# uproot.reading.ReadOnlyKey

Defined in uproot.reading on line 2237.

class uproot.reading.ReadOnlyKey(chunk, cursor, context, file, parent, read_strings=False)
  Parameters:

    - chunk (uproot.source.chunk.Chunk) – Buffer of contiguous data from the file uproot.source.chunk.Source.

    - cursor (uproot.Cursor) – Current position in the uproot.ReadOnlyFile.

    - context (dict) – Auxiliary data used in deserialization.

    - file (uproot.ReadOnlyFile) – The open file object.

    - parent (None or calling object) – The previous `read` in the recursive descent.

    - read_strings (bool) – If True, interpret the fClassName, fName, and fTitle attributes; otherwise, ignore them.

  Represents a `TKey` in a ROOT file, which aren’t often accessed by users.

  See the ROOT TKey documentation for a specification of `TKey` header fields.

## cursor

ReadOnlyKey.cursor

  A uproot.Cursor pointing to the seek point in the file where this `TKey` starts (before its header fields).

## data_cursor

ReadOnlyKey.data_cursor

  A uproot.Cursor pointing to the seek point in the file where the data begins (the object to be read, after its copy of the `TKey` and before the object’s number of bytes/version header).

## file

ReadOnlyKey.file

  The uproot.ReadOnlyFile in which this `TKey` resides.

## parent

ReadOnlyKey.parent

  The object that was deserialized before this one in recursive descent, usually the containing object (or the container’s container).

## name

ReadOnlyKey.name(cycle=False)

  The name of the object pointed to by this `TKey`, with semicolon (`;`) and cycle number if `cycle` is True.

## title

ReadOnlyKey.title()

  The title of the object pointed to by this `TKey`.

## classname

ReadOnlyKey.classname(encoded=False, version=None)

  The classname of the object pointed to by this `TKey`.

  If `encoded` is True, the classname is a Python (encoded) classname (optionally with `version` number).

  If `encoded` is False, the classname is a C++ (decoded) classname.

## object_path

ReadOnlyKey.object_path

  Object path of the object pointed to by this `TKey`.

  If an object path is not known (e.g. the object does not reside in a `TDirectory`), this returns a message with the raw seek position.

## cache_key

ReadOnlyKey.cache_key

  String that uniquely specifies this `TKey`, to use as part of object and array cache keys.

## is_64bit

ReadOnlyKey.is_64bit

  True if the `TKey` is 64-bit ready; False otherwise.

  This refers to seek points like fSeekKey being 64-bit integers, rather than 32-bit.

## is_compressed

ReadOnlyKey.is_compressed

  True if the object is compressed; False otherwise.

  Note: compression is determined by comparing `fObjlen` and `fNbytes - fKeylen`; if they are the same, the object is uncompressed.

## data_uncompressed_bytes

ReadOnlyKey.data_uncompressed_bytes

  Number of bytes in the uncompressed object (excluding any keys)

  This is equal to fObjlen.

## data_compressed_bytes

ReadOnlyKey.data_compressed_bytes

  Number of bytes in the compressed object (excluding any keys)

  This is equal to fNbytes minus fKeylen.

## created_on

ReadOnlyKey.created_on

  Creation date/time as a Python datetime.

  uproot.reading.ReadOnlyKey.fDatime presents this in ROOT’s raw integer encoding.

## get

ReadOnlyKey.get()

  Returns the object pointed to by this `TKey`, decompressing it if necessary.

  If the first attempt to deserialize the object fails with uproot.DeserializationError and any of the models used in that attempt were predefined (not from streamers), this method will try again with the file’s own streamers.

  (Some ROOT files do have classes that don’t match the standard `TStreamerInfo`; they may have been produced from private builds of ROOT between official releases.)

## get_uncompressed_chunk_cursor

ReadOnlyKey.get_uncompressed_chunk_cursor()

  Returns an uncompressed uproot.source.chunk.Chunk and uproot.Cursor for the object pointed to by this `TKey` as a 2-tuple.

## fNbytes

ReadOnlyKey.fNbytes

  The total number of bytes in the compressed object and `TKey`.

## fVersion

ReadOnlyKey.fVersion

  Raw integer version of the `TKey` class.

## fObjlen

ReadOnlyKey.fObjlen

  The number of bytes in the uncompressed object, not including its `TKey`.

## fDatime

ReadOnlyKey.fDatime

  Raw integer date/time when the object was written.

  uproot.reading.ReadOnlyKey.created_on presents this as a Python datetime.

## fKeylen

ReadOnlyKey.fKeylen

  The number of bytes in the `TKey`, not including the object.

## fCycle

ReadOnlyKey.fCycle

  The cycle number of the object, which disambiguates different versions of an object with the same name.

## fSeekKey

ReadOnlyKey.fSeekKey

  File seek position (int) pointing to a second copy of this `TKey`, just before the object itself.

## fSeekPdir

ReadOnlyKey.fSeekPdir

  File seek position (int) to the `TDirectory` in which this object resides.

## fClassName

ReadOnlyKey.fClassName

  The C++ (decoded) classname of the object or None if the uproot.reading.ReadOnlyKey was constructed with `read_strings=False`.

## fName

ReadOnlyKey.fName

  The name of the object or None if the uproot.reading.ReadOnlyKey was constructed with `read_strings=False`.

## fTitle

ReadOnlyKey.fTitle

  The title of the object or None if the uproot.reading.ReadOnlyKey was constructed with `read_strings=False`.

## hook_before_interpret

ReadOnlyKey.hook_before_interpret(**kwargs)

  Called in the uproot.reading.ReadOnlyKey constructor before interpeting anything.

  This is the first hook called in the uproot.reading.ReadOnlyKey constructor.

## hook_before_strings

ReadOnlyKey.hook_before_strings(**kwargs)

  Called in the uproot.reading.ReadOnlyKey constructor after interpeting the header and before interpreting fClassName, fName, and fTitle.

  Only called if `read_strings=True` is passed to the constructor.

## hook_after_interpret

ReadOnlyKey.hook_after_interpret(**kwargs)

  Called in the uproot.reading.ReadOnlyKey constructor after interpeting everything.

  This is the last hook called in the uproot.reading.ReadOnlyKey constructor.