latest.ipv8.util
Module Contents
Functions
|
Convert a value to a future with the value set as the result. |
|
Return a future with the given exception set as its exception. |
|
Ensure the return value of a callable is awaitable. |
|
Ensure that the given callable is awaitable. |
|
Strip the artificial SHA-1 prefix to make it the same byte space as SHA3-256. |
|
Creates an event that gets set when certain signals are received. If signals are omitted, |
|
Helper function for waiting until the user presses Ctrl+C. Commonly used |
Attributes
- latest.ipv8.util.maximum_integer = 2147483647
- latest.ipv8.util.int2byte
- latest.ipv8.util.byte2int
- latest.ipv8.util.T
- latest.ipv8.util.succeed(result: T) asyncio.Future[T]
Convert a value to a future with the value set as the result.
- latest.ipv8.util.fail(exception: type | BaseException) asyncio.Future
Return a future with the given exception set as its exception.
- latest.ipv8.util.maybe_coroutine(func: Callable, *args: Any, **kwargs) Awaitable
Ensure the return value of a callable is awaitable.
- latest.ipv8.util.coroutine(func: Callable) Callable[[tuple[Any, Ellipsis], dict[str, Any]], Coroutine[Any, Any, Awaitable]]
Ensure that the given callable is awaitable.
- latest.ipv8.util.strip_sha1_padding(s: bytes) bytes
Strip the artificial SHA-1 prefix to make it the same byte space as SHA3-256.
- latest.ipv8.util.create_event_with_signals(*args: int) asyncio.Event
Creates an event that gets set when certain signals are received. If signals are omitted, the signals SIGINT and SIGTERM will be used. If you don’t need access to the event itself, the use of run_forever is preferred.
- Parameters:
args ([int]) – signals after which the event should be set
- Return type:
- latest.ipv8.util.run_forever() Coroutine
Helper function for waiting until the user presses Ctrl+C. Commonly used for keeping an application alive until shutdown.
- Return type:
coroutine