Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
{% if not method.client_streaming %}
request (:class:`{{ method.input.ident.sphinx }}`):
The request object.{{ ' ' }}
{{ method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{% for key, field in method.flattened_fields.items() %}
{{ field.name }} (:class:`{{ field.ident.sphinx }}`):
{{ field.meta.doc|rst(width=72, indent=16) }}
Expand All @@ -316,7 +316,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
{% else %}
requests (Iterator[`{{ method.input.ident.sphinx }}`]):
The request object iterator.{{ ' ' }}
{{ method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{% endif %}
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down Expand Up @@ -344,7 +344,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
'the individual field arguments should be set.')

{% endif %} {# method.flattened_fields #}
{% if method.input.ident.package != method.ident.package %} {# request lives in a different package, so there is no proto wrapper #}
{% if method.input.ident.package != method.ident.package %}{# request lives in a different package, so there is no proto wrapper #}
# The request isn't a proto-plus wrapped type.
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
def {{ method.name|snake_case }}(self) -> Callable[
[{{ method.input.ident }}],
{{ method.output.ident }}]:
r"""Return a callable for the {{ ' ' }}
{{ (method.name|snake_case).replace('_',' ')|wrap(
width=70, offset=40, indent=8) }}
{{ ' ' }} method over gRPC.
r"""Return a callable for the{{ ' ' }}
{{- (method.name|snake_case).replace('_',' ')|wrap(
width=70, offset=40, indent=8) -}}
{{ ' ' }}method over gRPC.

{{ method.meta.doc|rst(width=72, indent=8) }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class {{ service.async_client_name }}:
{% if not method.client_streaming %}
request (:class:`{{ method.input.ident.sphinx }}`):
The request object.{{ ' ' }}
{{ method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{% for key, field in method.flattened_fields.items() %}
{{ field.name }} (:class:`{{ field.ident.sphinx }}`):
{{ field.meta.doc|rst(width=72, indent=16) }}
Expand All @@ -177,7 +177,7 @@ class {{ service.async_client_name }}:
{% else %}
requests (AsyncIterator[`{{ method.input.ident.sphinx }}`]):
The request object AsyncIterator.{{ ' ' }}
{{ method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{% endif %}
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
{% if not method.client_streaming %}
request ({{ method.input.ident.sphinx }}):
The request object.{{ ' ' }}
{{ method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{% for key, field in method.flattened_fields.items() %}
{{ field.name }} ({{ field.ident.sphinx }}):
{{ field.meta.doc|rst(width=72, indent=16) }}
Expand All @@ -331,7 +331,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
{% else %}
requests (Iterator[{{ method.input.ident.sphinx }}]):
The request object iterator.{{ ' ' }}
{{ method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{% endif %}
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down Expand Up @@ -360,7 +360,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
'the individual field arguments should be set.')

{% endif %}
{% if method.input.ident.package != method.ident.package %} {# request lives in a different package, so there is no proto wrapper #}
{% if method.input.ident.package != method.ident.package %}{# request lives in a different package, so there is no proto wrapper #}
if isinstance(request, dict):
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
Expand All @@ -375,7 +375,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
# there are no flattened fields.
if not isinstance(request, {{ method.input.ident }}):
request = {{ method.input.ident }}(request)
{% endif %} {# different request package #}
{% endif %}{# different request package #}

{#- Vanilla python protobuf wrapper types cannot _set_ repeated fields #}
{% if method.flattened_fields and method.input.ident.package == method.ident.package %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
def {{ method.name|snake_case }}(self) -> Callable[
[{{ method.input.ident }}],
{{ method.output.ident }}]:
r"""Return a callable for the {{ ' ' }}
{{ (method.name|snake_case).replace('_',' ')|wrap(
width=70, offset=40, indent=8) }}
{{ ' ' }} method over gRPC.
r"""Return a callable for the{{ ' ' }}
{{- (method.name|snake_case).replace('_',' ')|wrap(
width=70, offset=40, indent=8) -}}
{{ ' ' }}method over gRPC.

{{ method.meta.doc|rst(width=72, indent=8) }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ class {{ service.grpc_asyncio_transport_name }}({{ service.name }}Transport):
def {{ method.name|snake_case }}(self) -> Callable[
[{{ method.input.ident }}],
Awaitable[{{ method.output.ident }}]]:
r"""Return a callable for the {{ ' ' }}
{{ (method.name|snake_case).replace('_',' ')|wrap(
width=70, offset=40, indent=8) }}
{{ ' ' }} method over gRPC.
r"""Return a callable for the{{ ' ' }}
{{- (method.name|snake_case).replace('_',' ')|wrap(
width=70, offset=40, indent=8) -}}
{{ ' ' }}method over gRPC.

{{ method.meta.doc|rst(width=72, indent=8) }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ class {{ service.name }}RestTransport({{ service.name }}Transport):

Args:
request (~.{{ method.input.ident }}):
The request object.
{{ method.input.meta.doc|rst(width=72, indent=16) }}
The request object.{{ ' ' }}
{{- method.input.meta.doc|rst(width=72, indent=16) }}
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
{% if not method.void %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class {{ message.name }}({{ p }}.Message):
{{ field.name }} = {{ p }}.MapField(
{{ p }}.{{ key_field.proto_type }},
{{ p }}.{{ value_field.proto_type }},
number={{ field.number }}
number={{ field.number }},
{% if value_field.enum or value_field.message %}
{{ value_field.proto_type.lower() }}={{ value_field.type.ident.rel(message.ident) }},
{% endif %}{# enum or message#}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1485,10 +1485,9 @@ def test_{{ service.name|snake_case }}_base_transport_with_credentials_file():
load_creds.assert_called_once_with("credentials.json",
scopes=None,
default_scopes=(
{%- for scope in service.oauth_scopes %}
{% for scope in service.oauth_scopes %}
'{{ scope }}',
{%- endfor %}
),
{% endfor %}),
quota_project_id="octopus",
)

Expand Down Expand Up @@ -1533,7 +1532,6 @@ def test_{{ service.name|snake_case }}_auth_adc():
{% for scope in service.oauth_scopes %}
'{{ scope }}',
{% endfor %}),

quota_project_id=None,
)

Expand Down Expand Up @@ -1623,14 +1621,14 @@ def test_{{ service.name|snake_case }}_transport_create_channel(transport_class,

{% with host = (service.host|default('localhost', true)) %}
create_channel.assert_called_with(
"{{ host }}",
"{{ host }}{% if ":" not in service.host %}:443{% endif %}",
credentials=creds,
credentials_file=None,
quota_project_id="octopus",
default_scopes=(
{%- for scope in service.oauth_scopes %}
{% for scope in service.oauth_scopes %}
'{{ scope }}',
{%- endfor %}),
{% endfor %}),
scopes=["1", "2"],
default_host="{{ host }}",
ssl_credentials=None,
Expand Down Expand Up @@ -1667,9 +1665,9 @@ def test_{{ service.name|snake_case }}_transport_create_channel_old_api_core(tra
credentials_file=None,
quota_project_id="octopus",
scopes=(
{%- for scope in service.oauth_scopes %}
{% for scope in service.oauth_scopes %}
'{{ scope }}',
{%- endfor %}),
{% endfor %}),
ssl_credentials=None,
options=[
("grpc.max_send_message_length", -1),
Expand Down