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

Commit 93ef495

Browse files
committed
Merge branch 'self-signed-jwt' of github.com:googleapis/gapic-generator-python into self-signed-jwt
2 parents 5344b6b + b95db64 commit 93ef495

6 files changed

Lines changed: 70 additions & 7 deletions

File tree

.github/workflows/pypi-upload.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Upload Python Package to PyPI
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
environment: PyPI
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up Python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: '3.x'
17+
- name: Install dependencies
18+
run: python -m pip install twine wheel
19+
- name: Package and upload modulee
20+
env:
21+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
22+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
23+
run: |
24+
python setup.py sdist bdist_wheel
25+
twine upload dist/*

CHANGELOG.md

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

3+
### [0.40.12](https://www.github.com/googleapis/gapic-generator-python/compare/v0.40.11...v0.40.12) (2021-02-26)
4+
5+
6+
### Bug Fixes
7+
8+
* exclude 'input' from reserved names list ([#788](https://www.github.com/googleapis/gapic-generator-python/issues/788)) ([da2ff71](https://www.github.com/googleapis/gapic-generator-python/commit/da2ff717b82357359baeeafad9a3e48a70e194cb))
9+
10+
### [0.40.11](https://www.github.com/googleapis/gapic-generator-python/compare/v0.40.10...v0.40.11) (2021-02-24)
11+
12+
13+
### Bug Fixes
14+
15+
* remove duplicate field entries ([#786](https://www.github.com/googleapis/gapic-generator-python/issues/786)) ([9f4dfa4](https://www.github.com/googleapis/gapic-generator-python/commit/9f4dfa46cb6a67081563ce096452fedd9e35051d))
16+
317
### [0.40.10](https://www.github.com/googleapis/gapic-generator-python/compare/v0.40.9...v0.40.10) (2021-02-17)
418

519

gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
365365
request = {{ method.input.ident }}(**request)
366366
{% if method.flattened_fields -%}{# Cross-package req and flattened fields #}
367367
elif not request:
368-
request = {{ method.input.ident }}({% if method.input.ident.package != method.ident.package %}{% for f in method.flattened_fields.values() %}{{ f.name }}={{ f.name }}, {% endfor %}{% endif %})
368+
request = {{ method.input.ident }}()
369369
{% endif -%}{# Cross-package req and flattened fields #}
370370
{%- else %}
371371
# Minor optimization to avoid making a copy if the user passes

gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,30 @@ def test_{{ method.name|snake_case }}_from_dict():
498498
test_{{ method.name|snake_case }}(request_type=dict)
499499

500500

501+
{% if not method.client_streaming -%}
502+
def test_{{ method.name|snake_case }}_empty_call():
503+
# This test is a coverage failsafe to make sure that totally empty calls,
504+
# i.e. request == None and no flattened fields passed, work.
505+
client = {{ service.client_name }}(
506+
credentials=credentials.AnonymousCredentials(),
507+
transport='grpc',
508+
)
509+
510+
# Mock the actual call within the gRPC stub, and fake the request.
511+
with mock.patch.object(
512+
type(client.transport.{{ method.name|snake_case }}),
513+
'__call__') as call:
514+
client.{{ method.name|snake_case }}()
515+
call.assert_called()
516+
_, args, _ = call.mock_calls[0]
517+
{% if method.client_streaming %}
518+
assert next(args[0]) == request
519+
{% else %}
520+
assert args[0] == {{ method.input.ident }}()
521+
{% endif %}
522+
{% endif -%}
523+
524+
501525
@pytest.mark.asyncio
502526
async def test_{{ method.name|snake_case }}_async(transport: str = 'grpc_asyncio', request_type={{ method.input.ident }}):
503527
client = {{ service.async_client_name }}(
@@ -1303,7 +1327,7 @@ def test_{{ method.name|snake_case }}_pager():
13031327
for result in results:
13041328
assert isinstance(result, tuple)
13051329
assert tuple(type(t) for t in result) == (str, {{ method.paged_result_field.type.fields.get('value').ident }})
1306-
1330+
13071331
assert pager.get('a') is None
13081332
assert isinstance(pager.get('h'), {{ method.paged_result_field.type.fields.get('value').ident }})
13091333
{% else %}
@@ -1315,7 +1339,7 @@ def test_{{ method.name|snake_case }}_pager():
13151339
for page_, token in zip(pages, ['abc','def','ghi', '']):
13161340
assert page_.raw_page.next_page_token == token
13171341

1318-
1342+
13191343
{% endif %} {# paged methods #}
13201344
{% endfor -%} {#- method in methods for rest #}
13211345
def test_credentials_transport_error():
@@ -1771,7 +1795,7 @@ def test_{{ service.name|snake_case }}_grpc_transport_client_cert_source_for_mtl
17711795
("grpc.max_receive_message_length", -1),
17721796
],
17731797
)
1774-
1798+
17751799
# Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls
17761800
# is used.
17771801
with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()):

gapic/utils/reserved_names.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
RESERVED_NAMES = frozenset(
2323
itertools.chain(
2424
keyword.kwlist,
25-
set(dir(builtins)) - {"filter", "map", "id", "property"},
25+
set(dir(builtins)) - {"filter", "map", "id", "input", "property"},
2626
)
2727
)

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
click==7.1.2
22
google-api-core==1.26.0
3-
googleapis-common-protos==1.52.0
3+
googleapis-common-protos==1.53.0
44
jinja2==2.11.3
55
MarkupSafe==1.1.1
6-
protobuf==3.15.0
6+
protobuf==3.15.3
77
pypandoc==1.5
88
PyYAML==5.4.1
99
dataclasses==0.6 # TODO(busunkim) remove when 3.6 support is dropped

0 commit comments

Comments
 (0)