Skip to content

Interval

Source code in library_analyzer/processing/annotations/model/_annotations.py
@dataclass
class Interval:
    isDiscrete: bool
    lowerIntervalLimit: Union[int, float, str]
    lowerLimitType: int
    upperIntervalLimit: Union[int, float, str]
    upperLimitType: int

    def to_json(self) -> dict:
        return asdict(self)

    @staticmethod
    def from_json(json: Any) -> Interval:
        return Interval(
            json["isDiscrete"],
            json["lowerIntervalLimit"],
            json["lowerLimitType"],
            json["upperIntervalLimit"],
            json["upperLimitType"],
        )

    def __eq__(self, other: Any) -> bool:
        return (
            isinstance(other, Interval)
            and self.isDiscrete == other.isDiscrete
            and self.lowerIntervalLimit == other.lowerIntervalLimit
            and isinstance(self.lowerIntervalLimit, type(self.lowerIntervalLimit))
            and self.lowerLimitType == other.lowerLimitType
            and self.upperIntervalLimit == other.upperIntervalLimit
            and isinstance(self.upperIntervalLimit, type(self.upperIntervalLimit))
            and self.upperLimitType == self.upperLimitType
        )

isDiscrete: bool class-attribute

lowerIntervalLimit: Union[int, float, str] class-attribute

lowerLimitType: int class-attribute

upperIntervalLimit: Union[int, float, str] class-attribute

upperLimitType: int class-attribute

__eq__(other)

Source code in library_analyzer/processing/annotations/model/_annotations.py
def __eq__(self, other: Any) -> bool:
    return (
        isinstance(other, Interval)
        and self.isDiscrete == other.isDiscrete
        and self.lowerIntervalLimit == other.lowerIntervalLimit
        and isinstance(self.lowerIntervalLimit, type(self.lowerIntervalLimit))
        and self.lowerLimitType == other.lowerLimitType
        and self.upperIntervalLimit == other.upperIntervalLimit
        and isinstance(self.upperIntervalLimit, type(self.upperIntervalLimit))
        and self.upperLimitType == self.upperLimitType
    )

from_json(json) staticmethod

Source code in library_analyzer/processing/annotations/model/_annotations.py
@staticmethod
def from_json(json: Any) -> Interval:
    return Interval(
        json["isDiscrete"],
        json["lowerIntervalLimit"],
        json["lowerLimitType"],
        json["upperIntervalLimit"],
        json["upperLimitType"],
    )

to_json()

Source code in library_analyzer/processing/annotations/model/_annotations.py
def to_json(self) -> dict:
    return asdict(self)