15
0
Files
python-flake8-pyi/set-tests-python-path.patch

24 lines
953 B
Diff
Raw Normal View History

- 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
2023-12-05 21:09:18 +00:00
Index: flake8_pyi-23.11.0/tests/test_pyi_files.py
- Add set-tests-python-path.patch to fix tests inside osc build environment, running the flake8 process with shell=True and forcing the PYTHONPATH. - Update to 23.1.2: * Y011/Y014/Y015: Increase the maximum character length of literal numbers in default values from 7 to 10, allowing hexadecimal representation of 32-bit integers. Contributed by Avasam. - 23.1.1 New error codes: * Y052: Disallow default values in global or class namespaces where the assignment does not have a type annotation. Stubs should be explicit about the type of all variables in the stub; without type annotations, the type checker is forced to make inferences, which may have unpredictable consequences. Enum members are excluded from this check, as are various special assignments such as __all__ and __match_args__. Other changes: * Disallow numeric default values where len(str(default)) > 7. If a function has a default value where the string representation is greater than 7 characters, it is likely to be an implementation detail or a constant that varies depending on the system you're running on, such as sys.maxsize. * Disallow str or bytes defaults where the default is >50 characters long, for similar reasons. * Allow ast.Attribute nodes as default values for a small number of special cases, such as sys.maxsize and sys.executable. * Fewer Y020 false positives are now emitted when encountering default values in stub files. - 23.1.0 Bugfixes: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
2023-03-06 15:56:20 +00:00
===================================================================
- 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
2023-12-05 21:09:18 +00:00
--- 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:
2023-08-25 18:47:40 +00:00
option = flag.split("=")[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
2023-12-05 21:09:18 +00:00
assert option not in {"--ignore", "--select"}, bad_flag_msg(option[2:])
- Add set-tests-python-path.patch to fix tests inside osc build environment, running the flake8 process with shell=True and forcing the PYTHONPATH. - Update to 23.1.2: * Y011/Y014/Y015: Increase the maximum character length of literal numbers in default values from 7 to 10, allowing hexadecimal representation of 32-bit integers. Contributed by Avasam. - 23.1.1 New error codes: * Y052: Disallow default values in global or class namespaces where the assignment does not have a type annotation. Stubs should be explicit about the type of all variables in the stub; without type annotations, the type checker is forced to make inferences, which may have unpredictable consequences. Enum members are excluded from this check, as are various special assignments such as __all__ and __match_args__. Other changes: * Disallow numeric default values where len(str(default)) > 7. If a function has a default value where the string representation is greater than 7 characters, it is likely to be an implementation detail or a constant that varies depending on the system you're running on, such as sys.maxsize. * Disallow str or bytes defaults where the default is >50 characters long, for similar reasons. * Allow ast.Attribute nodes as default values for a small number of special cases, such as sys.maxsize and sys.executable. * Fewer Y020 false positives are now emitted when encountering default values in stub files. - 23.1.0 Bugfixes: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
2023-03-06 15:56:20 +00:00
+ pythonpath = os.environ.get("PYTHONPATH")
+ pythonpath = f"PYTHONPATH={pythonpath}:."
+
- 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
2023-12-05 21:09:18 +00:00
# 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",