Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit ce309df

Browse files
authored
Merge branch 'master' into snippet-gen
2 parents cca0f54 + 358a702 commit ce309df

26 files changed

Lines changed: 426 additions & 396 deletions

File tree

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
### [0.44.3](https://www.github.com/googleapis/gapic-generator-python/compare/v0.44.2...v0.44.3) (2021-05-03)
4+
5+
6+
### Performance Improvements
7+
8+
* reduce unnecessary copies, optimize Address comparison ([#855](https://www.github.com/googleapis/gapic-generator-python/issues/855)) ([e843540](https://www.github.com/googleapis/gapic-generator-python/commit/e8435400257707458e83424019c9b1a16fac9a99))
9+
10+
### [0.44.2](https://www.github.com/googleapis/gapic-generator-python/compare/v0.44.1...v0.44.2) (2021-04-30)
11+
12+
13+
### Bug Fixes
14+
15+
* remove auth, policy, and options from the reserved names list ([#851](https://www.github.com/googleapis/gapic-generator-python/issues/851)) ([d3f31a0](https://www.github.com/googleapis/gapic-generator-python/commit/d3f31a0d33411b3248871ddbe51135e83b699a73))
16+
17+
### [0.44.1](https://www.github.com/googleapis/gapic-generator-python/compare/v0.44.0...v0.44.1) (2021-04-28)
18+
19+
20+
### Bug Fixes
21+
22+
* fix syntax errors and failing unit tests ([#849](https://www.github.com/googleapis/gapic-generator-python/issues/849)) ([9046261](https://www.github.com/googleapis/gapic-generator-python/commit/90462617e3e2b90eb8684210b6a70e890bdc0d96)), closes [#848](https://www.github.com/googleapis/gapic-generator-python/issues/848)
23+
324
## [0.44.0](https://www.github.com/googleapis/gapic-generator-python/compare/v0.43.3...v0.44.0) (2021-04-23)
425

526

SECURITY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Security Policy
2+
3+
To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
4+
5+
The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
6+
7+
We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.

gapic/ads-templates/%namespace/%name/%version/%sub/__init__.py.j2

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88
them again.
99
-#}
1010
__all__ = (
11-
{% filter sort_lines %}
12-
{% for subpackage in api.subpackages.keys() %}
11+
{% filter sort_lines -%}
12+
{% for subpackage in api.subpackages -%}
1313
'{{ subpackage }}',
14-
{% endfor %}
14+
{% endfor -%}
1515
{% for service in api.services.values()
16-
if service.meta.address.subpackage == api.subpackage_view %}
16+
if service.meta.address.subpackage == api.subpackage_view -%}
1717
'{{ service.client_name }}',
18-
{% endfor %}
18+
{% endfor -%}
1919
{% for proto in api.protos.values()
20-
if proto.meta.address.subpackage == api.subpackage_view %}
21-
{% for message in proto.messages.values() %}
20+
if proto.meta.address.subpackage == api.subpackage_view -%}
21+
{% for message in proto.messages.values() -%}
2222
'{{ message.name }}',
23-
{% endfor %}
24-
{% for enum in proto.enums.values() %}
23+
{% endfor -%}
24+
{% for enum in proto.enums.values() -%}
2525
'{{ enum.name }}',
26-
{% endfor %}
27-
{% endfor %}
28-
{% endfilter %}
26+
{% endfor -%}
27+
{% endfor -%}
28+
{% endfilter -%}
2929
)
3030
{% endblock %}

gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ from typing import Callable, Dict, Optional, {% if service.any_server_streaming
1010
import pkg_resources
1111

1212
from google.api_core import client_options as client_options_lib # type: ignore
13-
from google.api_core import exceptions # type: ignore
13+
from google.api_core import exceptions as core_exceptions # type: ignore
1414
from google.api_core import gapic_v1 # type: ignore
1515
from google.api_core import retry as retries # type: ignore
16-
from google.auth import credentials # type: ignore
16+
from google.auth import credentials as ga_credentials # type: ignore
1717
from google.auth.transport import mtls # type: ignore
1818
from google.auth.transport.grpc import SslCredentials # type: ignore
1919
from google.auth.exceptions import MutualTLSChannelError # type: ignore
@@ -174,7 +174,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
174174
{% endfor %} {# common resources #}
175175

176176
def __init__(self, *,
177-
credentials: Optional[credentials.Credentials] = None,
177+
credentials: Optional[ga_credentials.Credentials] = None,
178178
transport: Union[str, {{ service.name }}Transport, None] = None,
179179
client_options: Optional[client_options_lib.ClientOptions] = None,
180180
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
@@ -305,7 +305,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
305305
{% if not method.client_streaming %}
306306
request (:class:`{{ method.input.ident.sphinx }}`):
307307
The request object.{{ ' ' }}
308-
{{ method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
308+
{{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
309309
{% for key, field in method.flattened_fields.items() %}
310310
{{ field.name }} (:class:`{{ field.ident.sphinx }}`):
311311
{{ field.meta.doc|rst(width=72, indent=16) }}
@@ -316,7 +316,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
316316
{% else %}
317317
requests (Iterator[`{{ method.input.ident.sphinx }}`]):
318318
The request object iterator.{{ ' ' }}
319-
{{ method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
319+
{{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
320320
{% endif %}
321321
retry (google.api_core.retry.Retry): Designation of what errors, if any,
322322
should be retried.
@@ -344,7 +344,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
344344
'the individual field arguments should be set.')
345345

346346
{% endif %} {# method.flattened_fields #}
347-
{% if method.input.ident.package != method.ident.package %} {# request lives in a different package, so there is no proto wrapper #}
347+
{% if method.input.ident.package != method.ident.package %}{# request lives in a different package, so there is no proto wrapper #}
348348
# The request isn't a proto-plus wrapped type.
349349
# so it must be constructed via keyword expansion.
350350
if isinstance(request, dict):

gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/base.py.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import abc
66
import typing
77
import pkg_resources
88

9-
from google import auth
9+
import google.auth # type: ignore
1010
from google.api_core import gapic_v1 # type: ignore
1111
from google.api_core import retry as retries # type: ignore
1212
{% if service.has_lro %}
1313
from google.api_core import operations_v1 # type: ignore
1414
{% endif %}
15-
from google.auth import credentials # type: ignore
15+
from google.auth import credentials as ga_credentials # type: ignore
1616

1717
{% filter sort_lines %}
1818
{% for method in service.methods.values() %}
@@ -43,7 +43,7 @@ class {{ service.name }}Transport(metaclass=abc.ABCMeta):
4343
def __init__(
4444
self, *,
4545
host: str{% if service.host %} = '{{ service.host }}'{% endif %},
46-
credentials: credentials.Credentials = None,
46+
credentials: ga_credentials.Credentials = None,
4747
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
4848
) -> None:
4949
"""Instantiate the transport.
@@ -70,7 +70,7 @@ class {{ service.name }}Transport(metaclass=abc.ABCMeta):
7070
# If no credentials are provided, then determine the appropriate
7171
# defaults.
7272
if credentials is None:
73-
credentials, _ = auth.default(scopes=self.AUTH_SCOPES)
73+
credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES)
7474

7575
# Save the credentials.
7676
self._credentials = credentials

gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/grpc.py.j2

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ from google.api_core import grpc_helpers # type: ignore
1010
from google.api_core import operations_v1 # type: ignore
1111
{% endif %}
1212
from google.api_core import gapic_v1 # type: ignore
13-
from google import auth # type: ignore
14-
from google.auth import credentials # type: ignore
13+
import google.auth # type: ignore
14+
from google.auth import credentials as ga_credentials # type: ignore
1515
from google.auth.transport.grpc import SslCredentials # type: ignore
1616

1717
import grpc # type: ignore
@@ -39,7 +39,7 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
3939
"""
4040
def __init__(self, *,
4141
host: str{% if service.host %} = '{{ service.host }}'{% endif %},
42-
credentials: credentials.Credentials = None,
42+
credentials: ga_credentials.Credentials = None,
4343
credentials_file: str = None,
4444
scopes: Sequence[str] = None,
4545
channel: grpc.Channel = None,
@@ -105,7 +105,7 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
105105
host = api_mtls_endpoint if ":" in api_mtls_endpoint else api_mtls_endpoint + ":443"
106106

107107
if credentials is None:
108-
credentials, _ = auth.default(scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id)
108+
credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id)
109109

110110
# Create SSL credentials with client_cert_source or application
111111
# default SSL credentials.
@@ -135,7 +135,7 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
135135
host = host if ":" in host else host + ":443"
136136

137137
if credentials is None:
138-
credentials, _ = auth.default(scopes=self.AUTH_SCOPES)
138+
credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES)
139139

140140
# create a new channel. The provided one is ignored.
141141
self._grpc_channel = type(self).create_channel(
@@ -162,7 +162,7 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
162162
@classmethod
163163
def create_channel(cls,
164164
host: str{% if service.host %} = '{{ service.host }}'{% endif %},
165-
credentials: credentials.Credentials = None,
165+
credentials: ga_credentials.Credentials = None,
166166
scopes: Optional[Sequence[str]] = None,
167167
**kwargs) -> grpc.Channel:
168168
"""Create and return a gRPC channel object.
@@ -217,10 +217,10 @@ class {{ service.name }}GrpcTransport({{ service.name }}Transport):
217217
def {{ method.name|snake_case }}(self) -> Callable[
218218
[{{ method.input.ident }}],
219219
{{ method.output.ident }}]:
220-
r"""Return a callable for the {{ ' ' }}
221-
{{ (method.name|snake_case).replace('_',' ')|wrap(
222-
width=70, offset=40, indent=8) }}
223-
{{ ' ' }} method over gRPC.
220+
r"""Return a callable for the{{ ' ' }}
221+
{{- (method.name|snake_case).replace('_',' ')|wrap(
222+
width=70, offset=40, indent=8) -}}
223+
{{ ' ' }}method over gRPC.
224224

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

gapic/ads-templates/%namespace/%name/%version/__init__.py.j2

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends '_base.py.j2' %}
22
{% block content %}
33

4-
{% if opts.lazy_import %} {# lazy import #}
4+
{% if opts.lazy_import -%} {# lazy import #}
55
import importlib
66
import sys
77

@@ -50,8 +50,7 @@ def __dir__():
5050
return globals().get('__all__') or __getattr__('__all__')
5151
{% else %} {# do not use lazy import #}
5252
{# Import subpackages. -#}
53-
{% filter sort_lines %}
54-
{% for subpackage in api.subpackages.keys() %}
53+
{% for subpackage in api.subpackages|dictsort %}
5554
from {% if api.naming.module_namespace %}{{ api.naming.module_namespace|join('.') }}.{% endif %}
5655
{{ api.naming.versioned_module_name }} import {{ subpackage }}
5756
{% endfor %}
@@ -83,15 +82,13 @@ from {% if api.naming.module_namespace %}{{ api.naming.module_namespace|join('.'
8382
from {% if api.naming.module_namespace %}{{ api.naming.module_namespace|join('.') }}.{% endif %}
8483
{{ api.naming.versioned_module_name }}.types.{{ proto.module_name }} import {{ enum.name }}
8584
{% endfor %}{% endfor %}
86-
{% endfilter %}
8785
{# Define __all__.
8886
This requires the full set of imported names, so we iterate over
8987
them again.
9088
-#}
9189
__all__ = (
9290
{% filter indent %}
93-
{% filter sort_lines %}
94-
{% for subpackage in api.subpackages.keys() %}
91+
{% for subpackage in api.subpackages|dictsort %}
9592
'{{ subpackage }}',
9693
{% endfor %}
9794
{% for service in api.services.values()|sort(attribute='name')
@@ -108,7 +105,6 @@ __all__ = (
108105
'{{ enum.name }}',
109106
{% endfor %}{% endfor %}
110107
{% endfilter %}
111-
{% endfilter %}
112108
)
113109
{% endif %} {# lazy import #}
114110
{% endblock %}

gapic/ads-templates/%namespace/%name/__init__.py.j2

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends '_base.py.j2' %}
22
{% block content %}
33

4-
{% if opts.lazy_import %} {# lazy import #}
4+
{% if opts.lazy_import -%} {# lazy import #}
55
import importlib
66
import sys
77

@@ -48,8 +48,7 @@ def __dir__():
4848
return globals().get('__all__') or __getattr__('__all__')
4949
{% else %} {# do not use lazy import #}
5050
{# Import subpackages. -#}
51-
{% filter sort_lines %}
52-
{% for subpackage in api.subpackages.keys() %}
51+
{% for subpackage in api.subpackages|dictsort %}
5352
from {% if api.naming.module_namespace %}{{ api.naming.module_namespace|join('.') }}.{% endif %}
5453
{{- api.naming.versioned_module_name }} import {{ subpackage }}
5554
{% endfor %}
@@ -81,14 +80,12 @@ from {% if api.naming.module_namespace %}{{ api.naming.module_namespace|join('.'
8180
from {% if api.naming.module_namespace %}{{ api.naming.module_namespace|join('.') }}.{% endif %}
8281
{{- api.naming.versioned_module_name }}.types.{{ proto.module_name }} import {{ enum.name }}
8382
{% endfor %}{% endfor %}
84-
{% endfilter %}
8583
{# Define __all__.
8684
This requires the full set of imported names, so we iterate over
8785
them again.
8886
#}
8987
__all__ = (
9088
{% filter indent %}
91-
{% filter sort_lines %}
9289
{% for subpackage, _ in api.subpackages|dictsort %}
9390
'{{ subpackage }}',
9491
{% endfor %}
@@ -106,7 +103,6 @@ __all__ = (
106103
'{{ enum.name }}',
107104
{% endfor %}{% endfor %}
108105
{% endfilter %}
109-
{% endfilter %}
110106
)
111107
{% endif %} {# lazy import #}
112108
{% endblock %}

0 commit comments

Comments
 (0)