Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-tomlkit for openSUSE:Factory checked in at 2022-10-04 20:37:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-tomlkit (Old) and /work/SRC/openSUSE:Factory/.python-tomlkit.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-tomlkit" Tue Oct 4 20:37:15 2022 rev:10 rq:1007720 version:0.11.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-tomlkit/python-tomlkit.changes 2022-09-25 15:34:50.887557188 +0200 +++ /work/SRC/openSUSE:Factory/.python-tomlkit.new.2275/python-tomlkit.changes 2022-10-04 20:37:16.756878217 +0200 @@ -1,0 +2,9 @@ +Mon Oct 3 16:05:27 UTC 2022 - Dirk M??ller <dmuel...@suse.com> + +- update to 0.11.5: + * Fix the type annotation of `unwrap()` and datetime parsing. + * Clear the existing table header when it is adding to another table. + * Fix a bug that escape chars are lost after concat with another string. + * Fix a rendering issue of tables inside arrays or inline tables. + +------------------------------------------------------------------- Old: ---- tomlkit-0.11.4.tar.gz New: ---- tomlkit-0.11.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-tomlkit.spec ++++++ --- /var/tmp/diff_new_pack.MyGQ38/_old 2022-10-04 20:37:17.288878974 +0200 +++ /var/tmp/diff_new_pack.MyGQ38/_new 2022-10-04 20:37:17.288878974 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-tomlkit -Version: 0.11.4 +Version: 0.11.5 Release: 0 Summary: Style preserving TOML library License: MIT ++++++ tomlkit-0.11.4.tar.gz -> tomlkit-0.11.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/CHANGELOG.md new/tomlkit-0.11.5/CHANGELOG.md --- old/tomlkit-0.11.4/CHANGELOG.md 2022-08-13 06:06:53.684682400 +0200 +++ new/tomlkit-0.11.5/CHANGELOG.md 2022-09-28 03:52:14.099740500 +0200 @@ -2,6 +2,15 @@ ## [Unreleased] +## [0.11.5] - 2022-09-28 + +### Fixed + +- Fix the type annotation of `unwrap()` and datetime parsing. ([#229](https://github.com/sdispater/tomlkit/issues/229)) +- Clear the existing table header when it is adding to another table. ([#230](https://github.com/sdispater/tomlkit/issues/230)) +- Fix a bug that escape chars are lost after concat with another string. ([#235](https://github.com/sdispater/tomlkit/issues/235)) +- Fix a rendering issue of tables inside arrays or inline tables. ([#236](https://github.com/sdispater/tomlkit/issues/236)) + ## [0.11.4] - 2022-08-12 ### Fixed @@ -313,7 +322,8 @@ - Fixed handling of super tables with different sections. - Fixed raw strings escaping. -[unreleased]: https://github.com/sdispater/tomlkit/compare/0.11.4...master +[unreleased]: https://github.com/sdispater/tomlkit/compare/0.11.5...master +[0.11.5]: https://github.com/sdispater/tomlkit/releases/tag/0.11.5 [0.11.4]: https://github.com/sdispater/tomlkit/releases/tag/0.11.4 [0.11.3]: https://github.com/sdispater/tomlkit/releases/tag/0.11.3 [0.11.2]: https://github.com/sdispater/tomlkit/releases/tag/0.11.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/PKG-INFO new/tomlkit-0.11.5/PKG-INFO --- old/tomlkit-0.11.4/PKG-INFO 2022-08-13 06:07:11.852850000 +0200 +++ new/tomlkit-0.11.5/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: tomlkit -Version: 0.11.4 +Version: 0.11.5 Summary: Style preserving TOML library Home-page: https://github.com/sdispater/tomlkit License: MIT @@ -9,11 +9,11 @@ Requires-Python: >=3.6,<4.0 Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Project-URL: Repository, https://github.com/sdispater/tomlkit Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/pyproject.toml new/tomlkit-0.11.5/pyproject.toml --- old/tomlkit-0.11.4/pyproject.toml 2022-08-13 06:06:53.684682400 +0200 +++ new/tomlkit-0.11.5/pyproject.toml 2022-09-28 03:52:14.099740500 +0200 @@ -1,6 +1,6 @@ [tool.poetry] name = "tomlkit" -version = "0.11.4" +version = "0.11.5" description = "Style preserving TOML library" authors = ["S??bastien Eustace <sebast...@eustace.io>"] license = "MIT" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/setup.py new/tomlkit-0.11.5/setup.py --- old/tomlkit-0.11.4/setup.py 2022-08-13 06:07:11.852423200 +0200 +++ new/tomlkit-0.11.5/setup.py 1970-01-01 01:00:00.000000000 +0100 @@ -9,13 +9,13 @@ setup_kwargs = { 'name': 'tomlkit', - 'version': '0.11.4', + 'version': '0.11.5', 'description': 'Style preserving TOML library', 'long_description': '[github_release]: https://img.shields.io/github/release/sdispater/tomlkit.svg?logo=github&logoColor=white\n[pypi_version]: https://img.shields.io/pypi/v/tomlkit.svg?logo=python&logoColor=white\n[python_versions]: https://img.shields.io/pypi/pyversions/tomlkit.svg?logo=python&logoColor=white\n[github_license]: https://img.shields.io/github/license/sdispater/tomlkit.svg?logo=github&logoColor=white\n[github_action]: https://github.com/sdispater/tomlkit/actions/workflows/tests.yml/badge.svg\n\n[![GitHub Release][github_release]](https://github.com/sdispater/tomlkit/releases/)\n[![PyPI Version][pypi_version]](https://pypi.org/project/tomlkit/)\n[![Python Versions][python_versions]](https://pypi.org/project/tomlkit/)\n[![License][github_license]](https://github.com/sdispater/tomlkit/blob/master/LICENSE)\n<br>\n[![Tests][github_action]](https://github.com/sdispater/tomlkit/actions/workflows/tests.yml)\n\n# TOML Kit - Style-preserving TOML library for Python\n\nTOML Kit is a **1.0.0-compliant** [TOML](https://toml.io/) library.\n\nIt includes a parser that preserves all comments, indentations, whitespace and internal element ordering,\nand makes them accessible and editable via an intuitive API.\n\nYou can also create new TOML documents from scratch using the provided helpers.\n\nPart of the implementation has been adapted, improved and fixed from [Molten](https://github.com/LeopoldArkham/Molten).\n\n## Usage\n\nSee the [documentation](https://github.com/sdispater/tomlkit/blob/master/docs/quickstart.rst) for more information.\n\n## Installation\n\nIf you are using [Poetry](https://poetry.eustace.io),\nadd `tomlkit` to your `pyproject.toml` file by using:\n\n```bash\npoetry add tomlkit\n```\n\nIf not, you can use `pip`:\n\n```bash\npip install tomlkit\n```\n\n## Running tests\n\nPlease clone the repo with submodules with the following command\n`git clone --recurse-submodules https://github.com/sdispater/tomlkit.git`.\nWe need the submodule - `t oml-test` for running the tests.\n\nYou can run the tests with `poetry run pytest -q tests`\n', 'author': 'S??bastien Eustace', 'author_email': 'sebast...@eustace.io', - 'maintainer': None, - 'maintainer_email': None, + 'maintainer': 'None', + 'maintainer_email': 'None', 'url': 'https://github.com/sdispater/tomlkit', 'packages': packages, 'package_data': package_data, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/tests/test_items.py new/tomlkit-0.11.5/tests/test_items.py --- old/tomlkit-0.11.4/tests/test_items.py 2022-08-13 06:06:53.684682400 +0200 +++ new/tomlkit-0.11.5/tests/test_items.py 2022-09-28 03:52:14.099740500 +0200 @@ -708,6 +708,14 @@ assert doc.as_string() == 'str = "foo bar" # Comment' +def test_string_add_preserve_escapes(): + i = api.value('"foo\\"bar"') + i += " baz" + + assert i == 'foo"bar baz' + assert i.as_string() == '"foo\\"bar baz"' + + def test_tables_behave_like_dicts(): t = item({"foo": "bar"}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/tests/test_toml_document.py new/tomlkit-0.11.5/tests/test_toml_document.py --- old/tomlkit-0.11.4/tests/test_toml_document.py 2022-08-13 06:06:53.684682400 +0200 +++ new/tomlkit-0.11.5/tests/test_toml_document.py 2022-09-28 03:52:14.099740500 +0200 @@ -1001,3 +1001,32 @@ """ assert doc.as_string() == dedent(expected) + + +def test_nested_table_update_display_name(): + content = """\ + [parent] + + [parent.foo] + x = 1 + """ + + doc = parse(dedent(content)) + sub = """\ + [foo] + y = 2 + + [bar] + z = 3 + """ + doc["parent"].update(parse(dedent(sub))) + expected = """\ + [parent] + + [parent.foo] + y = 2 + + [parent.bar] + z = 3 + """ + assert doc.as_string() == dedent(expected) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/tests/test_write.py new/tomlkit-0.11.5/tests/test_write.py --- old/tomlkit-0.11.4/tests/test_write.py 2022-08-13 06:06:53.684682400 +0200 +++ new/tomlkit-0.11.5/tests/test_write.py 2022-09-28 03:52:14.099740500 +0200 @@ -17,3 +17,10 @@ expected = '"foo\\nbar" = "baz"\n' assert expected == dumps(d) assert loads(dumps(d))["foo\nbar"] == "baz" + + +def test_write_inline_table_in_nested_arrays(): + d = {"foo": [[{"a": 1}]]} + expected = "foo = [[{a = 1}]]\n" # noqa: FS003 + assert expected == dumps(d) + assert loads(dumps(d))["foo"] == [[{"a": 1}]] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/tomlkit/__init__.py new/tomlkit-0.11.5/tomlkit/__init__.py --- old/tomlkit-0.11.4/tomlkit/__init__.py 2022-08-13 06:06:53.700682600 +0200 +++ new/tomlkit-0.11.5/tomlkit/__init__.py 2022-09-28 03:52:14.115740500 +0200 @@ -25,7 +25,7 @@ from tomlkit.api import ws -__version__ = "0.11.4" +__version__ = "0.11.5" __all__ = [ "aot", "array", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/tomlkit/container.py new/tomlkit-0.11.5/tomlkit/container.py --- old/tomlkit-0.11.4/tomlkit/container.py 2022-08-13 06:06:53.700682600 +0200 +++ new/tomlkit-0.11.5/tomlkit/container.py 2022-09-28 03:52:14.115740500 +0200 @@ -46,7 +46,7 @@ def body(self) -> List[Tuple[Optional[Key], Item]]: return self._body - def unwrap(self) -> str: + def unwrap(self) -> Dict[str, Any]: unwrapped = {} for k, v in self.items(): if k is None: @@ -66,7 +66,7 @@ return unwrapped @property - def value(self) -> Dict[Any, Any]: + def value(self) -> Dict[str, Any]: d = {} for k, v in self._body: if k is None: @@ -194,7 +194,7 @@ prev = self._previous_item() prev_ws = isinstance(prev, Whitespace) or ends_with_whitespace(prev) if isinstance(item, Table): - if item.name != key.key: + if not self._parsed: item.invalidate_display_name() if self._body and not (self._parsed or item.trivia.indent or prev_ws): item.trivia.indent = "\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/tomlkit/items.py new/tomlkit-0.11.5/tomlkit/items.py --- old/tomlkit-0.11.4/tomlkit/items.py 2022-08-13 06:06:53.700682600 +0200 +++ new/tomlkit-0.11.5/tomlkit/items.py 2022-09-28 03:52:14.115740500 +0200 @@ -170,7 +170,9 @@ elif isinstance(value, float): return Float(value, Trivia(), str(value)) elif isinstance(value, dict): - table_constructor = InlineTable if isinstance(_parent, Array) else Table + table_constructor = ( + InlineTable if isinstance(_parent, (Array, InlineTable)) else Table + ) val = table_constructor(Container(), Trivia(), False) for k, v in sorted( value.items(), @@ -184,7 +186,11 @@ return val elif isinstance(value, (list, tuple)): - if value and all(isinstance(v, dict) for v in value): + if ( + value + and all(isinstance(v, dict) for v in value) + and (_parent is None or isinstance(_parent, Table)) + ): a = AoT([]) table_constructor = Table else: @@ -199,7 +205,7 @@ v.items(), key=lambda i: (isinstance(i[1], dict), i[0] if _sort_keys else 1), ): - i = item(_v, _parent=a, _sort_keys=_sort_keys) + i = item(_v, _parent=table, _sort_keys=_sort_keys) if isinstance(table, InlineTable): i.trivia.trail = "" @@ -503,7 +509,11 @@ """The TOML representation""" raise NotImplementedError() - def unwrap(self): + @property + def value(self) -> Any: + return self + + def unwrap(self) -> Any: """Returns as pure python object (ppo)""" raise NotImplementedError() @@ -1036,7 +1046,7 @@ self._raw = raw - def unwrap(self) -> datetime: + def unwrap(self) -> time: (hour, minute, second, microsecond, tzinfo, _, _) = self._getstate() return time(hour, minute, second, microsecond, tzinfo) @@ -1157,7 +1167,7 @@ groups.append(this_group) return [group for group in groups if group] - def unwrap(self) -> str: + def unwrap(self) -> List[Any]: unwrapped = [] for v in self: if isinstance(v, Item): @@ -1427,7 +1437,7 @@ if k is not None: dict.__setitem__(self, k.key, v) - def unwrap(self): + def unwrap(self) -> Dict[str, Any]: unwrapped = {} for k, v in self.items(): if isinstance(k, Key): @@ -1509,7 +1519,7 @@ def __setitem__(self, key: Union[Key, str], value: Any) -> None: if not isinstance(value, Item): - value = item(value) + value = item(value, _parent=self) is_replace = key in self self._value[key] = value @@ -1573,7 +1583,7 @@ Appends a (key, item) to the table. """ if not isinstance(_item, Item): - _item = item(_item) + _item = item(_item, _parent=self) self._value.append(key, _item) @@ -1684,7 +1694,7 @@ Appends a (key, item) to the table. """ if not isinstance(_item, Item): - _item = item(_item) + _item = item(_item, _parent=self) if not isinstance(_item, (Whitespace, Comment)): if not _item.trivia.indent and len(self._value) > 0 and not self._new: @@ -1775,18 +1785,16 @@ def as_string(self) -> str: return f"{self._t.value}{decode(self._original)}{self._t.value}" - def __add__(self, other): + def __add__(self: ItemT, other: str) -> ItemT: + if not isinstance(other, str): + return NotImplemented result = super().__add__(other) + original = self._original + getattr(other, "_original", other) - return self._new(result) - - def __sub__(self, other): - result = super().__sub__(other) - - return self._new(result) + return self._new(result, original) - def _new(self, result): - return String(self._t, result, result, self._trivia) + def _new(self, result: str, original: str) -> "String": + return String(self._t, result, original, self._trivia) def _getstate(self, protocol=3): return self._t, str(self), self._original, self._trivia @@ -1822,7 +1830,7 @@ for table in body: self.append(table) - def unwrap(self) -> str: + def unwrap(self) -> List[Dict[str, Any]]: unwrapped = [] for t in self._body: if isinstance(t, Item): @@ -1922,7 +1930,7 @@ def __init__(self) -> None: pass - def unwrap(self) -> str: + def unwrap(self) -> None: return None @property diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.4/tomlkit/parser.py new/tomlkit-0.11.5/tomlkit/parser.py --- old/tomlkit-0.11.4/tomlkit/parser.py 2022-08-13 06:06:53.700682600 +0200 +++ new/tomlkit-0.11.5/tomlkit/parser.py 2022-09-28 03:52:14.115740500 +0200 @@ -1,3 +1,4 @@ +import datetime import re import string @@ -470,6 +471,7 @@ # datetime try: dt = parse_rfc3339(raw) + assert isinstance(dt, datetime.datetime) return DateTime( dt.year, dt.month, @@ -488,6 +490,7 @@ if m.group(1): try: dt = parse_rfc3339(raw) + assert isinstance(dt, datetime.date) date = Date(dt.year, dt.month, dt.day, trivia, raw) self.mark() while self._current not in "\t\n\r#,]}" and self.inc(): @@ -499,6 +502,7 @@ return date dt = parse_rfc3339(raw + time_raw) + assert isinstance(dt, datetime.datetime) return DateTime( dt.year, dt.month, @@ -517,6 +521,7 @@ if m.group(5): try: t = parse_rfc3339(raw) + assert isinstance(t, datetime.time) return Time( t.hour, t.minute, @@ -678,10 +683,10 @@ or sign and raw.startswith(".") ): - return + return None if raw.startswith(("0o", "0x", "0b")) and sign: - return + return None digits = "[0-9]" base = 10 @@ -699,14 +704,14 @@ clean = re.sub(f"(?i)(?<={digits})_(?={digits})", "", raw).lower() if "_" in clean: - return + return None if ( clean.endswith(".") or not clean.startswith("0x") and clean.split("e", 1)[0].endswith(".") ): - return + return None try: return Integer(int(sign + clean, base), trivia, sign + raw) @@ -714,7 +719,7 @@ try: return Float(float(sign + clean), trivia, sign + raw) except ValueError: - return + return None def _parse_literal_string(self) -> String: with self._state: