Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to ignore ANN001 errors for specific argument names #68

Closed
sumnerevans opened this issue Feb 22, 2020 · 1 comment · Fixed by #73
Closed

Ability to ignore ANN001 errors for specific argument names #68

sumnerevans opened this issue Feb 22, 2020 · 1 comment · Fixed by #73
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@sumnerevans
Copy link

sumnerevans commented Feb 22, 2020

Description
Add a new option like allowed-unannotated-argument-names which is a comma separated list of argument names that are fine to not have annotated.

Rationale/Use Case
Examples: often I need to ingest variables in my functions that I never use (callbacks from another library for example). In these cases, I often will just use _ as my variable.

Here is an example of a GTK callback:

    def on_download_all_click(self, _: Any):
        CacheManager.batch_download_songs(
            self.get_artist_song_ids(),
            before_download=lambda: self.update_artist_view(
                self.artist_id,
                order_token=self.update_order_token,
            ),
            on_song_download_complete=lambda i: self.update_artist_view(
                self.artist_id,
                order_token=self.update_order_token,
            ),
        )

it would be nice if I could avoid having to have the Any annotation here.

@sumnerevans sumnerevans added the enhancement New feature or request label Feb 22, 2020
@sco1
Copy link
Owner

sco1 commented Feb 22, 2020

While a generalized case is not something we’re interested in pursuing, as string parsing introduces its own set of complexity, there could be a case here for a special-case flag for suppressing colloquial “dummy” argument names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants