From d2b405105f1154948a23cf9ad5e09a084228749c Mon Sep 17 00:00:00 2001 From: Tony Tung Date: Tue, 26 Mar 2019 15:50:18 -0700 Subject: [PATCH] [easy] Make explicit the abstract methods in the PipelineComponent hierarchy (#1105) Depends on #1095 --- starfish/pipeline/pipelinecomponent.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/starfish/pipeline/pipelinecomponent.py b/starfish/pipeline/pipelinecomponent.py index 549c747f4..b1538ab85 100644 --- a/starfish/pipeline/pipelinecomponent.py +++ b/starfish/pipeline/pipelinecomponent.py @@ -1,9 +1,10 @@ import importlib +from abc import ABCMeta, abstractmethod from pathlib import Path from typing import Mapping, MutableMapping, Optional, Set, Type -class PipelineComponentType(type): +class PipelineComponentType(ABCMeta): """ This is the metaclass for PipelineComponent. As each subclass that is _not_ PipelineComponent is created, it sets up a map between the algorithm name and the class that implements it. @@ -58,6 +59,7 @@ def get_pipeline_component_class_by_name(name: str) -> Type["PipelineComponent"] return PipelineComponentType.get_pipeline_component_type_by_name(name) @classmethod + @abstractmethod def pipeline_component_type_name(cls) -> str: """ Returns the name of the pipeline component type. @@ -71,6 +73,7 @@ def _algorithm_to_class_map(cls) -> Mapping[str, Type]: return cls._algorithm_to_class_map_int @classmethod + @abstractmethod def _cli_run(cls, ctx, instance): raise NotImplementedError()