mapres 2.4.dev2__tar.gz → 2.4.dev4__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.dev2
3
+ Version: 2.4.dev4
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.2"
10
+ version = "2.4-dev.4"
11
11
  description = "A powerfull mapping utility"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.9"
@@ -39,7 +39,7 @@ def datamap(
39
39
  _cls = None,
40
40
  *,
41
41
  syntax: str = syntax.braces,
42
- mode: bool | None = None,
42
+ mode: bool | str | None = None,
43
43
  ):
44
44
  '''@datamap decorator with optional values'''
45
45
  def wrap(cls):
@@ -1,35 +1,36 @@
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
- @datamap(syntax=syntax.percents, mode='dynamic')
7
- class TimeMap:
8
- # default timezone
6
+ def safe_zoneinfo(tz: str):
9
7
  try:
10
- _default_tz = ZoneInfo("America/Chicago")
8
+ return ZoneInfo(tz)
11
9
  except Exception:
12
- from datetime import timezone
13
- _default_tz = timezone.utc
14
-
15
- # dynamic fields
16
- hh: str = None
17
- h: str = None
18
- h12: str = None
19
- hh12: str = None
20
- ampm: str = None
21
- mm: str = None
22
- m: str = None
23
- ss: str = None
24
- s: str = None
25
- ms: str = None
26
- YYYY: str = None
27
- MM: str = None
28
- DD: str = None
29
- weekday: str = None
10
+ return timezone.utc
11
+
12
+
13
+ @datamap(syntax=syntax.percents, mode='dynamic')
14
+ class TimeMap:
15
+ _default_tz = safe_zoneinfo("America/Chicago")
16
+
17
+ hh: str | None = None
18
+ h: str | None = None
19
+ h12: str | None = None
20
+ hh12: str | None = None
21
+ ampm: str | None = None
22
+ mm: str | None = None
23
+ m: str | None = None
24
+ ss: str | None = None
25
+ s: str | None = None
26
+ ms: str | None = None
27
+ YYYY: str | None = None
28
+ MM: str | None = None
29
+ DD: str | None = None
30
+ weekday: str | None = None
30
31
 
31
32
  def __init__(self, tz: str | None = None):
32
- self.TZ = ZoneInfo(tz) if tz else self._default_tz
33
+ self.TZ = safe_zoneinfo(tz) if tz else self._default_tz
33
34
 
34
35
  @property
35
36
  def providers(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapres
3
- Version: 2.4.dev2
3
+ Version: 2.4.dev4
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