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

Function set_scope

pywebio/output.py:278–299  ·  view source on GitHub ↗

Create a new scope. :param str name: scope name :param str container_scope: Specify the parent scope of this scope. When the scope doesn't exist, no operation is performed. :param int position: The location where this scope is created in the parent scope. (see :ref:`Scope

(name: str, container_scope: str = None, position: int = OutputPosition.BOTTOM, if_exist: str = None)

Source from the content-addressed store, hash-verified

276
277
278def set_scope(name: str, container_scope: str = None, position: int = OutputPosition.BOTTOM, if_exist: str = None):
279 """Create a new scope.
280
281 :param str name: scope name
282 :param str container_scope: Specify the parent scope of this scope.
283 When the scope doesn't exist, no operation is performed.
284 :param int position: The location where this scope is created in the parent scope.
285 (see :ref:`Scope related parameters <scope_param>`)
286 :param str if_exist: What to do when the specified scope already exists:
287
288 - `None`: Do nothing
289 - `'remove'`: Remove the old scope first and then create a new one
290 - `'clear'`: Just clear the contents of the old scope, but don&#x27;t create a new scope
291
292 Default is `None`
293 """
294 if container_scope is None:
295 container_scope = get_scope()
296 check_dom_name_value(name, 'scope name')
297 send_msg('output_ctl', dict(set_scope=scope2dom(name, no_css_selector=True),
298 container=scope2dom(container_scope),
299 position=position, if_exist=if_exist))
300
301
302def get_scope(stack_idx: int = -1):

Callers 6

basic_outputFunction · 0.85
background_outputFunction · 0.85
coro_background_outputFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
before_enterFunction · 0.85

Calls 4

get_scopeFunction · 0.85
check_dom_name_valueFunction · 0.85
send_msgFunction · 0.85
scope2domFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…