Gate runtime-import-in-type-checking-block (TCH004) behind enabled flag (#5789)

Closes #5787.
This commit is contained in:
Charlie Marsh 2023-07-15 16:57:29 -04:00 committed by GitHub
parent 6824b67f44
commit f2e995f78d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5005,18 +5005,26 @@ impl<'a> Checker<'a> {
.collect()
};
flake8_type_checking::rules::runtime_import_in_type_checking_block(
self,
scope,
&mut diagnostics,
);
if self.enabled(Rule::RuntimeImportInTypeCheckingBlock) {
flake8_type_checking::rules::runtime_import_in_type_checking_block(
self,
scope,
&mut diagnostics,
);
}
flake8_type_checking::rules::typing_only_runtime_import(
self,
scope,
&runtime_imports,
&mut diagnostics,
);
if self.any_enabled(&[
Rule::TypingOnlyFirstPartyImport,
Rule::TypingOnlyThirdPartyImport,
Rule::TypingOnlyStandardLibraryImport,
]) {
flake8_type_checking::rules::typing_only_runtime_import(
self,
scope,
&runtime_imports,
&mut diagnostics,
);
}
}
if self.enabled(Rule::UnusedImport) {