Ignore underscore references in type annotations#9036
Merged
charliermarsh merged 1 commit intomainfrom Dec 7, 2023
Merged
Conversation
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| SLF001 | 8 | 0 | 8 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+0 -8 violations, +0 -0 fixes in 41 projects)
apache/airflow (+0 -6 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --preview --select ALL
- airflow/cli/cli_parser.py:159:30: SLF001 Private member accessed: `_SubParsersAction` - airflow/providers/cncf/kubernetes/utils/k8s_hashlib_wrapper.py:32:44: SLF001 Private member accessed: `_Hash` - airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py:151:35: SLF001 Private member accessed: `_ParameterSpec` - airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py:73:35: SLF001 Private member accessed: `_ParameterSpec` - airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py:154:35: SLF001 Private member accessed: `_ParameterSpec` - airflow/utils/hashlib_wrapper.py:29:44: SLF001 Private member accessed: `_Hash`
zulip/zulip (+0 -2 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --preview --select ALL
- zerver/lib/queue.py:84:18: SLF001 Private member accessed: `_DEFAULT` - zerver/lib/request.py:295:20: SLF001 Private member accessed: `_NotSpecified`
Changes by rule (1 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| SLF001 | 8 | 0 | 8 | 0 | 0 |
Member
Author
|
I like what I see in the ecosystem changes -- it's having the intended effect, and those are more cases in which the underscore access is valid. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Occasionally, valid code needs to use
argparse._SubParsersActionin a type annotation. This isn't great, but it's indicative of the fact that public interfaces can return private types. If you accessed that private type via a private interface, then we should be flagging the call site, rather than the annotation.Closes #9013.