kisa-utils 0.37.10__py3-none-any.whl → 0.37.11__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/functionUtils.py +8 -6
- {kisa_utils-0.37.10.dist-info → kisa_utils-0.37.11.dist-info}/METADATA +1 -1
- {kisa_utils-0.37.10.dist-info → kisa_utils-0.37.11.dist-info}/RECORD +5 -5
- {kisa_utils-0.37.10.dist-info → kisa_utils-0.37.11.dist-info}/WHEEL +0 -0
- {kisa_utils-0.37.10.dist-info → kisa_utils-0.37.11.dist-info}/top_level.txt +0 -0
kisa_utils/functionUtils.py
CHANGED
|
@@ -89,11 +89,17 @@ def enforceRequirements(func:Callable[P, T]) -> Callable[P, T]:
|
|
|
89
89
|
registeredArgs = []
|
|
90
90
|
registeredKwargs = {}
|
|
91
91
|
|
|
92
|
+
argCount = 0
|
|
92
93
|
for key, value in signature.parameters.items():
|
|
93
|
-
|
|
94
|
+
argCount += 1
|
|
95
|
+
if (key in ['self', 'cls']) and 1==argCount:
|
|
94
96
|
registeredArgs.append((key, None))
|
|
95
97
|
continue
|
|
96
98
|
|
|
99
|
+
hint = typeHints.get(key, None)
|
|
100
|
+
if not hint:
|
|
101
|
+
raise TypeError(f"function/method `{func.__name__}`: parameter `{key}` has no type hint")
|
|
102
|
+
|
|
97
103
|
if value.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
|
|
98
104
|
raise TypeError(
|
|
99
105
|
f"function/method `{func.__name__}` should take either positional-only or keyword-only parameters. `{key}` is neither")
|
|
@@ -114,10 +120,6 @@ def enforceRequirements(func:Callable[P, T]) -> Callable[P, T]:
|
|
|
114
120
|
raise ValueError(
|
|
115
121
|
f'function/method `{func.__name__}`: *{key} or **{key} not allowed in function signature')
|
|
116
122
|
|
|
117
|
-
hint = typeHints.get(key, None)
|
|
118
|
-
if not hint:
|
|
119
|
-
raise TypeError(f"parameter `{key}` has no type hint")
|
|
120
|
-
|
|
121
123
|
expectectedReturnType = typeHints['return']
|
|
122
124
|
|
|
123
125
|
# print(registeredArgs, registeredKwargs)
|
|
@@ -125,7 +127,7 @@ def enforceRequirements(func:Callable[P, T]) -> Callable[P, T]:
|
|
|
125
127
|
@wraps(func)
|
|
126
128
|
def w(*args:P.args, **kwargs:P.kwargs):
|
|
127
129
|
for index, arg in enumerate(args):
|
|
128
|
-
if registeredArgs[index][0] in ['self']: continue
|
|
130
|
+
if (registeredArgs[index][0] in ['self', 'cls']) and 0==index: continue
|
|
129
131
|
if not (resp := validateWithResponse(arg, registeredArgs[index][1])):
|
|
130
132
|
log = f'arg `{registeredArgs[index][0]}`, arg-index {index}: {resp.log}'
|
|
131
133
|
if Response == expectectedReturnType: return Error(log)
|
|
@@ -7,7 +7,7 @@ kisa_utils/db.py,sha256=gU6BSBSglrndUMhmhOmIEVNXKSiRV6vqf2pskJKYmlQ,44463
|
|
|
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=l56NQiPVcFijpuLqt2n9ZwnVKT4XzK6oknRVallRzwQ,2573
|
|
25
25
|
kisa_utils/structures/validator.py,sha256=Y4UmB4TH7N-GkK22EV1WOsPWjTeqxVWLTentl1keZD4,4053
|
|
26
|
-
kisa_utils-0.37.
|
|
27
|
-
kisa_utils-0.37.
|
|
28
|
-
kisa_utils-0.37.
|
|
29
|
-
kisa_utils-0.37.
|
|
26
|
+
kisa_utils-0.37.11.dist-info/METADATA,sha256=j_xQph98QIGh8sRWaVx9mXa8Jy-cIiz14egzhgxtjmc,478
|
|
27
|
+
kisa_utils-0.37.11.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
28
|
+
kisa_utils-0.37.11.dist-info/top_level.txt,sha256=URxY4sRuqmirOxWtztpVmPoGQdksEMYO6hmYsEDGz2Y,75
|
|
29
|
+
kisa_utils-0.37.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|