Exemplo n.º 1
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)
Exemplo n.º 2
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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    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)
Exemplo n.º 7
0
 def __init__(self, project):
     """
     Constructor.
     """
     Section.__init__(self, project.parent, project.depth, 
                      project.main, project, project.name)
Exemplo n.º 8
0
 def __init__(self, project):
     """
     Constructor.
     """
     Section.__init__(self, project.parent, project.depth, project.main,
                      project, project.name)