Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .librarian/state.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:b8058df4c45e9a6e07f6b4d65b458d0d059241dd34c814f151c8bf6b89211209
image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:160860d189ff1c2f7515638478823712fa5b243e27ccc33a2728669fa1e2ed0c
libraries:
- id: google-cloud-pubsub
version: 2.35.0
Expand Down
2 changes: 1 addition & 1 deletion .repo-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"api_id": "pubsub.googleapis.com",
"requires_billing": true,
"default_version": "v1",
"codeowner_team": "@googleapis/cloud-sdk-python-team @googleapis/pubsub-team",
"codeowner_team": "@googleapis/api-pubsub",
"api_shortname": "pubsub",
"library_type": "GAPIC_COMBO",
"api_description": "is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher applications can send messages to a topic and other applications can subscribe to that topic to receive the messages. By decoupling senders and receivers, Google Cloud Pub/Sub allows developers to communicate between independently written applications."
Expand Down
14 changes: 10 additions & 4 deletions google/pubsub_v1/services/publisher/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.pubsub_v1.services.publisher import pagers
from google.pubsub_v1.types import pubsub
from google.pubsub_v1.types import TimeoutType
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
from .transports.base import PublisherTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import PublisherGrpcAsyncIOTransport
from .client import PublisherClient
Expand Down Expand Up @@ -122,7 +122,10 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
Returns:
PublisherAsyncClient: The constructed client.
"""
return PublisherClient.from_service_account_info.__func__(PublisherAsyncClient, info, *args, **kwargs) # type: ignore
sa_info_func = (
PublisherClient.from_service_account_info.__func__ # type: ignore
)
return sa_info_func(PublisherAsyncClient, info, *args, **kwargs)

@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
Expand All @@ -138,7 +141,10 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
Returns:
PublisherAsyncClient: The constructed client.
"""
return PublisherClient.from_service_account_file.__func__(PublisherAsyncClient, filename, *args, **kwargs) # type: ignore
sa_file_func = (
PublisherClient.from_service_account_file.__func__ # type: ignore
)
return sa_file_func(PublisherAsyncClient, filename, *args, **kwargs)

from_service_account_json = from_service_account_file

Expand Down
4 changes: 2 additions & 2 deletions google/pubsub_v1/services/publisher/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.pubsub_v1.services.publisher import pagers
from google.pubsub_v1.types import pubsub
from google.pubsub_v1.types import TimeoutType
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore

import grpc
from .transports.base import PublisherTransport, DEFAULT_CLIENT_INFO
Expand Down
13 changes: 8 additions & 5 deletions google/pubsub_v1/services/publisher/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import pubsub
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore

DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
client_library_version=package_version.__version__
Expand Down Expand Up @@ -89,8 +89,6 @@ def __init__(
be used for service account credentials.
"""

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
if not hasattr(self, "_ignore_credentials"):
Expand All @@ -105,11 +103,16 @@ def __init__(

if credentials_file is not None:
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
credentials_file,
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
Expand Down
2 changes: 1 addition & 1 deletion google/pubsub_v1/services/publisher/transports/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import pubsub
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from .base import PublisherTransport, DEFAULT_CLIENT_INFO

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import pubsub
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from .base import PublisherTransport, DEFAULT_CLIENT_INFO
from .grpc import PublisherGrpcTransport

Expand Down
4 changes: 2 additions & 2 deletions google/pubsub_v1/services/publisher/transports/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import warnings


from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import pubsub
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore


from .rest_base import _BasePublisherRestTransport
Expand Down Expand Up @@ -918,7 +918,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union


from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import pubsub
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore


class _BasePublisherRestTransport(PublisherTransport):
Expand Down
12 changes: 9 additions & 3 deletions google/pubsub_v1/services/schema_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.pubsub_v1.services.schema_service import pagers
from google.pubsub_v1.types import schema
from google.pubsub_v1.types import schema as gp_schema
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
from .transports.base import SchemaServiceTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import SchemaServiceGrpcAsyncIOTransport
from .client import SchemaServiceClient
Expand Down Expand Up @@ -117,7 +117,10 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
Returns:
SchemaServiceAsyncClient: The constructed client.
"""
return SchemaServiceClient.from_service_account_info.__func__(SchemaServiceAsyncClient, info, *args, **kwargs) # type: ignore
sa_info_func = (
SchemaServiceClient.from_service_account_info.__func__ # type: ignore
)
return sa_info_func(SchemaServiceAsyncClient, info, *args, **kwargs)

@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
Expand All @@ -133,7 +136,10 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
Returns:
SchemaServiceAsyncClient: The constructed client.
"""
return SchemaServiceClient.from_service_account_file.__func__(SchemaServiceAsyncClient, filename, *args, **kwargs) # type: ignore
sa_file_func = (
SchemaServiceClient.from_service_account_file.__func__ # type: ignore
)
return sa_file_func(SchemaServiceAsyncClient, filename, *args, **kwargs)

from_service_account_json = from_service_account_file

Expand Down
2 changes: 1 addition & 1 deletion google/pubsub_v1/services/schema_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.pubsub_v1.services.schema_service import pagers
from google.pubsub_v1.types import schema
from google.pubsub_v1.types import schema as gp_schema
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore

import grpc
from .transports.base import SchemaServiceTransport, DEFAULT_CLIENT_INFO
Expand Down
13 changes: 8 additions & 5 deletions google/pubsub_v1/services/schema_service/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import schema
from google.pubsub_v1.types import schema as gp_schema
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore

DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
client_library_version=package_version.__version__
Expand Down Expand Up @@ -90,8 +90,6 @@ def __init__(
be used for service account credentials.
"""

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
if not hasattr(self, "_ignore_credentials"):
Expand All @@ -106,11 +104,16 @@ def __init__(

if credentials_file is not None:
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
credentials_file,
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import schema
from google.pubsub_v1.types import schema as gp_schema
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from .base import SchemaServiceTransport, DEFAULT_CLIENT_INFO

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import schema
from google.pubsub_v1.types import schema as gp_schema
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from .base import SchemaServiceTransport, DEFAULT_CLIENT_INFO
from .grpc import SchemaServiceGrpcTransport

Expand Down
4 changes: 2 additions & 2 deletions google/pubsub_v1/services/schema_service/transports/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
import warnings


from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import schema
from google.pubsub_v1.types import schema as gp_schema
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore


from .rest_base import _BaseSchemaServiceRestTransport
Expand Down Expand Up @@ -1116,7 +1116,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union


from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import schema
from google.pubsub_v1.types import schema as gp_schema
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore


class _BaseSchemaServiceRestTransport(SchemaServiceTransport):
Expand Down
16 changes: 11 additions & 5 deletions google/pubsub_v1/services/subscriber/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.pubsub_v1.services.subscriber import pagers
from google.pubsub_v1.types import pubsub
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
from .transports.base import SubscriberTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import SubscriberGrpcAsyncIOTransport
from .client import SubscriberClient
Expand Down Expand Up @@ -126,7 +126,10 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
Returns:
SubscriberAsyncClient: The constructed client.
"""
return SubscriberClient.from_service_account_info.__func__(SubscriberAsyncClient, info, *args, **kwargs) # type: ignore
sa_info_func = (
SubscriberClient.from_service_account_info.__func__ # type: ignore
)
return sa_info_func(SubscriberAsyncClient, info, *args, **kwargs)

@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
Expand All @@ -142,7 +145,10 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
Returns:
SubscriberAsyncClient: The constructed client.
"""
return SubscriberClient.from_service_account_file.__func__(SubscriberAsyncClient, filename, *args, **kwargs) # type: ignore
sa_file_func = (
SubscriberClient.from_service_account_file.__func__ # type: ignore
)
return sa_file_func(SubscriberAsyncClient, filename, *args, **kwargs)

from_service_account_json = from_service_account_file

Expand Down
6 changes: 3 additions & 3 deletions google/pubsub_v1/services/subscriber/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.pubsub_v1.services.subscriber import pagers
from google.pubsub_v1.types import pubsub
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore

import grpc
from .transports.base import SubscriberTransport, DEFAULT_CLIENT_INFO
Expand Down
13 changes: 8 additions & 5 deletions google/pubsub_v1/services/subscriber/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import pubsub
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore

DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
client_library_version=package_version.__version__
Expand Down Expand Up @@ -89,8 +89,6 @@ def __init__(
be used for service account credentials.
"""

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
if not hasattr(self, "_ignore_credentials"):
Expand All @@ -105,11 +103,16 @@ def __init__(

if credentials_file is not None:
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
credentials_file,
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
Expand Down
2 changes: 1 addition & 1 deletion google/pubsub_v1/services/subscriber/transports/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.pubsub_v1.types import pubsub
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from .base import SubscriberTransport, DEFAULT_CLIENT_INFO

try:
Expand Down
Loading
Loading