Python's :code:`with` handler for defining a default session. This function provides a means of registering a session for handling and code that need a default session calls. The :code:`with` keyword to specify that code invocations within the scope of a block should be executed by
(session)
| 1494 | |
| 1495 | |
| 1496 | def default_session(session): |
| 1497 | """Python's :code:`with` handler for defining a default session. |
| 1498 | |
| 1499 | This function provides a means of registering a session for handling |
| 1500 | and code that need a default session calls. |
| 1501 | |
| 1502 | The :code:`with` keyword to specify that code invocations within |
| 1503 | the scope of a block should be executed by a particular session. |
| 1504 | |
| 1505 | Args: |
| 1506 | session: :class:`Session` |
| 1507 | The session to be installed as the default session. |
| 1508 | |
| 1509 | Returns: |
| 1510 | A context manager for the default session. |
| 1511 | """ |
| 1512 | return _default_session_stack.get_controller(session) |
| 1513 | |
| 1514 | |
| 1515 | def has_default_session() -> bool: |