15
0

- update to 23.11.0:

* Y058: Use `Iterator` rather than `Generator` as the return
    value for simple `__iter__` methods, and `AsyncIterator` rather
    than `AsyncGenerator` as the return value for simple `__aiter__`
    methods.
  * Y059: `Generic[]` should always be the last base class, if it
    is present in the bases of a class.
  * Y060, which flags redundant inheritance from `Generic[]`.
  * Y061: Do not use `None` inside a `Literal[]` slice.
  * For example, use `Literal["foo"] | None` instead of
    `Literal["foo", None]`.
  * Y022 and Y037 now flag more imports from `typing_extensions`.
  * Y034 now attempts to avoid flagging methods inside classes
    that inherit from `builtins.type`, `abc.ABCMeta` and/or
    `enum.EnumMeta`.  Classes that have one or more of these as
    bases are metaclasses, and PEP 673 forbids the use of
    `typing(_extensions).Self` for metaclasses.
  * Attempting to import `typing_extensions.Text` now causes Y039
    to be emitted rather than Y023.
  * Y053 will no longer be emitted for the argument to
    `@typing_extensions.deprecated`.
  * Introduce Y090, which warns if you have an annotation such as
    `tuple[int]` or `Tuple[int]`. These mean "a tuple of length 1,
    in which the sole element is of type `int`". This is sometimes
    what you want, but more usually you'll want `tuple[int, ...]`,
    which means "a tuple of arbitrary (possibly 0) length, in
    which all elements are of type `int`".
  * Y011 now ignores `sentinel` and `_typeshed.sentinel` in
    default values.
  * Y011/Y014/Y015: Allow math constants math.inf, math.nan, math.e,

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=21
This commit is contained in:
2023-12-05 21:09:18 +00:00
committed by Git OBS Bridge
parent 5e5d7cc4a9
commit 7530a289d2
5 changed files with 73 additions and 43 deletions

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:93de2acdd34db508c87e7b5c5b431108e15dfd349a162ab194b9ac49f3b99103
size 56425

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:597c750fd0394a237d4e0b51feb222b3cc7a7ebee5b3c59a15b58f6b3f2836a7
size 51066

View File

@@ -1,22 +1,55 @@
-------------------------------------------------------------------
Tue Dec 5 21:07:25 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 23.11.0:
* Y058: Use `Iterator` rather than `Generator` as the return
value for simple `__iter__` methods, and `AsyncIterator` rather
than `AsyncGenerator` as the return value for simple `__aiter__`
methods.
* Y059: `Generic[]` should always be the last base class, if it
is present in the bases of a class.
* Y060, which flags redundant inheritance from `Generic[]`.
* Y061: Do not use `None` inside a `Literal[]` slice.
* For example, use `Literal["foo"] | None` instead of
`Literal["foo", None]`.
* Y022 and Y037 now flag more imports from `typing_extensions`.
* Y034 now attempts to avoid flagging methods inside classes
that inherit from `builtins.type`, `abc.ABCMeta` and/or
`enum.EnumMeta`. Classes that have one or more of these as
bases are metaclasses, and PEP 673 forbids the use of
`typing(_extensions).Self` for metaclasses.
* Attempting to import `typing_extensions.Text` now causes Y039
to be emitted rather than Y023.
* Y053 will no longer be emitted for the argument to
`@typing_extensions.deprecated`.
* Introduce Y090, which warns if you have an annotation such as
`tuple[int]` or `Tuple[int]`. These mean "a tuple of length 1,
in which the sole element is of type `int`". This is sometimes
what you want, but more usually you'll want `tuple[int, ...]`,
which means "a tuple of arbitrary (possibly 0) length, in
which all elements are of type `int`".
* Y011 now ignores `sentinel` and `_typeshed.sentinel` in
default values.
-------------------------------------------------------------------
Fri Aug 25 11:40:31 UTC 2023 - Markéta Machová <mmachova@suse.com>
- Update to 23.6.0
* Y011/Y014/Y015: Allow math constants math.inf, math.nan, math.e,
math.pi, math.tau, and their negatives in default values. Some
other semantically equivalent values, such as x = inf (from math
import inf), or x = np.inf (import numpy as np), should be rewritten
* Y011/Y014/Y015: Allow math constants math.inf, math.nan, math.e,
math.pi, math.tau, and their negatives in default values. Some
other semantically equivalent values, such as x = inf (from math
import inf), or x = np.inf (import numpy as np), should be rewritten
to x = math.inf.
* Y053: Disallow string or bytes literals with length >50 characters.
Previously this rule only applied to parameter default values;
* Y053: Disallow string or bytes literals with length >50 characters.
Previously this rule only applied to parameter default values;
it now applies everywhere.
* Y054: Disallow numeric literals with a string representation >10
characters long. Previously this rule only applied to parameter
* Y054: Disallow numeric literals with a string representation >10
characters long. Previously this rule only applied to parameter
default values; it now applies everywhere.
* Y055: Unions of the form type[X] | type[Y] can be simplified to type[X | Y].
* The way in which flake8-pyi modifies pyflakes runs has been improved.
* Introduce Y056: Various type checkers have different levels of support
for method calls on __all__. Use __all__ += ["foo", "bar"] instead,
* Introduce Y056: Various type checkers have different levels of support
for method calls on __all__. Use __all__ += ["foo", "bar"] instead,
as this is known to be supported by all major type checkers.
* Support Python 3.12
* Support PEP 695 syntax for declaring type aliases
@@ -83,7 +116,7 @@ Other changes:
-------------------------------------------------------------------
Tue Dec 6 03:30:37 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
- Update to version 22.11.0:
- Update to version 22.11.0:
* Bugfixes:
Specify encoding when opening files. Prevents UnicodeDecodeError on Windows when the file contains non-CP1252 characters. Contributed by Avasam.
Significant changes have been made to the Y041 check. Previously, Y041 flagged "redundant numeric unions"
@@ -91,7 +124,7 @@ Tue Dec 6 03:30:37 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
PEP 484 only specifies that type checkers should treat int as an implicit subtype of float in the specific context of parameter annotations
for functions and methods. Y041 has therefore been revised to only emit errors on "redundant numeric unions" in the context of parameter annotations.
* Other changes:
Support running with flake8 v6.
Support running with flake8 v6.
-------------------------------------------------------------------
Fri Nov 4 15:45:00 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
@@ -262,7 +295,7 @@ Fri May 15 21:22:02 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
* support flake8 3.8.0
* introduce Y091 (function body must not contain "raise")
* introduce Y015 (attribute must not have a default value other than "...")
* introduce Y092 (top-level attribute must not have a default value)
* introduce Y092 (top-level attribute must not have a default value)
-------------------------------------------------------------------
Thu Mar 7 16:34:17 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
@@ -280,12 +313,12 @@ Thu Feb 28 09:43:51 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Add build dependency on Python 3.6+
- Add LICENSE
- Udpate to v19.2.0
* Support 3.7
* Be explicit in setup.py about Python 3.6+
* Support 3.7
* Be explicit in setup.py about Python 3.6+
* add `.flake8` to manifest file
* Use --stdin-display-name as filename when reading from stdin
* Add rules for checking an empty class
* Add a check for non-ellipsis, non-typed arguments
* Add a check for non-ellipsis, non-typed arguments
* Coding style improvements
-------------------------------------------------------------------

View File

@@ -16,9 +16,9 @@
#
%define skip_python2 1
%{?sle15_python_module_pythons}
Name: python-flake8-pyi
Version: 23.6.0
Version: 23.11.0
Release: 0
Summary: A plugin for flake8 to enable linting .pyi files
License: MIT
@@ -30,6 +30,7 @@ Source: https://files.pythonhosted.org/packages/source/f/flake8-pyi/flak
Patch0: set-tests-python-path.patch
BuildRequires: %{python_module ast-decompiler}
BuildRequires: %{python_module base >= 3.8.0}
BuildRequires: %{python_module hatch_vcs}
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module wheel}
@@ -42,6 +43,7 @@ BuildRequires: %{python_module pyflakes >= 2.1.1}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module black}
BuildRequires: %{python_module flake8-bugbear}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module typing}
# /SECTION
BuildRequires: fdupes

View File

@@ -1,28 +1,23 @@
Index: flake8_pyi-23.6.0/tests/test_pyi_files.py
Index: flake8_pyi-23.11.0/tests/test_pyi_files.py
===================================================================
--- flake8_pyi-23.6.0.orig/tests/test_pyi_files.py
+++ flake8_pyi-23.6.0/tests/test_pyi_files.py
@@ -42,16 +42,21 @@ def test_pyi_file(path: str) -> None:
--- flake8_pyi-23.11.0.orig/tests/test_pyi_files.py
+++ flake8_pyi-23.11.0/tests/test_pyi_files.py
@@ -43,6 +43,9 @@ def test_pyi_file(path: str) -> None:
option = flag.split("=")[0]
assert option != "--ignore", bad_flag_msg
assert option not in {"--ignore", "--select"}, bad_flag_msg(option[2:])
+ pythonpath = os.environ.get("PYTHONPATH")
+ pythonpath = f"PYTHONPATH={pythonpath}:."
+
run_results = [
# Passing a file on command line
subprocess.run(
- ["flake8", "-j0", *flags, path],
+ " ".join([pythonpath, "flake8", "-j0", *flags, path]),
+ shell=True,
env={**os.environ, "PYTHONPATH": "."},
stdout=subprocess.PIPE,
),
# Passing "-" as the file, and reading from stdin instead
subprocess.run(
- ["flake8", "-j0", "--stdin-display-name", path, *flags, "-"],
+ " ".join([pythonpath, "flake8", "-j0", "--stdin-display-name", path, *flags, "-"]),
+ shell=True,
env={**os.environ, "PYTHONPATH": "."},
input=file_contents.encode("utf-8"),
stdout=subprocess.PIPE,
# Silence DeprecationWarnings from our dependencies (pyflakes, flake8-bugbear, etc.)
#
# For DeprecationWarnings coming from flake8-pyi itself,
@@ -51,6 +54,8 @@ def test_pyi_file(path: str) -> None:
# but the test failure report that pytest gives is much easier to read
# if we use `-Wdefault:::pyi`
flake8_invocation = [
+ "env",
+ pythonpath,
sys.executable,
"-Wignore",
"-Wdefault:::pyi",