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 2023-04-25 16:54:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-tomlkit (Old) and /work/SRC/openSUSE:Factory/.python-tomlkit.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-tomlkit" Tue Apr 25 16:54:14 2023 rev:12 rq:1080076 version:0.11.7 Changes: -------- --- /work/SRC/openSUSE:Factory/python-tomlkit/python-tomlkit.changes 2022-11-12 17:40:30.941934582 +0100 +++ /work/SRC/openSUSE:Factory/.python-tomlkit.new.1533/python-tomlkit.changes 2023-04-25 16:54:15.506654119 +0200 @@ -1,0 +2,19 @@ +Tue Apr 18 06:47:33 UTC 2023 - Matej Cepl <mc...@suse.com> + +- Don't add dependency on full poetry, when poetry-core is enough. + +------------------------------------------------------------------- +Sun Apr 16 08:08:58 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.11.7: + * Parse empty table name if it is quoted. (#258) + * Fix a bug that remove last element of an Inline Table leaves + a comma. (#259) + * Parse datetime when it is followed by a space. (#260) + * Fix the `unwrap()` method for `Container` children values + which sometimes returns an internal object if the table is an + out-of-order table. (#264) + * Fix the wrong return type when doing arithmetic operations + between integers and floats. (#270) + +------------------------------------------------------------------- Old: ---- tomlkit-0.11.6.tar.gz New: ---- tomlkit-0.11.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-tomlkit.spec ++++++ --- /var/tmp/diff_new_pack.3J9HfN/_old 2023-04-25 16:54:16.122657818 +0200 +++ /var/tmp/diff_new_pack.3J9HfN/_new 2023-04-25 16:54:16.126657841 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-tomlkit # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,18 +16,19 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-tomlkit -Version: 0.11.6 +Version: 0.11.7 Release: 0 Summary: Style preserving TOML library License: MIT URL: https://github.com/sdispater/tomlkit Source: https://files.pythonhosted.org/packages/source/t/tomlkit/tomlkit-%{version}.tar.gz BuildRequires: %{python_module PyYAML >= 6.0} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module poetry-core} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch @@ -40,10 +41,10 @@ %setup -q -n tomlkit-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check ++++++ tomlkit-0.11.6.tar.gz -> tomlkit-0.11.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/CHANGELOG.md new/tomlkit-0.11.7/CHANGELOG.md --- old/tomlkit-0.11.6/CHANGELOG.md 2022-10-27 10:20:48.030500700 +0200 +++ new/tomlkit-0.11.7/CHANGELOG.md 2023-03-27 09:39:07.123327000 +0200 @@ -2,6 +2,16 @@ ## [Unreleased] +## [0.11.7] - 2023-03-27 + +### Fixed + +- Parse empty table name if it is quoted. ([#258](https://github.com/sdispater/tomlkit/issues/258)) +- Fix a bug that remove last element of an Inline Table leaves a comma. ([#259](https://github.com/sdispater/tomlkit/issues/259)) +- Parse datetime when it is followed by a space. ([#260](https://github.com/sdispater/tomlkit/issues/260)) +- Fix the `unwrap()` method for `Container` children values which sometimes returns an internal object if the table is an out-of-order table. ([#264](https://github.com/sdispater/tomlkit/issues/264)) +- Fix the wrong return type when doing arithmetic operations between integers and floats. ([#270](https://github.com/sdispater/tomlkit/issues/270)) + ## [0.11.6] - 2022-10-27 ### Fixed @@ -329,7 +339,8 @@ - Fixed handling of super tables with different sections. - Fixed raw strings escaping. -[unreleased]: https://github.com/sdispater/tomlkit/compare/0.11.6...master +[unreleased]: https://github.com/sdispater/tomlkit/compare/0.11.7...master +[0.11.7]: https://github.com/sdispater/tomlkit/releases/tag/0.11.7 [0.11.6]: https://github.com/sdispater/tomlkit/releases/tag/0.11.6 [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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/PKG-INFO new/tomlkit-0.11.7/PKG-INFO --- old/tomlkit-0.11.6/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/tomlkit-0.11.7/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +1,14 @@ Metadata-Version: 2.1 Name: tomlkit -Version: 0.11.6 +Version: 0.11.7 Summary: Style preserving TOML library Home-page: https://github.com/sdispater/tomlkit License: MIT Author: Sébastien Eustace Author-email: sebast...@eustace.io -Requires-Python: >=3.6 +Requires-Python: >=3.7 Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/docs/api.rst new/tomlkit-0.11.7/docs/api.rst --- old/tomlkit-0.11.6/docs/api.rst 2022-10-27 10:20:48.030500700 +0200 +++ new/tomlkit-0.11.7/docs/api.rst 2023-03-27 09:39:07.123327000 +0200 @@ -35,8 +35,6 @@ TOML Items ---------- -.. module:: tomlkit.items - .. automodule:: tomlkit.items :show-inheritance: :members: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/docs/conf.py new/tomlkit-0.11.7/docs/conf.py --- old/tomlkit-0.11.6/docs/conf.py 2022-10-27 10:20:48.030500700 +0200 +++ new/tomlkit-0.11.7/docs/conf.py 2023-03-27 09:39:07.123327000 +0200 @@ -57,4 +57,4 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] +html_static_path = [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/pyproject.toml new/tomlkit-0.11.7/pyproject.toml --- old/tomlkit-0.11.6/pyproject.toml 2022-10-27 10:20:48.030500700 +0200 +++ new/tomlkit-0.11.7/pyproject.toml 2023-03-27 09:39:07.123327000 +0200 @@ -1,6 +1,6 @@ [tool.poetry] name = "tomlkit" -version = "0.11.6" +version = "0.11.7" description = "Style preserving TOML library" authors = ["Sébastien Eustace <sebast...@eustace.io>"] license = "MIT" @@ -18,16 +18,16 @@ ] [tool.poetry.dependencies] -python = ">=3.6" +python = ">=3.7" [tool.poetry.dev-dependencies] -pytest = "^6.2.5" -pytest-cov = "^3.0.0" +pytest = "^7.2.0" +pytest-cov = "^4.0.0" PyYAML = "^6.0" -pre-commit = {version = "^2.1.0", python = "^3.6.1"} -mypy = "^0.920" +pre-commit = "^2.20.0" +mypy = "^0.990" Sphinx = "^4.3.2" -furo = "^2021.11.23" +furo = "^2022.9.29" [tool.black] line-length = 88 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/setup.py new/tomlkit-0.11.7/setup.py --- old/tomlkit-0.11.6/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ new/tomlkit-0.11.7/setup.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -from setuptools import setup - -packages = \ -['tomlkit'] - -package_data = \ -{'': ['*']} - -setup_kwargs = { - 'name': 'tomlkit', - 'version': '0.11.6', - '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', - 'url': 'https://github.com/sdispater/tomlkit', - 'packages': packages, - 'package_data': package_data, - 'python_requires': '>=3.6', -} - - -setup(**setup_kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/tests/test_api.py new/tomlkit-0.11.7/tests/test_api.py --- old/tomlkit-0.11.6/tests/test_api.py 2022-10-27 10:20:48.030500700 +0200 +++ new/tomlkit-0.11.7/tests/test_api.py 2023-03-27 09:39:07.123327000 +0200 @@ -458,3 +458,10 @@ def test_create_string_with_invalid_characters(kwargs, example): with pytest.raises(InvalidStringError): tomlkit.string(example, **kwargs) + + +def test_parse_empty_quoted_table_name(): + content = "['']\nx = 1\n" + parsed = loads(content) + assert parsed == {"": {"x": 1}} + assert dumps(parsed) == content diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/tests/test_items.py new/tomlkit-0.11.7/tests/test_items.py --- old/tomlkit-0.11.6/tests/test_items.py 2022-10-27 10:20:48.030500700 +0200 +++ new/tomlkit-0.11.7/tests/test_items.py 2023-03-27 09:39:07.123327000 +0200 @@ -307,6 +307,7 @@ content = """a = [1, 2,] # Comment """ doc = parse(content) + assert str(doc["a"]) == "[1, 2]" assert doc["a"] == [1, 2] doc["a"] += [3, 4] @@ -578,6 +579,29 @@ ) +def test_add_float_to_int(): + content = "[table]\nmy_int = 2043" + doc = parse(content) + doc["table"]["my_int"] += 5.0 + assert doc["table"]["my_int"] == 2048.0 + assert isinstance(doc["table"]["my_int"], float) + + +def test_sub_float_from_int(): + content = "[table]\nmy_int = 2048" + doc = parse(content) + doc["table"]["my_int"] -= 5.0 + assert doc["table"]["my_int"] == 2043.0 + assert isinstance(doc["table"]["my_int"], float) + + +def test_sub_int_from_float(): + content = "[table]\nmy_int = 2048.0" + doc = parse(content) + doc["table"]["my_int"] -= 5 + assert doc["table"]["my_int"] == 2043.0 + + def test_add_sum_int_with_float(): content = "[table]\nmy_int = 2048.3" doc = parse(content) @@ -677,6 +701,17 @@ assert doc.as_string() == "dt = 2018-07-23 # Comment" +def test_parse_datetime_followed_by_space(): + # issue #260 + doc = parse("dt = 2018-07-22 ") + assert doc["dt"] == date(2018, 7, 22) + assert doc.as_string() == "dt = 2018-07-22 " + + doc = parse("dt = 2013-01-24 13:48:01.123456 ") + assert doc["dt"] == datetime(2013, 1, 24, 13, 48, 1, 123456) + assert doc.as_string() == "dt = 2013-01-24 13:48:01.123456 " + + def test_times_behave_like_times(): i = item(time(12, 34, 56)) @@ -824,7 +859,7 @@ assert table.as_string() == '{foo = "bar", baz = "foobaz"}' -def test_deleting_inline_table_elemeent_does_not_leave_trailing_separator(): +def test_deleting_inline_table_element_does_not_leave_trailing_separator(): table = api.inline_table() table["foo"] = "bar" table["baz"] = "boom" @@ -845,6 +880,22 @@ assert table.as_string() == '{baz = "boom"}' +def test_deleting_inline_table_element_does_not_leave_trailing_separator2(): + doc = parse('a = {foo = "bar", baz = "boom"}') + table = doc["a"] + assert table.as_string() == '{foo = "bar", baz = "boom"}' + + del table["baz"] + assert table.as_string() == '{foo = "bar" }' + + del table["foo"] + assert table.as_string() == "{ }" + + table["baz"] = "boom" + + assert table.as_string() == '{ baz = "boom"}' + + def test_booleans_comparison(): boolean = Bool(True, Trivia()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/tests/test_write.py new/tomlkit-0.11.7/tests/test_write.py --- old/tomlkit-0.11.6/tests/test_write.py 2022-10-27 10:20:48.030500700 +0200 +++ new/tomlkit-0.11.7/tests/test_write.py 2023-03-27 09:39:07.127327200 +0200 @@ -21,6 +21,6 @@ def test_write_inline_table_in_nested_arrays(): d = {"foo": [[{"a": 1}]]} - expected = "foo = [[{a = 1}]]\n" # noqa: FS003 + expected = "foo = [[{a = 1}]]\n" 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.6/tomlkit/__init__.py new/tomlkit-0.11.7/tomlkit/__init__.py --- old/tomlkit-0.11.6/tomlkit/__init__.py 2022-10-27 10:20:48.046501400 +0200 +++ new/tomlkit-0.11.7/tomlkit/__init__.py 2023-03-27 09:39:07.139327800 +0200 @@ -25,7 +25,7 @@ from tomlkit.api import ws -__version__ = "0.11.6" +__version__ = "0.11.7" __all__ = [ "aot", "array", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/tomlkit/api.py new/tomlkit-0.11.7/tomlkit/api.py --- old/tomlkit-0.11.6/tomlkit/api.py 2022-10-27 10:20:48.046501400 +0200 +++ new/tomlkit-0.11.7/tomlkit/api.py 2023-03-27 09:39:07.139327800 +0200 @@ -59,7 +59,7 @@ raise TypeError(msg) from ex -def load(fp: IO) -> TOMLDocument: +def load(fp: Union[IO[str], IO[bytes]]) -> TOMLDocument: """ Load toml document from a file-like object. """ @@ -119,7 +119,7 @@ boolean flags (e.g. ``literal=True`` and/or ``multiline=True``) can be used for personalization. - For more information, please check the spec: `https://toml.io/en/v1.0.0#string`_. + For more information, please check the spec: `<https://toml.io/en/v1.0.0#string>`__. Common escaping rules will be applied for basic strings. This can be controlled by explicitly setting ``escape=False``. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/tomlkit/container.py new/tomlkit-0.11.7/tomlkit/container.py --- old/tomlkit-0.11.6/tomlkit/container.py 2022-10-27 10:20:48.046501400 +0200 +++ new/tomlkit-0.11.7/tomlkit/container.py 2023-03-27 09:39:07.139327800 +0200 @@ -55,7 +55,7 @@ if isinstance(k, Key): k = k.key - if isinstance(v, Item): + if hasattr(v, "unwrap"): v = v.unwrap() if k in unwrapped: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/tomlkit/items.py new/tomlkit-0.11.7/tomlkit/items.py --- old/tomlkit-0.11.6/tomlkit/items.py 2022-10-27 10:20:48.046501400 +0200 +++ new/tomlkit-0.11.7/tomlkit/items.py 2023-03-27 09:39:07.139327800 +0200 @@ -647,28 +647,28 @@ return self._raw def __add__(self, other): - return self._new(int(self._raw) + other) + result = super().__add__(other) + if result is NotImplemented: + return result + return self._new(result) def __radd__(self, other): result = super().__radd__(other) - - if isinstance(other, Integer): - return self._new(result) - - return result + if result is NotImplemented: + return result + return self._new(result) def __sub__(self, other): result = super().__sub__(other) - + if result is NotImplemented: + return result return self._new(result) def __rsub__(self, other): result = super().__rsub__(other) - - if isinstance(other, Integer): - return self._new(result) - - return result + if result is NotImplemented: + return result + return self._new(result) def _new(self, result): raw = str(result) @@ -1130,7 +1130,7 @@ super().__init__(trivia) list.__init__( self, - [v.value for v in value if not isinstance(v, (Whitespace, Comment, Null))], + [v for v in value if not isinstance(v, (Whitespace, Comment, Null))], ) self._index_map: Dict[int, int] = {} self._value = self._group_values(value) @@ -1166,7 +1166,7 @@ def unwrap(self) -> List[Any]: unwrapped = [] for v in self: - if isinstance(v, Item): + if hasattr(v, "unwrap"): unwrapped.append(v.unwrap()) else: unwrapped.append(v) @@ -1317,11 +1317,14 @@ return list.__len__(self) def __getitem__(self, key: Union[int, slice]) -> Any: - return list.__getitem__(self, key) + rv = cast(Item, list.__getitem__(self, key)) + if rv.is_boolean(): + return bool(rv) + return rv def __setitem__(self, key: Union[int, slice], value: Any) -> Any: it = item(value, _parent=self) - list.__setitem__(self, key, it.value) + list.__setitem__(self, key, it) if isinstance(key, slice): raise ValueError("slice assignment is not supported") if key < 0: @@ -1332,7 +1335,7 @@ it = item(value, _parent=self) length = len(self) if not isinstance(it, (Comment, Whitespace)): - list.insert(self, pos, it.value) + list.insert(self, pos, it) if pos < 0: pos += length if pos < 0: @@ -1411,9 +1414,6 @@ self._reindex() - def __str__(self): - return str([v.value.value for v in self._iter_items() if v.value is not None]) - def _getstate(self, protocol=3): return list(self._iter_items()), self._trivia, self._multiline @@ -1438,7 +1438,7 @@ for k, v in self.items(): if isinstance(k, Key): k = k.key - if isinstance(v, Item): + if hasattr(v, "unwrap"): v = v.unwrap() unwrapped[k] = v @@ -1716,6 +1716,14 @@ def as_string(self) -> str: buf = "{" + last_item_idx = next( + ( + i + for i in range(len(self._value.body) - 1, -1, -1) + if self._value.body[i][0] is not None + ), + None, + ) for i, (k, v) in enumerate(self._value.body): if k is None: if i == len(self._value.body) - 1: @@ -1738,7 +1746,7 @@ f"{v_trivia_trail}" ) - if i != len(self._value.body) - 1: + if last_item_idx is not None and i < last_item_idx: buf += "," if self._new: buf += " " @@ -1835,7 +1843,7 @@ def unwrap(self) -> List[Dict[str, Any]]: unwrapped = [] for t in self._body: - if isinstance(t, Item): + if hasattr(t, "unwrap"): unwrapped.append(t.unwrap()) else: unwrapped.append(t) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tomlkit-0.11.6/tomlkit/parser.py new/tomlkit-0.11.7/tomlkit/parser.py --- old/tomlkit-0.11.6/tomlkit/parser.py 2022-10-27 10:20:48.046501400 +0200 +++ new/tomlkit-0.11.7/tomlkit/parser.py 2023-03-27 09:39:07.139327800 +0200 @@ -497,11 +497,12 @@ pass time_raw = self.extract() - if not time_raw.strip(): - trivia.comment_ws = time_raw + time_part = time_raw.rstrip() + trivia.comment_ws = time_raw[len(time_part) :] + if not time_part: return date - dt = parse_rfc3339(raw + time_raw) + dt = parse_rfc3339(raw + time_part) assert isinstance(dt, datetime.datetime) return DateTime( dt.year, @@ -513,7 +514,7 @@ dt.microsecond, dt.tzinfo, trivia, - raw + time_raw, + raw + time_part, ) except ValueError: raise self.parse_error(InvalidDateError) @@ -910,8 +911,6 @@ raise self.parse_error(UnexpectedEofError) elif self._current != "]": raise self.parse_error(UnexpectedCharError, self._current) - elif not key.key.strip(): - raise self.parse_error(EmptyTableNameError) key.sep = "" full_key = key