CheeseAPI 2.0.5b4__tar.gz → 2.0.6__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-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/app.py +32 -96
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/file.py +1 -3
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/request.py +1 -3
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/route.py +3 -9
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/scheduler.py +20 -51
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/signal.py +14 -42
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/PKG-INFO +1 -1
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/pyproject.toml +1 -1
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/.gitignore +0 -0
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/__init__.py +0 -0
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/cors.py +0 -0
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/printer.py +0 -0
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/response.py +0 -0
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/static.py +0 -0
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/validator.py +0 -0
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/CheeseAPI/websocket.py +0 -0
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/LICENSE +0 -0
- {cheeseapi-2.0.5b4 → cheeseapi-2.0.6}/README.md +0 -0
|
@@ -590,169 +590,127 @@ class CheeseAPI:
|
|
|
590
590
|
|
|
591
591
|
@property
|
|
592
592
|
def logger_path(self) -> str | None:
|
|
593
|
-
'''
|
|
594
|
-
日志文件路径,支持日期格式化
|
|
595
|
-
'''
|
|
593
|
+
''' 日志文件路径,支持日期格式化 '''
|
|
596
594
|
|
|
597
595
|
return self._logger_path
|
|
598
596
|
|
|
599
597
|
@property
|
|
600
598
|
def dual_stack(self) -> bool:
|
|
601
|
-
'''
|
|
602
|
-
是否启用双栈支持;若系统不支持,则自动回退
|
|
603
|
-
'''
|
|
599
|
+
''' 是否启用双栈支持;若系统不支持,则自动回退 '''
|
|
604
600
|
|
|
605
601
|
return self._dual_stack
|
|
606
602
|
|
|
607
603
|
@property
|
|
608
604
|
def socket_backlog(self) -> int | None:
|
|
609
|
-
'''
|
|
610
|
-
最大连接数
|
|
611
|
-
'''
|
|
605
|
+
''' 最大连接数 '''
|
|
612
606
|
|
|
613
607
|
return self._socket_backlog
|
|
614
608
|
|
|
615
609
|
@property
|
|
616
610
|
def socket_send_buffer_size(self) -> int | None:
|
|
617
|
-
'''
|
|
618
|
-
发送缓冲区大小
|
|
619
|
-
'''
|
|
611
|
+
''' 发送缓冲区大小 '''
|
|
620
612
|
|
|
621
613
|
return self._socket_send_buffer_size
|
|
622
614
|
|
|
623
615
|
@property
|
|
624
616
|
def socket_receive_buffer_size(self) -> int | None:
|
|
625
|
-
'''
|
|
626
|
-
接收缓冲区大小
|
|
627
|
-
'''
|
|
617
|
+
''' 接收缓冲区大小 '''
|
|
628
618
|
|
|
629
619
|
return self._socket_receive_buffer_size
|
|
630
620
|
|
|
631
621
|
@property
|
|
632
622
|
def workers(self) -> int:
|
|
633
|
-
'''
|
|
634
|
-
工作进程数
|
|
635
|
-
'''
|
|
623
|
+
''' 工作进程数 '''
|
|
636
624
|
|
|
637
625
|
return self._workers
|
|
638
626
|
|
|
639
627
|
@property
|
|
640
628
|
def ssl_cert(self) -> str | None:
|
|
641
|
-
'''
|
|
642
|
-
SSL 证书路径
|
|
643
|
-
'''
|
|
629
|
+
''' SSL 证书路径 '''
|
|
644
630
|
|
|
645
631
|
return self._ssl_cert
|
|
646
632
|
|
|
647
633
|
@property
|
|
648
634
|
def ssl_key(self) -> str | None:
|
|
649
|
-
'''
|
|
650
|
-
SSL 密钥路径
|
|
651
|
-
'''
|
|
635
|
+
''' SSL 密钥路径 '''
|
|
652
636
|
|
|
653
637
|
return self._ssl_key
|
|
654
638
|
|
|
655
639
|
@property
|
|
656
640
|
def sync_server_url(self) -> str | None:
|
|
657
|
-
'''
|
|
658
|
-
同步服务器地址,用于多进程间同步数据;支持redis
|
|
659
|
-
'''
|
|
641
|
+
''' 同步服务器地址,用于多进程间同步数据;支持redis '''
|
|
660
642
|
|
|
661
643
|
return self._sync_server_url
|
|
662
644
|
|
|
663
645
|
@property
|
|
664
646
|
def static_path(self) -> dict[str, str]:
|
|
665
|
-
'''
|
|
666
|
-
静态文件路径映射,格式为`{url_path: file_system_path}`
|
|
667
|
-
'''
|
|
647
|
+
''' 静态文件路径映射,格式为`{url_path: file_system_path}` '''
|
|
668
648
|
|
|
669
649
|
return self._static_path
|
|
670
650
|
|
|
671
651
|
@property
|
|
672
652
|
def printer(self) -> Type[Printer]:
|
|
673
|
-
'''
|
|
674
|
-
自定义消息输出
|
|
675
|
-
'''
|
|
653
|
+
''' 自定义消息输出 '''
|
|
676
654
|
|
|
677
655
|
return self._printer
|
|
678
656
|
|
|
679
657
|
@property
|
|
680
658
|
def compress(self) -> list[Literal['gzip', 'br', 'zstd', 'deflate']]:
|
|
681
|
-
'''
|
|
682
|
-
支持的压缩算法,按照顺序尝试压缩
|
|
683
|
-
'''
|
|
659
|
+
''' 支持的压缩算法,按照顺序尝试压缩 '''
|
|
684
660
|
|
|
685
661
|
return self._compress
|
|
686
662
|
|
|
687
663
|
@property
|
|
688
664
|
def compress_min_length(self) -> int:
|
|
689
|
-
'''
|
|
690
|
-
启用压缩的最小响应体长度
|
|
691
|
-
'''
|
|
665
|
+
''' 启用压缩的最小响应体长度 '''
|
|
692
666
|
|
|
693
667
|
return self._compress_min_length
|
|
694
668
|
|
|
695
669
|
@property
|
|
696
670
|
def compress_level(self) -> int:
|
|
697
|
-
'''
|
|
698
|
-
压缩等级,每个算法的压缩级别可能不同,详见各算法文档
|
|
699
|
-
'''
|
|
671
|
+
''' 压缩等级,每个算法的压缩级别可能不同,详见各算法文档 '''
|
|
700
672
|
|
|
701
673
|
return self._compress_level
|
|
702
674
|
|
|
703
675
|
@property
|
|
704
676
|
def manual_modules(self) -> list[str]:
|
|
705
|
-
'''
|
|
706
|
-
手动加载的模块列表
|
|
707
|
-
'''
|
|
677
|
+
''' 手动加载的模块列表 '''
|
|
708
678
|
|
|
709
679
|
return self._manual_modules
|
|
710
680
|
|
|
711
681
|
@property
|
|
712
682
|
def exclude_modules(self) -> list[str]:
|
|
713
|
-
'''
|
|
714
|
-
排除加载的模块列表
|
|
715
|
-
'''
|
|
683
|
+
''' 排除加载的模块列表 '''
|
|
716
684
|
|
|
717
685
|
return self._exclude_modules
|
|
718
686
|
|
|
719
687
|
@property
|
|
720
688
|
def priority_modules(self) -> list[str]:
|
|
721
|
-
'''
|
|
722
|
-
优先加载的模块列表
|
|
723
|
-
'''
|
|
689
|
+
''' 优先加载的模块列表 '''
|
|
724
690
|
|
|
725
691
|
return self._priority_modules
|
|
726
692
|
|
|
727
693
|
@property
|
|
728
694
|
def sync_server_data_encode(self) -> Callable[[bytes], bytes] | None:
|
|
729
|
-
'''
|
|
730
|
-
同步服务器数据编码处理函数
|
|
731
|
-
'''
|
|
695
|
+
''' 同步服务器数据编码处理函数 '''
|
|
732
696
|
|
|
733
697
|
return self._sync_server_data_encode
|
|
734
698
|
|
|
735
699
|
@property
|
|
736
700
|
def sync_server_data_decode(self) -> Callable[[bytes], bytes] | None:
|
|
737
|
-
'''
|
|
738
|
-
同步服务器数据解码处理函数
|
|
739
|
-
'''
|
|
701
|
+
''' 同步服务器数据解码处理函数 '''
|
|
740
702
|
|
|
741
703
|
return self._sync_server_data_decode
|
|
742
704
|
|
|
743
705
|
@property
|
|
744
706
|
def logger_messages(self) -> dict[str, 'Message']:
|
|
745
|
-
'''
|
|
746
|
-
归属于 CheeseAPI 日志的消息列表
|
|
747
|
-
'''
|
|
707
|
+
''' 归属于 CheeseAPI 日志的消息列表 '''
|
|
748
708
|
|
|
749
709
|
return self._logger_messages
|
|
750
710
|
|
|
751
711
|
@property
|
|
752
712
|
def logger(self) -> CheeseLogger:
|
|
753
|
-
'''
|
|
754
|
-
归属于 CheeseAPI 日志实例
|
|
755
|
-
'''
|
|
713
|
+
''' 归属于 CheeseAPI 日志实例 '''
|
|
756
714
|
|
|
757
715
|
return self._logger
|
|
758
716
|
|
|
@@ -770,9 +728,7 @@ class CheeseAPI:
|
|
|
770
728
|
|
|
771
729
|
@property
|
|
772
730
|
def keep_alive(self) -> bool:
|
|
773
|
-
'''
|
|
774
|
-
是否启用长连接
|
|
775
|
-
'''
|
|
731
|
+
''' 是否启用长连接 '''
|
|
776
732
|
|
|
777
733
|
return self._keep_alive
|
|
778
734
|
|
|
@@ -782,49 +738,37 @@ class CheeseAPI:
|
|
|
782
738
|
|
|
783
739
|
@property
|
|
784
740
|
def keep_alive_max_requests(self) -> int:
|
|
785
|
-
'''
|
|
786
|
-
长连接最大请求次数
|
|
787
|
-
'''
|
|
741
|
+
''' 长连接最大请求次数 '''
|
|
788
742
|
|
|
789
743
|
return self._keep_alive_max_requests
|
|
790
744
|
|
|
791
745
|
@property
|
|
792
746
|
def AppProxy_Class(self) -> Type[AppProxy]:
|
|
793
|
-
'''
|
|
794
|
-
若想要对底层逻辑进行处理,可传入自定义的 AppProxy 类
|
|
795
|
-
'''
|
|
747
|
+
''' 若想要对底层逻辑进行处理,可传入自定义的 AppProxy 类 '''
|
|
796
748
|
|
|
797
749
|
return self._AppProxy_Class
|
|
798
750
|
|
|
799
751
|
@property
|
|
800
752
|
def RequestProxy_Class(self) -> Type[RequestProxy]:
|
|
801
|
-
'''
|
|
802
|
-
若想要对请求处理逻辑进行处理,可传入自定义的 RequestProxy 类
|
|
803
|
-
'''
|
|
753
|
+
''' 若想要对请求处理逻辑进行处理,可传入自定义的 RequestProxy 类 '''
|
|
804
754
|
|
|
805
755
|
return self._RequestProxy_Class
|
|
806
756
|
|
|
807
757
|
@property
|
|
808
758
|
def ResponseProxy_Class(self) -> Type[ResponseProxy]:
|
|
809
|
-
'''
|
|
810
|
-
若想要对响应处理逻辑进行处理,可传入自定义的 ResponseProxy 类
|
|
811
|
-
'''
|
|
759
|
+
''' 若想要对响应处理逻辑进行处理,可传入自定义的 ResponseProxy 类 '''
|
|
812
760
|
|
|
813
761
|
return self._ResponseProxy_Class
|
|
814
762
|
|
|
815
763
|
@property
|
|
816
764
|
def RouteProxy_Class(self) -> Type[RouteProxy]:
|
|
817
|
-
'''
|
|
818
|
-
若想要对路由处理逻辑进行处理,可传入自定义的 RouteProxy 类
|
|
819
|
-
'''
|
|
765
|
+
''' 若想要对路由处理逻辑进行处理,可传入自定义的 RouteProxy 类 '''
|
|
820
766
|
|
|
821
767
|
return self._RouteProxy_Class
|
|
822
768
|
|
|
823
769
|
@property
|
|
824
770
|
def route(self) -> AppRoute:
|
|
825
|
-
'''
|
|
826
|
-
总路由
|
|
827
|
-
'''
|
|
771
|
+
''' 总路由 '''
|
|
828
772
|
|
|
829
773
|
return self._route
|
|
830
774
|
|
|
@@ -834,32 +778,24 @@ class CheeseAPI:
|
|
|
834
778
|
|
|
835
779
|
@property
|
|
836
780
|
def WebsocketProxy_Class(self) -> Type[WebsocketProxy]:
|
|
837
|
-
'''
|
|
838
|
-
若想要对 Websocket 处理逻辑进行处理,可传入自定义的 WebsocketProxy 类
|
|
839
|
-
'''
|
|
781
|
+
''' 若想要对 Websocket 处理逻辑进行处理,可传入自定义的 WebsocketProxy 类 '''
|
|
840
782
|
|
|
841
783
|
return self._WebsocketProxy_Class
|
|
842
784
|
|
|
843
785
|
@property
|
|
844
786
|
def scheduler(self) -> 'Scheduler':
|
|
845
|
-
'''
|
|
846
|
-
任务调度
|
|
847
|
-
'''
|
|
787
|
+
''' 任务调度 '''
|
|
848
788
|
|
|
849
789
|
return self._scheduler
|
|
850
790
|
|
|
851
791
|
@property
|
|
852
792
|
def SchedulerProxy_Class(self) -> Type[SchedulerProxy]:
|
|
853
|
-
'''
|
|
854
|
-
自定义任务调度器代理类
|
|
855
|
-
'''
|
|
793
|
+
''' 自定义任务调度器代理类 '''
|
|
856
794
|
|
|
857
795
|
return self._SchedulerProxy_Class
|
|
858
796
|
|
|
859
797
|
@property
|
|
860
798
|
def sync_server_timeout(self) -> float:
|
|
861
|
-
'''
|
|
862
|
-
同步服务器操作超时时间
|
|
863
|
-
'''
|
|
799
|
+
''' 同步服务器操作超时时间 '''
|
|
864
800
|
|
|
865
801
|
return self._sync_server_timeout
|
|
@@ -48,9 +48,7 @@ class Request:
|
|
|
48
48
|
return await self._proxy.recv_body(get_all = get_all)
|
|
49
49
|
|
|
50
50
|
async def parse_body(self):
|
|
51
|
-
'''
|
|
52
|
-
若在路由中设置了 `auto_recv_body = False`,则需要手动调用此方法解析请求体
|
|
53
|
-
'''
|
|
51
|
+
''' 若在路由中设置了 `auto_recv_body = False`,则需要手动调用此方法解析请求体 '''
|
|
54
52
|
|
|
55
53
|
await self._proxy.parse_body()
|
|
56
54
|
|
|
@@ -137,9 +137,7 @@ class Route:
|
|
|
137
137
|
|
|
138
138
|
@property
|
|
139
139
|
def path(self) -> str:
|
|
140
|
-
'''
|
|
141
|
-
路由前缀
|
|
142
|
-
'''
|
|
140
|
+
''' 路由前缀 '''
|
|
143
141
|
|
|
144
142
|
return self._path
|
|
145
143
|
|
|
@@ -179,17 +177,13 @@ class AppRoute(Route):
|
|
|
179
177
|
|
|
180
178
|
@property
|
|
181
179
|
def patterns(self) -> list[Pattern]:
|
|
182
|
-
'''
|
|
183
|
-
动态路由匹配模式
|
|
184
|
-
'''
|
|
180
|
+
''' 动态路由匹配模式 '''
|
|
185
181
|
|
|
186
182
|
return self._patterns
|
|
187
183
|
|
|
188
184
|
@property
|
|
189
185
|
def routes(self) -> dict[str, dict[HTTP_METHOD_TYPE, RouteDict]]:
|
|
190
|
-
'''
|
|
191
|
-
所有路由
|
|
192
|
-
'''
|
|
186
|
+
''' 所有路由 '''
|
|
193
187
|
|
|
194
188
|
return self._routes
|
|
195
189
|
|
|
@@ -108,33 +108,25 @@ class Task:
|
|
|
108
108
|
|
|
109
109
|
@property
|
|
110
110
|
def last_run_timer(self) -> datetime.datetime | None:
|
|
111
|
-
'''
|
|
112
|
-
上一次的运行时刻
|
|
113
|
-
'''
|
|
111
|
+
''' 上一次的运行时刻 '''
|
|
114
112
|
|
|
115
113
|
return self._last_run_timer
|
|
116
114
|
|
|
117
115
|
@property
|
|
118
116
|
def last_run_time(self) -> float | None:
|
|
119
|
-
'''
|
|
120
|
-
上一次的运行耗时
|
|
121
|
-
'''
|
|
117
|
+
''' 上一次的运行耗时 '''
|
|
122
118
|
|
|
123
119
|
return self._last_run_time
|
|
124
120
|
|
|
125
121
|
@property
|
|
126
122
|
def run_num(self) -> int:
|
|
127
|
-
'''
|
|
128
|
-
运行次数
|
|
129
|
-
'''
|
|
123
|
+
''' 运行次数 '''
|
|
130
124
|
|
|
131
125
|
return self._run_num
|
|
132
126
|
|
|
133
127
|
@property
|
|
134
128
|
def is_running(self) -> bool:
|
|
135
|
-
'''
|
|
136
|
-
任务是否在运行中
|
|
137
|
-
'''
|
|
129
|
+
''' 任务是否在运行中 '''
|
|
138
130
|
|
|
139
131
|
return not self._queue.qsize()
|
|
140
132
|
|
|
@@ -180,72 +172,53 @@ class Scheduler:
|
|
|
180
172
|
return await self._proxy.async_add(interval_time, fn, first_run_timer = first_run_timer, expected_run_num = expected_run_num, key = key, args = args, kwargs = kwargs, auto_remove = auto_remove, timeout = timeout)
|
|
181
173
|
|
|
182
174
|
def start(self, key: str):
|
|
183
|
-
'''
|
|
184
|
-
启动任务
|
|
185
|
-
'''
|
|
175
|
+
''' 启动任务 '''
|
|
186
176
|
|
|
187
177
|
self._proxy.start(key)
|
|
188
178
|
|
|
189
179
|
async def async_start(self, key: str):
|
|
190
|
-
'''
|
|
191
|
-
启动任务
|
|
192
|
-
'''
|
|
180
|
+
''' 启动任务 '''
|
|
193
181
|
|
|
194
182
|
await self._proxy.async_start(key)
|
|
195
183
|
|
|
196
184
|
def stop(self, key: str):
|
|
197
|
-
'''
|
|
198
|
-
|
|
199
|
-
'''
|
|
185
|
+
''' 停止任务 '''
|
|
186
|
+
|
|
200
187
|
|
|
201
188
|
self._proxy.stop(key)
|
|
202
189
|
|
|
203
190
|
def remove(self, key: str):
|
|
204
|
-
'''
|
|
205
|
-
移除任务
|
|
206
|
-
'''
|
|
191
|
+
''' 移除任务 '''
|
|
207
192
|
|
|
208
193
|
self._proxy.remove(key)
|
|
209
194
|
|
|
210
195
|
async def async_stop(self, key: str):
|
|
211
|
-
'''
|
|
212
|
-
停止任务
|
|
213
|
-
'''
|
|
196
|
+
''' 停止任务 '''
|
|
214
197
|
|
|
215
198
|
await self._proxy.async_stop(key)
|
|
216
199
|
|
|
217
200
|
async def async_remove(self, key: str):
|
|
218
|
-
'''
|
|
219
|
-
移除任务
|
|
220
|
-
'''
|
|
201
|
+
''' 移除任务 '''
|
|
221
202
|
|
|
222
203
|
await self._proxy.async_remove(key)
|
|
223
204
|
|
|
224
205
|
def get_tasks(self) -> dict[str, Task]:
|
|
225
|
-
'''
|
|
226
|
-
获取所有任务
|
|
227
|
-
'''
|
|
206
|
+
''' 获取所有任务 '''
|
|
228
207
|
|
|
229
208
|
return self._proxy.get_tasks()
|
|
230
209
|
|
|
231
210
|
async def async_get_tasks(self) -> dict[str, Task]:
|
|
232
|
-
'''
|
|
233
|
-
获取所有任务
|
|
234
|
-
'''
|
|
211
|
+
''' 获取所有任务 '''
|
|
235
212
|
|
|
236
213
|
return await self._proxy.async_get_tasks()
|
|
237
214
|
|
|
238
215
|
def get_task(self, key: str) -> Task | None:
|
|
239
|
-
'''
|
|
240
|
-
获取任务
|
|
241
|
-
'''
|
|
216
|
+
''' 获取任务 '''
|
|
242
217
|
|
|
243
218
|
return self._proxy.get_task(key)
|
|
244
219
|
|
|
245
220
|
async def async_get_task(self, key: str) -> Task | None:
|
|
246
|
-
'''
|
|
247
|
-
获取任务
|
|
248
|
-
'''
|
|
221
|
+
''' 获取任务 '''
|
|
249
222
|
|
|
250
223
|
return await self._proxy.async_get_task(key)
|
|
251
224
|
|
|
@@ -477,7 +450,7 @@ class SchedulerProxy:
|
|
|
477
450
|
await asyncio.sleep(max(0, task.interval_time - time.time() + now))
|
|
478
451
|
|
|
479
452
|
if not task or task.auto_remove:
|
|
480
|
-
self._tasks.pop(
|
|
453
|
+
self._tasks.pop(key, None)
|
|
481
454
|
if static.scheduler_sync_servers is not None:
|
|
482
455
|
await redis.asyncio.Redis(connection_pool = static.scheduler_sync_servers[1]).hdel('CheeseAPI_scheduler_tasks', key)
|
|
483
456
|
else:
|
|
@@ -544,10 +517,8 @@ class SchedulerProxy:
|
|
|
544
517
|
|
|
545
518
|
def remove(self, key: str):
|
|
546
519
|
task = self.get_task(key)
|
|
547
|
-
if not task:
|
|
548
|
-
|
|
549
|
-
if not task.is_running:
|
|
550
|
-
raise KeyError(f'Task with key "{key}" is not running')
|
|
520
|
+
if not task or not task.is_running:
|
|
521
|
+
return
|
|
551
522
|
|
|
552
523
|
_task = self._tasks.get(key)
|
|
553
524
|
if not _task:
|
|
@@ -576,10 +547,8 @@ class SchedulerProxy:
|
|
|
576
547
|
|
|
577
548
|
async def async_remove(self, key: str):
|
|
578
549
|
task = await self.async_get_task(key)
|
|
579
|
-
if not task:
|
|
580
|
-
|
|
581
|
-
if not task.is_running:
|
|
582
|
-
raise KeyError(f'Task with key "{key}" is remove')
|
|
550
|
+
if not task or not task.is_running:
|
|
551
|
+
return
|
|
583
552
|
|
|
584
553
|
_task = self._tasks.get(key)
|
|
585
554
|
if not _task:
|
|
@@ -36,33 +36,25 @@ class Signal:
|
|
|
36
36
|
|
|
37
37
|
@property
|
|
38
38
|
def before_load_module(self) -> CheeseSignal:
|
|
39
|
-
'''
|
|
40
|
-
绑定函数`def func(*, index: int, module: str)`
|
|
41
|
-
'''
|
|
39
|
+
''' 绑定函数`def func(*, index: int, module: str)` '''
|
|
42
40
|
|
|
43
41
|
return self._before_load_module
|
|
44
42
|
|
|
45
43
|
@property
|
|
46
44
|
def after_load_module(self) -> CheeseSignal:
|
|
47
|
-
'''
|
|
48
|
-
绑定函数`def func(*, index: int, module: str)`
|
|
49
|
-
'''
|
|
45
|
+
''' 绑定函数`def func(*, index: int, module: str)` '''
|
|
50
46
|
|
|
51
47
|
return self._after_load_module
|
|
52
48
|
|
|
53
49
|
@property
|
|
54
50
|
def before_load_modules(self) -> CheeseSignal:
|
|
55
|
-
'''
|
|
56
|
-
绑定函数`def func(*, modules: list[str])`
|
|
57
|
-
'''
|
|
51
|
+
''' 绑定函数`def func(*, modules: list[str])` '''
|
|
58
52
|
|
|
59
53
|
return self._before_load_modules
|
|
60
54
|
|
|
61
55
|
@property
|
|
62
56
|
def after_load_modules(self) -> CheeseSignal:
|
|
63
|
-
'''
|
|
64
|
-
绑定函数`def func(*, modules: list[str])`
|
|
65
|
-
'''
|
|
57
|
+
''' 绑定函数`def func(*, modules: list[str])` '''
|
|
66
58
|
|
|
67
59
|
return self._after_load_modules
|
|
68
60
|
|
|
@@ -84,80 +76,60 @@ class Signal:
|
|
|
84
76
|
|
|
85
77
|
@property
|
|
86
78
|
def before_workers_start(self) -> CheeseSignal:
|
|
87
|
-
'''
|
|
88
|
-
绑定函数`def func(*, workers: int)`
|
|
89
|
-
'''
|
|
79
|
+
''' 绑定函数`def func(*, workers: int)` '''
|
|
90
80
|
|
|
91
81
|
return self._before_workers_start
|
|
92
82
|
|
|
93
83
|
@property
|
|
94
84
|
def after_workers_start(self) -> CheeseSignal:
|
|
95
|
-
'''
|
|
96
|
-
绑定函数`def func(*, workers: int)`
|
|
97
|
-
'''
|
|
85
|
+
''' 绑定函数`def func(*, workers: int)` '''
|
|
98
86
|
|
|
99
87
|
return self._after_workers_start
|
|
100
88
|
|
|
101
89
|
@property
|
|
102
90
|
def before_worker_start(self) -> CheeseSignal:
|
|
103
|
-
'''
|
|
104
|
-
绑定函数`def func(*, is_first: bool)`
|
|
105
|
-
'''
|
|
91
|
+
''' 绑定函数`def func(*, is_first: bool)` '''
|
|
106
92
|
|
|
107
93
|
return self._before_worker_start
|
|
108
94
|
|
|
109
95
|
@property
|
|
110
96
|
def after_worker_start(self) -> CheeseSignal:
|
|
111
|
-
'''
|
|
112
|
-
绑定协程函数`async def func(*, is_first: bool)`
|
|
113
|
-
'''
|
|
97
|
+
''' 绑定协程函数`async def func(*, is_first: bool)` '''
|
|
114
98
|
|
|
115
99
|
return self._after_worker_start
|
|
116
100
|
|
|
117
101
|
@property
|
|
118
102
|
def before_worker_stop(self) -> CheeseSignal:
|
|
119
|
-
'''
|
|
120
|
-
绑定协程函数`async def func(*, is_first: bool)`
|
|
121
|
-
'''
|
|
103
|
+
''' 绑定协程函数`async def func(*, is_first: bool)` '''
|
|
122
104
|
|
|
123
105
|
return self._before_worker_stop
|
|
124
106
|
|
|
125
107
|
@property
|
|
126
108
|
def after_worker_stop(self) -> CheeseSignal:
|
|
127
|
-
'''
|
|
128
|
-
绑定函数`def func(*, is_first: bool)`
|
|
129
|
-
'''
|
|
109
|
+
''' 绑定函数`def func(*, is_first: bool)` '''
|
|
130
110
|
|
|
131
111
|
return self._after_worker_stop
|
|
132
112
|
|
|
133
113
|
@property
|
|
134
114
|
def before_request(self) -> CheeseSignal:
|
|
135
|
-
'''
|
|
136
|
-
绑定协程函数`async def func(*, client_socket: socket.socket, addr: tuple[str, int])`
|
|
137
|
-
'''
|
|
115
|
+
''' 绑定协程函数`async def func(*, client_socket: socket.socket, addr: tuple[str, int])` '''
|
|
138
116
|
|
|
139
117
|
return self._before_request
|
|
140
118
|
|
|
141
119
|
@property
|
|
142
120
|
def after_request(self) -> CheeseSignal:
|
|
143
|
-
'''
|
|
144
|
-
绑定协程函数`async def func(*, request: Request | None)`
|
|
145
|
-
'''
|
|
121
|
+
''' 绑定协程函数`async def func(*, request: Request | None)` '''
|
|
146
122
|
|
|
147
123
|
return self._after_request
|
|
148
124
|
|
|
149
125
|
@property
|
|
150
126
|
def before_response(self) -> CheeseSignal:
|
|
151
|
-
'''
|
|
152
|
-
绑定协程函数`async def func(*, response: Response) -> Response`
|
|
153
|
-
'''
|
|
127
|
+
''' 绑定协程函数`async def func(*, response: Response) -> Response` '''
|
|
154
128
|
|
|
155
129
|
return self._before_response
|
|
156
130
|
|
|
157
131
|
@property
|
|
158
132
|
def after_response(self) -> CheeseSignal:
|
|
159
|
-
'''
|
|
160
|
-
绑定协程函数`async def func(*, response: Response)`
|
|
161
|
-
'''
|
|
133
|
+
''' 绑定协程函数`async def func(*, response: Response)` '''
|
|
162
134
|
|
|
163
135
|
return self._after_response
|
|
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
|