Skip to content

Release v2.3.0#91

Merged
sco1 merged 3 commits into
masterfrom
dev-next
Jul 12, 2020
Merged

Release v2.3.0#91
sco1 merged 3 commits into
masterfrom
dev-next

Conversation

@sco1
Copy link
Copy Markdown
Owner

@sco1 sco1 commented Jul 10, 2020

Changelog

[v2.3.0]

Added

Additional Details

To help provide compatibility with Mypy for maintainers that wish to do so, the --mypy-init-return flag has been introduced to mimic Mypy's allowance for the omission of return type hints for __init__ methods that are not dynamically typed (at least one argument is annotated). With this flag set, ANN200 level errors will be suppressed for __init__ methods if at least one argument is explicitly annotated.

For example, from Mypy's documentation:

class C1:  # Fully annotated
    def __init__(self) -> None:
        self.var = 42

class C2:  # Fully annotated
    def __init__(self, arg: int):
        self.var = arg

class C3:
    def __init__(self):  # Not fully annotated
        # This body is not type checked
        self.var = 42 + 'abc'

NOTE: By default, Mypy does not enforce annotations for self in class methods, so to completely mimic Mypy's behavior with flake8-annotations ANN101 will need to be added to the repository's ignored linting codes.

See Mypy's documentation for additional details: https://mypy.readthedocs.io/en/stable/class_basics.html?#annotating-init-methods

Closes #87

To help provide compatibility with Mypy for maintainers that wish to do so, the `--mypy-init-return` flag has been introduced to mimic Mypy's allowance for the omission of return type hints for __init__ methods that are not dynamically typed (at least one argument is annotated).
Copy link
Copy Markdown
Contributor

@MarkKoz MarkKoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to update the version in pyproject.toml

Comment thread CHANGELOG.md Outdated
sco1 and others added 2 commits July 10, 2020 15:41
Co-authored-by: Mark <kozlovmark@gmail.com>
Oops

Co-authored-by: Mark <kozlovmark@gmail.com>
Copy link
Copy Markdown
Contributor

@MarkKoz MarkKoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rock solid

@sco1 sco1 merged commit 2c5c7a4 into master Jul 12, 2020
@sco1 sco1 deleted the dev-next branch July 12, 2020 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Flag to Suppress Warnings for Dynamically Typed Functions

2 participants