Skip to content

BuiltinOpen

Bases: Builtin

Represents the builtin open like function.

When dealing with open-like functions the call node is needed to determine the file path.

Attributes:

Name Type Description
call Call

The call node of the open-like function.

Source code in src/library_analyzer/processing/api/purity_analysis/model/_module_data.py
@dataclass
class BuiltinOpen(Builtin):
    """Represents the builtin open like function.

    When dealing with open-like functions the call node is needed to determine the file path.

    Attributes
    ----------
    call :
        The call node of the open-like function.
    """

    call: astroid.Call

    def __str__(self) -> str:
        return f"{self.__class__.__name__}.{self.name}"

    def __hash__(self) -> int:
        return hash(str(self))

call: astroid.Call 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))

__init__(node, id, name, call)

__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}"