Skip to content

Result

Source code in src/library_analyzer/processing/api/model/_api.py
@dataclass(frozen=True)
class Result:
    id: str
    name: str
    docstring: ResultDocstring
    function_id: str | None = None

    @staticmethod
    def from_dict(d: dict[str, Any], function_id: str | None = None) -> Result:
        return Result(
            d["id"],
            d["name"],
            ResultDocstring.from_dict(d.get("docstring", {})),
            function_id,
        )

    def to_dict(self) -> dict[str, Any]:
        return {"id": self.id, "name": self.name, "docstring": self.docstring.to_dict()}

docstring: ResultDocstring instance-attribute

function_id: str | None = None class-attribute instance-attribute

id: str instance-attribute

name: str instance-attribute

__init__(id, name, docstring, function_id=None)

from_dict(d, function_id=None) staticmethod

Source code in src/library_analyzer/processing/api/model/_api.py
@staticmethod
def from_dict(d: dict[str, Any], function_id: str | None = None) -> Result:
    return Result(
        d["id"],
        d["name"],
        ResultDocstring.from_dict(d.get("docstring", {})),
        function_id,
    )

to_dict()

Source code in src/library_analyzer/processing/api/model/_api.py
def to_dict(self) -> dict[str, Any]:
    return {"id": self.id, "name": self.name, "docstring": self.docstring.to_dict()}