A function to read file from Amazon S3, URLs, or local paths#162
Merged
CluckRookie merged 3 commits intoCambioML:mainfrom Feb 3, 2024
Merged
A function to read file from Amazon S3, URLs, or local paths#162CluckRookie merged 3 commits intoCambioML:mainfrom
CluckRookie merged 3 commits intoCambioML:mainfrom
Conversation
CambioML
approved these changes
Feb 3, 2024
Collaborator
CambioML
left a comment
There was a problem hiding this comment.
approve with minor comment
uniflow/op/extract/load/utils.py
Outdated
| obj = s3.get_object(Bucket=bucket_name, Key=file_path) | ||
| data = obj["Body"].read() | ||
| return data.decode() if mode == "r" else data | ||
| if source.startswith("http://") or source.startswith("https://"): |
Collaborator
There was a problem hiding this comment.
nit: elif might be better.
Contributor
Author
There was a problem hiding this comment.
Comment on lines
+55
to
+57
| # Read file from local filesystem | ||
| with open(source, mode) as file: | ||
| return file.read() |
uniflow/op/extract/load/utils.py
Outdated
Comment on lines
+10
to
+14
| Parameters: | ||
| - source (str): The path to the file. This can be an S3 bucket path (s3://bucket_name/file_path), | ||
| a URL (http:// or https://), or a local file path. | ||
| - mode (str): The mode in which to open the file. Use 'r' for text mode and 'rb' for binary mode. | ||
| Default is 'r'. |
Collaborator
There was a problem hiding this comment.
nit: Args because we we using Google docstring format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.