kisa-utils 0.37.4__py3-none-any.whl → 0.37.6__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.
@@ -77,7 +77,7 @@ def enforceRequirements(func:Callable) -> Callable:
77
77
  raise ValueError(
78
78
  f"function `{func.__name__}` has no docString!")
79
79
 
80
- if not typeHints.get("return", None):
80
+ if -1 == typeHints.get("return", -1):
81
81
  raise TypeError(
82
82
  f"function `{func.__name__}` has no return type")
83
83
 
@@ -85,6 +85,10 @@ def enforceRequirements(func:Callable) -> Callable:
85
85
  registeredKwargs = {}
86
86
 
87
87
  for key, value in signature.parameters.items():
88
+ if 'self' == key:
89
+ registeredArgs.append((key, None))
90
+ continue
91
+
88
92
  if value.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
89
93
  raise TypeError(
90
94
  f"function `{func.__name__}` should take either positional-only or keyword-only parameters. `{key}` is neither")
@@ -116,6 +120,7 @@ def enforceRequirements(func:Callable) -> Callable:
116
120
  @wraps(func)
117
121
  def w(*args, **kwargs):
118
122
  for index, arg in enumerate(args):
123
+ if registeredArgs[index][0] in ['self']: continue
119
124
  if not (resp := validateWithResponse(arg, registeredArgs[index][1])):
120
125
  log = f'arg `{registeredArgs[index][0]}`, arg-index {index}: {resp.log}'
121
126
  if Response == expectectedReturnType: return Error(log)
@@ -1031,7 +1031,7 @@ class Permissions:
1031
1031
  return Error(f'permission at index #{index}(`{permission}`), error:{rep.log}')
1032
1032
 
1033
1033
  if permission in self.__globalPermissions:
1034
- return Error(f'permission at index #{index}(`{permission}`), error:global permission can not be added to resource')
1034
+ return Error(f'permission at index #{index}(`{permission}`), error:permission already in global permissions')
1035
1035
 
1036
1036
  return Ok()
1037
1037
 
@@ -547,6 +547,7 @@ def endpoint(
547
547
  }
548
548
  setEndpoints(__group, _name, new_entry)
549
549
 
550
+ @wraps(func)
550
551
  def w():
551
552
  nonlocal handler, new_entry
552
553
 
@@ -630,6 +631,8 @@ def endpoint(
630
631
 
631
632
  w.__name__ = f'__kisa_wrapper_{_group}_{handler.__name__}'
632
633
  __SERVER_APP.route(_name, methods=methods)(w)
634
+
635
+ return func
633
636
 
634
637
  # in case the decorator is called as `@endpoint` as opposed to `@endpoint(...)`
635
638
  if callable(name):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kisa-utils
3
- Version: 0.37.4
3
+ Version: 0.37.6
4
4
  Summary: Utility functions and modules for KISA Developers
5
5
  Author: Tom Bukenya
6
6
  Author-email: glayn2bukman@gmail.com
@@ -7,7 +7,7 @@ kisa_utils/db.py,sha256=Mv9BcHydRZZHE_ONbNPhGiezqVYXuILXct6qBZhgrdU,44223
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=y1C8N80ZJ5a6eBgEt_zZbweYAoZCOd9VxIb8if8RIdA,6030
10
+ kisa_utils/functionUtils.py,sha256=BMtXL3aaL_X1K56mZhQoGvZ2etJ6zdRvrorsi5ICFhA,6199
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
@@ -17,13 +17,13 @@ kisa_utils/storage.py,sha256=8-NgrY6BpIo-B9IJNTd-TqMB0m9BY1PuQgZ9WL1z8SM,7683
17
17
  kisa_utils/threads.py,sha256=qQqsf64YHMyLpboq5AEXKxYqf3iXUhxiJe6Ymg-vlxI,12840
18
18
  kisa_utils/token.py,sha256=RUdov01FlCfxMPY0onj0kvPkXTOxutvS96xQN1bhPBE,8282
19
19
  kisa_utils/permissions/__config__.py,sha256=i3ELkOydDnjKx2ozQTxLZdZ8DXSeUncnl2kRxANjFmM,613
20
- kisa_utils/permissions/__init__.py,sha256=Zwt7b1_P-Tu0CRZ8-TpCpnP3F7LnEEDTlQnkVWnwfyg,47982
20
+ kisa_utils/permissions/__init__.py,sha256=q7LGl26f-MPXkLS6nxBKDotW3xdB8y7pI5S_Oo5fPOw,47976
21
21
  kisa_utils/servers/__init__.py,sha256=lPqDyGTrFo0qwPZ2WA9Xtcpc5D8AIU4huqgFx1iZf68,19
22
- kisa_utils/servers/flask.py,sha256=DC-WuxB5NP6rvmYR40_yV_RD6zd9DiI98W1maeXf_7Y,40035
22
+ kisa_utils/servers/flask.py,sha256=o76cJKlQ3L8EOVdHUF092qwoAZMzgttuLt0mMhtCsGI,40085
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.4.dist-info/METADATA,sha256=cd4lkWJ2TSanY57w3wu6SKah-BHVLs51oAfZMPrDkcU,477
27
- kisa_utils-0.37.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
28
- kisa_utils-0.37.4.dist-info/top_level.txt,sha256=URxY4sRuqmirOxWtztpVmPoGQdksEMYO6hmYsEDGz2Y,75
29
- kisa_utils-0.37.4.dist-info/RECORD,,
26
+ kisa_utils-0.37.6.dist-info/METADATA,sha256=oiwwsLrbrDpaxy1FKalHU5QGuozuq8PQGfboFaUxgQE,477
27
+ kisa_utils-0.37.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
28
+ kisa_utils-0.37.6.dist-info/top_level.txt,sha256=URxY4sRuqmirOxWtztpVmPoGQdksEMYO6hmYsEDGz2Y,75
29
+ kisa_utils-0.37.6.dist-info/RECORD,,