Redifine ParseKwargs to not import scraibe to early on

This commit is contained in:
Jaikinator
2024-01-26 15:28:50 +01:00
parent c33c0f1f53
commit 8ba3ee146b
+15 -2
View File
@@ -6,8 +6,21 @@ The main Reason for this script is to allow the use of multiprocessing in the ap
""" """
import multiprocessing import multiprocessing
from scraibe.misc import ParseKwargs from argparse import ArgumentParser, Action
from argparse import ArgumentParser
class ParseKwargs(Action):
"""
Custom argparse action to parse keyword arguments. has to bne redifined here because of multiprocessing.
"""
def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, self.dest, dict())
for value in values:
key, value = value.split('=')
try:
value = eval(value)
except:
pass
getattr(namespace, self.dest)[key] = value
parser = ArgumentParser() parser = ArgumentParser()