refactor(analyzer): redefine *_analyzer into steps

- update imports and names
- define step as a protocol
- extract analyzer function from classes
This commit is contained in:
jo 2022-01-17 20:31:43 +01:00 committed by Kyle Robbertze
parent f6a52c8324
commit 2cae31a97a
14 changed files with 452 additions and 480 deletions

View file

@ -1,9 +1,7 @@
# TODO: use an abstract base class (ie. import from abc ...) once we have python >=3.3 that supports @staticmethod with @abstractmethod
from typing import Any, Dict, Protocol
class Analyzer:
"""Abstract base class for all "analyzers"."""
class Step(Protocol):
@staticmethod
def analyze(filename, metadata):
raise NotImplementedError
def __call__(filename: str, metadata: Dict[str, Any]):
...