Skip to content

Commit

Permalink
assert key created_at exist in config_states
Browse files Browse the repository at this point in the history
  • Loading branch information
w-e-w committed Aug 20, 2023
1 parent 348601a commit ce0f09d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/config_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@
all_config_states = {}


class ConfigStatus:
def __int__(self, path):
pass
self.path = path
self.str = None

def __str__(self):
pass


def list_config_states():
global all_config_states

Expand All @@ -29,10 +39,11 @@ def list_config_states():
try:
with open(path, "r", encoding="utf-8") as f:
j = json.load(f)
assert "created_at" in j, '"created_at" does not exist'
j["filepath"] = path
config_states.append(j)
except Exception as e:
print(f'[ERROR]{path}, {e}')
print(f'[ERROR]: Config states {path}, {e}')

config_states = sorted(config_states, key=lambda cs: cs["created_at"], reverse=True)

Expand Down

0 comments on commit ce0f09d

Please sign in to comment.