LineIndexedSupplier

Stream and randomly access objects serialized one per line.

deserialization_function receives one raw line (normally bytes) and returns the corresponding object. A line-index is an ndarray of byte offsets. A jump database is an uncompressed tar containing the source lines, that ndarray, metadata, and optional index-aligned arrays.

Subclasses configure the default name of the source member with STORED_FILE_NAME. stored_file_name= on name is recorded in the database metadata and honored when it is loaded.

STORED_FILE_NAME: str
INDEX_FILE_NAME: str
META_FILE_NAME: str

 

__init__(self, data_file, line_indices=None, name=None, size=1000, managed_streams=None, deserialization_function=None, metadata_arrays=None, stored_file_name=None): 

 

@classmethod
from_jump_database(cls, database_file, name=None, deserialization_function=None, metadata_arrays=None, create=False, **extra): 

Open a packaged or expanded jump database.

When create=True, database_file is treated as an expanded database directory. The directory and any missing empty database files are created before opening it. Existing database files are never truncated or replaced.

 

to_mp_state(self): 

 

@classmethod
from_mp_state(cls, state, line_indices=None, **extra): 

 

__enter__(self): 

 

__exit__(self, exc_type, exc_val, exc_tb): 

 

__del__(self): 

 

close(self): 

Release packaged streams and any owned temporary database.

 

@classmethod
load(cls, file, **reader_options): 

 

save(self, file, **writer_options): 

 

@property
files(self): 

 

keys(self): 

 

values(self): 

 

items(self): 

 

to_readout(self, **options): 

 

__getitem__(self, index): 

 

get(self, index, default=None): 

 

unpack(self): 

 

__len__(self): 

 

find_object(self, n, block_size=None, include_metadata=None): 

 

consume_iter(self, start_at=None, upto=None, include_metadata=None): 

 

__next__(self): 

 

__iter__(self): 

 

create_line_index(self, upto=None, return_index=True): 

 

@classmethod
save_line_index(cls, file, line_index): 

 

write_jump_database(self, target, **options): 

 

@classmethod
build_jump_database(cls, supplier_or_data_file, out_file, line_indices=None, name=None, metadata_arrays=None, stored_file_name=None, overwrite=False, extra_metadata=None): 

Feedback

Examples

Templates

Documentation