-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add autofix to move runtime-imports out of type-checking blocks #4743
Merged
Conversation
This file contains 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
charliermarsh
force-pushed
the
charlie/add-typing-import
branch
from
May 31, 2023 04:08
11648dd
to
03c30f1
Compare
charliermarsh
force-pushed
the
charlie/move-runtime-import
branch
from
May 31, 2023 04:08
27cf985
to
5169776
Compare
PR Check ResultsEcosystemℹ️ ecosystem check detected changes. (+31, -31, 0 error(s)) airflow (+31, -31)
- airflow/models/__init__.py:118:37: TCH004 Move import `airflow.models.base.ID_LEN` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:118:37: TCH004 [*] Move import `airflow.models.base.ID_LEN` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:118:45: TCH004 Move import `airflow.models.base.Base` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:118:45: TCH004 [*] Move import `airflow.models.base.Base` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:119:45: TCH004 Move import `airflow.models.baseoperator.BaseOperator` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:119:45: TCH004 [*] Move import `airflow.models.baseoperator.BaseOperator` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:119:59: TCH004 Move import `airflow.models.baseoperator.BaseOperatorLink` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:119:59: TCH004 [*] Move import `airflow.models.baseoperator.BaseOperatorLink` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:120:43: TCH004 Move import `airflow.models.connection.Connection` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:120:43: TCH004 [*] Move import `airflow.models.connection.Connection` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:121:36: TCH004 Move import `airflow.models.dag.DAG` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:121:36: TCH004 [*] Move import `airflow.models.dag.DAG` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:121:41: TCH004 Move import `airflow.models.dag.DagModel` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:121:41: TCH004 [*] Move import `airflow.models.dag.DagModel` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:121:51: TCH004 Move import `airflow.models.dag.DagTag` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:121:51: TCH004 [*] Move import `airflow.models.dag.DagTag` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:122:39: TCH004 Move import `airflow.models.dagbag.DagBag` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:122:39: TCH004 [*] Move import `airflow.models.dagbag.DagBag` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:123:42: TCH004 Move import `airflow.models.dagpickle.DagPickle` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:123:42: TCH004 [*] Move import `airflow.models.dagpickle.DagPickle` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:124:39: TCH004 Move import `airflow.models.dagrun.DagRun` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:124:39: TCH004 [*] Move import `airflow.models.dagrun.DagRun` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:125:52: TCH004 Move import `airflow.models.db_callback_request.DbCallbackRequest` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:125:52: TCH004 [*] Move import `airflow.models.db_callback_request.DbCallbackRequest` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:126:39: TCH004 Move import `airflow.models.errors.ImportError` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:126:39: TCH004 [*] Move import `airflow.models.errors.ImportError` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:127:36: TCH004 Move import `airflow.models.log.Log` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:127:36: TCH004 [*] Move import `airflow.models.log.Log` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:128:47: TCH004 Move import `airflow.models.mappedoperator.MappedOperator` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:128:47: TCH004 [*] Move import `airflow.models.mappedoperator.MappedOperator` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:129:41: TCH004 Move import `airflow.models.operator.Operator` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:129:41: TCH004 [*] Move import `airflow.models.operator.Operator` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:130:38: TCH004 Move import `airflow.models.param.Param` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:130:38: TCH004 [*] Move import `airflow.models.param.Param` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:131:37: TCH004 Move import `airflow.models.pool.Pool` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:131:37: TCH004 [*] Move import `airflow.models.pool.Pool` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:132:49: TCH004 Move import `airflow.models.renderedtifields.RenderedTaskInstanceFields` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:132:49: TCH004 [*] Move import `airflow.models.renderedtifields.RenderedTaskInstanceFields` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:133:42: TCH004 Move import `airflow.models.skipmixin.SkipMixin` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:133:42: TCH004 [*] Move import `airflow.models.skipmixin.SkipMixin` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:134:40: TCH004 Move import `airflow.models.slamiss.SlaMiss` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:134:40: TCH004 [*] Move import `airflow.models.slamiss.SlaMiss` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:135:41: TCH004 Move import `airflow.models.taskfail.TaskFail` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:135:41: TCH004 [*] Move import `airflow.models.taskfail.TaskFail` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:136:45: TCH004 Move import `airflow.models.taskinstance.TaskInstance` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:136:45: TCH004 [*] Move import `airflow.models.taskinstance.TaskInstance` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:136:59: TCH004 Move import `airflow.models.taskinstance.clear_task_instances` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:136:59: TCH004 [*] Move import `airflow.models.taskinstance.clear_task_instances` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:137:47: TCH004 Move import `airflow.models.taskreschedule.TaskReschedule` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:137:47: TCH004 [*] Move import `airflow.models.taskreschedule.TaskReschedule` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:138:40: TCH004 Move import `airflow.models.trigger.Trigger` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:138:40: TCH004 [*] Move import `airflow.models.trigger.Trigger` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:139:41: TCH004 Move import `airflow.models.variable.Variable` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:139:41: TCH004 [*] Move import `airflow.models.variable.Variable` out of type-checking block. Import is used for more than type hinting.
- airflow/models/__init__.py:140:37: TCH004 Move import `airflow.models.xcom.XCom` out of type-checking block. Import is used for more than type hinting.
+ airflow/models/__init__.py:140:37: TCH004 [*] Move import `airflow.models.xcom.XCom` out of type-checking block. Import is used for more than type hinting.
- airflow/serialization/serialized_objects.py:74:39: TCH004 Move import `kubernetes.client.models` out of type-checking block. Import is used for more than type hinting.
+ airflow/serialization/serialized_objects.py:74:39: TCH004 [*] Move import `kubernetes.client.models` out of type-checking block. Import is used for more than type hinting.
- airflow/serialization/serialized_objects.py:76:54: TCH004 Move import `airflow.kubernetes.pod_generator.PodGenerator` out of type-checking block. Import is used for more than type hinting.
+ airflow/serialization/serialized_objects.py:76:54: TCH004 [*] Move import `airflow.kubernetes.pod_generator.PodGenerator` out of type-checking block. Import is used for more than type hinting.
- airflow/utils/mixins.py:28:12: TCH004 Move import `multiprocessing.context` out of type-checking block. Import is used for more than type hinting.
+ airflow/utils/mixins.py:28:12: TCH004 [*] Move import `multiprocessing.context` out of type-checking block. Import is used for more than type hinting.
BenchmarkLinux
Windows
|
charliermarsh
force-pushed
the
charlie/add-typing-import
branch
from
May 31, 2023 04:34
03c30f1
to
9a84037
Compare
charliermarsh
force-pushed
the
charlie/move-runtime-import
branch
from
May 31, 2023 04:34
5169776
to
5eb9b93
Compare
MichaReiser
approved these changes
May 31, 2023
crates/ruff/src/rules/flake8_type_checking/rules/runtime_import_in_type_checking_block.rs
Show resolved
Hide resolved
crates/ruff/src/rules/flake8_type_checking/rules/runtime_import_in_type_checking_block.rs
Show resolved
Hide resolved
crates/ruff/src/rules/flake8_type_checking/rules/runtime_import_in_type_checking_block.rs
Outdated
Show resolved
Hide resolved
charliermarsh
force-pushed
the
charlie/add-typing-import
branch
2 times, most recently
from
May 31, 2023 17:43
2b9311b
to
498f270
Compare
charliermarsh
force-pushed
the
charlie/move-runtime-import
branch
from
May 31, 2023 17:58
5eb9b93
to
0ae6356
Compare
konstin
pushed a commit
that referenced
this pull request
Jun 13, 2023
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
Similar to #4742, this PR adds autofix for the inverse rule: if an import is in an
if TYPE_CHECKING:
block, but is required at runtime, remove it from the block, and add it to the top level.Test Plan
cargo test