panther 4.2.0__py3-none-any.whl → 4.2.2__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.
panther/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from panther.main import Panther # noqa: F401
2
2
 
3
- __version__ = '4.2.0'
3
+ __version__ = '4.2.2'
4
4
 
5
5
 
6
6
  def version():
panther/base_websocket.py CHANGED
@@ -1,12 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import asyncio
4
- import logging
4
+ import orjson as json
5
5
  from multiprocessing.managers import SyncManager
6
6
  from typing import TYPE_CHECKING, Literal
7
7
 
8
- import orjson as json
9
-
8
+ import logging
10
9
  from panther import status
11
10
  from panther.base_request import BaseRequest
12
11
  from panther.configs import config
@@ -53,9 +52,14 @@ class WebsocketConnections(Singleton):
53
52
  logger.info("Subscribed to 'websocket_connections' queue")
54
53
  while True:
55
54
  try:
56
- received_message = queue.get()
55
+ received_message = await asyncio.to_thread(queue.get)
56
+ if received_message is None:
57
+ # The None came from the CancelledError, so break the loop
58
+ break
57
59
  await self._handle_received_message(received_message=received_message)
58
- except InterruptedError:
60
+ except (InterruptedError, asyncio.CancelledError):
61
+ # Put the None to the queue, so the executor knows that it ends
62
+ queue.put(None)
59
63
  break
60
64
  else:
61
65
  # We have a redis connection, so use it for pubsub
@@ -1,6 +1,7 @@
1
1
  import contextlib
2
2
  import logging
3
3
  import os
4
+ import platform
4
5
  import signal
5
6
  from collections import deque
6
7
  from pathlib import Path
@@ -43,7 +44,12 @@ class Monitoring:
43
44
  ):
44
45
  f.readlines() # Set cursor at the end of the file
45
46
 
46
- for _ in watch(self.monitoring_log_file):
47
+ if platform.system() == 'Windows':
48
+ watching = watch(self.monitoring_log_file, force_polling=True)
49
+ else:
50
+ watching = watch(self.monitoring_log_file)
51
+
52
+ for _ in watching:
47
53
  for line in f.readlines():
48
54
  self.rows.append(line.split('|'))
49
55
  live.update(self.generate_table())
@@ -63,7 +69,8 @@ class Monitoring:
63
69
  self.update_rows()
64
70
 
65
71
  # Register the signal handler
66
- signal.signal(signal.SIGWINCH, self.update_rows)
72
+ if platform.system() != 'Windows':
73
+ signal.signal(signal.SIGWINCH, self.update_rows)
67
74
 
68
75
  def generate_table(self) -> Panel:
69
76
  # 2023-03-24 01:42:52 | GET | /user/317/ | 127.0.0.1:48856 | 0.0366 ms | 200
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: panther
3
- Version: 4.2.0
3
+ Version: 4.2.2
4
4
  Summary: Fast & Friendly, Web Framework For Building Async APIs
5
5
  Home-page: https://github.com/alirn76/panther
6
6
  Author: Ali RajabNezhad
@@ -1,11 +1,11 @@
1
- panther/__init__.py,sha256=sduiFCRbp6Nv6i1LB-sOh5Eb8lOJMR-Plz6Th79QwCs,110
1
+ panther/__init__.py,sha256=Sv6vixQQrNOJFV4kgGUL-pMtNbXp7MrXCoCs7BYP6p0,110
2
2
  panther/_load_configs.py,sha256=AVkoixkUFkBQiTmrLrwCmg0eiPW2U_Uw2EGNEGQRfnI,9281
3
3
  panther/_utils.py,sha256=j0rwIxTf0rtcZAAD-1nGE-_bWpvinyKtnwt3uO0hMmY,4330
4
4
  panther/app.py,sha256=e2eb4sXIaBje5vpcm4pbvvEO_sj83pLfBHCIZJFFX38,8222
5
5
  panther/authentications.py,sha256=gf7BVyQ8vXKhiumJAtD0aAK7uIHWx_snbOKYAKrYuVw,5677
6
6
  panther/background_tasks.py,sha256=HBYubDIiO_673cl_5fqCUP9zzimzRgRkDSkag9Msnbs,7656
7
7
  panther/base_request.py,sha256=XD2v1gLWcCKHePowRxT6_fYnS4tdKFxTLINMX0HQu8M,3880
8
- panther/base_websocket.py,sha256=iJUIbrfnh3ZLXlmKxTswMw158eNvtBFi8RZ-aBBmc8w,10643
8
+ panther/base_websocket.py,sha256=L0tiQQjg7E3462cd91PMf_SoVMMK4YiwW45yTFdTLhY,10973
9
9
  panther/caching.py,sha256=ltuJYdjNiAaKIs3jpO5EBpL8Y6CF1vAIQqh8J_Np10g,4098
10
10
  panther/configs.py,sha256=EaLApT6nYcguBoNXBG_8n6DU6HTNxsulI2943j8UAkE,3174
11
11
  panther/events.py,sha256=bxDqrfiNNBlvD03vEk2LDK4xbMzTMFVcgAjx2ein7mI,1158
@@ -29,7 +29,7 @@ panther/websocket.py,sha256=5WLw--Oa-6kGYbeRvO79hjbd0ARFcTTF40-hO_bdjmQ,1206
29
29
  panther/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  panther/cli/create_command.py,sha256=mT5GFzsTYZbzqShNHlw_UIkMcWLw9btm2mTwcg7TlfI,10292
31
31
  panther/cli/main.py,sha256=pCqnOTazgMhTvFHTugutIsiFXueU5kx2VmGngwAl54Q,1679
32
- panther/cli/monitor_command.py,sha256=7N1-4W0Lu7yl5maehJowe04WH4nxZ1DumGDRATh82SQ,3139
32
+ panther/cli/monitor_command.py,sha256=sbnxQOSy0Q6GB-ELrfyoY6S-ZwgbI7eZyKx7YkvrEas,3383
33
33
  panther/cli/run_command.py,sha256=yWcDoWC-c4ph4M5EDj0jvR9xSjh-apG5r6-NpDdArUo,2195
34
34
  panther/cli/template.py,sha256=hVkY1A3HZDVGEZzRkMtYte6FagKGTAxoFeG0wot7Zn4,5320
35
35
  panther/cli/utils.py,sha256=Jd4YQ9H6lapVktl7ZmiORt30WVmKI85xcwsY-fMRq3c,5289
@@ -49,9 +49,9 @@ panther/panel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
49
  panther/panel/apis.py,sha256=COsbwKZyTgyHvHYbpDfusifAH9ojMS3z1KhZCt9M-Ms,2428
50
50
  panther/panel/urls.py,sha256=JiV-H4dWE-m_bfaTTVxzOxTvJmOWhyLOvcbM7xU3Bn4,240
51
51
  panther/panel/utils.py,sha256=0Rv79oR5IEqalqwpRKQHMn1p5duVY5mxMqDKiA5mWx4,437
52
- panther-4.2.0.dist-info/LICENSE,sha256=2aF1hL2aC0zRPjzUkSxJUzZbn2_uLoOkn7DHjzZni-I,1524
53
- panther-4.2.0.dist-info/METADATA,sha256=N0SkpG2_UqpwuGhnGC8zOUdmnMYKNaaJG4sJaYl0UEk,6376
54
- panther-4.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
55
- panther-4.2.0.dist-info/entry_points.txt,sha256=6GPxYFGuzVfNB4YpHFJvYex6iWah5_tLnirAHwj2Qsg,51
56
- panther-4.2.0.dist-info/top_level.txt,sha256=VbBs02JGXTIoHMzsX-eLOk2MCbBZzQbLhWiYpI7xI2g,8
57
- panther-4.2.0.dist-info/RECORD,,
52
+ panther-4.2.2.dist-info/LICENSE,sha256=2aF1hL2aC0zRPjzUkSxJUzZbn2_uLoOkn7DHjzZni-I,1524
53
+ panther-4.2.2.dist-info/METADATA,sha256=WuUnOJAvGmczG9Mq0UJu0dKjaFLDqL6Vqvvh0cceGD0,6376
54
+ panther-4.2.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
55
+ panther-4.2.2.dist-info/entry_points.txt,sha256=6GPxYFGuzVfNB4YpHFJvYex6iWah5_tLnirAHwj2Qsg,51
56
+ panther-4.2.2.dist-info/top_level.txt,sha256=VbBs02JGXTIoHMzsX-eLOk2MCbBZzQbLhWiYpI7xI2g,8
57
+ panther-4.2.2.dist-info/RECORD,,