gws.core.debug

Debugging and profiling tools.

Source code: gws.core.debug

Module Contents

gws.core.debug.inspect(arg, max_depth=1, all_props=False)

Inspect a value up to the given depth.

Parameters:
  • arg – The value.

  • max_depth – Maximum nesting depth.

  • all_props – If True, list all attributes including callables, and expand dates.

Yields:

Description lines.

gws.core.debug.p(*args, lines=False, stack=False, d=3, all=False)

Log an inspection of the arguments at the debug level.

Parameters:
  • *args – Values to inspect.

  • lines – If True, log the string value of each argument line by line, with line numbers.

  • stack – If True, log the current call stack instead.

  • d – Maximum nesting depth.

  • all – If True, list all attributes including callables.

gws.core.debug.pycharm_debugger_check(path_to_pycharm_debug_egg, host, port, suspend=False)

Connect to a PyCharm debugger if it is listening.

Attempt to open the debugger socket first and return that socket when pydevd asks for it. If there is no socket, then IDEA is not listening, return quickly.

Parameters:
  • path_to_pycharm_debug_egg – Path to the pydevd egg file or to the directory containing it.

  • host – Debugger host.

  • port – Debugger port.

  • suspend – If True, suspend execution after connecting.

Returns:

True if the debugger was connected, False otherwise.

gws.core.debug.time_end()

Stop the most recently started timer and log the elapsed time at the debug level.

gws.core.debug.time_start(label=None)

Start a timer.

Timers are nested; time_end stops the most recently started one.

Parameters:

label – Timer label for the log message.