Expand description
Python enricher for Model.
Runs after model-treesitter extraction, on the same ModelBuilder:
it re-reads each .py file for facts a query cannot express and adds them
with Provenance::Frontend.
HTTP endpoints, from
- Flask:
@app.route("/x", methods=[...]),@bp.get("/x"); - FastAPI:
@router.get("/x"),@app.api_route(...), with theprefix=of theAPIRouter/Blueprintthey are declared on; - Django:
path(),re_path(),url()calls of a file definingurlpatterns(include(...)mounts are not followed: the route prefix of an included module is not composed).
Each endpoint is an entity of kind http.endpoint (shared with the Java and TypeScript enrichers) (archetype
Variable, no FM3 class: the Famix Python metamodel’s class names are not
settled), keyed under its handler (decorators) or its urls.py file
(Django) with a Meta descriptor METHOD path:. Props: http.framework,
http.verb, http.path, http.handler, http.route_name. Django
endpoints also get a Calls relation to their view when one project
function or class carries its name.
Structs§
- Endpoint
- One route, before it meets the model.
- Python
Stats
Enums§
Constants§
- HTTP_
ENDPOINT - Fine kind of an HTTP endpoint.
- IGNORED_
DIRS - Directories never descended into.
Functions§
- declare_
kinds - Defines the kinds this enricher adds (normally defined when first met),
see
model_treesitter::declare_kinds. - endpoints
- Endpoints of one file, in source order.
- enrich
- Reads every
.pyfile underroot(gitignore honoured) accepted bykeep(path relative toroot,/-separated) and adds its endpoints. - enrich_
sources - Adds the endpoints of
files((relative path, source)) tob.