Bases: Unknown
Class for parameter calls.
Since we cannot analyze parameter calls, we mark it as unknown.
A parameter call is a call of a function that is passed as a parameter to another function.
E.g., def f(x):
x()
The call of x() is a parameter call only known at runtime.
Attributes:
Source code in src/library_analyzer/processing/api/purity_analysis/model/_purity.py
| @dataclass
class CallOfParameter(Unknown): # ParameterCall
"""Class for parameter calls.
Since we cannot analyze parameter calls, we mark it as unknown.
A parameter call is a call of a function that is passed as a parameter to another function.
E.g., def f(x):
x()
The call of x() is a parameter call only known at runtime.
Attributes
----------
expression :
The expression that is called.
origin :
The origin of the call.
"""
expression: Expression
origin: Symbol | NodeID | None = field(default=None)
def __hash__(self) -> int:
return hash(str(self))
def __str__(self) -> str:
return f"{self.__class__.__name__}: {self.expression.__str__()}"
def to_dict(self) -> dict[str, Any]:
origin = (
self.origin.id if isinstance(self.origin, Symbol) else (self.origin if self.origin is not None else None)
)
return {
"origin": f"{origin}",
"reason": f"{self.expression.__str__()}",
}
|
expression: Expression
instance-attribute
origin: Symbol | NodeID | None = field(default=None)
class-attribute
instance-attribute
__hash__()
Source code in src/library_analyzer/processing/api/purity_analysis/model/_purity.py
| def __hash__(self) -> int:
return hash(str(self))
|
__init__(expression, origin=None)
__str__()
Source code in src/library_analyzer/processing/api/purity_analysis/model/_purity.py
| def __str__(self) -> str:
return f"{self.__class__.__name__}: {self.expression.__str__()}"
|
to_dict()
Source code in src/library_analyzer/processing/api/purity_analysis/model/_purity.py
| def to_dict(self) -> dict[str, Any]:
origin = (
self.origin.id if isinstance(self.origin, Symbol) else (self.origin if self.origin is not None else None)
)
return {
"origin": f"{origin}",
"reason": f"{self.expression.__str__()}",
}
|