Skip to content

Commit

Permalink
Tidy up code somewhat
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Oct 16, 2024
1 parent 3b9928a commit 90fc6ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Lib/shaperglot/cli/whatuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ def whatuses(options) -> None:
base_langs = []
mark_langs = []
aux_langs = []
for langid in langs.keys():
lang = langs[langid]
for lang in langs.values():
exemplar_chars = lang.get("exemplarChars", {})
marks = exemplar_chars.get("marks", "").replace("◌", "").split() or []
bases = parse_bases(exemplar_chars.get("base", ""))
aux = parse_bases(exemplar_chars.get("auxiliary", ""))
lang_key = f"{lang['name']} [{langid}]".replace(" ", "\u00A0")
lang_key = f"{lang['name']} [{lang['id']}]".replace(" ", "\u00A0")
if char in bases:
base_langs.append(lang_key)
elif char in marks:
Expand Down
4 changes: 4 additions & 0 deletions Lib/shaperglot/languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def __contains__(self, item) -> bool:
def keys(self):
return gflangs.keys()

def values(self):
for k in gflangs.keys():
yield self.__getitem__(k)

def disambiguate(self, lang):
maybe_keys = [k for k in gflangs if k.lower().startswith(lang.lower() + "_")]
if maybe_keys:
Expand Down

0 comments on commit 90fc6ca

Please sign in to comment.