Skip to content

Commit

Permalink
avoid using reserved keywords in the logger
Browse files Browse the repository at this point in the history
  • Loading branch information
masci committed Apr 12, 2024
1 parent 5fce2e9 commit 5e13577
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion haystack/components/caching/cache_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "CacheChecker":

try:
module_name, type_ = init_params["document_store"]["type"].rsplit(".", 1)
logger.debug("Trying to import module '{module}'", module=module_name)
logger.debug("Trying to import module '{module_name}'", module_name=module_name)
module = importlib.import_module(module_name)
except (ImportError, DeserializationError) as e:
raise DeserializationError(
Expand Down
2 changes: 1 addition & 1 deletion haystack/components/retrievers/filter_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "FilterRetriever":
raise DeserializationError("Missing 'type' in document store's serialization data")
try:
module_name, type_ = init_params["document_store"]["type"].rsplit(".", 1)
logger.debug("Trying to import module '{module}'", module=module_name)
logger.debug("Trying to import module '{module_name}'", module_name=module_name)
module = importlib.import_module(module_name)
except (ImportError, DeserializationError) as e:
raise DeserializationError(
Expand Down
2 changes: 1 addition & 1 deletion haystack/components/writers/document_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DocumentWriter":

try:
module_name, type_ = init_params["document_store"]["type"].rsplit(".", 1)
logger.debug("Trying to import module '{module}'", module=module_name)
logger.debug("Trying to import module '{module_name}'", module_name=module_name)
module = importlib.import_module(module_name)
except (ImportError, DeserializationError) as e:
raise DeserializationError(
Expand Down
6 changes: 3 additions & 3 deletions haystack/core/component/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ def copy_class_namespace(namespace):
if class_path in self.registry:
# Corner case, but it may occur easily in notebooks when re-running cells.
logger.debug(
"Component {component} is already registered. Previous imported from '{module}', new imported from '{new_module}'",
"Component {component} is already registered. Previous imported from '{module_name}', new imported from '{new_module_name}'",
component=class_path,
module=self.registry[class_path],
new_module=cls,
module_name=self.registry[class_path],
new_module_name=cls,
)
self.registry[class_path] = cls
logger.debug("Registered Component {component}", component=cls)
Expand Down
2 changes: 1 addition & 1 deletion haystack/core/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def from_dict(
try:
# Import the module first...
module, _ = component_data["type"].rsplit(".", 1)
logger.debug("Trying to import {module}", module=module)
logger.debug("Trying to import module {module_name}", module_name=module)
importlib.import_module(module)
# ...then try again
if component_data["type"] not in component.registry:
Expand Down

0 comments on commit 5e13577

Please sign in to comment.