diff --git a/src/backports/configparser/__init__.py b/src/backports/configparser/__init__.py index d1dd937..0d7cbe0 100644 --- a/src/backports/configparser/__init__.py +++ b/src/backports/configparser/__init__.py @@ -1,5 +1,3 @@ -# flake8: noqa - """Configuration file parser. A configuration file consists of sections, lead by a "[section]" header, @@ -918,11 +916,15 @@ def items(self, section=_UNSET, raw=False, vars=None): if vars: for key, value in vars.items(): d[self.optionxform(key)] = value - value_getter = lambda option: self._interpolation.before_get( - self, section, option, d[option], d - ) - if raw: - value_getter = lambda option: d[option] + + def value_getter_interp(option): + return self._interpolation.before_get(self, section, option, d[option], d) + + def value_getter_raw(option): + return d[option] + + value_getter = value_getter_raw if raw else value_getter_interp + return [(option, value_getter(option)) for option in orig_keys] def popitem(self): diff --git a/src/test_configparser.py b/src/test_configparser.py index 80ab36f..b32c45d 100644 --- a/src/test_configparser.py +++ b/src/test_configparser.py @@ -1,5 +1,3 @@ -# flake8: noqa - import io import os import textwrap @@ -747,6 +745,7 @@ def test_set_string_types(self): ) # Check that we don't get an exception when setting values in # an existing section using strings: + class mystr(str): pass