Skip to content

Commit

Permalink
chore: use alternative terms (#1157)
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Jan 26, 2022
1 parent b091bfc commit d215da5
Show file tree
Hide file tree
Showing 30 changed files with 106 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
{% if not method.client_streaming %}
# Create or coerce a protobuf request object.
{% if method.flattened_fields %}
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([{{ method.flattened_fields.values()|join(", ", attribute="name") }}])
if request is not None and has_flattened_params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
This property caches on the instance; repeated calls return the same
client.
"""
# Sanity check: Only create a new client if we do not already have one.
# Quick check: Only create a new client if we do not already have one.
if self._operations_client is None:
self._operations_client = operations_v1.OperationsClient(
self.grpc_channel
Expand Down
6 changes: 3 additions & 3 deletions gapic/generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def get_response(
# and instead of iterating over it/them, we iterate over samples
# and plug those into the template.
for template_name in client_templates:
# Sanity check: Skip "private" templates.
# Quick check: Skip "private" templates.
filename = template_name.split("/")[-1]
if filename.startswith("_") and filename != "__init__.py.j2":
continue
Expand Down Expand Up @@ -242,7 +242,7 @@ def _render_template(
if not opts.metadata and template_name.endswith("gapic_metadata.json.j2"):
return answer

# Sanity check: Rendering per service and per proto would be a
# Quick check: Rendering per service and per proto would be a
# combinatorial explosion and is almost certainly not what anyone
# ever wants. Error colorfully on it.
if "%service" in template_name and "%proto" in template_name:
Expand Down Expand Up @@ -343,7 +343,7 @@ def _get_file(
name=fn,
)

# Sanity check: Do not render empty files.
# Quick check: Do not render empty files.
if utils.empty(cgr_file.content) and not fn.endswith(
("py.typed", "__init__.py")
):
Expand Down
2 changes: 1 addition & 1 deletion gapic/schema/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def python_modules(self) -> Sequence[Tuple[str, str]]:
answer = {
t.ident.python_import
for m in self.all_messages.values()
# Sanity check: We do make sure that we are not trying to have
# Quick check: We do make sure that we are not trying to have
# a module import itself.
for t in m.field_types if t.ident.python_import != self_reference
}
Expand Down
4 changes: 2 additions & 2 deletions gapic/schema/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def build(
proto_packages = {fd.package for fd in file_descriptors}
root_package = os.path.commonprefix(tuple(proto_packages)).rstrip('.')

# Sanity check: If there is no common ground in the package,
# Quick check: If there is no common ground in the package,
# we are obviously in trouble.
if not root_package:
raise ValueError(
Expand Down Expand Up @@ -119,7 +119,7 @@ def build(
version=match.get('version', ''),
)

# Sanity check: Ensure that the package directives all inferred
# Quick check: Ensure that the package directives all inferred
# the same information.
if not package_info.version and len(proto_packages) > 1:
raise ValueError('All protos must have the same proto package '
Expand Down
4 changes: 2 additions & 2 deletions gapic/schema/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ def get_field(self, *field_path: str,
visited_messages=frozenset({self}),
)

# Sanity check: If cursor is a repeated field, then raise an exception.
# Quick check: If cursor is a repeated field, then raise an exception.
# Repeated fields are only permitted in the terminal position.
if cursor.repeated:
raise KeyError(
Expand All @@ -552,7 +552,7 @@ def get_field(self, *field_path: str,
'in the fields list in a position other than the end.',
)

# Sanity check: If this cursor has no message, there is a problem.
# Quick check: If this cursor has no message, there is a problem.
if not cursor.message:
raise KeyError(
f'Field {".".join(field_path)} could not be resolved from '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class {{ service.async_client_name }}:
{% if not method.client_streaming %}
# Create or coerce a protobuf request object.
{% if method.flattened_fields %}
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([{{ method.flattened_fields.values()|join(", ", attribute="name") }}])
if request is not None and has_flattened_params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
{% if not method.client_streaming %}
# Create or coerce a protobuf request object.
{% if method.flattened_fields %}
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([{{ method.flattened_fields.values()|join(", ", attribute="name") }}])
if request is not None and has_flattened_params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
This property caches on the instance; repeated calls return the same
client.
"""
# Sanity check: Only create a new client if we do not already have one.
# Quick check: Only create a new client if we do not already have one.
if self._operations_client is None:
self._operations_client = operations_v1.OperationsClient(
self.grpc_channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class {{ service.grpc_asyncio_transport_name }}({{ service.name }}Transport):
This property caches on the instance; repeated calls return the same
client.
"""
# Sanity check: Only create a new client if we do not already have one.
# Quick check: Only create a new client if we do not already have one.
if self._operations_client is None:
self._operations_client = operations_v1.OperationsAsyncClient(
self.grpc_channel
Expand Down
2 changes: 1 addition & 1 deletion gapic/utils/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def cached_property(fx):
"""
@functools.wraps(fx)
def inner(self):
# Sanity check: If there is no cache at all, create an empty cache.
# Quick check: If there is no cache at all, create an empty cache.
if not hasattr(self, '_cached_values'):
object.__setattr__(self, '_cached_values', {})

Expand Down
2 changes: 1 addition & 1 deletion gapic/utils/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def wrap(text: str, width: int, *, offset: int = None, indent: int = 0) -> str:
Returns:
str: The wrapped string.
"""
# Sanity check: If there is empty text, abort.
# Quick check: If there is empty text, abort.
if not text:
return ''

Expand Down
2 changes: 1 addition & 1 deletion gapic/utils/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def rst(text: str, width: int = 72, indent: int = 0, nl: bool = None,
Returns:
str: The same text, in RST format.
"""
# Sanity check: If the text block does not appear to have any formatting,
# Quick check: If the text block does not appear to have any formatting,
# do not convert it.
# (This makes code generation significantly faster; calling out to pandoc
# is by far the most expensive thing we do.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def sample_list_assets():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -559,7 +559,7 @@ def sample_create_feed():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -663,7 +663,7 @@ def sample_get_feed():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -767,7 +767,7 @@ def sample_list_feeds():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -878,7 +878,7 @@ def sample_update_feed():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([feed])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -968,7 +968,7 @@ def sample_delete_feed():
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -1158,7 +1158,7 @@ def sample_search_all_resources():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([scope, query, asset_types])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -1345,7 +1345,7 @@ def sample_search_all_iam_policies():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([scope, query])
if request is not None and has_flattened_params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def sample_list_assets():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -754,7 +754,7 @@ def sample_create_feed():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -859,7 +859,7 @@ def sample_get_feed():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -957,7 +957,7 @@ def sample_list_feeds():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -1062,7 +1062,7 @@ def sample_update_feed():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([feed])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -1153,7 +1153,7 @@ def sample_delete_feed():
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -1337,7 +1337,7 @@ def sample_search_all_resources():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([scope, query, asset_types])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -1518,7 +1518,7 @@ def sample_search_all_iam_policies():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([scope, query])
if request is not None and has_flattened_params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def operations_client(self) -> operations_v1.OperationsClient:
This property caches on the instance; repeated calls return the same
client.
"""
# Sanity check: Only create a new client if we do not already have one.
# Quick check: Only create a new client if we do not already have one.
if self._operations_client is None:
self._operations_client = operations_v1.OperationsClient(
self.grpc_channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
This property caches on the instance; repeated calls return the same
client.
"""
# Sanity check: Only create a new client if we do not already have one.
# Quick check: Only create a new client if we do not already have one.
if self._operations_client is None:
self._operations_client = operations_v1.OperationsAsyncClient(
self.grpc_channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def sample_generate_access_token():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name, delegates, scope, lifetime])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -450,7 +450,7 @@ def sample_generate_id_token():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name, delegates, audience, include_email])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -590,7 +590,7 @@ def sample_sign_blob():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name, delegates, payload])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -731,7 +731,7 @@ def sample_sign_jwt():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name, delegates, payload])
if request is not None and has_flattened_params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def sample_generate_access_token():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name, delegates, scope, lifetime])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -632,7 +632,7 @@ def sample_generate_id_token():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name, delegates, audience, include_email])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -766,7 +766,7 @@ def sample_sign_blob():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name, delegates, payload])
if request is not None and has_flattened_params:
Expand Down Expand Up @@ -901,7 +901,7 @@ def sample_sign_jwt():
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name, delegates, payload])
if request is not None and has_flattened_params:
Expand Down

0 comments on commit d215da5

Please sign in to comment.