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

Method fromstring

Lib/test/test_configparser.py:1494–1507  ·  view source on GitHub ↗
(self, string, defaults=None)

Source from the content-addressed store, hash-verified

1492 config_class = configparser.ConfigParser
1493
1494 def fromstring(self, string, defaults=None):
1495 cf = self.newconfig(defaults)
1496 cf.read_string(string)
1497 cf_copy = self.newconfig()
1498 cf_copy.read_dict(cf)
1499 # we have to clean up option duplicates that appeared because of
1500 # the magic DEFAULTSECT behaviour.
1501 for section in cf_copy.values():
1502 if section.name == self.default_section:
1503 continue
1504 for default, value in cf[self.default_section].items():
1505 if section[default] == value:
1506 del section[default]
1507 return cf_copy
1508
1509
1510class FakeFile:

Callers 15

test_immutable_typesMethod · 0.45
test_parseliteralMethod · 0.45
test_writestringMethod · 0.45
test_attlist_defaultMethod · 0.45
test_late_tailMethod · 0.45
_get_errorMethod · 0.45

Calls 5

read_stringMethod · 0.80
read_dictMethod · 0.80
newconfigMethod · 0.45
valuesMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected