Decorators

@gd.decorators.benchmark(function: Callable[[], T])Callable[[], T][source]

Benchmark time spent to call function. time_execution_and_print() is used internally.

@gd.decorators.cache_by(*names: str)Callable[[Callable[[], T]], Callable[[], T]][source]

Cache function result by object’s attributes given by names.

@gd.decorators.login_check(function: Callable[[], T])Callable[[], T][source]

Wrap function for AbstractEntity or Client to check if the client is logged in.

gd.decorators.login_check_object(client_or_entity: Union[AbstractEntity, Client])None[source]

Check whether AbstractEntity or Client have logged in client.

@gd.decorators.patch(some_object: Any, name: Optional[str] = None)Callable[[Callable[[], T]], Callable[[], T]][source]

Patch name method or function of some_object with function.

@gd.decorators.run_once(function: Callable[[], T])Callable[[], T][source]

Execute function once, cache the result and return it on other calls.

@gd.decorators.sync(function: Callable[[], Union[Awaitable[T], T]])Callable[[], T][source]

Wrap function to be called synchronously.

@gd.decorators.synchronize[source]

Implement sync_<name> functions for class cls to synchronously call methods.