module helpers.buffer_files_writing

Inheritance diagram of pymmails.helpers.buffer_files_writing

Short summary

module pymmails.helpers.buffer_files_writing

Buffer files writing

source on GitHub

Classes

class

truncated documentation

BufferFilesWriting

this class aims at delaying writing files, method open returns a buffer, method flush actually writes the file …

Methods

method

truncated documentation

__del__

destructor, check everything was flushed

__init__

constructor

__len__

return the number of buffered files

exists

tells if a file was already written

flush

flush a file (actually write it) and make it disappear from the list of buffered files, if the folder does not exists, …

listfiles

returns the list of flushed and opened files, does not preserved order

open

open a file and returns a buffer

read_binary_content

return the content of file (binary format)

Documentation

Buffer files writing

source on GitHub

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

source on GitHub

constructor

Parameters

flush_every – flush every 20 created files

source on GitHub

__del__()

destructor, check everything was flushed

source on GitHub

__init__(flush_every=20, fLOG=<function noLOG>)

constructor

Parameters

flush_every – flush every 20 created files

source on GitHub

__len__()

return the number of buffered files

source on GitHub

exists(name, local=True)

tells if a file was already written

Parameters
  • name – name

  • local – check local existence too

Returns

boolean

source on GitHub

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

source on GitHub

listfiles()

returns the list of flushed and opened files, does not preserved order

Returns

list of files

source on GitHub

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

source on GitHub

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

source on GitHub