__init__.py 650 B

1234567891011121314151617181920212223242526
  1. import json
  2. from pathlib import Path
  3. __init__ = ['ENGINES_LANGUGAGES', 'CURRENCIES', 'USER_AGENTS', 'bangs_loader', 'ahmia_blacklist_loader']
  4. data_dir = Path(__file__).parent
  5. def load(filename):
  6. # add str(...) for Python 3.5
  7. with open(str(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')