chore(python): use black==22.3.0 (#362)

* chore(python): use black==22.3.0

Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe

* ci: use black 22.3.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index 480226a..87dd006 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -13,4 +13,4 @@
 # limitations under the License.
 docker:
   image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
-  digest: sha256:6162c384d685c5fe22521d3f37f6fc732bf99a085f6d47b677dbcae97fc21392
+  digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe
diff --git a/docs/conf.py b/docs/conf.py
index 09f0c2b..9a80171 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -314,7 +314,13 @@
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    (root_doc, "google-api-core", "google-api-core Documentation", [author], 1,)
+    (
+        root_doc,
+        "google-api-core",
+        "google-api-core Documentation",
+        [author],
+        1,
+    )
 ]
 
 # If true, show URL addresses after external links.
@@ -355,7 +361,10 @@
 intersphinx_mapping = {
     "python": ("https://python.readthedocs.org/en/latest/", None),
     "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
-    "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
+    "google.api_core": (
+        "https://googleapis.dev/python/google-api-core/latest/",
+        None,
+    ),
     "grpc": ("https://grpc.github.io/grpc/python/", None),
     "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
     "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),
diff --git a/google/api_core/datetime_helpers.py b/google/api_core/datetime_helpers.py
index 78268ef..9470863 100644
--- a/google/api_core/datetime_helpers.py
+++ b/google/api_core/datetime_helpers.py
@@ -151,7 +151,7 @@
         micros = 0
     else:
         scale = 9 - len(fraction)
-        nanos = int(fraction) * (10 ** scale)
+        nanos = int(fraction) * (10**scale)
         micros = nanos // 1000
 
     return bare_seconds.replace(microsecond=micros, tzinfo=datetime.timezone.utc)
@@ -245,7 +245,7 @@
             nanos = 0
         else:
             scale = 9 - len(fraction)
-            nanos = int(fraction) * (10 ** scale)
+            nanos = int(fraction) * (10**scale)
         return cls(
             bare.year,
             bare.month,
diff --git a/google/api_core/exceptions.py b/google/api_core/exceptions.py
index 38fe6e7..bd2f856 100644
--- a/google/api_core/exceptions.py
+++ b/google/api_core/exceptions.py
@@ -202,7 +202,7 @@
 
         Returns:
             Sequence[Any]: A list of structured objects from error_details.proto
-       """
+        """
         return list(self._details)
 
     @property
@@ -490,7 +490,9 @@
     error_info = error_info[0] if error_info else None
 
     message = "{method} {url}: {error}".format(
-        method=response.request.method, url=response.request.url, error=error_message,
+        method=response.request.method,
+        url=response.request.url,
+        error=error_message,
     )
 
     exception = from_http_status(
diff --git a/google/api_core/grpc_helpers.py b/google/api_core/grpc_helpers.py
index 594df98..e86ddde 100644
--- a/google/api_core/grpc_helpers.py
+++ b/google/api_core/grpc_helpers.py
@@ -246,7 +246,9 @@
 
     # Create the metadata plugin for inserting the authorization header.
     metadata_plugin = google.auth.transport.grpc.AuthMetadataPlugin(
-        credentials, request, default_host=default_host,
+        credentials,
+        request,
+        default_host=default_host,
     )
 
     # Create a set of grpc.CallCredentials using the metadata plugin.
diff --git a/google/api_core/operations_v1/abstract_operations_client.py b/google/api_core/operations_v1/abstract_operations_client.py
index 631094e..e02bc19 100644
--- a/google/api_core/operations_v1/abstract_operations_client.py
+++ b/google/api_core/operations_v1/abstract_operations_client.py
@@ -49,7 +49,8 @@
     _transport_registry["rest"] = OperationsRestTransport
 
     def get_transport_class(
-        cls, label: Optional[str] = None,
+        cls,
+        label: Optional[str] = None,
     ) -> Type[OperationsTransport]:
         """Returns an appropriate transport class.
 
@@ -165,7 +166,9 @@
         return self._transport
 
     @staticmethod
-    def common_billing_account_path(billing_account: str,) -> str:
+    def common_billing_account_path(
+        billing_account: str,
+    ) -> str:
         """Returns a fully-qualified billing_account string."""
         return "billingAccounts/{billing_account}".format(
             billing_account=billing_account,
@@ -178,9 +181,13 @@
         return m.groupdict() if m else {}
 
     @staticmethod
-    def common_folder_path(folder: str,) -> str:
+    def common_folder_path(
+        folder: str,
+    ) -> str:
         """Returns a fully-qualified folder string."""
-        return "folders/{folder}".format(folder=folder,)
+        return "folders/{folder}".format(
+            folder=folder,
+        )
 
     @staticmethod
     def parse_common_folder_path(path: str) -> Dict[str, str]:
@@ -189,9 +196,13 @@
         return m.groupdict() if m else {}
 
     @staticmethod
-    def common_organization_path(organization: str,) -> str:
+    def common_organization_path(
+        organization: str,
+    ) -> str:
         """Returns a fully-qualified organization string."""
-        return "organizations/{organization}".format(organization=organization,)
+        return "organizations/{organization}".format(
+            organization=organization,
+        )
 
     @staticmethod
     def parse_common_organization_path(path: str) -> Dict[str, str]:
@@ -200,9 +211,13 @@
         return m.groupdict() if m else {}
 
     @staticmethod
-    def common_project_path(project: str,) -> str:
+    def common_project_path(
+        project: str,
+    ) -> str:
         """Returns a fully-qualified project string."""
-        return "projects/{project}".format(project=project,)
+        return "projects/{project}".format(
+            project=project,
+        )
 
     @staticmethod
     def parse_common_project_path(path: str) -> Dict[str, str]:
@@ -211,10 +226,14 @@
         return m.groupdict() if m else {}
 
     @staticmethod
-    def common_location_path(project: str, location: str,) -> str:
+    def common_location_path(
+        project: str,
+        location: str,
+    ) -> str:
         """Returns a fully-qualified location string."""
         return "projects/{project}/locations/{location}".format(
-            project=project, location=location,
+            project=project,
+            location=location,
         )
 
     @staticmethod
@@ -406,12 +425,20 @@
         )
 
         # Send the request.
-        response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+        response = rpc(
+            request,
+            retry=retry,
+            timeout=timeout,
+            metadata=metadata,
+        )
 
         # This method is paged; wrap the response in a pager, which provides
         # an `__iter__` convenience method.
         response = pagers.ListOperationsPager(
-            method=rpc, request=request, response=response, metadata=metadata,
+            method=rpc,
+            request=request,
+            response=response,
+            metadata=metadata,
         )
 
         # Done; return the response.
@@ -459,7 +486,12 @@
         )
 
         # Send the request.
-        response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+        response = rpc(
+            request,
+            retry=retry,
+            timeout=timeout,
+            metadata=metadata,
+        )
 
         # Done; return the response.
         return response
@@ -506,7 +538,10 @@
 
         # Send the request.
         rpc(
-            request, retry=retry, timeout=timeout, metadata=metadata,
+            request,
+            retry=retry,
+            timeout=timeout,
+            metadata=metadata,
         )
 
     def cancel_operation(
@@ -560,5 +595,8 @@
 
         # Send the request.
         rpc(
-            request, retry=retry, timeout=timeout, metadata=metadata,
+            request,
+            retry=retry,
+            timeout=timeout,
+            metadata=metadata,
         )
diff --git a/google/api_core/operations_v1/transports/base.py b/google/api_core/operations_v1/transports/base.py
index 460e646..f907056 100644
--- a/google/api_core/operations_v1/transports/base.py
+++ b/google/api_core/operations_v1/transports/base.py
@@ -183,9 +183,9 @@
     def close(self):
         """Closes resources associated with the transport.
 
-       .. warning::
-            Only call this method if the transport is NOT shared
-            with other clients - this may cause errors in other clients!
+        .. warning::
+             Only call this method if the transport is NOT shared
+             with other clients - this may cause errors in other clients!
         """
         raise NotImplementedError()
 
diff --git a/google/api_core/path_template.py b/google/api_core/path_template.py
index b6284c8..a99a4c8 100644
--- a/google/api_core/path_template.py
+++ b/google/api_core/path_template.py
@@ -239,26 +239,26 @@
 
 def transcode(http_options, **request_kwargs):
     """Transcodes a grpc request pattern into a proper HTTP request following the rules outlined here,
-       https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L44-L312
+    https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L44-L312
 
-        Args:
-            http_options (list(dict)): A list of dicts which consist of these keys,
-                'method'    (str): The http method
-                'uri'       (str): The path template
-                'body'      (str): The body field name (optional)
-                (This is a simplified representation of the proto option `google.api.http`)
+     Args:
+         http_options (list(dict)): A list of dicts which consist of these keys,
+             'method'    (str): The http method
+             'uri'       (str): The path template
+             'body'      (str): The body field name (optional)
+             (This is a simplified representation of the proto option `google.api.http`)
 
-            request_kwargs (dict) : A dict representing the request object
+         request_kwargs (dict) : A dict representing the request object
 
-        Returns:
-            dict: The transcoded request with these keys,
-                'method'        (str)   : The http method
-                'uri'           (str)   : The expanded uri
-                'body'          (dict)  : A dict representing the body (optional)
-                'query_params'  (dict)  : A dict mapping query parameter variables and values
+     Returns:
+         dict: The transcoded request with these keys,
+             'method'        (str)   : The http method
+             'uri'           (str)   : The expanded uri
+             'body'          (dict)  : A dict representing the body (optional)
+             'query_params'  (dict)  : A dict mapping query parameter variables and values
 
-        Raises:
-            ValueError: If the request does not match the given template.
+     Raises:
+         ValueError: If the request does not match the given template.
     """
     for http_option in http_options:
         request = {}
diff --git a/google/api_core/rest_streaming.py b/google/api_core/rest_streaming.py
index 69f5b41..f91381c 100644
--- a/google/api_core/rest_streaming.py
+++ b/google/api_core/rest_streaming.py
@@ -48,8 +48,7 @@
         self._escape_next = False
 
     def cancel(self):
-        """Cancel existing streaming operation.
-        """
+        """Cancel existing streaming operation."""
         self._response.close()
 
     def _process_chunk(self, chunk: str):
diff --git a/noxfile.py b/noxfile.py
index e02a128..c933321 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -21,7 +21,7 @@
 import nox  # pytype: disable=import-error
 
 
-BLACK_VERSION = "black==19.10b0"
+BLACK_VERSION = "black==22.3.0"
 BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
 # Black and flake8 clash on the syntax for ignoring flake8's F401 in this file.
 BLACK_EXCLUDES = ["--exclude", "^/google/api_core/operations_v1/__init__.py"]
@@ -64,7 +64,10 @@
     session.install("flake8", "flake8-import-order", BLACK_VERSION)
     session.install(".")
     session.run(
-        "black", "--check", *BLACK_EXCLUDES, *BLACK_PATHS,
+        "black",
+        "--check",
+        *BLACK_EXCLUDES,
+        *BLACK_PATHS,
     )
     session.run("flake8", "google", "tests")
 
diff --git a/tests/asyncio/gapic/test_method_async.py b/tests/asyncio/gapic/test_method_async.py
index 1410747..11847da 100644
--- a/tests/asyncio/gapic/test_method_async.py
+++ b/tests/asyncio/gapic/test_method_async.py
@@ -162,7 +162,8 @@
     )
 
     result = await wrapped_method(
-        retry=gapic_v1.method_async.DEFAULT, timeout=gapic_v1.method_async.DEFAULT,
+        retry=gapic_v1.method_async.DEFAULT,
+        timeout=gapic_v1.method_async.DEFAULT,
     )
 
     assert result == 42
diff --git a/tests/unit/operations_v1/test_operations_rest_client.py b/tests/unit/operations_v1/test_operations_rest_client.py
index dddf6b7..625539e 100644
--- a/tests/unit/operations_v1/test_operations_rest_client.py
+++ b/tests/unit/operations_v1/test_operations_rest_client.py
@@ -399,7 +399,9 @@
     client_class, transport_class, transport_name
 ):
     # Check the case scopes are provided.
-    options = client_options.ClientOptions(scopes=["1", "2"],)
+    options = client_options.ClientOptions(
+        scopes=["1", "2"],
+    )
     with mock.patch.object(transport_class, "__init__") as patched:
         patched.return_value = None
         client = client_class(client_options=options)
@@ -513,10 +515,12 @@
                 next_page_token="abc",
             ),
             operations_pb2.ListOperationsResponse(
-                operations=[], next_page_token="def",
+                operations=[],
+                next_page_token="def",
             ),
             operations_pb2.ListOperationsResponse(
-                operations=[operations_pb2.Operation()], next_page_token="ghi",
+                operations=[operations_pb2.Operation()],
+                next_page_token="ghi",
             ),
             operations_pb2.ListOperationsResponse(
                 operations=[operations_pb2.Operation(), operations_pb2.Operation()],
@@ -553,7 +557,9 @@
     with mock.patch.object(Session, "request") as req:
         # Designate an appropriate value for the returned response.
         return_value = operations_pb2.Operation(
-            name="operations/sample1", done=True, error=status_pb2.Status(code=411),
+            name="operations/sample1",
+            done=True,
+            error=status_pb2.Status(code=411),
         )
 
         # Wrap the value into a proper Response obj
@@ -679,7 +685,8 @@
     )
     with pytest.raises(ValueError):
         AbstractOperationsClient(
-            credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+            credentials=ga_credentials.AnonymousCredentials(),
+            transport=transport,
         )
 
     # It is an error to provide a credentials file and a transport instance.
@@ -698,7 +705,8 @@
     )
     with pytest.raises(ValueError):
         AbstractOperationsClient(
-            client_options={"scopes": ["1", "2"]}, transport=transport,
+            client_options={"scopes": ["1", "2"]},
+            transport=transport,
         )
 
 
@@ -765,7 +773,8 @@
         Transport.return_value = None
         load_creds.return_value = (ga_credentials.AnonymousCredentials(), None)
         transports.OperationsTransport(
-            credentials_file="credentials.json", quota_project_id="octopus",
+            credentials_file="credentials.json",
+            quota_project_id="octopus",
         )
         load_creds.assert_called_once_with(
             "credentials.json",
@@ -792,7 +801,9 @@
         adc.return_value = (ga_credentials.AnonymousCredentials(), None)
         AbstractOperationsClient()
         adc.assert_called_once_with(
-            scopes=None, default_scopes=(), quota_project_id=None,
+            scopes=None,
+            default_scopes=(),
+            quota_project_id=None,
         )
 
 
@@ -849,7 +860,9 @@
 
 def test_common_folder_path():
     folder = "whelk"
-    expected = "folders/{folder}".format(folder=folder,)
+    expected = "folders/{folder}".format(
+        folder=folder,
+    )
     actual = AbstractOperationsClient.common_folder_path(folder)
     assert expected == actual
 
@@ -867,7 +880,9 @@
 
 def test_common_organization_path():
     organization = "oyster"
-    expected = "organizations/{organization}".format(organization=organization,)
+    expected = "organizations/{organization}".format(
+        organization=organization,
+    )
     actual = AbstractOperationsClient.common_organization_path(organization)
     assert expected == actual
 
@@ -885,7 +900,9 @@
 
 def test_common_project_path():
     project = "cuttlefish"
-    expected = "projects/{project}".format(project=project,)
+    expected = "projects/{project}".format(
+        project=project,
+    )
     actual = AbstractOperationsClient.common_project_path(project)
     assert expected == actual
 
@@ -905,7 +922,8 @@
     project = "winkle"
     location = "nautilus"
     expected = "projects/{project}/locations/{location}".format(
-        project=project, location=location,
+        project=project,
+        location=location,
     )
     actual = AbstractOperationsClient.common_location_path(project, location)
     assert expected == actual
@@ -930,7 +948,8 @@
         transports.OperationsTransport, "_prep_wrapped_messages"
     ) as prep:
         AbstractOperationsClient(
-            credentials=ga_credentials.AnonymousCredentials(), client_info=client_info,
+            credentials=ga_credentials.AnonymousCredentials(),
+            client_info=client_info,
         )
         prep.assert_called_once_with(client_info)
 
@@ -939,6 +958,7 @@
     ) as prep:
         transport_class = AbstractOperationsClient.get_transport_class()
         transport_class(
-            credentials=ga_credentials.AnonymousCredentials(), client_info=client_info,
+            credentials=ga_credentials.AnonymousCredentials(),
+            client_info=client_info,
         )
         prep.assert_called_once_with(client_info)
diff --git a/tests/unit/test_client_options.py b/tests/unit/test_client_options.py
index fbff545..334b8c1 100644
--- a/tests/unit/test_client_options.py
+++ b/tests/unit/test_client_options.py
@@ -98,7 +98,8 @@
 def test_constructor_with_both_api_key_and_credentials_file():
     with pytest.raises(ValueError):
         client_options.ClientOptions(
-            api_key="api-key", credentials_file="path/to/credentials.json",
+            api_key="api-key",
+            credentials_file="path/to/credentials.json",
         )
 
 
diff --git a/tests/unit/test_extended_operation.py b/tests/unit/test_extended_operation.py
index 9521fde..ad62b77 100644
--- a/tests/unit/test_extended_operation.py
+++ b/tests/unit/test_extended_operation.py
@@ -59,7 +59,9 @@
     refresh.responses = client_operations_responses
     cancel = mock.Mock(spec=["__call__"])
     extended_operation_future = extended_operation.ExtendedOperation.make(
-        refresh, cancel, client_operations_responses[0],
+        refresh,
+        cancel,
+        client_operations_responses[0],
     )
 
     return extended_operation_future, refresh, cancel
diff --git a/tests/unit/test_page_iterator.py b/tests/unit/test_page_iterator.py
index a44e998..cf43aed 100644
--- a/tests/unit/test_page_iterator.py
+++ b/tests/unit/test_page_iterator.py
@@ -505,7 +505,8 @@
                 assert list(next(items_iter)) == [
                     dict(name=str(i))
                     for i in range(
-                        ipage * page_size, min((ipage + 1) * page_size, n_results),
+                        ipage * page_size,
+                        min((ipage + 1) * page_size, n_results),
                     )
                 ]
         else:
diff --git a/tests/unit/test_rest_streaming.py b/tests/unit/test_rest_streaming.py
index 4be5958..1b34a04 100644
--- a/tests/unit/test_rest_streaming.py
+++ b/tests/unit/test_rest_streaming.py
@@ -83,7 +83,10 @@
             return x.decode("utf-8")
 
     def __init__(
-        self, responses: List[proto.Message], response_cls, random_split=False,
+        self,
+        responses: List[proto.Message],
+        response_cls,
+        random_split=False,
     ):
         super().__init__()
         self._responses = responses
@@ -105,7 +108,8 @@
 
     def iter_content(self, *args, **kwargs):
         return self._ResponseItr(
-            self._parse_responses(self._responses), random_split=self._random_split,
+            self._parse_responses(self._responses),
+            random_split=self._random_split,
         )