def __init__(self, pyfilename=None, **kwargs):
        """Loads configuration from a python source file. Any variables
        defined in that file will be interpreted as configuration
        keys. The class ``Subsection`` is automatically imported into
        the context when the file is executed, and represents a
        subsection of the configuration. Any attribute set on such an
        object is treated as a configuration parameter on that
        subsection.

        .. note::

           The python source file is loaded and interpreted once, when
           creating the PyFile object. If a value is set by
           eg. calling a function, that function will only be called
           at load time, not when accessing the parameter.

        :param pyfile: The name of a file containing valid python code.
        :type pyfile: str

        """
        super(PyFile, self).__init__(**kwargs)
        self.source = Subsection()
        if pyfilename:
            with open(pyfilename) as fp:
                pycode = compile(fp.read(), pyfilename, 'exec')
            six.exec_(pycode, globals(), self.source)
        elif kwargs.get('dict'):
            self.source = kwargs['dict']
def __init__ ( self , pyfilename = None , ** kwargs ) : super ( PyFile , self ) . __init__ ( ** kwargs ) self . source = Subsection ( ) if pyfilename : with open ( pyfilename ) as fp : pycode = compile ( fp . read ( ) , pyfilename , 'exec' ) six . exec_ ( pycode , globals ( ) , self . source ) elif kwargs . get ( 'dict' ) : self . source = kwargs [ 'dict' ]
Loads configuration from a python source file. Any variables
        defined in that file will be interpreted as configuration
        keys. The class ``Subsection`` is automatically imported into
        the context when the file is executed, and represents a
        subsection of the configuration. Any attribute set on such an
        object is treated as a configuration parameter on that
        subsection.

        .. note::

           The python source file is loaded and interpreted once, when
           creating the PyFile object. If a value is set by
           eg. calling a function, that function will only be called
           at load time, not when accessing the parameter.

        :param pyfile: The name of a file containing valid python code.
        :type pyfile: str