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)
| 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 |
no test coverage detected