From 8440e09855d399d647b62238a9697e04ea4d0d41 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 15 Sep 2020 15:55:24 -0400 Subject: [PATCH 1/2] fix: ignore types for imports generated from 'google.api_core' (#597) Closes #596. --- gapic/schema/imp.py | 2 +- tests/unit/schema/test_imp.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gapic/schema/imp.py b/gapic/schema/imp.py index eb5d8ee830..ba53a91af1 100644 --- a/gapic/schema/imp.py +++ b/gapic/schema/imp.py @@ -31,6 +31,6 @@ def __str__(self) -> str: answer = f"from {'.'.join(self.package)} {answer}" if self.alias: answer += f' as {self.alias}' - if self.module.endswith('_pb2'): + if self.module.endswith('_pb2') or 'api_core' in self.package: answer += ' # type: ignore' return answer diff --git a/tests/unit/schema/test_imp.py b/tests/unit/schema/test_imp.py index c27e4b8769..cb42b81d93 100644 --- a/tests/unit/schema/test_imp.py +++ b/tests/unit/schema/test_imp.py @@ -35,6 +35,11 @@ def test_str_untyped_pb2(): assert str(i) == 'from foo.bar import baz_pb2 as bacon # type: ignore' +def test_str_untyped_api_core(): + i = imp.Import(package=('foo', 'api_core'), module='baz', alias='bacon') + assert str(i) == 'from foo.api_core import baz as bacon # type: ignore' + + def test_str_eq(): i1 = imp.Import(package=('foo', 'bar'), module='baz') i2 = imp.Import(package=('foo', 'bar'), module='baz') From e3faa384b8a1d507e263b2fb8cffcda3fcc3a49a Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 15 Sep 2020 16:20:00 -0400 Subject: [PATCH 2/2] chore: release 0.33.2 (#598) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3950060f54..e13e55ff16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [0.33.2](https://www.github.com/googleapis/gapic-generator-python/compare/v0.33.1...v0.33.2) (2020-09-15) + + +### Bug Fixes + +* ignore types for imports generated from 'google.api_core' ([#597](https://www.github.com/googleapis/gapic-generator-python/issues/597)) ([8440e09](https://www.github.com/googleapis/gapic-generator-python/commit/8440e09855d399d647b62238a9697e04ea4d0d41)), closes [#596](https://www.github.com/googleapis/gapic-generator-python/issues/596) + ### [0.33.1](https://www.github.com/googleapis/gapic-generator-python/compare/v0.33.0...v0.33.1) (2020-09-15) diff --git a/setup.py b/setup.py index 8cfe3e6cc5..3664409113 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__)) -version = "0.33.1" +version = "0.33.2" with io.open(os.path.join(PACKAGE_ROOT, "README.rst")) as file_obj: README = file_obj.read()