Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

16.4 KB
Raw Blame
{
  "targets": {
    "django/db/models/query.py": {
      "type": "file",
      "path": "django/db/models/query.py",
      "parent_page": {
        "title": "Models Overview",
        "target_path": "django/db/models",
        "section": "10.2"
      },
      "docs": {
        "title": "File: django/db/models/query.py",
        "summary": "The main QuerySet implementation. This provides the public API for the ORM.",
        "symbols": [
          {
            "name": "MAX_GET_RESULTS",
            "kind": "constant",
            "signature": "MAX_GET_RESULTS = 21",
            "line": 49,
            "symbol_id": "django/db/models/query.py::MAX_GET_RESULTS"
          },
          {
            "name": "REPR_OUTPUT_SIZE",
            "kind": "constant",
            "signature": "REPR_OUTPUT_SIZE = 20",
            "line": 52,
            "symbol_id": "django/db/models/query.py::REPR_OUTPUT_SIZE"
          },
          {
            "name": "DEFAULT_FETCH_MODE",
            "kind": "constant",
            "signature": "DEFAULT_FETCH_MODE = FETCH_ONE",
            "line": 54,
            "symbol_id": "django/db/models/query.py::DEFAULT_FETCH_MODE"
          },
          {
            "name": "BaseIterable",
            "kind": "class",
            "signature": "class BaseIterable",
            "line": 57,
            "symbol_id": "django/db/models/query.py::BaseIterable"
          },
          {
            "name": "__init__",
            "kind": "method",
            "signature": "def __init__( self, queryset, chunked_fetch=False, chunk_size=GET_ITERATOR_CHUNK_SIZE )",
            "line": 58,
            "symbol_id": "django/db/models/query.py::BaseIterable::__init__"
          },
          {
            "name": "_async_generator",
            "kind": "method",
            "signature": "async def _async_generator(self)",
            "line": 65,
            "symbol_id": "django/db/models/query.py::BaseIterable::_async_generator"
          },
          {
            "name": "__aiter__",
            "kind": "method",
            "signature": "def __aiter__(self)",
            "line": 89,
            "symbol_id": "django/db/models/query.py::BaseIterable::__aiter__"
          },
          {
            "name": "ModelIterable",
            "kind": "class",
            "signature": "class ModelIterable",
            "line": 93,
            "symbol_id": "django/db/models/query.py::ModelIterable"
          },
          {
            "name": "__iter__",
            "kind": "method",
            "signature": "def __iter__(self)",
            "line": 96,
            "symbol_id": "django/db/models/query.py::ModelIterable::__iter__"
          },
          {
            "name": "RawModelIterable",
            "kind": "class",
            "signature": "class RawModelIterable",
            "line": 171,
            "symbol_id": "django/db/models/query.py::RawModelIterable"
          },
          {
            "name": "__iter__",
            "kind": "method",
            "signature": "def __iter__(self)",
            "line": 176,
            "symbol_id": "django/db/models/query.py::RawModelIterable::__iter__"
          },
          {
            "name": "ValuesIterable",
            "kind": "class",
            "signature": "class ValuesIterable",
            "line": 227,
            "symbol_id": "django/db/models/query.py::ValuesIterable"
          },
          {
            "name": "__iter__",
            "kind": "method",
            "signature": "def __iter__(self)",
            "line": 232,
            "symbol_id": "django/db/models/query.py::ValuesIterable::__iter__"
          },
          {
            "name": "ValuesListIterable",
            "kind": "class",
            "signature": "class ValuesListIterable",
            "line": 253,
            "symbol_id": "django/db/models/query.py::ValuesListIterable"
          },
          {
            "name": "__iter__",
            "kind": "method",
            "signature": "def __iter__(self)",
            "line": 259,
            "symbol_id": "django/db/models/query.py::ValuesListIterable::__iter__"
          },
          {
            "name": "NamedValuesListIterable",
            "kind": "class",
            "signature": "class NamedValuesListIterable",
            "line": 270,
            "symbol_id": "django/db/models/query.py::NamedValuesListIterable"
          },
          {
            "name": "__iter__",
            "kind": "method",
            "signature": "def __iter__(self)",
            "line": 276,
            "symbol_id": "django/db/models/query.py::NamedValuesListIterable::__iter__"
          },
          {
            "name": "FlatValuesListIterable",
            "kind": "class",
            "signature": "class FlatValuesListIterable",
            "line": 293,
            "symbol_id": "django/db/models/query.py::FlatValuesListIterable"
          },
          {
            "name": "__iter__",
            "kind": "method",
            "signature": "def __iter__(self)",
            "line": 299,
            "symbol_id": "django/db/models/query.py::FlatValuesListIterable::__iter__"
          },
          {
            "name": "PreventQuerySetCloning",
            "kind": "class",
            "signature": "class PreventQuerySetCloning",
            "line": 308,
            "symbol_id": "django/db/models/query.py::PreventQuerySetCloning"
          },
          {
            "name": "__init__",
            "kind": "method",
            "signature": "def __init__(self, queryset)",
            "line": 320,
            "symbol_id": "django/db/models/query.py::PreventQuerySetCloning::__init__"
          },
          {
            "name": "__enter__",
            "kind": "method",
            "signature": "def __enter__(self)",
            "line": 323,
            "symbol_id": "django/db/models/query.py::PreventQuerySetCloning::__enter__"
          },
          {
            "name": "__exit__",
            "kind": "method",
            "signature": "def __exit__(self, exc_type, exc_value, traceback)",
            "line": 326,
            "symbol_id": "django/db/models/query.py::PreventQuerySetCloning::__exit__"
          },
          {
            "name": "QuerySet",
            "kind": "class",
            "signature": "class QuerySet",
            "line": 330,
            "symbol_id": "django/db/models/query.py::QuerySet"
          },
          {
            "name": "__init__",
            "kind": "method",
            "signature": "def __init__(self, model=None, query=None, using=None, hints=None)",
            "line": 333,
            "symbol_id": "django/db/models/query.py::QuerySet::__init__"
          },
          {
            "name": "query",
            "kind": "method",
            "signature": "def query(self, value)",
            "line": 360,
            "symbol_id": "django/db/models/query.py::QuerySet::query"
          },
          {
            "name": "as_manager",
            "kind": "method",
            "signature": "def as_manager(cls)",
            "line": 365,
            "symbol_id": "django/db/models/query.py::QuerySet::as_manager"
          },
          {
            "name": "__deepcopy__",
            "kind": "method",
            "signature": "def __deepcopy__(self, memo)",
            "line": 380,
            "symbol_id": "django/db/models/query.py::QuerySet::__deepcopy__"
          },
          {
            "name": "__getstate__",
            "kind": "method",
            "signature": "def __getstate__(self)",
            "line": 390,
            "symbol_id": "django/db/models/query.py::QuerySet::__getstate__"
          },
          {
            "name": "__setstate__",
            "kind": "method",
            "signature": "def __setstate__(self, state)",
            "line": 395,
            "symbol_id": "django/db/models/query.py::QuerySet::__setstate__"
          },
          {
            "name": "__repr__",
            "kind": "method",
            "signature": "def __repr__(self)",
            "line": 414,
            "symbol_id": "django/db/models/query.py::QuerySet::__repr__"
          },
          {
            "name": "__len__",
            "kind": "method",
            "signature": "def __len__(self)",
            "line": 420,
            "symbol_id": "django/db/models/query.py::QuerySet::__len__"
          },
          {
            "name": "__iter__",
            "kind": "method",
            "signature": "def __iter__(self)",
            "line": 424,
            "symbol_id": "django/db/models/query.py::QuerySet::__iter__"
          },
          {
            "name": "__aiter__",
            "kind": "method",
            "signature": "def __aiter__(self)",
            "line": 442,
            "symbol_id": "django/db/models/query.py::QuerySet::__aiter__"
          },
          {
            "name": "__bool__",
            "kind": "method",
            "signature": "def __bool__(self)",
            "line": 452,
            "symbol_id": "django/db/models/query.py::QuerySet::__bool__"
          },
          {
            "name": "__getitem__",
            "kind": "method",
            "signature": "def __getitem__(self, k)",
            "line": 456,
            "symbol_id": "django/db/models/query.py::QuerySet::__getitem__"
          },
          {
            "name": "__class_getitem__",
            "kind": "method",
            "signature": "def __class_getitem__(cls, *args, **kwargs)",
            "line": 493,
            "symbol_id": "django/db/models/query.py::QuerySet::__class_getitem__"
          },
          {
            "name": "__and__",
            "kind": "method",
            "signature": "def __and__(self, other)",
            "line": 496,
            "symbol_id": "django/db/models/query.py::QuerySet::__and__"
          },
          {
            "name": "__or__",
            "kind": "method",
            "signature": "def __or__(self, other)",
            "line": 508,
            "symbol_id": "django/db/models/query.py::QuerySet::__or__"
          },
          {
            "name": "__xor__",
            "kind": "method",
            "signature": "def __xor__(self, other)",
            "line": 527,
            "symbol_id": "django/db/models/query.py::QuerySet::__xor__"
          }
        ],
        "symbols_truncated": {
          "shown": 40,
          "total": 180,
          "hint": "Call with compact=False or include=['full_doc'] for the full list."
        }
      },
      "hotspot": true,
      "ownership": {
        "primary_owner": "Author One",
        "owner_pct": 0.066,
        "owner_line_pct": null,
        "contributor_count": 172,
        "bus_factor": 72,
        "recent_owner": "author_two",
        "recent_owner_pct": 0.2857
      },
      "last_change": {
        "date": "2026-06-25T20:47:00",
        "author": "Author One",
        "days_ago": 6030
      },
      "decisions": [],
      "freshness": {
        "confidence_score": 1.0,
        "freshness_status": "fresh",
        "is_stale": false
      },
      "architectural_layer": {
        "name": "Data",
        "description": "",
        "role": "edge_connector"
      },
      "callers": [
        {
          "file": "tests/aggregation/tests.py",
          "inbound_calls": 131
        },
        {
          "file": "tests/queries/tests.py",
          "inbound_calls": 88
        },
        {
          "file": "tests/aggregation_regress/tests.py",
          "inbound_calls": 87
        },
        {
          "file": "tests/prefetch_related/tests.py",
          "imports": true,
          "inbound_calls": 83
        },
        {
          "file": "tests/annotations/tests.py",
          "inbound_calls": 64
        },
        {
          "file": "tests/expressions_case/tests.py",
          "inbound_calls": 63
        },
        {
          "file": "tests/expressions_window/tests.py",
          "inbound_calls": 51
        },
        {
          "file": "tests/queries/test_qs_combinators.py",
          "inbound_calls": 45
        },
        {
          "file": "tests/lookup/tests.py",
          "inbound_calls": 41
        },
        {
          "file": "tests/db_functions/datetime/test_extract_trunc.py",
          "inbound_calls": 37
        },
        {
          "file": "tests/filtered_relation/tests.py",
          "inbound_calls": 37
        },
        {
          "file": "tests/defer/tests.py",
          "inbound_calls": 25
        },
        {
          "file": "tests/prefetch_related/test_prefetch_related_objects.py",
          "inbound_calls": 24
        },
        {
          "file": "tests/expressions/tests.py",
          "inbound_calls": 20
        },
        {
          "file": "tests/composite_pk/test_filter.py",
          "inbound_calls": 18
        },
        {
          "file": "tests/defer_regress/tests.py",
          "inbound_calls": 18
        },
        {
          "file": "tests/select_for_update/tests.py",
          "inbound_calls": 18
        },
        {
          "file": "tests/basic/tests.py",
          "imports": true,
          "inbound_calls": 17
        },
        {
          "file": "tests/postgres_tests/test_aggregates.py",
          "inbound_calls": 17
        },
        {
          "file": "tests/foreign_object/test_tuple_lookups.py",
          "inbound_calls": 15
        }
      ],
      "callers_total": 131,
      "callers_emitted": 20,
      "callers_truncated": true,
      "callers_reduced_reason": "construction_cap",
      "callers_omitted": 111,
      "_call_graph_note": "File-level rollup: importing files plus inbound cross-file call counts. For symbol-precise callers pass 'file.py::Symbol'.",
      "health": {
        "score": 2.0,
        "max_ccn": 26,
        "max_nesting": 7,
        "nloc": 2471,
        "has_test_file": true,
        "module": "django",
        "duplication_pct": 2.56,
        "top_biomarkers": [
          {
            "biomarker_type": "change_entropy",
            "severity": "critical",
            "impact": 1.27,
            "suggestion": "Calm this file's change history. Its modifications arrive in wide, scattered commits — a strong history-based fault predictor. Land future edits in focused, single-purpose commits, and consider splitting the file so unrelated changes stop landing together."
          },
          {
            "biomarker_type": "ownership_risk",
            "severity": "critical",
            "impact": 1.17,
            "suggestion": "Assign a clear owner and reduce drive-by contributors on this file. Fragmented ownership — many authors each touching a small slice — is one of the strongest defect predictors; nominate a DRI for reviews, or split the file along its natural seams so each part has a coherent owner."
          }
        ],
        "signals": {
          "prior_defect_count": 0,
          "change_entropy_pct": 99.7,
          "lines_added_90d": 54,
          "lines_deleted_90d": 15,
          "commit_count_90d": 7,
          "age_days": 6030,
          "primary_owner_name": "Author One",
          "primary_owner_commit_pct": 0.066,
          "recent_owner_name": "author_two",
          "recent_owner_commit_pct": 0.2857,
          "in_degree": 12,
          "out_degree": 28,
          "bug_magnet": false
        }
      }
    }
  },
  "_meta": {
    "contract_version": 2,
    "timing_ms": 131.3,
    "index_age_days": 0,
    "indexed_commit": "e78991410b78",
    "live_head": "e78991410b78",
    "index_behind": false,
    "index_scope": {
      "version": 1,
      "projection": "compact",
      "run_mode": "standard",
      "content_provenance": "template",
      "git_tier": "full",
      "status": "upgrading",
      "fingerprint": "99c42a358f89",
      "full": "get_overview()",
      "degraded_analyses": [
        "Graph build can take several minutes on a first run. Safe to Ctrl-C — re-run 'repowise init --resume' to continue where it stopped."
      ]
    },
    "embedder": "mock",
    "embedder_degraded": false,
    "semantic_search": false,
    "scope_hint": "Unrelated to what was served: Application (472 files), Config (205), Service (80).",
    "omitted": {
      "refs": [
        "repowise#5da23d779663"
      ],
      "tokens": 2181,
      "restore": "`repowise expand <ref>`, or get_symbol(\"repowise#<ref>\", query=...)"
    },
    "state": {
      "truncated": true
    },
    "response_budget": {
      "limit_chars": 32000,
      "tier": "expanded",
      "serialized_chars": 10995
    },
    "completeness": {
      "capped": true,
      "shown": 20,
      "total": 131,
      "reason": "construction_cap"
    },
    "floor": [
      "callers_total"
    ]
  },
  "omission_marker": "[repowise#5da23d779663: 459 lines omitted (~2181 tokens); restore: repowise expand 5da23d779663]"
}