MCPcopy
hub / github.com/long2ice/fastapi-cache / _locate_param

Function _locate_param

fastapi_cache/decorator.py:52–66  ·  view source on GitHub ↗

Locate an existing parameter in the decorated endpoint If not found, returns the injectable parameter, and adds it to the to_inject list.

(
    sig: Signature, dep: Parameter, to_inject: List[Parameter]
)

Source from the content-addressed store, hash-verified

50
51
52def _locate_param(
53 sig: Signature, dep: Parameter, to_inject: List[Parameter]
54) -> Parameter:
55 """Locate an existing parameter in the decorated endpoint
56
57 If not found, returns the injectable parameter, and adds it to the to_inject list.
58
59 """
60 param = next(
61 (p for p in sig.parameters.values() if p.annotation is dep.annotation), None
62 )
63 if param is None:
64 to_inject.append(dep)
65 param = dep
66 return param
67
68
69def _uncacheable(request: Optional[Request]) -> bool:

Callers 1

wrapperFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected