msticpy.common.utility.types module
Utility classes and functions.
- class msticpy.common.utility.types.ImportPlaceholder(name: str, required_pkgs: List[str])
Bases:
object
Placeholder class for optional imports.
Initialize class with imported item name and reqd. packages.
- class msticpy.common.utility.types.ParseableEnum
Bases:
object
Mix-in class for parseable Enum sub-classes.
- class msticpy.common.utility.types.SingletonArgsClass(wrapped_cls)
Bases:
SingletonClass
SingletonArgs decorator class.
Notes
Using this decorator on a class enforces the following behavior:
First instantiation of class will work as normal
Subsequent attempts with the same set/values of kwargs will just return the original class
Instantiation of the class with a different set of kwargs will instantiate a new class.
The class method current() will always return the last instance of the class.
Instantiate the class wrapper.
- current()
Return the current instance of the wrapped class.
- class msticpy.common.utility.types.SingletonClass(wrapped_cls)
Bases:
object
Singleton decorator class.
Notes
Using this decorator on a class enforces the following behavior:
First instantiation of class will work as normal
Subsequent attempts with the same set/values of kwargs will just return the original class
The class method current() will always return the last instance of the class.
Instantiate the class wrapper.
- current()
Return the current instance of the wrapped class.
- msticpy.common.utility.types.arg_to_list(arg: Union[str, List[str]], delims=',; ') List[str]
Convert an optional list/str/str with delims into a list.
- msticpy.common.utility.types.check_kwarg(arg_name: str, legal_args: List[str])
Check argument names against a list.
- msticpy.common.utility.types.check_kwargs(supplied_args: Dict[str, Any], legal_args: List[str])
Check all kwargs names against a list.
- msticpy.common.utility.types.collapse_dicts(*dicts: Dict[Any, Any]) Dict[Any, Any]
Merge multiple dictionaries - later dicts have higher precedence.
- msticpy.common.utility.types.enum_parse(enum_cls: Type[EnumType], value: str) Optional[EnumType]
Try to parse a string value to an Enum member.
- msticpy.common.utility.types.export(obj: Callable)
Decorate function or class to export to __all__.
- msticpy.common.utility.types.singleton(cls)
Class decorator for singleton classes.