diff --git a/rasa/core/brokers/broker.py b/rasa/core/brokers/broker.py index 23d917a6de03..8dbc333f8e70 100644 --- a/rasa/core/brokers/broker.py +++ b/rasa/core/brokers/broker.py @@ -69,14 +69,16 @@ def _create_from_endpoint_config( broker = KafkaEventBroker.from_endpoint_config(endpoint_config) else: - broker = _load_from_module_string(endpoint_config) + broker = _load_from_module_name_in_endpoint_config(endpoint_config) if broker: logger.debug(f"Instantiated event broker to '{broker.__class__.__name__}'.") return broker -def _load_from_module_string(broker_config: EndpointConfig,) -> Optional["EventBroker"]: +def _load_from_module_name_in_endpoint_config( + broker_config: EndpointConfig, +) -> Optional["EventBroker"]: """Instantiate an event broker based on its class name.""" try: event_broker_class = common.class_from_module_path(broker_config.type) diff --git a/rasa/core/interpreter.py b/rasa/core/interpreter.py index 3b889708f875..d283aef27d24 100644 --- a/rasa/core/interpreter.py +++ b/rasa/core/interpreter.py @@ -293,10 +293,10 @@ def _create_from_endpoint_config( elif endpoint_config.type is None or endpoint_config.type.lower() == "http": return RasaNLUHttpInterpreter(endpoint_config=endpoint_config) else: - return _load_from_module_string(endpoint_config) + return _load_from_module_name_in_endpoint_config(endpoint_config) -def _load_from_module_string( +def _load_from_module_name_in_endpoint_config( endpoint_config: EndpointConfig, ) -> "NaturalLanguageInterpreter": """Instantiate an event channel based on its class name.""" diff --git a/rasa/core/lock_store.py b/rasa/core/lock_store.py index b686a2dd0e27..e90a9623e689 100644 --- a/rasa/core/lock_store.py +++ b/rasa/core/lock_store.py @@ -247,15 +247,17 @@ def _create_from_endpoint_config( elif endpoint_config.type == "redis": lock_store = RedisLockStore(host=endpoint_config.url, **endpoint_config.kwargs) else: - lock_store = _load_from_module_string(endpoint_config) + lock_store = _load_from_module_name_in_endpoint_config(endpoint_config) logger.debug(f"Connected to lock store '{lock_store.__class__.__name__}'.") return lock_store -def _load_from_module_string(endpoint_config: EndpointConfig) -> "LockStore": - """Given the name of a `LockStore` module tries to retrieve it.""" +def _load_from_module_name_in_endpoint_config( + endpoint_config: EndpointConfig, +) -> "LockStore": + """Retrieve a `LockStore` based on its class name.""" try: lock_store_class = common.class_from_module_path(endpoint_config.type) diff --git a/rasa/core/nlg/generator.py b/rasa/core/nlg/generator.py index 93e119f1210d..0f2d9ecc7b90 100644 --- a/rasa/core/nlg/generator.py +++ b/rasa/core/nlg/generator.py @@ -67,13 +67,13 @@ def _create_from_endpoint_config( nlg = TemplatedNaturalLanguageGenerator(domain.templates) else: - nlg = _load_from_module_string(endpoint_config, domain) + nlg = _load_from_module_name_in_endpoint_config(endpoint_config, domain) logger.debug(f"Instantiated NLG to '{nlg.__class__.__name__}'.") return nlg -def _load_from_module_string( +def _load_from_module_name_in_endpoint_config( endpoint_config: EndpointConfig, domain: Domain ) -> "NaturalLanguageGenerator": """Initializes a custom natural language generator. diff --git a/rasa/core/tracker_store.py b/rasa/core/tracker_store.py index 8fec5ae0e8dd..33ab6b024d5f 100644 --- a/rasa/core/tracker_store.py +++ b/rasa/core/tracker_store.py @@ -1057,14 +1057,16 @@ def _create_from_endpoint_config( domain=domain, event_broker=event_broker, **endpoint_config.kwargs ) else: - tracker_store = _load_from_module_string(domain, endpoint_config, event_broker) + tracker_store = _load_from_module_name_in_endpoint_config( + domain, endpoint_config, event_broker + ) logger.debug(f"Connected to {tracker_store.__class__.__name__}.") return tracker_store -def _load_from_module_string( +def _load_from_module_name_in_endpoint_config( domain: Domain, store: EndpointConfig, event_broker: Optional[EventBroker] = None ) -> "TrackerStore": """Initializes a custom tracker.