-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
used-before-assignment
false negative with TYPE_CHECKING
#8198
Comments
Is this still a problem as of #8071? |
yes, I have the same problem with: from typing import TYPE_CHECKING
# It's needed just to avoid the PyCharm's static analyzer bug
# https://stackoverflow.com/questions/53276766/how-to-avoid-unexpected-argument-warning-using-data-classes
if TYPE_CHECKING:
from dataclasses import dataclass # noqa
else:
from pydantic.dataclasses import dataclass # noqa
@dataclass
class Item:
"""Item domain model."""
user_id: int
title: str
id: int | None = None |
@jacobtylerwalls Yeah, on |
@DanielNoord if no one has started on this, could you assign it to me? Thanks! 🙂 |
@MaximMukhametov i am struggling to understand why |
@zenlyj pylint is taking into account that first = datetime.now()
^^^^^^^^
NameError: name 'datetime' is not defined |
@jacobtylerwalls thanks for clarifying! Any thoughts on the other case posted by @MaximMukhametov? I am unsure if the |
Ah, sorry! You have a point; doesn't seem like we should emit warnings in that case (and we don't currently.) |
Bug description
Within functions
used-before-assignment
doesn't get raised for some edge cases.Configuration
Command used
Pylint output
Expected behavior
Pylint version
OS / Environment
/
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: