diff --git a/doc/whatsnew/fragments/8893.false_negative b/doc/whatsnew/fragments/8893.false_negative index c7088424b7..5760b384f1 100644 --- a/doc/whatsnew/fragments/8893.false_negative +++ b/doc/whatsnew/fragments/8893.false_negative @@ -1,3 +1,3 @@ Fix false negative for `used-before-assignment` when a `TYPE_CHECKING` import is used as a type annotation prior to erroneous usage. -Refs #8893 \ No newline at end of file +Refs #8893 diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index 33d1320491..e7740fb1ec 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -1985,7 +1985,7 @@ def _filter_type_checking_import_from_consumption( self, node: nodes.NodeNG, nodes_to_consume: list[nodes.NodeNG], - is_reported: bool + is_reported: bool, ) -> list[nodes.NodeNG]: """Do not consume type-checking import node as used-before-assignment may invoke in different scopes. diff --git a/tests/functional/u/used/used_before_assignment_scoping.py b/tests/functional/u/used/used_before_assignment_scoping.py index dd26dc6d81..0d88210bdd 100644 --- a/tests/functional/u/used/used_before_assignment_scoping.py +++ b/tests/functional/u/used/used_before_assignment_scoping.py @@ -15,4 +15,4 @@ def func(): first: datetime first = datetime.now() # [used-before-assignment] second = datetime.now() - return first, second \ No newline at end of file + return first, second