internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: googleapis/google-cloud-python

Issue:
Container: Regional Cluster support for GKE clusters

I'm unable to get or create regional clusters using the container_v1 client APIs. The [documentation](https://googleapis.github.io/google-cloud-python/latest/container/gapic/v1/api.html#google.cloud.container_v1.ClusterManagerClient.create_cluster) suggests that this is possible by using the `parent` parameter to describe the project/region to launch the cluster but I get the following errors:

```bash
(env) david@ ~ $ which python
~/dev/env/bin/python 

(env) david@ ~ $ pip freeze
...
google-api-core==1.6.0
google-auth==1.6.1
google-cloud==0.34.0
google-cloud-container==0.1.1
googleapis-common-protos==1.5.5
grpcio==1.16.1
...

(env) david@ ~ $ python --version
Python 2.7.10

(env) david@ ~ $ python ./get_cluster.py
Traceback (most recent call last):
  File "./get_cluster.py", line 6, in <module>
    cluster = client.get_cluster(project_id=credentials.project_id, parent='projects/<project_id>/locations/us-east1', cluster_id='ha-cluster-1')
TypeError: get_cluster() got an unexpected keyword argument 'parent'
```
 
Is it possible that the API documentation has been updated before the feature was merged or is it more likely an environment issue on my end? Any insight into this would be appreciated

I have also looked at using the [google-api-python-client](https://github.com/googleapis/google-api-python-client#google-api-client) to launch regional clusters but I would prefer to use this library if the feature is supported.  Are there any known workarounds for this?



Discussion:
The source protos were [updated](https://github.com/googleapis/googleapis/commit/27aa9a664e8d94560c18dfae1e12f277036d9e33#diff-c8b4ce812f4fcba12ec4d26438c2b919) around Nov 6, and it looks like the documentation reflects that, and it looks like the [code](https://github.com/googleapis/google-cloud-python/tree/master/container/google/cloud/container_v1/gapic) has been generated in the repo itself as well. But https://pypi.org/project/google-cloud-container says the library itself was last released in February. @theacodes @tseaver Can we release an update to google-cloud-container?
@dazuma I can make a release, if we're satisfied that the library is in good shape (given the weird codegen issues from earlier).
@tseaver Yes we were able to update the gapic configs conservatively to avoid breaking changes in the library.

Resolving patch:
diff --git a/container/setup.py b/container/setup.py
--- a/container/setup.py
+++ b/container/setup.py
@@ -22,7 +22,7 @@
 
 name = 'google-cloud-container'
 description = 'Google Container Engine API client library'
-version = '0.1.1'
+version = '0.2.0'
 # Should be one of:
 # 'Development Status :: 3 - Alpha'
 # 'Development Status :: 4 - Beta'


Test patch:
Repository: googleapis/google-cloud-python

Issue:
Firestore: Improve docs for 'Query.get' / 'Collection.get'
`Query.get` (which underlies `Collection.get`) could have better documentation strings. Particularly there is no mention that iteration must be completed in the `max_rpc_timeout_millis` as specificed when creating the firestore_client. If iteration is not completed in that time, the iteration will stop at the timeout.

This is in response to a customer question on StackOverflow:

https://stackoverflow.com/questions/52395736/loop-over-cloud-firestore-docs-ends-unexpectedly-after-20-seconds-when-iterating


Discussion:
#6033 was the previous report of that same SO issue here.  I wasn't aware of the timeout:  I assumed that it was a problem with non-transactional write-during-read.

Resolving patch:
diff --git a/firestore/google/cloud/firestore_v1beta1/collection.py b/firestore/google/cloud/firestore_v1beta1/collection.py
--- a/firestore/google/cloud/firestore_v1beta1/collection.py
+++ b/firestore/google/cloud/firestore_v1beta1/collection.py
@@ -354,8 +354,16 @@ def end_at(self, document_fields):
     def get(self, transaction=None):
         """Read the documents in this collection.
 
-        This sends a ``RunQuery`` RPC and then consumes each document
-        returned in the stream of ``RunQueryResponse`` messages.
+        This sends a ``RunQuery`` RPC and then returns an iterator which
+        consumes each document returned in the stream of ``RunQueryResponse``
+        messages.
+
+        .. note::
+
+           The underlying stream of responses will time out after
+           the ``max_rpc_timeout_millis`` value set in the GAPIC
+           client configuration for the ``RunQuery`` API.  Snapshots
+           not consumed from the iterator before that point will be lost.
 
         If a ``transaction`` is used and it already has write operations
         added, this method cannot be used (i.e. read-after-write is not
diff --git a/firestore/google/cloud/firestore_v1beta1/query.py b/firestore/google/cloud/firestore_v1beta1/query.py
--- a/firestore/google/cloud/firestore_v1beta1/query.py
+++ b/firestore/google/cloud/firestore_v1beta1/query.py
@@ -640,8 +640,16 @@ def _to_protobuf(self):
     def get(self, transaction=None):
         """Read the documents in the collection that match this query.
 
-        This sends a ``RunQuery`` RPC and then consumes each document
-        returned in the stream of ``RunQueryResponse`` messages.
+        This sends a ``RunQuery`` RPC and then returns an iterator which
+        consumes each document returned in the stream of ``RunQueryResponse``
+        messages.
+
+        .. note::
+
+           The underlying stream of responses will time out after
+           the ``max_rpc_timeout_millis`` value set in the GAPIC
+           client configuration for the ``RunQuery`` API.  Snapshots
+           not consumed from the iterator before that point will be lost.
 
         If a ``transaction`` is used and it already has write operations
         added, this method cannot be used (i.e. read-after-write is not


Test patch:
Repository: googleapis/google-cloud-python

Issue:
[DO NOT MERGE] Logging: failed to blacken after synth
This PR was generated using Autosynth. :rainbow:

Here's the log from Synthtool:
```
synthtool > Executing /tmpfs/src/git/autosynth/working_repo/logging/synth.py.
synthtool > Ensuring dependencies.
synthtool > Pulling artman image.
latest: Pulling from googleapis/artman
Digest: sha256:8b45fae963557c3299921037ecbb86f0689f41b1b4aea73408ebc50562cb2857
Status: Image is up to date for googleapis/artman:latest
synthtool > Cloning googleapis.
synthtool > Running generator for google/logging/artman_logging.yaml.
synthtool > Generated code into /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/python/logging-v2.
synthtool > Replaced '(^.*$\\n)*' in google/cloud/logging_v2/proto/logging_pb2.py.
synthtool > Replaced '(^.*$\\n)*' in google/cloud/logging_v2/proto/logging_metrics_pb2.py.
synthtool > Replaced '(^.*$\\n)*' in google/cloud/logging_v2/proto/log_entry_pb2.py.
synthtool > Replaced '(^.*$\\n)*' in google/cloud/logging_v2/proto/logging_config_pb2.py.
.coveragerc
.flake8
MANIFEST.in
noxfile.py.j2
setup.cfg
Running session blacken
Session blacken skipped: Python interpreter 3.7 not found.
synthtool > Cleaned up 2 temporary directories.
synthtool > Wrote metadata to synth.metadata.

```


Discussion:
@crwilcox, @theacodes Can one of you please figure out why blacken is failing here?  It runs fine on my local machine.

```python
Running session blacken
Session blacken skipped: Python interpreter 3.7 not found.
synthtool > Cleaned up 2 temporary directories.
synthtool > Wrote metadata to synth.metadata.
```

Resolving patch:
diff --git a/logging/noxfile.py b/logging/noxfile.py
--- a/logging/noxfile.py
+++ b/logging/noxfile.py
@@ -52,7 +52,7 @@ def lint(session):
     session.run("flake8", "google", "tests")
 
 
-@nox.session(python="3.7")
+@nox.session(python="3.6")
 def blacken(session):
     """Run black.
 


Test patch:
Repository: googleapis/google-cloud-python

Issue:
Pub/Sub doc: missing/broken link for FlowControl type definition 
The parameter `FlowControl` in the `subscribe()` method in the ref [doc](https://googleapis.github.io/google-cloud-python/latest/pubsub/subscriber/api/client.html) doesn't have a link to its definition. We should add a link to make the doc easy to use. 


Discussion:

Resolving patch:
diff --git a/pubsub/google/cloud/pubsub_v1/subscriber/client.py b/pubsub/google/cloud/pubsub_v1/subscriber/client.py
--- a/pubsub/google/cloud/pubsub_v1/subscriber/client.py
+++ b/pubsub/google/cloud/pubsub_v1/subscriber/client.py
@@ -186,14 +186,14 @@ def callback(message):
             subscription (str): The name of the subscription. The
                 subscription should have already been created (for example,
                 by using :meth:`create_subscription`).
-            callback (Callable[~.pubsub_v1.subscriber.message.Message]):
+            callback (Callable[~google.cloud.pubsub_v1.subscriber.message.Message]):
                 The callback function. This function receives the message as
                 its only argument and will be called from a different thread/
                 process depending on the scheduling strategy.
-            flow_control (~.pubsub_v1.types.FlowControl): The flow control
+            flow_control (~google.cloud.pubsub_v1.types.FlowControl): The flow control
                 settings. Use this to prevent situations where you are
                 inundated with too many messages at once.
-            scheduler (~.pubsub_v1.subscriber.scheduler.Scheduler): An optional
+            scheduler (~google.cloud.pubsub_v1.subscriber.scheduler.Scheduler): An optional
                 *scheduler* to use when executing the callback. This controls
                 how callbacks are executed concurrently.
 


Test patch:
Repository: googleapis/google-cloud-python

Issue:
[Firestore] DocumentReference.path is missing.
DocumentReference.path is missing.



Discussion:
Which variant should this property expose?  The one relative to the database root, or the full `/projects/<project_id>/databases/<client-database-name>/documents/<document-id>/....` one?
The Server API spec doesn't define the semantics of `path` directly, but does use it to define `documentId`:

> The `documentId` property refers to the last component of path pointing to this collection, e.g. projects/project-id/databases/database-id/documents/collectionId/**documentId**.

which makes me think that the `DocumentReference.path` property should be the fully-qualified version, not the database-relative one.
Taken from Node https://github.com/googleapis/nodejs-firestore/blob/5449774d5b02f6ac28ee3ffb3b5f94004c512fef/types/firestore.d.ts#L551
```
/**
     * A string representing the path of the referenced document (relative
     * to the root of the database).
     */
    readonly path: string;
```
The [implementation of `nodejs-firestore`'s `DocumentReference.path`](https://github.com/googleapis/nodejs-firestore/blob/5449774d5b02f6ac28ee3ffb3b5f94004c512fef/dev/src/reference.ts#L162) makes it clear that relative path is what is expected.

Resolving patch:
diff --git a/firestore/google/cloud/firestore_v1beta1/document.py b/firestore/google/cloud/firestore_v1beta1/document.py
--- a/firestore/google/cloud/firestore_v1beta1/document.py
+++ b/firestore/google/cloud/firestore_v1beta1/document.py
@@ -117,6 +117,15 @@ def __ne__(self, other):
         else:
             return NotImplemented
 
+    @property
+    def path(self):
+        """Database-relative for this document.
+
+        Returns:
+            str: The document's relative path.
+        """
+        return "/".join(self._path)
+
     @property
     def _document_path(self):
         """Create and cache the full path for this document.


Test patch:
diff --git a/firestore/tests/unit/test_document.py b/firestore/tests/unit/test_document.py
--- a/firestore/tests/unit/test_document.py
+++ b/firestore/tests/unit/test_document.py
@@ -41,8 +41,10 @@ def test_constructor(self):
             collection_id1, document_id1, collection_id2, document_id2, client=client
         )
         self.assertIs(document._client, client)
-        expected_path = (collection_id1, document_id1, collection_id2, document_id2)
-        self.assertEqual(document._path, expected_path)
+        expected_path = "/".join(
+            (collection_id1, document_id1, collection_id2, document_id2)
+        )
+        self.assertEqual(document.path, expected_path)
 
     def test_constructor_invalid_path(self):
         with self.assertRaises(ValueError):
Repository: googleapis/google-cloud-python

Issue:
fix typo



Discussion:

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: **Please visit <https://cla.developers.google.com/> to sign.**

Once you've signed (or fixed any issues), please reply here (e.g. `I signed it!`) and we'll verify it.

----

#### What to do if you already signed the CLA

##### Individual signers

*   It's possible we don't have your GitHub username or you're using a different email address on your commit. Check [your existing CLA data](https://cla.developers.google.com/clas) and verify that your [email is set on your git commits](https://help.github.com/articles/setting-your-email-in-git/).

##### Corporate signers

*   Your company has a Point of Contact who decides which employees are authorized to participate. Ask your POC to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the Google project maintainer to [go/cla#troubleshoot](http://go/cla#troubleshoot) ([Public version](https://opensource.google.com/docs/cla/#troubleshoot)).
*   The email used to register you as an authorized contributor must be the email used for the Git commit. Check [your existing CLA data](https://cla.developers.google.com/clas) and verify that your [email is set on your git commits](https://help.github.com/articles/setting-your-email-in-git/).
*   The email used to register you as an authorized contributor must also be [attached to your GitHub account](https://github.com/settings/emails).
		

<!-- need_sender_cla -->
Thanks, @pjenvey!  FWIW, a one character typo fix is definitely copyrightable, but I'm not the one to make that call.   @crwilcox, WDYT?
Hi @pjenvey , Thanks for catching this and fixing this. I don't have the authority to override our CLA. So, while this is almost certainly not copyrightable, it would be easier to have you sign the CLA :(. If you are unable to do that I can close this PR and open a bug for the typo.

Resolving patch:
diff --git a/spanner/google/cloud/spanner_v1/param_types.py b/spanner/google/cloud/spanner_v1/param_types.py
--- a/spanner/google/cloud/spanner_v1/param_types.py
+++ b/spanner/google/cloud/spanner_v1/param_types.py
@@ -20,7 +20,7 @@
 # Scalar parameter types
 STRING = type_pb2.Type(code=type_pb2.STRING)
 BYTES = type_pb2.Type(code=type_pb2.BYTES)
-BOOE = type_pb2.Type(code=type_pb2.BOOL)
+BOOL = type_pb2.Type(code=type_pb2.BOOL)
 INT64 = type_pb2.Type(code=type_pb2.INT64)
 FLOAT64 = type_pb2.Type(code=type_pb2.FLOAT64)
 DATE = type_pb2.Type(code=type_pb2.DATE)


Test patch:
Repository: googleapis/google-cloud-python

Issue:
Hard coded metadata endpoint breaks logging under GKE managed Istio
#### Environment details

1. API: GCE / GKE internal metadata endpoint
2. OS: anything running in GKE with [managed istio](https://cloud.google.com/istio/docs/istio-on-gke/overview) enabled.
3. Python version: 3.7.2 (container, no venv)
4. google-cloud-logging version: 1.9.0 (out of date but I double checked on master branch and `metadata` hostname is present there too).

#### Steps to reproduce

(please bear with me, I do get to the point!)

 1. Launch a GKE cluster and tick the managed istio box to enable it.
 2. Add the label `istio-inejction: enabled` to the default namespace to allow istio to control traffic on workloads deployed there.
 3. Launch a container into the namespace which will now have the istio/envoy sidecar automatically added to it. (eg. `kubectl run -i --tty busybox --image=busybox --restart=Never -- sh`)
 4. Attempt to access the hostname `metadata`.  
```
wget http://metadata/computeMetadata/v1/instance/attributes/cluster-name --header "Metadata-Flavor: Google"
Connecting to metadata (169.254.169.254:80)
wget: server returned error: HTTP/1.1 404 Not Found
```

This is the result of Istio's default policy of blocking all outbound requests until they are [whitelisted](https://istio.io/docs/tasks/traffic-management/egress/).

Since istio/istio#10694 will not accept non FQDN's the [hardcoded metadata endpoint in the python logging client](https://github.com/googleapis/google-cloud-python/blob/master/logging/google/cloud/logging/_helpers.py#L24) fails.

This manifests as logs showing up in stackdriver without the expected GCE / GKE annotations of instance name, cluster name, etc.

The approach from other google libraries (eg. googleapis/google-cloud-java#4269 ) is to update to the fully qualified `metadata.google.internal` or just [hit the magic IP address directly](https://github.com/googleapis/google-cloud-go/blob/master/compute/metadata/metadata.go#L39) which Istio has no problems whitelisting.



Discussion:

Resolving patch:
diff --git a/logging/google/cloud/logging/_helpers.py b/logging/google/cloud/logging/_helpers.py
--- a/logging/google/cloud/logging/_helpers.py
+++ b/logging/google/cloud/logging/_helpers.py
@@ -21,7 +21,7 @@
 from google.cloud.logging.entries import StructEntry
 from google.cloud.logging.entries import TextEntry
 
-METADATA_URL = "http://metadata/computeMetadata/v1/"
+METADATA_URL = "http://metadata.google.internal./computeMetadata/v1/"
 METADATA_HEADERS = {"Metadata-Flavor": "Google"}
 
 


Test patch:
Repository: googleapis/google-cloud-python

Issue:
BigQuery: Add `clustering_fields` property to TableListItem
API reference: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/list

The property `clustering.fields[]` now appears in the API results for `list_tables()`. In the `Table` class, this property is exposed as [Table.clustering_fields](https://googleapis.github.io/google-cloud-python/latest/bigquery/generated/google.cloud.bigquery.table.Table.html#google.cloud.bigquery.table.Table.clustering_fields). A similar property needs to appear on TableListItem.

Related: https://github.com/googleapis/google-cloud-python/issues/5117


Discussion:

Resolving patch:
diff --git a/bigquery/google/cloud/bigquery/table.py b/bigquery/google/cloud/bigquery/table.py
--- a/bigquery/google/cloud/bigquery/table.py
+++ b/bigquery/google/cloud/bigquery/table.py
@@ -1021,6 +1021,23 @@ def friendly_name(self):
 
     view_use_legacy_sql = property(_view_use_legacy_sql_getter)
 
+    @property
+    def clustering_fields(self):
+        """Union[List[str], None]: Fields defining clustering for the table
+
+        (Defaults to :data:`None`).
+
+        Clustering fields are immutable after table creation.
+
+        .. note::
+
+           As of 2018-06-29, clustering fields cannot be set on a table
+           which does not also have time partioning defined.
+        """
+        prop = self._properties.get("clustering")
+        if prop is not None:
+            return list(prop.get("fields", ()))
+
     @classmethod
     def from_string(cls, full_table_id):
         """Construct a table from fully-qualified table ID.


Test patch:
diff --git a/bigquery/tests/unit/test_table.py b/bigquery/tests/unit/test_table.py
--- a/bigquery/tests/unit/test_table.py
+++ b/bigquery/tests/unit/test_table.py
@@ -1148,6 +1148,7 @@ def test_ctor(self):
                 "expirationMs": "10000",
             },
             "labels": {"some-stuff": "this-is-a-label"},
+            "clustering": {"fields": ["string"]},
         }
 
         table = self._make_one(resource)
@@ -1170,6 +1171,7 @@ def test_ctor(self):
         self.assertEqual(table.time_partitioning.field, "mycolumn")
         self.assertEqual(table.labels["some-stuff"], "this-is-a-label")
         self.assertIsNone(table.view_use_legacy_sql)
+        self.assertEqual(table.clustering_fields, ["string"])
 
         with warnings.catch_warnings(record=True) as warned:
             self.assertEqual(table.partitioning_type, "DAY")
@@ -1222,6 +1224,7 @@ def test_ctor_missing_properties(self):
         self.assertEqual(table.table_id, "testtable")
         self.assertIsNone(table.created)
         self.assertIsNone(table.expires)
+        self.assertIsNone(table.clustering_fields)
         self.assertIsNone(table.full_table_id)
         self.assertIsNone(table.friendly_name)
         self.assertIsNone(table.table_type)
Repository: googleapis/google-cloud-python

Issue:
ImportError: cannot import name 'ciient_info'
`i != l`:

https://github.com/googleapis/google-cloud-python/blame/a9bcc2755248d41b7610ceff80cd9357ad7fd04a/error_reporting/google/cloud/error_reporting/client.py#L25

Who reports the error reporter?


Discussion:

Resolving patch:
diff --git a/error_reporting/google/cloud/error_reporting/client.py b/error_reporting/google/cloud/error_reporting/client.py
--- a/error_reporting/google/cloud/error_reporting/client.py
+++ b/error_reporting/google/cloud/error_reporting/client.py
@@ -22,7 +22,7 @@
 try:
     from google.cloud.error_reporting._gapic import make_report_error_api
 except ImportError:  # pragma: NO COVER
-    from google.api_core import ciient_info  # noqa
+    from google.api_core import client_info  # noqa
 
     _HAVE_GRPC = False
 else:


Test patch:
Repository: googleapis/google-cloud-python

Issue:
api_core: fix / disable the broken 'pytype' session in 'nox'.
CI is broken for unrelated PRs due to this failure, e.g. see [this Kokoro run](https://source.cloud.google.com/results/invocations/72b52360-5a1b-4f30-9cc3-89847b38e165/targets/cloud-devrel%2Fclient-libraries%2Fgoogle-cloud-python%2Fpresubmit%2Fapi_core/log) for PR #7628.


Discussion:
@rchen152 Is this new failure in our 'pytype' session due to a recent release of pytype, e.g. perhaps containing https://github.com/google/pytype/pull/314?
This looks like more fallout from https://github.com/python/typeshed/commit/e45f443d8530f0dd9f9022720a994f222da6f0fd. Typeshed is representing the return value of functools.partial() as a function rather than a class in order to get better type-checking when the returned partial is used. I'll send a PR to silence the failure (should be as simple as adding `# pytype: disable=wrong-arg-types` at the end of the line that pytype is complaining about).
@rchen152 That is an odd choice for Typeshed to make:  `functools.partial` is most definitely a `type` in both Python 2.7 and 3.7:

```bash
$ python2.7
Python 2.7.14 (default, Oct  4 2017, 16:09:27) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import functools
>>> functools.partial
<type 'functools.partial'>
>>> ^D
$ python3.7
Python 3.7.1 (default, Oct 22 2018, 11:31:38) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import functools
>>> functools.partial
<class 'functools.partial'>
>>> ^D
```

Resolving patch:
diff --git a/api_core/google/api_core/general_helpers.py b/api_core/google/api_core/general_helpers.py
--- a/api_core/google/api_core/general_helpers.py
+++ b/api_core/google/api_core/general_helpers.py
@@ -26,7 +26,8 @@
 
 def wraps(wrapped):
     """A functools.wraps helper that handles partial objects on Python 2."""
-    if isinstance(wrapped, functools.partial):
+    # https://github.com/google/pytype/issues/322
+    if isinstance(wrapped, functools.partial):  # pytype: disable=wrong-arg-types
         return six.wraps(wrapped, assigned=_PARTIAL_VALID_ASSIGNMENTS)
     else:
         return six.wraps(wrapped)


Test patch: