diff options
author | monster <monster@ydb.tech> | 2022-07-07 14:41:37 +0300 |
---|---|---|
committer | monster <monster@ydb.tech> | 2022-07-07 14:41:37 +0300 |
commit | 06e5c21a835c0e923506c4ff27929f34e00761c2 (patch) | |
tree | 75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /contrib/python/iniconfig | |
parent | 03f024c4412e3aa613bb543cf1660176320ba8f4 (diff) | |
download | ydb-06e5c21a835c0e923506c4ff27929f34e00761c2.tar.gz |
fix ya.make
Diffstat (limited to 'contrib/python/iniconfig')
-rw-r--r-- | contrib/python/iniconfig/.dist-info/METADATA | 78 | ||||
-rw-r--r-- | contrib/python/iniconfig/.dist-info/top_level.txt | 1 | ||||
-rw-r--r-- | contrib/python/iniconfig/LICENSE | 19 | ||||
-rw-r--r-- | contrib/python/iniconfig/README.txt | 51 | ||||
-rw-r--r-- | contrib/python/iniconfig/iniconfig/__init__.py | 174 | ||||
-rw-r--r-- | contrib/python/iniconfig/iniconfig/__init__.pyi | 31 | ||||
-rw-r--r-- | contrib/python/iniconfig/iniconfig/py.typed | 0 | ||||
-rw-r--r-- | contrib/python/iniconfig/patches/01-arcadia.patch | 27 |
8 files changed, 0 insertions, 381 deletions
diff --git a/contrib/python/iniconfig/.dist-info/METADATA b/contrib/python/iniconfig/.dist-info/METADATA deleted file mode 100644 index c078a7532f..0000000000 --- a/contrib/python/iniconfig/.dist-info/METADATA +++ /dev/null @@ -1,78 +0,0 @@ -Metadata-Version: 2.1 -Name: iniconfig -Version: 1.1.1 -Summary: iniconfig: brain-dead simple config-ini parsing -Home-page: http://github.com/RonnyPfannschmidt/iniconfig -Author: Ronny Pfannschmidt, Holger Krekel -Author-email: opensource@ronnypfannschmidt.de, holger.krekel@gmail.com -License: MIT License -Platform: unix -Platform: linux -Platform: osx -Platform: cygwin -Platform: win32 -Classifier: Development Status :: 4 - Beta -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: POSIX -Classifier: Operating System :: Microsoft :: Windows -Classifier: Operating System :: MacOS :: MacOS X -Classifier: Topic :: Software Development :: Libraries -Classifier: Topic :: Utilities -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 3 - -iniconfig: brain-dead simple parsing of ini files -======================================================= - -iniconfig is a small and simple INI-file parser module -having a unique set of features: - -* tested against Python2.4 across to Python3.2, Jython, PyPy -* maintains order of sections and entries -* supports multi-line values with or without line-continuations -* supports "#" comments everywhere -* raises errors with proper line-numbers -* no bells and whistles like automatic substitutions -* iniconfig raises an Error if two sections have the same name. - -If you encounter issues or have feature wishes please report them to: - - http://github.com/RonnyPfannschmidt/iniconfig/issues - -Basic Example -=================================== - -If you have an ini file like this:: - - # content of example.ini - [section1] # comment - name1=value1 # comment - name1b=value1,value2 # comment - - [section2] - name2= - line1 - line2 - -then you can do:: - - >>> import iniconfig - >>> ini = iniconfig.IniConfig("example.ini") - >>> ini['section1']['name1'] # raises KeyError if not exists - 'value1' - >>> ini.get('section1', 'name1b', [], lambda x: x.split(",")) - ['value1', 'value2'] - >>> ini.get('section1', 'notexist', [], lambda x: x.split(",")) - [] - >>> [x.name for x in list(ini)] - ['section1', 'section2'] - >>> list(list(ini)[0].items()) - [('name1', 'value1'), ('name1b', 'value1,value2')] - >>> 'section1' in ini - True - >>> 'inexistendsection' in ini - False - - diff --git a/contrib/python/iniconfig/.dist-info/top_level.txt b/contrib/python/iniconfig/.dist-info/top_level.txt deleted file mode 100644 index 9dda53692d..0000000000 --- a/contrib/python/iniconfig/.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -iniconfig diff --git a/contrib/python/iniconfig/LICENSE b/contrib/python/iniconfig/LICENSE deleted file mode 100644 index 31ecdfb1db..0000000000 --- a/contrib/python/iniconfig/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - diff --git a/contrib/python/iniconfig/README.txt b/contrib/python/iniconfig/README.txt deleted file mode 100644 index 6bbad9a8d9..0000000000 --- a/contrib/python/iniconfig/README.txt +++ /dev/null @@ -1,51 +0,0 @@ -iniconfig: brain-dead simple parsing of ini files -======================================================= - -iniconfig is a small and simple INI-file parser module -having a unique set of features: - -* tested against Python2.4 across to Python3.2, Jython, PyPy -* maintains order of sections and entries -* supports multi-line values with or without line-continuations -* supports "#" comments everywhere -* raises errors with proper line-numbers -* no bells and whistles like automatic substitutions -* iniconfig raises an Error if two sections have the same name. - -If you encounter issues or have feature wishes please report them to: - - http://github.com/RonnyPfannschmidt/iniconfig/issues - -Basic Example -=================================== - -If you have an ini file like this:: - - # content of example.ini - [section1] # comment - name1=value1 # comment - name1b=value1,value2 # comment - - [section2] - name2= - line1 - line2 - -then you can do:: - - >>> import iniconfig - >>> ini = iniconfig.IniConfig("example.ini") - >>> ini['section1']['name1'] # raises KeyError if not exists - 'value1' - >>> ini.get('section1', 'name1b', [], lambda x: x.split(",")) - ['value1', 'value2'] - >>> ini.get('section1', 'notexist', [], lambda x: x.split(",")) - [] - >>> [x.name for x in list(ini)] - ['section1', 'section2'] - >>> list(list(ini)[0].items()) - [('name1', 'value1'), ('name1b', 'value1,value2')] - >>> 'section1' in ini - True - >>> 'inexistendsection' in ini - False diff --git a/contrib/python/iniconfig/iniconfig/__init__.py b/contrib/python/iniconfig/iniconfig/__init__.py deleted file mode 100644 index ae2046d2b5..0000000000 --- a/contrib/python/iniconfig/iniconfig/__init__.py +++ /dev/null @@ -1,174 +0,0 @@ -""" brain-dead simple parser for ini-style files. -(C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed -""" -import os -__all__ = ['IniConfig', 'ParseError'] - -COMMENTCHARS = "#;" - - -class ParseError(Exception): - def __init__(self, path, lineno, msg): - Exception.__init__(self, path, lineno, msg) - self.path = path - self.lineno = lineno - self.msg = msg - - def __str__(self): - return "%s:%s: %s" % (self.path, self.lineno+1, self.msg) - - -class SectionWrapper(object): - def __init__(self, config, name): - self.config = config - self.name = name - - def lineof(self, name): - return self.config.lineof(self.name, name) - - def get(self, key, default=None, convert=str): - return self.config.get(self.name, key, - convert=convert, default=default) - - def __getitem__(self, key): - return self.config.sections[self.name][key] - - def __iter__(self): - section = self.config.sections.get(self.name, []) - - def lineof(key): - return self.config.lineof(self.name, key) - for name in sorted(section, key=lineof): - yield name - - def items(self): - for name in self: - yield name, self[name] - - -class IniConfig(object): - def __init__(self, path, data=None): - self.path = str(path) # convenience - if data is None: - if os.path.basename(self.path).startswith('pkg:'): - import io, pkgutil - - basename = os.path.basename(self.path) - _, package, resource = basename.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: - f.close() - else: - tokens = self._parse(data.splitlines(True)) - - self._sources = {} - self.sections = {} - - for lineno, section, name, value in tokens: - if section is None: - self._raise(lineno, 'no section header defined') - self._sources[section, name] = lineno - if name is None: - if section in self.sections: - self._raise(lineno, 'duplicate section %r' % (section, )) - self.sections[section] = {} - else: - if name in self.sections[section]: - self._raise(lineno, 'duplicate name %r' % (name, )) - self.sections[section][name] = value - - def _raise(self, lineno, msg): - raise ParseError(self.path, lineno, msg) - - def _parse(self, line_iter): - result = [] - section = None - for lineno, line in enumerate(line_iter): - name, data = self._parseline(line, lineno) - # new value - if name is not None and data is not None: - result.append((lineno, section, name, data)) - # new section - elif name is not None and data is None: - if not name: - self._raise(lineno, 'empty section name') - section = name - result.append((lineno, section, None, None)) - # continuation - elif name is None and data is not None: - if not result: - self._raise(lineno, 'unexpected value continuation') - last = result.pop() - last_name, last_data = last[-2:] - if last_name is None: - self._raise(lineno, 'unexpected value continuation') - - if last_data: - data = '%s\n%s' % (last_data, data) - result.append(last[:-1] + (data,)) - return result - - def _parseline(self, line, lineno): - # blank lines - if iscommentline(line): - line = "" - else: - line = line.rstrip() - if not line: - return None, None - # section - if line[0] == '[': - realline = line - for c in COMMENTCHARS: - line = line.split(c)[0].rstrip() - if line[-1] == "]": - return line[1:-1], None - return None, realline.strip() - # value - elif not line[0].isspace(): - try: - name, value = line.split('=', 1) - if ":" in name: - raise ValueError() - except ValueError: - try: - name, value = line.split(":", 1) - except ValueError: - self._raise(lineno, 'unexpected line: %r' % line) - return name.strip(), value.strip() - # continuation - else: - return None, line.strip() - - def lineof(self, section, name=None): - lineno = self._sources.get((section, name)) - if lineno is not None: - return lineno + 1 - - def get(self, section, name, default=None, convert=str): - try: - return convert(self.sections[section][name]) - except KeyError: - return default - - def __getitem__(self, name): - if name not in self.sections: - raise KeyError(name) - return SectionWrapper(self, name) - - def __iter__(self): - for name in sorted(self.sections, key=self.lineof): - yield SectionWrapper(self, name) - - def __contains__(self, arg): - return arg in self.sections - - -def iscommentline(line): - c = line.lstrip()[:1] - return c in COMMENTCHARS diff --git a/contrib/python/iniconfig/iniconfig/__init__.pyi b/contrib/python/iniconfig/iniconfig/__init__.pyi deleted file mode 100644 index b6284bec3f..0000000000 --- a/contrib/python/iniconfig/iniconfig/__init__.pyi +++ /dev/null @@ -1,31 +0,0 @@ -from typing import Callable, Iterator, Mapping, Optional, Tuple, TypeVar, Union -from typing_extensions import Final - -_D = TypeVar('_D') -_T = TypeVar('_T') - -class ParseError(Exception): - # Private __init__. - path: Final[str] - lineno: Final[int] - msg: Final[str] - -class SectionWrapper: - # Private __init__. - config: Final[IniConfig] - name: Final[str] - def __getitem__(self, key: str) -> str: ... - def __iter__(self) -> Iterator[str]: ... - def get(self, key: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ... - def items(self) -> Iterator[Tuple[str, str]]: ... - def lineof(self, name: str) -> Optional[int]: ... - -class IniConfig: - path: Final[str] - sections: Final[Mapping[str, Mapping[str, str]]] - def __init__(self, path: str, data: Optional[str] = None): ... - def __contains__(self, arg: str) -> bool: ... - def __getitem__(self, name: str) -> SectionWrapper: ... - def __iter__(self) -> Iterator[SectionWrapper]: ... - def get(self, section: str, name: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ... - def lineof(self, section: str, name: Optional[str] = ...) -> Optional[int]: ... diff --git a/contrib/python/iniconfig/iniconfig/py.typed b/contrib/python/iniconfig/iniconfig/py.typed deleted file mode 100644 index e69de29bb2..0000000000 --- a/contrib/python/iniconfig/iniconfig/py.typed +++ /dev/null diff --git a/contrib/python/iniconfig/patches/01-arcadia.patch b/contrib/python/iniconfig/patches/01-arcadia.patch deleted file mode 100644 index 3c618d6f09..0000000000 --- a/contrib/python/iniconfig/patches/01-arcadia.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- contrib/python/iniconfig/iniconfig/__init__.py (index) -+++ contrib/python/iniconfig/iniconfig/__init__.py (working tree) -@@ -1,6 +1,7 @@ - """ brain-dead simple parser for ini-style files. - (C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed - """ -+import os - __all__ = ['IniConfig', 'ParseError'] - - COMMENTCHARS = "#;" -@@ -49,7 +50,15 @@ class IniConfig(object): - def __init__(self, path, data=None): - self.path = str(path) # convenience - if data is None: -- f = open(self.path) -+ if os.path.basename(self.path).startswith('pkg:'): -+ import io, pkgutil -+ -+ basename = os.path.basename(self.path) -+ _, package, resource = basename.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: |