← back to kkollsga__kglite

Function bodies 1,000 total

All specs Real LLM only Function bodies
KnowledgeGraph.valid_at method · python · L561-L579 (19 LOC)
kglite/__init__.pyi
    def valid_at(
        self,
        date: str,
        date_from_field: Optional[str] = None,
        date_to_field: Optional[str] = None,
    ) -> KnowledgeGraph:
        """Filter nodes valid at a specific date.

        Keeps nodes where ``date_from <= date <= date_to``.

        Args:
            date: Date string (e.g. ``'2024-01-15'``).
            date_from_field: Name of the start-date property. Default ``'date_from'``.
            date_to_field: Name of the end-date property. Default ``'date_to'``.

        Returns:
            A new KnowledgeGraph with the filtered selection.
        """
        ...
KnowledgeGraph.valid_during method · python · L581-L599 (19 LOC)
kglite/__init__.pyi
    def valid_during(
        self,
        start_date: str,
        end_date: str,
        date_from_field: Optional[str] = None,
        date_to_field: Optional[str] = None,
    ) -> KnowledgeGraph:
        """Filter nodes whose validity period overlaps a date range.

        Args:
            start_date: Start of the query range.
            end_date: End of the query range.
            date_from_field: Name of the start-date property. Default ``'date_from'``.
            date_to_field: Name of the end-date property. Default ``'date_to'``.

        Returns:
            A new KnowledgeGraph with the filtered selection.
        """
        ...
KnowledgeGraph.update method · python · L605-L620 (16 LOC)
kglite/__init__.pyi
    def update(
        self,
        properties: dict[str, Any],
        keep_selection: Optional[bool] = None,
    ) -> dict[str, Any]:
        """Batch-update properties on all selected nodes.

        Args:
            properties: Mapping of property names to new values.
            keep_selection: Preserve the current selection in the returned graph. Default ``False``.

        Returns:
            Dict with ``graph`` (updated KnowledgeGraph), ``nodes_updated`` (int),
            and ``report_index`` (int).
        """
        ...
KnowledgeGraph.get_nodes method · python · L626-L647 (22 LOC)
kglite/__init__.pyi
    def get_nodes(
        self,
        max_nodes: Optional[int] = None,
        indices: Optional[list[int]] = None,
        parent_type: Optional[str] = None,
        parent_info: Optional[bool] = None,
        flatten_single_parent: bool = True,
    ) -> Union[ResultView, dict[str, Any]]:
        """Materialise selected nodes as a ResultView (flat) or grouped dict.

        Args:
            max_nodes: Maximum number of nodes to return.
            indices: Specific node indices to return.
            parent_type: Group results by parent of this type.
            parent_info: Include parent info in grouped output.
            flatten_single_parent: Flatten when there is only one parent group. Default ``True``.

        Returns:
            List of node dicts, each containing ``id``, ``title``, ``type``,
            and all stored properties.
        """
        ...
KnowledgeGraph.to_df method · python · L649-L667 (19 LOC)
kglite/__init__.pyi
    def to_df(
        self,
        *,
        include_type: bool = True,
        include_id: bool = True,
    ) -> pd.DataFrame:
        """Export current selection as a pandas DataFrame.

        Each node becomes a row with columns for title, type, id, and all
        properties. Missing properties across different node types become None.

        Args:
            include_type: Include ``type`` column. Default ``True``.
            include_id: Include ``id`` column. Default ``True``.

        Returns:
            DataFrame with one row per selected node.
        """
        ...
KnowledgeGraph.node_count method · python · L669-L674 (6 LOC)
kglite/__init__.pyi
    def node_count(self) -> int:
        """Count selected nodes without materialising them.

        Much faster than ``len(get_nodes())``.
        """
        ...
KnowledgeGraph.get_ids method · python · L680-L685 (6 LOC)
kglite/__init__.pyi
    def get_ids(self) -> list[dict[str, Any]]:
        """Return only ``id``, ``title``, and ``type`` for each selected node.

        Faster than :meth:`get_nodes` when you only need identification info.
        """
        ...
Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
KnowledgeGraph.id_values method · python · L687-L692 (6 LOC)
kglite/__init__.pyi
    def id_values(self) -> list[Any]:
        """Return a flat list of ID values from the current selection.

        The lightest retrieval method — no dict wrapping.
        """
        ...
KnowledgeGraph.get_node_by_id method · python · L694-L704 (11 LOC)
kglite/__init__.pyi
    def get_node_by_id(self, node_type: str, node_id: Any) -> Optional[dict[str, Any]]:
        """Look up a single node by type and ID. O(1) via hash index.

        Args:
            node_type: The node type (e.g. ``'User'``).
            node_id: The unique ID value.

        Returns:
            Node property dict, or ``None`` if not found.
        """
        ...
KnowledgeGraph.find method · python · L706-L730 (25 LOC)
kglite/__init__.pyi
    def find(
        self,
        name: str,
        node_type: Optional[str] = None,
        match_type: Optional[str] = None,
    ) -> list[dict[str, Any]]:
        """Find code entities by name, with disambiguation context.

        Searches across code entity node types (Function, Struct, Class, Enum,
        Trait, Protocol, Interface, Module, Constant) for nodes matching the
        given name.

        Args:
            name: Entity name to search for (e.g. ``"execute"``).
            node_type: Optional filter — only search this node type
                (e.g. ``"Function"``, ``"Struct"``).
            match_type: Matching strategy: ``"exact"`` (default),
                ``"contains"`` (case-insensitive substring), or
                ``"starts_with"`` (case-insensitive prefix).

        Returns:
            List of dicts with: type, name, qualified_name, file_path,
            line_number, and optionally signature and visibility.
        """
        ...
KnowledgeGraph.source method · python · L744-L764 (21 LOC)
kglite/__init__.pyi
    def source(
        self,
        name: str | list[str],
        node_type: Optional[str] = None,
    ) -> dict[str, Any] | list[dict[str, Any]]:
        """Get the source location of one or more code entities.

        Resolves names or qualified names to code entities and returns
        file paths and line ranges.

        Args:
            name: Entity name, qualified name, or list of names.
            node_type: Optional node type hint.

        Returns:
            Single name: dict with ``file_path``, ``line_number``,
            ``end_line``, ``line_count``, ``name``, ``qualified_name``,
            ``type``, ``signature``.
            List of names: list of such dicts.
        """
        ...
KnowledgeGraph.context method · python · L766-L788 (23 LOC)
kglite/__init__.pyi
    def context(
        self,
        name: str,
        node_type: Optional[str] = None,
        hops: Optional[int] = None,
    ) -> dict[str, Any]:
        """Get the full neighborhood of a code entity.

        Returns the node's properties and all related entities grouped by
        relationship type. If the name is ambiguous, returns the matches
        so you can refine with a qualified name.

        Args:
            name: Entity name or qualified name.
            node_type: Optional node type hint.
            hops: Max traversal depth (default 1).

        Returns:
            Dict with ``"node"`` (properties), ``"defined_in"`` (file path),
            and relationship groups (e.g. ``"HAS_METHOD"``, ``"CALLS"``,
            ``"called_by"``).
        """
        ...
KnowledgeGraph.toc method · python · L790-L807 (18 LOC)
kglite/__init__.pyi
    def toc(
        self,
        file_path: str,
    ) -> dict[str, Any]:
        """Get a table of contents for a file — all code entities defined in it.

        Returns entities sorted by line number with a type summary.

        Args:
            file_path: Path of the file (the File node's id/path).

        Returns:
            Dict with ``"file"`` (path), ``"entities"`` (list of entity dicts
            sorted by line_number, each with type, name, qualified_name,
            line_number, end_line, and optionally signature), and ``"summary"``
            (dict of type name to count).
        """
        ...
KnowledgeGraph.build_id_indices method · python · L809-L815 (7 LOC)
kglite/__init__.pyi
    def build_id_indices(self, node_types: Optional[list[str]] = None) -> None:
        """Pre-build ID lookup indices for fast :meth:`get_node_by_id` calls.

        Args:
            node_types: Types to index. ``None`` indexes all types.
        """
        ...
KnowledgeGraph.node_type_counts method · python · L817-L823 (7 LOC)
kglite/__init__.pyi
    def node_type_counts(self) -> dict[str, int]:
        """Get node counts per type without materialising nodes.

        Returns:
            Dict mapping node type name to count.
        """
        ...
Repobility (the analyzer behind this table) · https://repobility.com
KnowledgeGraph.reindex method · python · L828-L842 (15 LOC)
kglite/__init__.pyi
    def reindex(self) -> None:
        """Rebuild all indexes from the current graph state.

        Reconstructs type_indices, property_indices, and composite_indices by
        scanning all live nodes. Clears lazy caches (id_indices, connection_types)
        so they rebuild on next access.

        Use after bulk mutations (especially Cypher DELETE/REMOVE) to ensure
        index consistency.

        Example::

            graph.reindex()
        """
        ...
KnowledgeGraph.vacuum method · python · L844-L867 (24 LOC)
kglite/__init__.pyi
    def vacuum(self) -> dict[str, int]:
        """Compact the graph by removing tombstones left by node/edge deletions.

        With StableDiGraph, deletions leave holes in the internal storage.
        Over time, this wastes memory and degrades iteration performance.
        ``vacuum()`` rebuilds the graph with contiguous indices, then rebuilds
        all indexes.

        **Important**: This resets the current selection since node indices change.
        Call this between query chains, not in the middle of one.

        Returns:
            dict with keys:
                - ``nodes_remapped``: Number of nodes that were remapped
                - ``tombstones_removed``: Number of tombstone slots reclaimed

        Example::

            info = graph.graph_info()
            if info['fragmentation_ratio'] > 0.3:
                result = graph.vacuum()
                print(f"Reclaimed {result['tombstones_removed']} slots")
        """
        ...
KnowledgeGraph.set_auto_vacuum method · python · L869-L886 (18 LOC)
kglite/__init__.pyi
    def set_auto_vacuum(self, threshold: float | None) -> None:
        """Configure automatic vacuum after DELETE operations.

        When enabled, the graph automatically compacts itself after Cypher DELETE
        operations if the fragmentation ratio exceeds the threshold and there are
        more than 100 tombstones.

        Args:
            threshold: A float between 0.0 and 1.0, or ``None`` to disable.
                Default is ``0.3`` (30% fragmentation triggers vacuum).

        Example::

            graph.set_auto_vacuum(0.2)   # more aggressive — vacuum at 20%
            graph.set_auto_vacuum(None)  # disable auto-vacuum
            graph.set_auto_vacuum(0.3)   # restore default
        """
        ...
KnowledgeGraph.read_only method · python · L888-L907 (20 LOC)
kglite/__init__.pyi
    def read_only(self, enabled: bool | None = None) -> bool:
        """Set or query read-only mode for the Cypher layer.

        When enabled, all Cypher mutation queries (CREATE, SET, DELETE, REMOVE,
        MERGE) are rejected, and ``describe()`` omits mutation docs.

        Args:
            enabled: If ``True``, enable read-only mode. If ``False``, disable.
                If omitted, return the current state without changing it.

        Returns:
            The current read-only state (after applying the change, if any).

        Example::

            graph.read_only(True)   # lock the graph
            graph.read_only()       # -> True
            graph.read_only(False)  # unlock
        """
        ...
KnowledgeGraph.graph_info method · python · L909-L932 (24 LOC)
kglite/__init__.pyi
    def graph_info(self) -> dict[str, Any]:
        """Get diagnostic information about graph storage health.

        Returns a dictionary with storage metrics useful for deciding when
        to call :meth:`vacuum` or :meth:`reindex`.

        Returns:
            dict with keys:
                - ``node_count``: Number of live nodes
                - ``node_capacity``: Upper bound of node indices (includes tombstones)
                - ``node_tombstones``: Number of wasted slots from deletions
                - ``edge_count``: Number of live edges
                - ``fragmentation_ratio``: Ratio of wasted storage (0.0 = clean)
                - ``type_count``: Number of distinct node types
                - ``property_index_count``: Number of single-property indexes
                - ``composite_index_count``: Number of composite indexes

        Example::

            info = graph.graph_info()
            if info['fragmentation_ratio'] > 0.3:
                graph.vacuum()
        
KnowledgeGraph.get_connections method · python · L934-L952 (19 LOC)
kglite/__init__.pyi
    def get_connections(
        self,
        indices: Optional[list[int]] = None,
        parent_info: Optional[bool] = None,
        include_node_properties: Optional[bool] = None,
        flatten_single_parent: bool = True,
    ) -> dict[str, Any]:
        """Get connections for selected nodes.

        Args:
            indices: Specific node indices to query.
            parent_info: Include parent info in output.
            include_node_properties: Include properties of connected nodes. Default ``True``.
            flatten_single_parent: Flatten when only one parent. Default ``True``.

        Returns:
            Nested dict ``{title: {node_id, type, incoming, outgoing}}``.
        """
        ...
KnowledgeGraph.get_titles method · python · L954-L971 (18 LOC)
kglite/__init__.pyi
    def get_titles(
        self,
        max_nodes: Optional[int] = None,
        indices: Optional[list[int]] = None,
        flatten_single_parent: Optional[bool] = None,
    ) -> Union[list[str], dict[str, list[str]]]:
        """Get titles of selected nodes.

        Without traversal (single parent group), returns a flat list of titles.
        After traversal (multiple parent groups), returns ``{parent_title: [titles]}``.

        Args:
            flatten_single_parent: Flatten single-group results to a list. Default ``True``.

        Returns:
            ``list[str]`` when flattened, ``dict[str, list[str]]`` when grouped.
        """
        ...
KnowledgeGraph.explain method · python · L973-L980 (8 LOC)
kglite/__init__.pyi
    def explain(self) -> str:
        """Return a human-readable execution plan for the current query chain.

        Example output::

            TYPE_FILTER Person (500 nodes) -> FILTER (42 nodes)
        """
        ...
Repobility — same analyzer, your code, free for public repos · /scan/
KnowledgeGraph.get_properties method · python · L982-L1003 (22 LOC)
kglite/__init__.pyi
    def get_properties(
        self,
        properties: list[str],
        max_nodes: Optional[int] = None,
        indices: Optional[list[int]] = None,
        flatten_single_parent: Optional[bool] = None,
    ) -> Union[list[tuple[Any, ...]], dict[str, list[tuple[Any, ...]]]]:
        """Get specific properties for selected nodes.

        Without traversal (single parent group), returns a flat list of tuples.
        After traversal (multiple parent groups), returns ``{parent_title: [tuples]}``.

        Args:
            properties: List of property names to retrieve.
            max_nodes: Maximum number of nodes.
            indices: Specific node indices.
            flatten_single_parent: Flatten single-group results to a list. Default ``True``.

        Returns:
            ``list[tuple]`` when flattened, ``dict[str, list[tuple]]`` when grouped.
        """
        ...
KnowledgeGraph.unique_values method · python · L1005-L1029 (25 LOC)
kglite/__init__.pyi
    def unique_values(
        self,
        property: str,
        group_by_parent: Optional[bool] = None,
        level_index: Optional[int] = None,
        indices: Optional[list[int]] = None,
        store_as: Optional[str] = None,
        max_length: Optional[int] = None,
        keep_selection: Optional[bool] = None,
    ) -> Any:
        """Get unique values of a property, optionally storing results.

        Args:
            property: Property name to extract unique values from.
            group_by_parent: Group by parent node. Default ``True``.
            level_index: Target level in the selection hierarchy.
            indices: Specific node indices.
            store_as: If set, stores comma-separated unique values as this property on parents.
            max_length: Max string length when storing.
            keep_selection: Preserve selection after store. Default ``False``.

        Returns:
            Dict of unique values per parent, or a KnowledgeGraph if ``store_as
KnowledgeGraph.traverse method · python · L1035-L1153 (119 LOC)
kglite/__init__.pyi
    def traverse(
        self,
        connection_type: Optional[str] = None,
        level_index: Optional[int] = None,
        direction: Optional[str] = None,
        filter_target: Optional[dict[str, Any]] = None,
        filter_connection: Optional[dict[str, Any]] = None,
        sort_target: Optional[Union[str, list[tuple[str, bool]]]] = None,
        max_nodes: Optional[int] = None,
        new_level: Optional[bool] = None,
        method: Optional[Union[str, dict[str, Any]]] = None,
    ) -> KnowledgeGraph:
        """Traverse connections or discover relationships via comparison methods.

        **Edge-based mode** (default, no ``method``):
            Follow explicit graph edges of a given type.

        **Comparison-based mode** (``method=`` specified):
            Discover source→target pairs via spatial, semantic, or clustering
            comparisons. The first arg becomes **target node type** instead of
            connection type.

        Args:
            connection_
KnowledgeGraph.create_connections method · python · L1155-L1195 (41 LOC)
kglite/__init__.pyi
    def create_connections(
        self,
        connection_type: str,
        keep_selection: Optional[bool] = None,
        conflict_handling: Optional[str] = None,
        properties: Optional[dict[str, list[str]]] = None,
        source_type: Optional[str] = None,
        target_type: Optional[str] = None,
    ) -> KnowledgeGraph:
        """Create connections from the traversal hierarchy.

        By default, creates edges from the top-level ancestor (first
        traversal level) to the leaf nodes (last level). Use
        ``source_type`` / ``target_type`` to choose different levels.

        Args:
            connection_type: Label for the new edges (e.g. ``'A_TO_C'``).
            keep_selection: Preserve selection. Default ``False``.
            conflict_handling: ``'update'`` (default), ``'replace'``, ``'skip'``,
                or ``'preserve'``.
            properties: Copy properties from intermediate nodes onto the new
                edges. Dict mapping node type to pr
KnowledgeGraph.add_properties method · python · L1197-L1248 (52 LOC)
kglite/__init__.pyi
    def add_properties(
        self,
        properties: dict[str, Union[list[str], dict[str, str]]],
        keep_selection: Optional[bool] = None,
    ) -> KnowledgeGraph:
        """Enrich selected nodes with properties from ancestor nodes in the traversal chain.

        Copies, renames, aggregates, or computes spatial properties from nodes
        at other levels of the selection hierarchy onto the current leaf nodes.

        Args:
            properties: Dict mapping source node type → property spec:

                - ``{'B': ['name', 'status']}`` — copy listed properties as-is
                - ``{'B': []}`` — copy all properties from B
                - ``{'B': {'new_name': 'old_name'}}`` — copy with rename
                - ``{'B': {'avg_depth': 'mean(depth)'}}`` — aggregate functions:
                  ``count(*)``, ``sum(prop)``, ``mean(prop)``, ``min(prop)``,
                  ``max(prop)``, ``std(prop)``, ``collect(prop)``
                - ``{'B': {'dist': 'distance'}}
KnowledgeGraph.children_properties_to_list method · python · L1250-L1275 (26 LOC)
kglite/__init__.pyi
    def children_properties_to_list(
        self,
        property: Optional[str] = None,
        filter: Optional[dict[str, Any]] = None,
        sort: Optional[Union[str, list[tuple[str, bool]]]] = None,
        max_nodes: Optional[int] = None,
        store_as: Optional[str] = None,
        max_length: Optional[int] = None,
        keep_selection: Optional[bool] = None,
    ) -> Any:
        """Collect child-node property values into comma-separated lists.

        Args:
            property: Child property to collect. Default ``'title'``.
            filter: Filter conditions for children.
            sort: Sort children.
            max_nodes: Limit children per parent.
            store_as: If set, stores the list as this property on parent nodes.
            max_length: Max string length when storing.
            keep_selection: Preserve selection after store. Default ``False``.

        Returns:
            Dict of ``{parent_title: 'val1, val2, ...'}`` or a KnowledgeGraph
    
KnowledgeGraph.statistics method · python · L1281-L1297 (17 LOC)
kglite/__init__.pyi
    def statistics(
        self,
        property: str,
        level_index: Optional[int] = None,
        group_by: Optional[str] = None,
    ) -> Any:
        """Compute descriptive statistics for a numeric property.

        Returns per-parent stats including count, mean, std, min, max, sum.

        Args:
            property: Numeric property name.
            level_index: Target level in the hierarchy.
            group_by: Group results by this property instead of by parent.
                Returns ``{group_value: {count, sum, mean, min, max, std}}``.
        """
        ...
KnowledgeGraph.calculate method · python · L1299-L1322 (24 LOC)
kglite/__init__.pyi
    def calculate(
        self,
        expression: str,
        level_index: Optional[int] = None,
        store_as: Optional[str] = None,
        keep_selection: Optional[bool] = None,
        aggregate_connections: Optional[bool] = None,
    ) -> Any:
        """Evaluate a mathematical expression on selected nodes.

        Supports property references, arithmetic operators, and aggregate
        functions (``sum``, ``mean``, ``std``, ``min``, ``max``, ``count``).

        Args:
            expression: Expression string, e.g. ``'price * quantity'`` or ``'mean(age)'``.
            level_index: Target level in the hierarchy.
            store_as: If set, stores results as this property on nodes.
            keep_selection: Preserve selection after store. Default ``False``.
            aggregate_connections: Aggregate over connected nodes.

        Returns:
            Computation results, or a KnowledgeGraph if ``store_as`` is set.
        """
        ...
Citation: Repobility (2026). State of AI-Generated Code. https://repobility.com/research/
KnowledgeGraph.count method · python · L1324-L1345 (22 LOC)
kglite/__init__.pyi
    def count(
        self,
        level_index: Optional[int] = None,
        group_by_parent: Optional[bool] = None,
        store_as: Optional[str] = None,
        keep_selection: Optional[bool] = None,
        group_by: Optional[str] = None,
    ) -> Any:
        """Count nodes, optionally grouped by parent or by a property.

        Args:
            level_index: Target level in the hierarchy.
            group_by_parent: Group counts by parent node.
            store_as: Store count as a property on parent nodes.
            keep_selection: Preserve selection after store. Default ``False``.
            group_by: Group counts by this property instead of by parent.
                Returns ``{group_value: count}``.

        Returns:
            An integer count, grouped counts, or a KnowledgeGraph if ``store_as`` is set.
        """
        ...
KnowledgeGraph.set_parent_type method · python · L1355-L1375 (21 LOC)
kglite/__init__.pyi
    def set_parent_type(self, node_type: str, parent_type: str) -> None:
        """Declare a node type as a supporting child of a parent type.

        Supporting types are hidden from the ``describe()`` inventory and
        instead appear in the ``<supporting>`` section when the parent type
        is inspected.  Their capabilities (timeseries, spatial, etc.) bubble
        up to the parent descriptor.

        Args:
            node_type: The supporting (child) node type.
            parent_type: The core (parent) node type.

        Raises:
            ValueError: If either type does not exist in the graph.

        Example::

            graph.set_parent_type('ProductionProfile', 'Field')
            graph.set_parent_type('FieldReserves', 'Field')
        """
        ...
KnowledgeGraph.describe method · python · L1377-L1419 (43 LOC)
kglite/__init__.pyi
    def describe(
        self,
        types: list[str] | None = None,
        connections: bool | list[str] | None = None,
        cypher: bool | list[str] | None = None,
    ) -> str:
        """Return an XML description of this graph for AI agents.

        Three independent axes for progressive disclosure:

        **Node types** (``types`` parameter):

        - ``describe()`` — Inventory overview with compact type descriptors.
        - ``describe(types=['Field', 'Well'])`` — Focused detail for
          specific types with properties, connections, and samples.

        **Connections** (``connections`` parameter):

        - ``describe(connections=True)`` — All connection types with count,
          source/target node types, and property names.
        - ``describe(connections=['BELONGS_TO'])`` — Deep-dive with per-pair
          counts, property stats with sample values, and sample edges.

        **Cypher** (``cypher`` parameter):

        - ``describe(cypher=True)`` — Compact
KnowledgeGraph.bug_report method · python · L1421-L1448 (28 LOC)
kglite/__init__.pyi
    def bug_report(
        self,
        query: str,
        result: str,
        expected: str,
        description: str,
        path: str | None = None,
    ) -> str:
        """File a Cypher bug report to ``reported_bugs.md``.

        Appends a timestamped, version-tagged report to the top of the file
        (creating it if needed).  All inputs are sanitised against code
        injection (HTML tags, ``javascript:`` URIs, triple-backtick breakout).

        Args:
            query: The Cypher query that triggered the bug.
            result: The actual result you got.
            expected: The result you expected.
            description: Free-text explanation.
            path: Optional file path (default: ``reported_bugs.md`` in cwd).

        Returns:
            Confirmation message with the file path.

        Raises:
            IOError: If the file cannot be written.
        """
        ...
KnowledgeGraph.explain_mcp method · python · L1451-L1462 (12 LOC)
kglite/__init__.pyi
    def explain_mcp() -> str:
        """Return a self-contained XML quickstart for setting up a KGLite MCP server.

        Includes a ready-to-use server template with core tools (graph_overview,
        cypher_query, bug_report), optional tools (find_entity, read_source, etc.),
        and Claude Desktop / Claude Code registration config.

        Example::

            print(KnowledgeGraph.explain_mcp())
        """
        ...
KnowledgeGraph.schema method · python · L1476-L1490 (15 LOC)
kglite/__init__.pyi
    def schema(self) -> dict[str, Any]:
        """Return a full schema overview of the graph.

        Returns:
            Dict with keys:
                - ``node_types``: ``{type_name: {count, properties: {name: type_str}}}``
                - ``connection_types``: ``{conn_name: {count, source_types: list, target_types: list}}``
                - ``indexes``: list of ``"Type.property"`` strings
                - ``node_count``: total nodes
                - ``edge_count``: total edges

        Note:
            Scans all edges once (O(m)) to compute accurate connection type stats.
        """
        ...
KnowledgeGraph.connection_types method · python · L1492-L1498 (7 LOC)
kglite/__init__.pyi
    def connection_types(self) -> list[dict[str, Any]]:
        """Return all connection types with counts and endpoint type sets.

        Returns:
            List of dicts with ``type``, ``count``, ``source_types``, ``target_types``.
        """
        ...
KnowledgeGraph.properties method · python · L1500-L1520 (21 LOC)
kglite/__init__.pyi
    def properties(self, node_type: str, max_values: int = 20) -> dict[str, dict[str, Any]]:
        """Return property statistics for a node type.

        Only properties that exist on at least one node are included.

        Args:
            node_type: The node type to inspect.
            max_values: Include ``values`` list when unique count <= this
                threshold. Set to 0 to never include values. Default: 20.

        Returns:
            Dict mapping property name to stats dict with keys:
                - ``type``: type string (e.g. ``'str'``, ``'int'``, ``'float'``)
                - ``non_null``: count of non-null values
                - ``unique``: count of distinct values
                - ``values``: (optional) sorted list of values when unique count <= max_values

        Raises:
            KeyError: If node_type does not exist.
        """
        ...
Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
KnowledgeGraph.neighbors_schema method · python · L1522-L1536 (15 LOC)
kglite/__init__.pyi
    def neighbors_schema(self, node_type: str) -> dict[str, list[dict[str, Any]]]:
        """Return connection topology for a node type.

        Args:
            node_type: The node type to inspect.

        Returns:
            Dict with:
                - ``outgoing``: list of ``{connection_type, target_type, count}``
                - ``incoming``: list of ``{connection_type, source_type, count}``

        Raises:
            KeyError: If node_type does not exist.
        """
        ...
KnowledgeGraph.sample method · python · L1538-L1551 (14 LOC)
kglite/__init__.pyi
    def sample(self, node_type: str, n: int = 5) -> ResultView:
        """Return a quick sample of nodes for a given type.

        Args:
            node_type: The node type to sample.
            n: Number of nodes to return. Default ``5``.

        Returns:
            List of node dicts (same format as :meth:`get_nodes`).

        Raises:
            KeyError: If node_type does not exist.
        """
        ...
KnowledgeGraph.indexes method · python · L1553-L1563 (11 LOC)
kglite/__init__.pyi
    def indexes(self) -> list[dict[str, Any]]:
        """Return a unified list of all indexes.

        Returns:
            List of dicts, each with:
                - ``node_type``: the indexed node type
                - ``property``: property name (for equality indexes)
                - ``properties``: list of property names (for composite indexes)
                - ``type``: ``'equality'`` or ``'composite'``
        """
        ...
KnowledgeGraph.save method · python · L1569-L1577 (9 LOC)
kglite/__init__.pyi
    def save(self, path: str) -> None:
        """Serialise the graph to a binary file.

        Load it back with :func:`kglite.load`.

        Args:
            path: Output file path (typically ``*.kgl``).
        """
        ...
KnowledgeGraph.get_last_report method · python · L1583-L1588 (6 LOC)
kglite/__init__.pyi
    def get_last_report(self) -> dict[str, Any]:
        """Get the most recent operation report as a dict.

        Returns an empty dict if no operations have been performed.
        """
        ...
KnowledgeGraph.union method · python · L1602-L1608 (7 LOC)
kglite/__init__.pyi
    def union(self, other: KnowledgeGraph) -> KnowledgeGraph:
        """Combine selections from both graphs (set union).

        Returns:
            A new KnowledgeGraph with nodes from either selection.
        """
        ...
KnowledgeGraph.intersection method · python · L1610-L1616 (7 LOC)
kglite/__init__.pyi
    def intersection(self, other: KnowledgeGraph) -> KnowledgeGraph:
        """Keep only nodes present in both selections (set intersection).

        Returns:
            A new KnowledgeGraph with only shared nodes.
        """
        ...
KnowledgeGraph.difference method · python · L1618-L1624 (7 LOC)
kglite/__init__.pyi
    def difference(self, other: KnowledgeGraph) -> KnowledgeGraph:
        """Keep nodes in ``self`` but not in ``other`` (set difference).

        Returns:
            A new KnowledgeGraph with the difference.
        """
        ...
Repobility (the analyzer behind this table) · https://repobility.com
KnowledgeGraph.symmetric_difference method · python · L1626-L1632 (7 LOC)
kglite/__init__.pyi
    def symmetric_difference(self, other: KnowledgeGraph) -> KnowledgeGraph:
        """Keep nodes in exactly one of the selections (symmetric difference).

        Returns:
            A new KnowledgeGraph with nodes exclusive to each side.
        """
        ...
KnowledgeGraph.define_schema method · python · L1638-L1648 (11 LOC)
kglite/__init__.pyi
    def define_schema(self, schema_dict: dict[str, Any]) -> KnowledgeGraph:
        """Define the expected schema for the graph.

        Args:
            schema_dict: Schema definition with ``nodes`` and ``connections`` keys.
                See the Rust docstring for full structure.

        Returns:
            Self with schema defined.
        """
        ...
KnowledgeGraph.validate_schema method · python · L1650-L1659 (10 LOC)
kglite/__init__.pyi
    def validate_schema(self, strict: Optional[bool] = None) -> list[dict[str, Any]]:
        """Validate the graph against the defined schema.

        Args:
            strict: Report undefined types in the graph. Default ``False``.

        Returns:
            List of validation error dicts. Empty list means valid.
        """
        ...
‹ prevpage 5 / 20next ›