@@ -129,34 +129,38 @@ def __init__(self,
129
129
# Hybrid Parsing
130
130
self .HybridParsing = HybridParsing (self .client )
131
131
132
- """
133
- [中文]
134
-
135
- 这些代码用于实现异步上下文管理器,使得类的实例可以与 async with 语句一起使用,从而在进入和退出时自动处理资源的初始化和清理。
136
-
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
- async def __aenter__ (self ):
156
- return self
157
-
158
- async def __aexit__ (self , exc_type , exc_val , exc_tb ):
159
- await self .client .close ()
132
+
133
+ """
134
+ [中文]
135
+
136
+ 这些代码用于实现异步上下文管理器,使得类的实例可以与 async with 语句一起使用,从而在进入和退出时自动处理资源的初始化和清理。
137
+
138
+ 例如:
139
+ async with Client(api_key=api_key) as client:
140
+ pass
141
+
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
153
+
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 ()
160
164
161
165
162
166
if __name__ == '__main__' :
0 commit comments