def __init__(self, cache_engine=Configurator.CACHE_ENGINE_IN_MEMORY, base_dir=None, cls=None, logger=None):
        super(Topology, self).__init__()

        # Initializing django here in case Hydro is not used within a django project
        if os.environ not in 'DJANGO_SETTINGS_MODULE':
            if not settings.configured:
                settings.configure()
                django.setup()

        if logger:
            self.logger = logger

        # TODO: read the cache engines from the configuration and allow passing parameters if needed
        # Topology is support self discovering of its needed modules but it can be supplied in init
        if not base_dir:
            base_dir = self.__module__
        if not cls:
            cls = self.__class__

        self.cache_engines = CacheEnginesFactory.get_cache_engines()
        self.transformers = Transformers()
        self.base_dir = '.'.join(base_dir.split('.')[:-1])
        self._modules_dir = self.base_dir
        self._templates_dir = os.path.dirname(inspect.getabsfile(cls))

        cache_engine_params = None
        if type(cache_engine) == dict:
            cache_engine_name = cache_engine['cache_engine_name']
            cache_engine_params = cache_engine['params']
        else:
            cache_engine_name = cache_engine
        cache_engine_class = self.cache_engines.get(cache_engine_name)
        if not cache_engine_class:
            cache_engine_class = self.cache_engines.get(Configurator.CACHE_ENGINE_IN_MEMORY)
        self.cache_engine = cache_engine_class(cache_engine_params)

        self._execution_plan = ExecutionPlan()
        self.query_engine = QueryEngineFactory.get_query_engine(self._modules_dir, self.cache_engine, self._execution_plan, self.logger)
        self.query_engine.set_templates_dir(self._templates_dir)
        self.logger.debug("Topology {0} was instantiated, modules_dir: {1}, templates_dir: {2}".
                          format(type(self).__name__, self._modules_dir, self._templates_dir))

        self._topology_cache_ttl = Configurator.CACHE_DB_KEY_EXPIRE
dataset/ETHPy150Open Convertro/Hydro/src/hydro/topology_base.py/Topology.__init__/swapped operands of `not in`