prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Monitoring: where is CallOptions on monitoring API example?
  [OS] macOS Sierra 10.12.6
  [Versions]
  
  - Python 3.6.1
  
  ```
  google-api-core==1.2.1
  google-api-python-client==1.7.3
  google-auth==1.5.0
  google-auth-httplib2==0.0.3
  google-cloud-monitoring==0.30.0
  googleapis-common-protos==1.5.3
  ```
  
  ----
  
  ## CallOptions class was not found!
  
  Hi. I'm new to GCP and Stackdriver. I wanted to use Google Kubernetes Engine and its auto scaling by custom metrics. Then, it is required to export the metrics to Stackdriver Monitoring, so I am trying to do it.
  
  But, After installing above-mentioned libraries, the example code on monitoring API README document failed. The pit hole is that `CallOptions` was not found, thus I've searched it in this repository and some other repositories.
  
  And finally, I couldn't find it...
  
  `CallOptions` is defined in gax.python, but the package is currently deprecated and moved to google-api-core. So I guess that also the dependency is currently corrupted or the some examples are out-of-date.
  
  Please tell me how handle this problem.
  
  _Thank you for the great package and platform._
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `vision/google/cloud/vision_helpers/__init__.py`
  Content:
  ```
  1 # Copyright 2017, Google LLC All rights reserved.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 from __future__ import absolute_import
  16 import io
  17 
  18 from google.api_core import protobuf_helpers as protobuf
  19 
  20 
  21 class VisionHelpers(object):
  22     """A set of convenience methods to make the Vision GAPIC easier to use.
  23 
  24     This class should be considered abstract; it is used as a superclass
  25     in a multiple-inheritance construction alongside the applicable GAPIC.
  26     See the :class:`~google.cloud.vision_v1.ImageAnnotatorClient`.
  27     """
  28     def annotate_image(self, request, retry=None, timeout=None):
  29         """Run image detection and annotation for an image.
  30 
  31         Example:
  32             >>> from google.cloud.vision_v1 import ImageAnnotatorClient
  33             >>> client = ImageAnnotatorClient()
  34             >>> request = {
  35             ...     'image': {
  36             ...         'source': {'image_uri': 'https://foo.com/image.jpg'},
  37             ...     },
  38             ... }
  39             >>> response = client.annotate_image(request)
  40 
  41         Args:
  42             request (:class:`~.vision_v1.types.AnnotateImageRequest`)
  43             options (:class:`google.gax.CallOptions`): Overrides the default
  44                 settings for this call, e.g, timeout, retries, etc.
  45 
  46         Returns:
  47             :class:`~.vision_v1.types.AnnotateImageResponse` The API response.
  48         """
  49         # If the image is a file handler, set the content.
  50         image = protobuf.get(request, 'image')
  51         if hasattr(image, 'read'):
  52             img_bytes = image.read()
  53             protobuf.set(request, 'image', {})
  54             protobuf.set(request, 'image.content', img_bytes)
  55             image = protobuf.get(request, 'image')
  56 
  57         # If a filename is provided, read the file.
  58         filename = protobuf.get(image, 'source.filename', default=None)
  59         if filename:
  60             with io.open(filename, 'rb') as img_file:
  61                 protobuf.set(request, 'image.content', img_file.read())
  62                 protobuf.set(request, 'image.source', None)
  63 
  64         # This method allows features not to be specified, and you get all
  65         # of them.
  66         protobuf.setdefault(request, 'features', self._get_all_features())
  67         r = self.batch_annotate_images([request], retry=retry, timeout=timeout)
  68         return r.responses[0]
  69 
  70     def _get_all_features(self):
  71         """Return a list of all features.
  72 
  73         Returns:
  74             list: A list of all available features.
  75         """
  76         return [
  77             {'type': feature}
  78             for feature in self.enums.Feature.Type if feature != 0]
  79
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/vision/google/cloud/vision_helpers/__init__.py b/vision/google/cloud/vision_helpers/__init__.py
  --- a/vision/google/cloud/vision_helpers/__init__.py
  +++ b/vision/google/cloud/vision_helpers/__init__.py
  @@ -40,8 +40,12 @@
   
           Args:
               request (:class:`~.vision_v1.types.AnnotateImageRequest`)
  -            options (:class:`google.gax.CallOptions`): Overrides the default
  -                settings for this call, e.g, timeout, retries, etc.
  +            retry (Optional[google.api_core.retry.Retry]):  A retry object used
  +                to retry requests. If ``None`` is specified, requests will not
  +                be retried.
  +            timeout (Optional[float]): The amount of time, in seconds, to wait
  +                for the request to complete. Note that if ``retry`` is
  +                specified, the timeout applies to each individual attempt.
   
           Returns:
               :class:`~.vision_v1.types.AnnotateImageResponse` The API response.
  
verification_info: {"golden_diff": "diff --git a/vision/google/cloud/vision_helpers/__init__.py b/vision/google/cloud/vision_helpers/__init__.py\n--- a/vision/google/cloud/vision_helpers/__init__.py\n+++ b/vision/google/cloud/vision_helpers/__init__.py\n@@ -40,8 +40,12 @@\n \n         Args:\n             request (:class:`~.vision_v1.types.AnnotateImageRequest`)\n-            options (:class:`google.gax.CallOptions`): Overrides the default\n-                settings for this call, e.g, timeout, retries, etc.\n+            retry (Optional[google.api_core.retry.Retry]):  A retry object used\n+                to retry requests. If ``None`` is specified, requests will not\n+                be retried.\n+            timeout (Optional[float]): The amount of time, in seconds, to wait\n+                for the request to complete. Note that if ``retry`` is\n+                specified, the timeout applies to each individual attempt.\n \n         Returns:\n             :class:`~.vision_v1.types.AnnotateImageResponse` The API response.\n", "issue": "Monitoring: where is CallOptions on monitoring API example?\n[OS] macOS Sierra 10.12.6\r\n[Versions]\r\n\r\n- Python 3.6.1\r\n\r\n```\r\ngoogle-api-core==1.2.1\r\ngoogle-api-python-client==1.7.3\r\ngoogle-auth==1.5.0\r\ngoogle-auth-httplib2==0.0.3\r\ngoogle-cloud-monitoring==0.30.0\r\ngoogleapis-common-protos==1.5.3\r\n```\r\n\r\n----\r\n\r\n## CallOptions class was not found!\r\n\r\nHi. I'm new to GCP and Stackdriver. I wanted to use Google Kubernetes Engine and its auto scaling by custom metrics. Then, it is required to export the metrics to Stackdriver Monitoring, so I am trying to do it.\r\n\r\nBut, After installing above-mentioned libraries, the example code on monitoring API README document failed. The pit hole is that `CallOptions` was not found, thus I've searched it in this repository and some other repositories.\r\n\r\nAnd finally, I couldn't find it...\r\n\r\n`CallOptions` is defined in gax.python, but the package is currently deprecated and moved to google-api-core. So I guess that also the dependency is currently corrupted or the some examples are out-of-date.\r\n\r\nPlease tell me how handle this problem.\r\n\r\n_Thank you for the great package and platform._\n", "before_files": [{"content": "# Copyright 2017, Google LLC All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import\nimport io\n\nfrom google.api_core import protobuf_helpers as protobuf\n\n\nclass VisionHelpers(object):\n    \"\"\"A set of convenience methods to make the Vision GAPIC easier to use.\n\n    This class should be considered abstract; it is used as a superclass\n    in a multiple-inheritance construction alongside the applicable GAPIC.\n    See the :class:`~google.cloud.vision_v1.ImageAnnotatorClient`.\n    \"\"\"\n    def annotate_image(self, request, retry=None, timeout=None):\n        \"\"\"Run image detection and annotation for an image.\n\n        Example:\n            >>> from google.cloud.vision_v1 import ImageAnnotatorClient\n            >>> client = ImageAnnotatorClient()\n            >>> request = {\n            ...     'image': {\n            ...         'source': {'image_uri': 'https://foo.com/image.jpg'},\n            ...     },\n            ... }\n            >>> response = client.annotate_image(request)\n\n        Args:\n            request (:class:`~.vision_v1.types.AnnotateImageRequest`)\n            options (:class:`google.gax.CallOptions`): Overrides the default\n                settings for this call, e.g, timeout, retries, etc.\n\n        Returns:\n            :class:`~.vision_v1.types.AnnotateImageResponse` The API response.\n        \"\"\"\n        # If the image is a file handler, set the content.\n        image = protobuf.get(request, 'image')\n        if hasattr(image, 'read'):\n            img_bytes = image.read()\n            protobuf.set(request, 'image', {})\n            protobuf.set(request, 'image.content', img_bytes)\n            image = protobuf.get(request, 'image')\n\n        # If a filename is provided, read the file.\n        filename = protobuf.get(image, 'source.filename', default=None)\n        if filename:\n            with io.open(filename, 'rb') as img_file:\n                protobuf.set(request, 'image.content', img_file.read())\n                protobuf.set(request, 'image.source', None)\n\n        # This method allows features not to be specified, and you get all\n        # of them.\n        protobuf.setdefault(request, 'features', self._get_all_features())\n        r = self.batch_annotate_images([request], retry=retry, timeout=timeout)\n        return r.responses[0]\n\n    def _get_all_features(self):\n        \"\"\"Return a list of all features.\n\n        Returns:\n            list: A list of all available features.\n        \"\"\"\n        return [\n            {'type': feature}\n            for feature in self.enums.Feature.Type if feature != 0]\n", "path": "vision/google/cloud/vision_helpers/__init__.py"}], "after_files": [{"content": "# Copyright 2017, Google LLC All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import\nimport io\n\nfrom google.api_core import protobuf_helpers as protobuf\n\n\nclass VisionHelpers(object):\n    \"\"\"A set of convenience methods to make the Vision GAPIC easier to use.\n\n    This class should be considered abstract; it is used as a superclass\n    in a multiple-inheritance construction alongside the applicable GAPIC.\n    See the :class:`~google.cloud.vision_v1.ImageAnnotatorClient`.\n    \"\"\"\n    def annotate_image(self, request, retry=None, timeout=None):\n        \"\"\"Run image detection and annotation for an image.\n\n        Example:\n            >>> from google.cloud.vision_v1 import ImageAnnotatorClient\n            >>> client = ImageAnnotatorClient()\n            >>> request = {\n            ...     'image': {\n            ...         'source': {'image_uri': 'https://foo.com/image.jpg'},\n            ...     },\n            ... }\n            >>> response = client.annotate_image(request)\n\n        Args:\n            request (:class:`~.vision_v1.types.AnnotateImageRequest`)\n            retry (Optional[google.api_core.retry.Retry]):  A retry object used\n                to retry requests. If ``None`` is specified, requests will not\n                be retried.\n            timeout (Optional[float]): The amount of time, in seconds, to wait\n                for the request to complete. Note that if ``retry`` is\n                specified, the timeout applies to each individual attempt.\n\n        Returns:\n            :class:`~.vision_v1.types.AnnotateImageResponse` The API response.\n        \"\"\"\n        # If the image is a file handler, set the content.\n        image = protobuf.get(request, 'image')\n        if hasattr(image, 'read'):\n            img_bytes = image.read()\n            protobuf.set(request, 'image', {})\n            protobuf.set(request, 'image.content', img_bytes)\n            image = protobuf.get(request, 'image')\n\n        # If a filename is provided, read the file.\n        filename = protobuf.get(image, 'source.filename', default=None)\n        if filename:\n            with io.open(filename, 'rb') as img_file:\n                protobuf.set(request, 'image.content', img_file.read())\n                protobuf.set(request, 'image.source', None)\n\n        # This method allows features not to be specified, and you get all\n        # of them.\n        protobuf.setdefault(request, 'features', self._get_all_features())\n        r = self.batch_annotate_images([request], retry=retry, timeout=timeout)\n        return r.responses[0]\n\n    def _get_all_features(self):\n        \"\"\"Return a list of all features.\n\n        Returns:\n            list: A list of all available features.\n        \"\"\"\n        return [\n            {'type': feature}\n            for feature in self.enums.Feature.Type if feature != 0]\n", "path": "vision/google/cloud/vision_helpers/__init__.py"}]}