Skip to content

Commit

Permalink
👹 Feed the hobgoblins (delint).
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Oct 9, 2020
1 parent b6572f7 commit ac8cb18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 9 additions & 7 deletions src/backports/configparser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

"""Configuration file parser.
A configuration file consists of sections, lead by a "[section]" header,
Expand Down Expand Up @@ -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):
Expand Down
3 changes: 1 addition & 2 deletions src/test_configparser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

import io
import os
import textwrap
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit ac8cb18

Please sign in to comment.