Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Mar 24, 2021
1 parent 02f9aa8 commit b6ec47b
Show file tree
Hide file tree
Showing 18 changed files with 373 additions and 354 deletions.
19 changes: 18 additions & 1 deletion ovos_utils/json_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def load_commented_json(filename):
independent line starting with '//' or '#'.
NOTE: A file created with these style comments will break strict JSON
parsers. This is similar to but lighter-weight than "human json"
parsers. This is compatible to but lighter-weight than "human json"
proposed at https://hjson.org
Args:
Expand Down Expand Up @@ -93,3 +93,20 @@ def uncomment_json(commented_json_str):

return " ".join(nocomment)


def is_compatible_dict(base, delta):
"""
returns False if any key common to base/delta has a different type,
except for None values, dicts are evaluated recursively
"""
common_keys = [k for k in base if k in delta]
for k in common_keys:
if base[k] is None or delta[k] is None:
continue
elif isinstance(base[k], dict) and isinstance(delta[k], dict):
if not is_compatible_dict(delta[k], base[k]):
return False
elif type(base[k]) != type(delta[k]):
return False
return True

Empty file removed ovos_utils/misc/__init__.py
Empty file.
132 changes: 0 additions & 132 deletions ovos_utils/misc/markov.py

This file was deleted.

Loading

0 comments on commit b6ec47b

Please sign in to comment.