plaid.utils.base¶
Base utilities.
Exceptions¶
Exception for not allowed usage. |
|
Exception for badly shaped tensors. |
|
Exception for deprecated methods. |
Functions¶
|
Generate a random ASCII string of the specified size. |
|
Safely return the length of an object, or 0 if the object has no length. |
|
Class decorator to forward specific methods from a delegate attribute. |
Module Contents¶
- generate_random_ASCII(size: int = 16) str[source]¶
Generate a random ASCII string of the specified size.
- safe_len(obj)[source]¶
Safely return the length of an object, or 0 if the object has no length.
- Parameters:
obj (Any) – The object whose length is to be computed.
Returns
-------
int – The length of the object if it defines __len__, otherwise 0.
- delegate_methods(to: str, methods: list[str])[source]¶
Class decorator to forward specific methods from a delegate attribute.
- exception NotAllowedError[source]¶
Bases:
ExceptionException for not allowed usage.
Initialize self. See help(type(self)) for accurate signature.