polymerist.genutils.decorators.signatures

Tools for simplifying transfer and modification of wrapped function type signatures

Attributes

POSITIONAL_PARAMETER_TYPES

KEYWORD_PARAMETER_TYPES

Functions

get_index_after_positionals(→ int)

Get the first Parameter index which follows all positional Parameters

insert_parameter_at_index(→ inspect.Signature)

Insert a new Parameter into a Signature at a given position

modify_param_annotation_by_index(→ inspect.Signature)

Returns a copy of a Signature with the type annotation of the Parameter at a given index swapped out

modify_param_annotation_by_name(→ inspect.Signature)

Returns a copy of a Signature with the type annotation of the Parameter with a given name swapped out

Module Contents

polymerist.genutils.decorators.signatures.POSITIONAL_PARAMETER_TYPES
polymerist.genutils.decorators.signatures.KEYWORD_PARAMETER_TYPES
polymerist.genutils.decorators.signatures.get_index_after_positionals(sig: inspect.Signature) int[source]

Get the first Parameter index which follows all positional Parameters

polymerist.genutils.decorators.signatures.insert_parameter_at_index(sig: inspect.Signature, new_param: inspect.Parameter, index: int) inspect.Signature[source]

Insert a new Parameter into a Signature at a given position

polymerist.genutils.decorators.signatures.modify_param_annotation_by_index(sig: inspect.Signature, index: int, new_type: type) inspect.Signature[source]

Returns a copy of a Signature with the type annotation of the Parameter at a given index swapped out

polymerist.genutils.decorators.signatures.modify_param_annotation_by_name(sig: inspect.Signature, param_name: str, new_type: type) inspect.Signature[source]

Returns a copy of a Signature with the type annotation of the Parameter with a given name swapped out