Pop a scope previously returned by ``push()`` or ``scope()``. Args: handle: Scope handle to close. output: Optional JSON payload exported as the semantic scope output. metadata: Optional JSON metadata to append to the metadata set when the scope was created. time
(
handle: ScopeHandle, *, output: Json | None = None, metadata: Json | None = None, timestamp: datetime | None = None
)
| 148 | |
| 149 | |
| 150 | def pop( |
| 151 | handle: ScopeHandle, *, output: Json | None = None, metadata: Json | None = None, timestamp: datetime | None = None |
| 152 | ) -> None: |
| 153 | """Pop a scope previously returned by ``push()`` or ``scope()``. |
| 154 | |
| 155 | Args: |
| 156 | handle: Scope handle to close. |
| 157 | output: Optional JSON payload exported as the semantic scope output. |
| 158 | metadata: Optional JSON metadata to append to the metadata set when the scope was created. |
| 159 | timestamp: Optional timezone-aware ``datetime`` recorded on the scope |
| 160 | end event. When omitted, the runtime default end timestamp is used. |
| 161 | |
| 162 | Returns: |
| 163 | None: This function returns after the scope is closed successfully. |
| 164 | |
| 165 | Notes: |
| 166 | The handle must correspond to an active scope in the current scope |
| 167 | stack. Popping a scope also removes any scope-local registrations owned |
| 168 | by that scope. ``timestamp`` must be a timezone-aware ``datetime``; |
| 169 | strings and naive datetimes are rejected. |
| 170 | """ |
| 171 | _ensure_scope_stack() |
| 172 | _native_pop_scope(handle, output=output, metadata=metadata, timestamp=timestamp) |
| 173 | |
| 174 | |
| 175 | def event( |
nothing calls this directly
no test coverage detected