GeneralManager 0.10.3__py3-none-any.whl → 0.10.4__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.
@@ -18,7 +18,7 @@ class _nonExistent:
18
18
 
19
19
  class GeneralManagerMeta(type):
20
20
  all_classes: list[Type[GeneralManager]] = []
21
- read_only_classes: list[Type[GeneralManager[Any, ReadOnlyInterface]]] = []
21
+ read_only_classes: list[Type[GeneralManager]] = []
22
22
  pending_graphql_interfaces: list[Type[GeneralManager]] = []
23
23
  pending_attribute_initialization: list[Type[GeneralManager]] = []
24
24
  Interface: type[InterfaceBase]
@@ -70,20 +70,24 @@ class GeneralManagerMeta(type):
70
70
  attributes: Iterable[str], new_class: Type[GeneralManager]
71
71
  ):
72
72
  """
73
- Dynamically assigns property descriptors to a class for each specified attribute name.
74
-
75
- For each attribute, creates a descriptor that:
76
- - Returns the field type from the class's interface when accessed on the class.
73
+ Dynamically creates and assigns property descriptors to a class for each given attribute name.
74
+
75
+ For each attribute, adds a property to the class that:
76
+ - Returns the field type from the class's interface when accessed on the class itself.
77
77
  - Retrieves the value from the instance's `_attributes` dictionary when accessed on an instance.
78
- - Invokes the attribute with the instance's interface if it is callable.
78
+ - If the attribute value is callable, invokes it with the instance's interface and returns the result.
79
79
  - Raises `AttributeError` if the attribute is missing or if an error occurs during callable invocation.
80
+
81
+ Parameters:
82
+ attributes (Iterable[str]): Names of attributes for which to create property descriptors.
83
+ new_class (Type[GeneralManager]): The class to which the properties will be added.
80
84
  """
81
85
 
82
86
  def desciptorMethod(attr_name: str, new_class: type):
83
87
  """
84
- Creates a property descriptor for an attribute, enabling dynamic access and callable resolution.
85
-
86
- When accessed on the class, returns the field type from the associated interface. When accessed on an instance, retrieves the attribute value from the instance's `_attributes` dictionary, invoking it with the instance's interface if the value is callable. Raises `AttributeError` if the attribute is missing or if a callable attribute raises an exception.
88
+ Create a property descriptor for dynamic attribute access and callable resolution.
89
+
90
+ When accessed on the class, returns the field type from the class's associated interface. When accessed on an instance, retrieves the attribute value from the instance's `_attributes` dictionary; if the value is callable, it is invoked with the instance's interface. Raises `AttributeError` if the attribute is missing or if a callable attribute raises an exception.
87
91
  """
88
92
 
89
93
  class Descriptor(Generic[GeneralManagerType]):
@@ -93,9 +97,14 @@ class GeneralManagerMeta(type):
93
97
 
94
98
  def __get__(
95
99
  self,
96
- instance: GeneralManager[GeneralManagerType, InterfaceBase] | None,
100
+ instance: GeneralManagerType | None,
97
101
  owner: type | None = None,
98
102
  ):
103
+ """
104
+ Retrieve the value of a dynamically defined attribute from an instance or its interface.
105
+
106
+ When accessed on the class, returns the field type from the associated interface. When accessed on an instance, retrieves the attribute value from the instance's `_attributes` dictionary. If the attribute is callable, it is invoked with the instance's interface. Raises `AttributeError` if the attribute is missing or if a callable attribute raises an exception.
107
+ """
99
108
  if instance is None:
100
109
  return self.new_class.Interface.getFieldType(self.attr_name)
101
110
  attribute = instance._attributes.get(attr_name, _nonExistent)
@@ -19,9 +19,20 @@ class MeasurementField(models.Field): # type: ignore
19
19
  null: bool = False,
20
20
  blank: bool = False,
21
21
  editable: bool = True,
22
- *args: list[Any],
23
- **kwargs: dict[str, Any],
22
+ *args: Any,
23
+ **kwargs: Any,
24
24
  ):
25
+ """
26
+ Initialize a MeasurementField to store values in a specified base unit and retain the original unit.
27
+
28
+ Parameters:
29
+ base_unit (str): The canonical unit in which values are stored (e.g., 'meter').
30
+ null (bool, optional): Whether the field allows NULL values.
31
+ blank (bool, optional): Whether the field allows blank values.
32
+ editable (bool, optional): Whether the field is editable in Django admin and forms.
33
+
34
+ The field internally manages a DecimalField for the value (in the base unit) and a CharField for the original unit.
35
+ """
25
36
  self.base_unit = base_unit # E.g., 'meter' for length units
26
37
  # Determine the dimensionality of the base unit
27
38
  self.base_dimension = ureg.parse_expression(self.base_unit).dimensionality
@@ -45,8 +56,13 @@ class MeasurementField(models.Field): # type: ignore
45
56
  super().__init__(null=null, blank=blank, *args, **kwargs)
46
57
 
47
58
  def contribute_to_class(
48
- self, cls: type, name: str, private_only: bool = False, **kwargs: dict[str, Any]
59
+ self, cls: type, name: str, private_only: bool = False, **kwargs: Any
49
60
  ) -> None:
61
+ """
62
+ Integrates the MeasurementField into the Django model class, setting up internal fields for value and unit storage.
63
+
64
+ This method assigns unique attribute names for the value and unit fields, attaches them to the model, and sets the descriptor for the custom field on the model class.
65
+ """
50
66
  self.name = name
51
67
  self.value_attr = f"{name}_value"
52
68
  self.unit_attr = f"{name}_unit"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GeneralManager
3
- Version: 0.10.3
3
+ Version: 0.10.4
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
@@ -1,36 +1,36 @@
1
1
  general_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- general_manager/apps.py,sha256=dNzdcOTLs53y7JAGjQ7rqY1VWLtwO43NTTGJhbmbq1s,9906
3
- general_manager/api/graphql.py,sha256=ZMzlpgmyn2X9Zwxo12r-b5UZ2R-u1pXys_nhNczxyX8,31622
2
+ general_manager/apps.py,sha256=ii-48klC2kBRjxtdQU9-RtPq66lZ8fDa7BmqyH-mbzk,9904
3
+ general_manager/api/graphql.py,sha256=N7UbhLA2RGfzE8GCt8Ld_sQ-yiQTxAAnO0Qt8nBLWlg,31171
4
4
  general_manager/api/mutation.py,sha256=RvKp4OnV70q4Dqmu407Cd0FXgD12WdbRgzYCS4qd_bg,5990
5
5
  general_manager/api/property.py,sha256=oc93p1P8dcIvrNorRuqD1EJVsd6eYttYhZuAS0s28gs,696
6
- general_manager/bucket/baseBucket.py,sha256=eZZcSiOfmSz9AiGczO9qIkcKML0swWRoef7g_fqgiPo,7776
7
- general_manager/bucket/calculationBucket.py,sha256=Ae1HauVFz_CwEAqR3TM9cK6C8uhGwG2DuY2A3UQJ-Go,18590
8
- general_manager/bucket/databaseBucket.py,sha256=g34SdOW_fyFmYToXsD-bSGTAgQKECfGPe_XNWxrWfNY,9243
6
+ general_manager/bucket/baseBucket.py,sha256=UjEai7cVxgDJysoVY2-7s3YULW7bi-sx2mPqRKFWyTw,7728
7
+ general_manager/bucket/calculationBucket.py,sha256=a41YVdfhxKf_gpWlRKjXYmS1YuO-6VC0hn60RyLKByU,18777
8
+ general_manager/bucket/databaseBucket.py,sha256=Rfgh81BZoQk4Ng4DG34edf0CZP2SJrFy59sKpBR8VUM,9179
9
9
  general_manager/bucket/groupBucket.py,sha256=PGmYh7cg9oC-wcY33krHVhwjpUvSH3slCamwvdT87H8,10951
10
10
  general_manager/cache/cacheDecorator.py,sha256=XQvs322lDDafecS6osPKmf7DyuZgDq8kuQaYpMeXXYg,3264
11
11
  general_manager/cache/cacheTracker.py,sha256=rRw3OhBDf86hTC2Xbt1ocRgZqwu8_kXk4lczamcADFg,2955
12
12
  general_manager/cache/dependencyIndex.py,sha256=lxD7IfnWVsBNt9l0_yDfJlHDRHAFC7N7p-Typ2tJp88,11044
13
13
  general_manager/cache/modelDependencyCollector.py,sha256=S4jzH7qLfqiTRAgqM-CnsC1f3YOgoKCEvMXnQu2R3Eo,2439
14
- general_manager/cache/signals.py,sha256=ZHeXKFMN7tj9t0J-vSqf_05_NhGqEF2sZtbZO3vaRqI,1234
14
+ general_manager/cache/signals.py,sha256=WolIvusPjGaIomOelYCmY6HyaiMyWLVAaQ1iF_D955g,2272
15
15
  general_manager/factory/__init__.py,sha256=wbPIGyBlWBHa7aGWUd-1IUMPWUS-M6YqtPUL1iKXW8U,93
16
- general_manager/factory/autoFactory.py,sha256=WBhSuMVsxkPAPLhlZhYXwHVIqiomUveS7vMxw1ON_8Q,9376
17
- general_manager/factory/factories.py,sha256=F6_nYFyJRYYc3LQApfoVFdctfLzsWUDHKafn6xjckB8,7224
16
+ general_manager/factory/autoFactory.py,sha256=Lf3E9qi3mggIGK6ww_JxdZbK5BzWPWIEMvtFfNa3gUo,9776
17
+ general_manager/factory/factories.py,sha256=cJEV79SRHNNqtBXgE0ix5KOxdAkmPmq_8YlwJ_IJ_CM,8295
18
18
  general_manager/factory/factoryMethods.py,sha256=9Bag891j0XHe3dUBAFi7gUKcKeUwcBZN3cDLBobyBiI,3225
19
19
  general_manager/interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- general_manager/interface/baseInterface.py,sha256=IWEtY--IuFiB3cjrCgtyXBTMpAPTayiFDnRQY7JZeaw,8600
20
+ general_manager/interface/baseInterface.py,sha256=cFsDU-nhj_O6Gir3eO0ukGKNn9Pplhe6gEMccHNi4O0,8648
21
21
  general_manager/interface/calculationInterface.py,sha256=Kg_OqLw67tcLwdzYNLq31eKVLzkM7taw-8Mzmk0CYi0,4232
22
- general_manager/interface/databaseBasedInterface.py,sha256=fm5G-AVuTzAa59YwQRiFRGvy-DqsZZ3AfIBG9mls4sg,20398
22
+ general_manager/interface/databaseBasedInterface.py,sha256=_E4HoHmU8A_5_voSpeGp8AkiWbHGF3ZY1zO9phIezh8,21647
23
23
  general_manager/interface/databaseInterface.py,sha256=rhKVXhg0ztdIxKikTWtgjrkA7cwZTOYlEsRh0RWajDQ,6732
24
24
  general_manager/interface/models.py,sha256=gGYW5f1AUBpBakV3O0qsZwqMiWxZGdKRYXWaCBjt1oI,3334
25
25
  general_manager/interface/readOnlyInterface.py,sha256=TkfbOeaa2wCq5kCv0a3IwJWcYOTVbtNsdNWmGAz0Mns,11217
26
26
  general_manager/manager/__init__.py,sha256=l3RYp62aEhj3Y975_XUTIzo35LUnkTJHkb_hgChnXXI,111
27
- general_manager/manager/generalManager.py,sha256=jzLLAZTKgUOrzzOTXiWQsYj0FQk6Md8ggIQz0ie44qo,8793
27
+ general_manager/manager/generalManager.py,sha256=24eRdJW8BYPchYySxFNMywwk9LOhrab5Y4QiQWXZWT8,8730
28
28
  general_manager/manager/groupManager.py,sha256=8dpZUfm7aFL4lraUWv4qbbDRClQZaYxw4prclhBZYZs,4367
29
29
  general_manager/manager/input.py,sha256=-pJXGJ-g2-OxZfl4Buj3mQkf05fN4p8MsR2Lh9BQcEo,3208
30
- general_manager/manager/meta.py,sha256=EruJhpaYA1glWvb07HuTPAL919K3z7clU5_x2dG0ryA,5585
30
+ general_manager/manager/meta.py,sha256=-9celpo-oZmkTb8TnHfvcd_4XWTy1cn2UO-jp13NFmQ,6387
31
31
  general_manager/measurement/__init__.py,sha256=X97meFujBldE5v0WMF7SmKeGpC5R0JTczfLo_Lq1Xek,84
32
32
  general_manager/measurement/measurement.py,sha256=emd1z3IDClK7nrIrUL_JXPxNhJEq2HnXq6qNYv9ubcM,16090
33
- general_manager/measurement/measurementField.py,sha256=iq9Hqe6ZGX8CxXm4nIqTAWTRkQVptzpqE9ExX-jFyNs,5928
33
+ general_manager/measurement/measurementField.py,sha256=ixkZR_t--HGckK2iYi6sXOOa_Vbni4QRxK5Ngmy5YKc,6863
34
34
  general_manager/permission/__init__.py,sha256=5UlDERN60Vn8obGVkT-cOM8kHjzmoxgK5w5FgTCDhGE,59
35
35
  general_manager/permission/basePermission.py,sha256=14iKo6qVmaUdg1sAz-gSZyNtpVKAAapIhutVAMDf93c,6056
36
36
  general_manager/permission/fileBasedPermission.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -49,8 +49,8 @@ general_manager/utils/makeCacheKey.py,sha256=UlFsxHXgsYy69AAelkF6GDvY4h7AImT2bBn
49
49
  general_manager/utils/noneToZero.py,sha256=KfQtMQnrT6vsYST0K7lv6pVujkDcK3XL8czHYOhgqKQ,539
50
50
  general_manager/utils/pathMapping.py,sha256=nrz5owQg2a69Yig1eCXorR9U0NSw7NmBAk5OkeoHTdA,6842
51
51
  general_manager/utils/testing.py,sha256=ElZ8p4iZHxsHjDN8Lm5TmI6527CW747ltDOmtY6gAhk,11872
52
- generalmanager-0.10.3.dist-info/licenses/LICENSE,sha256=YGFm0ieb4KpkMRRt2qnWue6uFh0cUMtobwEBkHwajhc,1450
53
- generalmanager-0.10.3.dist-info/METADATA,sha256=nN3-3BbG3VNq_h5ONUpu4bmyNDslto9RxpSXbGW60so,6206
54
- generalmanager-0.10.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
- generalmanager-0.10.3.dist-info/top_level.txt,sha256=sTDtExP9ga-YP3h3h42yivUY-A2Q23C2nw6LNKOho4I,16
56
- generalmanager-0.10.3.dist-info/RECORD,,
52
+ generalmanager-0.10.4.dist-info/licenses/LICENSE,sha256=YGFm0ieb4KpkMRRt2qnWue6uFh0cUMtobwEBkHwajhc,1450
53
+ generalmanager-0.10.4.dist-info/METADATA,sha256=VC1eU13WK0cNkbOCrhOb7WK78u1E6ra_Xa71NsZ0TTA,6206
54
+ generalmanager-0.10.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
+ generalmanager-0.10.4.dist-info/top_level.txt,sha256=sTDtExP9ga-YP3h3h42yivUY-A2Q23C2nw6LNKOho4I,16
56
+ generalmanager-0.10.4.dist-info/RECORD,,