mapres 3.dev11__tar.gz → 3.dev13__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.
Files changed (23) hide show
  1. {mapres-3.dev11/src/mapres.egg-info → mapres-3.dev13}/PKG-INFO +1 -1
  2. {mapres-3.dev11 → mapres-3.dev13}/pyproject.toml +1 -1
  3. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/datamap.py +1 -1
  4. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/resolver.py +2 -0
  5. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/tokenizer.py +10 -27
  6. {mapres-3.dev11 → mapres-3.dev13/src/mapres.egg-info}/PKG-INFO +1 -1
  7. {mapres-3.dev11 → mapres-3.dev13}/LICENSE +0 -0
  8. {mapres-3.dev11 → mapres-3.dev13}/README.md +0 -0
  9. {mapres-3.dev11 → mapres-3.dev13}/setup.cfg +0 -0
  10. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/__init__.py +0 -0
  11. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/ast.py +0 -0
  12. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/cache.py +0 -0
  13. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/evaluator.py +0 -0
  14. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/exceptions.py +0 -0
  15. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/layers.py +0 -0
  16. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/maps/__init__.py +0 -0
  17. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/maps/color.py +0 -0
  18. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/maps/time.py +0 -0
  19. {mapres-3.dev11 → mapres-3.dev13}/src/mapres/parser.py +0 -0
  20. {mapres-3.dev11 → mapres-3.dev13}/src/mapres.egg-info/SOURCES.txt +0 -0
  21. {mapres-3.dev11 → mapres-3.dev13}/src/mapres.egg-info/dependency_links.txt +0 -0
  22. {mapres-3.dev11 → mapres-3.dev13}/src/mapres.egg-info/requires.txt +0 -0
  23. {mapres-3.dev11 → mapres-3.dev13}/src/mapres.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapres
3
- Version: 3.dev11
3
+ Version: 3.dev13
4
4
  Summary: A powerfull mapping utility
5
5
  Author: iFamished
6
6
  License: MIT
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "mapres"
10
- version = "3-dev.11"
10
+ version = "3-dev.13"
11
11
  description = "A powerfull mapping utility"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.9"
@@ -78,7 +78,7 @@ def datamap(_cls=None, *, syntax=None, mode=None):
78
78
  cls = type(cls.__name__, (DataMap,), namespace)
79
79
  if rules_obj is not None:
80
80
  setattr(cls, 'rules', rules_obj)
81
- return dataclass(frozen=False)(cls)
81
+ return dataclass(frozen=False)(cls)()
82
82
  if _cls is not None:
83
83
  return wrap(_cls)
84
84
  return wrap
@@ -104,6 +104,8 @@ def setGlobalMaps(maps, *, priority=0):
104
104
  Register a global map or datamap instance/class/dict.
105
105
  Lower priority = earlier lookup.
106
106
  """
107
+ if isinstance(maps, type):
108
+ maps = maps()
107
109
  _DEFAULT_RESOLVER.layers.add_layer(maps, priority=priority)
108
110
 
109
111
  def res(text: str, **ctx) -> str:
@@ -4,25 +4,18 @@ from enum import Enum, auto
4
4
  class TokenType(Enum):
5
5
  TEXT = auto()
6
6
  IDENT = auto()
7
-
8
7
  COLON_OPEN = auto()
9
8
  COLON_CLOSE = auto()
10
-
11
9
  BRACE_OPEN = auto()
12
10
  BRACE_CLOSE = auto()
13
-
14
11
  DOLLAR_OPEN = auto()
15
12
  DOLLAR_CLOSE = auto()
16
-
17
13
  ANGLE_OPEN = auto()
18
14
  ANGLE_CLOSE = auto()
19
-
20
15
  PIPE_OPEN = auto()
21
16
  PIPE_CLOSE = auto()
22
-
23
17
  PERCENT_OPEN = auto()
24
18
  PERCENT_CLOSE = auto()
25
-
26
19
  LPAREN = auto()
27
20
  RPAREN = auto()
28
21
 
@@ -45,12 +38,9 @@ class Tokenizer:
45
38
  self.i = 0
46
39
  self.n = len(text)
47
40
  self.tokens = []
48
-
49
- # state for single-char paired delimiters
50
41
  self.in_pipe = False
51
42
  self.in_percent = False
52
43
  self.in_colon = False
53
- self.escaped = False
54
44
 
55
45
  def peek(self, k=0):
56
46
  idx = self.i + k
@@ -78,33 +68,26 @@ class Tokenizer:
78
68
  while self.i < self.n:
79
69
  ch = self.peek()
80
70
 
81
- # ESCAPES
82
71
  if self.match(r'\:'):
83
- buf.append(':'); self.advance(2); self.escaped = True; continue
72
+ buf.append(':'); self.advance(2); continue
84
73
  if self.match(r'\<'):
85
- buf.append('<'); self.advance(2); self.escaped = True; continue
74
+ buf.append('<'); self.advance(2); continue
86
75
  if self.match(r'\>'):
87
- buf.append('>'); self.advance(2); self.escaped = True; continue
76
+ buf.append('>'); self.advance(2); continue
88
77
  if self.match(r'\%'):
89
- buf.append('%'); self.advance(2); self.escaped = True; continue
78
+ buf.append('%'); self.advance(2); continue
90
79
  if self.match(r'\$'):
91
- buf.append('$'); self.advance(2); self.escaped = True; continue
80
+ buf.append('$'); self.advance(2); continue
92
81
  if self.match(r'\{'):
93
- buf.append('{'); self.advance(2); self.escaped = True; continue
82
+ buf.append('{'); self.advance(2); continue
94
83
  if self.match(r'\}'):
95
- buf.append('}'); self.advance(2); self.escaped = True; continue
84
+ buf.append('}'); self.advance(2); continue
96
85
  if self.match(r'\|'):
97
- buf.append('|'); self.advance(2); self.escaped = True; continue
86
+ buf.append('|'); self.advance(2); continue
98
87
  if self.match(r'\('):
99
- buf.append('('); self.advance(2); self.escaped = True; continue
88
+ buf.append('('); self.advance(2); continue
100
89
  if self.match(r'\)'):
101
- buf.append(')'); self.advance(2); self.escaped = True; continue
102
-
103
- if self.escaped:
104
- buf.append(ch)
105
- self.escaped = False
106
- self.advance()
107
- continue
90
+ buf.append(')'); self.advance(2); continue
108
91
 
109
92
  if self.match("{{"):
110
93
  flush_text()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapres
3
- Version: 3.dev11
3
+ Version: 3.dev13
4
4
  Summary: A powerfull mapping utility
5
5
  Author: iFamished
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes