Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-flake8-pyi for 
openSUSE:Factory checked in at 2024-04-21 20:27:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flake8-pyi (Old)
 and      /work/SRC/openSUSE:Factory/.python-flake8-pyi.new.26366 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-flake8-pyi"

Sun Apr 21 20:27:09 2024 rev:15 rq:1169364 version:24.4.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-flake8-pyi/python-flake8-pyi.changes      
2024-04-07 22:15:05.050554239 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-flake8-pyi.new.26366/python-flake8-pyi.changes
   2024-04-21 20:28:41.665033056 +0200
@@ -1,0 +2,9 @@
+Sat Apr 20 13:45:03 UTC 2024 - Dirk Müller <[email protected]>
+
+- update to 24.4.1:
+  * Y066: When using if/else with `sys.version_info`,
+    put the code for new Python versions first.
+  * Fix Y026 false positive: allow simple assignment to `None` in
+    class scopes if the class is known to be an enum class.
+
+-------------------------------------------------------------------

Old:
----
  flake8_pyi-24.3.1.tar.gz

New:
----
  flake8_pyi-24.4.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-flake8-pyi.spec ++++++
--- /var/tmp/diff_new_pack.hUSFGG/_old  2024-04-21 20:28:43.129086798 +0200
+++ /var/tmp/diff_new_pack.hUSFGG/_new  2024-04-21 20:28:43.133086945 +0200
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-flake8-pyi
-Version:        24.3.1
+Version:        24.4.1
 Release:        0
 Summary:        A plugin for flake8 to enable linting .pyi files
 License:        MIT

++++++ flake8_pyi-24.3.1.tar.gz -> flake8_pyi-24.4.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8_pyi-24.3.1/.pre-commit-config.yaml 
new/flake8_pyi-24.4.1/.pre-commit-config.yaml
--- old/flake8_pyi-24.3.1/.pre-commit-config.yaml       2020-02-02 
01:00:00.000000000 +0100
+++ new/flake8_pyi-24.4.1/.pre-commit-config.yaml       2020-02-02 
01:00:00.000000000 +0100
@@ -9,7 +9,7 @@
       - id: check-merge-conflict
       - id: mixed-line-ending
   - repo: https://github.com/psf/black-pre-commit-mirror
-    rev: 24.1.1 # must match pyproject.toml
+    rev: 24.3.0 # must match pyproject.toml
     hooks:
       - id: black
         language_version: python3.8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8_pyi-24.3.1/CHANGELOG.md 
new/flake8_pyi-24.4.1/CHANGELOG.md
--- old/flake8_pyi-24.3.1/CHANGELOG.md  2020-02-02 01:00:00.000000000 +0100
+++ new/flake8_pyi-24.4.1/CHANGELOG.md  2020-02-02 01:00:00.000000000 +0100
@@ -1,5 +1,17 @@
 # Change Log
 
+## 24.4.1
+
+New error codes:
+* Y066: When using if/else with `sys.version_info`,
+  put the code for new Python versions first.
+
+## 24.4.0
+
+Bugfixes:
+* Fix Y026 false positive: allow simple assignment to `None` in class scopes
+  if the class is known to be an enum class.
+
 ## 24.3.1
 
 New error codes:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8_pyi-24.3.1/ERRORCODES.md 
new/flake8_pyi-24.4.1/ERRORCODES.md
--- old/flake8_pyi-24.3.1/ERRORCODES.md 2020-02-02 01:00:00.000000000 +0100
+++ new/flake8_pyi-24.4.1/ERRORCODES.md 2020-02-02 01:00:00.000000000 +0100
@@ -79,6 +79,7 @@
 | Y063 | Use [PEP 570 syntax](https://peps.python.org/pep-0570/) (e.g. `def 
foo(x: int, /) -> None: ...`) to denote positional-only arguments, rather than 
[the older Python 3.7-compatible syntax described in PEP 
484](https://peps.python.org/pep-0484/#positional-only-arguments) (`def 
foo(__x: int) -> None: ...`, etc.). | Style
 | Y064 | Use simpler syntax to define final literal types. For example, use 
`x: Final = 42` instead of `x: Final[Literal[42]]`. | Style
 | Y065 | Don't use bare `Incomplete` in argument and return annotations. 
Instead, leave them unannotated. Omitting an annotation entirely from a 
function will cause some type checkers to view the parameter or return type as 
"untyped"; this may result in stricter type-checking on code that makes use of 
the stubbed function. | Style
+| Y066 | When using if/else with `sys.version_info`, put the code for new 
Python versions first. | Style
 
 ## Warnings disabled by default
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8_pyi-24.3.1/PKG-INFO 
new/flake8_pyi-24.4.1/PKG-INFO
--- old/flake8_pyi-24.3.1/PKG-INFO      2020-02-02 01:00:00.000000000 +0100
+++ new/flake8_pyi-24.4.1/PKG-INFO      2020-02-02 01:00:00.000000000 +0100
@@ -1,18 +1,18 @@
 Metadata-Version: 2.3
 Name: flake8-pyi
-Version: 24.3.1
+Version: 24.4.1
 Summary: A plugin for flake8 to enable linting .pyi stub files.
 Project-URL: Homepage, https://github.com/PyCQA/flake8-pyi
 Project-URL: Source, https://github.com/PyCQA/flake8-pyi
 Project-URL: Bug Tracker, https://github.com/PyCQA/flake8-pyi/issues
 Project-URL: Changelog, 
https://github.com/PyCQA/flake8-pyi/blob/main/CHANGELOG.md
 Author-email: Łukasz Langa <[email protected]>
-Maintainer: Sebastian Rittau, Akuli, Shantanu
-Maintainer-email: Jelle Zijlstra <[email protected]>, Alex Waygood 
<[email protected]>
+Maintainer: Akuli, Shantanu
+Maintainer-email: Jelle Zijlstra <[email protected]>, Alex Waygood 
<[email protected]>, Sebastian Rittau <[email protected]>
 License: MIT
 License-File: LICENSE
 Keywords: bugs,flake8,linter,pyflakes,pyi,qa,stubs,typing
-Classifier: Development Status :: 3 - Alpha
+Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Console
 Classifier: Framework :: Flake8
 Classifier: Intended Audience :: Developers
@@ -32,14 +32,14 @@
 Requires-Dist: flake8<8.0.0,>=6.0.0
 Requires-Dist: pyflakes>=2.1.1
 Provides-Extra: dev
-Requires-Dist: black==24.1.1; extra == 'dev'
-Requires-Dist: flake8-bugbear==24.1.17; extra == 'dev'
+Requires-Dist: black==24.3.0; extra == 'dev'
+Requires-Dist: flake8-bugbear==24.2.6; extra == 'dev'
 Requires-Dist: flake8-noqa==1.4.0; extra == 'dev'
 Requires-Dist: isort==5.13.2; extra == 'dev'
-Requires-Dist: mypy==1.8.0; extra == 'dev'
+Requires-Dist: mypy==1.9.0; extra == 'dev'
 Requires-Dist: pre-commit-hooks==4.5.0; extra == 'dev'
 Requires-Dist: pytest-xdist==3.5.0; extra == 'dev'
-Requires-Dist: pytest==8.0.0; extra == 'dev'
+Requires-Dist: pytest==8.1.1; extra == 'dev'
 Requires-Dist: types-pyflakes<4; extra == 'dev'
 Description-Content-Type: text/markdown
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8_pyi-24.3.1/pyi.py new/flake8_pyi-24.4.1/pyi.py
--- old/flake8_pyi-24.3.1/pyi.py        2020-02-02 01:00:00.000000000 +0100
+++ new/flake8_pyi-24.4.1/pyi.py        2020-02-02 01:00:00.000000000 +0100
@@ -1219,7 +1219,7 @@
             isinstance(assignment, ast.Subscript)
             or _is_valid_pep_604_union(assignment)
             or _is_Any(assignment)
-            or _is_None(assignment)
+            or (_is_None(assignment) and not self.visiting_enum_class)
         ):
             new_node = ast.AnnAssign(
                 target=target,
@@ -1586,6 +1586,8 @@
             self.visit(node)
 
     def visit_If(self, node: ast.If) -> None:
+        self._check_for_Y066_violations(node)
+
         test = node.test
         # No types can appear in if conditions, so avoid confusing additional 
errors.
         with self.string_literals_allowed.enabled():
@@ -1621,6 +1623,34 @@
         else:
             self.error(node, Y002)
 
+    def _check_for_Y066_violations(self, node: ast.If) -> None:
+        def is_version_info(attr: ast.expr) -> bool:
+            return (
+                isinstance(attr, ast.Attribute)
+                and _is_name(attr.value, "sys")
+                and attr.attr == "version_info"
+            )
+
+        def if_chain_ends_with_else(if_chain: ast.If) -> bool:
+            orelse = if_chain.orelse
+            if len(orelse) == 1 and isinstance(orelse[0], ast.If):
+                return if_chain_ends_with_else(orelse[0])
+            return bool(orelse)
+
+        test = node.test
+        if not isinstance(test, ast.Compare):
+            return
+
+        left = test.left
+        op = test.ops[0]
+        if (
+            is_version_info(left)
+            and isinstance(op, ast.Lt)  # sys.version_info < ...
+            and if_chain_ends_with_else(node)
+        ):
+            new_syntax = "if " + unparse(test).replace("<", ">=", 1)
+            self.error(node, Y066.format(new_syntax=new_syntax))
+
     def _check_subscript_version_check(self, node: ast.Compare) -> None:
         # unless this is on, comparisons against a single integer aren't 
allowed
         must_be_single = False
@@ -2415,6 +2445,10 @@
 Y063 = "Y063 Use PEP-570 syntax to indicate positional-only arguments"
 Y064 = 'Y064 Use "{suggestion}" instead of "{original}"'
 Y065 = 'Y065 Leave {what} unannotated rather than using "Incomplete"'
+Y066 = (
+    "Y066 When using if/else with sys.version_info, "
+    'put the code for new Python versions first, e.g. "{new_syntax}"'
+)
 Y090 = (
     'Y090 "{original}" means '
     '"a tuple of length 1, in which the sole element is of type {typ!r}". '
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8_pyi-24.3.1/pyproject.toml 
new/flake8_pyi-24.4.1/pyproject.toml
--- old/flake8_pyi-24.3.1/pyproject.toml        2020-02-02 01:00:00.000000000 
+0100
+++ new/flake8_pyi-24.4.1/pyproject.toml        2020-02-02 01:00:00.000000000 
+0100
@@ -11,7 +11,7 @@
 maintainers = [
   { name="Jelle Zijlstra", email="[email protected]" },
   { name="Alex Waygood", email="[email protected]" },
-  { name="Sebastian Rittau" },
+  { name="Sebastian Rittau", email="[email protected]" },
   { name="Akuli" },
   { name="Shantanu" },
 ]
@@ -30,7 +30,7 @@
     "typing",
 ]
 classifiers = [
-    "Development Status :: 3 - Alpha",
+    "Development Status :: 5 - Production/Stable",
     "Environment :: Console",
     "Framework :: Flake8",
     "Intended Audience :: Developers",
@@ -60,13 +60,13 @@
 
 [project.optional-dependencies]
 dev = [
-    "black==24.1.1",            # Must match .pre-commit-config.yaml
-    "flake8-bugbear==24.1.17",
+    "black==24.3.0",            # Must match .pre-commit-config.yaml
+    "flake8-bugbear==24.2.6",
     "flake8-noqa==1.4.0",
     "isort==5.13.2",            # Must match .pre-commit-config.yaml
-    "mypy==1.8.0",
+    "mypy==1.9.0",
     "pre-commit-hooks==4.5.0",  # Must match .pre-commit-config.yaml
-    "pytest==8.0.0",
+    "pytest==8.1.1",
     "pytest-xdist==3.5.0",
     "types-pyflakes<4",
 ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8_pyi-24.3.1/tests/aliases.pyi 
new/flake8_pyi-24.4.1/tests/aliases.pyi
--- old/flake8_pyi-24.3.1/tests/aliases.pyi     2020-02-02 01:00:00.000000000 
+0100
+++ new/flake8_pyi-24.4.1/tests/aliases.pyi     2020-02-02 01:00:00.000000000 
+0100
@@ -2,6 +2,7 @@
 import array
 import builtins
 import collections.abc
+import enum
 import typing
 from collections.abc import Mapping
 from typing import (
@@ -86,3 +87,6 @@
 
 # check that this edge case doesn't crash the plugin
 _: TypeAlias = str | int
+
+class FooEnum(enum.Enum):
+    BAR = None  # shouldn't emit Y026 because it's an assignment in an enum 
class
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8_pyi-24.3.1/tests/sysversioninfo.pyi 
new/flake8_pyi-24.4.1/tests/sysversioninfo.pyi
--- old/flake8_pyi-24.3.1/tests/sysversioninfo.pyi      2020-02-02 
01:00:00.000000000 +0100
+++ new/flake8_pyi-24.4.1/tests/sysversioninfo.pyi      2020-02-02 
01:00:00.000000000 +0100
@@ -29,3 +29,29 @@
 if sys.version_info < (3, 5): ...
 if sys.version_info >= (3, 5): ...
 if (2, 7) <= sys.version_info < (3, 5): ...  # Y002 If test must be a simple 
comparison against sys.platform or sys.version_info
+
+if sys.version_info >= (3, 10):
+    def foo1(x, *, bar=True, baz=False): ...
+elif sys.version_info >= (3, 9):
+    def foo1(x, *, bar=True): ...
+else:
+    def foo1(x): ...
+
+if sys.version_info < (3, 9):
+    def foo2(x): ...
+elif sys.version_info < (3, 10):
+    def foo2(x, *, bar=True): ...
+
+if sys.version_info < (3, 10):  # Y066 When using if/else with 
sys.version_info, put the code for new Python versions first, e.g. "if 
sys.version_info >= (3, 10)"
+    def foo3(x): ...
+else:
+    def foo3(x, *, bar=True): ...
+
+if sys.version_info < (3, 8):  # Y066 When using if/else with 
sys.version_info, put the code for new Python versions first, e.g. "if 
sys.version_info >= (3, 8)"
+    def foo4(x): ...
+elif sys.version_info < (3, 9):  # Y066 When using if/else with 
sys.version_info, put the code for new Python versions first, e.g. "if 
sys.version_info >= (3, 9)"
+    def foo4(x, *, bar=True): ...
+elif sys.version_info < (3, 10):  # Y066 When using if/else with 
sys.version_info, put the code for new Python versions first, e.g. "if 
sys.version_info >= (3, 10)"
+    def foo4(x, *, bar=True, baz=False): ...
+else:
+    def foo4(x, *, bar=True, baz=False, qux=1): ...

Reply via email to