This commit is contained in:
Daniel Tsvetkov 2019-04-20 23:23:30 +02:00
parent fae628b534
commit 17ca8f8b33
2 changed files with 17 additions and 16 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
venv venv
data/.cache.csv data/.cache.csv
__pycache__ __pycache__
.idea

6
tww.py
View File

@ -3,10 +3,9 @@
Find time now, in the past or future in any timezone or location. Find time now, in the past or future in any timezone or location.
""" """
import os
import argparse import argparse
import logging import logging
import sys import os
import dateparser import dateparser
from pytz.exceptions import UnknownTimeZoneError from pytz.exceptions import UnknownTimeZoneError
@ -20,6 +19,7 @@ basepath = os.path.dirname(os.path.abspath(__file__))
logging.basicConfig() logging.basicConfig()
logger = logging.getLogger() logger = logging.getLogger()
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('query', nargs='*', default="now", help="<datetime-like> to <timezone-like or location string>") parser.add_argument('query', nargs='*', default="now", help="<datetime-like> to <timezone-like or location string>")
@ -36,11 +36,11 @@ def setup_logging_level(debug=False):
logger.debug("Debugging enabled") logger.debug("Debugging enabled")
class Location: class Location:
""" """
Represents a location with name, latitude and longitude Represents a location with name, latitude and longitude
""" """
def __init__(self, name: str, latitude: float, longitude: float): def __init__(self, name: str, latitude: float, longitude: float):
self.name = name self.name = name
self.latitude = latitude self.latitude = latitude