module helpers.buffer_files_writing
¶
Short summary¶
module pymmails.helpers.buffer_files_writing
Buffer files writing
Classes¶
class |
truncated documentation |
---|---|
this class aims at delaying writing files, method open returns a buffer, method flush actually writes the file … |
Methods¶
method |
truncated documentation |
---|---|
destructor, check everything was flushed |
|
constructor |
|
return the number of buffered files |
|
tells if a file was already written |
|
flush a file (actually write it) and make it disappear from the list of buffered files, if the folder does not exists, … |
|
returns the list of flushed and opened files, does not preserved order |
|
open a file and returns a buffer |
|
return the content of file (binary format) |
Documentation¶
Buffer files writing
- class pymmails.helpers.buffer_files_writing.BufferFilesWriting(flush_every=20, fLOG=<function noLOG>)¶
Bases:
object
this class aims at delaying writing files, method open returns a buffer, method flush actually writes the file
constructor
- Parameters:
flush_every – flush every 20 created files
- __del__()¶
destructor, check everything was flushed
- __init__(flush_every=20, fLOG=<function noLOG>)¶
constructor
- Parameters:
flush_every – flush every 20 created files
- __len__()¶
return the number of buffered files
- exists(name, local=True)¶
tells if a file was already written
- Parameters:
name – name
local – check local existence too
- Returns:
boolean
- flush(name, upto=False)¶
flush a file (actually write it) and make it disappear from the list of buffered files, if the folder does not exists, the method creates it
- Parameters:
name – file name (or None for all)
upto – flush all files up to this one
- Returns:
number of written bytes
- listfiles()¶
returns the list of flushed and opened files, does not preserved order
- Returns:
list of files
- open(name, text=True, encoding='utf8')¶
open a file and returns a buffer
- Parameters:
name – filename
text – text or binary file
encoding – encoding
- Returns:
a buffer
- read_binary_content(name, local=True)¶
return the content of file (binary format)
- Parameters:
name – name
local – check local existence too and read the content from it
- Returns:
boolean