Refactor concurrency so that it is pluggable

However, this may not be the best idea because it involves global
state that could be overridden by a parallel call to ocrmypdf.ocr.
This commit is contained in:
James R. Barlow
2021-01-24 23:46:29 -08:00
parent 34e564cd7d
commit 26b4d9bb4b
6 changed files with 242 additions and 135 deletions
+8 -2
View File
@@ -32,7 +32,11 @@ class OcrmypdfPluginManager(pluggy.PluginManager):
"""
def __init__(
self, *args, plugins: List[Union[str, Path]], builtins: bool = True, **kwargs,
self,
*args,
plugins: List[Union[str, Path]],
builtins: bool = True,
**kwargs,
):
self.__init_args = args
self.__init_kwargs = kwargs
@@ -88,7 +92,9 @@ class OcrmypdfPluginManager(pluggy.PluginManager):
def get_plugin_manager(plugins: List[Union[str, Path]], builtins=True):
pm = OcrmypdfPluginManager(
project_name='ocrmypdf', plugins=plugins, builtins=builtins,
project_name='ocrmypdf',
plugins=plugins,
builtins=builtins,
)
return pm