gpsea.util module
- gpsea.util.open_text_io_handle_for_reading(file: IOBase | str, encoding: str = 'utf-8') TextIOWrapper [source]
Open a io.TextIO file handle based on file.
- Parameters:
file – a str or
io.IOBase
to read from. If str, then the input is interpreted as a path to a local file. If fh is an IO wrapper, the function ensures we get a text wrapper that uses given encoding.encoding – encoding used to decode the input (utf-8 by default).
- Returns:
the
io.TextIOWrapper
wrapper.
- gpsea.util.open_text_io_handle_for_writing(file: IOBase | str, encoding: str = 'utf-8') TextIOWrapper [source]
Open a io.TextIO file handle based on file.
- Parameters:
file – a str or
io.IOBase
to write to. If str, then the input is interpreted as a path to a local file. If fh is an IO wrapper, the function ensures we get a text wrapper that uses given encoding.encoding – encoding used to encode the output (utf-8 by default).
- Returns:
the
io.TextIOWrapper
wrapper.