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 — fix: revise and rename is_etag_in_json(data) by cojenco · Pull Request #483 · googleapis/python-storage
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Conversation
|
| pass | ||
| return False | ||
| :type data: dict or None | ||
| :param data: A dict containing the JSON body. If not passed, returns False. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think we could be clearer that the dict represents the JSON body rather than containing it. Also, this is specifically intended for calls where metadata is sent in the request body.
It seems like it'd be better to actually just rename this function to is_etag_in_data but I guess technically this is part of the public surface of the library (even if we don't expect external callers to use it directly)?
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.
We could rename it and leave is_etag_in_json around as a backward-compatibility alias.
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.
Would it be something like this:
def is_etag_in_data(data):
"""Return True if an etag is contained in the request body.
:type data: dict or None
:param data: A dict representing the request JSON body. If not passed, returns False.
"""
return data is not None and "etag" in data
def is_etag_in_json(data):
"""
``is_etag_in_json`` is supported for backwards-compatibility reasons only;
please use ``is_etag_in_data`` instead.
"""
return is_etag_in_data(data)
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.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
* fix: handle cases where data is a dict in is_etag_in_json(data) * address comments and accept proposed changes * revise is_etag_in_json to check dict data * revise docstring wording * revise docstrings * rename conditional predicate to is_etag_in_data
* fix: handle cases where data is a dict in is_etag_in_json(data) * address comments and accept proposed changes * revise is_etag_in_json to check dict data * revise docstring wording * revise docstrings * rename conditional predicate to is_etag_in_data
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Handle data dict type in retry.is_etag_in_json(data)
There was an error while loading. Please reload this page.