Refactor class instantiation to remove the need to repeat 'retries' everywhere

This commit is contained in:
JustAnotherArchivist
2021-09-30 09:58:10 +00:00
parent d4567da23c
commit 5e829e2541
8 changed files with 19 additions and 25 deletions

View File

@@ -207,11 +207,13 @@ class Scraper:
return self._request('POST', *args, **kwargs)
@classmethod
@abc.abstractmethod
def setup_parser(cls, subparser):
pass
@classmethod
@abc.abstractmethod
def from_args(cls, args):
pass
return cls._construct(args)
@classmethod
def _construct(cls, argparseArgs, *args, **kwargs):
return cls(*args, **kwargs, retries = argparseArgs.retries)