-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add 'Client.list_entries'. #1569
Add 'Client.list_entries'. #1569
Conversation
dt_str, _RFC3339_MICROS).replace(tzinfo=UTC) | ||
except ValueError: # maybe nanosecond resoultion | ||
prefix, suffix = dt_str.split('.') | ||
fraction, zulu = suffix[:-1], suffix[-1] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Sorry I've gotta stop midway through the review, have to go teach |
@dhermes this one should be good to go. |
:param resource: one entry resource from API response | ||
|
||
:type loggers: dict or None | ||
:param loggers: A mapping of loggerr fullnames -> loggers. If not |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Since when do we love using regex everywhere? My question about a guarantee about the number of digits after the decimal point is still unanswered. Do you know if it will always be 9? Do trailing 0's get chopped? The goal of my feedback was to avoid having to catch the ValueError and that fix doesn't really capture it |
The regex gives us a way to parse the new format which is a) faster, b) easier to understand, c) less error prone than the manual parsing I initially added.
The docs promise "nanosecond precision", which requires 9 digits, even with trailing zeroes.
We cannot do anything sensible with hypothetical malformed values from the backend, and the previous code didn't try to prevent them (in fact, this code comes from me exposing them when talking to the logging API). If we come across another timestamp format when mapping a new API, then we will have to adjust this helper again: I see that as a better alternative than trying to smother ValueErrors here. |
I have what might be a better idea: rather than overloading the existing |
@dhermes PTAL again. I think splitting the two branches into separate functions worked out well. I'll be glad to squash everything down before merging. |
LGTM. Squashing commits would be nice if it isn't too much |
Squashed. I will merge after Travis. |
No description provided.