mapres 2.4.dev3__tar.gz → 2.4.dev5__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.
- {mapres-2.4.dev3/src/mapres.egg-info → mapres-2.4.dev5}/PKG-INFO +1 -1
- {mapres-2.4.dev3 → mapres-2.4.dev5}/pyproject.toml +1 -1
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres/__init__.py +2 -1
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres/datamap.py +1 -1
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres/maps/time.py +14 -14
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres/resolver.py +16 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5/src/mapres.egg-info}/PKG-INFO +1 -1
- {mapres-2.4.dev3 → mapres-2.4.dev5}/LICENSE +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/README.md +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/setup.cfg +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres/cache.py +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres/exceptions.py +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres/layers.py +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres/maps/__init__.py +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres/maps/color.py +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres.egg-info/SOURCES.txt +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres.egg-info/dependency_links.txt +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres.egg-info/requires.txt +0 -0
- {mapres-2.4.dev3 → mapres-2.4.dev5}/src/mapres.egg-info/top_level.txt +0 -0
|
@@ -7,7 +7,7 @@ try:
|
|
|
7
7
|
except PackageNotFoundError:
|
|
8
8
|
__version__ = '0.0.0'
|
|
9
9
|
|
|
10
|
-
from .resolver import MapResolver, res
|
|
10
|
+
from .resolver import MapResolver, res, setGlobalMaps
|
|
11
11
|
from .datamap import DataMap, datamap, syntax
|
|
12
12
|
from .layers import Layer, LayerStack
|
|
13
13
|
|
|
@@ -37,6 +37,7 @@ __all__ = [
|
|
|
37
37
|
'syntax',
|
|
38
38
|
'Layer',
|
|
39
39
|
'LayerStack',
|
|
40
|
+
'setGlobalMaps',
|
|
40
41
|
|
|
41
42
|
# maps
|
|
42
43
|
'ColorMap',
|
|
@@ -14,20 +14,20 @@ def safe_zoneinfo(tz: str):
|
|
|
14
14
|
class TimeMap:
|
|
15
15
|
_default_tz = safe_zoneinfo("America/Chicago")
|
|
16
16
|
|
|
17
|
-
hh: str = None
|
|
18
|
-
h: str = None
|
|
19
|
-
h12: str = None
|
|
20
|
-
hh12: str = None
|
|
21
|
-
ampm: str = None
|
|
22
|
-
mm: str = None
|
|
23
|
-
m: str = None
|
|
24
|
-
ss: str = None
|
|
25
|
-
s: str = None
|
|
26
|
-
ms: str = None
|
|
27
|
-
YYYY: str = None
|
|
28
|
-
MM: str = None
|
|
29
|
-
DD: str = None
|
|
30
|
-
weekday: str = None
|
|
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
|
|
31
31
|
|
|
32
32
|
def __init__(self, tz: str | None = None):
|
|
33
33
|
self.TZ = safe_zoneinfo(tz) if tz else self._default_tz
|
|
@@ -183,3 +183,19 @@ def res(text: str, **ctx) -> str:
|
|
|
183
183
|
Resolve using the global default resolver.
|
|
184
184
|
'''
|
|
185
185
|
return _DEFAULT.res(text, **ctx)
|
|
186
|
+
|
|
187
|
+
def setGlobalMaps(maps, *, name=None, priority=0):
|
|
188
|
+
"""
|
|
189
|
+
Register a global map or datamap class into the default resolver.
|
|
190
|
+
|
|
191
|
+
maps: datamap class OR dict
|
|
192
|
+
name: optional layer name (default = class name or 'global')
|
|
193
|
+
priority: layer priority (lower = earlier)
|
|
194
|
+
"""
|
|
195
|
+
layer_name = name or getattr(maps, "__name__", "global")
|
|
196
|
+
|
|
197
|
+
# Wrap datamap class or dict in a Layer
|
|
198
|
+
layer = Layer(layer_name, maps=[maps], priority=priority)
|
|
199
|
+
|
|
200
|
+
# Add to global resolver
|
|
201
|
+
_DEFAULT.layers.add_layer(layer)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|