MCPcopy Index your code
hub / github.com/python/cpython / items

Method items

Lib/configparser.py:880–908  ·  view source on GitHub ↗

Return a list of (name, value) tuples for each option in a section. All % interpolations are expanded in the return values, based on the defaults passed into the constructor, unless the optional argument `raw` is true. Additional substitutions may be provided using the

(self, section=_UNSET, raw=False, vars=None)

Source from the content-addressed store, hash-verified

878 raw=raw, vars=vars, fallback=fallback, **kwargs)
879
880 def items(self, section=_UNSET, raw=False, vars=None):
881 """Return a list of (name, value) tuples for each option in a section.
882
883 All % interpolations are expanded in the return values, based on the
884 defaults passed into the constructor, unless the optional argument
885 `raw` is true. Additional substitutions may be provided using the
886 `vars` argument, which must be a dictionary whose contents overrides
887 any pre-existing defaults.
888
889 The section DEFAULT is special.
890 """
891 if section is _UNSET:
892 return super().items()
893 d = self._defaults.copy()
894 try:
895 d.update(self._sections[section])
896 except KeyError:
897 if section != self.default_section:
898 raise NoSectionError(section)
899 orig_keys = list(d.keys())
900 # Update with the entry specific variables
901 if vars:
902 for key, value in vars.items():
903 d[self.optionxform(key)] = value
904 value_getter = lambda option: self._interpolation.before_get(self,
905 section, option, d[option], d)
906 if raw:
907 value_getter = lambda option: d[option]
908 return [(option, value_getter(option)) for option in orig_keys]
909
910 def popitem(self):
911 """Remove a section from the parser and return it as

Callers 6

_interpolate_someMethod · 0.45
read_dictMethod · 0.45
writeMethod · 0.45
_read_defaultsMethod · 0.45
_unify_valuesMethod · 0.45

Calls 8

optionxformMethod · 0.95
superClass · 0.85
NoSectionErrorClass · 0.85
listClass · 0.85
copyMethod · 0.45
updateMethod · 0.45
keysMethod · 0.45
before_getMethod · 0.45

Tested by

no test coverage detected