mapres 2.4.dev1__tar.gz → 2.4.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapres
3
- Version: 2.4.dev1
3
+ Version: 2.4.dev3
4
4
  Summary: A powerfull mapping utility
5
5
  Author: iFamished
6
6
  License: MIT
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "mapres"
10
- version = "2.4-dev.1"
10
+ version = "2.4-dev.3"
11
11
  description = "A powerfull mapping utility"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.9"
@@ -1,14 +1,19 @@
1
- from datetime import datetime
1
+ from datetime import datetime, timezone
2
2
  from zoneinfo import ZoneInfo
3
3
  from mapres.datamap import datamap, syntax
4
4
 
5
5
 
6
+ def safe_zoneinfo(tz: str):
7
+ try:
8
+ return ZoneInfo(tz)
9
+ except Exception:
10
+ return timezone.utc
11
+
12
+
6
13
  @datamap(syntax=syntax.percents, mode='dynamic')
7
14
  class TimeMap:
8
- # default timezone
9
- _default_tz = ZoneInfo('America/Chicago')
15
+ _default_tz = safe_zoneinfo("America/Chicago")
10
16
 
11
- # dynamic fields
12
17
  hh: str = None
13
18
  h: str = None
14
19
  h12: str = None
@@ -25,7 +30,7 @@ class TimeMap:
25
30
  weekday: str = None
26
31
 
27
32
  def __init__(self, tz: str | None = None):
28
- self.TZ = ZoneInfo(tz) if tz else self._default_tz
33
+ self.TZ = safe_zoneinfo(tz) if tz else self._default_tz
29
34
 
30
35
  @property
31
36
  def providers(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapres
3
- Version: 2.4.dev1
3
+ Version: 2.4.dev3
4
4
  Summary: A powerfull mapping utility
5
5
  Author: iFamished
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes