__init__.py 746 B

1234567891011121314151617181920212223242526272829
  1. import json
  2. from pathlib import Path
  3. __init__ = ['ENGINES_LANGUGAGES', 'CURRENCIES', 'USER_AGENTS', 'EXTERNAL_URLS', 'WIKIDATA_UNITS',
  4. 'bangs_loader', 'ahmia_blacklist_loader']
  5. data_dir = Path(__file__).parent
  6. def load(filename):
  7. with open(data_dir / filename, encoding='utf-8') as fd:
  8. return json.load(fd)
  9. def bangs_loader():
  10. return load('bangs.json')
  11. def ahmia_blacklist_loader():
  12. with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as fd:
  13. return fd.read().split()
  14. ENGINES_LANGUAGES = load('engines_languages.json')
  15. CURRENCIES = load('currencies.json')
  16. USER_AGENTS = load('useragents.json')
  17. EXTERNAL_URLS = load('external_urls.json')
  18. WIKIDATA_UNITS = load('wikidata_units.json')