replace_with_parameter¶
-
utilipy.utils.inspect.
replace_with_parameter
(sig: inspect.Signature, name: Union[int, str], param: inspect.Parameter) → inspect.Signature[source]¶ Replace a Parameter with another Parameter.
Similar to
replace,
but more convenient for modifying a single parameter Parameters are immutable, so will create a newSignature
object- Parameters
- sig: Signature
Signature object
- name: int or str
parameter to replace
- param: Parameter
new parameter kind, defaults to old parameter kind default: None
- Returns
- Signature
a new Signature object with the replaced parameter