@@ -129,38 +129,35 @@ def __init__(self,
129
129
# Hybrid Parsing
130
130
self .HybridParsing = HybridParsing (self .client )
131
131
132
-
133
- """
134
- [中文]
135
-
136
- 这些代码用于实现异步上下文管理器,使得类的实例可以与 async with 语句一起使用,从而在进入和退出时自动处理资源的初始化和清理。
137
-
138
- 例如:
139
- async with Client(api_key=api_key) as client:
140
- pass
132
+ """
133
+ [中文]
141
134
142
- 这样在退出时会自动调用 __aexit__ 方法,关闭 client。
143
-
144
- [English]
145
-
146
- This code is used to implement an asynchronous context manager,
147
- which allows instances of a class to be used with the async with statement,
148
- automatically handling the initialization and cleanup of resources when entering and exiting.
149
-
150
- For example:
151
- async with Client(api_key=api_key) as client:
152
- pass
135
+ 这些代码用于实现异步上下文管理器,使得类的实例可以与 async with 语句一起使用,从而在进入和退出时自动处理资源的初始化和清理。
153
136
154
- This way, the __aexit__ method is automatically called when exiting, closing the client.
155
- """
156
-
157
-
158
- async def __aenter__ (self ):
159
- return self
160
-
161
-
162
- async def __aexit__ (self , exc_type , exc_val , exc_tb ):
163
- await self .client .close ()
137
+ 例如:
138
+ async with Client(api_key=api_key) as client:
139
+ pass
140
+
141
+ 这样在退出时会自动调用 __aexit__ 方法,关闭 client。
142
+
143
+ [English]
144
+
145
+ This code is used to implement an asynchronous context manager,
146
+ which allows instances of a class to be used with the async with statement,
147
+ automatically handling the initialization and cleanup of resources when entering and exiting.
148
+
149
+ For example:
150
+ async with Client(api_key=api_key) as client:
151
+ pass
152
+
153
+ This way, the __aexit__ method is automatically called when exiting, closing the client.
154
+ """
155
+
156
+ async def __aenter__ (self ):
157
+ return self
158
+
159
+ async def __aexit__ (self , exc_type , exc_val , exc_tb ):
160
+ await self .client .close ()
164
161
165
162
166
163
if __name__ == '__main__' :
0 commit comments