aboutsummaryrefslogtreecommitdiff
path: root/modules/location.py
blob: e4f769aa679bb0999c8a11035862596f625b84e2 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from src import ModuleManager, utils
import pytz

_lower_timezones = {}
for tz in pytz.all_timezones:
    if "/" in tz:
        _lower_timezones[tz.split("/", 1)[1].lower()] = tz
    _lower_timezones[tz.lower()] = tz

def _find_tz(s):
    return _lower_timezones.get(s.lower(), None)

@utils.export("set", {"setting": "location", "help": "Set your location",
    "validate": _find_tz})
class Module(ModuleManager.BaseModule):
    pass