Hello community,

here is the log from the commit of package python-google-api-core for 
openSUSE:Factory checked in at 2020-06-10 00:45:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-google-api-core (Old)
 and      /work/SRC/openSUSE:Factory/.python-google-api-core.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-google-api-core"

Wed Jun 10 00:45:21 2020 rev:13 rq:810893 version:1.17.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-google-api-core/python-google-api-core.changes
    2020-04-21 13:10:56.240844602 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-google-api-core.new.3606/python-google-api-core.changes
  2020-06-10 00:45:29.098494759 +0200
@@ -1,0 +2,8 @@
+Tue Jun  2 16:14:34 UTC 2020 - Dirk Mueller <[email protected]>
+
+- update to 1.17.0:
+  * api_core: add retry param into PollingFuture() and it’s inheritors (#9923) 
(14f1f34), closes #6197
+  * api-core: add client_cert_source to ClientOptions (#17) (748c935)
+  * consume part of StreamingResponseIterator to support failure while under a 
retry context (#10206) (2b103b6)
+
+-------------------------------------------------------------------

Old:
----
  google-api-core-1.16.0.tar.gz

New:
----
  google-api-core-1.17.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-google-api-core.spec ++++++
--- /var/tmp/diff_new_pack.LdM8rq/_old  2020-06-10 00:45:30.974499442 +0200
+++ /var/tmp/diff_new_pack.LdM8rq/_new  2020-06-10 00:45:30.978499452 +0200
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %bcond_without python2
 Name:           python-google-api-core
-Version:        1.16.0
+Version:        1.17.0
 Release:        0
 Summary:        Google API client core library
 License:        Apache-2.0

++++++ google-api-core-1.16.0.tar.gz -> google-api-core-1.17.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-core-1.16.0/LICENSE 
new/google-api-core-1.17.0/LICENSE
--- old/google-api-core-1.16.0/LICENSE  2020-01-14 02:27:31.000000000 +0100
+++ new/google-api-core-1.17.0/LICENSE  2020-04-15 01:18:41.000000000 +0200
@@ -1,7 +1,6 @@
-
-                                 Apache License
+                            Apache License
                            Version 2.0, January 2004
-                        http://www.apache.org/licenses/
+                        https://www.apache.org/licenses/
 
    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
 
@@ -193,7 +192,7 @@
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
 
-       http://www.apache.org/licenses/LICENSE-2.0
+       https://www.apache.org/licenses/LICENSE-2.0
 
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-core-1.16.0/MANIFEST.in 
new/google-api-core-1.17.0/MANIFEST.in
--- old/google-api-core-1.16.0/MANIFEST.in      2020-01-14 02:27:31.000000000 
+0100
+++ new/google-api-core-1.17.0/MANIFEST.in      2020-04-15 01:18:41.000000000 
+0200
@@ -1,3 +1,6 @@
+# Generated by synthtool. DO NOT EDIT!
 include README.rst LICENSE
+recursive-include google *.json *.proto
 recursive-include tests *
-global-exclude *.pyc __pycache__
+global-exclude *.py[co]
+global-exclude __pycache__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-core-1.16.0/PKG-INFO 
new/google-api-core-1.17.0/PKG-INFO
--- old/google-api-core-1.16.0/PKG-INFO 2020-01-14 02:30:51.890481700 +0100
+++ new/google-api-core-1.17.0/PKG-INFO 2020-04-15 01:20:13.933496000 +0200
@@ -1,8 +1,8 @@
 Metadata-Version: 2.1
 Name: google-api-core
-Version: 1.16.0
+Version: 1.17.0
 Summary: Google API client core library
-Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
+Home-page: https://github.com/googleapis/python-api-core
 Author: Google LLC
 Author-email: [email protected]
 License: Apache 2.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-core-1.16.0/google/api_core/client_options.py 
new/google-api-core-1.17.0/google/api_core/client_options.py
--- old/google-api-core-1.16.0/google/api_core/client_options.py        
2020-01-14 02:27:31.000000000 +0100
+++ new/google-api-core-1.17.0/google/api_core/client_options.py        
2020-04-15 01:18:41.000000000 +0200
@@ -24,7 +24,12 @@
     from google.api_core.client_options import ClientOptions
     from google.cloud.vision_v1 import ImageAnnotatorClient
 
-    options = ClientOptions(api_endpoint="foo.googleapis.com")
+    def get_client_cert():
+        # code to load client certificate and private key.
+        return client_cert_bytes, client_private_key_bytes
+
+    options = ClientOptions(api_endpoint="foo.googleapis.com",
+        client_cert_source=get_client_cert)
 
     client = ImageAnnotatorClient(client_options=options)
 
@@ -34,7 +39,11 @@
 
     from google.cloud.vision_v1 import ImageAnnotatorClient
 
-    client = ImageAnnotatorClient(client_options={"api_endpoint": 
"foo.googleapis.com"})
+    client = ImageAnnotatorClient(
+        client_options={
+            "api_endpoint": "foo.googleapis.com",
+            "client_cert_source" : get_client_cert
+        })
 
 
 """
@@ -45,10 +54,14 @@
 
     Args:
         api_endpoint (str): The desired API endpoint, e.g., 
compute.googleapis.com
+        client_cert_source (Callable[[], (bytes, bytes)]): An optional callback
+            which returns client certificate bytes and private key bytes both 
in
+            PEM format.
     """
 
-    def __init__(self, api_endpoint=None):
+    def __init__(self, api_endpoint=None, client_cert_source=None):
         self.api_endpoint = api_endpoint
+        self.client_cert_source = client_cert_source
 
     def __repr__(self):
         return "ClientOptions: " + repr(self.__dict__)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-core-1.16.0/google/api_core/future/polling.py 
new/google-api-core-1.17.0/google/api_core/future/polling.py
--- old/google-api-core-1.16.0/google/api_core/future/polling.py        
2020-01-14 02:27:31.000000000 +0100
+++ new/google-api-core-1.17.0/google/api_core/future/polling.py        
2020-04-15 01:18:41.000000000 +0200
@@ -66,9 +66,12 @@
         self._done_callbacks = []
 
     @abc.abstractmethod
-    def done(self):
+    def done(self, retry=DEFAULT_RETRY):
         """Checks to see if the operation is complete.
 
+        Args:
+            retry (google.api_core.retry.Retry): (Optional) How to retry the 
RPC.
+
         Returns:
             bool: True if the operation is complete, False otherwise.
         """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-core-1.16.0/google/api_core/grpc_helpers.py 
new/google-api-core-1.17.0/google/api_core/grpc_helpers.py
--- old/google-api-core-1.16.0/google/api_core/grpc_helpers.py  2020-01-14 
02:27:31.000000000 +0100
+++ new/google-api-core-1.17.0/google/api_core/grpc_helpers.py  2020-04-15 
01:18:41.000000000 +0200
@@ -65,6 +65,19 @@
     def __init__(self, wrapped):
         self._wrapped = wrapped
 
+        # This iterator is used in a retry context, and returned outside after 
init.
+        # gRPC will not throw an exception until the stream is consumed, so we 
need
+        # to retrieve the first result, in order to fail, in order to trigger 
a retry.
+        try:
+            self._stored_first_result = six.next(self._wrapped)
+        except TypeError:
+            # It is possible the wrapped method isn't an iterable (a grpc.Call
+            # for instance). If this happens don't store the first result.
+            pass
+        except StopIteration:
+            # ignore stop iteration at this time. This should be handled 
outside of retry.
+            pass
+
     def __iter__(self):
         """This iterator is also an iterable that returns itself."""
         return self
@@ -76,8 +89,13 @@
             protobuf.Message: A single response from the stream.
         """
         try:
+            if hasattr(self, "_stored_first_result"):
+                result = self._stored_first_result
+                del self._stored_first_result
+                return result
             return six.next(self._wrapped)
         except grpc.RpcError as exc:
+            # If the stream has already returned data, we cannot recover here.
             six.raise_from(exceptions.from_grpc_error(exc), exc)
 
     # Alias needed for Python 2/3 support.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-core-1.16.0/google/api_core/operation.py 
new/google-api-core-1.17.0/google/api_core/operation.py
--- old/google-api-core-1.16.0/google/api_core/operation.py     2020-01-14 
02:27:31.000000000 +0100
+++ new/google-api-core-1.17.0/google/api_core/operation.py     2020-04-15 
01:18:41.000000000 +0200
@@ -145,21 +145,28 @@
                 )
                 self.set_exception(exception)
 
-    def _refresh_and_update(self):
-        """Refresh the operation and update the result if needed."""
+    def _refresh_and_update(self, retry=polling.DEFAULT_RETRY):
+        """Refresh the operation and update the result if needed.
+
+        Args:
+            retry (google.api_core.retry.Retry): (Optional) How to retry the 
RPC.
+        """
         # If the currently cached operation is done, no need to make another
         # RPC as it will not change once done.
         if not self._operation.done:
-            self._operation = self._refresh()
+            self._operation = self._refresh(retry=retry)
             self._set_result_from_operation()
 
-    def done(self):
+    def done(self, retry=polling.DEFAULT_RETRY):
         """Checks to see if the operation is complete.
 
+        Args:
+            retry (google.api_core.retry.Retry): (Optional) How to retry the 
RPC.
+
         Returns:
             bool: True if the operation is complete, False otherwise.
         """
-        self._refresh_and_update()
+        self._refresh_and_update(retry)
         return self._operation.done
 
     def cancel(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-core-1.16.0/google_api_core.egg-info/PKG-INFO 
new/google-api-core-1.17.0/google_api_core.egg-info/PKG-INFO
--- old/google-api-core-1.16.0/google_api_core.egg-info/PKG-INFO        
2020-01-14 02:30:51.000000000 +0100
+++ new/google-api-core-1.17.0/google_api_core.egg-info/PKG-INFO        
2020-04-15 01:20:13.000000000 +0200
@@ -1,8 +1,8 @@
 Metadata-Version: 2.1
 Name: google-api-core
-Version: 1.16.0
+Version: 1.17.0
 Summary: Google API client core library
-Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
+Home-page: https://github.com/googleapis/python-api-core
 Author: Google LLC
 Author-email: [email protected]
 License: Apache 2.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-core-1.16.0/google_api_core.egg-info/requires.txt 
new/google-api-core-1.17.0/google_api_core.egg-info/requires.txt
--- old/google-api-core-1.16.0/google_api_core.egg-info/requires.txt    
2020-01-14 02:30:51.000000000 +0100
+++ new/google-api-core-1.17.0/google_api_core.egg-info/requires.txt    
2020-04-15 01:20:13.000000000 +0200
@@ -1,6 +1,6 @@
 googleapis-common-protos<2.0dev,>=1.6.0
 protobuf>=3.4.0
-google-auth<2.0dev,>=0.4.0
+google-auth<2.0dev,>=1.14.0
 requests<3.0.0dev,>=2.18.0
 setuptools>=34.0.0
 six>=1.10.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-core-1.16.0/setup.py 
new/google-api-core-1.17.0/setup.py
--- old/google-api-core-1.16.0/setup.py 2020-01-14 02:27:31.000000000 +0100
+++ new/google-api-core-1.17.0/setup.py 2020-04-15 01:18:41.000000000 +0200
@@ -22,7 +22,7 @@
 
 name = "google-api-core"
 description = "Google API client core library"
-version = "1.16.0"
+version = "1.17.0"
 # Should be one of:
 # 'Development Status :: 3 - Alpha'
 # 'Development Status :: 4 - Beta'
@@ -31,7 +31,7 @@
 dependencies = [
     "googleapis-common-protos >= 1.6.0, < 2.0dev",
     "protobuf >= 3.4.0",
-    "google-auth >= 0.4.0, < 2.0dev",
+    "google-auth >= 1.14.0, < 2.0dev",
     "requests >= 2.18.0, < 3.0.0dev",
     "setuptools >= 34.0.0",
     "six >= 1.10.0",
@@ -73,7 +73,7 @@
     author="Google LLC",
     author_email="[email protected]",
     license="Apache 2.0",
-    url="https://github.com/GoogleCloudPlatform/google-cloud-python";,
+    url="https://github.com/googleapis/python-api-core";,
     classifiers=[
         release_status,
         "Intended Audience :: Developers",
@@ -93,7 +93,7 @@
     namespace_packages=namespaces,
     install_requires=dependencies,
     extras_require=extras,
-    python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
+    python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
     include_package_data=True,
     zip_safe=False,
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-core-1.16.0/tests/unit/test_client_options.py 
new/google-api-core-1.17.0/tests/unit/test_client_options.py
--- old/google-api-core-1.16.0/tests/unit/test_client_options.py        
2020-01-14 02:27:31.000000000 +0100
+++ new/google-api-core-1.17.0/tests/unit/test_client_options.py        
2020-04-15 01:18:41.000000000 +0200
@@ -17,26 +17,46 @@
 from google.api_core import client_options
 
 
+def get_client_cert():
+    return b"cert", b"key"
+
+
 def test_constructor():
-    options = client_options.ClientOptions(api_endpoint="foo.googleapis.com")
+
+    options = client_options.ClientOptions(
+        api_endpoint="foo.googleapis.com", client_cert_source=get_client_cert
+    )
 
     assert options.api_endpoint == "foo.googleapis.com"
+    assert options.client_cert_source() == (b"cert", b"key")
 
 
 def test_from_dict():
-    options = client_options.from_dict({"api_endpoint": "foo.googleapis.com"})
+    options = client_options.from_dict(
+        {"api_endpoint": "foo.googleapis.com", "client_cert_source": 
get_client_cert}
+    )
 
     assert options.api_endpoint == "foo.googleapis.com"
+    # assert options.client_cert_source == get_client_cert
+    assert options.client_cert_source() == (b"cert", b"key")
 
 
 def test_from_dict_bad_argument():
     with pytest.raises(ValueError):
         client_options.from_dict(
-            {"api_endpoint": "foo.googleapis.com", "bad_arg": "1234"}
+            {
+                "api_endpoint": "foo.googleapis.com",
+                "bad_arg": "1234",
+                "client_cert_source": get_client_cert,
+            }
         )
 
 
 def test_repr():
     options = client_options.ClientOptions(api_endpoint="foo.googleapis.com")
 
-    assert repr(options) == "ClientOptions: {'api_endpoint': 
'foo.googleapis.com'}"
+    assert (
+        repr(options)
+        == "ClientOptions: {'api_endpoint': 'foo.googleapis.com', 
'client_cert_source': None}"
+        or "ClientOptions: {'client_cert_source': None, 'api_endpoint': 
'foo.googleapis.com'}"
+    )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-core-1.16.0/tests/unit/test_grpc_helpers.py 
new/google-api-core-1.17.0/tests/unit/test_grpc_helpers.py
--- old/google-api-core-1.16.0/tests/unit/test_grpc_helpers.py  2020-01-14 
02:27:31.000000000 +0100
+++ new/google-api-core-1.17.0/tests/unit/test_grpc_helpers.py  2020-04-15 
01:18:41.000000000 +0200
@@ -129,24 +129,55 @@
     assert exc_info.value.response == grpc_error
 
 
+def test_wrap_stream_empty_iterator():
+    expected_responses = []
+    callable_ = mock.Mock(spec=["__call__"], 
return_value=iter(expected_responses))
+
+    wrapped_callable = grpc_helpers._wrap_stream_errors(callable_)
+
+    got_iterator = wrapped_callable()
+
+    responses = list(got_iterator)
+
+    callable_.assert_called_once_with()
+    assert responses == expected_responses
+
+
 class RpcResponseIteratorImpl(object):
-    def __init__(self, exception):
-        self._exception = exception
+    def __init__(self, iterable):
+        self._iterable = iter(iterable)
 
     def next(self):
-        raise self._exception
+        next_item = next(self._iterable)
+        if isinstance(next_item, RpcErrorImpl):
+            raise next_item
+        return next_item
 
     __next__ = next
 
 
-def test_wrap_stream_errors_iterator():
+def test_wrap_stream_errors_iterator_initialization():
     grpc_error = RpcErrorImpl(grpc.StatusCode.UNAVAILABLE)
-    response_iter = RpcResponseIteratorImpl(grpc_error)
+    response_iter = RpcResponseIteratorImpl([grpc_error])
     callable_ = mock.Mock(spec=["__call__"], return_value=response_iter)
 
     wrapped_callable = grpc_helpers._wrap_stream_errors(callable_)
 
+    with pytest.raises(exceptions.ServiceUnavailable) as exc_info:
+        wrapped_callable(1, 2, three="four")
+
+    callable_.assert_called_once_with(1, 2, three="four")
+    assert exc_info.value.response == grpc_error
+
+
+def test_wrap_stream_errors_during_iteration():
+    grpc_error = RpcErrorImpl(grpc.StatusCode.UNAVAILABLE)
+    response_iter = RpcResponseIteratorImpl([1, grpc_error])
+    callable_ = mock.Mock(spec=["__call__"], return_value=response_iter)
+
+    wrapped_callable = grpc_helpers._wrap_stream_errors(callable_)
     got_iterator = wrapped_callable(1, 2, three="four")
+    next(got_iterator)
 
     with pytest.raises(exceptions.ServiceUnavailable) as exc_info:
         next(got_iterator)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-core-1.16.0/tests/unit/test_operation.py 
new/google-api-core-1.17.0/tests/unit/test_operation.py
--- old/google-api-core-1.16.0/tests/unit/test_operation.py     2020-01-14 
02:27:31.000000000 +0100
+++ new/google-api-core-1.17.0/tests/unit/test_operation.py     2020-04-15 
01:18:41.000000000 +0200
@@ -15,8 +15,10 @@
 
 import mock
 
+from google.api_core import exceptions
 from google.api_core import operation
 from google.api_core import operations_v1
+from google.api_core import retry
 from google.longrunning import operations_pb2
 from google.protobuf import struct_pb2
 from google.rpc import code_pb2
@@ -113,6 +115,23 @@
     assert future.done()
 
 
+def test_done_w_retry():
+    RETRY_PREDICATE = retry.if_exception_type(exceptions.TooManyRequests)
+    test_retry = retry.Retry(predicate=RETRY_PREDICATE)
+
+    expected_result = struct_pb2.Struct()
+    responses = [
+        make_operation_proto(),
+        # Second operation response includes the result.
+        make_operation_proto(done=True, response=expected_result),
+    ]
+    future, _, _ = make_operation_future(responses)
+    future._refresh = mock.Mock()
+
+    future.done(retry=test_retry)
+    future._refresh.assert_called_once_with(retry=test_retry)
+
+
 def test_exception():
     expected_exception = status_pb2.Status(message="meep")
     responses = [


Reply via email to