mapres 3.dev8__tar.gz → 3.dev9__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.dev8/src/mapres.egg-info → mapres-3.dev9}/PKG-INFO +1 -1
- {mapres-3.dev8 → mapres-3.dev9}/pyproject.toml +1 -1
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/datamap.py +31 -22
- {mapres-3.dev8 → mapres-3.dev9/src/mapres.egg-info}/PKG-INFO +1 -1
- {mapres-3.dev8 → mapres-3.dev9}/LICENSE +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/README.md +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/setup.cfg +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/__init__.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/ast.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/cache.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/evaluator.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/exceptions.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/layers.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/maps/__init__.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/maps/color.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/maps/time.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/parser.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/resolver.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres/tokenizer.py +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres.egg-info/SOURCES.txt +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres.egg-info/dependency_links.txt +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres.egg-info/requires.txt +0 -0
- {mapres-3.dev8 → mapres-3.dev9}/src/mapres.egg-info/top_level.txt +0 -0
|
@@ -27,14 +27,23 @@ class DataMap:
|
|
|
27
27
|
|
|
28
28
|
Syntax metadata (__syntax__) determines which delimiters
|
|
29
29
|
this map responds to (angle, brace, colon, percent, pipe, etc).
|
|
30
|
+
|
|
31
|
+
Mode metadata (__mode__) controls behavior:
|
|
32
|
+
- None: plain static map
|
|
33
|
+
- "dynamic": values may be provided by callables/providers
|
|
34
|
+
- "config": config-style maps (no dynamic evaluation)
|
|
35
|
+
- "callable": map exposes callable methods for nested calls
|
|
30
36
|
'''
|
|
31
37
|
__syntax__: str = None
|
|
32
|
-
__mode__: str | None = None # "dynamic", "config", or None
|
|
38
|
+
__mode__: str | None = None # "dynamic", "config", "callable", or None
|
|
33
39
|
|
|
34
40
|
def as_map(self):
|
|
35
41
|
'''
|
|
36
42
|
Convert datamap fields into a dictionary.
|
|
37
43
|
If mode='dynamic', evaluate provider functions.
|
|
44
|
+
|
|
45
|
+
Callable mode does NOT change as_map() behavior; methods are
|
|
46
|
+
used by the evaluator, not exported as map entries.
|
|
38
47
|
'''
|
|
39
48
|
result = {}
|
|
40
49
|
|
|
@@ -59,15 +68,7 @@ class DataMap:
|
|
|
59
68
|
|
|
60
69
|
# main decorator factory
|
|
61
70
|
def datamap(_cls=None, *, syntax=None, mode=None):
|
|
62
|
-
'''
|
|
63
|
-
@datamap decorator.
|
|
64
|
-
|
|
65
|
-
Supports:
|
|
66
|
-
@datamap
|
|
67
|
-
@datamap(mode='dynamic')
|
|
68
|
-
@datamap(syntax='angle')
|
|
69
|
-
@datamap(syntax='angle', mode='config')
|
|
70
|
-
'''
|
|
71
|
+
'''@datamap decorator'''
|
|
71
72
|
def wrap(cls):
|
|
72
73
|
cls.__syntax__ = syntax
|
|
73
74
|
cls.__mode__ = mode
|
|
@@ -90,6 +91,8 @@ class _SyntaxFactory:
|
|
|
90
91
|
@datamap.angles
|
|
91
92
|
@datamap.angles(mode='config')
|
|
92
93
|
@datamap.angles.config
|
|
94
|
+
@datamap.angles.dynamic
|
|
95
|
+
@datamap.angles.callable
|
|
93
96
|
'''
|
|
94
97
|
def __init__(self, syntax_name):
|
|
95
98
|
self._syntax = syntax_name
|
|
@@ -106,24 +109,30 @@ class _SyntaxFactory:
|
|
|
106
109
|
def config(self):
|
|
107
110
|
# Case 3: @datamap.angles.config
|
|
108
111
|
return datamap(syntax=self._syntax, mode='config')
|
|
109
|
-
|
|
112
|
+
|
|
110
113
|
@property
|
|
111
114
|
def dynamic(self):
|
|
115
|
+
# @datamap.angles.dynamic
|
|
112
116
|
return datamap(syntax=self._syntax, mode='dynamic')
|
|
113
117
|
|
|
118
|
+
@property
|
|
119
|
+
def callable(self):
|
|
120
|
+
# @datamap.angles.callable
|
|
121
|
+
return datamap(syntax=self._syntax, mode='callable')
|
|
114
122
|
|
|
115
123
|
|
|
116
124
|
# build syntax shortcuts
|
|
117
|
-
datamap.braces
|
|
118
|
-
|
|
119
|
-
datamap.
|
|
120
|
-
datamap.
|
|
121
|
-
datamap.
|
|
122
|
-
datamap.
|
|
123
|
-
datamap.
|
|
124
|
-
datamap.
|
|
125
|
-
datamap.hash_tags = _SyntaxFactory(syntax.hash_tags)
|
|
125
|
+
datamap.braces = _SyntaxFactory(syntax.braces)
|
|
126
|
+
datamap.dollars = _SyntaxFactory(syntax.dollars)
|
|
127
|
+
datamap.angles = _SyntaxFactory(syntax.angles)
|
|
128
|
+
datamap.percents = _SyntaxFactory(syntax.percents)
|
|
129
|
+
datamap.pipes = _SyntaxFactory(syntax.pipes)
|
|
130
|
+
datamap.colons = _SyntaxFactory(syntax.colons)
|
|
131
|
+
datamap.at_tags = _SyntaxFactory(syntax.at_tags)
|
|
132
|
+
datamap.hash_tags = _SyntaxFactory(syntax.hash_tags)
|
|
126
133
|
datamap.paren_dollars = _SyntaxFactory(syntax.paren_dollars)
|
|
127
134
|
|
|
128
|
-
# global mode
|
|
129
|
-
datamap.config
|
|
135
|
+
# global mode shortcuts
|
|
136
|
+
datamap.config = datamap(mode='config')
|
|
137
|
+
datamap.dynamic = datamap(mode='dynamic')
|
|
138
|
+
datamap.callable = datamap(mode='callable')
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|