Analyzer::Python::Litestar
Inherits Analyzer::Python::PythonEngine < Analyzer < FileHelper < Reference < Object
Constants
Path literal inside a decorator. Litestar accepts both a positional
path and an explicit path= keyword argument. List forms
(@get(["/a", "/b"]), @get(path=["/a", "/b"])) and omitted paths
(@get(), @get(sync_to_thread=False) → default "" / /) are
handled by extract_decorator_paths.
Decorator matching: @get("/path"), @post("/path"), etc. The tail
after the path literal is captured so extra kwargs (like methods=)
can be inspected for multi-method @route decorators.
websocket(?:_listener|_stream)? also matches Litestar's
@websocket_listener("/ws") and @websocket_stream("/ws")
decorators (the listener/stream class-based WS handlers), which
take a positional path just like @websocket — without the
variants every listener/stream endpoint was silently dropped.
Hoisted out of the per-line/per-param loops: an interpolated regex
literal recompiles (PCRE2 JIT) on every evaluation, and these
interpolate only constants or fixed sets. The .to_s expansion is
byte-identical to the previous inline form, so matching behaviour
is unchanged.
One verb in an http_method=[...] list: "POST" or HttpMethod.POST.
Bases a body model's own fields are complete under; any other base may contribute fields this pass does not follow.
The same, as the whole default: x: str = Parameter(header="X").
Anchored, so a long default is not searched end to end.
Parameter(header="X-Token") / cookie= / query=: the location
and wire name, in a default or an Annotated[...] hint.
Path param: {name} or {name:type}. Litestar uses the :type suffix as a converter (int, str, uuid, path, float); strip it when exposing the param.
classify_param runs once per typed handler parameter and rebuilt
one PCRE2 pattern per primitive type on every call.
Names a dependencies mapping provides ("users_service": Provide(...), or a service helper's key="users_service" inside the
dependencies = ... statement): a handler parameter so named is
injected, not read from the request. Keys count for handlers in the
declaring file, or everywhere when that file builds the Litestar(...)
app (app-level dependencies).
ponytail: file scope, not Litestar's handler/controller/router scope;
a same-named query param in another controller of that file is
dropped too.
collect_request_attr_params runs twice per handler-body line per
attribute; the attribute set is fixed, so precompile the patterns.
Router(path="/prefix", route_handlers=[...])
Class methods
Instance methods
Instance-side view of the same declaration. The per-file rescues live on
this base class, which has no way to name the analyzer that is running
inside them, so a skipped file could not be attributed to a tech.
Deriving it from analyzer_for keeps the name written exactly once.