API

Module with some helper functions.

get_extensions(names)

Returns the list of extensions of files to process.

If the given names of extensions are None or empty, the default extensions are used.

Otherwise, the given string is split and returned as a list.

Parameters:
  • names (List[str]) –

    The names of extensions to process (or None if default extensions shall be used)

Returns:
  • List[str]

    The list of extensions to use.

todo

What about removing dots?

get_files(name, recursive, extensions)

Returns the files to process.

If a file name is given, a list with only this file name is returned.

If a folder name is given, the files to process are determined by walking through the folder — recursively if wished — and collecting all files that match the extensions.

The list of collected files is returned.

Parameters:
  • name (str) –

    The name of the file/folder

  • recursive (bool) –

    Whether the folder (if given) shall be processed recursively

  • extensions (List[str]) –

    The extensions of the files to process

Returns:
  • List[str]

    The list of collected files.

parse_to_skip(to_skip)

Sets the elements which contents shall not be changed.

Otherwise, a list with the elements to skip is built.

Parameters:
  • elements_to_skip (List[str]) –

    The names of elements which shall not be changed

Todo

Warn user if a non-XML-character occurs?