-
Notifications
You must be signed in to change notification settings - Fork 76
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
[SVCS-826] S3 Compatablilty #351
base: develop
Are you sure you want to change the base?
Changes from 4 commits
1d4717d
cb9d166
1424645
d180d0d
f83e2cb
ada59b2
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 |
---|---|---|
|
@@ -179,6 +179,7 @@ def __init__(self, request, inner): | |
super().__init__() | ||
self.inner = inner | ||
self.request = request | ||
self.offset = 0 | ||
|
||
@property | ||
def size(self): | ||
|
@@ -187,12 +188,16 @@ def size(self): | |
def at_eof(self): | ||
return self.inner.at_eof() | ||
|
||
def tell(self): | ||
return self.offset | ||
|
||
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. Not strictly necessary, but was needed for a transient implementation. Still technically correct and simply makes our streams more stream-y. |
||
async def _read(self, size): | ||
if self.inner.at_eof(): | ||
return b'' | ||
if size < 0: | ||
return (await self.inner.read(size)) | ||
try: | ||
self.offset += size | ||
return (await self.inner.readexactly(size)) | ||
except asyncio.IncompleteReadError as e: | ||
return e.partial |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,15 +105,17 @@ async def send_signed_request(method, url, payload): | |
)) | ||
|
||
|
||
def normalize_datetime(date_string): | ||
if date_string is None: | ||
def normalize_datetime(date): | ||
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. not always a string, so saying date_str here is a little misleading. |
||
if date is None: | ||
return None | ||
parsed_datetime = dateutil.parser.parse(date_string) | ||
if not parsed_datetime.tzinfo: | ||
parsed_datetime = parsed_datetime.replace(tzinfo=pytz.UTC) | ||
parsed_datetime = parsed_datetime.astimezone(tz=pytz.UTC) | ||
parsed_datetime = parsed_datetime.replace(microsecond=0) | ||
return parsed_datetime.isoformat() | ||
if isinstance(date, str): | ||
date = dateutil.parser.parse(date) | ||
if not date.tzinfo: | ||
date = date.replace(tzinfo=pytz.UTC) | ||
date = date.astimezone(tz=pytz.UTC) | ||
date = date.replace(microsecond=0) | ||
return date.isoformat() | ||
|
||
|
||
|
||
class ZipStreamGenerator: | ||
|
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.
Need to remove old boto