Debugging and Code Utilities¶
-
gd.utils.breakpoint(message: Optional[str] = None, *, prompt: str = '(dbg) ') → None[source]¶ Drop into the debugger at the call site.
-
gd.utils.time_execution(function: Callable[[…], T], *args, **kwargs) → Tuple[T, datetime.timedelta][source]¶ Execute given
functionwithargsandkwargsand measure elapsed time.- Parameters
function (Callable[…,
T]) – Function to call.*args – Arguments to call function with.
**kwargs – Keyword arguments to call function with.
- Returns
Tuple: result of the
functionand time elapsed.- Return type
Tuple[
T,datetime.timedelta]
-
gd.utils.time_execution_and_print(function: Callable[[…], T], *args, **kwargs) → T[source]¶ Execute given
functionwithargsandkwargsand print elapsed time.Prints a message like
Executed function_name in 0:00:00.001000.- Parameters
function (Callable[…,
T]) – Function to call.*args – Arguments to call function with.
**kwargs – Keyword arguments to call function with.
- Returns
Result that the
functionreturns.- Return type
T
-
gd.utils.unreachable() → NoReturn[source]¶ Indicates the code that is unreachable.
- Raises
RuntimeError – Error that is raised when, for some reason, this function is called.