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-12-03 12:48:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pyupgrade (Old)
and /work/SRC/openSUSE:Factory/.python-pyupgrade.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pyupgrade"
Sat Dec 3 12:48:32 2022 rev:29 rq:1039759 version:3.2.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pyupgrade/python-pyupgrade.changes
2022-11-17 17:24:52.921185269 +0100
+++
/work/SRC/openSUSE:Factory/.python-pyupgrade.new.1835/python-pyupgrade.changes
2022-12-03 12:48:35.698140645 +0100
@@ -1,0 +2,14 @@
+Sat Dec 3 00:15:00 UTC 2022 - Yogalakshmi Arunachalam <[email protected]>
+
+- 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
+
+-------------------------------------------------------------------
Old:
----
python-pyupgrade-3.2.0.tar.gz
New:
----
python-pyupgrade-3.2.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pyupgrade.spec ++++++
--- /var/tmp/diff_new_pack.3f1zU7/_old 2022-12-03 12:48:36.270143841 +0100
+++ /var/tmp/diff_new_pack.3f1zU7/_new 2022-12-03 12:48:36.274143863 +0100
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-pyupgrade
-Version: 3.2.0
+Version: 3.2.2
Release: 0
Summary: A tool to automatically upgrade syntax for newer versions
License: MIT
++++++ python-pyupgrade-3.2.0.tar.gz -> python-pyupgrade-3.2.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.2.0/.pre-commit-config.yaml
new/pyupgrade-3.2.2/.pre-commit-config.yaml
--- old/pyupgrade-3.2.0/.pre-commit-config.yaml 2022-10-29 23:50:47.000000000
+0200
+++ new/pyupgrade-3.2.2/.pre-commit-config.yaml 2022-11-10 16:38:09.000000000
+0100
@@ -10,11 +10,11 @@
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://github.com/asottile/setup-cfg-fmt
- rev: v2.1.0
+ rev: v2.2.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/reorder_python_imports
- rev: v3.8.5
+ rev: v3.9.0
hooks:
- id: reorder-python-imports
args: [--py37-plus, --add-import, 'from __future__ import annotations']
@@ -24,12 +24,12 @@
- id: add-trailing-comma
args: [--py36-plus]
- repo: https://github.com/asottile/pyupgrade
- rev: v3.2.0
+ rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/pre-commit/mirrors-autopep8
- rev: v1.7.0
+ rev: v2.0.0
hooks:
- id: autopep8
- repo: https://github.com/PyCQA/flake8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.2.0/README.md
new/pyupgrade-3.2.2/README.md
--- old/pyupgrade-3.2.0/README.md 2022-10-29 23:50:47.000000000 +0200
+++ new/pyupgrade-3.2.2/README.md 2022-11-10 16:38:09.000000000 +0100
@@ -22,7 +22,7 @@
```yaml
- repo: https://github.com/asottile/pyupgrade
- rev: v3.2.0
+ rev: v3.2.2
hooks:
- id: pyupgrade
```
@@ -665,19 +665,6 @@
```
-### remove unnecessary abspath
-
-Availability:
-- `--py39-plus` is passed on the commandline.
-
-```diff
- from os.path import abspath
-
--abspath(__file__)
-+__file__
-```
-
-
### pep 604 typing rewrites
Availability:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.2.0/pyupgrade/_data.py
new/pyupgrade-3.2.2/pyupgrade/_data.py
--- old/pyupgrade-3.2.0/pyupgrade/_data.py 2022-10-29 23:50:47.000000000
+0200
+++ new/pyupgrade-3.2.2/pyupgrade/_data.py 2022-11-10 16:38:09.000000000
+0100
@@ -43,7 +43,6 @@
RECORD_FROM_IMPORTS = frozenset((
'__future__',
- 'os.path',
'functools',
'mmap',
'select',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.2.0/pyupgrade/_plugins/abspath_file.py
new/pyupgrade-3.2.2/pyupgrade/_plugins/abspath_file.py
--- old/pyupgrade-3.2.0/pyupgrade/_plugins/abspath_file.py 2022-10-29
23:50:47.000000000 +0200
+++ new/pyupgrade-3.2.2/pyupgrade/_plugins/abspath_file.py 1970-01-01
01:00:00.000000000 +0100
@@ -1,53 +0,0 @@
-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._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_open_paren
-
-
-def _remove_abspath(i: int, tokens: list[Token]) -> None:
- paren_start = find_open_paren(tokens, i + 1)
- paren_end = find_closing_bracket(tokens, paren_start)
- while i <= paren_start:
- tokens[i] = Token('PLACEHOLDER', '')
- i += 1
- tokens[paren_end] = Token('PLACEHOLDER', '')
-
-
-@register(ast.Call)
-def visit_Call(
- state: State,
- node: ast.Call,
- parent: ast.AST,
-) -> Iterable[tuple[Offset, TokenFunc]]:
- if (
- state.settings.min_version >= (3, 9) and
- (
- (
- isinstance(node.func, ast.Name) and
- node.func.id == 'abspath' and
- node.func.id in state.from_imports['os.path']
- ) or
- (
- isinstance(node.func, ast.Attribute) and
- isinstance(node.func.value, ast.Attribute) and
- isinstance(node.func.value.value, ast.Name) and
- node.func.value.value.id == 'os' and
- node.func.value.attr == 'path' and
- node.func.attr == 'abspath'
- )
- ) and
- len(node.args) == 1 and
- isinstance(node.args[0], ast.Name) and
- node.args[0].id == '__file__'
- ):
- yield ast_to_offset(node), _remove_abspath
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.2.0/pyupgrade/_plugins/typing_pep604.py
new/pyupgrade-3.2.2/pyupgrade/_plugins/typing_pep604.py
--- old/pyupgrade-3.2.0/pyupgrade/_plugins/typing_pep604.py 2022-10-29
23:50:47.000000000 +0200
+++ new/pyupgrade-3.2.2/pyupgrade/_plugins/typing_pep604.py 2022-11-10
16:38:09.000000000 +0100
@@ -144,16 +144,17 @@
if not _supported_version(state):
return
- # prevent rewriting forward annotations
- if (
- (sys.version_info >= (3, 9) and _any_arg_is_str(node.slice)) or
- (
- sys.version_info < (3, 9) and
- isinstance(node.slice, ast.Index) and
- _any_arg_is_str(node.slice.value)
- )
- ):
- return
+ # don't rewrite forward annotations (unless we know they will be dequoted)
+ if 'annotations' not in state.from_imports['__future__']:
+ if (
+ (sys.version_info >= (3, 9) and _any_arg_is_str(node.slice)) or
+ (
+ sys.version_info < (3, 9) and
+ isinstance(node.slice, ast.Index) and
+ _any_arg_is_str(node.slice.value)
+ )
+ ):
+ return
if is_name_attr(
node.value,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.2.0/setup.cfg
new/pyupgrade-3.2.2/setup.cfg
--- old/pyupgrade-3.2.0/setup.cfg 2022-10-29 23:50:47.000000000 +0200
+++ new/pyupgrade-3.2.2/setup.cfg 2022-11-10 16:38:09.000000000 +0100
@@ -1,6 +1,6 @@
[metadata]
name = pyupgrade
-version = 3.2.0
+version = 3.2.2
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.2.0/tests/features/abspath_file_test.py
new/pyupgrade-3.2.2/tests/features/abspath_file_test.py
--- old/pyupgrade-3.2.0/tests/features/abspath_file_test.py 2022-10-29
23:50:47.000000000 +0200
+++ new/pyupgrade-3.2.2/tests/features/abspath_file_test.py 1970-01-01
01:00:00.000000000 +0100
@@ -1,54 +0,0 @@
-from __future__ import annotations
-
-import pytest
-
-from pyupgrade._data import Settings
-from pyupgrade._main import _fix_plugins
-
-
[email protected](
- ('s', 'expected'),
- (
- pytest.param(
- 'from os.path import abspath\n'
- 'abspath(__file__)',
- 'from os.path import abspath\n'
- '__file__',
- id='abspath',
- ),
- pytest.param(
- 'import os\n'
- 'os.path.abspath(__file__)',
- 'import os\n'
- '__file__',
- id='os.path.abspath',
- ),
- ),
-)
-def test_fix_abspath_file(s, expected):
- ret = _fix_plugins(s, settings=Settings(min_version=(3, 9)))
- assert ret == expected
-
-
[email protected](
- 's, min_version',
- (
- pytest.param(
- 'abspath(__file__)',
- (3, 8),
- id='Not Python3.9+',
- ),
- pytest.param(
- 'os.path.abspath(file)',
- (3, 9),
- id='Abspath of not-__file__',
- ),
- pytest.param(
- 'os.path.abspath(file, foo)',
- (3, 9),
- id='Garbage (don\'t rewrite)',
- ),
- ),
-)
-def test_fix_abspath_file_noop(s, min_version):
- assert _fix_plugins(s, settings=Settings(min_version=min_version)) == s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyupgrade-3.2.0/tests/features/typing_pep604_test.py
new/pyupgrade-3.2.2/tests/features/typing_pep604_test.py
--- old/pyupgrade-3.2.0/tests/features/typing_pep604_test.py 2022-10-29
23:50:47.000000000 +0200
+++ new/pyupgrade-3.2.2/tests/features/typing_pep604_test.py 2022-11-10
16:38:09.000000000 +0100
@@ -186,6 +186,17 @@
id='Optional rewrite multi-line',
),
pytest.param(
+ 'from __future__ import annotations\n'
+ 'from typing import Optional\n'
+ 'x: Optional["str"]\n',
+
+ 'from __future__ import annotations\n'
+ 'from typing import Optional\n'
+ 'x: str | None\n',
+
+ id='Optional rewrite with forward reference',
+ ),
+ pytest.param(
'from typing import Union, Sequence\n'
'def f(x: Union[Union[A, B], Sequence[Union[C, D]]]): pass\n',