GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-31800: Support for colon when parsing time offsets by mariocj89 · Pull Request #4015 · python/cpython Conversation
| |||||||||||||||||||||||||||||||||||||||||||
|
included the support for 'Z' in 49098f6 happy to remove it or extract it in a different PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please use all caps for "UTC".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please add support for sub-minute offsets. See bpo-5288.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
16227fa to
59af357
Compare
This change adds support to _strptime to parse time offsets with a colon between the hour and the minutes. This unblocks the parsing of datetime string representation generated via isoformat together with all string that have the colon in its offset (which is quite common and part of the ISO8606)
59af357 to
f718b37
Compare
|
I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @abalkin: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Added both support for second and microseconds worries me that now the offset can be both a float and an int depending on whether there are microseconds in it though. Open to suggestions! Thanks |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mariocj89 - the offset is a timedelta, not int or float. Let me take a look at your changes ... |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| seconds = int(z[5:7] or 0) | ||
| microseconds = int(z[8:] or 0) | ||
| gmtoff = (hours * 60 * 60) + (minutes * 60) + seconds | ||
| gmtoff = gmtoff + (microseconds / (10**6)) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Let's not make gmtoff a float, but instead add gmtoff_fraction to the returned tuple. See how %f format is handled.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Great idea, I've added it at the end like the fraction, if you rather want it as part of the time tuple we can try that out as well. Thanks @abalkin ! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@abalkin I've added some further information & corrected a typo in the NEWS entry. Do you want me to add some info in Python3.7 what's new as well or it is not really worth it? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| .. versionchanged:: 3.7 | ||
| When ``%z`` directive is provided to the :meth:`strptime` method, any valid | ||
| RFC-822/ISO 8601 standard utftime-offset can be parsed. For example, strings |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
utftime-offset? This should be UTC offset, right?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -0,0 +1,3 @@ | |||
| Add support for parsing RFC-822/ISO 8601 UTC offsets. strptime '%z' can now | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think the RFC or the ISO standard allows seconds, let alone microseconds in the UTC offset. Please note that RFC 822 was obsoleted by RFC 2822 which in turn was obsoleted by 5322. I don't think this matters much for this PR because the RFCs specify the TZ format without a colon. I would remove references to standards and just describe what is implemented.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @abalkin: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
A NEWS entry is enough. The What's New editor will pick it from there. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.