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

Add new check: unguarded-typing-import #9964

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

nickdrozd
Copy link
Collaborator

@nickdrozd nickdrozd commented Sep 24, 2024

Type of Changes

Type
✨ New feature

Description

This PR adds a new check to warn about imports that are used only for typechecking but are imported outside of the TYPE_CHECKING flag. These are imported at runtime but not used at runtime. As far as I can tell, there is no good reason to do this, and I assume that such imports are a slight drag on speed and possibly memory as well.

There is the question of whether or not this check should be enabled by default. As can be seen from the output below, it will raise a lot of warnings on codebases that are large and have a lot of typechecking. These are not false negatives or noise: they really are runtime imports that are not used at runtime. Code that doesn't use type annotations will not be affected. My feeling is that the kind of people who use Python annotations are generally on the fastidious side to begin with, and would be interested to know whether they are doing any useless runtime importing.

The initial form of this PR includes only the check (enabled). There are associated tasks that need to be done (testing, documentation, fixing warnings in Pylint itself, etc), but I will get to these after some discussion.

Surprisingly, it seems to mostly work! I am aware of one bug at the moment, and I don't know the cause yet.

TODO:

  • Find and fix bugs
  • Add new tests
  • Update existing tests
  • Add documentation
  • Address warnings in Pylint

Closes #8111

This comment has been minimized.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

How about 'unguarded-typing-import' for the name ? Also this need to be disabled by default or an extension (seeing the number of violations in astroid and home assistant alone). Well maybe not as it's the 4.0 branch now, depends if we want to make this default or not long term.

@jacobtylerwalls jacobtylerwalls added this to the 4.0.0 milestone Sep 25, 2024
@jacobtylerwalls
Copy link
Member

I like unguarded-typing-import.

I think the check makes sense, at least as much sense as vanilla unused-import. You can have bugs from depending on the coincidental importing of one module by another and then be surprised when a less-common code path doesn't import those modules.

I think it's likely we want this off by default, but I'm hoping to do away with the concept of extensions in 4.0, so I'm not sure we need to worry about this too much right now.

@Pierre-Sassoulas
Copy link
Member

I'm wondering about the perf implication in astroid. I suppose it should make the startup time better (?). if we fix astroid to always guard typing import we could benchmark it. And if it's a big improvement I would definitely be in favor of making this a default check. But think I remember that Marc or Daniel had reservation about always using typing guard and it's a lot of work to fix those 241 violations.

Regarding removing extensions, now that we have a way to disable by default in "standard checkers" we could remove extensions imo. Maybe we could open an issue to see if there are other opinions than ours.

@nickdrozd
Copy link
Collaborator Author

I changed the name and added a test. There are currently some false positives for undefined-variable. I don't know the cause exactly. It has to do with the name consumption logic.

I also opened a PR against Astroid to move typing imports behind the guard. It takes a little work, but it doesn't take a lot of thought. It should be easy to automate (if Pylint ever gets an autofix feature).

This comment has been minimized.

@Pierre-Sassoulas Pierre-Sassoulas changed the title Add new check: import-used-only-for-typechecking Add new check: unguarded-typing-impor Sep 25, 2024
@Pierre-Sassoulas Pierre-Sassoulas changed the title Add new check: unguarded-typing-impor Add new check: unguarded-typing-import Sep 25, 2024
@akamat10
Copy link
Contributor

Some feedback as a user of pylint. While perhaps there are users who want this, I am not sure how large that number is. I am also not convinced how much it saves in terms of performance. Is there some data to demonstrate the performance savings? You still have to import typing for TYPE_CHECKING. How much is the saving when other types are not imported from typing library? I would like to see concrete data.

Also, importing typing without TYPE_CHECKING guards is a pretty common way of writing code. AFAIK it is not discouraged. So not sure why the code needs to be changed.

Also, I personally wouldn't want to make this change in my repos at work. The total cost for every developer to turn off this at a large company will be large. I am not sure whether it is worth the cost for the benefit it may provide. At the very minimum, we should not make this the default.

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Sep 26, 2024

This should definitely be off by default (and to be clear when I say do away with the concept of extensions, I don't mean turn everything on, I mean replace it with a more consistent on/off base default as mused in #3512).

I'm also open to the idea of not merging this. (FYI @nickdrozd we should probably wait to polish this until we get more opinions).

Is there some data to demonstrate the performance savings?

I don't think performance is the main motivation. I think the idea is that having unnecessary imports promotes cyclic imports or the hiding of cyclic imports by late imports inside functions, which will emit their own warnings.

The best statement of the problem I see is from Carl Meyer:

"Type annotations tend to greatly increase the import dependency fanout of a typical module. Increasing the import dependency fanout when there is no runtime need for the increased fanout is a bad thing, because it leads to many more import cycles and it unnecessarily front-loads import expense (even if there is no singular "expensive module" but rather just many many modules in the transitive dependency chain which in aggregate are expensive to import)."


The reason I suggested we bump main to 4.0 was so that we can start tackling #3512. IMO the main reason people don't use pylint is because it has (to borrow Carl's word) fanned out a bit much. No clutter-free configuration/readme recipe/button-push way (other than just --errors-only) to just get some configuration that delivers the goodies that go beyond flake8 but without drowning you.

AFAIK it is not discouraged.

Pylint has a lot of refactoring messages where nothing is strictly wrong. This proposed message is one of them, just a slight future-proofing advantage against possible import cycles.

@jacobtylerwalls
Copy link
Member

Pylint has a lot of refactoring messages where nothing is strictly wrong.

no-else-return is a good example. Recently a core python committer asked me to insert else: before a return. I agree the parallelism can be nice! I bet there are tons of python devs who find that check ridiculous. Having these messages on by default makes it harder to build consensus to adopt pylint.

@nickdrozd
Copy link
Collaborator Author

Regarding removing extensions, now that we have a way to disable by default in "standard checkers" we could remove extensions imo. Maybe we could open an issue to see if there are other opinions than ours.

I'm not familiar with this, what are the details?

@jacobtylerwalls
Copy link
Member

We added default_enabled in #7629, but we may not be using it in all the places we should yet (e.g. until we fully implement #3512).

@nickdrozd
Copy link
Collaborator Author

#8893 should be fixed before merging this too. Is there a way to mark that issue as a blocker?

@Pierre-Sassoulas
Copy link
Member

no-else-return is a good example. Recently a core python committer asked me to insert else: before a return. I agree the parallelism can be nice! I bet there are tons of python devs who find that check ridiculous. Having these messages on by default makes it harder to build consensus to adopt pylint.

There's also those that think this is the best thing since sliced bread. And they can enable it if they want. It should probably be by using a mozzilla template / shortcut, because this is something from the Mozzilla style guideline afair. So, yes, this kind of opinionated checks should be disabled by default so the default is acceptable for everyone.

Same for unguarded-typing-import, the fact that we have so much violations in both pylint and astroid as well as the argument given by Marc in the astroid MR, are sufficient to conclude it's opinionated and not make it a default message. I'm still going to benchmark your astroid MR, because it's not easy to know what exactly are the implications in term of performance.

#3512 is the main reason pylint is not adopted i.e. a lot of article that say "pylint is nice but you need to configure it before it's nice", the highest priority issue at the moment imo.

@Pierre-Sassoulas
Copy link
Member

#8893 should be fixed before merging this too. Is there a way to mark that issue as a blocker?

the blocker label exists but it's more for something like "we can't release the milestone if this is not fixed". But we could release without it as long as we don't merge this. We can draft this MR as long as #8893 is not fixed imo

@nickdrozd
Copy link
Collaborator Author

Okay, the check is disabled by default. Everyone will get to keep their unused runtime imports 😆

Copy link
Contributor

🤖 Effect of this PR on checked open source code: 🤖

Effect on astroid:
The following messages are now emitted:

  1. unguarded-typing-import:
    Callable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/test_utils.py#L13
  2. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/context.py#L11
  3. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/context.py#L14
  4. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/context.py#L14
  5. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/typing.py#L8
  6. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/bases.py#L12
  7. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/bases.py#L12
  8. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/bases.py#L13
  9. unguarded-typing-import:
    Literal used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/bases.py#L13
  10. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/bases.py#L30
  11. unguarded-typing-import:
    InferenceErrorInfo used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/bases.py#L30
  12. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/bases.py#L30
  13. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/raw_building.py#L19
  14. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/raw_building.py#L21
  15. unguarded-typing-import:
    types used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/modutils.py#L28
  16. unguarded-typing-import:
    Sequence used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/modutils.py#L30
  17. unguarded-typing-import:
    Callable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/modutils.py#L30
  18. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/modutils.py#L30
  19. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/objects.py#L16
  20. unguarded-typing-import:
    Generator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/objects.py#L16
  21. unguarded-typing-import:
    Literal used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/objects.py#L18
  22. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/objects.py#L18
  23. unguarded-typing-import:
    NoReturn used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/objects.py#L18
  24. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/objects.py#L21
  25. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/objects.py#L31
  26. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/objects.py#L31
  27. unguarded-typing-import:
    Callable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/rebuilder.py#L14
  28. unguarded-typing-import:
    Generator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/rebuilder.py#L14
  29. unguarded-typing-import:
    TokenInfo used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/rebuilder.py#L16
  30. unguarded-typing-import:
    Final used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/rebuilder.py#L17
  31. unguarded-typing-import:
    ParserModule used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/rebuilder.py#L20
  32. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/rebuilder.py#L22
  33. unguarded-typing-import:
    NodeNG used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/rebuilder.py#L23
  34. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/rebuilder.py#L26
  35. unguarded-typing-import:
    ast used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/builder.py#L13
  36. unguarded-typing-import:
    types used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/builder.py#L16
  37. unguarded-typing-import:
    Sequence used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/builder.py#L18
  38. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/builder.py#L18
  39. unguarded-typing-import:
    TextIOWrapper used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/builder.py#L19
  40. unguarded-typing-import:
    ParserModule used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/builder.py#L23
  41. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/exceptions.py#L9
  42. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/exceptions.py#L9
  43. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/exceptions.py#L10
  44. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/exceptions.py#L12
  45. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/exceptions.py#L12
  46. unguarded-typing-import:
    Callable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/protocols.py#L14
  47. unguarded-typing-import:
    Generator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/protocols.py#L14
  48. unguarded-typing-import:
    Sequence used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/protocols.py#L14
  49. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/protocols.py#L14
  50. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/protocols.py#L15
  51. unguarded-typing-import:
    ConstFactoryResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/protocols.py#L28
  52. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/protocols.py#L28
  53. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/protocols.py#L28
  54. unguarded-typing-import:
    Generator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/helpers.py#L10
  55. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/helpers.py#L22
  56. unguarded-typing-import:
    types used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/manager.py#L14
  57. unguarded-typing-import:
    Sequence used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/manager.py#L16
  58. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/manager.py#L16
  59. unguarded-typing-import:
    Callable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/manager.py#L16
  60. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/manager.py#L17
  61. unguarded-typing-import:
    ClassVar used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/manager.py#L17
  62. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/manager.py#L20
  63. unguarded-typing-import:
    AstroidManagerBrain used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/manager.py#L37
  64. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/manager.py#L37
  65. unguarded-typing-import:
    Generator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/inference_tip.py#L10
  66. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/inference_tip.py#L11
  67. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/inference_tip.py#L13
  68. unguarded-typing-import:
    InferFn used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/inference_tip.py#L16
  69. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/inference_tip.py#L16
  70. unguarded-typing-import:
    TransformFn used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/inference_tip.py#L16
  71. unguarded-typing-import:
    Literal used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/util.py#L9
  72. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/util.py#L9
  73. unguarded-typing-import:
    Final used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/util.py#L9
  74. undefined-variable:
    Undefined variable 'nodes'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/filter_statements.py#L29
  75. undefined-variable:
    Undefined variable 'nodes'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/filter_statements.py#L39
  76. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/filter_statements.py#L16
  77. unguarded-typing-import:
    Generator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/decorators.py#L13
  78. unguarded-typing-import:
    Callable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/decorators.py#L13
  79. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/decorators.py#L19
  80. unguarded-typing-import:
    TransformFn used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/transforms.py#L13
  81. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/constraint.py#L10
  82. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/constraint.py#L14
  83. unguarded-typing-import:
    Self used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/constraint.py#L17
  84. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/arguments.py#L11
  85. undefined-variable:
    Undefined variable 'nodes'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/objectmodel.py#L567
  86. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/objectmodel.py#L30
  87. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/objectmodel.py#L32
  88. unguarded-typing-import:
    Literal used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/objectmodel.py#L32
  89. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/objectmodel.py#L40
  90. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/objectmodel.py#L40
  91. unguarded-typing-import:
    _NamespacePath used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/_import/util.py#L10
  92. undefined-variable:
    Undefined variable 'importlib'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/_import/spec.py#L124
  93. undefined-variable:
    Undefined variable 'importlib'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/_import/spec.py#L125
  94. undefined-variable:
    Undefined variable 'importlib'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/_import/spec.py#L126
  95. unguarded-typing-import:
    pathlib used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/_import/spec.py#L13
  96. unguarded-typing-import:
    types used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/_import/spec.py#L15
  97. unguarded-typing-import:
    Sequence used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/_import/spec.py#L18
  98. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/_import/spec.py#L18
  99. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/_import/spec.py#L18
  100. unguarded-typing-import:
    Literal used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/interpreter/_import/spec.py#L21
  101. unguarded-typing-import:
    Generator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_ng.py#L10
  102. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_ng.py#L10
  103. unguarded-typing-import:
    ClassVar used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_ng.py#L13
  104. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_ng.py#L13
  105. unguarded-typing-import:
    Literal used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_ng.py#L13
  106. unguarded-typing-import:
    Position used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_ng.py#L36
  107. unguarded-typing-import:
    InferFn used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_ng.py#L37
  108. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_ng.py#L37
  109. unguarded-typing-import:
    InferenceErrorInfo used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_ng.py#L37
  110. unguarded-typing-import:
    Self used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_ng.py#L40
  111. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_classes.py#L16
  112. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_classes.py#L16
  113. unguarded-typing-import:
    Mapping used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_classes.py#L16
  114. unguarded-typing-import:
    Literal used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_classes.py#L18
  115. unguarded-typing-import:
    ClassVar used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_classes.py#L18
  116. unguarded-typing-import:
    Context used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_classes.py#L29
  117. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_classes.py#L49
  118. unguarded-typing-import:
    Self used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/node_classes.py#L57
  119. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/_base_nodes.py#L13
  120. unguarded-typing-import:
    ClassVar used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/_base_nodes.py#L15
  121. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/_base_nodes.py#L15
  122. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/as_string.py#L10
  123. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/mixin.py#L15
  124. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/mixin.py#L15
  125. undefined-variable:
    Undefined variable 'node_classes'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L376
  126. undefined-variable:
    Undefined variable 'Const'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L1622
  127. undefined-variable:
    Undefined variable 'Const'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L2867
  128. unguarded-typing-import:
    Sequence used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L17
  129. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L17
  130. unguarded-typing-import:
    Generator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L17
  131. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L17
  132. unguarded-typing-import:
    ClassVar used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L19
  133. unguarded-typing-import:
    Literal used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L19
  134. unguarded-typing-import:
    NoReturn used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L19
  135. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L19
  136. unguarded-typing-import:
    NodeNG used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L43
  137. unguarded-typing-import:
    Const used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L43
  138. unguarded-typing-import:
    Position used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L54
  139. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L55
  140. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L55
  141. unguarded-typing-import:
    InferBinaryOp used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/nodes/scoped_nodes/scoped_nodes.py#L55
  142. unguarded-typing-import:
    Callable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_builtin_inference.py#L10
  143. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_builtin_inference.py#L10
  144. unguarded-typing-import:
    NoReturn used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_builtin_inference.py#L12
  145. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_builtin_inference.py#L12
  146. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_builtin_inference.py#L16
  147. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_builtin_inference.py#L28
  148. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_builtin_inference.py#L28
  149. unguarded-typing-import:
    ConstFactoryResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_builtin_inference.py#L28
  150. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_pathlib.py#L7
  151. unguarded-typing-import:
    context used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_pathlib.py#L9
  152. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_pathlib.py#L14
  153. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_function_base.py#L14
  154. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_einsumfunc.py#L10
  155. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_einsumfunc.py#L13
  156. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_crypt.py#L5
  157. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_crypt.py#L8
  158. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_collections.py#L9
  159. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_collections.py#L11
  160. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_attrs.py#L11
  161. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_dataclasses.py#L17
  162. unguarded-typing-import:
    context used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_dataclasses.py#L20
  163. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_dataclasses.py#L26
  164. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_http.py#L8
  165. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_hashlib.py#L5
  166. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_hashlib.py#L8
  167. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_unittest.py#L6
  168. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_unittest.py#L9
  169. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_type.py#L27
  170. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_type.py#L30
  171. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_threading.py#L5
  172. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_threading.py#L8
  173. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_uuid.py#L6
  174. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_numeric.py#L9
  175. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_numeric.py#L17
  176. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_boto3.py#L8
  177. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_multiprocessing.py#L9
  178. undefined-variable:
    Undefined variable 'nodes'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_namedtuple_enum.py#L110
  179. undefined-variable:
    Undefined variable 'nodes'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_namedtuple_enum.py#L116
  180. undefined-variable:
    Undefined variable 'nodes'
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_namedtuple_enum.py#L120
  181. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_namedtuple_enum.py#L11
  182. unguarded-typing-import:
    Final used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_namedtuple_enum.py#L13
  183. unguarded-typing-import:
    astroid used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_namedtuple_enum.py#L15
  184. unguarded-typing-import:
    bases used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_namedtuple_enum.py#L16
  185. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_scipy_signal.py#L6
  186. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_scipy_signal.py#L9
  187. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_signal.py#L32
  188. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_random.py#L9
  189. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_random.py#L12
  190. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_ndarray.py#L10
  191. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_ndarray.py#L12
  192. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_nose.py#L14
  193. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_ssl.py#L7
  194. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_ssl.py#L11
  195. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_fromnumeric.py#L6
  196. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_fromnumeric.py#L9
  197. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_subprocess.py#L7
  198. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_subprocess.py#L11
  199. unguarded-typing-import:
    Callable used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/helpers.py#L7
  200. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/helpers.py#L9
  201. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_hypothesis.py#L19
  202. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_random_mtrand.py#L7
  203. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_random_mtrand.py#L10
  204. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_functools.py#L9
  205. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_functools.py#L13
  206. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_functools.py#L15
  207. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_functools.py#L19
  208. unguarded-typing-import:
    SuccessfulInferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_functools.py#L22
  209. unguarded-typing-import:
    InferenceResult used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_functools.py#L22
  210. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_pkg_resources.py#L5
  211. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_pkg_resources.py#L8
  212. unguarded-typing-import:
    context used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_regex.py#L7
  213. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_regex.py#L11
  214. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_dateutil.py#L9
  215. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_umath.py#L10
  216. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_umath.py#L13
  217. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_datetime.py#L5
  218. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_responses.py#L13
  219. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_responses.py#L16
  220. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_multiarray.py#L9
  221. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_multiarray.py#L18
  222. unguarded-typing-import:
    context used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_re.py#L7
  223. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_re.py#L12
  224. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_curses.py#L5
  225. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_curses.py#L8
  226. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_sqlalchemy.py#L5
  227. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_sqlalchemy.py#L8
  228. unguarded-typing-import:
    Iterator used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_typing.py#L11
  229. unguarded-typing-import:
    Final used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_typing.py#L13
  230. unguarded-typing-import:
    context used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_typing.py#L15
  231. unguarded-typing-import:
    NodeNG used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_typing.py#L27
  232. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_ctypes.py#L15
  233. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_ctypes.py#L18
  234. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_pytest.py#L6
  235. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_argparse.py#L8
  236. unguarded-typing-import:
    InferenceContext used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_utils.py#L10
  237. unguarded-typing-import:
    Attribute used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_utils.py#L11
  238. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_ma.py#L7
  239. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_ma.py#L10
  240. unguarded-typing-import:
    nodes used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_numerictypes.py#L8
  241. unguarded-typing-import:
    AstroidManager used only for typechecking but imported outside of a typechecking block
    https://github.com/pylint-dev/astroid/blob/a3f5c4a397cb68b563e2c16a40bd623a53ad59b3/astroid/brain/brain_numpy_core_numerictypes.py#L12

Effect on home-assistant:
The following messages are now emitted:

  1. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/requirements.py#L6
  2. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/requirements.py#L10
  3. unguarded-typing-import:
    HomeAssistant used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/requirements.py#L14
  4. used-before-assignment:
    Using variable 'ConfigEntry' before assignment
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L247
  5. undefined-variable:
    Undefined variable 'DiscoveryKey'
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L1888
  6. unguarded-typing-import:
    Mapping used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L7
  7. unguarded-typing-import:
    Generator used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L7
  8. unguarded-typing-import:
    ValuesView used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L7
  9. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L7
  10. unguarded-typing-import:
    Self used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L25
  11. unguarded-typing-import:
    Platform used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L32
  12. unguarded-typing-import:
    CALLBACK_TYPE used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L33
  13. unguarded-typing-import:
    Event used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L33
  14. unguarded-typing-import:
    DiscoveryKey used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L52
  15. unguarded-typing-import:
    ConfigType used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L61
  16. unguarded-typing-import:
    UndefinedType used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L61
  17. unguarded-typing-import:
    DiscoveryInfoType used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/config_entries.py#L61
  18. unguarded-typing-import:
    Hashable used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/data_entry_flow.py#L8
  19. unguarded-typing-import:
    Mapping used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/data_entry_flow.py#L8
  20. unguarded-typing-import:
    Container used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/data_entry_flow.py#L8
  21. unguarded-typing-import:
    Callable used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/data_entry_flow.py#L8
  22. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/data_entry_flow.py#L8
  23. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/data_entry_flow.py#L16
  24. unguarded-typing-import:
    Required used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/data_entry_flow.py#L16
  25. unguarded-typing-import:
    HomeAssistant used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/data_entry_flow.py#L21
  26. unguarded-typing-import:
    Any used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/bootstrap.py#L19
  27. unguarded-typing-import:
    ConfigType used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/bootstrap.py#L92
  28. unguarded-typing-import:
    Iterable used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L11
  29. unguarded-typing-import:
    Collection used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L11
  30. unguarded-typing-import:
    ValuesView used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L11
  31. unguarded-typing-import:
    KeysView used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L11
  32. unguarded-typing-import:
    concurrent.futures used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L20
  33. unguarded-typing-import:
    datetime used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L23
  34. unguarded-typing-import:
    Final used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L35
  35. unguarded-typing-import:
    Self used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L35
  36. unguarded-typing-import:
    NotRequired used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L35
  37. unguarded-typing-import:
    VolSchemaType used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L99
  38. unguarded-typing-import:
    UndefinedType used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L99
  39. unguarded-typing-import:
    EventType used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L108
  40. unguarded-typing-import:
    UnitSystem used only for typechecking but imported outside of a typechecking block
    https://github.com/home-assistant/core/blob/1395baef017b08c8681499fc2ce8507436b999ee/homeassistant/core.py#L115
  41. unguarded-typing-import:
    *Any used only for typechecking b...

This comment was truncated because GitHub allows only 65536 characters in a comment.

This comment was generated for commit 70c836f

@nickdrozd
Copy link
Collaborator Author

The new test passes for me locally but not in CI. Is the check being enabled incorrectly? The check is also being run in the primer, which I think it shouldn't be?

@jacobtylerwalls
Copy link
Member

I think we still want the primer to test all checks, so we can make the most informed decisions when reviewing features and fixes.

@akamat10
Copy link
Contributor

Thank you @jacobtylerwalls for providing the necessary background on this check. I can see the value of this check but yes everyone here realizes that onboarding this check on to is a pretty major ask so leaving this out by default makes sense. Thank you for the update @nickdrozd

#3512 is a wonderful feature and definitely worth pursuing. It will be good if some of the checks pylint can do that are useful that some other static checkers can't do make it to this list because pylint can follow imports and do inference based checks.

@akamat10
Copy link
Contributor

@nickdrozd I suspect undefined-variable error is very likely related to your code. The node failure in astroid, for example, is related to import that supplies types but also needed at runtime. Perhaps there is a bug around handling such cases.

@akamat10
Copy link
Contributor

One thought I have. Is it worth leaving out typing library from this check? It is going to be more practical to use.

@nickdrozd
Copy link
Collaborator Author

I suspect undefined-variable error is very likely related to your code.

Yeah, there is definitely a bug in there. I think it is closely related to (and maybe even caused by) an existing bug in the consumer logic that is also responsible for problems like #8893.

Is it worth leaving out typing library from this check?

I don't know if I speak for all users who would want this check, but what I am really interested in knowing is which runtime imports can be avoided. This goes for typing as well. For example, Any and Union are used only for typechecking, while NamedTuple is used at runtime.

There is also a function called cast, which seems like it ought to be used only for typechecking, but does in fact get used at runtime in a few places. IMO this is probably a code smell. Here is an actual verbatim code snippet from Astroid:

        # XXX REMOVE me :
        if context in (Context.Del, Context.Store):  # 'Aug' ??
            newnode = cast(Union[nodes.AssignName, nodes.DelName], newnode)
            self._save_assignment(newnode)

Besides all that, if it is going to be disabled by default, it may as well be as strict as possible, since all users will have opted in.

@akamat10
Copy link
Contributor

I don't know that segment well enough but cast is only for the static checker and sometimes there are legitimate uses for it. The value is returned unchanged at runtime. Why do you think it is code smell?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New check: variable used only for type checking
4 participants