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)
| 300 | |
| 301 | |
| 302 | def 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 | |
| 319 | def clear(scope: str = None): |