Skip to content

Commit

Permalink
fixed for coderabbit reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
jkbhagatio committed Sep 12, 2023
1 parent 23c8872 commit aaacd53
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions aeon/schema/social.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def read(
# Get config file from `file`, then bodyparts from config file.
model_dir = Path(file.stem.replace("_", "/")).parent
config_file_dir = ceph_proc_dir / model_dir
assert config_file_dir.exists(), f"Cannot find model dir {config_file_dir}"
if not config_file_dir.exists():
raise FileNotFoundError(f"Cannot find model dir {config_file_dir}")
config_file = get_config_file(config_file_dir)
parts = self.get_bodyparts(config_file)

Expand Down Expand Up @@ -78,7 +79,7 @@ def get_bodyparts(self, file: Path) -> list[str]:
parts = [util.find_nested_key(heads, "anchor_part")]
parts += util.find_nested_key(heads, "part_names")
except KeyError as err:
if parts is None:
if not parts:
raise KeyError(f"Cannot find bodyparts in {file}.") from err
return parts

Expand All @@ -95,7 +96,8 @@ def get_config_file(
if (config_file_dir / f).exists():
config_file = config_file_dir / f
break
assert config_file is not None, f"Cannot find config file in {config_file_dir}"
if config_file is None:
raise FileNotFoundError(f"Cannot find config file in {config_file_dir}")
return config_file


Expand Down

0 comments on commit aaacd53

Please sign in to comment.