@@ -187,22 +187,22 @@ def monkeypatch_bq(bq_client, *args, **kwargs):
187
187
bq_client , * args , ** kwargs )
188
188
return bigquery
189
189
190
- # Monkey patch classes that use the init method
190
+ # Monkey patch for aiplatform init
191
191
# eg
192
192
# from google.cloud import aiplatform
193
193
# aiplatform.init(args)
194
- def monkeypatch_init ( client_klass , kaggle_kernel_credentials ):
195
- client_init = client_klass .init
194
+ def monkeypatch_aiploatform_init ( aiplatform_klass , kaggle_kernel_credentials ):
195
+ aiplatform_init = aiplatform_klass .init
196
196
def patched_init (self , * args , ** kwargs ):
197
197
specified_credentials = kwargs .get ('credentials' )
198
198
if specified_credentials is None :
199
199
Log .info ("No credentials specified, using KaggleKernelCredentials." )
200
200
kwargs ['credentials' ] = kaggle_kernel_credentials
201
- return client_init (self , * args , ** kwargs )
201
+ return aiplatform_init (self , * args , ** kwargs )
202
202
203
- if (not has_been_monkeypatched (client_klass .init )):
204
- client_klass .init = patched_init
205
- Log .info (f"Client patched: { client_klass } " )
203
+ if (not has_been_monkeypatched (aiplatform_klass .init )):
204
+ aiplatform_klass .init = patched_init
205
+ Log .info ("aiplatform.init patched" )
206
206
207
207
def monkeypatch_client (client_klass , kaggle_kernel_credentials ):
208
208
client_init = client_klass .__init__
@@ -340,7 +340,7 @@ def init_ucaip():
340
340
kaggle_kernel_credentials = KaggleKernelCredentials (target = GcpTarget .CLOUDAI )
341
341
342
342
# Patch the ucaip init method, this flows down to all ucaip services
343
- monkeypatch_init (aiplatform , kaggle_kernel_credentials )
343
+ monkeypatch_aiplatform_init (aiplatform , kaggle_kernel_credentials )
344
344
345
345
def init_video_intelligence ():
346
346
from google .cloud import videointelligence
0 commit comments