mapres 2.4a9__tar.gz → 2.4a10__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapres
3
- Version: 2.4a9
3
+ Version: 2.4a10
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 = "2.4-alpha.9"
10
+ version = "2.4-alpha.10"
11
11
  description = "A powerfull mapping utility"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.9"
@@ -52,12 +52,8 @@ def datamap(_cls=None, *, syntax=syntax.double_braces, mode=None):
52
52
  if rules_obj is not None:
53
53
  setattr(cls, 'rules', rules_obj)
54
54
  return dataclass(frozen=False)(cls)
55
-
56
- # direct decorator: @datamap(...)
57
55
  if _cls is not None:
58
56
  return wrap(_cls)
59
-
60
- # factory: @datamap(...)
61
57
  return wrap
62
58
 
63
59
 
@@ -66,13 +62,17 @@ class _SyntaxFactory:
66
62
  def __init__(self, syntax_value):
67
63
  self._syntax = syntax_value
68
64
 
69
- def __call__(self, **kwargs):
70
- # allows: @datamap.double_braces(mode='config')
65
+ def __call__(self, _cls=None, **kwargs):
66
+ # Case 1: bare decorator: @datamap.colons
67
+ if _cls is not None and isinstance(_cls, type):
68
+ return datamap(_cls, syntax=self._syntax)
69
+
70
+ # Case 2: decorator with args: @datamap.colons(mode='config')
71
71
  return datamap(syntax=self._syntax, **kwargs)
72
72
 
73
73
  @property
74
74
  def config(self):
75
- # allows: @datamap.double_braces.config
75
+ # Case 3: @datamap.colons.config
76
76
  return datamap(syntax=self._syntax, mode='config')
77
77
 
78
78
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapres
3
- Version: 2.4a9
3
+ Version: 2.4a10
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
File without changes
File without changes
File without changes