Skip to content

Commit

Permalink
refactor - separate class_obj into two variables
Browse files Browse the repository at this point in the history
Signed-off-by: Nok Chan <[email protected]>
  • Loading branch information
noklam committed Nov 6, 2023
1 parent 588e3ea commit face399
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions kedro/io/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,21 +387,21 @@ def parse_dataset_definition(
if "type" not in config:
raise DatasetError("'type' is missing from dataset catalog configuration")

class_obj = config.pop("type")
if isinstance(class_obj, str):
if len(class_obj.strip(".")) != len(class_obj):
dataset_type = config.pop("type")
if isinstance(dataset_type, str):
if len(dataset_type.strip(".")) != len(dataset_type):
raise DatasetError(
"'type' class path does not support relative "
"paths or paths ending with a dot."
)
class_paths = (prefix + class_obj for prefix in _DEFAULT_PACKAGES)
class_paths = (prefix + dataset_type for prefix in _DEFAULT_PACKAGES)

trials = (_load_obj(class_path) for class_path in class_paths)
try:
class_obj = next(obj for obj in trials if obj is not None)
except StopIteration as exc:
raise DatasetError(
f"Class '{class_obj}' not found or one of its dependencies "
f"Class '{dataset_type}' not found or one of its dependencies "
f"has not been installed."
) from exc

Expand Down

0 comments on commit face399

Please sign in to comment.