Reader#

class lsst.images.serialization.Reader(archive, tree, info, expected_cls)#

Bases: Generic

A handle to an open lsst.images file.

Returned by open_archive. Lets the caller pull individual components, or the whole object, out of a file that is opened once; the underlying archive caches dereferenced pointers so repeated reads share work. Valid only inside the with block that produced it.

Parameters:
  • archive (InputArchive[Any]) – Input archive backing the open file.

  • tree (ArchiveTree) – Validated on-disk deserialization tree for the file.

  • info (ArchiveInfo) – Schema name, version, URL, and format version for the file.

  • expected_cls (type[TypeVar(T)] | None) – Expected type of the deserialized object, or None to accept any type.

Attributes Summary

butler_info

Butler dataset info stored with the object, or None.

info

Schema name/version/url and format version for this file.

metadata

Flexible metadata stored with the object.

Methods Summary

get_component(name, **kwargs)

Deserialize and return a single named component.

get_tree()

Return the validated on-disk tree for advanced, low-level access.

read(**kwargs)

Deserialize and return the whole object.

Attributes Documentation

butler_info#

Butler dataset info stored with the object, or None.

info#

Schema name/version/url and format version for this file.

metadata#

Flexible metadata stored with the object.

Methods Documentation

get_component(name, **kwargs)#

Deserialize and return a single named component.

Raises InvalidComponentError for an unknown component name.

Parameters:
  • name (str) – Name of the component to deserialize.

  • **kwargs (Any) – Additional keyword arguments forwarded to the component deserializer.

Return type:

Any

get_tree()#

Return the validated on-disk tree for advanced, low-level access.

Most callers want read or get_component instead; the tree is the raw deserialization model that those methods build on.

Return type:

ArchiveTree

read(**kwargs)#

Deserialize and return the whole object.

Parameters:

**kwargs (Any) – Additional keyword arguments forwarded to the deserializer.

Return type:

TypeVar(T)

This page was last modified on .