# Path: spimagine/config/myconfigparser.py
# class MyConfigParser(SafeConfigParser):
#     def __init__(self, fName=None, defaults={}, create_file = True):
#         SafeConfigParser.__init__(self, defaults)
#         self.dummySection = "dummy"
# 
#         if fName:
#             if create_file and not os.path.exists(fName):
#                 try:
#                     logger.debug("trying to create %s"%fName)
#                     with open(fName,"w") as f:
#                         pass
#                 except Exception as e:
#                     logger.debug("failed to create %s"%fName)
#                     logger.debug(e)
#             self.read(fName)
# 
# 
# 
#     def read(self, fName):
#         try:
#             with open(fName) as f:
#                 if six.PY2:
#                     f = io.StringIO("[%s]\n%s" % (self.dummySection, f.read()))
#                     self.readfp(f)
#                 else:
#                     f = chain(("[%s]"%self.dummySection,), f)
#                     self.read_file(f)
# 
#         except Exception as e:
#             logger.debug(e)
# 
# 
# 
#     def get(self, key, defaultValue=None, **kwargs):
#         try:
#             val = SafeConfigParser.get(self, self.dummySection, key,**kwargs)
#             logger.debug("from config file: %s = %s " % (key, val))
# 
#             return val
#         except Exception as e:
#             logger.debug("%s (%s)" % (e, key))
#             return defaultValue


import sys
import os
import six
from spimagine.config.myconfigparser import MyConfigParser


def rel_path(name):
    return os.path.abspath(os.path.join(os.path.dirname(__file__),name))




def test_config():
    
    vals = {
        "id_platform": 99,
        "id_device" : 101,
        "colormap" : "foo",
        "texture_width" : 754,
        "window_width" : 123,
        "window_height": 123,
        "max_steps": 400}


# Path: spimagine/config/myconfigparser.py
# class MyConfigParser(SafeConfigParser):
#     def __init__(self, fName=None, defaults={}, create_file = True):
#         SafeConfigParser.__init__(self, defaults)
#         self.dummySection = "dummy"
# 
#         if fName:
#             if create_file and not os.path.exists(fName):
#                 try:
#                     logger.debug("trying to create %s"%fName)
#                     with open(fName,"w") as f:
#                         pass
#                 except Exception as e:
#                     logger.debug("failed to create %s"%fName)
#                     logger.debug(e)
#             self.read(fName)
# 
# 
# 
#     def read(self, fName):
#         try:
#             with open(fName) as f:
#                 if six.PY2:
#                     f = io.StringIO("[%s]\n%s" % (self.dummySection, f.read()))
#                     self.readfp(f)
#                 else:
#                     f = chain(("[%s]"%self.dummySection,), f)
#                     self.read_file(f)
# 
#         except Exception as e:
#             logger.debug(e)
# 
# 
# 
#     def get(self, key, defaultValue=None, **kwargs):
#         try:
#             val = SafeConfigParser.get(self, self.dummySection, key,**kwargs)
#             logger.debug("from config file: %s = %s " % (key, val))
# 
#             return val
#         except Exception as e:
#             logger.debug("%s (%s)" % (e, key))
#             return defaultValue


# Path: tests/test_config/test_config.py
import sys
import os
import six
from spimagine.config.myconfigparser import MyConfigParser



def rel_path(name):
    return os.path.abspath(os.path.join(os.path.dirname(__file__),name))




def test_config():
    
    vals = {
        "id_platform": 99,
        "id_device" : 101,
        "colormap" : "foo",
        "texture_width" : 754,
        "window_width" : 123,
        "window_height": 123,
        "max_steps": 400}


    text = "\n".join(["%s = %s "%(k,v) for k,v in six.iteritems(vals)])