macrosynergy.management.decorators#
Module housing decorators that are used to validate the arguments and return values of functions.
- deprecate(new_func, deprecate_version, remove_after=None, message=None)[source]#
Decorator for deprecating a function.
Parameters :type new_func:
Callable
:param new_func: The function that replaces the old one. :type deprecate_version:str
:param deprecate_version: The version in which the old function is deprecated. :type remove_after:str
:param remove_after: The version in which the old function is removed. :type message:str
:param message: The message to display when the old function is called.This message must contain the following format strings: “{old_method}”, “{deprecate_version}”, and “{new_method}”. If None, the default message is used.
- Return <callable>:
The decorated function.
- is_matching_subscripted_type(value, type_hint)[source]#
Implementation of insinstance() for type-hints imported from the typing module, and for subscripted types (e.g. List[int], Tuple[str, int], etc.). Parameters :type value:
Any
:param value: The value to check. :type type_hint:Type
[Any
] :param type_hint: The type hint to check against. :return <bool>: True if the value is of the type hint, False otherwise.- Return type:
- get_expected_type(arg_type_hint)[source]#
Based on the type hint, return a list of strings that represent the type hint - including any nested type hints. Parameters :type arg_type_hint:
Type
[Any
] :param arg_type_hint: The type hint to get the expected types for. :return <List[str]>: A list of strings that represent the type hint.