Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: add type hints to ClientOptions#735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
parthea merged 5 commits intogoogleapis:mainfromrinarakaki:typing
Oct 19, 2024
Merged
Changes fromall 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
30 changes: 17 additions & 13 deletionsgoogle/api_core/client_options.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,18 +48,20 @@ def get_client_cert():

"""

from typing import Callable, Mapping, Optional, Sequence, Tuple


class ClientOptions(object):
"""Client Options used to set options on clients.

Args:
api_endpoint (Optional[str]): The desired API endpoint, e.g.,
compute.googleapis.com
client_cert_source (Optional[Callable[[],(bytes, bytes)]]): A callback
client_cert_source (Optional[Callable[[],Tuple[bytes, bytes]]]): A callback
which returns client certificate bytes and private key bytes both in
PEM format. ``client_cert_source`` and ``client_encrypted_cert_source``
are mutually exclusive.
client_encrypted_cert_source (Optional[Callable[[],(str, str, bytes)]]):
client_encrypted_cert_source (Optional[Callable[[],Tuple[str, str, bytes]]]):
A callback which returns client certificate file path, encrypted
private key file path, and the passphrase bytes.``client_cert_source``
and ``client_encrypted_cert_source`` are mutually exclusive.
Expand DownExpand Up@@ -88,15 +90,17 @@ class ClientOptions(object):

def __init__(
self,
api_endpoint=None,
client_cert_source=None,
client_encrypted_cert_source=None,
quota_project_id=None,
credentials_file=None,
scopes=None,
api_key=None,
api_audience=None,
universe_domain=None,
api_endpoint: Optional[str] = None,
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
client_encrypted_cert_source: Optional[
Callable[[], Tuple[str, str, bytes]]
] = None,
quota_project_id: Optional[str] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
api_key: Optional[str] = None,
api_audience: Optional[str] = None,
universe_domain: Optional[str] = None,
):
if client_cert_source and client_encrypted_cert_source:
raise ValueError(
Expand All@@ -114,11 +118,11 @@ def __init__(
self.api_audience = api_audience
self.universe_domain = universe_domain

def __repr__(self):
def __repr__(self) -> str:
return "ClientOptions: " + repr(self.__dict__)


def from_dict(options):
def from_dict(options: Mapping[str, object]) -> ClientOptions:
"""Construct a client options object from a mapping object.

Args:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp