module pycode.clean_helper

Short summary

module pyquickhelper.pycode.clean_helper

Various function to clean files.

source on GitHub

Functions

function

truncated documentation

clean_exts

Cleans files in a folder and subfolders with a given extensions.

clean_files

Cleans \r in files a folder and subfolders with a given extensions. Backslashes are replaces by /. The regular …

Documentation

Various function to clean files.

source on GitHub

pyquickhelper.pycode.clean_helper.clean_exts(folder='.', fLOG=<built-in function print>, exts=None, fclean=None)[source]

Cleans files in a folder and subfolders with a given extensions.

Parameters:
  • folder – folder to clean

  • fLOG – logging function

  • exts – extensions to clean

  • fclean – if not None, fclean(name) -> True to clean

Returns:

list of removed files

If exts is None, it will be replaced by {".pyd", ".so", ".o", ".def", ".obj"}.

source on GitHub

pyquickhelper.pycode.clean_helper.clean_files(folder='.', posreg='.*[.]((py)|(rst))$', negreg='.*[.]git/.*', op='CR', fLOG=<built-in function print>)[source]

Cleans \r in files a folder and subfolders with a given extensions. Backslashes are replaces by /. The regular expressions applies on the relative path starting from folder.

Parameters:
  • folder – folder to clean

  • posreg – regular expression to select files to process

  • negreg – regular expression to skip files to process

  • op – kind of cleaning to do, options are CR, CRB, pep8, see below for more details

  • fLOG – logging function

Returns:

list of processed files

The following cleaning are available:

  • 'CR': replaces '\r\n' by '\n'

  • 'CRB': replaces end of lines '\n' by '\r\n'

  • 'pep8': applies pep8 convention

source on GitHub