Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Python Package(deps): Bump flake8-annotations from 2.3.0 to 2.4.0 in /python-package #119

Conversation

dependabot[bot]
Copy link

@dependabot dependabot bot commented on behalf of github Sep 12, 2020

Bumps flake8-annotations from 2.3.0 to 2.4.0.

Release notes

Sourced from flake8-annotations's releases.

Release v2.4.0

[v2.4.0]

Fixed

  • #92 Fix inconsistent linting behavior between function-level type comments and their equivalent PEP 3107-style function annotations of class methods and classmethods.
  • #94 Fix improper handling of the closing definition in a series of typing.overload decorated functions.

Additional Details

Function-level type comment changes

Per #92, there exists a discrepancy in behavior between linting of functions with PEP 3107-style annotations and PEP 484-style function-level type comments. Because PEP 484 does not describe a method to provide partial function-level type comments, there is a potential for ambiguity in the context of both class methods and classmethods when aligning type comments to method arguments.

These two class methods, for example, should lint equivalently:

    def bar(self, a):
        # type: (int) -> int
        ...
def bar(self, a: int) -> int
    ...

When this example type comment is parsed by ast and then matched with the method's arguments, it associates the int hint to self rather than a, so a dummy hint needs to be provided in situations where self or class are not hinted in the type comment in order to achieve equivalent linting results to PEP-3107 style annotations.

A dummy ast.Ellipses constant is injected into the parsed node if the following criteria are met:

  1. The function node is either a class method or classmethod
  2. The number of hinted args is at least 1 less than the number of function args

typing.overload decorator handling

Per #94, the typing.overload was being handled too literally (aka: ignored) by the linter, resulting in emitted linting errors that do not align with the purpose of the decorator.

For example, this code:

import typing
@typing.overload
def foo(a: int) -> int:
...
def foo(a):
...

Would raise linting errors for missing annotations for the arguments & return of the non-decorated foo definition; this interpretation disagrees with the purpose of the decorator.

Per the documentation:

A series of @overload-decorated definitions must be followed by exactly one non-@overload-decorated definition (for the same function/method)

Changelog

Sourced from flake8-annotations's changelog.

[v2.4.0]

Fixed

  • #92 Fix inconsistent linting behavior between function-level type comments and their equivalent PEP 3107-style function annotations of class methods and classmethods.
  • #94 Fix improper handling of the closing definition in a series of typing.overload decorated functions.
Commits
  • f2487f9 Release v2.4.0
  • 994864e Add overload decorator support details to README
  • 03683bc Add test cases for minor coverage gaps
  • 294d1e3 Add tests for typing.overload decorators
  • b729a01 Add logic to skip errors for the closing typing.overload series def
  • 337553f Add attribute to Function to indicate presence of @typing.overload
  • d9a152e Fix logic error in injection determination
  • b431c79 Add test cases for type comment arg injection
  • b8aa801 Bump ver
  • a8002de Add method to adjust type comments for class methods and classmethods
  • 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 dependabot bot added the dependencies Pull requests that update a dependency file label Sep 12, 2020
@dependabot @github
Copy link
Author

dependabot bot commented on behalf of github Oct 1, 2020

Superseded by #128.

@dependabot dependabot bot closed this Oct 1, 2020
@dependabot dependabot bot deleted the dependabot/pip/python-package/flake8-annotations-2.4.0 branch October 1, 2020 23:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants