def __new__(cls, base, *args, **kwargs): if isinstance(base, Flask): return object.__new__(AutoIndexApplication) elif isinstance(base, Blueprint): return object.__new__(AutoIndexBlueprint) else: raise TypeError("'base' should be Flask or Blueprint.")
def __new__(cls, base, *args, **kwargs): if isinstance(base, Flask): return object.__new__(AutoIndexApplication) elif isinstance(base, Blueprint): return object.__new__(AutoIndexBlueprint) else: raise TypeError("'base' should be Flask or Blueprint.")
def __new__(cls, queue_id, **kwargs): """ Creates a new instance of the right queue type """ if cls is not Queue: return object.__new__(cls) if isinstance(queue_id, Queue): queue_id = queue_id.id queue_type = Queue.get_queue_type(queue_id) if queue_type == "regular": from .queue_regular import QueueRegular return QueueRegular(queue_id, **kwargs) else: from .queue_raw import QueueRaw return QueueRaw(queue_id, **kwargs)