agent0.utils ============ .. py:module:: agent0.utils .. autoapi-nested-parse:: General utility functions .. !! processed by numpydoc !! Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/agent0/utils/async_runner/index /autoapi/agent0/utils/async_runner_test/index /autoapi/agent0/utils/block_number_before_timestamp/index /autoapi/agent0/utils/block_number_before_timestamp_test/index /autoapi/agent0/utils/conversions/index Functions --------- .. autoapisummary:: agent0.utils.async_runner agent0.utils.block_number_before_timestamp Package Contents ---------------- .. py:function:: async_runner(funcs: Sequence[Callable[[], R]], return_exceptions: bool = False) -> list[R] :async: Helper function that runs a list of passed in functions asynchronously. NOTE: use `functools.partial()` to pass in arguments to the functions. WARNING: this assumes all functions passed in are thread safe, use at your own risk. :param funcs: List of functions to run asynchronously. :type funcs: list[Callable[[], R]] :param return_exceptions: If True, return exceptions from the functions. Otherwise, will throw exception if a thread fails. :type return_exceptions: bool :returns: List of results. :rtype: list[R] .. !! processed by numpydoc !! .. py:function:: block_number_before_timestamp(web3: web3.Web3, block_timestamp: web3.types.Timestamp | int) -> eth_typing.BlockNumber Finds the closest block number that is before or at the given block time. :param web3: The web3 instance. :type web3: Web3 :param block_timestamp: The block time to find the closest block to. :type block_timestamp: BlockTime | int :returns: The closest block number to the given block time. :rtype: BlockNumber .. !! processed by numpydoc !!