forked from charlesmadere/CynanBotCommon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocation.py
46 lines (36 loc) · 1.37 KB
/
location.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from datetime import tzinfo
import CynanBotCommon.utils as utils
class Location():
def __init__(
self,
latitude: float,
longitude: float,
locationId: str,
name: str,
timeZone: tzinfo
):
if not utils.isValidNum(latitude):
raise ValueError(f'latitude argument is malformed: \"{latitude}\"')
elif not utils.isValidNum(longitude):
raise ValueError(f'longitude argument is malformed: \"{longitude}\"')
elif not utils.isValidStr(locationId):
raise ValueError(f'id_ argument is malformed: \"{locationId}\"')
elif not utils.isValidStr(name):
raise ValueError(f'name argument is malformed: \"{name}\"')
elif timeZone is None:
raise ValueError(f'timeZone argument is malformed: \"{timeZone}\"')
self.__latitude = latitude
self.__longitude = longitude
self.__locationId = locationId
self.__name = name
self.__timeZone = timeZone
def getLatitude(self) -> float:
return self.__latitude
def getLocationId(self) -> str:
return self.__locationId
def getLongitude(self) -> float:
return self.__longitude
def getName(self) -> str:
return self.__name
def getTimeZone(self) -> tzinfo:
return self.__timeZone