Analyzer::Python::Aiohttp
Inherits Analyzer::Python::PythonEngine < Analyzer < FileHelper < Reference < Object
Constants
Spaces are stripped before the add_<method> match, so the route
path is re-extracted from the original (spaced) line. Precompile one
matcher per method name so the re-extraction isn't a per-route PCRE2
compile. Keyed by the same names captured by ADD_METHOD_RE.
Prefix-collection matchers. collect_app_prefixes /
collect_route_list_ranges scan every line of every file, so these
were per-line PCRE2 recompiles before hoisting.
Frameworks whose registration syntax overlaps aiohttp's enough to trip
the loose markers below — sanic's @app.get("/x") and its
app.add_route(handler, "/x") in particular. A file that imports one of
them and never mentions aiohttp is theirs. Mirrors the same guard in the
Flask analyzer.
The route-discovery patterns below interpolate only the
PYTHON_VAR_NAME_REGEX/DOT_NATION constants and this fixed method
alternation, so the inline literals were recompiling identical
PCRE2 patterns on every source line of every file (and rebuilding
methods_re with a join each line). Compile once here; the
.to_s expansion of the interpolated constants is byte-identical
to the previous inline form, so matching behaviour is unchanged.
Method-first web.route("METHOD", "/path", handler) — the only way to
reach a route whose verb has no dedicated web.<method>() shorthand
(e.g. QUERY, RFC 10008). Same free-form method capture as
ROUTE_DECO_RE/ADD_ROUTE_RE, so any verb works, not just QUERY.
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.