Return the parameter annotations of the wrapped function. Keys are the Python parameter names.
(self)
| 140 | |
| 141 | @cached_property |
| 142 | def parameters(self): |
| 143 | """Return the parameter annotations of the wrapped function. |
| 144 | |
| 145 | Keys are the Python parameter names. |
| 146 | """ |
| 147 | mapping: dict[PythonName, Parameter] = {} |
| 148 | |
| 149 | for param in self.signature.parameters.values(): |
| 150 | # Skip `self` parameter on instance methods. |
| 151 | # It will be added manually on `get_result`. |
| 152 | if param.name == "self": |
| 153 | continue |
| 154 | |
| 155 | if param.kind is inspect.Parameter.POSITIONAL_ONLY: |
| 156 | msg = "Positional-only parameters are not supported" |
| 157 | raise BadUsageError(msg) |
| 158 | |
| 159 | mapping[param.name] = self._make_parameter(param) |
| 160 | |
| 161 | return mapping |
| 162 | |
| 163 | def _make_parameter(self, param: inspect.Parameter) -> Parameter: |
| 164 | """Create a parameter object from an inspect.Parameter.""" |
no test coverage detected