nlpstack.common.filebackend module#

class nlpstack.common.filebackend.FileBackendMapping(path=None, pagesize=None)[source]#

Bases: Mapping[K, V]

Parameters:
  • path (str | PathLike | None) –

  • pagesize (int | None) –

close()[source]#
Return type:

None

flush()[source]#
Return type:

None

lock()[source]#
Return type:

Iterator[None]

property path: Path#
class nlpstack.common.filebackend.FileBackendSequence(path=None, pagesize=None)[source]#

Bases: Sequence[T]

Parameters:
  • path (str | PathLike | None) –

  • pagesize (int | None) –

append(obj)[source]#
Return type:

None

Parameters:

obj (T) –

close()[source]#
Return type:

None

flush()[source]#
Return type:

None

classmethod from_iterable(iterable, path=None, pagesize=1073741824)[source]#
Return type:

FileBackendSequence[TypeVar(T)]

Parameters:
  • iterable (Iterable[T]) –

  • path (str | PathLike | None) –

  • pagesize (int) –

lock()[source]#
Return type:

Iterator[None]

property path: Path#
class nlpstack.common.filebackend.Index(page, offset, length)[source]#

Bases: object

Parameters:
  • page (int) –

  • offset (int) –

  • length (int) –

classmethod from_binaryio(f)[source]#
Return type:

Index

Parameters:

f (BinaryIO) –

length: int#
offset: int#
page: int#
to_bytes()[source]#
Return type:

bytes

class nlpstack.common.filebackend.Key(value)[source]#

Bases: Generic[K]

Parameters:

value (K) –

classmethod from_binaryio(f)[source]#
Return type:

Key

Parameters:

f (BinaryIO) –

to_bytes()[source]#
Return type:

bytes

value: TypeVar(K, bound= Hashable)#
class nlpstack.common.filebackend.Metadata[source]#

Bases: TypedDict

pagesize: int#