-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: allow both gs:// and gcs:// as query scheme; internally normalize to gs:// for compatibility with google cloud tools #52
Conversation
…e to gs:// for compatibility with google cloud tools
Warning Rate limit exceeded@johanneskoester has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 31 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe updates to the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Files ignored due to path filters (1)
pyproject.toml
is excluded by!pyproject.toml
Files selected for processing (1)
- snakemake_storage_plugin_gcs/init.py (6 hunks)
Additional context used
Path-based instructions (1)
snakemake_storage_plugin_gcs/__init__.py (1)
Pattern
**/*.py
: Do not suggest to add trailing commas for improving formatting.
Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theself
argument of methods.
Do not suggest type annotation of thecls
argument of classmethods.
Do not suggest return type annotation if a function or method does not explicitly return anything.
Ruff
snakemake_storage_plugin_gcs/__init__.py
255-255: Missing type annotation for
self
in method(ANN101)
485-485: Unnecessary
else
afterreturn
statement(RET505)
487-487: Trailing comma missing
Add trailing comma
(COM812)
Additional comments not posted (3)
snakemake_storage_plugin_gcs/__init__.py (3)
201-206
: LGTM! Enhanced URL scheme validation.The function now correctly validates both "gcs" and "gs" schemes, improving compatibility with Google Cloud Storage URLs.
220-220
: LGTM! Updated example query scheme.The example query now uses the "gs://" scheme, aligning with the preferred format for Google Cloud Storage.
255-257
: LGTM! URL normalization method added.The
postprocess_query
method effectively normalizes "gcs://" URLs to "gs://", ensuring consistency in URL handling.Tools
Ruff
255-255: Missing type annotation for
self
in method(ANN101)
if prefix.startswith(f"gs://{self.bucket.name}"): | ||
prefix = prefix[6 + len(self.bucket.name) :].lstrip("/") | ||
|
||
return ( | ||
f"gcs://{self.bucket.name}/{item.name}" | ||
f"gs://{self.bucket.name}/{item.name}" | ||
for item in self.bucket.list_blobs(prefix=prefix) | ||
) | ||
else: | ||
raise WorkflowError( | ||
f"GCS storage object {self.query} must start with gcs://" | ||
f"GCS storage object {self.query} must start with gs:// or gcs://" |
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.
Refactor: Remove unnecessary else
after return
.
The else
block after a return
statement is not needed and can be removed for cleaner code.
else:
raise WorkflowError(
f"GCS storage object {self.query} must start with gs:// or gcs://"
)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if prefix.startswith(f"gs://{self.bucket.name}"): | |
prefix = prefix[6 + len(self.bucket.name) :].lstrip("/") | |
return ( | |
f"gcs://{self.bucket.name}/{item.name}" | |
f"gs://{self.bucket.name}/{item.name}" | |
for item in self.bucket.list_blobs(prefix=prefix) | |
) | |
else: | |
raise WorkflowError( | |
f"GCS storage object {self.query} must start with gcs://" | |
f"GCS storage object {self.query} must start with gs:// or gcs://" | |
if prefix.startswith(f"gs://{self.bucket.name}"): | |
prefix = prefix[6 + len(self.bucket.name) :].lstrip("/") | |
return ( | |
f"gs://{self.bucket.name}/{item.name}" | |
for item in self.bucket.list_blobs(prefix=prefix) | |
) | |
raise WorkflowError( | |
f"GCS storage object {self.query} must start with gs:// or gcs://" |
Tools
Ruff
485-485: Unnecessary
else
afterreturn
statement(RET505)
487-487: Trailing comma missing
Add trailing comma
(COM812)
🤖 I have created a release *beep* *boop* --- ## [1.1.1](v1.1.0...v1.1.1) (2024-08-19) ### Bug Fixes * allow both gs:// and gcs:// as query scheme; internally normalize to gs:// for compatibility with google cloud tools ([#52](#52)) ([099e87f](099e87f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
Improvements