GeneralManager 0.6.0__py3-none-any.whl → 0.6.1__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.
- general_manager/bucket/calculationBucket.py +19 -16
- general_manager/interface/calculationInterface.py +12 -11
- {generalmanager-0.6.0.dist-info → generalmanager-0.6.1.dist-info}/METADATA +1 -1
- {generalmanager-0.6.0.dist-info → generalmanager-0.6.1.dist-info}/RECORD +7 -7
- {generalmanager-0.6.0.dist-info → generalmanager-0.6.1.dist-info}/WHEEL +0 -0
- {generalmanager-0.6.0.dist-info → generalmanager-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {generalmanager-0.6.0.dist-info → generalmanager-0.6.1.dist-info}/top_level.txt +0 -0
@@ -151,15 +151,15 @@ class CalculationBucket(Bucket[GeneralManagerType]):
|
|
151
151
|
|
152
152
|
def __repr__(self) -> str:
|
153
153
|
"""
|
154
|
-
Returns a string representation of the CalculationBucket,
|
154
|
+
Returns a concise string representation of the CalculationBucket, including the manager class name, filters, excludes, sort key, and sort order.
|
155
155
|
"""
|
156
|
-
return self.
|
156
|
+
return f"{self.__class__.__name__}({self._manager_class.__name__}, {self.filters}, {self.excludes}, {self.sort_key}, {self.reverse})"
|
157
157
|
|
158
158
|
def filter(self, **kwargs: Any) -> CalculationBucket:
|
159
159
|
"""
|
160
|
-
Returns a new CalculationBucket with additional filters applied
|
161
|
-
|
162
|
-
|
160
|
+
Returns a new CalculationBucket with additional filters applied.
|
161
|
+
|
162
|
+
Merges the provided filter criteria with existing filters to further restrict valid input combinations.
|
163
163
|
"""
|
164
164
|
filters = self.filters.copy()
|
165
165
|
excludes = self.excludes.copy()
|
@@ -315,42 +315,45 @@ class CalculationBucket(Bucket[GeneralManagerType]):
|
|
315
315
|
excludes: dict[str, dict],
|
316
316
|
) -> List[dict[str, Any]]:
|
317
317
|
"""
|
318
|
-
Recursively generates all valid input combinations
|
319
|
-
|
318
|
+
Recursively generates all valid input combinations for the specified input fields, applying filters and exclusions.
|
319
|
+
|
320
320
|
Args:
|
321
|
-
sorted_inputs:
|
322
|
-
filters:
|
323
|
-
excludes:
|
324
|
-
|
321
|
+
sorted_inputs: Input field names ordered to respect dependency constraints.
|
322
|
+
filters: Mapping of input field names to filter definitions.
|
323
|
+
excludes: Mapping of input field names to exclusion definitions.
|
324
|
+
|
325
325
|
Returns:
|
326
|
-
A list of dictionaries, each representing a valid combination of input values.
|
326
|
+
A list of dictionaries, each representing a valid combination of input values that satisfy all filters and exclusions.
|
327
327
|
"""
|
328
328
|
|
329
329
|
def helper(index, current_combo):
|
330
|
+
"""
|
331
|
+
Recursively generates all valid input combinations for calculation inputs.
|
332
|
+
|
333
|
+
Yields:
|
334
|
+
Dict[str, Any]: A dictionary representing a valid combination of input values, filtered and excluded according to the provided criteria.
|
335
|
+
"""
|
330
336
|
if index == len(sorted_inputs):
|
331
337
|
yield current_combo.copy()
|
332
338
|
return
|
333
339
|
input_name: str = sorted_inputs[index]
|
334
340
|
input_field = self.input_fields[input_name]
|
335
341
|
|
336
|
-
# Hole mögliche Werte
|
337
342
|
possible_values = self.get_possible_values(
|
338
343
|
input_name, input_field, current_combo
|
339
344
|
)
|
340
345
|
|
341
|
-
# Wende die Filter an
|
342
346
|
field_filters = filters.get(input_name, {})
|
343
347
|
field_excludes = excludes.get(input_name, {})
|
344
348
|
|
349
|
+
# use filter_funcs and exclude_funcs to filter possible values
|
345
350
|
if isinstance(possible_values, Bucket):
|
346
|
-
# Wende die Filter- und Exklusionsargumente direkt an
|
347
351
|
filter_kwargs = field_filters.get("filter_kwargs", {})
|
348
352
|
exclude_kwargs = field_excludes.get("filter_kwargs", {})
|
349
353
|
possible_values = possible_values.filter(**filter_kwargs).exclude(
|
350
354
|
**exclude_kwargs
|
351
355
|
)
|
352
356
|
else:
|
353
|
-
# Wende die Filterfunktionen an
|
354
357
|
filter_funcs = field_filters.get("filter_funcs", [])
|
355
358
|
for filter_func in filter_funcs:
|
356
359
|
possible_values = filter(filter_func, possible_values)
|
@@ -61,7 +61,15 @@ class CalculationInterface(InterfaceBase):
|
|
61
61
|
def _preCreate(
|
62
62
|
name: generalManagerClassName, attrs: attributes, interface: interfaceBaseClass
|
63
63
|
) -> tuple[attributes, interfaceBaseClass, None]:
|
64
|
-
|
64
|
+
|
65
|
+
"""
|
66
|
+
Prepares attributes and a new interface class before creating a GeneralManager class.
|
67
|
+
|
68
|
+
Collects all `Input` instances from the provided interface class, sets the interface type in the attributes, dynamically creates a new interface class with these input fields, and adds it to the attributes.
|
69
|
+
|
70
|
+
Returns:
|
71
|
+
A tuple containing the updated attributes dictionary, the new interface class, and None.
|
72
|
+
"""
|
65
73
|
input_fields: dict[str, Input[Any]] = {}
|
66
74
|
for key, value in vars(interface).items():
|
67
75
|
if key.startswith("__"):
|
@@ -69,7 +77,6 @@ class CalculationInterface(InterfaceBase):
|
|
69
77
|
if isinstance(value, Input):
|
70
78
|
input_fields[key] = value
|
71
79
|
|
72
|
-
# Interface-Typ bestimmen
|
73
80
|
attrs["_interface_type"] = interface._interface_type
|
74
81
|
interface_cls = type(
|
75
82
|
interface.__name__, (interface,), {"input_fields": input_fields}
|
@@ -102,18 +109,12 @@ class CalculationInterface(InterfaceBase):
|
|
102
109
|
@classmethod
|
103
110
|
def getFieldType(cls, field_name: str) -> type:
|
104
111
|
"""
|
105
|
-
Returns the type of
|
106
|
-
|
107
|
-
Args:
|
108
|
-
field_name: The name of the input field.
|
109
|
-
|
110
|
-
Returns:
|
111
|
-
The Python type associated with the input field.
|
112
|
+
Returns the Python type of a specified input field.
|
112
113
|
|
113
114
|
Raises:
|
114
|
-
|
115
|
+
KeyError: If the field name does not exist in input_fields.
|
115
116
|
"""
|
116
117
|
input = cls.input_fields.get(field_name)
|
117
118
|
if input is None:
|
118
|
-
raise
|
119
|
+
raise KeyError(f"Field '{field_name}' not found in input fields.")
|
119
120
|
return input.type
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: GeneralManager
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.1
|
4
4
|
Summary: Modular Django-based data management framework with ORM, GraphQL, fine-grained permissions, rule validation, calculations and caching.
|
5
5
|
Author-email: Tim Kleindick <tkleindick@yahoo.de>
|
6
6
|
License-Expression: MIT
|
@@ -11,7 +11,7 @@ general_manager/auxiliary/makeCacheKey.py,sha256=lczutqxlofLSUnheKRi8nazhOyPa04T
|
|
11
11
|
general_manager/auxiliary/noneToZero.py,sha256=KfQtMQnrT6vsYST0K7lv6pVujkDcK3XL8czHYOhgqKQ,539
|
12
12
|
general_manager/auxiliary/pathMapping.py,sha256=nrz5owQg2a69Yig1eCXorR9U0NSw7NmBAk5OkeoHTdA,6842
|
13
13
|
general_manager/bucket/baseBucket.py,sha256=65oQbSE6C8TE0yVPP_Aoi_Fwq0Uo2TLVPWMG6l2qxyQ,7836
|
14
|
-
general_manager/bucket/calculationBucket.py,sha256=
|
14
|
+
general_manager/bucket/calculationBucket.py,sha256=c4p4QBV6PVYi1sxM8iReZ2YQtMmD8q5uPXXwkgCX6fQ,18467
|
15
15
|
general_manager/bucket/databaseBucket.py,sha256=V_xiPa8ErnPHVh_-i-oaH8qCa818UJxm5CVl80SVc1U,9060
|
16
16
|
general_manager/bucket/groupBucket.py,sha256=55QdUaH_qO1JFJ2Jc1f2WcxniiLE5LB3vNwbnksKk8A,10939
|
17
17
|
general_manager/cache/cacheDecorator.py,sha256=DK2ANIJgPpMxazfMSiFrI9OuVE_7K9zlIZQRrgaC2Lw,3268
|
@@ -25,7 +25,7 @@ general_manager/factory/factories.py,sha256=F6_nYFyJRYYc3LQApfoVFdctfLzsWUDHKafn
|
|
25
25
|
general_manager/factory/factoryMethods.py,sha256=9Bag891j0XHe3dUBAFi7gUKcKeUwcBZN3cDLBobyBiI,3225
|
26
26
|
general_manager/interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
27
|
general_manager/interface/baseInterface.py,sha256=b7MH-jVADcpGluvJMogPn2O3Yiy37uCnWOM9j0Ec0o0,8692
|
28
|
-
general_manager/interface/calculationInterface.py,sha256=
|
28
|
+
general_manager/interface/calculationInterface.py,sha256=Kg_OqLw67tcLwdzYNLq31eKVLzkM7taw-8Mzmk0CYi0,4232
|
29
29
|
general_manager/interface/databaseBasedInterface.py,sha256=K2PYxANuLQU8wzrajcl922tuWwko642KJAS3f3PnAmg,21566
|
30
30
|
general_manager/interface/databaseInterface.py,sha256=rQWeL5u_WCvDtikXLracFkECVM9vZHjs7UXTJlDDCmY,4146
|
31
31
|
general_manager/interface/readOnlyInterface.py,sha256=d2CM2gj5XZNEaVFZeNCgqZf46rwUAetVS3SyePCKNsY,4691
|
@@ -46,8 +46,8 @@ general_manager/permission/permissionDataManager.py,sha256=Ji7fsnuaKTa6M8yzCGyzr
|
|
46
46
|
general_manager/rule/__init__.py,sha256=4Har5cfPD1fmOsilTDod-ZUz3Com-tkl58jz7yY4fD0,23
|
47
47
|
general_manager/rule/handler.py,sha256=z8SFHTIZ0LbLh3fV56Mud0V4_OvWkqJjlHvFqau7Qfk,7334
|
48
48
|
general_manager/rule/rule.py,sha256=3FVCKGL7BTVoStdgOTdWQwuoVRIxAIAilV4VOzouDpc,10759
|
49
|
-
generalmanager-0.6.
|
50
|
-
generalmanager-0.6.
|
51
|
-
generalmanager-0.6.
|
52
|
-
generalmanager-0.6.
|
53
|
-
generalmanager-0.6.
|
49
|
+
generalmanager-0.6.1.dist-info/licenses/LICENSE,sha256=YGFm0ieb4KpkMRRt2qnWue6uFh0cUMtobwEBkHwajhc,1450
|
50
|
+
generalmanager-0.6.1.dist-info/METADATA,sha256=R3oRDo5hyUA5XaBYhYi0CNPfriK7wXjCgEbw_5BDsiQ,6205
|
51
|
+
generalmanager-0.6.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
52
|
+
generalmanager-0.6.1.dist-info/top_level.txt,sha256=sTDtExP9ga-YP3h3h42yivUY-A2Q23C2nw6LNKOho4I,16
|
53
|
+
generalmanager-0.6.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|