mapres 3.dev24__tar.gz → 3.dev26__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-3.dev24/src/mapres.egg-info → mapres-3.dev26}/PKG-INFO +1 -1
- {mapres-3.dev24 → mapres-3.dev26}/pyproject.toml +1 -1
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/__init__.py +9 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/datamap.py +12 -17
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/resolver.py +2 -2
- mapres-3.dev26/src/mapres/utils.py +5 -0
- {mapres-3.dev24 → mapres-3.dev26/src/mapres.egg-info}/PKG-INFO +1 -1
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres.egg-info/SOURCES.txt +1 -0
- {mapres-3.dev24 → mapres-3.dev26}/LICENSE +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/README.md +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/setup.cfg +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/ast.py +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/cache.py +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/evaluator.py +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/exceptions.py +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/layers.py +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/maps/__init__.py +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/maps/color.py +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/maps/time.py +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/parser.py +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres/tokenizer.py +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres.egg-info/dependency_links.txt +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres.egg-info/requires.txt +0 -0
- {mapres-3.dev24 → mapres-3.dev26}/src/mapres.egg-info/top_level.txt +0 -0
|
@@ -10,6 +10,7 @@ except PackageNotFoundError:
|
|
|
10
10
|
from .resolver import MapResolver, res, setGlobalMaps
|
|
11
11
|
from .datamap import DataMap, datamap, syntax
|
|
12
12
|
from .layers import Layer, LayerStack
|
|
13
|
+
from .utils import rprint
|
|
13
14
|
|
|
14
15
|
# maps
|
|
15
16
|
from .maps.color import ColorMap, ascii_colors, mc_colors, strip_colors
|
|
@@ -28,6 +29,10 @@ maps = SimpleNamespace(
|
|
|
28
29
|
time = time,
|
|
29
30
|
)
|
|
30
31
|
|
|
32
|
+
utils = SimpleNamespace(
|
|
33
|
+
rprint = rprint,
|
|
34
|
+
)
|
|
35
|
+
|
|
31
36
|
__all__ = [
|
|
32
37
|
# core modules
|
|
33
38
|
'MapResolver',
|
|
@@ -39,6 +44,9 @@ __all__ = [
|
|
|
39
44
|
'LayerStack',
|
|
40
45
|
'setGlobalMaps',
|
|
41
46
|
|
|
47
|
+
# utils
|
|
48
|
+
'rprint',
|
|
49
|
+
|
|
42
50
|
# maps
|
|
43
51
|
'ColorMap',
|
|
44
52
|
'ascii_colors',
|
|
@@ -49,4 +57,5 @@ __all__ = [
|
|
|
49
57
|
|
|
50
58
|
# namespaces
|
|
51
59
|
'maps',
|
|
60
|
+
'utils',
|
|
52
61
|
]
|
|
@@ -121,14 +121,6 @@ def datamap(_cls=None, *, syntax=None, mode=None, missing_key=None, recursive=No
|
|
|
121
121
|
|
|
122
122
|
# syntax-bound decorator factories
|
|
123
123
|
class _SyntaxFactory:
|
|
124
|
-
'''
|
|
125
|
-
Allows:
|
|
126
|
-
@datamap.angles
|
|
127
|
-
@datamap.angles(mode='config')
|
|
128
|
-
@datamap.angles.config
|
|
129
|
-
@datamap.angles.dynamic
|
|
130
|
-
@datamap.angles.callable
|
|
131
|
-
'''
|
|
132
124
|
def __init__(self, syntax_name):
|
|
133
125
|
self._syntax = syntax_name
|
|
134
126
|
|
|
@@ -137,17 +129,20 @@ class _SyntaxFactory:
|
|
|
137
129
|
return datamap(_cls, syntax=self._syntax)
|
|
138
130
|
return datamap(syntax=self._syntax, **kwargs)
|
|
139
131
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
132
|
+
def config(self, _cls=None, **kwargs):
|
|
133
|
+
if _cls is not None and isinstance(_cls, type):
|
|
134
|
+
return datamap(_cls, syntax=self._syntax, mode='config')
|
|
135
|
+
return datamap(syntax=self._syntax, mode='config', **kwargs)
|
|
143
136
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
137
|
+
def dynamic(self, _cls=None, **kwargs):
|
|
138
|
+
if _cls is not None and isinstance(_cls, type):
|
|
139
|
+
return datamap(_cls, syntax=self._syntax, mode='dynamic')
|
|
140
|
+
return datamap(syntax=self._syntax, mode='dynamic', **kwargs)
|
|
147
141
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
142
|
+
def callable(self, _cls=None, **kwargs):
|
|
143
|
+
if _cls is not None and isinstance(_cls, type):
|
|
144
|
+
return datamap(_cls, syntax=self._syntax, mode='callable')
|
|
145
|
+
return datamap(syntax=self._syntax, mode='callable', **kwargs)
|
|
151
146
|
|
|
152
147
|
|
|
153
148
|
datamap.braces = _SyntaxFactory(syntax.braces)
|
|
@@ -129,7 +129,7 @@ def setGlobalMaps(maps, *, priority=0):
|
|
|
129
129
|
_DEFAULT_RESOLVER.layers.add_layer(maps, priority=priority)
|
|
130
130
|
|
|
131
131
|
def res(text: str, **ctx) -> str:
|
|
132
|
-
|
|
132
|
+
'''
|
|
133
133
|
Simple global resolution.
|
|
134
|
-
|
|
134
|
+
'''
|
|
135
135
|
return _DEFAULT_RESOLVER.res(text, **ctx)
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|