Bases: ABC
Represents a node that defines a Name.
A Symbol is a node that defines a Name, e.g. a function, a class, a variable, etc.
It can be referenced by another node.
Attributes:
| Name |
Type |
Description |
node |
ClassDef | FunctionDef | AssignName | MemberAccessTarget
|
The node that defines the symbol.
|
id |
NodeID
|
|
name |
str
|
The name of the symbol (for easier access).
|
Source code in src/library_analyzer/processing/api/purity_analysis/model/_module_data.py
| @dataclass
class Symbol(ABC):
"""Represents a node that defines a Name.
A Symbol is a node that defines a Name, e.g. a function, a class, a variable, etc.
It can be referenced by another node.
Attributes
----------
node :
The node that defines the symbol.
id :
The id of that node.
name :
The name of the symbol (for easier access).
"""
node: astroid.ClassDef | astroid.FunctionDef | astroid.AssignName | MemberAccessTarget
id: NodeID
name: str
def __str__(self) -> str:
return f"{self.__class__.__name__}.{self.name}.line{self.id.line}"
def __hash__(self) -> int:
return hash(str(self))
|
id: NodeID
instance-attribute
name: str
instance-attribute
node: astroid.ClassDef | astroid.FunctionDef | astroid.AssignName | MemberAccessTarget
instance-attribute
__hash__()
Source code in src/library_analyzer/processing/api/purity_analysis/model/_module_data.py
| def __hash__(self) -> int:
return hash(str(self))
|
__str__()
Source code in src/library_analyzer/processing/api/purity_analysis/model/_module_data.py
| def __str__(self) -> str:
return f"{self.__class__.__name__}.{self.name}.line{self.id.line}"
|