file_read_backwards package¶
Submodules¶
file_read_backwards.buffer_work_space module¶
BufferWorkSpace module.
-
class
file_read_backwards.buffer_work_space.
BufferWorkSpace
(fp, chunk_size)[source]¶ Bases:
object
It is a helper module for FileReadBackwards.
-
add_to_buffer
(content, read_position)[source]¶ Add additional bytes content as read from the read_position.
- Args:
- content (bytes): data to be added to buffer working BufferWorkSpac. read_position (int): where in the file pointer the data was read from.
-
has_returned_every_line
()[source]¶ Return True if every single line in the file has been returned, False otherwise.
-
file_read_backwards.file_read_backwards module¶
FileReadBackwards module.
-
class
file_read_backwards.file_read_backwards.
FileReadBackwards
(path, encoding='utf-8', chunk_size=8192)[source]¶ Bases:
object
Class definition for FileReadBackwards.
A FileReadBackwards will spawn a FileReadBackwardsIterator and keep an opened file handler.
It can be used as a Context Manager. If done so, when exited, it will close its file handler.
In any mode, close() can be called to close the file handler..
-
class
file_read_backwards.file_read_backwards.
FileReadBackwardsIterator
(fp, encoding, chunk_size)[source]¶ Bases:
object
Iterator for FileReadBackwards.
This will read backwards line by line a file. It holds an opened file handler.
-
closed
¶ The status of the file handler.
Returns: True if the file handler is still opened. False otherwise.
-