Skip to content

Commit

Permalink
refactor: output the path without full stops at the end;
Browse files Browse the repository at this point in the history
  • Loading branch information
WenjieDu committed Jun 6, 2024
1 parent df6b2ac commit d038579
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pypots/cli/tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def run(self):
if self._model not in NN_MODELS:
logger.info(
f"The specified model {self._model} is not in PyPOTS. Available models are {NN_MODELS.keys()}. "
f"Trying to fetch it from the given model package {self._model_package_path}."
f"Trying to fetch it from the given model package {self._model_package_path}"
)
assert self._model_package_path is not None, (
f"The given model {self._model} is not in PyPOTS. "
Expand All @@ -220,7 +220,7 @@ def run(self):
)
model_package = load_package_from_path(self._model_package_path)
assert self._model in model_package.__all__, (
f"{self._model} is not in the given model package {self._model_package_path}."
f"{self._model} is not in the given model package {self._model_package_path}"
f"Please ensure that the model class is in the __all__ list of the model package."
)
model_class = getattr(model_package, self._model)
Expand Down
8 changes: 4 additions & 4 deletions pypots/data/saving/h5.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ def save_set(handle, name, data):
# check typing
assert isinstance(
data_dict, dict
), f"`data_dict` should be a Python dictionary, but got {type(data_dict)}."
), f"`data_dict` should be a Python dictionary, but got {type(data_dict)}"
assert isinstance(
saving_path, str
), f"`saving_path` should be a string, but got {type(saving_path)}."
), f"`saving_path` should be a string, but got {type(saving_path)}"

if file_name is None: # if file_name is not given
# check suffix
if not saving_path.endswith(".h5") or saving_path.endswith(".hdf5"):
logger.warning(
f"‼️ `saving_path` should end with '.h5' or '.hdf5', but got {saving_path}. "
f"‼️ `saving_path` should end with '.h5' or '.hdf5', but got {saving_path} ."
f"PyPOTS will automatically append '.h5' to the given `saving_path`."
)
else: # if file_name is given
Expand All @@ -84,7 +84,7 @@ def save_set(handle, name, data):
for k, v in data_dict.items():
save_set(hf, k, v)

logger.info(f"Successfully saved the given data into {saving_path}.")
logger.info(f"Successfully saved the given data into {saving_path}")


def load_dict_from_h5(
Expand Down
2 changes: 1 addition & 1 deletion pypots/utils/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ def create_dir_if_not_exist(path: str, is_dir: bool = True) -> None:
path = extract_parent_dir(path) if not is_dir else path
if not os.path.exists(path):
os.makedirs(path, exist_ok=True)
logger.info(f'Successfully created the given path "{path}".')
logger.info(f"Successfully created the given path {path}")

0 comments on commit d038579

Please sign in to comment.