# uproot.WritableFile

Defined in uproot.writing.writable on line 197.

Inheritance order:
uproot.reading.CommonFileMethods

class uproot.writing.writable.WritableFile(sink, cascading, initial_directory_bytes, uuid_function)
  Parameters:

    - sink (uproot.sink.file.FileSink) – The physical layer for file-writing.

    - cascading (uproot.writing._cascade.CascadingFile) – The low-level file object.

    - initial_directory_bytes (int) – Number of bytes to allocate for new directories, so that TKeys can be added to them without immediately needing to rewrite the block.

    - uuid_function (zero-argument callable returning a `uuid.UUID`) – Function to create the file’s UUID and/or any directory’s UUID.

  Handle to a writable ROOT file, usually created by uproot.create, uproot.recreate, or uproot.update and accessed through a uproot.WritableDirectory.

## sink

WritableFile.sink

  Returns a uproot.sink.file.FileSink, the physical layer for writing (and sometimes reading) data.

## initial_directory_bytes

WritableFile.initial_directory_bytes

  Number of bytes to allocate for new directories, so that TKeys can be added to them without immediately needing to rewrite the block.

## uuid_function

WritableFile.uuid_function

  The function used to create the file’s UUID and/or any directory’s UUID.

## root_directory

WritableFile.root_directory

  The root (first) directory in the file as a uproot.WritableDirectory.

## update_streamers

WritableFile.update_streamers(streamers)

  Overwrite the TStreamerInfo in this file with a new list of uproot.streamers.Model_TStreamerInfo or uproot.writable._cascade.RawStreamerInfo.

## close

WritableFile.close()

  Explicitly close the file.

  (Files can also be closed with the Python `with` statement, as context managers.)

  After closing, objects cannot be read from or written to the file.

## closed

WritableFile.closed

  True if the file has been closed; False otherwise.

  The file may have been closed explicitly with close or implicitly in the Python `with` statement, as a context manager.

  After closing, objects cannot be read from or written to the file.

## file_path

Inherited from uproot.reading.CommonFileMethods.

WritableFile.file_path

  Filesystem path of the open file, or None if using a file-like object.

## options

Inherited from uproot.reading.CommonFileMethods.

WritableFile.options

  The options passed to uproot.create, uproot.recreate, or uproot.update when opening this file.

## root_version

Inherited from uproot.reading.CommonFileMethods.

WritableFile.root_version

  Version of ROOT used to write the file as a string.

  See root_version_tuple and fVersion.

## root_version_tuple

Inherited from uproot.reading.CommonFileMethods.

WritableFile.root_version_tuple

  Version of ROOT used to write teh file as a tuple.

  See root_version and fVersion.

## is_64bit

Inherited from uproot.reading.CommonFileMethods.

WritableFile.is_64bit

  True if the file has 8-byte pointers in its header; False if the pointers are 4-byte.

## compression

Inherited from uproot.reading.CommonFileMethods.

WritableFile.compression

  Compression algorithm and level (uproot.compression.Compression or None) for new objects added to the file.

  This property can be changed, which allows you to write different objects with different compression settings.

  See also fCompress.

## hex_uuid

Inherited from uproot.reading.CommonFileMethods.

WritableFile.hex_uuid

  The unique identifier (UUID) of the ROOT file expressed as a hexadecimal string.

  See uuid and fUUID.

## uuid

Inherited from uproot.reading.CommonFileMethods.

WritableFile.uuid

  The unique identifier (UUID) of the ROOT file expressed as a Python `uuid.UUID` object.

## fVersion

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fVersion

  Raw version information for the ROOT file; this number is used to derive root_version, root_version_tuple, and is_64bit.

## fBEGIN

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fBEGIN

  The seek point (int) for the first data record, past the TFile header.

  Usually 100.

## fEND

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fEND

  The seek point (int) to the last free word at the end of the ROOT file.

## fSeekFree

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fSeekFree

  The seek point (int) to the `TFree` data, for managing empty spaces in a ROOT file (filesystem-like fragmentation).

## fNbytesFree

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fNbytesFree

  The number of bytes in the `TFree` data, for managing empty spaces in a ROOT file (filesystem-like fragmentation).

## nfree

Inherited from uproot.reading.CommonFileMethods.

WritableFile.nfree

  The number of objects in the `TFree` data, for managing empty spaces in a ROOT file (filesystem-like fragmentation).

## fNbytesName

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fNbytesName

  The number of bytes in the filename (`TNamed`) that is embedded in the ROOT file.

## fUnits

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fUnits

  Number of bytes in the serialization of file seek points, which can either be 4 or 8.

## fCompress

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fCompress

  Compression algorithm and level (as an integer code) for new objects added to the file.

  This property can be changed, which allows you to write different objects with different compression settings.

  See also compression.

## fSeekInfo

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fSeekInfo

  The seek point (int) to the `TStreamerInfo` data, where TStreamerInfo records are located.

## fNbytesInfo

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fNbytesInfo

  The number of bytes in the `TStreamerInfo` data, where TStreamerInfo records are located.

## fUUID

Inherited from uproot.reading.CommonFileMethods.

WritableFile.fUUID

  The unique identifier (UUID) of the ROOT file as a raw bytestring (Python `bytes`).

  See hex_uuid and uuid.