eventsourcing 9.2.22__py3-none-any.whl → 9.3.0a1__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.
- eventsourcing/__init__.py +1 -1
- eventsourcing/application.py +106 -135
- eventsourcing/cipher.py +15 -12
- eventsourcing/dispatch.py +31 -91
- eventsourcing/domain.py +138 -143
- eventsourcing/examples/__init__.py +0 -0
- eventsourcing/examples/aggregate1/__init__.py +0 -0
- eventsourcing/examples/aggregate1/application.py +27 -0
- eventsourcing/examples/aggregate1/domainmodel.py +16 -0
- eventsourcing/examples/aggregate1/test_application.py +37 -0
- eventsourcing/examples/aggregate2/__init__.py +0 -0
- eventsourcing/examples/aggregate2/application.py +27 -0
- eventsourcing/examples/aggregate2/domainmodel.py +22 -0
- eventsourcing/examples/aggregate2/test_application.py +37 -0
- eventsourcing/examples/aggregate3/__init__.py +0 -0
- eventsourcing/examples/aggregate3/application.py +27 -0
- eventsourcing/examples/aggregate3/domainmodel.py +38 -0
- eventsourcing/examples/aggregate3/test_application.py +37 -0
- eventsourcing/examples/aggregate4/__init__.py +0 -0
- eventsourcing/examples/aggregate4/application.py +27 -0
- eventsourcing/examples/aggregate4/domainmodel.py +128 -0
- eventsourcing/examples/aggregate4/test_application.py +38 -0
- eventsourcing/examples/aggregate5/__init__.py +0 -0
- eventsourcing/examples/aggregate5/application.py +27 -0
- eventsourcing/examples/aggregate5/domainmodel.py +131 -0
- eventsourcing/examples/aggregate5/test_application.py +38 -0
- eventsourcing/examples/aggregate6/__init__.py +0 -0
- eventsourcing/examples/aggregate6/application.py +30 -0
- eventsourcing/examples/aggregate6/domainmodel.py +123 -0
- eventsourcing/examples/aggregate6/test_application.py +38 -0
- eventsourcing/examples/aggregate6a/__init__.py +0 -0
- eventsourcing/examples/aggregate6a/application.py +40 -0
- eventsourcing/examples/aggregate6a/domainmodel.py +149 -0
- eventsourcing/examples/aggregate6a/test_application.py +45 -0
- eventsourcing/examples/aggregate7/__init__.py +0 -0
- eventsourcing/examples/aggregate7/application.py +48 -0
- eventsourcing/examples/aggregate7/domainmodel.py +144 -0
- eventsourcing/examples/aggregate7/persistence.py +57 -0
- eventsourcing/examples/aggregate7/test_application.py +38 -0
- eventsourcing/examples/aggregate7/test_compression_and_encryption.py +45 -0
- eventsourcing/examples/aggregate7/test_snapshotting_intervals.py +67 -0
- eventsourcing/examples/aggregate7a/__init__.py +0 -0
- eventsourcing/examples/aggregate7a/application.py +56 -0
- eventsourcing/examples/aggregate7a/domainmodel.py +170 -0
- eventsourcing/examples/aggregate7a/test_application.py +46 -0
- eventsourcing/examples/aggregate7a/test_compression_and_encryption.py +45 -0
- eventsourcing/examples/aggregate8/__init__.py +0 -0
- eventsourcing/examples/aggregate8/application.py +47 -0
- eventsourcing/examples/aggregate8/domainmodel.py +65 -0
- eventsourcing/examples/aggregate8/persistence.py +57 -0
- eventsourcing/examples/aggregate8/test_application.py +37 -0
- eventsourcing/examples/aggregate8/test_compression_and_encryption.py +44 -0
- eventsourcing/examples/aggregate8/test_snapshotting_intervals.py +38 -0
- eventsourcing/examples/bankaccounts/__init__.py +0 -0
- eventsourcing/examples/bankaccounts/application.py +70 -0
- eventsourcing/examples/bankaccounts/domainmodel.py +56 -0
- eventsourcing/examples/bankaccounts/test.py +173 -0
- eventsourcing/examples/cargoshipping/__init__.py +0 -0
- eventsourcing/examples/cargoshipping/application.py +126 -0
- eventsourcing/examples/cargoshipping/domainmodel.py +330 -0
- eventsourcing/examples/cargoshipping/interface.py +143 -0
- eventsourcing/examples/cargoshipping/test.py +231 -0
- eventsourcing/examples/contentmanagement/__init__.py +0 -0
- eventsourcing/examples/contentmanagement/application.py +118 -0
- eventsourcing/examples/contentmanagement/domainmodel.py +69 -0
- eventsourcing/examples/contentmanagement/test.py +180 -0
- eventsourcing/examples/contentmanagement/utils.py +26 -0
- eventsourcing/examples/contentmanagementsystem/__init__.py +0 -0
- eventsourcing/examples/contentmanagementsystem/application.py +54 -0
- eventsourcing/examples/contentmanagementsystem/postgres.py +17 -0
- eventsourcing/examples/contentmanagementsystem/sqlite.py +17 -0
- eventsourcing/examples/contentmanagementsystem/system.py +14 -0
- eventsourcing/examples/contentmanagementsystem/test_system.py +174 -0
- eventsourcing/examples/searchablecontent/__init__.py +0 -0
- eventsourcing/examples/searchablecontent/application.py +45 -0
- eventsourcing/examples/searchablecontent/persistence.py +23 -0
- eventsourcing/examples/searchablecontent/postgres.py +118 -0
- eventsourcing/examples/searchablecontent/sqlite.py +136 -0
- eventsourcing/examples/searchablecontent/test_application.py +111 -0
- eventsourcing/examples/searchablecontent/test_recorder.py +69 -0
- eventsourcing/examples/searchabletimestamps/__init__.py +0 -0
- eventsourcing/examples/searchabletimestamps/application.py +32 -0
- eventsourcing/examples/searchabletimestamps/persistence.py +20 -0
- eventsourcing/examples/searchabletimestamps/postgres.py +110 -0
- eventsourcing/examples/searchabletimestamps/sqlite.py +99 -0
- eventsourcing/examples/searchabletimestamps/test_searchabletimestamps.py +91 -0
- eventsourcing/examples/test_invoice.py +176 -0
- eventsourcing/examples/test_parking_lot.py +206 -0
- eventsourcing/interface.py +2 -2
- eventsourcing/persistence.py +85 -81
- eventsourcing/popo.py +30 -31
- eventsourcing/postgres.py +361 -578
- eventsourcing/sqlite.py +91 -99
- eventsourcing/system.py +42 -57
- eventsourcing/tests/application.py +20 -32
- eventsourcing/tests/application_tests/__init__.py +0 -0
- eventsourcing/tests/application_tests/test_application_with_automatic_snapshotting.py +55 -0
- eventsourcing/tests/application_tests/test_application_with_popo.py +22 -0
- eventsourcing/tests/application_tests/test_application_with_postgres.py +75 -0
- eventsourcing/tests/application_tests/test_application_with_sqlite.py +72 -0
- eventsourcing/tests/application_tests/test_cache.py +134 -0
- eventsourcing/tests/application_tests/test_event_sourced_log.py +162 -0
- eventsourcing/tests/application_tests/test_notificationlog.py +232 -0
- eventsourcing/tests/application_tests/test_notificationlogreader.py +126 -0
- eventsourcing/tests/application_tests/test_processapplication.py +110 -0
- eventsourcing/tests/application_tests/test_processingpolicy.py +109 -0
- eventsourcing/tests/application_tests/test_repository.py +504 -0
- eventsourcing/tests/application_tests/test_snapshotting.py +68 -0
- eventsourcing/tests/application_tests/test_upcasting.py +459 -0
- eventsourcing/tests/docs_tests/__init__.py +0 -0
- eventsourcing/tests/docs_tests/test_docs.py +293 -0
- eventsourcing/tests/domain.py +1 -1
- eventsourcing/tests/domain_tests/__init__.py +0 -0
- eventsourcing/tests/domain_tests/test_aggregate.py +1159 -0
- eventsourcing/tests/domain_tests/test_aggregate_decorators.py +1604 -0
- eventsourcing/tests/domain_tests/test_domainevent.py +80 -0
- eventsourcing/tests/interface_tests/__init__.py +0 -0
- eventsourcing/tests/interface_tests/test_remotenotificationlog.py +258 -0
- eventsourcing/tests/persistence.py +49 -50
- eventsourcing/tests/persistence_tests/__init__.py +0 -0
- eventsourcing/tests/persistence_tests/test_aes.py +93 -0
- eventsourcing/tests/persistence_tests/test_connection_pool.py +722 -0
- eventsourcing/tests/persistence_tests/test_eventstore.py +72 -0
- eventsourcing/tests/persistence_tests/test_infrastructure_factory.py +21 -0
- eventsourcing/tests/persistence_tests/test_mapper.py +113 -0
- eventsourcing/tests/persistence_tests/test_noninterleaving_notification_ids.py +69 -0
- eventsourcing/tests/persistence_tests/test_popo.py +124 -0
- eventsourcing/tests/persistence_tests/test_postgres.py +1121 -0
- eventsourcing/tests/persistence_tests/test_sqlite.py +348 -0
- eventsourcing/tests/persistence_tests/test_transcoder.py +44 -0
- eventsourcing/tests/postgres_utils.py +7 -7
- eventsourcing/tests/system_tests/__init__.py +0 -0
- eventsourcing/tests/system_tests/test_runner.py +935 -0
- eventsourcing/tests/system_tests/test_system.py +287 -0
- eventsourcing/tests/utils_tests/__init__.py +0 -0
- eventsourcing/tests/utils_tests/test_utils.py +226 -0
- eventsourcing/utils.py +47 -50
- {eventsourcing-9.2.22.dist-info → eventsourcing-9.3.0a1.dist-info}/METADATA +28 -80
- eventsourcing-9.3.0a1.dist-info/RECORD +144 -0
- {eventsourcing-9.2.22.dist-info → eventsourcing-9.3.0a1.dist-info}/WHEEL +1 -2
- eventsourcing-9.2.22.dist-info/AUTHORS +0 -10
- eventsourcing-9.2.22.dist-info/RECORD +0 -25
- eventsourcing-9.2.22.dist-info/top_level.txt +0 -1
- {eventsourcing-9.2.22.dist-info → eventsourcing-9.3.0a1.dist-info}/LICENSE +0 -0
eventsourcing/dispatch.py
CHANGED
|
@@ -1,98 +1,38 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
class singledispatchmethod(_singledispatchmethod): # noqa: N801
|
|
7
|
+
def __init__(self, func):
|
|
8
|
+
super().__init__(func)
|
|
9
|
+
self.deferred_registrations = []
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
def register(self, cls, method=None):
|
|
12
|
+
"""generic_method.register(cls, func) -> func
|
|
15
13
|
|
|
16
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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)
|