Repository navigation
feat(io): accept the Java gcs.user-project property #4626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -67,6 +67,7 @@ | |||||||||||||||||
| GCS_SESSION_KWARGS, | ||||||||||||||||||
| GCS_TOKEN, | ||||||||||||||||||
| GCS_TOKEN_EXPIRES_AT_MS, | ||||||||||||||||||
| GCS_USER_PROJECT, | ||||||||||||||||||
| GCS_VERSION_AWARE, | ||||||||||||||||||
| HF_ENDPOINT, | ||||||||||||||||||
| HF_TOKEN, | ||||||||||||||||||
|
|
@@ -265,13 +266,21 @@ def _gs(properties: Properties) -> AbstractFileSystem: | |||||||||||||||||
| if token and (expires_at := properties.get(GCS_TOKEN_EXPIRES_AT_MS)): | ||||||||||||||||||
| token = Credentials(token, expiry=millis_to_datetime(int(expires_at))) | ||||||||||||||||||
|
|
||||||||||||||||||
| requester_pays: bool | str | ||||||||||||||||||
| if GCS_REQUESTER_PAYS in properties: | ||||||||||||||||||
| requester_pays = property_as_bool(properties, GCS_REQUESTER_PAYS, False) | ||||||||||||||||||
|
Comment on lines
+270
to
+271
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit:
Suggested change
Might also be worth a test case for |
||||||||||||||||||
| elif user_project := properties.get(GCS_USER_PROJECT): | ||||||||||||||||||
| requester_pays = user_project | ||||||||||||||||||
| else: | ||||||||||||||||||
| requester_pays = False | ||||||||||||||||||
|
|
||||||||||||||||||
| return GCSFileSystem( | ||||||||||||||||||
| project=properties.get(GCS_PROJECT_ID), | ||||||||||||||||||
| access=properties.get(GCS_ACCESS, "full_control"), | ||||||||||||||||||
| token=token, | ||||||||||||||||||
| consistency=properties.get(GCS_CONSISTENCY, "none"), | ||||||||||||||||||
| cache_timeout=properties.get(GCS_CACHE_TIMEOUT), | ||||||||||||||||||
| requester_pays=property_as_bool(properties, GCS_REQUESTER_PAYS, False), | ||||||||||||||||||
| requester_pays=requester_pays, | ||||||||||||||||||
| session_kwargs=json.loads(properties.get(GCS_SESSION_KWARGS, "{}")), | ||||||||||||||||||
| endpoint_url=properties.get(GCS_SERVICE_HOST), | ||||||||||||||||||
| default_location=properties.get(GCS_DEFAULT_LOCATION), | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: in Java (
GCSInputStream/GCSOutputStream)gcs.user-projectis applied whenever it's set, not only as a fallback, so the doc row reads slightly stricter than the code below it (an explicitgcs.requester-pays=falsealso skips it here). Happy either way, just flagging the wording: