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][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"}.

Changed in version 1.8: Parameter fclean was added.

source on GitHub

pyquickhelper.pycode.clean_helper.clean_files(folder='.', posreg='.*[.]((py)|(rst))$', negreg='.*[.]git/.*', op='CR', fLOG=<built-in function print>)[source][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, see below for the available option

  • fLOG – logging function

Returns

list of processed files

The following cleaning are available:

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

  • 'pep8': applies pep8 convention

New in version 1.8.

source on GitHub