imas.backends.imas_core.al_context.LazyALContext¶
-
class imas.backends.imas_core.al_context.LazyALContext(parent_ctx: LazyALContext | None =
None, method: Callable | None =None, args: tuple =(), *, dbentry: ALDBEntryImpl | None =None, nbc_map: NBCPathMap | None =None, time_mode: int | None =None)¶ Bases:
objectReplacement for ALContext that is used during lazy loading.
This class implements
global_action,slice_actionandread_data, such that it can be used as a drop-in replacement inimas.db_entry._get_childrenand only custom logic is needed for IDSStructArray there.This class tracks:
The ALDBEntryImpl object which was used for get() / get_slice().
The context object from that ALDBEntryImpl (such that we can detect if the underlying AL context was closed or replaced).
Potentially a parent LazyALContext for nested contexts (looking at you, arraystruct_action!).
The ALContext method and arguments that we need to call on the ALContext we obtain from our parent, to obtain the actual ALContext we should use for loading data.
The NBC map that
imas.db_entry._get_childrenneeds when lazy loading children of an IDSStructArray.
When constructing a LazyALContext, you need to supply either the
dbentryandnbc_map, or aparent_ctx.-
__init__(parent_ctx: LazyALContext | None =
None, method: Callable | None =None, args: tuple =(), *, dbentry: ALDBEntryImpl | None =None, nbc_map: NBCPathMap | None =None, time_mode: int | None =None)¶
Methods
__init__([parent_ctx, method, args, ...])arraystruct_action(path, timebase, size)Lazily start an arraystruct action.
get_child(child)Retrieve a child entry from the field.
Create and yield the actual ALContext.
global_action(path, rwmode)Lazily start a lowlevel global action, see
ALContext.global_action()slice_action(path, rwmode, time_requested, ...)Lazily start a lowlevel slice action, see
ALContext.slice_action()timerange_action(path, rwmode, tmin, tmax, ...)Lazily start a lowlevel timerange action, see
ALContext.timerange_action().Attributes
ALDBEntryImpl object that created us, or our parent.
The ALContext of the ALDBEntryImpl at the time of get/get_slice.
Optional parent context that provides our parent ALContext.
Method we need to call with our parent ALContext to get our ALContext.
Additional arguments we need to supply to self.method
NBC map for _get_children() when lazy loading IDSStructArray items.
Time mode used by the IDS being lazy loaded.
Potential weak reference to opened context.
- args¶
Additional arguments we need to supply to self.method
- arraystruct_action(path: str, timebase: str, size: int) LazyALArrayStructContext¶
Lazily start an arraystruct action.
- context¶
Potential weak reference to opened context.
- dbentry¶
ALDBEntryImpl object that created us, or our parent.
- dbentry_ctx¶
The ALContext of the ALDBEntryImpl at the time of get/get_slice.
- global_action(path: str, rwmode: int) Iterator[LazyALContext]¶
Lazily start a lowlevel global action, see
ALContext.global_action()
- method¶
Method we need to call with our parent ALContext to get our ALContext.
- nbc_map¶
NBC map for _get_children() when lazy loading IDSStructArray items.
- parent_ctx¶
Optional parent context that provides our parent ALContext.
- slice_action(path: str, rwmode: int, time_requested: float, interpolation_method: int) Iterator[LazyALContext]¶
Lazily start a lowlevel slice action, see
ALContext.slice_action()
- time_mode¶
Time mode used by the IDS being lazy loaded.