CheeseAPI 1.7.0__tar.gz → 1.7.2__tar.gz
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.
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/response.py +1 -1
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/schedule.py +8 -9
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/PKG-INFO +1 -1
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/pyproject.toml +1 -1
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/.gitignore +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/__init__.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/app.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/cors.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/exception.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/file.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/handle.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/protocol.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/request.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/route.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/server.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/signal.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/text.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/validator.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/websocket.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/CheeseAPI/workspace.py +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/LICENSE +0 -0
- {cheeseapi-1.7.0 → cheeseapi-1.7.2}/README.md +0 -0
|
@@ -466,7 +466,7 @@ class JsonResponse(BaseResponse):
|
|
|
466
466
|
'''
|
|
467
467
|
|
|
468
468
|
def __init__(self, body: dict | list = {}, status: HTTPStatus | int = HTTPStatus_OK, headers: Dict[str, str] = {}):
|
|
469
|
-
super().__init__(dumps(body)
|
|
469
|
+
super().__init__(dumps(body), status, {
|
|
470
470
|
'Content-Type': 'application/json',
|
|
471
471
|
**headers
|
|
472
472
|
})
|
|
@@ -15,7 +15,6 @@ if TYPE_CHECKING:
|
|
|
15
15
|
logger_danger = logger.danger
|
|
16
16
|
logger_encode = logger.encode
|
|
17
17
|
datetime_now = datetime.now
|
|
18
|
-
DATA_LENGTH = 1024
|
|
19
18
|
|
|
20
19
|
class ScheduleTask:
|
|
21
20
|
def __init__(self, app: 'App', key: str):
|
|
@@ -58,14 +57,14 @@ class ScheduleTask:
|
|
|
58
57
|
@property
|
|
59
58
|
def fn(self) -> Callable:
|
|
60
59
|
fn = self._app._managers_['schedules'][self.key]['fn']
|
|
61
|
-
return loads(uncompress(memoryview(fn).toreadonly() if len(fn) >=
|
|
60
|
+
return loads(uncompress(memoryview(fn).toreadonly() if len(fn) >= 1024 else fn))
|
|
62
61
|
|
|
63
62
|
@fn.setter
|
|
64
63
|
def fn(self, value: Callable):
|
|
65
64
|
value = dumps(value, recurse = True)
|
|
66
65
|
self._app._managers_['schedules'][self.key] = {
|
|
67
66
|
**self._app._managers_['schedules'][self.key],
|
|
68
|
-
'fn': compress(memoryview(value).toreadonly() if len(value) >=
|
|
67
|
+
'fn': compress(memoryview(value).toreadonly() if len(value) >= 1024 else value),
|
|
69
68
|
'needUpdate': True
|
|
70
69
|
}
|
|
71
70
|
|
|
@@ -214,7 +213,7 @@ class ScheduleTask:
|
|
|
214
213
|
'''
|
|
215
214
|
|
|
216
215
|
lastReturn = self._app._managers_['schedules'][self.key]['lastReturn']
|
|
217
|
-
return loads(uncompress(memoryview(lastReturn).toreadonly() if len(lastReturn) >=
|
|
216
|
+
return loads(uncompress(memoryview(lastReturn).toreadonly() if len(lastReturn) >= 1024 else lastReturn))
|
|
218
217
|
|
|
219
218
|
@property
|
|
220
219
|
def endTimer(self) -> datetime | None:
|
|
@@ -327,7 +326,7 @@ class Scheduler:
|
|
|
327
326
|
**self._app._managers_['schedules'][task.key],
|
|
328
327
|
'total_repetition_num': task.total_repetition_num + 1,
|
|
329
328
|
'lastTimer': datetime_fromtimestamp(runTime),
|
|
330
|
-
'lastReturn': compress(memoryview(result).toreadonly() if len(result) >=
|
|
329
|
+
'lastReturn': compress(memoryview(result).toreadonly() if len(result) >= 1024 else result)
|
|
331
330
|
}
|
|
332
331
|
queues[0].put(True)
|
|
333
332
|
|
|
@@ -424,7 +423,7 @@ class Scheduler:
|
|
|
424
423
|
fn = dumps(fn, recurse = True)
|
|
425
424
|
self._app._managers_['schedules'][key] = {
|
|
426
425
|
'timer': timer,
|
|
427
|
-
'fn': compress(memoryview(fn).toreadonly() if len(fn) >
|
|
426
|
+
'fn': compress(memoryview(fn).toreadonly() if len(fn) > 1024 else fn),
|
|
428
427
|
'startTimer': startTimer,
|
|
429
428
|
'expected_repetition_num': expected_repetition_num,
|
|
430
429
|
'total_repetition_num': 0,
|
|
@@ -432,7 +431,7 @@ class Scheduler:
|
|
|
432
431
|
'active': True,
|
|
433
432
|
'lastTimer': None,
|
|
434
433
|
'intervalTime': intervalTime or (self._app.server.intervalTime if timer == 'PER_FRAME' else timer.total_seconds()) / 10,
|
|
435
|
-
'lastReturn': dumps(None, recurse = True),
|
|
434
|
+
'lastReturn': compress(dumps(None, recurse = True)),
|
|
436
435
|
'needUpdate': False,
|
|
437
436
|
'endTimer': endTimer
|
|
438
437
|
}
|
|
@@ -442,7 +441,7 @@ class Scheduler:
|
|
|
442
441
|
fn = dumps(fn, recurse = True)
|
|
443
442
|
self._app._managers_['schedules'][key] = {
|
|
444
443
|
'timer': timer,
|
|
445
|
-
'fn': compress(memoryview(fn).toreadonly() if len(fn) >=
|
|
444
|
+
'fn': compress(memoryview(fn).toreadonly() if len(fn) >= 1024 else fn),
|
|
446
445
|
'startTimer': startTimer,
|
|
447
446
|
'expected_repetition_num': expected_repetition_num,
|
|
448
447
|
'total_repetition_num': 0,
|
|
@@ -450,7 +449,7 @@ class Scheduler:
|
|
|
450
449
|
'active': True,
|
|
451
450
|
'lastTimer': None,
|
|
452
451
|
'intervalTime': intervalTime or (self._app.server.intervalTime if timer == 'PER_FRAME' else timer.total_seconds()) / 10,
|
|
453
|
-
'lastReturn': dumps(None, recurse = True),
|
|
452
|
+
'lastReturn': compress(dumps(None, recurse = True)),
|
|
454
453
|
'needUpdate': False,
|
|
455
454
|
'endTimer': endTimer
|
|
456
455
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|