module filehelper.files_status

Inheritance diagram of pyquickhelper.filehelper.files_status

Short summary

module pyquickhelper.filehelper.files_status

keep the status of a folder, assuming this folder is not moved

source on GitHub

Classes

class

truncated documentation

FilesStatus

This class maintains a list of files and does some verifications in order to check if a file was modified or not …

Methods

method

truncated documentation

__init__

file which will contains the status

__iter__

Iterates on all files stored in the current file, yield a couple (filename, FileInfo).

add_if_modified

Adds a file to self.modifiedList if it was modified.

add_modified_file

Adds a file the modified list of files.

difference

Goes through the list of files and tells which one has changed.

has_been_modified_and_reason

Returns (True, reason) if a file was modified or (False, None) if not.

iter_modified

Iterates on all modified files yield a couple (filename, reason).

save_dates

Saves the status of the copy.

update_copied_file

Updates the file in copyFiles (before saving), update all fields.

Documentation

keep the status of a folder, assuming this folder is not moved

source on GitHub

class pyquickhelper.filehelper.files_status.FilesStatus(file, fLOG=<function noLOG>)[source]

Bases: object

This class maintains a list of files and does some verifications in order to check if a file was modified or not (if yes, then it will be updated to the website).

source on GitHub

file which will contains the status

Parameters:
  • file – file, if None, fill _children

  • fLOG – logging function

source on GitHub

__init__(file, fLOG=<function noLOG>)[source]

file which will contains the status

Parameters:
  • file – file, if None, fill _children

  • fLOG – logging function

source on GitHub

__iter__()[source]

Iterates on all files stored in the current file, yield a couple (filename, FileInfo).

source on GitHub

add_if_modified(file)[source]

Adds a file to self.modifiedList if it was modified.

Parameters:

file – filename

Returns:

True or False

source on GitHub

add_modified_file(file, reason)[source]

Adds a file the modified list of files.

Parameters:
  • file – file to add

  • reason – reason for modification

source on GitHub

difference(files, u4=False, nlog=None)[source]

Goes through the list of files and tells which one has changed.

Parameters:
  • filesFileTreeNode

  • u4FileTreeNode (changes the output)

  • nlog – if not None, print something every nlog processed files

Returns:

iterator on files which changed

source on GitHub

has_been_modified_and_reason(file)[source]

Returns (True, reason) if a file was modified or (False, None) if not.

Parameters:

file – filename

Returns:

(True, reason) or (False, None)

source on GitHub

iter_modified()[source]

Iterates on all modified files yield a couple (filename, reason).

source on GitHub

save_dates(checkfile=None)[source]

Saves the status of the copy.

Parameters:

checkfile – check the status for file checkfile

source on GitHub

update_copied_file(file, delete=False)[source]

Updates the file in copyFiles (before saving), update all fields.

Parameters:
  • file – filename

  • delete – to remove this file

Returns:

file object

source on GitHub