diff --git a/docs/conf.py b/docs/conf.py index 899dac0e7..fb9f1ca32 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -337,7 +337,7 @@ intersphinx_mapping = { "python": ("http://python.readthedocs.org/en/latest/", None), "google-auth": ("https://google-auth.readthedocs.io/en/stable", 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.io/grpc/python/", None), } diff --git a/google/cloud/pubsub.py b/google/cloud/pubsub.py index e7006048b..3dc5fea84 100644 --- a/google/cloud/pubsub.py +++ b/google/cloud/pubsub.py @@ -22,4 +22,8 @@ from google.cloud.pubsub_v1 import types -__all__ = ("types", "PublisherClient", "SubscriberClient") +__all__ = ( + "types", + "PublisherClient", + "SubscriberClient", +) diff --git a/google/cloud/pubsub_v1/gapic/publisher_client.py b/google/cloud/pubsub_v1/gapic/publisher_client.py index 6a60d775b..e8853d841 100644 --- a/google/cloud/pubsub_v1/gapic/publisher_client.py +++ b/google/cloud/pubsub_v1/gapic/publisher_client.py @@ -47,7 +47,7 @@ from google.protobuf import field_mask_pb2 -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-pubsub").version +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-pubsub",).version # TODO: remove conditional import after Python 2 support is dropped @@ -116,7 +116,7 @@ def from_service_account_file(cls, filename, *args, **kwargs): def project_path(cls, project): """Return a fully-qualified project string.""" return google.api_core.path_template.expand( - "projects/{project}", project=project + "projects/{project}", project=project, ) @classmethod @@ -132,7 +132,7 @@ def subscription_path(cls, project, subscription): def topic_path(cls, project, topic): """Return a fully-qualified topic string.""" return google.api_core.path_template.expand( - "projects/{project}/topics/{topic}", project=project, topic=topic + "projects/{project}/topics/{topic}", project=project, topic=topic, ) def __init__( @@ -219,12 +219,12 @@ def __init__( self.transport = transport else: self.transport = publisher_grpc_transport.PublisherGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials + address=api_endpoint, channel=channel, credentials=credentials, ) if client_info is None: client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION + gapic_version=_GAPIC_LIBRARY_VERSION, ) else: client_info.gapic_version = _GAPIC_LIBRARY_VERSION @@ -235,7 +235,7 @@ def __init__( # (Ordinarily, these are the defaults specified in the `*_config.py` # file next to this one.) self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] + client_config["interfaces"][self._INTERFACE_NAME], ) # Save a dictionary of cached API call functions. @@ -411,7 +411,7 @@ def update_topic( client_info=self._client_info, ) - request = pubsub_pb2.UpdateTopicRequest(topic=topic, update_mask=update_mask) + request = pubsub_pb2.UpdateTopicRequest(topic=topic, update_mask=update_mask,) if metadata is None: metadata = [] metadata = list(metadata) @@ -490,7 +490,7 @@ def publish( client_info=self._client_info, ) - request = pubsub_pb2.PublishRequest(topic=topic, messages=messages) + request = pubsub_pb2.PublishRequest(topic=topic, messages=messages,) if metadata is None: metadata = [] metadata = list(metadata) @@ -560,7 +560,7 @@ def get_topic( client_info=self._client_info, ) - request = pubsub_pb2.GetTopicRequest(topic=topic) + request = pubsub_pb2.GetTopicRequest(topic=topic,) if metadata is None: metadata = [] metadata = list(metadata) @@ -651,7 +651,7 @@ def list_topics( client_info=self._client_info, ) - request = pubsub_pb2.ListTopicsRequest(project=project, page_size=page_size) + request = pubsub_pb2.ListTopicsRequest(project=project, page_size=page_size,) if metadata is None: metadata = [] metadata = list(metadata) @@ -754,7 +754,7 @@ def list_topic_subscriptions( ) request = pubsub_pb2.ListTopicSubscriptionsRequest( - topic=topic, page_size=page_size + topic=topic, page_size=page_size, ) if metadata is None: metadata = [] @@ -862,7 +862,9 @@ def list_topic_snapshots( client_info=self._client_info, ) - request = pubsub_pb2.ListTopicSnapshotsRequest(topic=topic, page_size=page_size) + request = pubsub_pb2.ListTopicSnapshotsRequest( + topic=topic, page_size=page_size, + ) if metadata is None: metadata = [] metadata = list(metadata) @@ -945,7 +947,7 @@ def delete_topic( client_info=self._client_info, ) - request = pubsub_pb2.DeleteTopicRequest(topic=topic) + request = pubsub_pb2.DeleteTopicRequest(topic=topic,) if metadata is None: metadata = [] metadata = list(metadata) @@ -1031,7 +1033,7 @@ def set_iam_policy( client_info=self._client_info, ) - request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy) + request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy,) if metadata is None: metadata = [] metadata = list(metadata) @@ -1110,7 +1112,7 @@ def get_iam_policy( ) request = iam_policy_pb2.GetIamPolicyRequest( - resource=resource, options=options_ + resource=resource, options=options_, ) if metadata is None: metadata = [] @@ -1197,7 +1199,7 @@ def test_iam_permissions( ) request = iam_policy_pb2.TestIamPermissionsRequest( - resource=resource, permissions=permissions + resource=resource, permissions=permissions, ) if metadata is None: metadata = [] @@ -1271,7 +1273,7 @@ def detach_subscription( client_info=self._client_info, ) - request = pubsub_pb2.DetachSubscriptionRequest(subscription=subscription) + request = pubsub_pb2.DetachSubscriptionRequest(subscription=subscription,) if metadata is None: metadata = [] metadata = list(metadata) diff --git a/google/cloud/pubsub_v1/gapic/subscriber_client.py b/google/cloud/pubsub_v1/gapic/subscriber_client.py index 12c2a780d..4d1d9111d 100644 --- a/google/cloud/pubsub_v1/gapic/subscriber_client.py +++ b/google/cloud/pubsub_v1/gapic/subscriber_client.py @@ -46,7 +46,7 @@ from google.protobuf import timestamp_pb2 -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-pubsub").version +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-pubsub",).version class SubscriberClient(object): @@ -94,7 +94,7 @@ def from_service_account_file(cls, filename, *args, **kwargs): def project_path(cls, project): """Return a fully-qualified project string.""" return google.api_core.path_template.expand( - "projects/{project}", project=project + "projects/{project}", project=project, ) @classmethod @@ -119,7 +119,7 @@ def subscription_path(cls, project, subscription): def topic_path(cls, project, topic): """Return a fully-qualified topic string.""" return google.api_core.path_template.expand( - "projects/{project}/topics/{topic}", project=project, topic=topic + "projects/{project}/topics/{topic}", project=project, topic=topic, ) def __init__( @@ -209,12 +209,12 @@ def __init__( self.transport = transport else: self.transport = subscriber_grpc_transport.SubscriberGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials + address=api_endpoint, channel=channel, credentials=credentials, ) if client_info is None: client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION + gapic_version=_GAPIC_LIBRARY_VERSION, ) else: client_info.gapic_version = _GAPIC_LIBRARY_VERSION @@ -225,7 +225,7 @@ def __init__( # (Ordinarily, these are the defaults specified in the `*_config.py` # file next to this one.) self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] + client_config["interfaces"][self._INTERFACE_NAME], ) # Save a dictionary of cached API call functions. @@ -490,7 +490,7 @@ def get_subscription( client_info=self._client_info, ) - request = pubsub_pb2.GetSubscriptionRequest(subscription=subscription) + request = pubsub_pb2.GetSubscriptionRequest(subscription=subscription,) if metadata is None: metadata = [] metadata = list(metadata) @@ -578,7 +578,7 @@ def update_subscription( ) request = pubsub_pb2.UpdateSubscriptionRequest( - subscription=subscription, update_mask=update_mask + subscription=subscription, update_mask=update_mask, ) if metadata is None: metadata = [] @@ -671,7 +671,7 @@ def list_subscriptions( ) request = pubsub_pb2.ListSubscriptionsRequest( - project=project, page_size=page_size + project=project, page_size=page_size, ) if metadata is None: metadata = [] @@ -755,7 +755,7 @@ def delete_subscription( client_info=self._client_info, ) - request = pubsub_pb2.DeleteSubscriptionRequest(subscription=subscription) + request = pubsub_pb2.DeleteSubscriptionRequest(subscription=subscription,) if metadata is None: metadata = [] metadata = list(metadata) @@ -829,7 +829,7 @@ def get_snapshot( client_info=self._client_info, ) - request = pubsub_pb2.GetSnapshotRequest(snapshot=snapshot) + request = pubsub_pb2.GetSnapshotRequest(snapshot=snapshot,) if metadata is None: metadata = [] metadata = list(metadata) @@ -1002,7 +1002,7 @@ def acknowledge( ) request = pubsub_pb2.AcknowledgeRequest( - subscription=subscription, ack_ids=ack_ids + subscription=subscription, ack_ids=ack_ids, ) if metadata is None: metadata = [] @@ -1253,7 +1253,7 @@ def modify_push_config( ) request = pubsub_pb2.ModifyPushConfigRequest( - subscription=subscription, push_config=push_config + subscription=subscription, push_config=push_config, ) if metadata is None: metadata = [] @@ -1350,7 +1350,7 @@ def list_snapshots( client_info=self._client_info, ) - request = pubsub_pb2.ListSnapshotsRequest(project=project, page_size=page_size) + request = pubsub_pb2.ListSnapshotsRequest(project=project, page_size=page_size,) if metadata is None: metadata = [] metadata = list(metadata) @@ -1462,7 +1462,7 @@ def create_snapshot( ) request = pubsub_pb2.CreateSnapshotRequest( - name=name, subscription=subscription, labels=labels + name=name, subscription=subscription, labels=labels, ) if metadata is None: metadata = [] @@ -1556,7 +1556,7 @@ def update_snapshot( ) request = pubsub_pb2.UpdateSnapshotRequest( - snapshot=snapshot, update_mask=update_mask + snapshot=snapshot, update_mask=update_mask, ) if metadata is None: metadata = [] @@ -1633,7 +1633,7 @@ def delete_snapshot( client_info=self._client_info, ) - request = pubsub_pb2.DeleteSnapshotRequest(snapshot=snapshot) + request = pubsub_pb2.DeleteSnapshotRequest(snapshot=snapshot,) if metadata is None: metadata = [] metadata = list(metadata) @@ -1727,10 +1727,12 @@ def seek( # Sanity check: We have some fields which are mutually exclusive; # raise ValueError if more than one is sent. - google.api_core.protobuf_helpers.check_oneof(time=time, snapshot=snapshot) + google.api_core.protobuf_helpers.check_oneof( + time=time, snapshot=snapshot, + ) request = pubsub_pb2.SeekRequest( - subscription=subscription, time=time, snapshot=snapshot + subscription=subscription, time=time, snapshot=snapshot, ) if metadata is None: metadata = [] @@ -1817,7 +1819,7 @@ def set_iam_policy( client_info=self._client_info, ) - request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy) + request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy,) if metadata is None: metadata = [] metadata = list(metadata) @@ -1896,7 +1898,7 @@ def get_iam_policy( ) request = iam_policy_pb2.GetIamPolicyRequest( - resource=resource, options=options_ + resource=resource, options=options_, ) if metadata is None: metadata = [] @@ -1983,7 +1985,7 @@ def test_iam_permissions( ) request = iam_policy_pb2.TestIamPermissionsRequest( - resource=resource, permissions=permissions + resource=resource, permissions=permissions, ) if metadata is None: metadata = [] diff --git a/google/cloud/pubsub_v1/gapic/transports/publisher_grpc_transport.py b/google/cloud/pubsub_v1/gapic/transports/publisher_grpc_transport.py index c874e78d3..bdba63555 100644 --- a/google/cloud/pubsub_v1/gapic/transports/publisher_grpc_transport.py +++ b/google/cloud/pubsub_v1/gapic/transports/publisher_grpc_transport.py @@ -57,7 +57,7 @@ def __init__( # exception (channels come with credentials baked in already). if channel is not None and credentials is not None: raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." + "The `channel` and `credentials` arguments are mutually " "exclusive.", ) # Create the channel. diff --git a/google/cloud/pubsub_v1/gapic/transports/subscriber_grpc_transport.py b/google/cloud/pubsub_v1/gapic/transports/subscriber_grpc_transport.py index 4a48b9317..cd7a19bbe 100644 --- a/google/cloud/pubsub_v1/gapic/transports/subscriber_grpc_transport.py +++ b/google/cloud/pubsub_v1/gapic/transports/subscriber_grpc_transport.py @@ -57,7 +57,7 @@ def __init__( # exception (channels come with credentials baked in already). if channel is not None and credentials is not None: raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." + "The `channel` and `credentials` arguments are mutually " "exclusive.", ) # Create the channel. diff --git a/google/cloud/pubsub_v1/proto/pubsub_pb2.py b/google/cloud/pubsub_v1/proto/pubsub_pb2.py index 6ba73883d..a53a75513 100644 --- a/google/cloud/pubsub_v1/proto/pubsub_pb2.py +++ b/google/cloud/pubsub_v1/proto/pubsub_pb2.py @@ -68,7 +68,7 @@ serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -228,7 +228,7 @@ ), ], extensions=[], - nested_types=[_TOPIC_LABELSENTRY], + nested_types=[_TOPIC_LABELSENTRY,], enum_types=[], serialized_options=b"\352AQ\n\033pubsub.googleapis.com/Topic\022!projects/{project}/topics/{topic}\022\017_deleted-topic_", is_extendable=False, @@ -404,7 +404,7 @@ ), ], extensions=[], - nested_types=[_PUBSUBMESSAGE_ATTRIBUTESENTRY], + nested_types=[_PUBSUBMESSAGE_ATTRIBUTESENTRY,], enum_types=[], serialized_options=None, is_extendable=False, @@ -442,7 +442,7 @@ serialized_options=b"\340A\002\372A\035\n\033pubsub.googleapis.com/Topic", file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -603,7 +603,7 @@ serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -1061,7 +1061,7 @@ serialized_options=b"\340A\002\372A\035\n\033pubsub.googleapis.com/Topic", file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -1102,7 +1102,7 @@ serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -1454,7 +1454,7 @@ ), ], extensions=[], - nested_types=[_SUBSCRIPTION_LABELSENTRY], + nested_types=[_SUBSCRIPTION_LABELSENTRY,], enum_types=[], serialized_options=b'\352AU\n"pubsub.googleapis.com/Subscription\022/projects/{project}/subscriptions/{subscription}', is_extendable=False, @@ -1612,7 +1612,7 @@ serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -1812,7 +1812,7 @@ ), ], extensions=[], - nested_types=[_PUSHCONFIG_OIDCTOKEN, _PUSHCONFIG_ATTRIBUTESENTRY], + nested_types=[_PUSHCONFIG_OIDCTOKEN, _PUSHCONFIG_ATTRIBUTESENTRY,], enum_types=[], serialized_options=None, is_extendable=False, @@ -1826,7 +1826,7 @@ containing_type=None, create_key=_descriptor._internal_create_key, fields=[], - ) + ), ], serialized_start=3102, serialized_end=3403, @@ -1938,7 +1938,7 @@ serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -2178,7 +2178,7 @@ serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -2358,7 +2358,7 @@ serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -2674,7 +2674,7 @@ serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -2815,7 +2815,7 @@ ), ], extensions=[], - nested_types=[_CREATESNAPSHOTREQUEST_LABELSENTRY], + nested_types=[_CREATESNAPSHOTREQUEST_LABELSENTRY,], enum_types=[], serialized_options=None, is_extendable=False, @@ -3032,7 +3032,7 @@ ), ], extensions=[], - nested_types=[_SNAPSHOT_LABELSENTRY], + nested_types=[_SNAPSHOT_LABELSENTRY,], enum_types=[], serialized_options=b"\352AI\n\036pubsub.googleapis.com/Snapshot\022'projects/{project}/snapshots/{snapshot}", is_extendable=False, @@ -3070,7 +3070,7 @@ serialized_options=b"\340A\002\372A \n\036pubsub.googleapis.com/Snapshot", file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -3250,7 +3250,7 @@ serialized_options=b"\340A\002\372A \n\036pubsub.googleapis.com/Snapshot", file=DESCRIPTOR, create_key=_descriptor._internal_create_key, - ) + ), ], extensions=[], nested_types=[], @@ -3346,7 +3346,7 @@ containing_type=None, create_key=_descriptor._internal_create_key, fields=[], - ) + ), ], serialized_start=6143, serialized_end=6333, diff --git a/noxfile.py b/noxfile.py index cf7a6e978..615358c2e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -23,11 +23,11 @@ import nox -BLACK_VERSION = "black==19.3b0" +BLACK_VERSION = "black==19.10b0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.7" -SYSTEM_TEST_PYTHON_VERSIONS = ["2.7", "3.7"] +DEFAULT_PYTHON_VERSION = "3.8" +SYSTEM_TEST_PYTHON_VERSIONS = ["2.7", "3.8"] UNIT_TEST_PYTHON_VERSIONS = ["2.7", "3.5", "3.6", "3.7", "3.8"] @@ -39,7 +39,9 @@ def lint(session): serious code quality issues. """ session.install("flake8", BLACK_VERSION) - session.run("black", "--check", *BLACK_PATHS) + session.run( + "black", "--check", *BLACK_PATHS, + ) session.run("flake8", "google", "tests") @@ -54,7 +56,9 @@ def blacken(session): check the state of the `gcp_ubuntu_config` we use for that Kokoro run. """ session.install(BLACK_VERSION) - session.run("black", *BLACK_PATHS) + session.run( + "black", *BLACK_PATHS, + ) @nox.session(python=DEFAULT_PYTHON_VERSION) diff --git a/synth.metadata b/synth.metadata index 3e3c4f0cd..fe6ccf394 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-pubsub.git", - "sha": "f2eec65cec43066ba7a2d1d45efa979e6b7add4f" + "sha": "71d70822c816062ef10d6d7584c4f8ed038d923f" } }, { @@ -19,14 +19,14 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "cd522c3b4dde821766d95c80ae5aeb43d7a41170" + "sha": "cf2eff09d0f5319a4dc5cdce2b6356d85af4a798" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "cd522c3b4dde821766d95c80ae5aeb43d7a41170" + "sha": "cf2eff09d0f5319a4dc5cdce2b6356d85af4a798" } } ], diff --git a/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py b/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py index 0475aaf6e..dd1035991 100644 --- a/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py +++ b/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py @@ -541,9 +541,14 @@ def make_running_manager(): def test_close(): - manager, consumer, dispatcher, leaser, heartbeater, scheduler = ( - make_running_manager() - ) + ( + manager, + consumer, + dispatcher, + leaser, + heartbeater, + scheduler, + ) = make_running_manager() manager.close() @@ -557,9 +562,14 @@ def test_close(): def test_close_inactive_consumer(): - manager, consumer, dispatcher, leaser, heartbeater, scheduler = ( - make_running_manager() - ) + ( + manager, + consumer, + dispatcher, + leaser, + heartbeater, + scheduler, + ) = make_running_manager() consumer.is_active = False manager.close()