Skip to content

AbstractType

Source code in library_analyzer/processing/api/model/_types.py
class AbstractType(metaclass=ABCMeta):
    @abstractmethod
    def to_json(self) -> dict[str, Any]:
        pass

    @classmethod
    def from_json(cls, json: Any) -> Optional[AbstractType]:
        if json is None:
            return None
        value: Optional[AbstractType] = NamedType.from_json(json)
        if value is not None:
            return value
        value = EnumType.from_json(json)
        if value is not None:
            return value
        value = BoundaryType.from_json(json)
        if value is not None:
            return value
        return UnionType.from_json(json)

from_json(json) classmethod

Source code in library_analyzer/processing/api/model/_types.py
@classmethod
def from_json(cls, json: Any) -> Optional[AbstractType]:
    if json is None:
        return None
    value: Optional[AbstractType] = NamedType.from_json(json)
    if value is not None:
        return value
    value = EnumType.from_json(json)
    if value is not None:
        return value
    value = BoundaryType.from_json(json)
    if value is not None:
        return value
    return UnionType.from_json(json)

to_json() abstractmethod

Source code in library_analyzer/processing/api/model/_types.py
@abstractmethod
def to_json(self) -> dict[str, Any]:
    pass