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
functionresult by object’s attributes given bynames.
-
@gd.decorators.login_check(function: Callable[[…], T]) → Callable[[…], T][source]¶ Wrap
functionforAbstractEntityorClientto check if the client is logged in.
-
gd.decorators.login_check_object(client_or_entity: Union[AbstractEntity, Client]) → None[source]¶ Check whether
AbstractEntityorClienthave logged in client.
-
@gd.decorators.patch(some_object: Any, name: Optional[str] = None) → Callable[[Callable[[…], T]], Callable[[…], T]][source]¶ Patch
namemethod or function ofsome_objectwithfunction.
-
@gd.decorators.run_once(function: Callable[[…], T]) → Callable[[…], T][source]¶ Execute
functiononce, cache the result and return it on other calls.