Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pyupgrade for
openSUSE:Factory checked in at 2022-11-17 17:24:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pyupgrade (Old)
and /work/SRC/openSUSE:Factory/.python-pyupgrade.new.1597 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pyupgrade"
Thu Nov 17 17:24:40 2022 rev:28 rq:1036282 version:3.2.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pyupgrade/python-pyupgrade.changes
2022-11-08 10:54:38.997726802 +0100
+++
/work/SRC/openSUSE:Factory/.python-pyupgrade.new.1597/python-pyupgrade.changes
2022-11-17 17:24:52.921185269 +0100
@@ -1,0 +2,12 @@
+Wed Nov 9 18:48:48 UTC 2022 - Yogalakshmi Arunachalam <[email protected]>
+
+- 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
+
+-------------------------------------------------------------------
Old:
----
python-pyupgrade-3.1.0.tar.gz
New:
----
python-pyupgrade-3.2.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pyupgrade.spec ++++++
--- /var/tmp/diff_new_pack.wwfxs3/_old 2022-11-17 17:24:55.089196738 +0100
+++ /var/tmp/diff_new_pack.wwfxs3/_new 2022-11-17 17:24:55.093196759 +0100
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-pyupgrade
-Version: 3.1.0
+Version: 3.2.0
Release: 0
Summary: A tool to automatically upgrade syntax for newer versions
License: MIT
++++++ python-pyupgrade-3.1.0.tar.gz -> python-pyupgrade-3.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.1.0/.pre-commit-config.yaml
new/pyupgrade-3.2.0/.pre-commit-config.yaml
--- old/pyupgrade-3.1.0/.pre-commit-config.yaml 2022-10-11 00:03:27.000000000
+0200
+++ new/pyupgrade-3.2.0/.pre-commit-config.yaml 2022-10-29 23:50:47.000000000
+0200
@@ -10,11 +10,11 @@
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://github.com/asottile/setup-cfg-fmt
- rev: v2.0.0
+ rev: v2.1.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/reorder_python_imports
- rev: v3.8.3
+ rev: v3.8.5
hooks:
- id: reorder-python-imports
args: [--py37-plus, --add-import, 'from __future__ import annotations']
@@ -24,7 +24,7 @@
- id: add-trailing-comma
args: [--py36-plus]
- repo: https://github.com/asottile/pyupgrade
- rev: v3.1.0
+ rev: v3.2.0
hooks:
- id: pyupgrade
args: [--py37-plus]
@@ -37,6 +37,6 @@
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: v0.971
+ rev: v0.982
hooks:
- id: mypy
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.1.0/README.md
new/pyupgrade-3.2.0/README.md
--- old/pyupgrade-3.1.0/README.md 2022-10-11 00:03:27.000000000 +0200
+++ new/pyupgrade-3.2.0/README.md 2022-10-29 23:50:47.000000000 +0200
@@ -22,7 +22,7 @@
```yaml
- repo: https://github.com/asottile/pyupgrade
- rev: v3.1.0
+ rev: v3.2.0
hooks:
- id: pyupgrade
```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.1.0/pyupgrade/_plugins/imports.py
new/pyupgrade-3.2.0/pyupgrade/_plugins/imports.py
--- old/pyupgrade-3.1.0/pyupgrade/_plugins/imports.py 2022-10-11
00:03:27.000000000 +0200
+++ new/pyupgrade-3.2.0/pyupgrade/_plugins/imports.py 2022-10-29
23:50:47.000000000 +0200
@@ -21,7 +21,7 @@
from pyupgrade._token_helpers import indented_amount
# GENERATED VIA generate-imports
-# Using reorder-python-imports==3.8.4
+# Using reorder-python-imports==3.9.0
REMOVALS = {
(3,): {
'__future__': {
@@ -164,6 +164,25 @@
('typing_extensions', 'get_origin'): 'typing',
('typing_extensions', 'is_typeddict'): 'typing',
},
+ (3, 11): {
+ ('typing_extensions', 'Any'): 'typing',
+ ('typing_extensions', 'LiteralString'): 'typing',
+ ('typing_extensions', 'NamedTuple'): 'typing',
+ ('typing_extensions', 'Never'): 'typing',
+ ('typing_extensions', 'NotRequired'): 'typing',
+ ('typing_extensions', 'Required'): 'typing',
+ ('typing_extensions', 'Self'): 'typing',
+ ('typing_extensions', 'TypedDict'): 'typing',
+ ('typing_extensions', 'Unpack'): 'typing',
+ ('typing_extensions', 'assert_never'): 'typing',
+ ('typing_extensions', 'assert_type'): 'typing',
+ ('typing_extensions', 'clear_overloads'): 'typing',
+ ('typing_extensions', 'dataclass_transform'): 'typing',
+ ('typing_extensions', 'final'): 'typing',
+ ('typing_extensions', 'get_overloads'): 'typing',
+ ('typing_extensions', 'overload'): 'typing',
+ ('typing_extensions', 'reveal_type'): 'typing',
+ },
}
REPLACE_MODS = {
'six.moves.BaseHTTPServer': 'http.server',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pyupgrade-3.1.0/pyupgrade/_plugins/typing_pep646_unpack.py
new/pyupgrade-3.2.0/pyupgrade/_plugins/typing_pep646_unpack.py
--- old/pyupgrade-3.1.0/pyupgrade/_plugins/typing_pep646_unpack.py
1970-01-01 01:00:00.000000000 +0100
+++ new/pyupgrade-3.2.0/pyupgrade/_plugins/typing_pep646_unpack.py
2022-10-29 23:50:47.000000000 +0200
@@ -0,0 +1,39 @@
+from __future__ import annotations
+
+import ast
+from typing import Iterable
+
+from tokenize_rt import Offset
+from tokenize_rt import Token
+
+from pyupgrade._ast_helpers import ast_to_offset
+from pyupgrade._ast_helpers import is_name_attr
+from pyupgrade._data import register
+from pyupgrade._data import State
+from pyupgrade._data import TokenFunc
+from pyupgrade._token_helpers import find_closing_bracket
+from pyupgrade._token_helpers import find_token
+from pyupgrade._token_helpers import remove_brace
+
+
+def _replace_unpack_with_star(i: int, tokens: list[Token]) -> None:
+ start = find_token(tokens, i, '[')
+ end = find_closing_bracket(tokens, start)
+
+ remove_brace(tokens, end)
+ # replace `Unpack` with `*`
+ tokens[i:start + 1] = [tokens[i]._replace(name='OP', src='*')]
+
+
+@register(ast.Subscript)
+def visit_Subscript(
+ state: State,
+ node: ast.Subscript,
+ parent: ast.AST,
+) -> Iterable[tuple[Offset, TokenFunc]]:
+ if state.settings.min_version < (3, 11):
+ return
+
+ if is_name_attr(node.value, state.from_imports, ('typing',), ('Unpack',)):
+ if isinstance(parent, (ast.Subscript, ast.Index)):
+ yield ast_to_offset(node.value), _replace_unpack_with_star
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.1.0/setup.cfg
new/pyupgrade-3.2.0/setup.cfg
--- old/pyupgrade-3.1.0/setup.cfg 2022-10-11 00:03:27.000000000 +0200
+++ new/pyupgrade-3.2.0/setup.cfg 2022-10-29 23:50:47.000000000 +0200
@@ -1,6 +1,6 @@
[metadata]
name = pyupgrade
-version = 3.1.0
+version = 3.2.0
description = A tool to automatically upgrade syntax for newer versions.
long_description = file: README.md
long_description_content_type = text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pyupgrade-3.1.0/tests/features/typing_pep646_unpack_test.py
new/pyupgrade-3.2.0/tests/features/typing_pep646_unpack_test.py
--- old/pyupgrade-3.1.0/tests/features/typing_pep646_unpack_test.py
1970-01-01 01:00:00.000000000 +0100
+++ new/pyupgrade-3.2.0/tests/features/typing_pep646_unpack_test.py
2022-10-29 23:50:47.000000000 +0200
@@ -0,0 +1,60 @@
+from __future__ import annotations
+
+import pytest
+
+from pyupgrade._data import Settings
+from pyupgrade._main import _fix_plugins
+
+
[email protected](
+ ('s',),
+ (
+ pytest.param(
+ 'from typing import Unpack\n'
+ 'foo(Unpack())',
+ id='Not a subscript',
+ ),
+ pytest.param(
+ 'from typing import TypeVarTuple, Unpack\n'
+ 'Shape = TypeVarTuple("Shape")\n'
+ 'class Foo(Unpack[Shape]):\n'
+ ' pass',
+ id='Not inside a subscript',
+ ),
+ ),
+)
+def test_fix_pep646_noop(s):
+ assert _fix_plugins(s, settings=Settings(min_version=(3, 11))) == s
+ assert _fix_plugins(s, settings=Settings(min_version=(3, 10))) == s
+
+
[email protected](
+ ('s', 'expected'),
+ (
+ (
+ 'from typing import Generic, TypeVarTuple, Unpack\n'
+ "Shape = TypeVarTuple('Shape')\n"
+ 'class C(Generic[Unpack[Shape]]):\n'
+ ' pass',
+
+ 'from typing import Generic, TypeVarTuple, Unpack\n'
+ "Shape = TypeVarTuple('Shape')\n"
+ 'class C(Generic[*Shape]):\n'
+ ' pass',
+ ),
+ (
+ 'from typing import Generic, TypeVarTuple, Unpack\n'
+ "Shape = TypeVarTuple('Shape')\n"
+ 'class C(Generic[Unpack [Shape]]):\n'
+ ' pass',
+
+ 'from typing import Generic, TypeVarTuple, Unpack\n'
+ "Shape = TypeVarTuple('Shape')\n"
+ 'class C(Generic[*Shape]):\n'
+ ' pass',
+ ),
+ ),
+)
+def test_typing_unpack(s, expected):
+ assert _fix_plugins(s, settings=Settings(min_version=(3, 11))) == expected
+ assert _fix_plugins(s, settings=Settings(min_version=(3, 10))) == s