From a93f3902f241c0d4c375d73ef26565ea24280f47feee68c7360aa1781ca1a259 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sat, 31 Aug 2024 12:17:47 +0000 Subject: [PATCH] - update to 3.17.0: * remove python 3.8 support * rewrite TypeVar defaults for Generator / AsyncGenerator * run pyupgrade on itself OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyupgrade?expand=0&rev=81 --- .gitattributes | 23 ++ .gitignore | 1 + python-pyupgrade-3.16.0.tar.gz | 3 + python-pyupgrade-3.17.0.tar.gz | 3 + python-pyupgrade.changes | 505 +++++++++++++++++++++++++++++++++ python-pyupgrade.spec | 75 +++++ 6 files changed, 610 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 python-pyupgrade-3.16.0.tar.gz create mode 100644 python-pyupgrade-3.17.0.tar.gz create mode 100644 python-pyupgrade.changes create mode 100644 python-pyupgrade.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/python-pyupgrade-3.16.0.tar.gz b/python-pyupgrade-3.16.0.tar.gz new file mode 100644 index 0000000..3073483 --- /dev/null +++ b/python-pyupgrade-3.16.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22db026d0bf7e26c9955b45d12cf269f0fe71b32157b3e59ce6792688dd7b5f1 +size 65582 diff --git a/python-pyupgrade-3.17.0.tar.gz b/python-pyupgrade-3.17.0.tar.gz new file mode 100644 index 0000000..95d62be --- /dev/null +++ b/python-pyupgrade-3.17.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e0ad5086fd4e4e6c175799d601684ca8c71a9181bcdc089981f46eb2a3f6d1a +size 66098 diff --git a/python-pyupgrade.changes b/python-pyupgrade.changes new file mode 100644 index 0000000..d920aa5 --- /dev/null +++ b/python-pyupgrade.changes @@ -0,0 +1,505 @@ +------------------------------------------------------------------- +Sat Aug 31 12:15:56 UTC 2024 - Dirk Müller + +- update to 3.17.0: + * remove python 3.8 support + * rewrite TypeVar defaults for Generator / AsyncGenerator + * run pyupgrade on itself + +------------------------------------------------------------------- +Mon Jun 24 15:44:15 UTC 2024 - Dirk Müller + +- update to 3.16.0: + * rewrite pep 646 Unpack to splat in *args + * CI updates + +------------------------------------------------------------------- +Mon Mar 25 13:04:48 UTC 2024 - Dirk Müller + +- update to 3.15.2: + * only replace to shlex.join if joined with a space + +------------------------------------------------------------------- +Thu Mar 21 08:55:48 UTC 2024 - Dirk Müller + +- update to 3.15.1: + * handle constant folding with comments on multilines better + +------------------------------------------------------------------- +Tue Dec 26 20:21:43 UTC 2023 - Dirk Müller + +- update to 3.15.0: + * Implement defaultdict lambda fixer + * update import symbols for 3.12 release + * constant fold isinstance / issubclass / except + * slight improvement to except fix + * document TimeoutError rewrites + * also rewrite os.error -> OSError + * prevent rewriting unittest module functions with additional + arguments + * fix string formatting with named escape adjacent to placeholder + * regenerate with latest reorder-python-imports + * slightly cleaner plugin union registering + * remove python 2 notes about invalid escapes + * correct minimum requirement + * fix weird-ws empty set literals + * automatically rewrite to shlex.join in --py38-plus + * posonlyargs are always present in 3.8+ + * updates for add-trailing-comma 3.x + * 3.12 TypeVar bounds are always unquotable + * support PEP 563 rewrites for 3.12+ TypeVar bounds + +------------------------------------------------------------------- +Thu Jun 1 20:18:41 UTC 2023 - Dirk Müller + +- update to 3.4.0: + * drop python37 support + * remove use of deprecated ast + +------------------------------------------------------------------- +Sat Dec 3 00:15:00 UTC 2022 - Yogalakshmi Arunachalam + +- Update to version 3.3.0 + * rewrite to datetime.UTC +- Update to version 3.2.3 + * fix rewrite of u strings to f strings + +- Update to version 3.2.2 + * remove abspath(__file__) rewrite + +- Update to version 3.2.1 + * Fix `Optional["ForwardRef"]` rewriting + +------------------------------------------------------------------- +Wed Nov 9 18:48:48 UTC 2022 - Yogalakshmi Arunachalam + +- Update to version 3.2.0 + * Merge pull request #747 from asottile/pre-commit-ci-update-config + * Merge pull request #745 from tusharsadhwani/unpack + * Add PEP646 Unpack plugin + * Merge pull request #741 from asottile/py311-release + * regenerate import symbols + * Merge pull request #738 from asottile/pre-commit-ci-update-config + * Merge pull request #734 from asottile/pre-commit-ci-update-config + +------------------------------------------------------------------- +Fri Oct 28 21:03:08 UTC 2022 - Yogalakshmi Arunachalam + +- Update to version 3.1.0 + - regenerate import symbols + - sync import rewrites from latest reorder-python-imports + - there is a comment in the code about this causing a SyntaxError but as far as I can tell that is incorrect + +- Update to version 3.0.0 + - Merge pull request #718 from asottile/py3-plus + - remove python-2-compatible rewriting mode + +- Update to version 2.38.4 + - Merge pull request #716 from asottile/lt-5 + +- Update to version 2.38.3 + - Merge pull request #715 from asottile/limit-tokenize-rt-before-break + - limit tokenize-rt to <4 before breaks + - tokenze-rt will remove python2-compat parsing + - Merge pull request #711 from asottile/pre-commit-ci-update-config + +------------------------------------------------------------------- +Mon Sep 26 06:05:32 UTC 2022 - Sebastian Wagner + +- update to version 2.38.2: + - rewrite 2-arg super call in nested class +- update to version 2.38.1: + - regenerate imports to get typing.get_type_hints version change +- update to version 2.38.0: + - Add ast.Bytes in typing_classes _unparse + Fix "NotImplementedError: Constant(value=*)" + when defining TypedDict in alternative syntax + with literal bytes values. + - Implement preservation of comments "within" typing classes + This ensures that comments which appear around TypedDicts and + NamedTuples that are converted to class style are preserved. + The layout of the comments in the new code isn't perfect, however + that's relatively easy for the user to fix manually afterwards. + Fixes https://github.com/asottile/pyupgrade/issues/497 + Fixes https://github.com/asottile/pyupgrade/issues/634 + Fixes https://github.com/asottile/pyupgrade/issues/697 + - remove pep289 rewrite + - upgrade azure-pipelines + - convert pip install comand to a block + github will produce a copy-paste button + Committed via https://github.com/asottile/all-repos +- update to version 2.37.3: + - fix imports removal not including rules from previous versions +- update to version 2.37.2: + - sync import rewrites from reorder-python-imports +- update to version 2.37.1: + - fix replacement of entire indented import + - only rewrite typing.Callable in 3.10+ +- update to version 2.37.0: + - avoid double parse when removing imports + - fix indentation for import-imports being added + - rewrite pipes.quote -> shlex.quote +- update to version 2.36.0: + - combine mock and imports plugins +- update to version 2.35.0: + - document import replacements + - rewrite collections.Name to collections.abc.Name + Co-Authored-By: ptmcg + - add more tests for import rewriting + Co-Authored-By: ptmcg + - fix replacing imports when not ending in a newline + - rewrite from-imports of modules + - check in testing/generate-imports + - rewrite aliased import-imports + - avoid computing modnames when not needed in import replace + - handle from imports where module name is replaced + - fix removals and replacements at the same time + - replace from imports with exact symbols + - rewrite a few more six.moves.* attrs + - refactor import removal to a plugin + - converge open modes of io.open in one pass + Co-Authored-By: Ali Hamdan +- update to version 2.34.0: + - warn that py2 mode will be going away + - rewrite bytes(b'foo') to b'foo' + +------------------------------------------------------------------- +Tue Jun 21 08:52:27 UTC 2022 - Sebastian Wagner + +- update to version 2.33.0: + - feat: rewrite deprecated unittest methods + - Fix typos + * README.md + * tests/features/typing_classes_test.py + * tests/features/yield_from_test.py + +------------------------------------------------------------------- +Sun May 22 10:39:56 UTC 2022 - Sebastian Wagner + +- update to version 2.32.1: + - Do not remove quoted annotations on 3.11 + `from __future__ import annotations` will not be the default + behavior on 3.11. + Fixes #637. + +------------------------------------------------------------------- +Sat Apr 9 07:31:58 UTC 2022 - Sebastian Wagner + +- update to version 2.32.0: + - rewrite check_output(...) universal_newlines -> text + - convert fstring rewriter to a plugin + - move typed class rewrite to a plugin + - change is_name_attr to accept multiple modules + - reorder pre-commit config + - Update default branch to main + - remove unneeded gitignore lines + - coverage-html: coverage>=6.2 writes a .gitignore file + - mypy_cache: mypy>=0.770 writes a .gitignore file + - pytest_cache: pytest>=3.8.1 writes a .gitignore file + - venv: virtualenv>=20.0.21 writes a .gitignore file + +------------------------------------------------------------------- +Mon Mar 14 21:41:27 UTC 2022 - Sebastian Wagner + +- update to version 2.31.1: + - dont rewrite universal_newlines if text or **kwargs present + - upgrade flake8-typing-imports + - drop python3.6 support + python 3.6 reached end of life on 2021-12-23 + - remove --fail-under from tox (covdefaults handles this) + - Use diff syntax in more places in the docs +- update to version 2.31.0: + - rewrite string formatting with **locals() + +------------------------------------------------------------------- +Mon Jan 3 11:37:47 UTC 2022 - Sebastian Wagner + +- - update to version 2.31.0: + - rewrite string formatting with **locals() +- update to version 2.30.1: + - don't rewrite six.reraise with named args +- update to version 2.30.0: + - rewrite abspath(__file__) to __file__ in py39+ + - fix __path__ type annotation + - fix the diff output of `forced str("native") literals` section + - improve coverage pragmas with covdefaults 2.1 + - Use org-default .github/FUNDING.yml + Committed via https://github.com/asottile/all-repos + - Rewrite docs examples with commented code to use diffs + +------------------------------------------------------------------- +Tue Dec 28 16:15:14 UTC 2021 - Sebastian Wagner + +- - update to version 2.30.0: + - rewrite abspath(__file__) to __file__ in py39+ + - fix __path__ type annotation + - fix the diff output of `forced str("native") literals` section + - improve coverage pragmas with covdefaults 2.1 + - Use org-default .github/FUNDING.yml + Committed via https://github.com/asottile/all-repos + - Rewrite docs examples with commented code to use diffs +- update to version 2.29.1: + - prevent rewriting union types with forward annotations + - replace exit(main()) with raise SystemExit(main()) + Committed via https://github.com/asottile/all-repos + +------------------------------------------------------------------- +Tue Nov 16 07:44:51 UTC 2021 - Sebastian Wagner + +- - update to version 2.29.1: + - prevent rewriting union types with forward annotations + - replace exit(main()) with raise SystemExit(main()) + Committed via https://github.com/asottile/all-repos + +------------------------------------------------------------------- +Tue Nov 2 19:39:16 UTC 2021 - Sebastian Wagner + +- update to version 2.29.0: + - Revert "Merge pull request #320 from asottile/new_class_super_v2" + This reverts commit b3f8c7b2e9ccb06c6028d5dd90c8f5490a49e95b, reversing + changes made to 41308214566af7c5589ebc7e8a760522c82dc3bc. + - Revert "Merge pull request #545 from asottile/skip-staticmethod" + This reverts commit 8768d42facdaa1ef771a5a689b11329a54afd00a, reversing + changes made to a2f517f0103c1f74bffbc06be510bcec4cd181ec. +- update to version 2.28.1: + - don't rewrite old-super for staticmethods + +------------------------------------------------------------------- +Sun Sep 26 07:22:08 UTC 2021 - Sebastian Wagner + +- update to version 2.28.0: + - don't rewrite old super calls for __new__ + - fix super replacement of multiple lines + - Fix bug with calling different superclass method + - Revert "Revert "Merge pull request #317 from asottile/old_super"" + This reverts commit 2719335fa7bdb582b35ac90547a0f763d4225036. + - fix raise_from with multi lines / trailing commas + - fix rewrite causing syntax error when the first arg has newlines + - fix invalid dedent with comment after block + +------------------------------------------------------------------- +Fri Sep 24 19:39:14 UTC 2021 - Sebastian Wagner + +- update to version 2.27.0: + - handle named escape sequences in format upgrades + - remove splatting of listcomp -> splat of generator + +------------------------------------------------------------------- +Sat Sep 18 19:58:40 UTC 2021 - Sebastian Wagner + +- update to version 2.26.0.post1: + - BUG: fix broken tests for versioned_branches feature +- update to version 2.26.0: + - ENH: expand versioned_branches feature to Python 3 minor version comparison (<, >, <=, >= with else) +- update to version 2.25.1: + - don't rewrite %-format with width+s + - update timidity docs for f-strings +- update to version 2.25.0: + - revert pep584 rewrite + +------------------------------------------------------------------- +Fri Aug 20 19:49:12 UTC 2021 - Sebastian Wagner + +- update to version 2.24.0: + - Rewrite unittest deprecated aliases + Fixes #519 + +------------------------------------------------------------------- +Sun Aug 8 19:23:58 UTC 2021 - Sebastian Wagner + +- update to version 2.23.3: + - can't splat async generators + - cannot unpack async generators + - add extra test for pep584 +- update to version 2.23.2: + - correctly compute indent for typeddict after dedent +- update to version 2.23.1: + - fix bug in merge dicts: look for comma backwards +- update to version 2.23.0: + - rewrite type of primitive +- update to version 2.22.0: + - rewrite six.moves.range + - rewrite lru_cache with maxsize=None and typed=False + Co-authored-by: Max Rozentsveyg +- update to version 2.21.2: + - dont do generator rewrite if list comp contains await +- update to version 2.21.1: + - fix breakage from async generator + - Fix etree heading, non-breaking space to space +- update to version 2.21.0: + - remove redunant encoding even for f-strings +- update to version 2.20.1: + - dont rewrite fstring if await in py3 + +------------------------------------------------------------------- +Sat Jul 3 20:31:13 UTC 2021 - Sebastian Wagner + +- Update to version 2.20.0: + - stricter mypy settings + - remove unused type ignore + - fix six.with_metaclass and trailing commas + - rewrite cElementTree to ElementTree + +------------------------------------------------------------------- +Sun Jun 20 08:51:13 UTC 2021 - Sebastian Wagner + +- update to version 2.19.1 + - unpack argument list comprehensions + - revert string join for potential perf reasons +- update to version 2.19.2 + - replace open modes with string flags +- update to version 2.19.3 + - ignore unrelated calls to .encode(...) + - fix elif -> else when indented +- update to version 2.19.4 + - fix __metaclass__ = type replacement without extra newline + +------------------------------------------------------------------- +Tue May 25 07:46:49 UTC 2021 - Sebastian Wagner + +- update to versio 2.18.3: + - remove trailing comma after removed list comp + +------------------------------------------------------------------- +Mon May 24 17:12:55 UTC 2021 - Sebastian Wagner + +- update to version 2.18.2: + - don't rewrite list comp to generator expression in short-circuiting functions + +------------------------------------------------------------------- +Fri May 21 16:01:15 UTC 2021 - Sebastian Wagner + +- update to version 2.18.1: + - check argument count for generator rewrite +- update to version 2.18.0: + - use generator expressions in single arg func calls + +------------------------------------------------------------------- +Wed May 19 07:23:18 UTC 2021 - Sebastian Wagner + +- update to version 2.17.0: + - Fix typo in the "is" example of README + - use generator to unpack list comprehension +- update to version 2.16.0: + - don't crash on --py311-plus + - Use more inclusive language + - pep584-rewrite + - note pep584 change in README + +------------------------------------------------------------------- +Sun May 9 09:50:40 UTC 2021 - Sebastian Wagner + +- update to version 2.15.0: + - only replace argument token + - CLN only replace argument token + - replace stdout=PIPE and stderr=PIPE with capture_output=True + +------------------------------------------------------------------- +Sun May 2 07:38:55 UTC 2021 - Sebastian Wagner + +- update to version 2.14.0: + - replace universal_newlines with text if py37+ + - upgrade subprocess.run(universal_newlines=True) to subprocess.run(text=True) in --py37-plus + - reorder_python_imports: v2.4.0 → v2.5.0 + +------------------------------------------------------------------- +Sat Apr 24 18:16:48 UTC 2021 - Sebastian Wagner + +- Update to version 2.13.0: + - move pep563 rewrite to py311 +- Update to version 2.12.0: + - document annotation unquote + - use dict comprehension + - rewrite typeddict even with total= option + - Update azure-pipelines template repositories + - _to_fstring: Use original token stream instead of unparsed AST + +------------------------------------------------------------------- +Mon Mar 22 21:04:52 UTC 2021 - Sebastian Wagner + +- Update to version 2.10.1 + - fix nested union replaces +- Update to version 2.11.0 + - dequote annotations: quoted annotations + `from __future__ import annotations` + - rewrite open even with mode=: Rewrite open_mode even if mode is passed by name + +------------------------------------------------------------------- +Sat Feb 13 18:15:11 UTC 2021 - Sebastian Wagner + +- Disable build on Python 2 as the build fails with the latest version. + +------------------------------------------------------------------- +Tue Feb 9 06:44:47 UTC 2021 - Sebastian Wagner + +- Update to version 1.10.0: + - lru_cache(maxsize=None) => functools.cache + +------------------------------------------------------------------- +Wed Feb 3 16:46:58 UTC 2021 - Sebastian Wagner + +- Update to version 2.9.0: + - Document correct minimum version for PEP 604 + - fix propagation of --keep-mock + - Add --keep-runtime-typing + +------------------------------------------------------------------- +Sun Jan 31 17:48:42 UTC 2021 - Sebastian Wagner + +- Update to version 2.8.0: + - genericize future import detection + - rewrite pep585 generic builtins + - move py2 compat fixer to plugins + - move %-format rewrite to a plugin + - move py3+ base class removal to plugins + - move lru_cache rewrite to a plugin + - move six decorator removal to a plugin + - move six.b / six.ensure_binary to a plugin + - move __metaclass__ = test checker to a plugin + - move io.open rewriting to a plugin + - move simple six attrs to a plugin + - move typing pep585 rewrite to a plugin + - move default encoding to a plugin + - move native literals to a plugin + - move versioned branches rewrite to a plugin + - move open mode fix to a plugin + - move os error alias rename to a plugin + - move six calls / metaclass rewrites to plugins + - settings in separate class + - move mock rewrite to a plugin + - refactor Py3Plus scope management + - move super and yield from to a legacy plugin + - combine six_b into six_calls plugin + - replace typing.Text with str + - rewrite pep604 (+ add --py310-plus) + - document PEP 604 rewrites + +------------------------------------------------------------------- +Sat Jan 23 15:25:51 UTC 2021 - Sebastian Wagner + +- Use python_clone and alternatives to provide the executable. + +------------------------------------------------------------------- +Wed Nov 25 20:49:51 UTC 2020 - Sebastian Wagner + +- Update to version 2.7.4: + - parenthesize expressions when replacing six calls when needed + +------------------------------------------------------------------- +Sun Nov 1 18:32:44 UTC 2020 - Sebastian Wagner + +- Update to 2.7.3: + - fix off-by-one in encode() call fixer + - upgrade mypy to get typeshed fix + +------------------------------------------------------------------- +Mon Aug 3 13:30:45 UTC 2020 - Marketa Calabkova + +- update to 2.7.2 + * fix any call with *sys.exc_info() + * leave f'string'.format(...) alone + * `reraise` and `raise_from` doc examples + +------------------------------------------------------------------- +Sat Jul 4 09:50:49 UTC 2020 - Sebastian Wagner + +- initial package for version 2.6.2. diff --git a/python-pyupgrade.spec b/python-pyupgrade.spec new file mode 100644 index 0000000..e5c5143 --- /dev/null +++ b/python-pyupgrade.spec @@ -0,0 +1,75 @@ +# +# spec file for package python-pyupgrade +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-pyupgrade +Version: 3.17.0 +Release: 0 +Summary: A tool to automatically upgrade syntax for newer versions +License: MIT +Group: Development/Languages/Python +URL: https://github.com/asottile/pyupgrade +Source: https://github.com/asottile/pyupgrade/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: python-rpm-macros +# SECTION test requirements +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module tokenize-rt >= 3.2.0} +# /SECTION +BuildRequires: fdupes +Requires: python-tokenize-rt >= 3.2.0 +Requires(post): update-alternatives +Requires(postun): update-alternatives +BuildArch: noarch + +%python_subpackages + +%description +A tool to automatically upgrade syntax for newer versions of the Python +programming language. + +%prep +%setup -q -n pyupgrade-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} +%python_clone -a %{buildroot}%{_bindir}/pyupgrade + +%check +%pytest + +%post +%python_install_alternative pyupgrade + +%postun +%python_uninstall_alternative pyupgrade + +%files %{python_files} +%doc README.md +%license LICENSE +%python_alternative %{_bindir}/pyupgrade +%{python_sitelib}/pyupgrade +%{python_sitelib}/pyupgrade-%{version}.dist-info + +%changelog