-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codedataclasses
Description
Bug description
This file:
from dataclasses import dataclass
import collections
@dataclass
class Shadow:
collections: collections.deque
other: collections.defaultdict
print(Shadow(collections.deque(), collections.defaultdict()))is perhaps a bit unorthodox, but runs fine, because the collections: ... doesn't actually shadow the module when defining other.
Configuration
No response
Command used
pylint -E test.pyPylint output
************* Module test
.../test.py:9:11: E0601: Using variable 'collections' before assignment (used-before-assignment)Expected behavior
No error.
Pylint version
pylint 2.13.9
astroid 2.11.5
Python 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]OS / Environment
Archlinux
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codedataclasses