kisa-utils 0.37.19__py3-none-any.whl → 0.38.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.
- kisa_utils/db.py +9 -2
- kisa_utils/functionUtils.py +6 -6
- {kisa_utils-0.37.19.dist-info → kisa_utils-0.38.0.dist-info}/METADATA +1 -1
- {kisa_utils-0.37.19.dist-info → kisa_utils-0.38.0.dist-info}/RECORD +6 -6
- {kisa_utils-0.37.19.dist-info → kisa_utils-0.38.0.dist-info}/WHEEL +0 -0
- {kisa_utils-0.37.19.dist-info → kisa_utils-0.38.0.dist-info}/top_level.txt +0 -0
kisa_utils/db.py
CHANGED
|
@@ -955,11 +955,10 @@ class Api:
|
|
|
955
955
|
reply['log'] = 'database not open'
|
|
956
956
|
return reply if not self.__returnKISAResponse else Error(reply['log'])
|
|
957
957
|
|
|
958
|
-
if self.
|
|
958
|
+
if not self.inTopLevelContext:
|
|
959
959
|
reply['log'] = 'can not commit transaction in non top-level context'
|
|
960
960
|
return reply if not self.__returnKISAResponse else Error(reply['log'])
|
|
961
961
|
|
|
962
|
-
|
|
963
962
|
for op in self.__transactionData:
|
|
964
963
|
if self.__transactionData[op]['failed']:
|
|
965
964
|
reply['log'] = f'{self.__transactionData[op]["failed"]} `{op}` operation(s) returned a `False` status'
|
|
@@ -1103,6 +1102,14 @@ class Api:
|
|
|
1103
1102
|
def __bool__(self)->bool:
|
|
1104
1103
|
return self.isOpen
|
|
1105
1104
|
|
|
1105
|
+
@property
|
|
1106
|
+
def inTopLevelContext(self) -> bool:
|
|
1107
|
+
'''
|
|
1108
|
+
check if the opened db-handle is in the top-most `with` context.
|
|
1109
|
+
If it is, then its okay to commit a transaction
|
|
1110
|
+
'''
|
|
1111
|
+
return self.__withContextCount <= 1
|
|
1112
|
+
|
|
1106
1113
|
Handle = Api
|
|
1107
1114
|
|
|
1108
1115
|
def transaction(*dbArgs, **dbKwargs) -> dict|Response:
|
kisa_utils/functionUtils.py
CHANGED
|
@@ -6,14 +6,11 @@ from kisa_utils.response import Response, Ok, Error
|
|
|
6
6
|
from kisa_utils.storage import Path
|
|
7
7
|
from kisa_utils.structures.validator import Value, validateWithResponse
|
|
8
8
|
import copy
|
|
9
|
-
from typing import Any, get_args, Callable
|
|
9
|
+
from typing import Any, get_args, Callable
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
T = TypeVar('T')
|
|
13
|
-
|
|
14
|
-
class Definition(Generic[T]):
|
|
11
|
+
class Definition:
|
|
15
12
|
@staticmethod
|
|
16
|
-
def __class_getitem__(structure:
|
|
13
|
+
def __class_getitem__(structure:Any) -> Any:
|
|
17
14
|
return structure
|
|
18
15
|
|
|
19
16
|
def private(func:Callable) -> Callable:
|
|
@@ -63,6 +60,9 @@ def protected(func:Callable) -> Callable:
|
|
|
63
60
|
return wrapper
|
|
64
61
|
|
|
65
62
|
# ------------------------------------------------------------------------------
|
|
63
|
+
from typing import ParamSpec, TypeVar
|
|
64
|
+
P = ParamSpec('P')
|
|
65
|
+
T = TypeVar('T')
|
|
66
66
|
|
|
67
67
|
def enforceRequirements(func:Callable[P, T]) -> Callable[P, T]:
|
|
68
68
|
'''
|
|
@@ -3,11 +3,11 @@ kisa_utils/cache.py,sha256=4Ue5G3QhHSQAmIfQKYgWKWjNL4rA4wLLd_RdBLb2ABY,7345
|
|
|
3
3
|
kisa_utils/codes.py,sha256=PV_S53Skggf4XetOdYoIKtEmM8cpN5wZwUlxje70WZY,904
|
|
4
4
|
kisa_utils/config.py,sha256=NfluzGKTh66qfNtC-Ae0zNb1XzMTgU2Me9Vi82R9c1E,2285
|
|
5
5
|
kisa_utils/dates.py,sha256=kcNqoY_iguG9hSzABMIBqeL3MGz3n4MRIXuW4OxRHLs,12662
|
|
6
|
-
kisa_utils/db.py,sha256=
|
|
6
|
+
kisa_utils/db.py,sha256=tVNMV-hc-oPxR4iRSX-d82Gi4fQwI5Cga1eP8SLvHFs,49202
|
|
7
7
|
kisa_utils/encryption.py,sha256=nFzNpzWV_D9uSEq4FsgCnlS7FQtqWP9fvM_81rsfcLo,4218
|
|
8
8
|
kisa_utils/enqueue.py,sha256=VIliaMvw4MUdOqts0dXdZCYNxs-QrOVjIRAR3scGrRM,11786
|
|
9
9
|
kisa_utils/figures.py,sha256=pYIpQzu1OXRSsY1d98GhgPifnIRmgl-r7S32ai-Ms0c,3731
|
|
10
|
-
kisa_utils/functionUtils.py,sha256=
|
|
10
|
+
kisa_utils/functionUtils.py,sha256=PlXjnmU1uJWNdISlJJ3SCgavTsgNBoebaa9dtWSFhRA,6553
|
|
11
11
|
kisa_utils/log.py,sha256=0TYdxcIBts026RCSuVIQBcZ-CW1ES7n3M1nEIjmeLTM,2295
|
|
12
12
|
kisa_utils/queues.py,sha256=9QqPtDujw6tbWk7uUiXrsd0rVBTIkzeQw9b45l5Fo3k,6502
|
|
13
13
|
kisa_utils/remote.py,sha256=0RDrfC4RUW4m6JLziC0_EXJYqzWp38Rw8NDroJ0MuqI,2149
|
|
@@ -23,7 +23,7 @@ kisa_utils/servers/flask.py,sha256=o76cJKlQ3L8EOVdHUF092qwoAZMzgttuLt0mMhtCsGI,4
|
|
|
23
23
|
kisa_utils/structures/__init__.py,sha256=JBU1j3A42jQ62ALKnsS1Hav9YXcYwjDw1wQJtohXPbU,83
|
|
24
24
|
kisa_utils/structures/utils.py,sha256=665rXIapGwFqejizeJwy3DryeskCQOdgP25BCdLkGvk,2898
|
|
25
25
|
kisa_utils/structures/validator.py,sha256=Y4UmB4TH7N-GkK22EV1WOsPWjTeqxVWLTentl1keZD4,4053
|
|
26
|
-
kisa_utils-0.
|
|
27
|
-
kisa_utils-0.
|
|
28
|
-
kisa_utils-0.
|
|
29
|
-
kisa_utils-0.
|
|
26
|
+
kisa_utils-0.38.0.dist-info/METADATA,sha256=N9Rr0nesf9HuUFeg9N_nQgpZYO5YLOMhfOYax5vI3NA,477
|
|
27
|
+
kisa_utils-0.38.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
28
|
+
kisa_utils-0.38.0.dist-info/top_level.txt,sha256=URxY4sRuqmirOxWtztpVmPoGQdksEMYO6hmYsEDGz2Y,75
|
|
29
|
+
kisa_utils-0.38.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|