-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkControl flowRequires control flow understandingRequires control flow understandingFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Bug description
Example
# pylint: disable=import-error,missing-function-docstring,invalid-name
"""."""
from typing import TYPE_CHECKING, Optional
from package import runtime
if TYPE_CHECKING:
from package import module
elif runtime.is_local:
from package import module
else:
module = None
def diagnose() -> Optional[module.Result]:
if module is not None:
return module.diagnose_result()
return None
Configuration
No response
Command used
pylint a.py
Pylint output
************* Module a
a.py:16:27: E0601: Using variable 'module' before assignment (used-before-assignment)
------------------------------------------------------------------
Your code has been rated at 5.45/10 (previous run: 5.45/10, +0.00)
Expected behavior
No used-before-assignment
should be raised.
Pylint version
pylint 2.15.3
astroid 2.12.10
Python 3.8.10 (default, Jul 6 2022, 10:42:32)
[Clang 13.0.0 (clang-1300.0.29.30)]
OS / Environment
No response
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkControl flowRequires control flow understandingRequires control flow understandingFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation