Skip to content

Commit

Permalink
detect json file when hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Jul 18, 2024
1 parent 922e733 commit e784849
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion python/hal9/iobind.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def add_extension(path, contents):
return Path(path)

def find_extension(file_path):
if Path(file_path + '.json').exists():
json_hidden = get_hidden(Path(file_path + '.json'))
if Path(file_path + '.json').exists() or Path(json_hidden).exists():
return Path(file_path + '.json')
return Path(file_path + '.pkl')

Expand Down Expand Up @@ -44,6 +45,7 @@ def load(name, default):
file_path = get_hidden(file_path)

extension = get_extension(file_path)

if not extension:
extension = "pkl"

Expand All @@ -58,6 +60,7 @@ def load(name, default):
contents = file.read()
else:
contents = default

return contents

def save(name, contents, hidden = False):
Expand Down
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hal9"
version = "2.4.7"
version = "2.4.8"
description = ""
authors = ["Javier Luraschi <javier@hal9.ai>"]
readme = "README.md"
Expand Down

0 comments on commit e784849

Please sign in to comment.