MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / get_scope

Function get_scope

pywebio/output.py:302–316  ·  view source on GitHub ↗

Get the scope name of runtime scope stack :param int stack_idx: The index of the runtime scope stack. Default is -1. 0 means the top level scope(the ``ROOT`` Scope), -1 means the current Scope, -2 means the scope used before entering the current scope, ... :return: Ret

(stack_idx: int = -1)

Source from the content-addressed store, hash-verified

300
301
302def get_scope(stack_idx: int = -1):
303 """Get the scope name of runtime scope stack
304
305 :param int stack_idx: The index of the runtime scope stack. Default is -1.
306
307 0 means the top level scope(the ``ROOT`` Scope),
308 -1 means the current Scope,
309 -2 means the scope used before entering the current scope, ...
310 :return: Returns the scope name with the index, and returns ``None`` when occurs index error
311 """
312 try:
313 return get_current_session().get_scope_name(stack_idx)
314 except IndexError:
315 logger.exception("Scope stack index error")
316 return None
317
318
319def clear(scope: str = None):

Callers 6

targetFunction · 0.85
set_scopeFunction · 0.85
clearFunction · 0.85
removeFunction · 0.85
scroll_toFunction · 0.85
_get_output_specFunction · 0.85

Calls 2

get_current_sessionFunction · 0.85
get_scope_nameMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…