# uproot.reading.ReadOnlyKey

Defined in [uproot.reading](https://github.com/scikit-hep/uproot/blob/f1299d71fa4f435b1901386346c8a42adbd72642/src/uproot/reading.py) on [line 2284](https://github.com/scikit-hep/uproot/blob/f1299d71fa4f435b1901386346c8a42adbd72642/src/uproot/reading.py#L2284).

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

* **Parameters:**
  * **chunk** ([uproot.source.chunk.Chunk](uproot.source.chunk.Chunk.html.md)) – Buffer of contiguous data
    from the file [uproot.source.chunk.Source](uproot.source.chunk.Source.html.md).
  * **cursor** ([uproot.Cursor](uproot.source.cursor.Cursor.html.md)) – Current position in
    the [uproot.ReadOnlyFile](uproot.reading.ReadOnlyFile.html.md).
  * **context** (*dict*) – Auxiliary data used in deserialization.
  * **file** ([uproot.ReadOnlyFile](uproot.reading.ReadOnlyFile.html.md)) – 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](https://root.cern.ch/doc/master/classTKey.html)
for a specification of `TKey` header fields.

<a id="uproot-reading-readonlykey-cursor"></a>

## cursor

#### ReadOnlyKey.cursor

A [uproot.Cursor](uproot.source.cursor.Cursor.html.md) pointing to the seek point in the
file where this `TKey` starts (before its header fields).

<a id="uproot-reading-readonlykey-data-cursor"></a>

## data_cursor

#### ReadOnlyKey.data_cursor

A [uproot.Cursor](uproot.source.cursor.Cursor.html.md) 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).

<a id="uproot-reading-readonlykey-file"></a>

## file

#### ReadOnlyKey.file

The [uproot.ReadOnlyFile](uproot.reading.ReadOnlyFile.html.md) in which this `TKey` resides.

<a id="uproot-reading-readonlykey-parent"></a>

## parent

#### ReadOnlyKey.parent

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

<a id="uproot-reading-readonlykey-name"></a>

## name

#### ReadOnlyKey.name(cycle=False)

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

<a id="uproot-reading-readonlykey-title"></a>

## title

#### ReadOnlyKey.title()

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

<a id="uproot-reading-readonlykey-classname"></a>

## 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.

<a id="uproot-reading-readonlykey-object-path"></a>

## 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.

<a id="uproot-reading-readonlykey-cache-key"></a>

## cache_key

#### ReadOnlyKey.cache_key

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

<a id="uproot-reading-readonlykey-is-64bit"></a>

## is_64bit

#### ReadOnlyKey.is_64bit

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

This refers to seek points like
[fSeekKey](#uproot-reading-readonlykey-fseekkey) being 64-bit integers,
rather than 32-bit.

<a id="uproot-reading-readonlykey-is-compressed"></a>

## 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.

<a id="uproot-reading-readonlykey-data-uncompressed-bytes"></a>

## data_uncompressed_bytes

#### ReadOnlyKey.data_uncompressed_bytes

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

This is equal to [fObjlen](#uproot-reading-readonlykey-fobjlen).

<a id="uproot-reading-readonlykey-data-compressed-bytes"></a>

## data_compressed_bytes

#### ReadOnlyKey.data_compressed_bytes

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

This is equal to [fNbytes](#uproot-reading-readonlykey-fnbytes)
minus [fKeylen](#uproot-reading-readonlykey-fkeylen).

<a id="uproot-reading-readonlykey-created-on"></a>

## created_on

#### ReadOnlyKey.created_on

Creation date/time as a Python datetime.

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

<a id="uproot-reading-readonlykey-get"></a>

## 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](uproot.deserialization.DeserializationError.html.md) and any of the
models used in that attempt were predefined (not from
[streamers](uproot.reading.ReadOnlyFile.html.md#uproot-reading-readonlyfile-streamers)), this method will
try again with the file’s own
[streamers](uproot.reading.ReadOnlyFile.html.md#uproot-reading-readonlyfile-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.)

<a id="uproot-reading-readonlykey-get-uncompressed-chunk-cursor"></a>

## get_uncompressed_chunk_cursor

#### ReadOnlyKey.get_uncompressed_chunk_cursor()

Returns an uncompressed [uproot.source.chunk.Chunk](uproot.source.chunk.Chunk.html.md) and
[uproot.Cursor](uproot.source.cursor.Cursor.html.md) for the object pointed to by this
`TKey` as a 2-tuple.

<a id="uproot-reading-readonlykey-fnbytes"></a>

## fNbytes

#### ReadOnlyKey.fNbytes

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

<a id="uproot-reading-readonlykey-fversion"></a>

## fVersion

#### ReadOnlyKey.fVersion

Raw integer version of the `TKey` class.

<a id="uproot-reading-readonlykey-fobjlen"></a>

## fObjlen

#### ReadOnlyKey.fObjlen

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

<a id="uproot-reading-readonlykey-fdatime"></a>

## fDatime

#### ReadOnlyKey.fDatime

Raw integer date/time when the object was written.

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

<a id="uproot-reading-readonlykey-fkeylen"></a>

## fKeylen

#### ReadOnlyKey.fKeylen

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

<a id="uproot-reading-readonlykey-fcycle"></a>

## fCycle

#### ReadOnlyKey.fCycle

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

<a id="uproot-reading-readonlykey-fseekkey"></a>

## fSeekKey

#### ReadOnlyKey.fSeekKey

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

<a id="uproot-reading-readonlykey-fseekpdir"></a>

## fSeekPdir

#### ReadOnlyKey.fSeekPdir

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

<a id="uproot-reading-readonlykey-fclassname"></a>

## fClassName

#### ReadOnlyKey.fClassName

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

<a id="uproot-reading-readonlykey-fname"></a>

## fName

#### ReadOnlyKey.fName

The name of the object or None if the [uproot.reading.ReadOnlyKey](uproot.reading.ReadOnlyKey.html.md)
was constructed with `read_strings=False`.

<a id="uproot-reading-readonlykey-ftitle"></a>

## fTitle

#### ReadOnlyKey.fTitle

The title of the object or None if the [uproot.reading.ReadOnlyKey](uproot.reading.ReadOnlyKey.html.md)
was constructed with `read_strings=False`.

<a id="uproot-reading-readonlykey-hook-before-interpret"></a>

## hook_before_interpret

#### ReadOnlyKey.hook_before_interpret(\*\*kwargs)

Called in the [uproot.reading.ReadOnlyKey](uproot.reading.ReadOnlyKey.html.md) constructor before
interpeting anything.

This is the first hook called in the
[uproot.reading.ReadOnlyKey](uproot.reading.ReadOnlyKey.html.md) constructor.

<a id="uproot-reading-readonlykey-hook-before-strings"></a>

## hook_before_strings

#### ReadOnlyKey.hook_before_strings(\*\*kwargs)

Called in the [uproot.reading.ReadOnlyKey](uproot.reading.ReadOnlyKey.html.md) constructor after
interpeting the header and before interpreting
[fClassName](#uproot-reading-readonlykey-fclassname),
[fName](#uproot-reading-readonlykey-fname), and
[fTitle](#uproot-reading-readonlykey-ftitle).

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

<a id="uproot-reading-readonlykey-hook-after-interpret"></a>

## hook_after_interpret

#### ReadOnlyKey.hook_after_interpret(\*\*kwargs)

Called in the [uproot.reading.ReadOnlyKey](uproot.reading.ReadOnlyKey.html.md) constructor after
interpeting everything.

This is the last hook called in the
[uproot.reading.ReadOnlyKey](uproot.reading.ReadOnlyKey.html.md) constructor.
