forked from pool/python-flake8-pyi
Accepting request 1069697 from devel:languages:python
- 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:
* Do not emit Y020 (quoted annotations) for strings in parameter defaults.
* Fix checking of defaults for functions with positional-only parameters.
Other changes:
* Modify Y036 so that _typeshed.Unused is allowed as an annotation
for parameters in __(a)exit__ methods. Contributed by Avasam
* Several changes have been made to error codes relating to imports:
- The Y027 error code has been removed.
- All errors that used to result in Y027 being emitted now result
in Y022 being emitted instead.
- Some errors that used to result in Y023 being emitted now result
in Y022 being emitted instead.
- typing.Match and typing.Pattern have been added to the list of
imports banned by Y022. Use re.Match and re.Pattern instead.
* flake8-pyi no longer supports stub files that aim to support
Python 2. If your stubs need to support Python 2, pin flake8-pyi
to 22.11.0 or lower.
* Y011, Y014 and Y015 have all been significantly relaxed. None,
bools, ints, floats, complex numbers, strings and bytes are all
now allowed as default values for parameter annotations or
assignments.
* Hatchling is now used as the build backend. This should have
minimal, if any, user-facing impact.
OBS-URL: https://build.opensuse.org/request/show/1069697
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-flake8-pyi?expand=0&rev=9
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ded2e4d947f0605abe9095ae3d38b01b7880b112bc3da0b4f888cd4a717c7acd
|
||||
size 41386
|
||||
3
flake8_pyi-23.1.2.tar.gz
Normal file
3
flake8_pyi-23.1.2.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:226866b75e8ae264e47799576ebbac96323cee6b85196bd286baa30a19bddf65
|
||||
size 46799
|
||||
@@ -1,3 +1,59 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 6 15:53:17 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
||||
|
||||
- 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:
|
||||
* Do not emit Y020 (quoted annotations) for strings in parameter defaults.
|
||||
* Fix checking of defaults for functions with positional-only parameters.
|
||||
Other changes:
|
||||
* Modify Y036 so that _typeshed.Unused is allowed as an annotation
|
||||
for parameters in __(a)exit__ methods. Contributed by Avasam
|
||||
* Several changes have been made to error codes relating to imports:
|
||||
- The Y027 error code has been removed.
|
||||
- All errors that used to result in Y027 being emitted now result
|
||||
in Y022 being emitted instead.
|
||||
- Some errors that used to result in Y023 being emitted now result
|
||||
in Y022 being emitted instead.
|
||||
- typing.Match and typing.Pattern have been added to the list of
|
||||
imports banned by Y022. Use re.Match and re.Pattern instead.
|
||||
* flake8-pyi no longer supports stub files that aim to support
|
||||
Python 2. If your stubs need to support Python 2, pin flake8-pyi
|
||||
to 22.11.0 or lower.
|
||||
* Y011, Y014 and Y015 have all been significantly relaxed. None,
|
||||
bools, ints, floats, complex numbers, strings and bytes are all
|
||||
now allowed as default values for parameter annotations or
|
||||
assignments.
|
||||
* Hatchling is now used as the build backend. This should have
|
||||
minimal, if any, user-facing impact.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 6 03:30:37 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-flake8-pyi
|
||||
#
|
||||
# Copyright (c) 2022 SUSE LLC
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -18,16 +18,21 @@
|
||||
|
||||
%define skip_python2 1
|
||||
Name: python-flake8-pyi
|
||||
Version: 22.11.0
|
||||
Version: 23.1.2
|
||||
Release: 0
|
||||
Summary: A plugin for flake8 to enable linting .pyi files
|
||||
License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/ambv/flake8-pyi
|
||||
Source: https://files.pythonhosted.org/packages/source/f/flake8-pyi/flake8-pyi-%{version}.tar.gz
|
||||
Source: https://files.pythonhosted.org/packages/source/f/flake8-pyi/flake8_pyi-%{version}.tar.gz
|
||||
# PATCH-FIX-OPENSUSE set-tests-python-path.patch, patch to fix
|
||||
# PYTHONPATH resolution for tests running inside osc
|
||||
Patch0: set-tests-python-path.patch
|
||||
BuildRequires: %{python_module ast-decompiler}
|
||||
BuildRequires: %{python_module base >= 3.6.0}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module hatchling}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: python-rpm-macros
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module attrs}
|
||||
@@ -35,6 +40,8 @@ BuildRequires: %{python_module flake8 >= 3.2.1}
|
||||
BuildRequires: %{python_module pyflakes >= 2.1.1}
|
||||
# Use pytest directly to bypass setup.py test dependencies
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module black}
|
||||
BuildRequires: %{python_module flake8-bugbear}
|
||||
BuildRequires: %{python_module typing}
|
||||
# /SECTION
|
||||
BuildRequires: fdupes
|
||||
@@ -52,14 +59,14 @@ A plugin for Flake8 that provides specializations for type hinting stub
|
||||
files. Especially interesting for linting typeshed.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n flake8-pyi-%{version}
|
||||
%autosetup -p1 -n flake8_pyi-%{version}
|
||||
sed -i '1{\,^#!%{_bindir}/env python,d}' pyi.py
|
||||
|
||||
%build
|
||||
%python_build
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%python_install
|
||||
%pyproject_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
@@ -70,6 +77,6 @@ sed -i '1{\,^#!%{_bindir}/env python,d}' pyi.py
|
||||
%doc README.md
|
||||
%{python_sitelib}/pyi.py*
|
||||
%{pycache_only %{python_sitelib}/__pycache__/pyi.*.py*}
|
||||
%{python_sitelib}/flake8_pyi-%{version}-*.egg-info
|
||||
%{python_sitelib}/flake8_pyi-%{version}*-info
|
||||
|
||||
%changelog
|
||||
|
||||
28
set-tests-python-path.patch
Normal file
28
set-tests-python-path.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
Index: flake8_pyi-23.1.2/tests/test_pyi_files.py
|
||||
===================================================================
|
||||
--- flake8_pyi-23.1.2.orig/tests/test_pyi_files.py
|
||||
+++ flake8_pyi-23.1.2/tests/test_pyi_files.py
|
||||
@@ -35,16 +35,21 @@ def test_pyi_file(path: str) -> None:
|
||||
message = line[match.end() : end_pos].strip()
|
||||
expected_output += f"{path}:{lineno}: {match.group(1)}{message}\n"
|
||||
|
||||
+ 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,
|
||||
Reference in New Issue
Block a user