예제 #1
0
파일: config.py 프로젝트: mlc0202/RepoGuard
 def __init__(self, parent, depth, main, indict=None, name=None):
     """
     Constructor.
     
     :param _profile: Profile section that has to be wrapped by this class.
     :type _profile: Section
     """
     
     Section.__init__(self, parent, depth + 1, main, indict, name)
예제 #2
0
파일: config.py 프로젝트: mlc0202/RepoGuard
 def __init__(self, parent, depth, main, indict=None, name=None):
     """
     Constructor.
     
     :param get_process: Process section.
     :type get_process: Section
     """
     
     Section.__init__(self, parent, depth + 1, main, indict, name)
예제 #3
0
    def __init__(self, parent, depth, main, indict=None, name=None):
        """
        Constructor.
        
        :param get_process: Process section.
        :type get_process: Section
        """

        Section.__init__(self, parent, depth + 1, main, indict, name)
예제 #4
0
    def __init__(self, parent, depth, main, indict=None, name=None):
        """
        Constructor.
        
        :param _profile: Profile section that has to be wrapped by this class.
        :type _profile: Section
        """

        Section.__init__(self, parent, depth + 1, main, indict, name)
예제 #5
0
파일: config.py 프로젝트: SunGuo/workflow
    def __init__(self, infile=None, options=None, configspec=None, encoding=None,
             interpolation=True, raise_errors=False, list_values=True,
             create_empty=False, file_error=False, stringify=True,
             indent_type=None, default_encoding=None, unrepr=False,
             write_empty_values=False, _inspec=False, parent_config=None):
        """
        Parse a config file or create a config file object.

        ``ConfigObj(infile=None, configspec=None, encoding=None,
                    interpolation=True, raise_errors=False, list_values=True,
                    create_empty=False, file_error=False, stringify=True,
                    indent_type=None, default_encoding=None, unrepr=False,
                    write_empty_values=False, _inspec=False)``
        """
        self._inspec = _inspec
        # init the superclass
        # this is the only change - we pass the parent configobj if
        # available, to have lookup use its values
        Section.__init__(self, parent_config or self, 0, self)


        infile = infile or []
        if options is not None:
            import warnings
            warnings.warn('Passing in an options dictionary to ConfigObj() is ',
                          'deprecated. Use **options instead.',
                          DeprecationWarning, stacklevel=2)

        _options = {'configspec': configspec,
                    'encoding': encoding, 'interpolation': interpolation,
                    'raise_errors': raise_errors, 'list_values': list_values,
                    'create_empty': create_empty, 'file_error': file_error,
                    'stringify': stringify, 'indent_type': indent_type,
                    'default_encoding': default_encoding, 'unrepr': unrepr,
                    'write_empty_values': write_empty_values}

        options = dict(options or {})
        options.update(_options)

        # XXXX this ignores an explicit list_values = True in combination
        # with _inspec. The user should *never* do that anyway, but still...
        if _inspec:
            options['list_values'] = False

        defaults = OPTION_DEFAULTS.copy()
        # TODO: check the values too.
        for entry in options:
            if entry not in defaults:
                raise TypeError('Unrecognised option "%s".' % entry)

        # Add any explicit options to the defaults
        defaults.update(options)
        self._initialise(defaults)
        configspec = defaults['configspec']
        self._original_configspec = configspec
        self._load(infile, configspec)
예제 #6
0
파일: config.py 프로젝트: insad/workflow-1
    def __init__(self, infile=None, options=None, configspec=None,
                 encoding=None, interpolation=True, raise_errors=False,
                 list_values=True, create_empty=False, file_error=False,
                 stringify=True, indent_type=None, default_encoding=None,
                 unrepr=False, write_empty_values=False, _inspec=False,
                 parent_config=None):
        """Parse a config file or create a config file object."""
        self._inspec = _inspec
        # init the superclass
        # this is the only change - we pass the parent configobj if
        # available, to have lookup use its values
        Section.__init__(self, parent_config or self, 0, self)

        infile = infile or []
        if options is not None:
            import warnings
            warnings.warn('Passing in an options dictionary to ConfigObj() ',
                          'is deprecated. Use **options instead.',
                          DeprecationWarning, stacklevel=2)

        _options = {'configspec': configspec,
                    'encoding': encoding, 'interpolation': interpolation,
                    'raise_errors': raise_errors, 'list_values': list_values,
                    'create_empty': create_empty, 'file_error': file_error,
                    'stringify': stringify, 'indent_type': indent_type,
                    'default_encoding': default_encoding, 'unrepr': unrepr,
                    'write_empty_values': write_empty_values}

        options = dict(options or {})
        options.update(_options)

        # XXXX this ignores an explicit list_values = True in combination
        # with _inspec. The user should *never* do that anyway, but still...
        if _inspec:
            options['list_values'] = False

        defaults = OPTION_DEFAULTS.copy()
        # TODO: check the values too.
        for entry in options:
            if entry not in defaults:
                raise TypeError('Unrecognised option "%s".' % entry)

        # Add any explicit options to the defaults
        defaults.update(options)
        self._initialise(defaults)
        configspec = defaults['configspec']
        self._original_configspec = configspec
        self._load(infile, configspec)
예제 #7
0
파일: config.py 프로젝트: mlc0202/RepoGuard
 def __init__(self, project):
     """
     Constructor.
     """
     Section.__init__(self, project.parent, project.depth, 
                      project.main, project, project.name)
예제 #8
0
 def __init__(self, project):
     """
     Constructor.
     """
     Section.__init__(self, project.parent, project.depth, project.main,
                      project, project.name)