added factory pattern

This commit is contained in:
tylerlaberge
2016-07-24 15:21:00 -04:00
parent 2811f40da8
commit cf68b753d7
2 changed files with 84 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
from abc import abstractmethod, ABCMeta
class Factory(object, metaclass=ABCMeta):
"""
Abstract Factory Class.
All Factories should inherit this class and overwrite the create method.
"""
@abstractmethod
def create(self, **kwargs):
"""
Abstract create method.
Concrete implementations should return a new instance of the object the factory class is responsible for.
@param kwargs: Arguments for object creation.
@return: A new instance of the object the factory is responsible for.
"""
pass