Skip to content

PurityResult

Bases: ABC

Superclass for purity results.

Purity results are either pure, impure or unknown.

is_class : Whether the result is for a class or not.

Source code in src/library_analyzer/processing/api/purity_analysis/model/_purity.py
class PurityResult(ABC):
    """Superclass for purity results.

    Purity results are either pure, impure or unknown.

    is_class :
        Whether the result is for a class or not.
    """

    is_class: bool = False

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

    @abstractmethod
    def to_dict(self, shorten: bool = False) -> dict[str, Any]:
        pass

    @abstractmethod
    def update(self, other: PurityResult | None) -> PurityResult:
        """Update the current result with another result."""

is_class: bool = False 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))

to_dict(shorten=False) abstractmethod

Source code in src/library_analyzer/processing/api/purity_analysis/model/_purity.py
@abstractmethod
def to_dict(self, shorten: bool = False) -> dict[str, Any]:
    pass

update(other) abstractmethod

Update the current result with another result.

Source code in src/library_analyzer/processing/api/purity_analysis/model/_purity.py
@abstractmethod
def update(self, other: PurityResult | None) -> PurityResult:
    """Update the current result with another result."""