| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,7 @@ def init(): | |||
| 10 | 10 | if kaggle_proxy_token or is_jwe_set: | |
| 11 | 11 | init_bigquery() | |
| 12 | 12 | if is_jwe_set: | |
| 13 | + from kaggle_gcp import get_integrations | ||
| 13 | 14 | if get_integrations().has_gcs(): | |
| 14 | 15 | init_gcs() | |
| 15 | 16 | ||
@@ -65,20 +66,18 @@ def monkeypatch_bq(bq_client, *args, **kwargs): | |||
| 65 | 66 | ||
| 66 | 67 | ||
| 67 | 68 | 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) | ||
| 79 | 78 | ||
| 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) | ||
| 82 | 81 | ||
| 83 | 82 | ||
| 84 | 83 | init() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments