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

Issue:
Storage: Document public bucket property
 **Is your feature request related to a problem? Please describe.**

I have a Blob object and I want to know what Bucket it belongs to.

 **Describe the solution you'd like**

Convert `Blob.bucket` into a real `@property` so that it can be documented. It should be a read-only property, as the bucket it part of the identifier for the blob, so seems best if it's immutable.

 **Describe alternatives you've considered**

You could put `bucket` in the docstring for the `Blob` class, but this is less discoverable than a true property.

 **Additional context**

Discovered in review of https://github.com/googleapis/google-cloud-python/pull/8424.



Discussion:

Resolving patch:
diff --git a/storage/google/cloud/storage/blob.py b/storage/google/cloud/storage/blob.py
--- a/storage/google/cloud/storage/blob.py
+++ b/storage/google/cloud/storage/blob.py
@@ -172,7 +172,7 @@ def __init__(
         super(Blob, self).__init__(name=name)
 
         self.chunk_size = chunk_size  # Check that setter accepts value.
-        self.bucket = bucket
+        self._bucket = bucket
         self._acl = ObjectACL(self)
         if encryption_key is not None and kms_key_name is not None:
             raise ValueError(
@@ -187,6 +187,15 @@ def __init__(
         if generation is not None:
             self._properties["generation"] = generation
 
+    @property
+    def bucket(self):
+        """Bucket which contains the object.
+
+        :rtype: :class:`~google.cloud.storage.bucket.Bucket`
+        :returns: The object's bucket.
+        """
+        return self._bucket
+
     @property
     def chunk_size(self):
         """Get the blob's default chunk size.


Test patch:
diff --git a/storage/tests/unit/test_blob.py b/storage/tests/unit/test_blob.py
--- a/storage/tests/unit/test_blob.py
+++ b/storage/tests/unit/test_blob.py
@@ -274,6 +274,14 @@ def test_path_with_non_ascii(self):
         blob = self._make_one(blob_name, bucket=bucket)
         self.assertEqual(blob.path, "/b/name/o/Caf%C3%A9")
 
+    def test_bucket_readonly_property(self):
+        blob_name = "BLOB"
+        bucket = _Bucket()
+        other = _Bucket()
+        blob = self._make_one(blob_name, bucket=bucket)
+        with self.assertRaises(AttributeError):
+            blob.bucket = other
+
     def test_client(self):
         blob_name = "BLOB"
         bucket = _Bucket()
Repository: googleapis/google-cloud-python

Issue:
PubSub: Release the first GA version
If no major issues are discovered during the ongoing bake-in period, the PubSub client should be released as GA.

Releasing a new version is done with the help of [releasetool](https://github.com/googleapis/releasetool). Prior to the GA release, the following must be done:

- Go through the checklist from the internal GA release doc, make sure everything is in order.
- Changes in the client lib files:
    - Update PubSub Python lib README to indicate semver just like Java library has
    - Update beta tag in PubSub Python lib README
    - Update beta tag in Python libs root
    - Set the release level to `ga` in `.repo-metadata.json`
    - Change beta label in code samples in clients page in Google Cloud website
    - Add to release notes (talk to @kir-titievsky)
    - Update any documentation on Cloudsite





Discussion:
@busunkim96 Is the list of all required file changes complete and accurate?

Please proof-read it, thanks!
@plamut Looks good to me!

Resolving patch:
diff --git a/pubsub/setup.py b/pubsub/setup.py
--- a/pubsub/setup.py
+++ b/pubsub/setup.py
@@ -22,12 +22,12 @@
 
 name = "google-cloud-pubsub"
 description = "Google Cloud Pub/Sub API client library"
-version = "0.45.0"
+version = "1.0.0"
 # Should be one of:
 # 'Development Status :: 3 - Alpha'
 # 'Development Status :: 4 - Beta'
 # 'Development Status :: 5 - Production/Stable'
-release_status = "Development Status :: 4 - Beta"
+release_status = "Development Status :: 5 - Production/Stable"
 dependencies = [
     "google-api-core[grpc] >= 1.14.0, < 2.0.0dev",
     "grpc-google-iam-v1 >= 0.12.3, < 0.13dev",


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

Issue:
Storage: Bad URL in Error Message from 'ensure_signed_credentials".
https://github.com/googleapis/google-cloud-python/blob/5a81ea3b1a2de36e8f2cc33d8cca6cc82ff4f994/storage/google/cloud/storage/_signing.py#L34

The URL shown in the AttributionError that is thrown from `ensure_signed_credentials` when the credentials are unsigned is invalid and takes you to a "Sorry this page does not exist yet." page.

Here is the URL from the attribution error for easy reference:
https://google-cloud-python.readthedocs.io/en/latest/core/auth.html?highlight=authentication#setting-up-a-service-account


Discussion:
The [correct URL](https://googleapis.dev/python/google-api-core/latest/auth.html#setting-up-a-service-account).

Resolving patch:
diff --git a/storage/google/cloud/storage/_signing.py b/storage/google/cloud/storage/_signing.py
--- a/storage/google/cloud/storage/_signing.py
+++ b/storage/google/cloud/storage/_signing.py
@@ -30,6 +30,11 @@
 MULTIPLE_SPACES_RE = r"\s+"
 MULTIPLE_SPACES = re.compile(MULTIPLE_SPACES_RE)
 
+SERVICE_ACCOUNT_URL = (
+    "https://googleapis.dev/python/google-api-core/latest/"
+    "auth.html#setting-up-a-service-account"
+)
+
 
 def ensure_signed_credentials(credentials):
     """Raise AttributeError if the credentials are unsigned.
@@ -42,16 +47,11 @@ def ensure_signed_credentials(credentials):
             of :class:`google.auth.credentials.Signing`.
     """
     if not isinstance(credentials, google.auth.credentials.Signing):
-        auth_uri = (
-            "https://google-cloud-python.readthedocs.io/en/latest/"
-            "core/auth.html?highlight=authentication#setting-up-"
-            "a-service-account"
-        )
         raise AttributeError(
             "you need a private key to sign credentials."
-            "the credentials you are currently using %s "
-            "just contains a token. see %s for more "
-            "details." % (type(credentials), auth_uri)
+            "the credentials you are currently using {} "
+            "just contains a token. see {} for more "
+            "details.".format(type(credentials), SERVICE_ACCOUNT_URL)
         )
 
 


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

Issue:
BigQuery: DB-API is very slow
DB-API is very slow.

google-cloud-bigquery version: 1.19.0

```python
from datetime import datetime

from google.cloud import bigquery
from google.cloud.bigquery import dbapi

client = bigquery.Client()
conn = dbapi.Connection(client)
curr = conn.cursor()

start = datetime.now()
QUERY = """SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` LIMIT 100"""
query_job = client.query(QUERY)
query_job.result()
print('API', datetime.now() - start)

start = datetime.now()
curr.execute(QUERY)
result = curr.fetchall()
print('DB-API', datetime.now() - start)
```
Output
```
API 0:00:01.623182
DB-API 0:01:36.157141
```



Discussion:
Peter, can you look into this? 1 minute versus 1 second is quite the difference!

I don't know why this would be the case, as the DB-API should be creating a QueryJob behind the scenes, but maybe there's something we're doing wrong to wait for results (such as sleeping between requests or something)?
This is indeed quite a difference, will check. I confirm that the issue is reproducible.

**Update:** The reason is that results are requested one at a time, because the page size is set to 1, meaning that 100 requests are made to the backend.

Resolving patch:
diff --git a/bigquery/google/cloud/bigquery/dbapi/cursor.py b/bigquery/google/cloud/bigquery/dbapi/cursor.py
--- a/bigquery/google/cloud/bigquery/dbapi/cursor.py
+++ b/bigquery/google/cloud/bigquery/dbapi/cursor.py
@@ -61,8 +61,10 @@ def __init__(self, connection):
         # cannot be determined by the interface.
         self.rowcount = -1
         # Per PEP 249: The arraysize attribute defaults to 1, meaning to fetch
-        # a single row at a time.
-        self.arraysize = 1
+        # a single row at a time. However, we deviate from that, and set the
+        # default to None, allowing the backend to automatically determine the
+        # most appropriate size.
+        self.arraysize = None
         self._query_data = None
         self._query_job = None
 
@@ -241,7 +243,8 @@ def fetchmany(self, size=None):
         :type size: int
         :param size:
             (Optional) Maximum number of rows to return. Defaults to the
-            ``arraysize`` property value.
+            ``arraysize`` property value. If ``arraysize`` is not set, it
+            defaults to ``1``.
 
         :rtype: List[tuple]
         :returns: A list of rows.
@@ -249,7 +252,10 @@ def fetchmany(self, size=None):
             if called before ``execute()``.
         """
         if size is None:
-            size = self.arraysize
+            # Since self.arraysize can be None (a deviation from PEP 249),
+            # use an actual PEP 249 default of 1 in such case (*some* number
+            # is needed here).
+            size = self.arraysize if self.arraysize else 1
 
         self._try_fetch(size=size)
         rows = []


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

Issue:
PubSub: Publisher Futures result TimeOutError documentation is not matched with the code
PubSub: Publisher Futures Result TimeOutError
Environment: Python 3.6.9

* [Documentation](https://googleapis.dev/python/pubsub/latest/publisher/api/futures.html): `TimeoutError – If the request times out.` The link is point to `https://python.readthedocs.io/en/latest/library/exceptions.html#TimeoutError`
* [Code](https://github.com/googleapis/google-cloud-python/blob/master/pubsub/google/cloud/pubsub_v1/exceptions.py): The TimeOutError used is `concurrent.futures.TimeoutError`


Discussion:
@michael-wilg-8 Thanks for that!

Resolving patch:
diff --git a/pubsub/google/cloud/pubsub_v1/futures.py b/pubsub/google/cloud/pubsub_v1/futures.py
--- a/pubsub/google/cloud/pubsub_v1/futures.py
+++ b/pubsub/google/cloud/pubsub_v1/futures.py
@@ -94,7 +94,7 @@ def result(self, timeout=None):
                 times out and raises TimeoutError.
 
         Raises:
-            ~.pubsub_v1.TimeoutError: If the request times out.
+            concurrent.futures.TimeoutError: If the request times out.
             Exception: For undefined exceptions in the underlying
                 call execution.
         """
@@ -114,7 +114,7 @@ def exception(self, timeout=None):
                 times out and raises TimeoutError.
 
         Raises:
-            TimeoutError: If the request times out.
+            concurrent.futures.TimeoutError: If the request times out.
 
         Returns:
             Exception: The exception raised by the call, if any.
diff --git a/pubsub/google/cloud/pubsub_v1/publisher/futures.py b/pubsub/google/cloud/pubsub_v1/publisher/futures.py
--- a/pubsub/google/cloud/pubsub_v1/publisher/futures.py
+++ b/pubsub/google/cloud/pubsub_v1/publisher/futures.py
@@ -39,7 +39,7 @@ def result(self, timeout=None):
             str: The message ID.
 
         Raises:
-            ~.pubsub_v1.TimeoutError: If the request times out.
+            concurrent.futures.TimeoutError: If the request times out.
             Exception: For undefined exceptions in the underlying
                 call execution.
         """


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

Issue:
BigQuery: Run lint and black on samples/ directory
We should make sure our code samples are linted, too.

I think we'll get a few flake8 errors for unused imports. Since we always want to show `from google.cloud import bigquery`, we can make those lines into comments when they are otherwise unnecessary.

Also, I forget if we use the templated files for `noxfile.py`. This update may need to be made at the synthtool templates repo if so.


Discussion:
It appears that snippets are already linted. Black already runs on them, while the flake8 check needs to be extended to the `docs/samples` directory:

```patch
diff --git a/bigquery/noxfile.py b/bigquery/noxfile.py
index 37611a5ce29..fc44db1c120 100644
--- a/bigquery/noxfile.py
+++ b/bigquery/noxfile.py
@@ -150,6 +150,7 @@ def lint(session):
     session.install("-e", ".")
     session.run("flake8", os.path.join("google", "cloud", "bigquery"))
     session.run("flake8", "tests")
+    session.run("flake8", os.path.join("docs", "samples"))
     session.run("flake8", os.path.join("docs", "snippets.py"))
     session.run("black", "--check", *BLACK_PATHS)
```

Noxfiles are auto-generated AFAIK, yes, thus the change needs to be made in the synthool repo (or wherever the files are generated).
FYI: the `noxfile.py` template lives here: https://github.com/googleapis/synthtool/blob/master/synthtool/gcp/templates/python_library/noxfile.py.j2

Resolving patch:
diff --git a/bigquery/noxfile.py b/bigquery/noxfile.py
--- a/bigquery/noxfile.py
+++ b/bigquery/noxfile.py
@@ -150,6 +150,7 @@ def lint(session):
     session.install("-e", ".")
     session.run("flake8", os.path.join("google", "cloud", "bigquery"))
     session.run("flake8", "tests")
+    session.run("flake8", os.path.join("docs", "samples"))
     session.run("flake8", os.path.join("docs", "snippets.py"))
     session.run("black", "--check", *BLACK_PATHS)
 


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

Issue:
Storage: download_as_string documentation says that it downloads a string, instead of bytes
For google-cloud-storage, in the documentation for [`download_as_string()`](https://github.com/googleapis/google-cloud-python/blob/53d692517345979b2b4621872d76c1184c987b92/storage/google/cloud/storage/blob.py#L714) method on blobs, it says [on line 715](https://github.com/googleapis/google-cloud-python/blob/53d692517345979b2b4621872d76c1184c987b92/storage/google/cloud/storage/blob.py#L715): 

        """Download the contents of this blob as a string.

This is not true. The confusingly named method downloads the content as bytes, not string.

On [line 731](https://github.com/googleapis/google-cloud-python/blob/53d692517345979b2b4621872d76c1184c987b92/storage/google/cloud/storage/blob.py#L731), the return type is correctly declared as bytes, but reading the documentation, you are still presented with conflicting information.



Discussion:
@tseaver is it ok to change method's name ,Please suggest.
@HemangChothani We *cannot* change the method's name:  that would be a breaking change.  Note that we chose that method name explicitly for compatibility with the API of the AWS / S3 `boto` library.

We *can* update its docstring to indicate its actual semantics.

Resolving patch:
diff --git a/storage/docs/snippets.py b/storage/docs/snippets.py
--- a/storage/docs/snippets.py
+++ b/storage/docs/snippets.py
@@ -39,7 +39,7 @@ def storage_get_started(client, to_delete):
     bucket = client.get_bucket("bucket-id-here")
     # Then do other things...
     blob = bucket.get_blob("/remote/path/to/file.txt")
-    assert blob.download_as_string() == "My old contents!"
+    assert blob.download_as_string() == b"My old contents!"
     blob.upload_from_string("New contents!")
     blob2 = bucket.blob("/remote/path/storage.txt")
     blob2.upload_from_filename(filename="/local/path.txt")
diff --git a/storage/google/cloud/storage/blob.py b/storage/google/cloud/storage/blob.py
--- a/storage/google/cloud/storage/blob.py
+++ b/storage/google/cloud/storage/blob.py
@@ -712,7 +712,7 @@ def download_to_filename(self, filename, client=None, start=None, end=None):
             os.utime(file_obj.name, (mtime, mtime))
 
     def download_as_string(self, client=None, start=None, end=None):
-        """Download the contents of this blob as a string.
+        """Download the contents of this blob as a bytes object.
 
         If :attr:`user_project` is set on the bucket, bills the API request
         to that project.


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

Issue:
BigQuery: Remove duplicate test dependencies from nox session configuration
The `system` and `snippets` nox session unnecessarily install `test_utils` twice, and this redundancy should be removed.


Discussion:

Resolving patch:
diff --git a/bigquery/noxfile.py b/bigquery/noxfile.py
--- a/bigquery/noxfile.py
+++ b/bigquery/noxfile.py
@@ -20,11 +20,7 @@
 import nox
 
 
-LOCAL_DEPS = (
-    os.path.join("..", "api_core[grpc]"),
-    os.path.join("..", "core"),
-    os.path.join("..", "test_utils"),
-)
+LOCAL_DEPS = (os.path.join("..", "api_core[grpc]"), os.path.join("..", "core"))
 
 BLACK_PATHS = ("docs", "google", "samples", "tests", "noxfile.py", "setup.py")
 
@@ -42,6 +38,7 @@ def default(session):
     for local_dep in LOCAL_DEPS:
         session.install("-e", local_dep)
 
+    session.install("-e", os.path.join("..", "test_utils"))
     dev_install = ".[all]"
     session.install("-e", dev_install)
 


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

Issue:
Release google-cloud-storage 
Hi @tseaver, could you help cut a release for google-cloud-storage?

cc: @JesseLovelace 


Discussion:

Resolving patch:
diff --git a/storage/setup.py b/storage/setup.py
--- a/storage/setup.py
+++ b/storage/setup.py
@@ -22,7 +22,7 @@
 
 name = "google-cloud-storage"
 description = "Google Cloud Storage API client library"
-version = "1.21.0"
+version = "1.22.0"
 # Should be one of:
 # 'Development Status :: 3 - Alpha'
 # 'Development Status :: 4 - Beta'


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

Issue:
BigQuery: Valid `google-resumable-media` versions conflict with Cloud Storage
It looks like #9572 introduced a dependency conflict for `google-resumable-media` between the latest `google-cloud-storage` and `google-cloud-bigquery` releases.

#### Environment details

1. Python 3.7

#### Steps to reproduce

1. `pip install google-cloud-storage` (latest release is `1.23.0`)
2.`pip install google-cloud-bigquery` (latest release is `1.21.0`)
3. Try to import both libraries in the same python 

#### Issue

Today, `google-cloud-storage 1.23.0` was released. It depends on `google-resumable-media >= 0.5.0, < 0.6dev`. The current `google-cloud-bigquery` version, depends on `google-resumable-media >= 0.3.1, != 0.4.0, < 0.5.0dev`

Therefore, the `setup.py` files for these two libraries will 2nd level dependency conflict when you attempt to `pip install`.

This can be fixed by releasing a new `google-cloud-bigquery` version. (to pick up the changes in  #9572)


Discussion:
@tswast Are we at a good spot to release a new version of `google-cloud-bigquery`?
@daniel-humu Thanks for the report!

Resolving patch:
diff --git a/bigquery/setup.py b/bigquery/setup.py
--- a/bigquery/setup.py
+++ b/bigquery/setup.py
@@ -22,7 +22,7 @@
 
 name = "google-cloud-bigquery"
 description = "Google BigQuery API client library"
-version = "1.21.0"
+version = "1.22.0"
 # Should be one of:
 # 'Development Status :: 3 - Alpha'
 # 'Development Status :: 4 - Beta'


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

Issue:
AutoML Tables: Passing client_info produces a a TypeError

#### Environment details

1. Linux.
2. python 3.7
3. Latest google-cloud-python master branch

#### Steps to reproduce

  1. Initializing the automl tables client with a client_info parameter throws a TypeError due to it being passed twice to the underlying clients.

#### Code example
client = automl_v1beta1.TablesClient(client_info=client_info)

A more thorough example in this PR (where we have to make an exception of setting the ClientInfo due to the error): https://github.com/Kaggle/docker-python/pull/671/files.

#### Stack trace
```
TypeError: type object got multiple values for keyword argument 'client_info'.
```

It should be a pretty easy fix, putting together the PR now :) 



Discussion:

Resolving patch:
diff --git a/automl/google/cloud/automl_v1beta1/tables/tables_client.py b/automl/google/cloud/automl_v1beta1/tables/tables_client.py
--- a/automl/google/cloud/automl_v1beta1/tables/tables_client.py
+++ b/automl/google/cloud/automl_v1beta1/tables/tables_client.py
@@ -104,6 +104,7 @@ def __init__(
         else:
             client_info_.user_agent = user_agent
             client_info_.gapic_version = version
+        kwargs.pop("client_info", None)
 
         if client is None:
             self.auto_ml_client = gapic.auto_ml_client.AutoMlClient(


Test patch:
diff --git a/automl/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py b/automl/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py
--- a/automl/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py
+++ b/automl/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py
@@ -1424,3 +1424,14 @@ def test_prediction_client_credentials(self):
         _, prediction_client_kwargs = MockPredictionClient.call_args
         assert "credentials" in prediction_client_kwargs
         assert prediction_client_kwargs["credentials"] == credentials_mock
+
+    def test_prediction_client_client_info(self):
+        client_info_mock = mock.Mock()
+        patch_prediction_client = mock.patch(
+            "google.cloud.automl_v1beta1.gapic.prediction_service_client.PredictionServiceClient"
+        )
+        with patch_prediction_client as MockPredictionClient:
+            client = automl_v1beta1.TablesClient(client_info=client_info_mock)
+        _, prediction_client_kwargs = MockPredictionClient.call_args
+        assert "client_info" in prediction_client_kwargs
+        assert prediction_client_kwargs["client_info"] == client_info_mock
Repository: googleapis/google-cloud-python

Issue:
Bigquery: Missing Entity Type when reading dataset.access_entries
When running the following code:

```python
from google.cloud import bigquery
gbq_client = bigquery.Client(project='project-name')
dataset_ref = gbq_client.dataset(dataset_id='dataset1', project='project-name')
dataset = gbq_client.get_dataset(dataset_ref=dataset_ref)
print(len(dataset.access_entries))
```

the following error will happen about 25% of the time:

```python
Traceback (most recent call last):
  File "iam.py", line 5, in <module>
    print(len(dataset.access_entries))
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery/dataset.py", line 376, in access_entries
    return [AccessEntry.from_api_repr(entry) for entry in entries]
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery/dataset.py", line 376, in <listcomp>
    return [AccessEntry.from_api_repr(entry) for entry in entries]
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery/dataset.py", line 183, in from_api_repr
    return cls(role, entity_type, entity_id)
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery/dataset.py", line 115, in __init__
    raise ValueError(message)
ValueError: Entity type 'iamMember' not among: domain, groupByEmail, specialGroup, userByEmail, view
```

It seems the Google API is returning a new 'iamMember' entity type that is not in the hard coded list of allowed entity types in [dataset.py](https://github.com/googleapis/google-cloud-python/blob/master/bigquery/google/cloud/bigquery/dataset.py)


Discussion:
We're seeing this too, and when we do the entity_id is something like:
`deleted:user:name@example.com?uid=123456789012345678901`

Is there a work around?
```python
# Nasty monkeypatch to work around
# https://github.com/googleapis/google-cloud-python/issues/9963
AccessEntry.ENTITY_TYPES = frozenset(set(AccessEntry.ENTITY_TYPES) | {"iamMember"})
```
seems to work

Resolving patch:
diff --git a/bigquery/google/cloud/bigquery/dataset.py b/bigquery/google/cloud/bigquery/dataset.py
--- a/bigquery/google/cloud/bigquery/dataset.py
+++ b/bigquery/google/cloud/bigquery/dataset.py
@@ -123,7 +123,7 @@ class AccessEntry(object):
     """
 
     ENTITY_TYPES = frozenset(
-        ["userByEmail", "groupByEmail", "domain", "specialGroup", "view"]
+        ["userByEmail", "groupByEmail", "domain", "specialGroup", "view", "iamMember"]
     )
     """Allowed entity types."""
 


Test patch: