A semantic search engine for source code https://bitshift.benkurtovic.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
640 B

  1. from os import path
  2. import yaml
  3. __all__ = ["LANGS", "LANGS_ALL"]
  4. def _load_langs():
  5. filename = path.join(path.dirname(__file__), "languages.yml")
  6. with open(filename) as fp:
  7. data = yaml.load(fp)["languages"]
  8. langs = [(it.keys()[0] if isinstance(it, dict) else it).encode("utf8")
  9. for it in data]
  10. all_langs = {}
  11. for i, lang in enumerate(data):
  12. if isinstance(lang, dict):
  13. for val in lang.values()[0]:
  14. all_langs[val] = i
  15. else:
  16. all_langs[lang] = i
  17. return langs, all_langs
  18. LANGS, LANGS_ALL = _load_langs()