123456789101112131415161718192021222324252627 |
- --- contrib/python/py/py3/py/_vendored_packages/iniconfig/__init__.py (working tree)
- +++ contrib/python/py/py3/py/_vendored_packages/iniconfig/__init__.py (index)
- @@ -1,6 +1,8 @@
- """ brain-dead simple parser for ini-style files.
- (C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed
- """
- +import io
- +
- __all__ = ['IniConfig', 'ParseError']
- COMMENTCHARS = "#;"
- @@ -49,7 +51,14 @@
- def __init__(self, path, data=None):
- self.path = str(path) # convenience
- if data is None:
- - f = open(self.path)
- + if self.path.startswith('pkg:'):
- + import pkgutil
- +
- + _, package, resource = self.path.split(':')
- + content = pkgutil.get_data(package, resource)
- + f = io.StringIO(content.decode('utf-8'))
- + else:
- + f = open(self.path)
- try:
- tokens = self._parse(iter(f))
- finally:
|