plaid.utils.base ================ .. py:module:: plaid.utils.base .. autoapi-nested-parse:: Base utilities. Exceptions ---------- .. autoapisummary:: plaid.utils.base.NotAllowedError plaid.utils.base.ShapeError plaid.utils.base.DeprecatedError Functions --------- .. autoapisummary:: plaid.utils.base.generate_random_ASCII plaid.utils.base.safe_len plaid.utils.base.delegate_methods Module Contents --------------- .. py:function:: generate_random_ASCII(size: int = 16) -> str Generate a random ASCII string of the specified size. :param size: The length of the generated string. Defaults to 16. :type size: int, optional :returns: A random ASCII string of the specified size. :rtype: str .. py:function:: safe_len(obj) Safely return the length of an object, or 0 if the object has no length. :param obj: The object whose length is to be computed. :type obj: Any :param Returns: :param -------: :param int: The length of the object if it defines `__len__`, otherwise 0. .. py:function:: delegate_methods(to: str, methods: list[str]) Class decorator to forward specific methods from a delegate attribute. .. py:exception:: NotAllowedError Bases: :py:obj:`Exception` Exception for not allowed usage. Initialize self. See help(type(self)) for accurate signature. .. py:exception:: ShapeError Bases: :py:obj:`Exception` Exception for badly shaped tensors. Initialize self. See help(type(self)) for accurate signature. .. py:exception:: DeprecatedError Bases: :py:obj:`Exception` Exception for deprecated methods. Initialize self. See help(type(self)) for accurate signature.