uproot.containers.AsContainer

Defined in uproot.containers on line 159.

class uproot.containers.AsContainer

Abstract class for all descriptions of data as containers, such as std::vector.

Note that these are not uproot.interpretation.Interpretation objects, since they are recursively nestable and have a read instance method like uproot.Model’s read classmethod.

A nested tree of uproot.containers.AsContainer instances and uproot.Model class objects may be the model argument of a uproot.AsObjects.

cache_key

AsContainer.cache_key

String that uniquely specifies this container, to use as part of an array’s cache key.

typename

AsContainer.typename

String that describes this container as a C++ type.

This type might not exactly correspond to the type in C++, but it would have equivalent meaning.

awkward_form

AsContainer.awkward_form(file, context)
Parameters:
  • file (uproot.reading.CommonFileMethods) – The file associated with this interpretation’s TBranch.

  • context (dict) – Context for the Form-generation; defaults are the remaining arguments below.

  • index_format (str) – Format to use for indexes of the awkward.forms.Form; may be "i32", "u32", or "i64".

  • header (bool) – If True, include header fields of each C++ class.

  • tobject_header (bool) – If True, include header fields of each TObject base class.

  • breadcrumbs (tuple of class objects) – Used to check for recursion. Types that contain themselves cannot be Awkward Arrays because the depth of instances is unknown.

The awkward.forms.Form to use to put objects of type type in an Awkward Array.

strided_interpretation

AsContainer.strided_interpretation(file, header=False, tobject_header=True, breadcrumbs=(), original=None)
Parameters:
  • file (uproot.ReadOnlyFile) – File to use to generate uproot.Model classes from its streamers and file_path for error messages.

  • header (bool) – If True, assume the outermost object has a header.

  • tobject_header (bool) – If True, assume that TObjects have headers.

  • breadcrumbs (tuple of class objects) – Used to check for recursion. Types that contain themselves cannot be strided because the depth of instances is unknown.

  • original (None, uproot.Model, or uproot.containers.Container) – The original, non-strided model or container.

Returns a list of (str, numpy.dtype) pairs to build a uproot.AsStridedObjects interpretation.

read

AsContainer.read(chunk, cursor, context, file, selffile, parent, header=True)
Parameters:

Read one object as part of a recursive descent.