OCDocker.Toolbox.IO module¶
Sets of classes and functions that are used to handle I/O operations.
Usage:
import OCDocker.Toolbox.IO as ocio
- OCDocker.Toolbox.IO.lazyread(file_name, decode='utf-8')[source]¶
Read a file in sequential order.
- Parameters:
file_name (str) – The file to be read.
decode (str, optional) – The decode to be used, by default “utf-8”
- Returns:
A generator with the lines of the file in sequential order.
- Return type:
Generator[str, None, None]
- OCDocker.Toolbox.IO.lazyread_mmap(file_name, decode='utf-8')[source]¶
Read a file in sequential order using mmap.
- Parameters:
file_name (str) – The file to be read.
decode (str, optional) – The decode to be used, by default “utf-8”
- Returns:
A generator with the lines of the file in sequential order.
- Return type:
Generator[str, None, None]
- OCDocker.Toolbox.IO.lazyread_reverse_order(file_name, decode='utf-8')[source]¶
Read a file in reverse order.
- Parameters:
file_name (str) – The file to be read.
decode (str, optional) – The decode to be used, by default “utf-8”
- Returns:
A generator with the lines of the file in reverse order.
- Return type:
Generator[str, None, None]
- OCDocker.Toolbox.IO.lazyread_reverse_order_mmap(file_name, decode='utf-8')[source]¶
Read a file in reverse order using mmap.
- Parameters:
file_name (str) – The file to be read.
decode (str, optional) – The decode to be used, by default “utf-8”
- Returns:
A generator with the lines of the file in reverse order.
- Return type:
Generator[str, None, None]