eventsourcing 9.2.22__py3-none-any.whl → 9.3.0__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.

Potentially problematic release.


This version of eventsourcing might be problematic. Click here for more details.

Files changed (144) hide show
  1. eventsourcing/__init__.py +1 -1
  2. eventsourcing/application.py +116 -135
  3. eventsourcing/cipher.py +15 -12
  4. eventsourcing/dispatch.py +31 -91
  5. eventsourcing/domain.py +220 -226
  6. eventsourcing/examples/__init__.py +0 -0
  7. eventsourcing/examples/aggregate1/__init__.py +0 -0
  8. eventsourcing/examples/aggregate1/application.py +27 -0
  9. eventsourcing/examples/aggregate1/domainmodel.py +16 -0
  10. eventsourcing/examples/aggregate1/test_application.py +37 -0
  11. eventsourcing/examples/aggregate2/__init__.py +0 -0
  12. eventsourcing/examples/aggregate2/application.py +27 -0
  13. eventsourcing/examples/aggregate2/domainmodel.py +22 -0
  14. eventsourcing/examples/aggregate2/test_application.py +37 -0
  15. eventsourcing/examples/aggregate3/__init__.py +0 -0
  16. eventsourcing/examples/aggregate3/application.py +27 -0
  17. eventsourcing/examples/aggregate3/domainmodel.py +38 -0
  18. eventsourcing/examples/aggregate3/test_application.py +37 -0
  19. eventsourcing/examples/aggregate4/__init__.py +0 -0
  20. eventsourcing/examples/aggregate4/application.py +27 -0
  21. eventsourcing/examples/aggregate4/domainmodel.py +114 -0
  22. eventsourcing/examples/aggregate4/test_application.py +38 -0
  23. eventsourcing/examples/aggregate5/__init__.py +0 -0
  24. eventsourcing/examples/aggregate5/application.py +27 -0
  25. eventsourcing/examples/aggregate5/domainmodel.py +131 -0
  26. eventsourcing/examples/aggregate5/test_application.py +38 -0
  27. eventsourcing/examples/aggregate6/__init__.py +0 -0
  28. eventsourcing/examples/aggregate6/application.py +30 -0
  29. eventsourcing/examples/aggregate6/domainmodel.py +123 -0
  30. eventsourcing/examples/aggregate6/test_application.py +38 -0
  31. eventsourcing/examples/aggregate6a/__init__.py +0 -0
  32. eventsourcing/examples/aggregate6a/application.py +40 -0
  33. eventsourcing/examples/aggregate6a/domainmodel.py +149 -0
  34. eventsourcing/examples/aggregate6a/test_application.py +45 -0
  35. eventsourcing/examples/aggregate7/__init__.py +0 -0
  36. eventsourcing/examples/aggregate7/application.py +48 -0
  37. eventsourcing/examples/aggregate7/domainmodel.py +144 -0
  38. eventsourcing/examples/aggregate7/persistence.py +57 -0
  39. eventsourcing/examples/aggregate7/test_application.py +38 -0
  40. eventsourcing/examples/aggregate7/test_compression_and_encryption.py +45 -0
  41. eventsourcing/examples/aggregate7/test_snapshotting_intervals.py +67 -0
  42. eventsourcing/examples/aggregate7a/__init__.py +0 -0
  43. eventsourcing/examples/aggregate7a/application.py +56 -0
  44. eventsourcing/examples/aggregate7a/domainmodel.py +170 -0
  45. eventsourcing/examples/aggregate7a/test_application.py +46 -0
  46. eventsourcing/examples/aggregate7a/test_compression_and_encryption.py +45 -0
  47. eventsourcing/examples/aggregate8/__init__.py +0 -0
  48. eventsourcing/examples/aggregate8/application.py +47 -0
  49. eventsourcing/examples/aggregate8/domainmodel.py +65 -0
  50. eventsourcing/examples/aggregate8/persistence.py +57 -0
  51. eventsourcing/examples/aggregate8/test_application.py +37 -0
  52. eventsourcing/examples/aggregate8/test_compression_and_encryption.py +44 -0
  53. eventsourcing/examples/aggregate8/test_snapshotting_intervals.py +38 -0
  54. eventsourcing/examples/bankaccounts/__init__.py +0 -0
  55. eventsourcing/examples/bankaccounts/application.py +70 -0
  56. eventsourcing/examples/bankaccounts/domainmodel.py +56 -0
  57. eventsourcing/examples/bankaccounts/test.py +173 -0
  58. eventsourcing/examples/cargoshipping/__init__.py +0 -0
  59. eventsourcing/examples/cargoshipping/application.py +126 -0
  60. eventsourcing/examples/cargoshipping/domainmodel.py +330 -0
  61. eventsourcing/examples/cargoshipping/interface.py +143 -0
  62. eventsourcing/examples/cargoshipping/test.py +231 -0
  63. eventsourcing/examples/contentmanagement/__init__.py +0 -0
  64. eventsourcing/examples/contentmanagement/application.py +118 -0
  65. eventsourcing/examples/contentmanagement/domainmodel.py +69 -0
  66. eventsourcing/examples/contentmanagement/test.py +180 -0
  67. eventsourcing/examples/contentmanagement/utils.py +26 -0
  68. eventsourcing/examples/contentmanagementsystem/__init__.py +0 -0
  69. eventsourcing/examples/contentmanagementsystem/application.py +54 -0
  70. eventsourcing/examples/contentmanagementsystem/postgres.py +17 -0
  71. eventsourcing/examples/contentmanagementsystem/sqlite.py +17 -0
  72. eventsourcing/examples/contentmanagementsystem/system.py +14 -0
  73. eventsourcing/examples/contentmanagementsystem/test_system.py +180 -0
  74. eventsourcing/examples/searchablecontent/__init__.py +0 -0
  75. eventsourcing/examples/searchablecontent/application.py +45 -0
  76. eventsourcing/examples/searchablecontent/persistence.py +23 -0
  77. eventsourcing/examples/searchablecontent/postgres.py +118 -0
  78. eventsourcing/examples/searchablecontent/sqlite.py +136 -0
  79. eventsourcing/examples/searchablecontent/test_application.py +110 -0
  80. eventsourcing/examples/searchablecontent/test_recorder.py +68 -0
  81. eventsourcing/examples/searchabletimestamps/__init__.py +0 -0
  82. eventsourcing/examples/searchabletimestamps/application.py +32 -0
  83. eventsourcing/examples/searchabletimestamps/persistence.py +20 -0
  84. eventsourcing/examples/searchabletimestamps/postgres.py +110 -0
  85. eventsourcing/examples/searchabletimestamps/sqlite.py +99 -0
  86. eventsourcing/examples/searchabletimestamps/test_searchabletimestamps.py +94 -0
  87. eventsourcing/examples/test_invoice.py +176 -0
  88. eventsourcing/examples/test_parking_lot.py +206 -0
  89. eventsourcing/interface.py +2 -2
  90. eventsourcing/persistence.py +85 -81
  91. eventsourcing/popo.py +30 -31
  92. eventsourcing/postgres.py +379 -590
  93. eventsourcing/sqlite.py +91 -99
  94. eventsourcing/system.py +52 -57
  95. eventsourcing/tests/application.py +20 -32
  96. eventsourcing/tests/application_tests/__init__.py +0 -0
  97. eventsourcing/tests/application_tests/test_application_with_automatic_snapshotting.py +55 -0
  98. eventsourcing/tests/application_tests/test_application_with_popo.py +22 -0
  99. eventsourcing/tests/application_tests/test_application_with_postgres.py +75 -0
  100. eventsourcing/tests/application_tests/test_application_with_sqlite.py +72 -0
  101. eventsourcing/tests/application_tests/test_cache.py +134 -0
  102. eventsourcing/tests/application_tests/test_event_sourced_log.py +162 -0
  103. eventsourcing/tests/application_tests/test_notificationlog.py +232 -0
  104. eventsourcing/tests/application_tests/test_notificationlogreader.py +126 -0
  105. eventsourcing/tests/application_tests/test_processapplication.py +110 -0
  106. eventsourcing/tests/application_tests/test_processingpolicy.py +109 -0
  107. eventsourcing/tests/application_tests/test_repository.py +504 -0
  108. eventsourcing/tests/application_tests/test_snapshotting.py +68 -0
  109. eventsourcing/tests/application_tests/test_upcasting.py +459 -0
  110. eventsourcing/tests/docs_tests/__init__.py +0 -0
  111. eventsourcing/tests/docs_tests/test_docs.py +293 -0
  112. eventsourcing/tests/domain.py +1 -1
  113. eventsourcing/tests/domain_tests/__init__.py +0 -0
  114. eventsourcing/tests/domain_tests/test_aggregate.py +1180 -0
  115. eventsourcing/tests/domain_tests/test_aggregate_decorators.py +1604 -0
  116. eventsourcing/tests/domain_tests/test_domainevent.py +80 -0
  117. eventsourcing/tests/interface_tests/__init__.py +0 -0
  118. eventsourcing/tests/interface_tests/test_remotenotificationlog.py +258 -0
  119. eventsourcing/tests/persistence.py +52 -50
  120. eventsourcing/tests/persistence_tests/__init__.py +0 -0
  121. eventsourcing/tests/persistence_tests/test_aes.py +93 -0
  122. eventsourcing/tests/persistence_tests/test_connection_pool.py +722 -0
  123. eventsourcing/tests/persistence_tests/test_eventstore.py +72 -0
  124. eventsourcing/tests/persistence_tests/test_infrastructure_factory.py +21 -0
  125. eventsourcing/tests/persistence_tests/test_mapper.py +113 -0
  126. eventsourcing/tests/persistence_tests/test_noninterleaving_notification_ids.py +69 -0
  127. eventsourcing/tests/persistence_tests/test_popo.py +124 -0
  128. eventsourcing/tests/persistence_tests/test_postgres.py +1119 -0
  129. eventsourcing/tests/persistence_tests/test_sqlite.py +348 -0
  130. eventsourcing/tests/persistence_tests/test_transcoder.py +44 -0
  131. eventsourcing/tests/postgres_utils.py +7 -7
  132. eventsourcing/tests/system_tests/__init__.py +0 -0
  133. eventsourcing/tests/system_tests/test_runner.py +935 -0
  134. eventsourcing/tests/system_tests/test_system.py +284 -0
  135. eventsourcing/tests/utils_tests/__init__.py +0 -0
  136. eventsourcing/tests/utils_tests/test_utils.py +226 -0
  137. eventsourcing/utils.py +47 -50
  138. {eventsourcing-9.2.22.dist-info → eventsourcing-9.3.0.dist-info}/METADATA +29 -79
  139. eventsourcing-9.3.0.dist-info/RECORD +145 -0
  140. {eventsourcing-9.2.22.dist-info → eventsourcing-9.3.0.dist-info}/WHEEL +1 -2
  141. eventsourcing-9.2.22.dist-info/RECORD +0 -25
  142. eventsourcing-9.2.22.dist-info/top_level.txt +0 -1
  143. {eventsourcing-9.2.22.dist-info → eventsourcing-9.3.0.dist-info}/AUTHORS +0 -0
  144. {eventsourcing-9.2.22.dist-info → eventsourcing-9.3.0.dist-info}/LICENSE +0 -0
eventsourcing/dispatch.py CHANGED
@@ -1,98 +1,38 @@
1
1
  from __future__ import annotations
2
2
 
3
- import sys
3
+ from functools import singledispatchmethod as _singledispatchmethod
4
4
 
5
- if sys.version_info >= (3, 8): # pragma: no cover
6
- from functools import singledispatchmethod as _singledispatchmethod
7
5
 
8
- class singledispatchmethod(_singledispatchmethod):
9
- def __init__(self, func):
10
- super().__init__(func)
11
- self.deferred_registrations = []
6
+ class singledispatchmethod(_singledispatchmethod): # noqa: N801
7
+ def __init__(self, func):
8
+ super().__init__(func)
9
+ self.deferred_registrations = []
12
10
 
13
- def register(self, cls, method=None):
14
- """generic_method.register(cls, func) -> func
11
+ def register(self, cls, method=None):
12
+ """generic_method.register(cls, func) -> func
15
13
 
16
- Registers a new implementation for the given *cls* on a *generic_method*.
17
- """
18
- if isinstance(cls, (classmethod, staticmethod)):
19
- first_annotation = {}
20
- for k, v in cls.__func__.__annotations__.items():
21
- first_annotation[k] = v
22
- break
23
- cls.__annotations__ = first_annotation
24
-
25
- # for globals in typing.get_type_hints() in Python 3.8 and 3.9
26
- if not hasattr(cls, "__wrapped__"):
27
- cls.__wrapped__ = cls.__func__
28
-
29
- try:
30
- return self.dispatcher.register(cls, func=method)
31
- except NameError:
32
- self.deferred_registrations.append([cls, method])
33
- # Todo: Fix this....
34
- return method or cls
35
-
36
- def __get__(self, obj, cls=None):
37
- for registered_cls, registered_method in self.deferred_registrations:
38
- self.dispatcher.register(registered_cls, func=registered_method)
39
- self.deferred_registrations = []
40
- return super().__get__(obj, cls=cls)
41
-
42
- else:
43
- from functools import singledispatch, update_wrapper
44
-
45
- class singledispatchmethod:
46
- """Single-dispatch generic method descriptor.
47
-
48
- Supports wrapping existing descriptors and handles non-descriptor
49
- callables as instance methods.
14
+ Registers a new implementation for the given *cls* on a *generic_method*.
50
15
  """
51
-
52
- def __init__(self, func):
53
- if not callable(func) and not hasattr(func, "__get__"):
54
- raise TypeError(f"{func!r} is not callable or a descriptor")
55
-
56
- self.dispatcher = singledispatch(func)
57
- self.func = func
58
- self.deferred_registrations = []
59
-
60
- def register(self, cls, method=None):
61
- """generic_method.register(cls, func) -> func
62
-
63
- Registers a new implementation for the given *cls* on a *generic_method*.
64
- """
65
- if isinstance(cls, (classmethod, staticmethod)):
66
- first_annotation = {}
67
- for k, v in cls.__func__.__annotations__.items():
68
- first_annotation[k] = v
69
- break
70
- cls.__annotations__ = first_annotation
71
- cls.__wrapped__ = cls.__func__ # for globals in typing.get_type_hints()
72
- try:
73
- return self.dispatcher.register(cls, func=method)
74
- except NameError as e:
75
- self.deferred_registrations.append([cls, method, e])
76
- # Todo: Fix this....
77
- return method or cls
78
-
79
- def __get__(self, obj, cls=None):
80
- for cls, method, original_e in self.deferred_registrations:
81
- try:
82
- self.dispatcher.register(cls, func=method)
83
- except NameError as e:
84
- raise original_e from e
85
- self.deferred_registrations = []
86
-
87
- def _method(*args, **kwargs):
88
- method = self.dispatcher.dispatch(args[0].__class__)
89
- return method.__get__(obj, cls)(*args, **kwargs)
90
-
91
- _method.__isabstractmethod__ = self.__isabstractmethod__
92
- _method.register = self.register
93
- update_wrapper(_method, self.func)
94
- return _method
95
-
96
- @property
97
- def __isabstractmethod__(self):
98
- return getattr(self.func, "__isabstractmethod__", False)
16
+ if isinstance(cls, (classmethod, staticmethod)):
17
+ first_annotation = {}
18
+ for k, v in cls.__func__.__annotations__.items():
19
+ first_annotation[k] = v
20
+ break
21
+ cls.__annotations__ = first_annotation
22
+
23
+ # for globals in typing.get_type_hints() in Python 3.8 and 3.9
24
+ if not hasattr(cls, "__wrapped__"):
25
+ cls.__wrapped__ = cls.__func__
26
+
27
+ try:
28
+ return self.dispatcher.register(cls, func=method)
29
+ except NameError:
30
+ self.deferred_registrations.append([cls, method])
31
+ # TODO: Fix this....
32
+ return method or cls
33
+
34
+ def __get__(self, obj, cls=None):
35
+ for registered_cls, registered_method in self.deferred_registrations:
36
+ self.dispatcher.register(registered_cls, func=registered_method)
37
+ self.deferred_registrations = []
38
+ return super().__get__(obj, cls=cls)