uproot.source.object.ObjectResource — Uproot documentation

# uproot.source.object.ObjectResource

Defined in uproot.source.object on line 18.

Inheritance order:
uproot.source.chunk.Resource

class uproot.source.object.ObjectResource(obj)
  Parameters:

    obj – The file-like object to use.

  A uproot.source.chunk.Resource for a file-like object.

  This object must have the following methods:

  - `read(num_bytes)` where `num_bytes` is an integer number of bytes to read.

  - `seek(position)` where `position` is an integer position to seek to.

  Both of these methods change the internal state of the object, its current seek position (because `read` moves that position forward `num_bytes`). Hence, it is in principle not thread-safe.

## obj

ObjectResource.obj

## closed

ObjectResource.closed

## get

ObjectResource.get(start: int, stop: int)
  Parameters:

    - start (int) – Seek position of the first byte to include.

    - stop (int) – Seek position of the first byte to exclude (one greater than the last byte to include).

  Returns a Python buffer of data between `start` and `stop`.

## future

static ObjectResource.future(source: Source, start: int, stop: int)
  Parameters:

    - source (uproot.ObjectSource) – The data source.

    - start (int) – Seek position of the first byte to include.

    - stop (int) – Seek position of the first byte to exclude (one greater than the last byte to include).

  Returns a uproot.source.futures.ResourceFuture that calls get with `start` and `stop`.

## file_path

Inherited from uproot.source.chunk.Resource.

ObjectResource.file_path

  A path to the file (or URL).