Skip to content

Commit a31ba3b

Browse files
CopilotOhYee
andauthored
style: unify __get_client() calls to keyword form across all resource modules
Agent-Logs-Url: https://github.com/Serverless-Devs/agentrun-sdk-python/sessions/6c1e8b76-7ece-4f18-927b-cc1da46732da Co-authored-by: OhYee <13498329+OhYee@users.noreply.github.com>
1 parent f35715f commit a31ba3b

18 files changed

Lines changed: 120 additions & 120 deletions

agentrun/agent_runtime/__endpoint_async_template.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async def create_by_id_async(
6767
ResourceNotExistError: Agent Runtime 不存在 / Agent Runtime does not exist
6868
HTTPError: HTTP 请求错误 / HTTP request error
6969
"""
70-
cli = cls.__get_client(config)
70+
cli = cls.__get_client(config=config)
7171
return await cli.create_endpoint_async(
7272
agent_runtime_id,
7373
input,
@@ -95,7 +95,7 @@ async def delete_by_id_async(
9595
ResourceNotExistError: 资源不存在 / Resource does not exist
9696
HTTPError: HTTP 请求错误 / HTTP request error
9797
"""
98-
cli = cls.__get_client(config)
98+
cli = cls.__get_client(config=config)
9999
return await cli.delete_endpoint_async(
100100
agent_runtime_id,
101101
endpoint_id,
@@ -125,7 +125,7 @@ async def update_by_id_async(
125125
ResourceNotExistError: 资源不存在 / Resource does not exist
126126
HTTPError: HTTP 请求错误 / HTTP request error
127127
"""
128-
cli = cls.__get_client(config)
128+
cli = cls.__get_client(config=config)
129129
return await cli.update_endpoint_async(
130130
agent_runtime_id,
131131
endpoint_id,
@@ -154,7 +154,7 @@ async def get_by_id_async(
154154
ResourceNotExistError: 资源不存在 / Resource does not exist
155155
HTTPError: HTTP 请求错误 / HTTP request error
156156
"""
157-
cli = cls.__get_client(config)
157+
cli = cls.__get_client(config=config)
158158
return await cli.get_endpoint_async(
159159
agent_runtime_id,
160160
endpoint_id,
@@ -191,7 +191,7 @@ async def _list_page_async(
191191
"agent_runtime_id is required for listing endpoints"
192192
)
193193

194-
return await cls.__get_client(config).list_endpoints_async(
194+
return await cls.__get_client(config=config).list_endpoints_async(
195195
agent_runtime_id,
196196
AgentRuntimeEndpointListInput(
197197
page_number=page_input.page_number,
@@ -219,7 +219,7 @@ async def list_by_id_async(
219219
Raises:
220220
HTTPError: HTTP 请求错误 / HTTP request error
221221
"""
222-
cli = cls.__get_client(config)
222+
cli = cls.__get_client(config=config)
223223

224224
endpoints: List[AgentRuntimeEndpoint] = []
225225
page = 1

agentrun/agent_runtime/__runtime_async_template.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async def create_async(
7777
ResourceAlreadyExistError: 资源已存在 / Resource already exists
7878
HTTPError: HTTP 请求错误 / HTTP request error
7979
"""
80-
return await cls.__get_client(config).create_async(input, config=config)
80+
return await cls.__get_client(config=config).create_async(input, config=config)
8181

8282
@classmethod
8383
async def delete_by_id_async(cls, id: str, config: Optional[Config] = None):
@@ -97,7 +97,7 @@ async def delete_by_id_async(cls, id: str, config: Optional[Config] = None):
9797
ResourceNotExistError: 资源不存在 / Resource does not exist
9898
HTTPError: HTTP 请求错误 / HTTP request error
9999
"""
100-
cli = cls.__get_client(config)
100+
cli = cls.__get_client(config=config)
101101

102102
# 删除所有的 endpoint / Delete all endpoints
103103
endpoints = await cli.list_endpoints_async(id, config=config)
@@ -136,7 +136,7 @@ async def update_by_id_async(
136136
ResourceNotExistError: 资源不存在 / Resource does not exist
137137
HTTPError: HTTP 请求错误 / HTTP request error
138138
"""
139-
return await cls.__get_client(config).update_async(
139+
return await cls.__get_client(config=config).update_async(
140140
id, input, config=config
141141
)
142142

@@ -155,13 +155,13 @@ async def get_by_id_async(cls, id: str, config: Optional[Config] = None):
155155
ResourceNotExistError: 资源不存在 / Resource does not exist
156156
HTTPError: HTTP 请求错误 / HTTP request error
157157
"""
158-
return await cls.__get_client(config).get_async(id, config=config)
158+
return await cls.__get_client(config=config).get_async(id, config=config)
159159

160160
@classmethod
161161
async def _list_page_async(
162162
cls, page_input: PageableInput, config: Config | None = None, **kwargs
163163
):
164-
return await cls.__get_client(config).list_async(
164+
return await cls.__get_client(config=config).list_async(
165165
input=AgentRuntimeListInput(
166166
**kwargs,
167167
**page_input.model_dump(),
@@ -202,7 +202,7 @@ async def list_async(cls, config: Optional[Config] = None):
202202
Raises:
203203
HTTPError: HTTP 请求错误 / HTTP request error
204204
"""
205-
cli = cls.__get_client(config)
205+
cli = cls.__get_client(config=config)
206206

207207
runtimes: List[AgentRuntime] = []
208208
page = 1
@@ -299,7 +299,7 @@ async def list_versions_by_id_async(
299299
agent_runtime_id: str,
300300
config: Optional[Config] = None,
301301
):
302-
cli = cls.__get_client(config)
302+
cli = cls.__get_client(config=config)
303303

304304
versions: List[AgentRuntimeVersion] = []
305305
page = 1

agentrun/agent_runtime/endpoint.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async def create_by_id_async(
7777
ResourceNotExistError: Agent Runtime 不存在 / Agent Runtime does not exist
7878
HTTPError: HTTP 请求错误 / HTTP request error
7979
"""
80-
cli = cls.__get_client(config)
80+
cli = cls.__get_client(config=config)
8181
return await cli.create_endpoint_async(
8282
agent_runtime_id,
8383
input,
@@ -106,7 +106,7 @@ def create_by_id(
106106
ResourceNotExistError: Agent Runtime 不存在 / Agent Runtime does not exist
107107
HTTPError: HTTP 请求错误 / HTTP request error
108108
"""
109-
cli = cls.__get_client(config)
109+
cli = cls.__get_client(config=config)
110110
return cli.create_endpoint(
111111
agent_runtime_id,
112112
input,
@@ -134,7 +134,7 @@ async def delete_by_id_async(
134134
ResourceNotExistError: 资源不存在 / Resource does not exist
135135
HTTPError: HTTP 请求错误 / HTTP request error
136136
"""
137-
cli = cls.__get_client(config)
137+
cli = cls.__get_client(config=config)
138138
return await cli.delete_endpoint_async(
139139
agent_runtime_id,
140140
endpoint_id,
@@ -162,7 +162,7 @@ def delete_by_id(
162162
ResourceNotExistError: 资源不存在 / Resource does not exist
163163
HTTPError: HTTP 请求错误 / HTTP request error
164164
"""
165-
cli = cls.__get_client(config)
165+
cli = cls.__get_client(config=config)
166166
return cli.delete_endpoint(
167167
agent_runtime_id,
168168
endpoint_id,
@@ -192,7 +192,7 @@ async def update_by_id_async(
192192
ResourceNotExistError: 资源不存在 / Resource does not exist
193193
HTTPError: HTTP 请求错误 / HTTP request error
194194
"""
195-
cli = cls.__get_client(config)
195+
cli = cls.__get_client(config=config)
196196
return await cli.update_endpoint_async(
197197
agent_runtime_id,
198198
endpoint_id,
@@ -223,7 +223,7 @@ def update_by_id(
223223
ResourceNotExistError: 资源不存在 / Resource does not exist
224224
HTTPError: HTTP 请求错误 / HTTP request error
225225
"""
226-
cli = cls.__get_client(config)
226+
cli = cls.__get_client(config=config)
227227
return cli.update_endpoint(
228228
agent_runtime_id,
229229
endpoint_id,
@@ -252,7 +252,7 @@ async def get_by_id_async(
252252
ResourceNotExistError: 资源不存在 / Resource does not exist
253253
HTTPError: HTTP 请求错误 / HTTP request error
254254
"""
255-
cli = cls.__get_client(config)
255+
cli = cls.__get_client(config=config)
256256
return await cli.get_endpoint_async(
257257
agent_runtime_id,
258258
endpoint_id,
@@ -280,7 +280,7 @@ def get_by_id(
280280
ResourceNotExistError: 资源不存在 / Resource does not exist
281281
HTTPError: HTTP 请求错误 / HTTP request error
282282
"""
283-
cli = cls.__get_client(config)
283+
cli = cls.__get_client(config=config)
284284
return cli.get_endpoint(
285285
agent_runtime_id,
286286
endpoint_id,
@@ -317,7 +317,7 @@ async def _list_page_async(
317317
"agent_runtime_id is required for listing endpoints"
318318
)
319319

320-
return await cls.__get_client(config).list_endpoints_async(
320+
return await cls.__get_client(config=config).list_endpoints_async(
321321
agent_runtime_id,
322322
AgentRuntimeEndpointListInput(
323323
page_number=page_input.page_number,
@@ -356,7 +356,7 @@ def _list_page(
356356
"agent_runtime_id is required for listing endpoints"
357357
)
358358

359-
return cls.__get_client(config).list_endpoints(
359+
return cls.__get_client(config=config).list_endpoints(
360360
agent_runtime_id,
361361
AgentRuntimeEndpointListInput(
362362
page_number=page_input.page_number,
@@ -384,7 +384,7 @@ async def list_by_id_async(
384384
Raises:
385385
HTTPError: HTTP 请求错误 / HTTP request error
386386
"""
387-
cli = cls.__get_client(config)
387+
cli = cls.__get_client(config=config)
388388

389389
endpoints: List[AgentRuntimeEndpoint] = []
390390
page = 1
@@ -429,7 +429,7 @@ def list_by_id(cls, agent_runtime_id: str, config: Optional[Config] = None):
429429
Raises:
430430
HTTPError: HTTP 请求错误 / HTTP request error
431431
"""
432-
cli = cls.__get_client(config)
432+
cli = cls.__get_client(config=config)
433433

434434
endpoints: List[AgentRuntimeEndpoint] = []
435435
page = 1

agentrun/agent_runtime/runtime.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async def create_async(
8787
ResourceAlreadyExistError: 资源已存在 / Resource already exists
8888
HTTPError: HTTP 请求错误 / HTTP request error
8989
"""
90-
return await cls.__get_client(config).create_async(input, config=config)
90+
return await cls.__get_client(config=config).create_async(input, config=config)
9191

9292
@classmethod
9393
def create(
@@ -107,7 +107,7 @@ def create(
107107
ResourceAlreadyExistError: 资源已存在 / Resource already exists
108108
HTTPError: HTTP 请求错误 / HTTP request error
109109
"""
110-
return cls.__get_client(config).create(input, config=config)
110+
return cls.__get_client(config=config).create(input, config=config)
111111

112112
@classmethod
113113
async def delete_by_id_async(cls, id: str, config: Optional[Config] = None):
@@ -127,7 +127,7 @@ async def delete_by_id_async(cls, id: str, config: Optional[Config] = None):
127127
ResourceNotExistError: 资源不存在 / Resource does not exist
128128
HTTPError: HTTP 请求错误 / HTTP request error
129129
"""
130-
cli = cls.__get_client(config)
130+
cli = cls.__get_client(config=config)
131131

132132
# 删除所有的 endpoint / Delete all endpoints
133133
endpoints = await cli.list_endpoints_async(id, config=config)
@@ -163,7 +163,7 @@ def delete_by_id(cls, id: str, config: Optional[Config] = None):
163163
ResourceNotExistError: 资源不存在 / Resource does not exist
164164
HTTPError: HTTP 请求错误 / HTTP request error
165165
"""
166-
cli = cls.__get_client(config)
166+
cli = cls.__get_client(config=config)
167167

168168
# 删除所有的 endpoint / Delete all endpoints
169169
endpoints = cli.list_endpoints(id, config=config)
@@ -201,7 +201,7 @@ async def update_by_id_async(
201201
ResourceNotExistError: 资源不存在 / Resource does not exist
202202
HTTPError: HTTP 请求错误 / HTTP request error
203203
"""
204-
return await cls.__get_client(config).update_async(
204+
return await cls.__get_client(config=config).update_async(
205205
id, input, config=config
206206
)
207207

@@ -226,7 +226,7 @@ def update_by_id(
226226
ResourceNotExistError: 资源不存在 / Resource does not exist
227227
HTTPError: HTTP 请求错误 / HTTP request error
228228
"""
229-
return cls.__get_client(config).update(id, input, config=config)
229+
return cls.__get_client(config=config).update(id, input, config=config)
230230

231231
@classmethod
232232
async def get_by_id_async(cls, id: str, config: Optional[Config] = None):
@@ -243,7 +243,7 @@ async def get_by_id_async(cls, id: str, config: Optional[Config] = None):
243243
ResourceNotExistError: 资源不存在 / Resource does not exist
244244
HTTPError: HTTP 请求错误 / HTTP request error
245245
"""
246-
return await cls.__get_client(config).get_async(id, config=config)
246+
return await cls.__get_client(config=config).get_async(id, config=config)
247247

248248
@classmethod
249249
def get_by_id(cls, id: str, config: Optional[Config] = None):
@@ -260,13 +260,13 @@ def get_by_id(cls, id: str, config: Optional[Config] = None):
260260
ResourceNotExistError: 资源不存在 / Resource does not exist
261261
HTTPError: HTTP 请求错误 / HTTP request error
262262
"""
263-
return cls.__get_client(config).get(id, config=config)
263+
return cls.__get_client(config=config).get(id, config=config)
264264

265265
@classmethod
266266
async def _list_page_async(
267267
cls, page_input: PageableInput, config: Config | None = None, **kwargs
268268
):
269-
return await cls.__get_client(config).list_async(
269+
return await cls.__get_client(config=config).list_async(
270270
input=AgentRuntimeListInput(
271271
**kwargs,
272272
**page_input.model_dump(),
@@ -278,7 +278,7 @@ async def _list_page_async(
278278
def _list_page(
279279
cls, page_input: PageableInput, config: Config | None = None, **kwargs
280280
):
281-
return cls.__get_client(config).list(
281+
return cls.__get_client(config=config).list(
282282
input=AgentRuntimeListInput(
283283
**kwargs,
284284
**page_input.model_dump(),
@@ -336,7 +336,7 @@ async def list_async(cls, config: Optional[Config] = None):
336336
Raises:
337337
HTTPError: HTTP 请求错误 / HTTP request error
338338
"""
339-
cli = cls.__get_client(config)
339+
cli = cls.__get_client(config=config)
340340

341341
runtimes: List[AgentRuntime] = []
342342
page = 1
@@ -380,7 +380,7 @@ def list(cls, config: Optional[Config] = None):
380380
Raises:
381381
HTTPError: HTTP 请求错误 / HTTP request error
382382
"""
383-
cli = cls.__get_client(config)
383+
cli = cls.__get_client(config=config)
384384

385385
runtimes: List[AgentRuntime] = []
386386
page = 1
@@ -540,7 +540,7 @@ async def list_versions_by_id_async(
540540
agent_runtime_id: str,
541541
config: Optional[Config] = None,
542542
):
543-
cli = cls.__get_client(config)
543+
cli = cls.__get_client(config=config)
544544

545545
versions: List[AgentRuntimeVersion] = []
546546
page = 1
@@ -574,7 +574,7 @@ def list_versions_by_id(
574574
agent_runtime_id: str,
575575
config: Optional[Config] = None,
576576
):
577-
cli = cls.__get_client(config)
577+
cli = cls.__get_client(config=config)
578578

579579
versions: List[AgentRuntimeVersion] = []
580580
page = 1

agentrun/credential/__credential_async_template.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async def create_async(
6262
Returns:
6363
Credential: 创建的凭证对象
6464
"""
65-
return await cls.__get_client(config).create_async(input, config=config)
65+
return await cls.__get_client(config=config).create_async(input, config=config)
6666

6767
@classmethod
6868
async def delete_by_name_async(
@@ -74,7 +74,7 @@ async def delete_by_name_async(
7474
credential_name: 凭证名称
7575
config: 配置
7676
"""
77-
return await cls.__get_client(config).delete_async(
77+
return await cls.__get_client(config=config).delete_async(
7878
credential_name, config=config
7979
)
8080

@@ -95,7 +95,7 @@ async def update_by_name_async(
9595
Returns:
9696
Credential: 更新后的凭证对象
9797
"""
98-
return await cls.__get_client(config).update_async(
98+
return await cls.__get_client(config=config).update_async(
9999
credential_name, input, config=config
100100
)
101101

@@ -112,15 +112,15 @@ async def get_by_name_async(
112112
Returns:
113113
Credential: 凭证对象
114114
"""
115-
return await cls.__get_client(config).get_async(
115+
return await cls.__get_client(config=config).get_async(
116116
credential_name, config=config
117117
)
118118

119119
@classmethod
120120
async def _list_page_async(
121121
cls, page_input: PageableInput, config: Config | None = None, **kwargs
122122
):
123-
return await cls.__get_client(config).list_async(
123+
return await cls.__get_client(config=config).list_async(
124124
input=CredentialListInput(
125125
**kwargs,
126126
**page_input.model_dump(),

0 commit comments

Comments
 (0)