@@ -133,19 +133,19 @@ def __init__(
133
133
"""
134
134
self .name = name
135
135
self .description = description
136
- self .apihub_resource_name = apihub_resource_name
137
- self .lazy_load_spec = lazy_load_spec
138
- self .apihub_client = apihub_client or APIHubClient (
136
+ self ._apihub_resource_name = apihub_resource_name
137
+ self ._lazy_load_spec = lazy_load_spec
138
+ self ._apihub_client = apihub_client or APIHubClient (
139
139
access_token = access_token ,
140
140
service_account_json = service_account_json ,
141
141
)
142
142
143
- self .openapi_toolset = None
144
- self .auth_scheme = auth_scheme
145
- self .auth_credential = auth_credential
143
+ self ._openapi_toolset = None
144
+ self ._auth_scheme = auth_scheme
145
+ self ._auth_credential = auth_credential
146
146
self .tool_filter = tool_filter
147
147
148
- if not self .lazy_load_spec :
148
+ if not self ._lazy_load_spec :
149
149
self ._prepare_toolset ()
150
150
151
151
@override
@@ -157,16 +157,16 @@ async def get_tools(
157
157
Returns:
158
158
A list of all available RestApiTool objects.
159
159
"""
160
- if not self .openapi_toolset :
160
+ if not self ._openapi_toolset :
161
161
self ._prepare_toolset ()
162
- if not self .openapi_toolset :
162
+ if not self ._openapi_toolset :
163
163
return []
164
- return await self .openapi_toolset .get_tools (readonly_context )
164
+ return await self ._openapi_toolset .get_tools (readonly_context )
165
165
166
166
def _prepare_toolset (self ) -> None :
167
167
"""Fetches the spec from API Hub and generates the toolset."""
168
168
# For each API, get the first version and the first spec of that version.
169
- spec_str = self .apihub_client .get_spec_content (self .apihub_resource_name )
169
+ spec_str = self ._apihub_client .get_spec_content (self ._apihub_resource_name )
170
170
spec_dict = yaml .safe_load (spec_str )
171
171
if not spec_dict :
172
172
return
@@ -177,14 +177,14 @@ def _prepare_toolset(self) -> None:
177
177
self .description = self .description or spec_dict .get ('info' , {}).get (
178
178
'description' , ''
179
179
)
180
- self .openapi_toolset = OpenAPIToolset (
180
+ self ._openapi_toolset = OpenAPIToolset (
181
181
spec_dict = spec_dict ,
182
- auth_credential = self .auth_credential ,
183
- auth_scheme = self .auth_scheme ,
182
+ auth_credential = self ._auth_credential ,
183
+ auth_scheme = self ._auth_scheme ,
184
184
tool_filter = self .tool_filter ,
185
185
)
186
186
187
187
@override
188
188
async def close (self ):
189
- if self .openapi_toolset :
190
- await self .openapi_toolset .close ()
189
+ if self ._openapi_toolset :
190
+ await self ._openapi_toolset .close ()
0 commit comments