mapres 2.2.1__tar.gz → 2.3__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.2.1/src/mapres.egg-info → mapres-2.3}/PKG-INFO +1 -1
- {mapres-2.2.1 → mapres-2.3}/pyproject.toml +1 -1
- {mapres-2.2.1 → mapres-2.3}/src/mapres/datamap.py +7 -1
- {mapres-2.2.1 → mapres-2.3}/src/mapres/resolver.py +6 -1
- {mapres-2.2.1 → mapres-2.3/src/mapres.egg-info}/PKG-INFO +1 -1
- {mapres-2.2.1 → mapres-2.3}/LICENSE +0 -0
- {mapres-2.2.1 → mapres-2.3}/README.md +0 -0
- {mapres-2.2.1 → mapres-2.3}/setup.cfg +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres/__init__.py +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres/cache.py +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres/exceptions.py +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres/layers.py +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres/maps/__init__.py +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres/maps/color.py +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres/maps/time.py +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres.egg-info/SOURCES.txt +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres.egg-info/dependency_links.txt +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres.egg-info/requires.txt +0 -0
- {mapres-2.2.1 → mapres-2.3}/src/mapres.egg-info/top_level.txt +0 -0
|
@@ -33,6 +33,7 @@ class DataMap:
|
|
|
33
33
|
def get_syntax(cls):
|
|
34
34
|
return getattr(cls, "__syntax__", syntax.braces)
|
|
35
35
|
|
|
36
|
+
|
|
36
37
|
# decorator
|
|
37
38
|
def datamap(
|
|
38
39
|
_cls = None,
|
|
@@ -46,7 +47,12 @@ def datamap(
|
|
|
46
47
|
cls.__mode__ = mode
|
|
47
48
|
namespace = dict(cls.__dict__)
|
|
48
49
|
namespace["__dict__"] = {}
|
|
50
|
+
# preserve any rules class defined in the original namespace by attaching it to the generated class
|
|
51
|
+
rules_obj = namespace.get("rules", None)
|
|
49
52
|
cls = type(cls.__name__, (DataMap,), namespace)
|
|
53
|
+
# attach rules (if present) to the new class so validators can read them via the datamap class
|
|
54
|
+
if rules_obj is not None:
|
|
55
|
+
setattr(cls, "rules", rules_obj)
|
|
50
56
|
return dataclass(frozen=False)(cls)
|
|
51
57
|
return wrap if _cls is None else wrap(_cls)
|
|
52
58
|
|
|
@@ -55,4 +61,4 @@ def datamap(
|
|
|
55
61
|
datamap.braces = datamap(syntax=syntax.braces)
|
|
56
62
|
datamap.angles = datamap(syntax=syntax.angles)
|
|
57
63
|
datamap.dollars = datamap(syntax=syntax.dollars)
|
|
58
|
-
datamap.percents = datamap(syntax=syntax.percents)
|
|
64
|
+
datamap.percents = datamap(syntax=syntax.percents)
|
|
@@ -88,7 +88,12 @@ class MapResolver:
|
|
|
88
88
|
continue
|
|
89
89
|
if k in d:
|
|
90
90
|
return str(d[k])
|
|
91
|
-
|
|
91
|
+
|
|
92
|
+
if k in ctx:
|
|
93
|
+
return str(ctx[k])
|
|
94
|
+
|
|
95
|
+
raise MissingKeyError(f"Missing key '{k}' in any layer or context")
|
|
96
|
+
|
|
92
97
|
try:
|
|
93
98
|
text = re.sub(pattern, repl, text)
|
|
94
99
|
except re.error as exc:
|
|
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
|