qena-shared-lib 0.1.10__py3-none-any.whl → 0.1.12__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.
@@ -31,7 +31,7 @@ RESPONSE_CODE = int(environ.get("UNAUTHORIZED_RESPONSE_CODE") or 0)
31
31
 
32
32
 
33
33
  class PasswordHasher(AsyncEventLoopMixin):
34
- def __init__(self, schemes=None):
34
+ def __init__(self, schemes: Any | None = None) -> None:
35
35
  self._crypt_context = CryptContext(
36
36
  schemes=schemes or ["bcrypt"], deprecated="auto"
37
37
  )
@@ -48,7 +48,7 @@ class PasswordHasher(AsyncEventLoopMixin):
48
48
 
49
49
 
50
50
  class JwtAdapter(AsyncEventLoopMixin):
51
- def __init__(self):
51
+ def __init__(self) -> None:
52
52
  self._jwt = JWT()
53
53
 
54
54
  def encode(
qena_shared_lib/utils.py CHANGED
@@ -1,40 +1,23 @@
1
1
  from asyncio import AbstractEventLoop, get_running_loop
2
+ from functools import lru_cache
2
3
 
3
4
  from pydantic import TypeAdapter
4
5
 
5
6
  __all__ = ["AsyncEventLoopMixin", "TypeAdapterCache"]
6
7
 
7
- ABSTRACT_EVENT_LOOP_ATTRIBUTE = "__abstract_event_loop__"
8
-
9
8
 
10
9
  class AsyncEventLoopMixin:
11
10
  @property
11
+ @lru_cache
12
12
  def loop(self) -> AbstractEventLoop:
13
- previous_running_loop = getattr(
14
- self, ABSTRACT_EVENT_LOOP_ATTRIBUTE, None
15
- )
16
- current_running_loop = None
17
-
18
- try:
19
- current_running_loop = get_running_loop()
20
- except RuntimeError:
21
- if previous_running_loop is None:
22
- raise
23
-
24
- if previous_running_loop is None or (
25
- current_running_loop is not None
26
- and previous_running_loop != current_running_loop
27
- ):
28
- setattr(self, ABSTRACT_EVENT_LOOP_ATTRIBUTE, current_running_loop)
29
-
30
- return getattr(self, ABSTRACT_EVENT_LOOP_ATTRIBUTE)
13
+ return get_running_loop()
31
14
 
32
15
 
33
16
  class TypeAdapterCache:
34
- _cache = {}
17
+ _cache: dict[type, TypeAdapter] = {}
35
18
 
36
19
  @classmethod
37
- def cache_annotation(cls, annotation: type):
20
+ def cache_annotation(cls, annotation: type) -> None:
38
21
  if annotation not in cls._cache:
39
22
  cls._cache[annotation] = TypeAdapter(annotation)
40
23
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qena-shared-lib
3
- Version: 0.1.10
3
+ Version: 0.1.12
4
4
  Summary: A shared tools for other services
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: cronsim==2.6
@@ -515,7 +515,7 @@ def main() -> FastAPI:
515
515
  ...
516
516
 
517
517
 
518
- async data_processor(data: Data):
518
+ async def data_processor(data: Data):
519
519
  ...
520
520
 
521
521
 
@@ -0,0 +1,29 @@
1
+ qena_shared_lib/__init__.py,sha256=WokKEFaMNow6h2ZY_fyB-tiYnic-Ed6K6kyzKgg3Rlw,371
2
+ qena_shared_lib/application.py,sha256=CY4RKRe1EcykBYZkLUUFhjLSY9Oriqbg6llqciCSsvU,5660
3
+ qena_shared_lib/background.py,sha256=QSwvJODQrkFpzDOOmGQVpuLXd3Ib-jcAd-Z8VIo2gvg,3268
4
+ qena_shared_lib/exception_handlers.py,sha256=NlJrhpovP5UaLa2Om2NradURMZf_UtGngeDGz6jm7C0,6382
5
+ qena_shared_lib/exceptions.py,sha256=GvRLuiLEJTwobWPWHwSNlIblLAG3hSX6FbHGfXzFjgg,11057
6
+ qena_shared_lib/http.py,sha256=59_XW-cMFGjOfp5j4UAcwjne_9a7vKk6JiknHB1juZc,24727
7
+ qena_shared_lib/logging.py,sha256=NyaKgbaBknti9aYxqrhGhIBuAbybCTmYXrRZtI-Mils,1625
8
+ qena_shared_lib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ qena_shared_lib/scheduler.py,sha256=-m5ngBN_hC9eotmOP_WjqK6DwwNgtLNart3jefXTSa4,12125
10
+ qena_shared_lib/security.py,sha256=x3aPGdey6_5nDxtWKXIyD9EySyhwoPgiitFHNG1KqWU,6106
11
+ qena_shared_lib/utils.py,sha256=rgaaxpUAHV_ZGKwxDkX8P0DISml4sgCcgTMSZ7RwneU,716
12
+ qena_shared_lib/dependencies/__init__.py,sha256=W12RgJbhqZ9GiSV1nLlHmpwPzvQv8t7f4JEoazM_WYg,350
13
+ qena_shared_lib/dependencies/http.py,sha256=IBsMnRr8Jh8ixf2IcU6n1aYRMazI3fF9GLZxHM2dsXk,1492
14
+ qena_shared_lib/dependencies/miscellaneous.py,sha256=iGwAjatXb_JVSF13n1vdTRAgSKv19VtHo9ZbjjbkIco,753
15
+ qena_shared_lib/logstash/__init__.py,sha256=KlWFXqwPGwKM3yWnz0lTmeZymkobxFPPNeOgyfdGu4g,315
16
+ qena_shared_lib/logstash/_base.py,sha256=bp6rPjEFvNzhjxVc6qwAZ7hi2DnTpcAw-TnIONEVQ2M,16073
17
+ qena_shared_lib/logstash/_http_sender.py,sha256=2LgVW17sicQ-oaFeKUwZhmQQQq8s1EQXd2ztpRu4UQc,1773
18
+ qena_shared_lib/logstash/_tcp_sender.py,sha256=CMPCycMq3Ts0vr2r5JvP3bmGMFJFl2un9HbpUWhyAyA,2397
19
+ qena_shared_lib/rabbitmq/__init__.py,sha256=lCP2qiXwdEBI81eeLQA5x54AizY0pTBk-1RYvP_Nqzs,1201
20
+ qena_shared_lib/rabbitmq/_base.py,sha256=Ab3CdbjT6WGngDzg-N6-8nraTbBslQXmtAECEC6aDY8,23424
21
+ qena_shared_lib/rabbitmq/_channel.py,sha256=amQH5vavNEYRBgqA7Hb76qA7fkj7Nfn-EX0Jfx3IH2Y,5812
22
+ qena_shared_lib/rabbitmq/_exception_handlers.py,sha256=2vAkJB-yJIWzDJWoZS-giAPtFtIamiyg_YUCnwowcxc,4553
23
+ qena_shared_lib/rabbitmq/_listener.py,sha256=f3OuJCoU5-_tZ8PDiO2dLqUdyVZLr99pD5zTNFlAjjw,46429
24
+ qena_shared_lib/rabbitmq/_pool.py,sha256=GZcJJygMfXEo5LLxaPB_qCDtgEElPCovHWTvY1VYfIM,1968
25
+ qena_shared_lib/rabbitmq/_publisher.py,sha256=vAWLrR4rS6aL2C4iHEk2jG69imoNuzbtzIW4zydqO2U,2468
26
+ qena_shared_lib/rabbitmq/_rpc_client.py,sha256=7eTs8svTuFFHqZrf2aHbHzWZoPHMicArEgtw0mSS_Ik,9231
27
+ qena_shared_lib-0.1.12.dist-info/METADATA,sha256=M4wZ3GtI_eqxIcabl_pahhhHH1phI0svnCDcJS2f4sA,11237
28
+ qena_shared_lib-0.1.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
+ qena_shared_lib-0.1.12.dist-info/RECORD,,
@@ -1,29 +0,0 @@
1
- qena_shared_lib/__init__.py,sha256=WokKEFaMNow6h2ZY_fyB-tiYnic-Ed6K6kyzKgg3Rlw,371
2
- qena_shared_lib/application.py,sha256=LyMgCrp1wqUfHsQktybWW-fZG-XugxZ6_Bafhp3gRls,5472
3
- qena_shared_lib/background.py,sha256=upWeJ747-4S4xsBOR-P2_oNar1YiaxCpnLhEDvnArmQ,3097
4
- qena_shared_lib/exception_handlers.py,sha256=qAXb8yE06yJRO2Qe9tfTu9D2DJhqgvX5wsc1_OPOjX4,6188
5
- qena_shared_lib/exceptions.py,sha256=GEGcSNaNMhFCdgCl6crNrrw-tmzPD-2Jz6MnpMvqXIU,9419
6
- qena_shared_lib/http.py,sha256=xpMOdyOSkZO70C87Vu_0q0Ud4KyNLrfpNOassAUnF00,23864
7
- qena_shared_lib/logging.py,sha256=JL6bAmkK1BJA84rZNpvDEmrec3dogQRpSug4fj1Omkw,1618
8
- qena_shared_lib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- qena_shared_lib/scheduler.py,sha256=wVLgHM0cCBZhqSmOAgEa5McEJSSTHfoMAEIrFGI0tT0,11946
10
- qena_shared_lib/security.py,sha256=MAq2Qf8FVYiUp8Iht82cVIPlyJGHReZC4LYKBF6N6cw,6076
11
- qena_shared_lib/utils.py,sha256=y60AKFknK-vus4i-nesgL00BWuAXJyd8Qx79Gi7lRq4,1272
12
- qena_shared_lib/dependencies/__init__.py,sha256=W12RgJbhqZ9GiSV1nLlHmpwPzvQv8t7f4JEoazM_WYg,350
13
- qena_shared_lib/dependencies/http.py,sha256=3KopQjq05qbYROMPZjji2Zz7qQLU6_2u3qKisLrjLks,1469
14
- qena_shared_lib/dependencies/miscellaneous.py,sha256=iGwAjatXb_JVSF13n1vdTRAgSKv19VtHo9ZbjjbkIco,753
15
- qena_shared_lib/logstash/__init__.py,sha256=KlWFXqwPGwKM3yWnz0lTmeZymkobxFPPNeOgyfdGu4g,315
16
- qena_shared_lib/logstash/_base.py,sha256=SRTcAwMOWk-sDxuu12-VGgbBts5HBmL3f6OJtQBvr18,15768
17
- qena_shared_lib/logstash/_http_sender.py,sha256=Sq3bJOXuOafqloROGblnmyUd0RuU3zF0QLpQDYjiy-g,1765
18
- qena_shared_lib/logstash/_tcp_sender.py,sha256=ncvc3wYxOJPkB7c_0W8vboaxMRJ_1UYGdA8LN2NXUpo,2306
19
- qena_shared_lib/rabbitmq/__init__.py,sha256=HKGd-CfbqNkTMDzF9dd-ZQlj5fQfnO5S9qzMcILy8xk,1151
20
- qena_shared_lib/rabbitmq/_base.py,sha256=S7jo4NbtAO8rzr7mBwhxRJrSmzrypOalrJChfrQ6-6I,23098
21
- qena_shared_lib/rabbitmq/_channel.py,sha256=R0xzZvLkeE4YWsyLhx8bPDramsTFDZIcCgfsDyFmSB4,5429
22
- qena_shared_lib/rabbitmq/_exception_handlers.py,sha256=gLkPFxQUW9faL8RApPT-Bqmn-fQ134q1ZvKInfRKjuo,4529
23
- qena_shared_lib/rabbitmq/_listener.py,sha256=1w5JAgwYy0xIU4kEZwL_KHyudfUWeqMWSXX5UdZ-p7M,46210
24
- qena_shared_lib/rabbitmq/_pool.py,sha256=MGubA-nYxxjgsZRF1yK4UBkzUy65t-suh0W1jZDk5q8,1952
25
- qena_shared_lib/rabbitmq/_publisher.py,sha256=Dr2u1IELCboCbozjTRsRtyQh7TRaJvujPsp74TF7utA,2434
26
- qena_shared_lib/rabbitmq/_rpc_client.py,sha256=eNzKpU_BvfDTR3udiSNtjJ4MaJqHrIOxMItKHA8aJbo,8909
27
- qena_shared_lib-0.1.10.dist-info/METADATA,sha256=9x9ScJEgC0yevgIlVBLA5_qbHZIy-C2vM6ABdphTlAU,11233
28
- qena_shared_lib-0.1.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
- qena_shared_lib-0.1.10.dist-info/RECORD,,