Skip to content

Instantly share code, notes, and snippets.

@geoffkoh
Created January 26, 2020 04:06
Show Gist options
  • Save geoffkoh/1d84a653c8884061bd6dfbb575a244ee to your computer and use it in GitHub Desktop.
Save geoffkoh/1d84a653c8884061bd6dfbb575a244ee to your computer and use it in GitHub Desktop.
Factory pattern using decorators
class ExecutorBase(metaclass=ABCMeta):
""" Base class for an executor """
def __init__(self, **kwargs):
""" Constructor """
pass
@abstractmethod
def run(self, command: str) -> (str, str):
""" Abstract method to run a command """
pass
# end class ExecutorBase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment