eventsourcing 9.4.0a6__py3-none-any.whl → 9.4.0a8__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/application.py +4 -17
- eventsourcing/domain.py +355 -331
- eventsourcing/persistence.py +18 -24
- eventsourcing/popo.py +5 -1
- eventsourcing/postgres.py +41 -33
- eventsourcing/projection.py +22 -19
- eventsourcing/sqlite.py +5 -1
- eventsourcing/system.py +19 -11
- eventsourcing/tests/application.py +57 -49
- eventsourcing/tests/domain.py +8 -6
- eventsourcing/tests/persistence.py +162 -143
- eventsourcing/tests/postgres_utils.py +7 -8
- eventsourcing/utils.py +15 -10
- {eventsourcing-9.4.0a6.dist-info → eventsourcing-9.4.0a8.dist-info}/METADATA +1 -1
- eventsourcing-9.4.0a8.dist-info/RECORD +26 -0
- eventsourcing-9.4.0a6.dist-info/RECORD +0 -26
- {eventsourcing-9.4.0a6.dist-info → eventsourcing-9.4.0a8.dist-info}/AUTHORS +0 -0
- {eventsourcing-9.4.0a6.dist-info → eventsourcing-9.4.0a8.dist-info}/LICENSE +0 -0
- {eventsourcing-9.4.0a6.dist-info → eventsourcing-9.4.0a8.dist-info}/WHEEL +0 -0
|
@@ -5,12 +5,12 @@ from eventsourcing.postgres import PostgresDatastore
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def pg_close_all_connections(
|
|
8
|
-
name="eventsourcing",
|
|
9
|
-
host="127.0.0.1",
|
|
10
|
-
port="5432",
|
|
11
|
-
user="postgres",
|
|
12
|
-
password="postgres", # noqa: S107
|
|
13
|
-
):
|
|
8
|
+
name: str = "eventsourcing",
|
|
9
|
+
host: str = "127.0.0.1",
|
|
10
|
+
port: str = "5432",
|
|
11
|
+
user: str = "postgres",
|
|
12
|
+
password: str = "postgres", # noqa: S107
|
|
13
|
+
) -> None:
|
|
14
14
|
try:
|
|
15
15
|
# For local development... probably.
|
|
16
16
|
pg_conn = psycopg.connect(
|
|
@@ -40,10 +40,9 @@ def pg_close_all_connections(
|
|
|
40
40
|
"""
|
|
41
41
|
pg_conn_cursor = pg_conn.cursor()
|
|
42
42
|
pg_conn_cursor.execute(close_all_connections)
|
|
43
|
-
return close_all_connections, pg_conn_cursor
|
|
44
43
|
|
|
45
44
|
|
|
46
|
-
def drop_postgres_table(datastore: PostgresDatastore, table_name):
|
|
45
|
+
def drop_postgres_table(datastore: PostgresDatastore, table_name: str) -> None:
|
|
47
46
|
statement = f"DROP TABLE {table_name}"
|
|
48
47
|
try:
|
|
49
48
|
with datastore.transaction(commit=True) as curs:
|
eventsourcing/utils.py
CHANGED
|
@@ -8,7 +8,8 @@ from inspect import isfunction
|
|
|
8
8
|
from random import random
|
|
9
9
|
from threading import Lock
|
|
10
10
|
from time import sleep
|
|
11
|
-
from
|
|
11
|
+
from types import ModuleType
|
|
12
|
+
from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union, no_type_check, overload
|
|
12
13
|
|
|
13
14
|
if TYPE_CHECKING:
|
|
14
15
|
from types import FunctionType, WrapperDescriptorType
|
|
@@ -20,12 +21,14 @@ class TopicError(Exception):
|
|
|
20
21
|
"""
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
SupportsTopic = Union[type, Callable[..., Any], ModuleType]
|
|
25
|
+
|
|
26
|
+
_type_cache: dict[SupportsTopic, str] = {}
|
|
27
|
+
_topic_cache: dict[str, SupportsTopic] = {}
|
|
25
28
|
_topic_cache_lock = Lock()
|
|
26
29
|
|
|
27
30
|
|
|
28
|
-
def get_topic(
|
|
31
|
+
def get_topic(obj: SupportsTopic, /) -> str:
|
|
29
32
|
"""
|
|
30
33
|
Returns a "topic string" that locates the given class
|
|
31
34
|
in its module. The string is formed by joining the
|
|
@@ -33,11 +36,11 @@ def get_topic(cls: type) -> str:
|
|
|
33
36
|
colon character.
|
|
34
37
|
"""
|
|
35
38
|
try:
|
|
36
|
-
return _type_cache[
|
|
39
|
+
return _type_cache[obj]
|
|
37
40
|
except KeyError:
|
|
38
|
-
topic = f"{
|
|
39
|
-
register_topic(topic,
|
|
40
|
-
_type_cache[
|
|
41
|
+
topic = f"{obj.__module__}:{obj.__qualname__}"
|
|
42
|
+
register_topic(topic, obj)
|
|
43
|
+
_type_cache[obj] = topic
|
|
41
44
|
return topic
|
|
42
45
|
|
|
43
46
|
|
|
@@ -97,7 +100,7 @@ def resolve_topic(topic: str) -> Any:
|
|
|
97
100
|
return obj
|
|
98
101
|
|
|
99
102
|
|
|
100
|
-
def register_topic(topic: str, obj:
|
|
103
|
+
def register_topic(topic: str, obj: SupportsTopic) -> None:
|
|
101
104
|
"""
|
|
102
105
|
Registers a topic with an object, so the object will be
|
|
103
106
|
returned whenever the topic is resolved.
|
|
@@ -215,7 +218,9 @@ def reversed_keys(d: dict[Any, Any]) -> Iterator[Any]:
|
|
|
215
218
|
return reversed(d.keys())
|
|
216
219
|
|
|
217
220
|
|
|
218
|
-
def get_method_name(
|
|
221
|
+
def get_method_name(
|
|
222
|
+
method: Callable[..., Any] | FunctionType | WrapperDescriptorType,
|
|
223
|
+
) -> str:
|
|
219
224
|
if sys.version_info >= (3, 10): # pragma: no cover
|
|
220
225
|
return method.__qualname__
|
|
221
226
|
return method.__name__ # pragma: no cover
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
eventsourcing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
eventsourcing/application.py,sha256=YF1CAUZrqb51vzT95mk6mC0tWCHdR_N6-rn1s6SKL8g,35909
|
|
3
|
+
eventsourcing/cipher.py,sha256=AjgOlOv9FF6xyXiFnHwcK6NX5IJ3nPHFL5GzIyWozyg,3265
|
|
4
|
+
eventsourcing/compressor.py,sha256=IdvrJUB9B2td871oifInv4lGXmHwYL9d69MbHHCr7uI,421
|
|
5
|
+
eventsourcing/cryptography.py,sha256=ZsQFyeyMZysADqKy38ECV71j6EMMSbo3VQO7oRnC1h0,2994
|
|
6
|
+
eventsourcing/dispatch.py,sha256=yYSpT-jqc6l_wTdqEnfPJJfvsZN2Ta8g2anrVPWIcqQ,1412
|
|
7
|
+
eventsourcing/domain.py,sha256=FUvCklB-8BGEzoalk3IcuEeyDZrRzPhzgI96L4I9OxM,58980
|
|
8
|
+
eventsourcing/interface.py,sha256=kObA7ouzLD4YpJMjhfPVmRUcDzhbK0bbFKXy75EscHU,5138
|
|
9
|
+
eventsourcing/persistence.py,sha256=zsd_RL_H_gc64Ka45Vapd92eVZXrwfanrGNE36zp9tg,45877
|
|
10
|
+
eventsourcing/popo.py,sha256=xBUnnPuQ_wdF0ErU9AApRPwlkB0CJePMbWCz6qn3U1M,9654
|
|
11
|
+
eventsourcing/postgres.py,sha256=mMdorzwSbDDNjK5KQDNVLy48JrI_18KoRUkDtOI8_wM,36506
|
|
12
|
+
eventsourcing/projection.py,sha256=pmSywj7DkUFIoOMuo8RJv7snB5jNdODSupMgQikEZto,6677
|
|
13
|
+
eventsourcing/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
eventsourcing/sqlite.py,sha256=UVgG0JCmYr7xN8HHnoiMPpZtZ3d5NTfB-iq0MlZGax4,22051
|
|
15
|
+
eventsourcing/system.py,sha256=UgIwaU35drvaq9Nvs16zsZ4UMPjZ_PlFclvEhIWIVFA,47400
|
|
16
|
+
eventsourcing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
+
eventsourcing/tests/application.py,sha256=DEncXtCsX0X6Udua9GbGpua0xTGshnDPIThFfzuiBog,18025
|
|
18
|
+
eventsourcing/tests/domain.py,sha256=1FTpfG5w-UMbqh_R-6LKDZY0JKb_nZtOIEGrdYDEUyY,3373
|
|
19
|
+
eventsourcing/tests/persistence.py,sha256=mb29R8-CJCNroSmrfYYxsN354zmJKQ--ROrjPDhjKTc,58256
|
|
20
|
+
eventsourcing/tests/postgres_utils.py,sha256=jS1Ac5Yj4IPx-bsL2IRlytcd5oa0l6SiFcprHxqWdVQ,1371
|
|
21
|
+
eventsourcing/utils.py,sha256=0DlFnDmvGwCSWiEQ_h5GLgyjAgHJbsVtdf-GLQvoH7I,8350
|
|
22
|
+
eventsourcing-9.4.0a8.dist-info/AUTHORS,sha256=8aHOM4UbNZcKlD-cHpFRcM6RWyCqtwtxRev6DeUgVRs,137
|
|
23
|
+
eventsourcing-9.4.0a8.dist-info/LICENSE,sha256=CQEQzcZO8AWXL5i3hIo4yVKrYjh2FBz6hCM7kpXWpw4,1512
|
|
24
|
+
eventsourcing-9.4.0a8.dist-info/METADATA,sha256=22EfMdqFS1lzyD7ZDa4t3tfgl1b3mgeBwhXMYkzTCJg,9797
|
|
25
|
+
eventsourcing-9.4.0a8.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
26
|
+
eventsourcing-9.4.0a8.dist-info/RECORD,,
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
eventsourcing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
eventsourcing/application.py,sha256=jnW_D1WpcH_S9tOER36xzy3juYzm9D3f-nGTKAU8RpI,36188
|
|
3
|
-
eventsourcing/cipher.py,sha256=AjgOlOv9FF6xyXiFnHwcK6NX5IJ3nPHFL5GzIyWozyg,3265
|
|
4
|
-
eventsourcing/compressor.py,sha256=IdvrJUB9B2td871oifInv4lGXmHwYL9d69MbHHCr7uI,421
|
|
5
|
-
eventsourcing/cryptography.py,sha256=ZsQFyeyMZysADqKy38ECV71j6EMMSbo3VQO7oRnC1h0,2994
|
|
6
|
-
eventsourcing/dispatch.py,sha256=yYSpT-jqc6l_wTdqEnfPJJfvsZN2Ta8g2anrVPWIcqQ,1412
|
|
7
|
-
eventsourcing/domain.py,sha256=3pg7OtnupNFEJxLH0cur1k6rSFspYX2Ic6wteuEjtxE,58170
|
|
8
|
-
eventsourcing/interface.py,sha256=kObA7ouzLD4YpJMjhfPVmRUcDzhbK0bbFKXy75EscHU,5138
|
|
9
|
-
eventsourcing/persistence.py,sha256=5fyJ9H7rgQY1M1cO6rfNU9VI2_GLn4KjFLia7lqXLSM,46147
|
|
10
|
-
eventsourcing/popo.py,sha256=wSnpFutz24czC34v-Pd_OjMvv3RCXRjT0pk7ibkClrY,9573
|
|
11
|
-
eventsourcing/postgres.py,sha256=WM23kJSmKzYvbiEU6y_E5WIuOIDMQfgLi2yHqazbj3c,36325
|
|
12
|
-
eventsourcing/projection.py,sha256=x4lnqJbbnqwt_UKQN69jYSZEJkbhgvZgf-QX4c_y0lE,6774
|
|
13
|
-
eventsourcing/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
eventsourcing/sqlite.py,sha256=ZiQSxaRULQMpK6RuiVQ1jD8dSMW_I-urzfAW6oL2FEk,21970
|
|
15
|
-
eventsourcing/system.py,sha256=geMw08uAEySRHaNeDwYZyzD55WcduK7WP_BTy964dEU,47063
|
|
16
|
-
eventsourcing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
eventsourcing/tests/application.py,sha256=vHF5xp5WAXdTItdY5NsHvtT2QCRGmSM-j-afwFJqKj0,17357
|
|
18
|
-
eventsourcing/tests/domain.py,sha256=lHSlY6jIoSeqlcPSbrrozEPUJGvJ8bgPrznlmzTxn2w,3254
|
|
19
|
-
eventsourcing/tests/persistence.py,sha256=XHoe4rk9VftCJ3Wfi30K1u3wnMLUyOjuYyI7ml9ecIQ,57096
|
|
20
|
-
eventsourcing/tests/postgres_utils.py,sha256=xymcGYasUXeZTBenkHz-ykD8HtrFjVM1Z7-qRrH6OQk,1364
|
|
21
|
-
eventsourcing/utils.py,sha256=1MXOacnjXauYaBhGmmGc1nOMXWcd9NnDC8uPeiop9l4,8184
|
|
22
|
-
eventsourcing-9.4.0a6.dist-info/AUTHORS,sha256=8aHOM4UbNZcKlD-cHpFRcM6RWyCqtwtxRev6DeUgVRs,137
|
|
23
|
-
eventsourcing-9.4.0a6.dist-info/LICENSE,sha256=CQEQzcZO8AWXL5i3hIo4yVKrYjh2FBz6hCM7kpXWpw4,1512
|
|
24
|
-
eventsourcing-9.4.0a6.dist-info/METADATA,sha256=DyLTvR4U5LLER3GR88LJkFHdSB6RlZ7MnsFE30OzAi0,9797
|
|
25
|
-
eventsourcing-9.4.0a6.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
26
|
-
eventsourcing-9.4.0a6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|