agglovar.io

I/O utilities.

Classes

PlainOrGzReader

Read a plain or a gzipped file using context guard.

Module Contents

class agglovar.io.PlainOrGzReader

Read a plain or a gzipped file using context guard.

Parameters:
  • file_path – File path or file name.

  • mode – File open mode.

  • is_gz – If None, determine if file is gzipped based on the file name. Set to True to force reading gzipped, False to force reading plain.

Example:

with PlainOrGzReader('path/to/file.gz'): ...
__enter__()

Enter context.

__exit__(exc_type, exc_value, traceback)

Exit context.

__post_init__()

Post initialization.

file_path: str | pathlib.Path
is_gz: bool | None = None
mode: str = 'rt'