Hello community,
here is the log from the commit of package python-iniconfig for
openSUSE:Factory checked in at 2020-11-13 18:54:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-iniconfig (Old)
and /work/SRC/openSUSE:Factory/.python-iniconfig.new.24930 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-iniconfig"
Fri Nov 13 18:54:00 2020 rev:2 rq:847414 version:1.1.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-iniconfig/python-iniconfig.changes
2020-08-25 09:39:34.796234509 +0200
+++
/work/SRC/openSUSE:Factory/.python-iniconfig.new.24930/python-iniconfig.changes
2020-11-13 18:54:22.369795777 +0100
@@ -1,0 +2,7 @@
+Tue Nov 10 08:00:10 UTC 2020 - Dirk Mueller <[email protected]>
+
+- update to 1.1.1:
+ * fix version determination (thanks @florimondmanca)
+ * typing stubs (thanks @bluetech)
+
+-------------------------------------------------------------------
Old:
----
iniconfig-1.0.1.tar.gz
New:
----
iniconfig-1.1.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-iniconfig.spec ++++++
--- /var/tmp/diff_new_pack.RoqhUl/_old 2020-11-13 18:54:25.233798961 +0100
+++ /var/tmp/diff_new_pack.RoqhUl/_new 2020-11-13 18:54:25.237798965 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package python-iniconfig
+# spec file for package python
#
# Copyright (c) 2020 SUSE LLC
#
@@ -26,7 +26,7 @@
%bcond_with test
%endif
Name: python-iniconfig%{psuffix}
-Version: 1.0.1
+Version: 1.1.1
Release: 0
Summary: iniconfig: brain-dead simple config-ini parsing
License: MIT
++++++ iniconfig-1.0.1.tar.gz -> iniconfig-1.1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/CHANGELOG
new/iniconfig-1.1.1/CHANGELOG
--- old/iniconfig-1.0.1/CHANGELOG 2020-07-31 10:46:47.000000000 +0200
+++ new/iniconfig-1.1.1/CHANGELOG 2020-10-14 12:19:54.000000000 +0200
@@ -1,3 +1,18 @@
+1.1.1
+=========
+
+* fix version determination (thanks @florimondmanca)
+
+1.1.0
+=====
+
+- typing stubs (thanks @bluetech)
+- ci fixes
+
+1.0.1
+======
+
+pytest 5+ support
1.0
====
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/MANIFEST.in
new/iniconfig-1.1.1/MANIFEST.in
--- old/iniconfig-1.0.1/MANIFEST.in 2020-07-31 10:46:47.000000000 +0200
+++ new/iniconfig-1.1.1/MANIFEST.in 2020-10-14 12:19:54.000000000 +0200
@@ -1,3 +1,5 @@
include LICENSE
include example.ini
include tox.ini
+include src/iniconfig/py.typed
+recursive-include src *.pyi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/PKG-INFO new/iniconfig-1.1.1/PKG-INFO
--- old/iniconfig-1.0.1/PKG-INFO 2020-07-31 10:57:47.918844500 +0200
+++ new/iniconfig-1.1.1/PKG-INFO 2020-10-14 12:20:18.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: iniconfig
-Version: 1.0.1
+Version: 1.1.1
Summary: iniconfig: brain-dead simple config-ini parsing
Home-page: http://github.com/RonnyPfannschmidt/iniconfig
Author: Ronny Pfannschmidt, Holger Krekel
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/conftest.py
new/iniconfig-1.1.1/conftest.py
--- old/iniconfig-1.0.1/conftest.py 2020-07-31 10:46:47.000000000 +0200
+++ new/iniconfig-1.1.1/conftest.py 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-
-option_doctestglob = "README.txt"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/iniconfig.egg-info/PKG-INFO
new/iniconfig-1.1.1/iniconfig.egg-info/PKG-INFO
--- old/iniconfig-1.0.1/iniconfig.egg-info/PKG-INFO 2020-07-31
10:57:47.000000000 +0200
+++ new/iniconfig-1.1.1/iniconfig.egg-info/PKG-INFO 1970-01-01
01:00:00.000000000 +0100
@@ -1,76 +0,0 @@
-Metadata-Version: 1.1
-Name: iniconfig
-Version: 1.0.1
-Summary: iniconfig: brain-dead simple config-ini parsing
-Home-page: http://github.com/RonnyPfannschmidt/iniconfig
-Author: Ronny Pfannschmidt, Holger Krekel
-Author-email: [email protected], [email protected]
-License: MIT License
-Description: 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
-
-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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/iniconfig.egg-info/SOURCES.txt
new/iniconfig-1.1.1/iniconfig.egg-info/SOURCES.txt
--- old/iniconfig-1.0.1/iniconfig.egg-info/SOURCES.txt 2020-07-31
10:57:47.000000000 +0200
+++ new/iniconfig-1.1.1/iniconfig.egg-info/SOURCES.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1,19 +0,0 @@
-.gitignore
-.hgignore
-.landscape.yml
-.travis.yml
-CHANGELOG
-LICENSE
-MANIFEST.in
-README.txt
-conftest.py
-example.ini
-iniconfig.py
-pyproject.toml
-setup.py
-test_iniconfig.py
-tox.ini
-iniconfig.egg-info/PKG-INFO
-iniconfig.egg-info/SOURCES.txt
-iniconfig.egg-info/dependency_links.txt
-iniconfig.egg-info/top_level.txt
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/iniconfig-1.0.1/iniconfig.egg-info/dependency_links.txt
new/iniconfig-1.1.1/iniconfig.egg-info/dependency_links.txt
--- old/iniconfig-1.0.1/iniconfig.egg-info/dependency_links.txt 2020-07-31
10:57:47.000000000 +0200
+++ new/iniconfig-1.1.1/iniconfig.egg-info/dependency_links.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/iniconfig.egg-info/top_level.txt
new/iniconfig-1.1.1/iniconfig.egg-info/top_level.txt
--- old/iniconfig-1.0.1/iniconfig.egg-info/top_level.txt 2020-07-31
10:57:47.000000000 +0200
+++ new/iniconfig-1.1.1/iniconfig.egg-info/top_level.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-iniconfig
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/iniconfig.py
new/iniconfig-1.1.1/iniconfig.py
--- old/iniconfig-1.0.1/iniconfig.py 2020-07-31 10:46:47.000000000 +0200
+++ new/iniconfig-1.1.1/iniconfig.py 1970-01-01 01:00:00.000000000 +0100
@@ -1,165 +0,0 @@
-""" brain-dead simple parser for ini-style files.
-(C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed
-"""
-__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:
- 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/setup.cfg
new/iniconfig-1.1.1/setup.cfg
--- old/iniconfig-1.0.1/setup.cfg 2020-07-31 10:57:47.918844500 +0200
+++ new/iniconfig-1.1.1/setup.cfg 2020-10-14 12:20:18.000000000 +0200
@@ -1,3 +1,6 @@
+[bdist_wheel]
+universal = 1
+
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/setup.py new/iniconfig-1.1.1/setup.py
--- old/iniconfig-1.0.1/setup.py 2020-07-31 10:56:49.000000000 +0200
+++ new/iniconfig-1.1.1/setup.py 2020-10-14 12:19:54.000000000 +0200
@@ -14,9 +14,11 @@
readme = fp.read()
setup(
name='iniconfig',
- py_modules=['iniconfig'],
+ packages=['iniconfig'],
+ package_dir={'': 'src'},
description='iniconfig: brain-dead simple config-ini parsing',
long_description=readme,
+ use_scm_version=True,
url='http://github.com/RonnyPfannschmidt/iniconfig',
license='MIT License',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
@@ -36,6 +38,8 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
],
+ include_package_data=True,
+ zip_safe=False,
)
if __name__ == '__main__':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/src/iniconfig/__init__.py
new/iniconfig-1.1.1/src/iniconfig/__init__.py
--- old/iniconfig-1.0.1/src/iniconfig/__init__.py 1970-01-01
01:00:00.000000000 +0100
+++ new/iniconfig-1.1.1/src/iniconfig/__init__.py 2020-10-14
12:19:54.000000000 +0200
@@ -0,0 +1,165 @@
+""" brain-dead simple parser for ini-style files.
+(C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed
+"""
+__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:
+ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/src/iniconfig/__init__.pyi
new/iniconfig-1.1.1/src/iniconfig/__init__.pyi
--- old/iniconfig-1.0.1/src/iniconfig/__init__.pyi 1970-01-01
01:00:00.000000000 +0100
+++ new/iniconfig-1.1.1/src/iniconfig/__init__.pyi 2020-10-14
12:19:54.000000000 +0200
@@ -0,0 +1,31 @@
+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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/src/iniconfig.egg-info/PKG-INFO
new/iniconfig-1.1.1/src/iniconfig.egg-info/PKG-INFO
--- old/iniconfig-1.0.1/src/iniconfig.egg-info/PKG-INFO 1970-01-01
01:00:00.000000000 +0100
+++ new/iniconfig-1.1.1/src/iniconfig.egg-info/PKG-INFO 2020-10-14
12:20:17.000000000 +0200
@@ -0,0 +1,76 @@
+Metadata-Version: 1.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: [email protected], [email protected]
+License: MIT License
+Description: 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
+
+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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/src/iniconfig.egg-info/SOURCES.txt
new/iniconfig-1.1.1/src/iniconfig.egg-info/SOURCES.txt
--- old/iniconfig-1.0.1/src/iniconfig.egg-info/SOURCES.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/iniconfig-1.1.1/src/iniconfig.egg-info/SOURCES.txt 2020-10-14
12:20:18.000000000 +0200
@@ -0,0 +1,23 @@
+.gitignore
+.hgignore
+.landscape.yml
+.travis.yml
+CHANGELOG
+LICENSE
+MANIFEST.in
+README.txt
+example.ini
+pyproject.toml
+setup.cfg
+setup.py
+tox.ini
+src/iniconfig/__init__.py
+src/iniconfig/__init__.pyi
+src/iniconfig/py.typed
+src/iniconfig.egg-info/PKG-INFO
+src/iniconfig.egg-info/SOURCES.txt
+src/iniconfig.egg-info/dependency_links.txt
+src/iniconfig.egg-info/not-zip-safe
+src/iniconfig.egg-info/top_level.txt
+testing/conftest.py
+testing/test_iniconfig.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/iniconfig-1.0.1/src/iniconfig.egg-info/dependency_links.txt
new/iniconfig-1.1.1/src/iniconfig.egg-info/dependency_links.txt
--- old/iniconfig-1.0.1/src/iniconfig.egg-info/dependency_links.txt
1970-01-01 01:00:00.000000000 +0100
+++ new/iniconfig-1.1.1/src/iniconfig.egg-info/dependency_links.txt
2020-10-14 12:20:17.000000000 +0200
@@ -0,0 +1 @@
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/src/iniconfig.egg-info/not-zip-safe
new/iniconfig-1.1.1/src/iniconfig.egg-info/not-zip-safe
--- old/iniconfig-1.0.1/src/iniconfig.egg-info/not-zip-safe 1970-01-01
01:00:00.000000000 +0100
+++ new/iniconfig-1.1.1/src/iniconfig.egg-info/not-zip-safe 2020-10-14
12:20:17.000000000 +0200
@@ -0,0 +1 @@
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/src/iniconfig.egg-info/top_level.txt
new/iniconfig-1.1.1/src/iniconfig.egg-info/top_level.txt
--- old/iniconfig-1.0.1/src/iniconfig.egg-info/top_level.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/iniconfig-1.1.1/src/iniconfig.egg-info/top_level.txt 2020-10-14
12:20:17.000000000 +0200
@@ -0,0 +1 @@
+iniconfig
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/test_iniconfig.py
new/iniconfig-1.1.1/test_iniconfig.py
--- old/iniconfig-1.0.1/test_iniconfig.py 2020-07-31 10:46:47.000000000
+0200
+++ new/iniconfig-1.1.1/test_iniconfig.py 1970-01-01 01:00:00.000000000
+0100
@@ -1,314 +0,0 @@
-import py
-import pytest
-from iniconfig import IniConfig, ParseError, __all__ as ALL
-from iniconfig import iscommentline
-from textwrap import dedent
-
-
-check_tokens = {
- 'section': (
- '[section]',
- [(0, 'section', None, None)]
- ),
- 'value': (
- 'value = 1',
- [(0, None, 'value', '1')]
- ),
- 'value in section': (
- '[section]\nvalue=1',
- [(0, 'section', None, None), (1, 'section', 'value', '1')]
- ),
- 'value with continuation': (
- 'names =\n Alice\n Bob',
- [(0, None, 'names', 'Alice\nBob')]
- ),
- 'value with aligned continuation': (
- 'names = Alice\n'
- ' Bob',
- [(0, None, 'names', 'Alice\nBob')]
- ),
- 'blank line': (
- '[section]\n\nvalue=1',
- [(0, 'section', None, None), (2, 'section', 'value', '1')]
- ),
- 'comment': (
- '# comment',
- []
- ),
- 'comment on value': (
- 'value = 1',
- [(0, None, 'value', '1')]
- ),
-
- 'comment on section': (
- '[section] #comment',
- [(0, 'section', None, None)]
- ),
- 'comment2': (
- '; comment',
- []
- ),
-
- 'comment2 on section': (
- '[section] ;comment',
- [(0, 'section', None, None)]
- ),
- 'pseudo section syntax in value': (
- 'name = value []',
- [(0, None, 'name', 'value []')]
- ),
- 'assignment in value': (
- 'value = x = 3',
- [(0, None, 'value', 'x = 3')]
- ),
- 'use of colon for name-values': (
- 'name: y',
- [(0, None, 'name', 'y')]
- ),
- 'use of colon without space': (
- 'value:y=5',
- [(0, None, 'value', 'y=5')]
- ),
- 'equality gets precedence': (
- 'value=xyz:5',
- [(0, None, 'value', 'xyz:5')]
- ),
-
-}
-
-
[email protected](params=sorted(check_tokens))
-def input_expected(request):
- return check_tokens[request.param]
-
-
[email protected]
-def input(input_expected):
- return input_expected[0]
-
-
[email protected]
-def expected(input_expected):
- return input_expected[1]
-
-
-def parse(input):
- # only for testing purposes - _parse() does not use state except path
- ini = object.__new__(IniConfig)
- ini.path = "sample"
- return ini._parse(input.splitlines(True))
-
-
-def parse_a_error(input):
- return py.test.raises(ParseError, parse, input)
-
-
-def test_tokenize(input, expected):
- parsed = parse(input)
- assert parsed == expected
-
-
-def test_parse_empty():
- parsed = parse("")
- assert not parsed
- ini = IniConfig("sample", "")
- assert not ini.sections
-
-
-def test_ParseError():
- e = ParseError("filename", 0, "hello")
- assert str(e) == "filename:1: hello"
-
-
-def test_continuation_needs_perceeding_token():
- excinfo = parse_a_error(' Foo')
- assert excinfo.value.lineno == 0
-
-
-def test_continuation_cant_be_after_section():
- excinfo = parse_a_error('[section]\n Foo')
- assert excinfo.value.lineno == 1
-
-
-def test_section_cant_be_empty():
- excinfo = parse_a_error('[]')
- assert excinfo.value.lineno == 0
-
-
[email protected]('line', [
- '!!',
- ])
-def test_error_on_weird_lines(line):
- parse_a_error(line)
-
-
-def test_iniconfig_from_file(tmpdir):
- path = tmpdir/'test.txt'
- path.write('[metadata]\nname=1')
-
- config = IniConfig(path=path)
- assert list(config.sections) == ['metadata']
- config = IniConfig(path, "[diff]")
- assert list(config.sections) == ['diff']
- with pytest.raises(TypeError):
- IniConfig(data=path.read())
-
-
-def test_iniconfig_section_first(tmpdir):
- with pytest.raises(ParseError) as excinfo:
- IniConfig("x", data='name=1')
- assert excinfo.value.msg == "no section header defined"
-
-
-def test_iniconig_section_duplicate_fails():
- with pytest.raises(ParseError) as excinfo:
- IniConfig("x", data='[section]\n[section]')
- assert 'duplicate section' in str(excinfo.value)
-
-
-def test_iniconfig_duplicate_key_fails():
- with pytest.raises(ParseError) as excinfo:
- IniConfig("x", data='[section]\nname = Alice\nname = bob')
-
- assert 'duplicate name' in str(excinfo.value)
-
-
-def test_iniconfig_lineof():
- config = IniConfig("x.ini", data=(
- '[section]\n'
- 'value = 1\n'
- '[section2]\n'
- '# comment\n'
- 'value =2'
- ))
-
- assert config.lineof('missing') is None
- assert config.lineof('section') == 1
- assert config.lineof('section2') == 3
- assert config.lineof('section', 'value') == 2
- assert config.lineof('section2', 'value') == 5
-
- assert config['section'].lineof('value') == 2
- assert config['section2'].lineof('value') == 5
-
-
-def test_iniconfig_get_convert():
- config = IniConfig("x", data='[section]\nint = 1\nfloat = 1.1')
- assert config.get('section', 'int') == '1'
- assert config.get('section', 'int', convert=int) == 1
-
-
-def test_iniconfig_get_missing():
- config = IniConfig("x", data='[section]\nint = 1\nfloat = 1.1')
- assert config.get('section', 'missing', default=1) == 1
- assert config.get('section', 'missing') is None
-
-
-def test_section_get():
- config = IniConfig("x", data='[section]\nvalue=1')
- section = config['section']
- assert section.get('value', convert=int) == 1
- assert section.get('value', 1) == "1"
- assert section.get('missing', 2) == 2
-
-
-def test_missing_section():
- config = IniConfig("x", data='[section]\nvalue=1')
- with pytest.raises(KeyError):
- config["other"]
-
-
-def test_section_getitem():
- config = IniConfig("x", data='[section]\nvalue=1')
- assert config['section']['value'] == '1'
- assert config['section']['value'] == '1'
-
-
-def test_section_iter():
- config = IniConfig("x", data='[section]\nvalue=1')
- names = list(config['section'])
- assert names == ['value']
- items = list(config['section'].items())
- assert items == [('value', '1')]
-
-
-def test_config_iter():
- config = IniConfig("x.ini", data=dedent('''
- [section1]
- value=1
- [section2]
- value=2
- '''))
- l = list(config)
- assert len(l) == 2
- assert l[0].name == 'section1'
- assert l[0]['value'] == '1'
- assert l[1].name == 'section2'
- assert l[1]['value'] == '2'
-
-
-def test_config_contains():
- config = IniConfig("x.ini", data=dedent('''
- [section1]
- value=1
- [section2]
- value=2
- '''))
- assert 'xyz' not in config
- assert 'section1' in config
- assert 'section2' in config
-
-
-def test_iter_file_order():
- config = IniConfig("x.ini", data="""
-[section2] #cpython dict ordered before section
-value = 1
-value2 = 2 # dict ordered before value
-[section]
-a = 1
-b = 2
-""")
- l = list(config)
- secnames = [x.name for x in l]
- assert secnames == ['section2', 'section']
- assert list(config['section2']) == ['value', 'value2']
- assert list(config['section']) == ['a', 'b']
-
-
-def test_example_pypirc():
- config = IniConfig("pypirc", data=dedent('''
- [distutils]
- index-servers =
- pypi
- other
-
- [pypi]
- repository: <repository-url>
- username: <username>
- password: <password>
-
- [other]
- repository: http://example.com/pypi
- username: <username>
- password: <password>
- '''))
- distutils, pypi, other = list(config)
- assert distutils["index-servers"] == "pypi\nother"
- assert pypi['repository'] == '<repository-url>'
- assert pypi['username'] == '<username>'
- assert pypi['password'] == '<password>'
- assert ['repository', 'username', 'password'] == list(other)
-
-
-def test_api_import():
- assert ALL == ['IniConfig', 'ParseError']
-
-
[email protected]("line", [
- "#qwe",
- " #qwe",
- ";qwe",
- " ;qwe",
-])
-def test_iscommentline_true(line):
- assert iscommentline(line)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/testing/conftest.py
new/iniconfig-1.1.1/testing/conftest.py
--- old/iniconfig-1.0.1/testing/conftest.py 1970-01-01 01:00:00.000000000
+0100
+++ new/iniconfig-1.1.1/testing/conftest.py 2020-10-14 12:19:54.000000000
+0200
@@ -0,0 +1,2 @@
+
+option_doctestglob = "README.txt"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/testing/test_iniconfig.py
new/iniconfig-1.1.1/testing/test_iniconfig.py
--- old/iniconfig-1.0.1/testing/test_iniconfig.py 1970-01-01
01:00:00.000000000 +0100
+++ new/iniconfig-1.1.1/testing/test_iniconfig.py 2020-10-14
12:19:54.000000000 +0200
@@ -0,0 +1,314 @@
+import py
+import pytest
+from iniconfig import IniConfig, ParseError, __all__ as ALL
+from iniconfig import iscommentline
+from textwrap import dedent
+
+
+check_tokens = {
+ 'section': (
+ '[section]',
+ [(0, 'section', None, None)]
+ ),
+ 'value': (
+ 'value = 1',
+ [(0, None, 'value', '1')]
+ ),
+ 'value in section': (
+ '[section]\nvalue=1',
+ [(0, 'section', None, None), (1, 'section', 'value', '1')]
+ ),
+ 'value with continuation': (
+ 'names =\n Alice\n Bob',
+ [(0, None, 'names', 'Alice\nBob')]
+ ),
+ 'value with aligned continuation': (
+ 'names = Alice\n'
+ ' Bob',
+ [(0, None, 'names', 'Alice\nBob')]
+ ),
+ 'blank line': (
+ '[section]\n\nvalue=1',
+ [(0, 'section', None, None), (2, 'section', 'value', '1')]
+ ),
+ 'comment': (
+ '# comment',
+ []
+ ),
+ 'comment on value': (
+ 'value = 1',
+ [(0, None, 'value', '1')]
+ ),
+
+ 'comment on section': (
+ '[section] #comment',
+ [(0, 'section', None, None)]
+ ),
+ 'comment2': (
+ '; comment',
+ []
+ ),
+
+ 'comment2 on section': (
+ '[section] ;comment',
+ [(0, 'section', None, None)]
+ ),
+ 'pseudo section syntax in value': (
+ 'name = value []',
+ [(0, None, 'name', 'value []')]
+ ),
+ 'assignment in value': (
+ 'value = x = 3',
+ [(0, None, 'value', 'x = 3')]
+ ),
+ 'use of colon for name-values': (
+ 'name: y',
+ [(0, None, 'name', 'y')]
+ ),
+ 'use of colon without space': (
+ 'value:y=5',
+ [(0, None, 'value', 'y=5')]
+ ),
+ 'equality gets precedence': (
+ 'value=xyz:5',
+ [(0, None, 'value', 'xyz:5')]
+ ),
+
+}
+
+
[email protected](params=sorted(check_tokens))
+def input_expected(request):
+ return check_tokens[request.param]
+
+
[email protected]
+def input(input_expected):
+ return input_expected[0]
+
+
[email protected]
+def expected(input_expected):
+ return input_expected[1]
+
+
+def parse(input):
+ # only for testing purposes - _parse() does not use state except path
+ ini = object.__new__(IniConfig)
+ ini.path = "sample"
+ return ini._parse(input.splitlines(True))
+
+
+def parse_a_error(input):
+ return py.test.raises(ParseError, parse, input)
+
+
+def test_tokenize(input, expected):
+ parsed = parse(input)
+ assert parsed == expected
+
+
+def test_parse_empty():
+ parsed = parse("")
+ assert not parsed
+ ini = IniConfig("sample", "")
+ assert not ini.sections
+
+
+def test_ParseError():
+ e = ParseError("filename", 0, "hello")
+ assert str(e) == "filename:1: hello"
+
+
+def test_continuation_needs_perceeding_token():
+ excinfo = parse_a_error(' Foo')
+ assert excinfo.value.lineno == 0
+
+
+def test_continuation_cant_be_after_section():
+ excinfo = parse_a_error('[section]\n Foo')
+ assert excinfo.value.lineno == 1
+
+
+def test_section_cant_be_empty():
+ excinfo = parse_a_error('[]')
+ assert excinfo.value.lineno == 0
+
+
[email protected]('line', [
+ '!!',
+ ])
+def test_error_on_weird_lines(line):
+ parse_a_error(line)
+
+
+def test_iniconfig_from_file(tmpdir):
+ path = tmpdir/'test.txt'
+ path.write('[metadata]\nname=1')
+
+ config = IniConfig(path=path)
+ assert list(config.sections) == ['metadata']
+ config = IniConfig(path, "[diff]")
+ assert list(config.sections) == ['diff']
+ with pytest.raises(TypeError):
+ IniConfig(data=path.read())
+
+
+def test_iniconfig_section_first(tmpdir):
+ with pytest.raises(ParseError) as excinfo:
+ IniConfig("x", data='name=1')
+ assert excinfo.value.msg == "no section header defined"
+
+
+def test_iniconig_section_duplicate_fails():
+ with pytest.raises(ParseError) as excinfo:
+ IniConfig("x", data='[section]\n[section]')
+ assert 'duplicate section' in str(excinfo.value)
+
+
+def test_iniconfig_duplicate_key_fails():
+ with pytest.raises(ParseError) as excinfo:
+ IniConfig("x", data='[section]\nname = Alice\nname = bob')
+
+ assert 'duplicate name' in str(excinfo.value)
+
+
+def test_iniconfig_lineof():
+ config = IniConfig("x.ini", data=(
+ '[section]\n'
+ 'value = 1\n'
+ '[section2]\n'
+ '# comment\n'
+ 'value =2'
+ ))
+
+ assert config.lineof('missing') is None
+ assert config.lineof('section') == 1
+ assert config.lineof('section2') == 3
+ assert config.lineof('section', 'value') == 2
+ assert config.lineof('section2', 'value') == 5
+
+ assert config['section'].lineof('value') == 2
+ assert config['section2'].lineof('value') == 5
+
+
+def test_iniconfig_get_convert():
+ config = IniConfig("x", data='[section]\nint = 1\nfloat = 1.1')
+ assert config.get('section', 'int') == '1'
+ assert config.get('section', 'int', convert=int) == 1
+
+
+def test_iniconfig_get_missing():
+ config = IniConfig("x", data='[section]\nint = 1\nfloat = 1.1')
+ assert config.get('section', 'missing', default=1) == 1
+ assert config.get('section', 'missing') is None
+
+
+def test_section_get():
+ config = IniConfig("x", data='[section]\nvalue=1')
+ section = config['section']
+ assert section.get('value', convert=int) == 1
+ assert section.get('value', 1) == "1"
+ assert section.get('missing', 2) == 2
+
+
+def test_missing_section():
+ config = IniConfig("x", data='[section]\nvalue=1')
+ with pytest.raises(KeyError):
+ config["other"]
+
+
+def test_section_getitem():
+ config = IniConfig("x", data='[section]\nvalue=1')
+ assert config['section']['value'] == '1'
+ assert config['section']['value'] == '1'
+
+
+def test_section_iter():
+ config = IniConfig("x", data='[section]\nvalue=1')
+ names = list(config['section'])
+ assert names == ['value']
+ items = list(config['section'].items())
+ assert items == [('value', '1')]
+
+
+def test_config_iter():
+ config = IniConfig("x.ini", data=dedent('''
+ [section1]
+ value=1
+ [section2]
+ value=2
+ '''))
+ l = list(config)
+ assert len(l) == 2
+ assert l[0].name == 'section1'
+ assert l[0]['value'] == '1'
+ assert l[1].name == 'section2'
+ assert l[1]['value'] == '2'
+
+
+def test_config_contains():
+ config = IniConfig("x.ini", data=dedent('''
+ [section1]
+ value=1
+ [section2]
+ value=2
+ '''))
+ assert 'xyz' not in config
+ assert 'section1' in config
+ assert 'section2' in config
+
+
+def test_iter_file_order():
+ config = IniConfig("x.ini", data="""
+[section2] #cpython dict ordered before section
+value = 1
+value2 = 2 # dict ordered before value
+[section]
+a = 1
+b = 2
+""")
+ l = list(config)
+ secnames = [x.name for x in l]
+ assert secnames == ['section2', 'section']
+ assert list(config['section2']) == ['value', 'value2']
+ assert list(config['section']) == ['a', 'b']
+
+
+def test_example_pypirc():
+ config = IniConfig("pypirc", data=dedent('''
+ [distutils]
+ index-servers =
+ pypi
+ other
+
+ [pypi]
+ repository: <repository-url>
+ username: <username>
+ password: <password>
+
+ [other]
+ repository: http://example.com/pypi
+ username: <username>
+ password: <password>
+ '''))
+ distutils, pypi, other = list(config)
+ assert distutils["index-servers"] == "pypi\nother"
+ assert pypi['repository'] == '<repository-url>'
+ assert pypi['username'] == '<username>'
+ assert pypi['password'] == '<password>'
+ assert ['repository', 'username', 'password'] == list(other)
+
+
+def test_api_import():
+ assert ALL == ['IniConfig', 'ParseError']
+
+
[email protected]("line", [
+ "#qwe",
+ " #qwe",
+ ";qwe",
+ " ;qwe",
+])
+def test_iscommentline_true(line):
+ assert iscommentline(line)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniconfig-1.0.1/tox.ini new/iniconfig-1.1.1/tox.ini
--- old/iniconfig-1.0.1/tox.ini 2020-07-31 10:46:47.000000000 +0200
+++ new/iniconfig-1.1.1/tox.ini 2020-10-14 12:19:54.000000000 +0200
@@ -4,6 +4,11 @@
[testenv]
commands=
- pytest --junitxml={envlogdir}/junit-{envname}.xml []
+ pytest {posargs}
deps=
pytest
+
+
+[pytest]
+testpaths=
+ testing
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives:
https://lists.opensuse.org/archives/list/[email protected]