class documentation

class FileAvoidWrite:

View In Hierarchy

File-like object that buffers output and only writes if content changed.

Use this class like when writing to a file to avoid touching the original file if the content hasn't changed. This is useful in scenarios where file mtime is used to invalidate caches or trigger new behavior.

When writing to this file handle, all writes are buffered until the object is closed.

Objects can be used as context managers.

Method __enter__ Undocumented
Method __exit__ Undocumented
Method __getattr__ Undocumented
Method __init__ Undocumented
Method close Stop accepting writes and write file, if needed.
Method write Undocumented
Instance Variable ​_io Undocumented
Instance Variable ​_path Undocumented
def __enter__(self):

Undocumented

Returns
FileAvoidWriteUndocumented
def __exit__(self, exc_type, exc_value, traceback):

Undocumented

Parameters
exc​_type:Type[Exception]Undocumented
exc​_value:ExceptionUndocumented
traceback:AnyUndocumented
Returns
boolUndocumented
def __getattr__(self, name):

Undocumented

Parameters
name:strUndocumented
Returns
AnyUndocumented
def __init__(self, path):

Undocumented

Parameters
path:strUndocumented
def close(self):
Stop accepting writes and write file, if needed.
def write(self, data):

Undocumented

Parameters
data:strUndocumented
_io =

Undocumented

_path =

Undocumented