Skip to content

Commit

Permalink
[fix] Registry write/remove issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tamohannes committed Jul 12, 2024
1 parent 381f6c9 commit 8e90c8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion urartu/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.18
2.0.19
8 changes: 3 additions & 5 deletions urartu/utils/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def remove_entry(module_name):
file_content.pop(module_name)

with open(Registry.REGISTRY_FILE_PATH, "w") as file:
yaml.dump(file_content, file)
if file_content:
yaml.dump(file_content, file)

return True

Expand All @@ -37,7 +38,7 @@ def add_entry(module_name, module_root_dir):
else:
file_content[module_name] = str(module_root_dir)

with open(Registry.REGISTRY_FILE_PATH, "a") as file:
with open(Registry.REGISTRY_FILE_PATH, "w") as file:
yaml.dump(file_content, file)

return True
Expand All @@ -53,9 +54,6 @@ def load_file_content():

if file_content is None:
return {}
# raise RuntimeError(
# f"Registery is empty, register a module using `urartu register --name='NAME' --path='PATH'` command."
# )

return file_content

Expand Down

0 comments on commit 8e90c8d

Please sign in to comment.