2020-10-05 13:50:33 +02:00
|
|
|
import json
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
2020-10-26 19:19:18 +01:00
|
|
|
__init__ = ['ENGINES_LANGUGAGES', 'CURRENCIES', 'USER_AGENTS', 'EXTERNAL_URLS', 'WIKIDATA_UNITS',
|
|
|
|
'bangs_loader', 'ahmia_blacklist_loader']
|
2020-10-05 13:50:33 +02:00
|
|
|
data_dir = Path(__file__).parent
|
|
|
|
|
|
|
|
|
|
|
|
def load(filename):
|
2021-01-12 09:45:16 +01:00
|
|
|
with open(data_dir / filename, encoding='utf-8') as fd:
|
2020-10-05 13:50:33 +02:00
|
|
|
return json.load(fd)
|
|
|
|
|
|
|
|
|
|
|
|
def bangs_loader():
|
|
|
|
return load('bangs.json')
|
|
|
|
|
|
|
|
|
2020-10-26 20:40:24 +01:00
|
|
|
def ahmia_blacklist_loader():
|
|
|
|
with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as fd:
|
|
|
|
return fd.read().split()
|
|
|
|
|
|
|
|
|
2020-10-05 13:50:33 +02:00
|
|
|
ENGINES_LANGUAGES = load('engines_languages.json')
|
|
|
|
CURRENCIES = load('currencies.json')
|
|
|
|
USER_AGENTS = load('useragents.json')
|
2020-10-26 19:19:18 +01:00
|
|
|
EXTERNAL_URLS = load('external_urls.json')
|
|
|
|
WIKIDATA_UNITS = load('wikidata_units.json')
|