class
Analyzer::Python::Pyramid
Defined in:
analyzer/analyzers/python/pyramid.crConstant Summary
-
ACCESSOR_MAP =
{"query" => ["params", "GET"], "form" => ["POST"], "json" => ["json_body", "json"], "header" => ["headers"], "cookie" => ["cookies"]} -
ACCESSOR_PATTERNS =
ACCESSOR_MAP.flat_map do |param_type, accessors| accessors.map do |accessor| {param_type, /(?:self\.)?request\.#{accessor}\s*\[\s*[rf]?['"]([^'"]+)['"]\s*\]/, /(?:self\.)?request\.#{accessor}\.get(?:all|one)?\s*\(\s*[rf]?['"]([^'"]+)['"]/} end end -
extract_request_paramsruns once per endpoint and used to rebuild two PCRE2 patterns per accessor on every call (an interpolated regex literal recompiles on every evaluation). The accessor set is fixed, so precompile the access patterns once here; the.to_sexpansion is byte-identical to the previous inline form. Tuple shape: {noir_param_type, bracket_re, get_re}