FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix import · HpcDataLab/docker-python@c2dbd80 · GitHub

Commit c2dbd80

Browse files
committed
Fix import
1 parent 44f637a commit c2dbd80

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

‎patches/sitecustomize.py‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def init():
1010
if kaggle_proxy_token or is_jwe_set:
1111
init_bigquery()
1212
if is_jwe_set:
13+
from kaggle_gcp import get_integrations
1314
if get_integrations().has_gcs():
1415
init_gcs()
1516

@@ -65,20 +66,18 @@ def monkeypatch_bq(bq_client, *args, **kwargs):
6566

6667

6768
def init_gcs():
68-
from kaggle_gcp import get_integrations
69-
if get_integrations().has_gcs():
70-
from kaggle_secrets import GcpTarget
71-
from kaggle_gcp import KaggleKernelCredentials
72-
from google.cloud import storage
73-
def monkeypatch_gcs(gcs_client, *args, **kwargs):
74-
specified_credentials = kwargs.get('credentials')
75-
if specified_credentials is None:
76-
Log.info("No credentials specified, using KaggleKernelCredentials.")
77-
kwargs['credentials'] = KaggleKernelCredentials(target=GcpTarget.GCS)
78-
return gcs_client(*args, **kwargs)
69+
from kaggle_secrets import GcpTarget
70+
from kaggle_gcp import KaggleKernelCredentials
71+
from google.cloud import storage
72+
def monkeypatch_gcs(gcs_client, *args, **kwargs):
73+
specified_credentials = kwargs.get('credentials')
74+
if specified_credentials is None:
75+
Log.info("No credentials specified, using KaggleKernelCredentials.")
76+
kwargs['credentials'] = KaggleKernelCredentials(target=GcpTarget.GCS)
77+
return gcs_client(*args, **kwargs)
7978

80-
gcs_client = storage.Client
81-
storage.Client = lambda *args, **kwargs: monkeypatch_gcs(gcs_client, *args, **kwargs)
79+
gcs_client = storage.Client
80+
storage.Client = lambda *args, **kwargs: monkeypatch_gcs(gcs_client, *args, **kwargs)
8281

8382

8483
init()

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL