mapres 3.dev19__py3-none-any.whl → 3.dev21__py3-none-any.whl
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/datamap.py +5 -13
- mapres/evaluator.py +0 -14
- {mapres-3.dev19.dist-info → mapres-3.dev21.dist-info}/METADATA +1 -1
- {mapres-3.dev19.dist-info → mapres-3.dev21.dist-info}/RECORD +7 -7
- {mapres-3.dev19.dist-info → mapres-3.dev21.dist-info}/WHEEL +0 -0
- {mapres-3.dev19.dist-info → mapres-3.dev21.dist-info}/licenses/LICENSE +0 -0
- {mapres-3.dev19.dist-info → mapres-3.dev21.dist-info}/top_level.txt +0 -0
mapres/datamap.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import re
|
|
2
1
|
from dataclasses import dataclass, fields, is_dataclass
|
|
3
2
|
|
|
4
3
|
# syntax identifiers
|
|
@@ -30,15 +29,13 @@ class DataMap:
|
|
|
30
29
|
|
|
31
30
|
Mode metadata (__mode__) controls behavior:
|
|
32
31
|
- None: plain static map
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
32
|
+
- 'dynamic': values may be provided by callables/providers
|
|
33
|
+
- 'config': config-style maps (no dynamic evaluation)
|
|
34
|
+
- 'callable': map exposes callable methods for nested calls
|
|
36
35
|
'''
|
|
37
36
|
__syntax__: str = None
|
|
38
|
-
__mode__: str | None = None
|
|
39
|
-
__recursive__: bool = False
|
|
37
|
+
__mode__: str | None = None # 'dynamic', 'config', 'callable', or None
|
|
40
38
|
__missing_key__: str = 'error' # 'error', 'silent', 'placeholder'
|
|
41
|
-
__ignore_delimiters__: bool = False
|
|
42
39
|
|
|
43
40
|
def as_map(self):
|
|
44
41
|
'''
|
|
@@ -95,16 +92,11 @@ class DataMap:
|
|
|
95
92
|
return out
|
|
96
93
|
|
|
97
94
|
|
|
98
|
-
def datamap(_cls=None, *, syntax=None, mode=None,
|
|
99
|
-
missing_key=None, ignore_delimiters=None):
|
|
100
|
-
|
|
95
|
+
def datamap(_cls=None, *, syntax=None, mode=None, missing_key=None):
|
|
101
96
|
def wrap(cls):
|
|
102
97
|
cls.__syntax__ = syntax
|
|
103
98
|
cls.__mode__ = mode
|
|
104
|
-
cls.__recursive__ = recursive if recursive is not None else False
|
|
105
|
-
# cls.__recursive__ = recursive
|
|
106
99
|
cls.__missing_key__ = missing_key or 'error'
|
|
107
|
-
cls.__ignore_delimiters__ = ignore_delimiters or False
|
|
108
100
|
|
|
109
101
|
namespace = dict(cls.__dict__)
|
|
110
102
|
namespace['__dict__'] = {}
|
mapres/evaluator.py
CHANGED
|
@@ -40,8 +40,6 @@ class Evaluator:
|
|
|
40
40
|
for child in node.children:
|
|
41
41
|
parts.append(self._eval(child))
|
|
42
42
|
out = ''.join(parts)
|
|
43
|
-
|
|
44
|
-
# recursion disabled for now (Mapres 2–style behavior)
|
|
45
43
|
return out
|
|
46
44
|
|
|
47
45
|
# identifier
|
|
@@ -123,15 +121,3 @@ class Evaluator:
|
|
|
123
121
|
return None
|
|
124
122
|
cur = cur[p]
|
|
125
123
|
return cur
|
|
126
|
-
|
|
127
|
-
# recursion helpers now effectively disabled
|
|
128
|
-
def _has_recursive_maps(self):
|
|
129
|
-
return False
|
|
130
|
-
|
|
131
|
-
def _get_max_depth(self):
|
|
132
|
-
return 0
|
|
133
|
-
|
|
134
|
-
def _re_resolve(self, text: str) -> str:
|
|
135
|
-
tokens = Tokenizer(text).tokenize()
|
|
136
|
-
ast = Parser(tokens).parse()
|
|
137
|
-
return self.evaluate(ast)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
mapres/__init__.py,sha256=t23ofM-wzpPByYi1rEQonxyU1yyza4ZzwwHDZUa5QqA,1010
|
|
2
2
|
mapres/ast.py,sha256=6PcMkwtNHYD8xEkdyzDgn_mRTj1ZaWSyuHZK3BtXiuo,427
|
|
3
3
|
mapres/cache.py,sha256=hbvsoc6Qw3RhWAEfOOpKHtC7i9EomoUgWzyd4dnH71w,333
|
|
4
|
-
mapres/datamap.py,sha256=
|
|
5
|
-
mapres/evaluator.py,sha256=
|
|
4
|
+
mapres/datamap.py,sha256=R_5G_mE2OZpZ9YVL4tsNXAGS_SkQ6LKlx6Bz2Pr652Y,5021
|
|
5
|
+
mapres/evaluator.py,sha256=KNZ9aygOClM0kgnOf3anigsupLF175EJ07z_17ubZzU,3441
|
|
6
6
|
mapres/exceptions.py,sha256=D2XKnrMkZDyUXQt2PmaKbj08FObWU00yXKGHwNpjvww,222
|
|
7
7
|
mapres/layers.py,sha256=sFc1eUOBg2BoB2cBXIleq8RMYcg5GZpUoCnGh-uKN6U,1380
|
|
8
8
|
mapres/parser.py,sha256=8XLCzYosvh81bN-Jddc1AM4w0X7bsHnBzmA8sq5_72w,4018
|
|
@@ -11,8 +11,8 @@ mapres/tokenizer.py,sha256=js0S1s8MkltdQoH5V1cLjdY0fFqZoGqmtP_OhEJEM6M,6539
|
|
|
11
11
|
mapres/maps/__init__.py,sha256=lIRRfem1Fw4iynuwUQ7BY5qrC4fbJKxqLivao2_Dtm4,239
|
|
12
12
|
mapres/maps/color.py,sha256=noRTGFNo9xLl5YEhX0tttV6i_oDAiptXmRVnkr5EzwM,1348
|
|
13
13
|
mapres/maps/time.py,sha256=TyncycYoIGVZWps32qWlFy2a2hTayvZWVHu9uh2nid8,2050
|
|
14
|
-
mapres-3.
|
|
15
|
-
mapres-3.
|
|
16
|
-
mapres-3.
|
|
17
|
-
mapres-3.
|
|
18
|
-
mapres-3.
|
|
14
|
+
mapres-3.dev21.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
15
|
+
mapres-3.dev21.dist-info/METADATA,sha256=SrQXRywgQfa_pKRb7Egsdagr1pNwn2F9S3bBdpTWdVQ,1476
|
|
16
|
+
mapres-3.dev21.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
17
|
+
mapres-3.dev21.dist-info/top_level.txt,sha256=5LMVQqJdtyjxfzv7wJBOZ-360m0Yc79w_-Y7s3n6cTw,7
|
|
18
|
+
mapres-3.dev21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|