FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docker-python/patches/sitecustomize.py at master · HadokenCode/docker-python · GitHub
HadokenCode
/
docker-python
Public
forked from
Kaggle/docker-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
docker-python
/
patches
/
sitecustomize.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (22 loc) · 1 KB
Breadcrumbs
docker-python
/
patches
/
sitecustomize.py
Copy path
File metadata and controls
27 lines (22 loc) · 1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Monkey patches BigQuery client creation to use proxy.
# Import tensorflow and torch before anything else. This is a hacky workaround to an error on dlopen
# reporting a limit on static TLS, tracked in:
# tensorflow: https://github.com/tensorflow/tensorflow/issues/19010
# torch: https://github.com/pytorch/pytorch/issues/2575
import
tensorflow
import
torch
import
os
kaggle_proxy_token
=
os
.
getenv
(
"KAGGLE_DATA_PROXY_TOKEN"
)
if
kaggle_proxy_token
:
from
google
.
auth
import
credentials
from
google
.
cloud
import
bigquery
from
google
.
cloud
.
bigquery
.
_http
import
Connection
Connection
.
API_BASE_URL
=
os
.
getenv
(
"KAGGLE_DATA_PROXY_URL"
)
Connection
.
_EXTRA_HEADERS
[
"X-KAGGLE-PROXY-DATA"
]
=
kaggle_proxy_token
bq_client
=
bigquery
.
Client
bigquery
.
Client
=
lambda
*
args
,
**
kwargs
:
bq_client
(
*
args
,
credentials
=
credentials
.
AnonymousCredentials
(),
project
=
os
.
getenv
(
"KAGGLE_DATA_PROXY_PROJECT"
),
**
kwargs
)
credentials
.
AnonymousCredentials
.
refresh
=
lambda
*
args
:
None
Back
|
FazBrowse Home
|
New Git URL