Threaded, Directory Walking Example¶
- Synopsis
Multithreaded example with signal handling that also demonstrates error handling.
- Platform
Unix, Windows, python >=v3.5.3
- Dependencies
editfrontmatter>=0.0.1 Jinja2>=2.10.1 MarkupSafe>=1.1.1 oyaml>=0.9 PyYAML>=5.1
- License
- Author
- homepage
- Current Release
version: 0.0.1
New in version 0.0.1: Initial Version
-
print_lock
= <unlocked _thread.lock object>¶ Tread lock used for printing
-
STOP_ALL
= False¶ a global thread cancel flag
-
class
Derived_EditFrontMatter
(**kwargs)[source]¶ Bases:
editfrontmatter.EditFrontMatter.EditFrontMatter
EditFrontMatter derived class for example purposes
-
__init__
(**kwargs)[source]¶ Init override with some self thread handling.
- Description
Instantiates the class with some thread self awareness for example puproses. Also files are read during the init process.
- Variables
- Throws:
EditFrontMatter_Exception
-
run
(write_file=False, extraVars_dict={}, keys_toDelete=[], *args, **kwargs) → str[source]¶ A method overload to process files.
- Description
Class method that performs setup for a call to
editfrontmatter.EditFrontMatter.EditFrontMatter.run()
.The method follows some flow control mechanisms for thread safety.
The method supresses IOError Exception with a comment loged to stderr if the exception occurs.
- Parameters
write_file (bool) – [default: False] Writes to the source file if True
extraVars_dict (dict) – [default: {}]: see
editfrontmatter.EditFrontMatter.EditFrontMatter
keys_toDelete (dict) – [default: []] see
editfrontmatter.EditFrontMatter.EditFrontMatter
- Returns
The altered file as a string or a null string on error
-