dry-python / lambdas

Write short and fully-typed lambdas where you need them.
BSD 2-Clause "Simplified" License
270 stars 5 forks source link

Bump flake8-pyi from 22.8.2 to 23.1.1 #152

Closed dependabot[bot] closed 1 year ago

dependabot[bot] commented 1 year ago

Bumps flake8-pyi from 22.8.2 to 23.1.1.

Release notes

Sourced from flake8-pyi's releases.

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.

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" (e.g. float | int, complex | float or complex | int) in all contexts outside of type aliases. This was incorrect. 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.

22.10.0

Bugfixes:

  • Do not emit Y020 for empty strings. Y020 concerns "quoted annotations", but an empty string can never be a quoted annotation.
  • Add special-casing so that Y020 is not emitted for __slots__ definitions inside class blocks.
  • Expand Y035 to cover __slots__ definitions as well as __match_args__ and __all__ definitions.

... (truncated)

Changelog

Sourced from flake8-pyi's changelog.

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.

22.11.0

... (truncated)

Commits
  • 6b18eec Prepare for release 23.1.1 (#341)
  • dc81a15 Reduce Y020 false positives for default values in stubs (#340)
  • 516317d Introduce Y052: Disallow assignments to constant values in global or class na...
  • 29ba4e3 Improve handling of default values (#336)
  • cbc447e typeshed_primer: Add a newline before the final backticks (#338)
  • 36051b7 isort config: set skip_gitignore = true (#337)
  • 4778623 Copy-edit a few error code descriptions (#335)
  • 4879637 Tighten up the logic for valid stub defaults (#334)
  • c4ab400 rename master -> main (#333)
  • 66ec697 Improve pre-commit config (#332)
  • Additional commits viewable in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
dependabot[bot] commented 1 year ago

Superseded by #153.