Skip to content

Commit

Permalink
style: reformat ruff with new style
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyoon committed Jan 22, 2025
1 parent d4c1f63 commit 4c79e24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/ml_project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ def setup_logging(
file_levels: List of logging levels for each output file. Only applies if log_dir is not None.
log_init_messages: Whether to log the initialisation messages.
"""
assert len(output_files) == len(
file_levels
), "output_files and file_levels must have the same length"
assert len(output_files) == len(file_levels), (
"output_files and file_levels must have the same length"
)

if log_dir is None:
output_files = []
Expand Down
2 changes: 1 addition & 1 deletion src/ml_project/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def config(config_dir: Path | None = None):
rich.print()
rich.print("Type in the values for the following variables:")
for i, (key, value) in enumerate(template_envs.items()):
choice = Prompt.ask(f"{i+1}/{len(template_envs)}. {key}", default=value)
choice = Prompt.ask(f"{i + 1}/{len(template_envs)}. {key}", default=value)
if choice is None:
set_key(dotenv_file, key, "", quote_mode="auto")
else:
Expand Down
6 changes: 3 additions & 3 deletions src/ml_project/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def _set_value_as_type(self, key, value: str, vartype):
"""Set the string value as the given type."""
if get_origin(vartype) is list:
setattr(self, key, ast.literal_eval(value))
assert isinstance(
getattr(self, key), vartype
), f"{type(self).__name__}.{key} has to be {vartype} but got {type(getattr(self, key))}"
assert isinstance(getattr(self, key), vartype), (
f"{type(self).__name__}.{key} has to be {vartype} but got {type(getattr(self, key))}"
)
elif vartype is bool:
if value == "True":
setattr(self, key, True)
Expand Down

0 comments on commit 4c79e24

Please sign in to comment.