partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | IAMCredentialsClient.service_account_path | Return a fully-qualified service_account string. | iam/google/cloud/iam_credentials_v1/gapic/iam_credentials_client.py | def service_account_path(cls, project, service_account):
"""Return a fully-qualified service_account string."""
return google.api_core.path_template.expand(
"projects/{project}/serviceAccounts/{service_account}",
project=project,
service_account=service_account,
... | def service_account_path(cls, project, service_account):
"""Return a fully-qualified service_account string."""
return google.api_core.path_template.expand(
"projects/{project}/serviceAccounts/{service_account}",
project=project,
service_account=service_account,
... | [
"Return",
"a",
"fully",
"-",
"qualified",
"service_account",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iam/google/cloud/iam_credentials_v1/gapic/iam_credentials_client.py#L82-L88 | [
"def",
"service_account_path",
"(",
"cls",
",",
"project",
",",
"service_account",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/serviceAccounts/{service_account}\"",
",",
"project",
"=",
"project",
",",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | IAMCredentialsClient.generate_access_token | Generates an OAuth 2.0 access token for a service account.
Example:
>>> from google.cloud import iam_credentials_v1
>>>
>>> client = iam_credentials_v1.IAMCredentialsClient()
>>>
>>> name = client.service_account_path('[PROJECT]', '[SERVICE_ACCOUNT]')... | iam/google/cloud/iam_credentials_v1/gapic/iam_credentials_client.py | def generate_access_token(
self,
name,
scope,
delegates=None,
lifetime=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Generates an OAuth 2.0 access token for a... | def generate_access_token(
self,
name,
scope,
delegates=None,
lifetime=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Generates an OAuth 2.0 access token for a... | [
"Generates",
"an",
"OAuth",
"2",
".",
"0",
"access",
"token",
"for",
"a",
"service",
"account",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iam/google/cloud/iam_credentials_v1/gapic/iam_credentials_client.py#L189-L286 | [
"def",
"generate_access_token",
"(",
"self",
",",
"name",
",",
"scope",
",",
"delegates",
"=",
"None",
",",
"lifetime",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"googl... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | IAMCredentialsClient.generate_id_token | Generates an OpenID Connect ID token for a service account.
Example:
>>> from google.cloud import iam_credentials_v1
>>>
>>> client = iam_credentials_v1.IAMCredentialsClient()
>>>
>>> name = client.service_account_path('[PROJECT]', '[SERVICE_ACCOUNT]'... | iam/google/cloud/iam_credentials_v1/gapic/iam_credentials_client.py | def generate_id_token(
self,
name,
audience,
delegates=None,
include_email=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Generates an OpenID Connect ID token ... | def generate_id_token(
self,
name,
audience,
delegates=None,
include_email=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Generates an OpenID Connect ID token ... | [
"Generates",
"an",
"OpenID",
"Connect",
"ID",
"token",
"for",
"a",
"service",
"account",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iam/google/cloud/iam_credentials_v1/gapic/iam_credentials_client.py#L288-L381 | [
"def",
"generate_id_token",
"(",
"self",
",",
"name",
",",
"audience",
",",
"delegates",
"=",
"None",
",",
"include_email",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"g... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | IAMCredentialsClient.sign_blob | Signs a blob using a service account's system-managed private key.
Example:
>>> from google.cloud import iam_credentials_v1
>>>
>>> client = iam_credentials_v1.IAMCredentialsClient()
>>>
>>> name = client.service_account_path('[PROJECT]', '[SERVICE_AC... | iam/google/cloud/iam_credentials_v1/gapic/iam_credentials_client.py | def sign_blob(
self,
name,
payload,
delegates=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Signs a blob using a service account's system-managed private key.
... | def sign_blob(
self,
name,
payload,
delegates=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Signs a blob using a service account's system-managed private key.
... | [
"Signs",
"a",
"blob",
"using",
"a",
"service",
"account",
"s",
"system",
"-",
"managed",
"private",
"key",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iam/google/cloud/iam_credentials_v1/gapic/iam_credentials_client.py#L383-L469 | [
"def",
"sign_blob",
"(",
"self",
",",
"name",
",",
"payload",
",",
"delegates",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | IAMCredentialsClient.generate_identity_binding_access_token | Exchange a JWT signed by third party identity provider to an OAuth 2.0
access token
Example:
>>> from google.cloud import iam_credentials_v1
>>>
>>> client = iam_credentials_v1.IAMCredentialsClient()
>>>
>>> name = client.service_account_path(... | iam/google/cloud/iam_credentials_v1/gapic/iam_credentials_client.py | def generate_identity_binding_access_token(
self,
name,
scope,
jwt,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Exchange a JWT signed by third party identity provider to ... | def generate_identity_binding_access_token(
self,
name,
scope,
jwt,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Exchange a JWT signed by third party identity provider to ... | [
"Exchange",
"a",
"JWT",
"signed",
"by",
"third",
"party",
"identity",
"provider",
"to",
"an",
"OAuth",
"2",
".",
"0",
"access",
"token"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iam/google/cloud/iam_credentials_v1/gapic/iam_credentials_client.py#L559-L682 | [
"def",
"generate_identity_binding_access_token",
"(",
"self",
",",
"name",
",",
"scope",
",",
"jwt",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DataCatalogClient.entry_path | Return a fully-qualified entry string. | datacatalog/google/cloud/datacatalog_v1beta1/gapic/data_catalog_client.py | def entry_path(cls, project, location, entry_group, entry):
"""Return a fully-qualified entry string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}",
project=project,
location=locatio... | def entry_path(cls, project, location, entry_group, entry):
"""Return a fully-qualified entry string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}",
project=project,
location=locatio... | [
"Return",
"a",
"fully",
"-",
"qualified",
"entry",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datacatalog/google/cloud/datacatalog_v1beta1/gapic/data_catalog_client.py#L86-L94 | [
"def",
"entry_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"entry_group",
",",
"entry",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{ent... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DataCatalogClient.lookup_entry | Get an entry by target resource name. This method allows clients to use
the resource name from the source Google Cloud Platform service to get the
Cloud Data Catalog Entry.
Example:
>>> from google.cloud import datacatalog_v1beta1
>>>
>>> client = datacatalog... | datacatalog/google/cloud/datacatalog_v1beta1/gapic/data_catalog_client.py | def lookup_entry(
self,
linked_resource=None,
sql_resource=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Get an entry by target resource name. This method allows clients to u... | def lookup_entry(
self,
linked_resource=None,
sql_resource=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Get an entry by target resource name. This method allows clients to u... | [
"Get",
"an",
"entry",
"by",
"target",
"resource",
"name",
".",
"This",
"method",
"allows",
"clients",
"to",
"use",
"the",
"resource",
"name",
"from",
"the",
"source",
"Google",
"Cloud",
"Platform",
"service",
"to",
"get",
"the",
"Cloud",
"Data",
"Catalog",
... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datacatalog/google/cloud/datacatalog_v1beta1/gapic/data_catalog_client.py#L195-L272 | [
"def",
"lookup_entry",
"(",
"self",
",",
"linked_resource",
"=",
"None",
",",
"sql_resource",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _get_document_path | Convert a path tuple into a full path string.
Of the form:
``projects/{project_id}/databases/{database_id}/...
documents/{document_path}``
Args:
client (~.firestore_v1beta1.client.Client): The client that holds
configuration details and a GAPIC client object.
... | firestore/google/cloud/firestore_v1beta1/document.py | def _get_document_path(client, path):
"""Convert a path tuple into a full path string.
Of the form:
``projects/{project_id}/databases/{database_id}/...
documents/{document_path}``
Args:
client (~.firestore_v1beta1.client.Client): The client that holds
configurati... | def _get_document_path(client, path):
"""Convert a path tuple into a full path string.
Of the form:
``projects/{project_id}/databases/{database_id}/...
documents/{document_path}``
Args:
client (~.firestore_v1beta1.client.Client): The client that holds
configurati... | [
"Convert",
"a",
"path",
"tuple",
"into",
"a",
"full",
"path",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L695-L712 | [
"def",
"_get_document_path",
"(",
"client",
",",
"path",
")",
":",
"parts",
"=",
"(",
"client",
".",
"_database_string",
",",
"\"documents\"",
")",
"+",
"path",
"return",
"_helpers",
".",
"DOCUMENT_PATH_DELIMITER",
".",
"join",
"(",
"parts",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _consume_single_get | Consume a gRPC stream that should contain a single response.
The stream will correspond to a ``BatchGetDocuments`` request made
for a single document.
Args:
response_iterator (~google.cloud.exceptions.GrpcRendezvous): A
streaming iterator returned from a ``BatchGetDocuments``
... | firestore/google/cloud/firestore_v1beta1/document.py | def _consume_single_get(response_iterator):
"""Consume a gRPC stream that should contain a single response.
The stream will correspond to a ``BatchGetDocuments`` request made
for a single document.
Args:
response_iterator (~google.cloud.exceptions.GrpcRendezvous): A
streaming itera... | def _consume_single_get(response_iterator):
"""Consume a gRPC stream that should contain a single response.
The stream will correspond to a ``BatchGetDocuments`` request made
for a single document.
Args:
response_iterator (~google.cloud.exceptions.GrpcRendezvous): A
streaming itera... | [
"Consume",
"a",
"gRPC",
"stream",
"that",
"should",
"contain",
"a",
"single",
"response",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L715-L743 | [
"def",
"_consume_single_get",
"(",
"response_iterator",
")",
":",
"# Calling ``list()`` consumes the entire iterator.",
"all_responses",
"=",
"list",
"(",
"response_iterator",
")",
"if",
"len",
"(",
"all_responses",
")",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"\"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DocumentReference._document_path | Create and cache the full path for this document.
Of the form:
``projects/{project_id}/databases/{database_id}/...
documents/{document_path}``
Returns:
str: The full document path.
Raises:
ValueError: If the current document reference has... | firestore/google/cloud/firestore_v1beta1/document.py | def _document_path(self):
"""Create and cache the full path for this document.
Of the form:
``projects/{project_id}/databases/{database_id}/...
documents/{document_path}``
Returns:
str: The full document path.
Raises:
ValueError: ... | def _document_path(self):
"""Create and cache the full path for this document.
Of the form:
``projects/{project_id}/databases/{database_id}/...
documents/{document_path}``
Returns:
str: The full document path.
Raises:
ValueError: ... | [
"Create",
"and",
"cache",
"the",
"full",
"path",
"for",
"this",
"document",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L130-L149 | [
"def",
"_document_path",
"(",
"self",
")",
":",
"if",
"self",
".",
"_document_path_internal",
"is",
"None",
":",
"if",
"self",
".",
"_client",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"A document reference requires a `client`.\"",
")",
"self",
".",
"_doc... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DocumentReference.collection | Create a sub-collection underneath the current document.
Args:
collection_id (str): The sub-collection identifier (sometimes
referred to as the "kind").
Returns:
~.firestore_v1beta1.collection.CollectionReference: The
child collection. | firestore/google/cloud/firestore_v1beta1/document.py | def collection(self, collection_id):
"""Create a sub-collection underneath the current document.
Args:
collection_id (str): The sub-collection identifier (sometimes
referred to as the "kind").
Returns:
~.firestore_v1beta1.collection.CollectionReference: ... | def collection(self, collection_id):
"""Create a sub-collection underneath the current document.
Args:
collection_id (str): The sub-collection identifier (sometimes
referred to as the "kind").
Returns:
~.firestore_v1beta1.collection.CollectionReference: ... | [
"Create",
"a",
"sub",
"-",
"collection",
"underneath",
"the",
"current",
"document",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L171-L183 | [
"def",
"collection",
"(",
"self",
",",
"collection_id",
")",
":",
"child_path",
"=",
"self",
".",
"_path",
"+",
"(",
"collection_id",
",",
")",
"return",
"self",
".",
"_client",
".",
"collection",
"(",
"*",
"child_path",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DocumentReference.create | Create the current document in the Firestore database.
Args:
document_data (dict): Property names and values to use for
creating a document.
Returns:
google.cloud.firestore_v1beta1.types.WriteResult: The
write result corresponding to the committed do... | firestore/google/cloud/firestore_v1beta1/document.py | def create(self, document_data):
"""Create the current document in the Firestore database.
Args:
document_data (dict): Property names and values to use for
creating a document.
Returns:
google.cloud.firestore_v1beta1.types.WriteResult: The
wr... | def create(self, document_data):
"""Create the current document in the Firestore database.
Args:
document_data (dict): Property names and values to use for
creating a document.
Returns:
google.cloud.firestore_v1beta1.types.WriteResult: The
wr... | [
"Create",
"the",
"current",
"document",
"in",
"the",
"Firestore",
"database",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L185-L203 | [
"def",
"create",
"(",
"self",
",",
"document_data",
")",
":",
"batch",
"=",
"self",
".",
"_client",
".",
"batch",
"(",
")",
"batch",
".",
"create",
"(",
"self",
",",
"document_data",
")",
"write_results",
"=",
"batch",
".",
"commit",
"(",
")",
"return"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DocumentReference.set | Replace the current document in the Firestore database.
A write ``option`` can be specified to indicate preconditions of
the "set" operation. If no ``option`` is specified and this document
doesn't exist yet, this method will create it.
Overwrites all content for the document with the ... | firestore/google/cloud/firestore_v1beta1/document.py | def set(self, document_data, merge=False):
"""Replace the current document in the Firestore database.
A write ``option`` can be specified to indicate preconditions of
the "set" operation. If no ``option`` is specified and this document
doesn't exist yet, this method will create it.
... | def set(self, document_data, merge=False):
"""Replace the current document in the Firestore database.
A write ``option`` can be specified to indicate preconditions of
the "set" operation. If no ``option`` is specified and this document
doesn't exist yet, this method will create it.
... | [
"Replace",
"the",
"current",
"document",
"in",
"the",
"Firestore",
"database",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L205-L234 | [
"def",
"set",
"(",
"self",
",",
"document_data",
",",
"merge",
"=",
"False",
")",
":",
"batch",
"=",
"self",
".",
"_client",
".",
"batch",
"(",
")",
"batch",
".",
"set",
"(",
"self",
",",
"document_data",
",",
"merge",
"=",
"merge",
")",
"write_resul... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DocumentReference.update | Update an existing document in the Firestore database.
By default, this method verifies that the document exists on the
server before making updates. A write ``option`` can be specified to
override these preconditions.
Each key in ``field_updates`` can either be a field name or a
... | firestore/google/cloud/firestore_v1beta1/document.py | def update(self, field_updates, option=None):
"""Update an existing document in the Firestore database.
By default, this method verifies that the document exists on the
server before making updates. A write ``option`` can be specified to
override these preconditions.
Each key i... | def update(self, field_updates, option=None):
"""Update an existing document in the Firestore database.
By default, this method verifies that the document exists on the
server before making updates. A write ``option`` can be specified to
override these preconditions.
Each key i... | [
"Update",
"an",
"existing",
"document",
"in",
"the",
"Firestore",
"database",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L236-L381 | [
"def",
"update",
"(",
"self",
",",
"field_updates",
",",
"option",
"=",
"None",
")",
":",
"batch",
"=",
"self",
".",
"_client",
".",
"batch",
"(",
")",
"batch",
".",
"update",
"(",
"self",
",",
"field_updates",
",",
"option",
"=",
"option",
")",
"wri... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DocumentReference.delete | Delete the current document in the Firestore database.
Args:
option (Optional[~.firestore_v1beta1.client.WriteOption]): A
write option to make assertions / preconditions on the server
state of the document before applying changes.
Returns:
google.p... | firestore/google/cloud/firestore_v1beta1/document.py | def delete(self, option=None):
"""Delete the current document in the Firestore database.
Args:
option (Optional[~.firestore_v1beta1.client.WriteOption]): A
write option to make assertions / preconditions on the server
state of the document before applying chang... | def delete(self, option=None):
"""Delete the current document in the Firestore database.
Args:
option (Optional[~.firestore_v1beta1.client.WriteOption]): A
write option to make assertions / preconditions on the server
state of the document before applying chang... | [
"Delete",
"the",
"current",
"document",
"in",
"the",
"Firestore",
"database",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L383-L406 | [
"def",
"delete",
"(",
"self",
",",
"option",
"=",
"None",
")",
":",
"write_pb",
"=",
"_helpers",
".",
"pb_for_delete",
"(",
"self",
".",
"_document_path",
",",
"option",
")",
"commit_response",
"=",
"self",
".",
"_client",
".",
"_firestore_api",
".",
"comm... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DocumentReference.get | Retrieve a snapshot of the current document.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
If a ``transaction`` is used and it already has write operations
added, this method cannot be used (i.e. read-after-write is not
allowe... | firestore/google/cloud/firestore_v1beta1/document.py | def get(self, field_paths=None, transaction=None):
"""Retrieve a snapshot of the current document.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
If a ``transaction`` is used and it already has write operations
added, this meth... | def get(self, field_paths=None, transaction=None):
"""Retrieve a snapshot of the current document.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
If a ``transaction`` is used and it already has write operations
added, this meth... | [
"Retrieve",
"a",
"snapshot",
"of",
"the",
"current",
"document",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L408-L468 | [
"def",
"get",
"(",
"self",
",",
"field_paths",
"=",
"None",
",",
"transaction",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"field_paths",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"ValueError",
"(",
"\"'field_paths' must be a sequence of paths, no... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DocumentReference.collections | List subcollections of the current document.
Args:
page_size (Optional[int]]): The maximum number of collections
in each page of results from this request. Non-positive values
are ignored. Defaults to a sensible value set by the API.
Returns:
Sequence[~.... | firestore/google/cloud/firestore_v1beta1/document.py | def collections(self, page_size=None):
"""List subcollections of the current document.
Args:
page_size (Optional[int]]): The maximum number of collections
in each page of results from this request. Non-positive values
are ignored. Defaults to a sensible value set by ... | def collections(self, page_size=None):
"""List subcollections of the current document.
Args:
page_size (Optional[int]]): The maximum number of collections
in each page of results from this request. Non-positive values
are ignored. Defaults to a sensible value set by ... | [
"List",
"subcollections",
"of",
"the",
"current",
"document",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L470-L491 | [
"def",
"collections",
"(",
"self",
",",
"page_size",
"=",
"None",
")",
":",
"iterator",
"=",
"self",
".",
"_client",
".",
"_firestore_api",
".",
"list_collection_ids",
"(",
"self",
".",
"_document_path",
",",
"page_size",
"=",
"page_size",
",",
"metadata",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DocumentSnapshot.get | Get a value from the snapshot data.
If the data is nested, for example:
.. code-block:: python
>>> snapshot.to_dict()
{
'top1': {
'middle2': {
'bottom3': 20,
'bottom4': 22,
},
... | firestore/google/cloud/firestore_v1beta1/document.py | def get(self, field_path):
"""Get a value from the snapshot data.
If the data is nested, for example:
.. code-block:: python
>>> snapshot.to_dict()
{
'top1': {
'middle2': {
'bottom3': 20,
'bo... | def get(self, field_path):
"""Get a value from the snapshot data.
If the data is nested, for example:
.. code-block:: python
>>> snapshot.to_dict()
{
'top1': {
'middle2': {
'bottom3': 20,
'bo... | [
"Get",
"a",
"value",
"from",
"the",
"snapshot",
"data",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L615-L677 | [
"def",
"get",
"(",
"self",
",",
"field_path",
")",
":",
"if",
"not",
"self",
".",
"_exists",
":",
"return",
"None",
"nested_data",
"=",
"field_path_module",
".",
"get_nested_value",
"(",
"field_path",
",",
"self",
".",
"_data",
")",
"return",
"copy",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _delay_until_retry | Helper for :meth:`Session.run_in_transaction`.
Detect retryable abort, and impose server-supplied delay.
:type exc: :class:`google.api_core.exceptions.Aborted`
:param exc: exception for aborted transaction
:type deadline: float
:param deadline: maximum timestamp to continue retrying the transacti... | spanner/google/cloud/spanner_v1/session.py | def _delay_until_retry(exc, deadline):
"""Helper for :meth:`Session.run_in_transaction`.
Detect retryable abort, and impose server-supplied delay.
:type exc: :class:`google.api_core.exceptions.Aborted`
:param exc: exception for aborted transaction
:type deadline: float
:param deadline: maximu... | def _delay_until_retry(exc, deadline):
"""Helper for :meth:`Session.run_in_transaction`.
Detect retryable abort, and impose server-supplied delay.
:type exc: :class:`google.api_core.exceptions.Aborted`
:param exc: exception for aborted transaction
:type deadline: float
:param deadline: maximu... | [
"Helper",
"for",
":",
"meth",
":",
"Session",
".",
"run_in_transaction",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/session.py#L323-L347 | [
"def",
"_delay_until_retry",
"(",
"exc",
",",
"deadline",
")",
":",
"cause",
"=",
"exc",
".",
"errors",
"[",
"0",
"]",
"now",
"=",
"time",
".",
"time",
"(",
")",
"if",
"now",
">=",
"deadline",
":",
"raise",
"delay",
"=",
"_get_retry_delay",
"(",
"cau... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _get_retry_delay | Helper for :func:`_delay_until_retry`.
:type exc: :class:`grpc.Call`
:param exc: exception for aborted transaction
:rtype: float
:returns: seconds to wait before retrying the transaction. | spanner/google/cloud/spanner_v1/session.py | def _get_retry_delay(cause):
"""Helper for :func:`_delay_until_retry`.
:type exc: :class:`grpc.Call`
:param exc: exception for aborted transaction
:rtype: float
:returns: seconds to wait before retrying the transaction.
"""
metadata = dict(cause.trailing_metadata())
retry_info_pb = met... | def _get_retry_delay(cause):
"""Helper for :func:`_delay_until_retry`.
:type exc: :class:`grpc.Call`
:param exc: exception for aborted transaction
:rtype: float
:returns: seconds to wait before retrying the transaction.
"""
metadata = dict(cause.trailing_metadata())
retry_info_pb = met... | [
"Helper",
"for",
":",
"func",
":",
"_delay_until_retry",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/session.py#L353-L368 | [
"def",
"_get_retry_delay",
"(",
"cause",
")",
":",
"metadata",
"=",
"dict",
"(",
"cause",
".",
"trailing_metadata",
"(",
")",
")",
"retry_info_pb",
"=",
"metadata",
".",
"get",
"(",
"\"google.rpc.retryinfo-bin\"",
")",
"if",
"retry_info_pb",
"is",
"not",
"None... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DatabaseAdminClient.database_path | Return a fully-qualified database string. | spanner/google/cloud/spanner_admin_database_v1/gapic/database_admin_client.py | def database_path(cls, project, instance, database):
"""Return a fully-qualified database string."""
return google.api_core.path_template.expand(
"projects/{project}/instances/{instance}/databases/{database}",
project=project,
instance=instance,
database=d... | def database_path(cls, project, instance, database):
"""Return a fully-qualified database string."""
return google.api_core.path_template.expand(
"projects/{project}/instances/{instance}/databases/{database}",
project=project,
instance=instance,
database=d... | [
"Return",
"a",
"fully",
"-",
"qualified",
"database",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_admin_database_v1/gapic/database_admin_client.py#L95-L102 | [
"def",
"database_path",
"(",
"cls",
",",
"project",
",",
"instance",
",",
"database",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/instances/{instance}/databases/{database}\"",
",",
"project",
"=",
"p... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DatabaseAdminClient.create_database | Creates a new Cloud Spanner database and starts to prepare it for
serving. The returned ``long-running operation`` will have a name of the
format ``<database_name>/operations/<operation_id>`` and can be used to
track preparation of the database. The ``metadata`` field type is
``CreateDat... | spanner/google/cloud/spanner_admin_database_v1/gapic/database_admin_client.py | def create_database(
self,
parent,
create_statement,
extra_statements=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a new Cloud Spanner database and starts to... | def create_database(
self,
parent,
create_statement,
extra_statements=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a new Cloud Spanner database and starts to... | [
"Creates",
"a",
"new",
"Cloud",
"Spanner",
"database",
"and",
"starts",
"to",
"prepare",
"it",
"for",
"serving",
".",
"The",
"returned",
"long",
"-",
"running",
"operation",
"will",
"have",
"a",
"name",
"of",
"the",
"format",
"<database_name",
">",
"/",
"o... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_admin_database_v1/gapic/database_admin_client.py#L307-L413 | [
"def",
"create_database",
"(",
"self",
",",
"parent",
",",
"create_statement",
",",
"extra_statements",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | DatabaseAdminClient.update_database_ddl | Updates the schema of a Cloud Spanner database by
creating/altering/dropping tables, columns, indexes, etc. The returned
``long-running operation`` will have a name of the format
``<database_name>/operations/<operation_id>`` and can be used to track
execution of the schema change(s). The... | spanner/google/cloud/spanner_admin_database_v1/gapic/database_admin_client.py | def update_database_ddl(
self,
database,
statements,
operation_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates the schema of a Cloud Spanner database by
... | def update_database_ddl(
self,
database,
statements,
operation_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates the schema of a Cloud Spanner database by
... | [
"Updates",
"the",
"schema",
"of",
"a",
"Cloud",
"Spanner",
"database",
"by",
"creating",
"/",
"altering",
"/",
"dropping",
"tables",
"columns",
"indexes",
"etc",
".",
"The",
"returned",
"long",
"-",
"running",
"operation",
"will",
"have",
"a",
"name",
"of",
... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_admin_database_v1/gapic/database_admin_client.py#L485-L595 | [
"def",
"update_database_ddl",
"(",
"self",
",",
"database",
",",
"statements",
",",
"operation_id",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client._get_scopes | Get the scopes corresponding to admin / read-only state.
Returns:
Tuple[str, ...]: The tuple of scopes. | bigtable/google/cloud/bigtable/client.py | def _get_scopes(self):
"""Get the scopes corresponding to admin / read-only state.
Returns:
Tuple[str, ...]: The tuple of scopes.
"""
if self._read_only:
scopes = (READ_ONLY_SCOPE,)
else:
scopes = (DATA_SCOPE,)
if self._admin:
... | def _get_scopes(self):
"""Get the scopes corresponding to admin / read-only state.
Returns:
Tuple[str, ...]: The tuple of scopes.
"""
if self._read_only:
scopes = (READ_ONLY_SCOPE,)
else:
scopes = (DATA_SCOPE,)
if self._admin:
... | [
"Get",
"the",
"scopes",
"corresponding",
"to",
"admin",
"/",
"read",
"-",
"only",
"state",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/client.py#L146-L160 | [
"def",
"_get_scopes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_read_only",
":",
"scopes",
"=",
"(",
"READ_ONLY_SCOPE",
",",
")",
"else",
":",
"scopes",
"=",
"(",
"DATA_SCOPE",
",",
")",
"if",
"self",
".",
"_admin",
":",
"scopes",
"+=",
"(",
"ADMIN... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.table_data_client | Getter for the gRPC stub used for the Table Admin API.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_table_data_client]
:end-before: [END bigtable_table_data_client]
:rtype: :class:`.bigtable_v2.BigtableClient`
:returns: A BigtableC... | bigtable/google/cloud/bigtable/client.py | def table_data_client(self):
"""Getter for the gRPC stub used for the Table Admin API.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_table_data_client]
:end-before: [END bigtable_table_data_client]
:rtype: :class:`.bigtable_v2.Bigta... | def table_data_client(self):
"""Getter for the gRPC stub used for the Table Admin API.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_table_data_client]
:end-before: [END bigtable_table_data_client]
:rtype: :class:`.bigtable_v2.Bigta... | [
"Getter",
"for",
"the",
"gRPC",
"stub",
"used",
"for",
"the",
"Table",
"Admin",
"API",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/client.py#L187-L203 | [
"def",
"table_data_client",
"(",
"self",
")",
":",
"if",
"self",
".",
"_table_data_client",
"is",
"None",
":",
"self",
".",
"_table_data_client",
"=",
"_create_gapic_client",
"(",
"bigtable_v2",
".",
"BigtableClient",
")",
"(",
"self",
")",
"return",
"self",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.table_admin_client | Getter for the gRPC stub used for the Table Admin API.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_table_admin_client]
:end-before: [END bigtable_table_admin_client]
:rtype: :class:`.bigtable_admin_pb2.BigtableTableAdmin`
:returns... | bigtable/google/cloud/bigtable/client.py | def table_admin_client(self):
"""Getter for the gRPC stub used for the Table Admin API.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_table_admin_client]
:end-before: [END bigtable_table_admin_client]
:rtype: :class:`.bigtable_admin... | def table_admin_client(self):
"""Getter for the gRPC stub used for the Table Admin API.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_table_admin_client]
:end-before: [END bigtable_table_admin_client]
:rtype: :class:`.bigtable_admin... | [
"Getter",
"for",
"the",
"gRPC",
"stub",
"used",
"for",
"the",
"Table",
"Admin",
"API",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/client.py#L206-L227 | [
"def",
"table_admin_client",
"(",
"self",
")",
":",
"if",
"self",
".",
"_table_admin_client",
"is",
"None",
":",
"if",
"not",
"self",
".",
"_admin",
":",
"raise",
"ValueError",
"(",
"\"Client is not an admin client.\"",
")",
"self",
".",
"_table_admin_client",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.instance_admin_client | Getter for the gRPC stub used for the Table Admin API.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_instance_admin_client]
:end-before: [END bigtable_instance_admin_client]
:rtype: :class:`.bigtable_admin_pb2.BigtableInstanceAdmin`
... | bigtable/google/cloud/bigtable/client.py | def instance_admin_client(self):
"""Getter for the gRPC stub used for the Table Admin API.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_instance_admin_client]
:end-before: [END bigtable_instance_admin_client]
:rtype: :class:`.bigta... | def instance_admin_client(self):
"""Getter for the gRPC stub used for the Table Admin API.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_instance_admin_client]
:end-before: [END bigtable_instance_admin_client]
:rtype: :class:`.bigta... | [
"Getter",
"for",
"the",
"gRPC",
"stub",
"used",
"for",
"the",
"Table",
"Admin",
"API",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/client.py#L230-L251 | [
"def",
"instance_admin_client",
"(",
"self",
")",
":",
"if",
"self",
".",
"_instance_admin_client",
"is",
"None",
":",
"if",
"not",
"self",
".",
"_admin",
":",
"raise",
"ValueError",
"(",
"\"Client is not an admin client.\"",
")",
"self",
".",
"_instance_admin_cli... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.instance | Factory to create a instance associated with this client.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_prod_instance]
:end-before: [END bigtable_create_prod_instance]
:type instance_id: str
:param instance_id: The ID of the ... | bigtable/google/cloud/bigtable/client.py | def instance(self, instance_id, display_name=None, instance_type=None, labels=None):
"""Factory to create a instance associated with this client.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_prod_instance]
:end-before: [END bigtable_... | def instance(self, instance_id, display_name=None, instance_type=None, labels=None):
"""Factory to create a instance associated with this client.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_prod_instance]
:end-before: [END bigtable_... | [
"Factory",
"to",
"create",
"a",
"instance",
"associated",
"with",
"this",
"client",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/client.py#L253-L300 | [
"def",
"instance",
"(",
"self",
",",
"instance_id",
",",
"display_name",
"=",
"None",
",",
"instance_type",
"=",
"None",
",",
"labels",
"=",
"None",
")",
":",
"return",
"Instance",
"(",
"instance_id",
",",
"self",
",",
"display_name",
"=",
"display_name",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.list_instances | List instances owned by the project.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_instances]
:end-before: [END bigtable_list_instances]
:rtype: tuple
:returns:
(instances, failed_locations), where 'instances' is li... | bigtable/google/cloud/bigtable/client.py | def list_instances(self):
"""List instances owned by the project.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_instances]
:end-before: [END bigtable_list_instances]
:rtype: tuple
:returns:
(instances, faile... | def list_instances(self):
"""List instances owned by the project.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_instances]
:end-before: [END bigtable_list_instances]
:rtype: tuple
:returns:
(instances, faile... | [
"List",
"instances",
"owned",
"by",
"the",
"project",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/client.py#L302-L320 | [
"def",
"list_instances",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"instance_admin_client",
".",
"list_instances",
"(",
"self",
".",
"project_path",
")",
"instances",
"=",
"[",
"Instance",
".",
"from_pb",
"(",
"instance",
",",
"self",
")",
"for",
"i... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.list_clusters | List the clusters in the project.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_clusters_in_project]
:end-before: [END bigtable_list_clusters_in_project]
:rtype: tuple
:returns:
(clusters, failed_locations), where '... | bigtable/google/cloud/bigtable/client.py | def list_clusters(self):
"""List the clusters in the project.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_clusters_in_project]
:end-before: [END bigtable_list_clusters_in_project]
:rtype: tuple
:returns:
(... | def list_clusters(self):
"""List the clusters in the project.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_clusters_in_project]
:end-before: [END bigtable_list_clusters_in_project]
:rtype: tuple
:returns:
(... | [
"List",
"the",
"clusters",
"in",
"the",
"project",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/client.py#L322-L349 | [
"def",
"list_clusters",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"instance_admin_client",
".",
"list_clusters",
"(",
"self",
".",
"instance_admin_client",
".",
"instance_path",
"(",
"self",
".",
"project",
",",
"\"-\"",
")",
")",
"clusters",
"=",
"["... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | MetricServiceServicer.DeleteMetricDescriptor | Deletes a metric descriptor. Only user-created
[custom metrics](/monitoring/custom-metrics) can be deleted. | monitoring/google/cloud/monitoring_v3/proto/metric_service_pb2_grpc.py | def DeleteMetricDescriptor(self, request, context):
"""Deletes a metric descriptor. Only user-created
[custom metrics](/monitoring/custom-metrics) can be deleted.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplement... | def DeleteMetricDescriptor(self, request, context):
"""Deletes a metric descriptor. Only user-created
[custom metrics](/monitoring/custom-metrics) can be deleted.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplement... | [
"Deletes",
"a",
"metric",
"descriptor",
".",
"Only",
"user",
"-",
"created",
"[",
"custom",
"metrics",
"]",
"(",
"/",
"monitoring",
"/",
"custom",
"-",
"metrics",
")",
"can",
"be",
"deleted",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/proto/metric_service_pb2_grpc.py#L113-L119 | [
"def",
"DeleteMetricDescriptor",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"context",
".",
"set_code",
"(",
"grpc",
".",
"StatusCode",
".",
"UNIMPLEMENTED",
")",
"context",
".",
"set_details",
"(",
"\"Method not implemented!\"",
")",
"raise",
"NotIm... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ClusterManagerClient.list_clusters | Lists all clusters owned by a project in either the specified zone or all
zones.
Example:
>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `project_id`:
>>> p... | container/google/cloud/container_v1/gapic/cluster_manager_client.py | def list_clusters(
self,
project_id,
zone,
parent=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Lists all clusters owned by a project in either the specified zone or ... | def list_clusters(
self,
project_id,
zone,
parent=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Lists all clusters owned by a project in either the specified zone or ... | [
"Lists",
"all",
"clusters",
"owned",
"by",
"a",
"project",
"in",
"either",
"the",
"specified",
"zone",
"or",
"all",
"zones",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/container/google/cloud/container_v1/gapic/cluster_manager_client.py#L169-L241 | [
"def",
"list_clusters",
"(",
"self",
",",
"project_id",
",",
"zone",
",",
"parent",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ClusterManagerClient.get_cluster | Gets the details of a specific cluster.
Example:
>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `project_id`:
>>> project_id = ''
>>>
>>> # ... | container/google/cloud/container_v1/gapic/cluster_manager_client.py | def get_cluster(
self,
project_id,
zone,
cluster_id,
name=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets the details of a specific cluster.
Examp... | def get_cluster(
self,
project_id,
zone,
cluster_id,
name=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets the details of a specific cluster.
Examp... | [
"Gets",
"the",
"details",
"of",
"a",
"specific",
"cluster",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/container/google/cloud/container_v1/gapic/cluster_manager_client.py#L243-L319 | [
"def",
"get_cluster",
"(",
"self",
",",
"project_id",
",",
"zone",
",",
"cluster_id",
",",
"name",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ClusterManagerClient.set_labels | Sets labels on a cluster.
Example:
>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `project_id`:
>>> project_id = ''
>>>
>>> # TODO: Initiali... | container/google/cloud/container_v1/gapic/cluster_manager_client.py | def set_labels(
self,
project_id,
zone,
cluster_id,
resource_labels,
label_fingerprint,
name=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Set... | def set_labels(
self,
project_id,
zone,
cluster_id,
resource_labels,
label_fingerprint,
name=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Set... | [
"Sets",
"labels",
"on",
"a",
"cluster",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/container/google/cloud/container_v1/gapic/cluster_manager_client.py#L2191-L2287 | [
"def",
"set_labels",
"(",
"self",
",",
"project_id",
",",
"zone",
",",
"cluster_id",
",",
"resource_labels",
",",
"label_fingerprint",
",",
"name",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | MetricsServiceV2Client.metric_path | Return a fully-qualified metric string. | logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py | def metric_path(cls, project, metric):
"""Return a fully-qualified metric string."""
return google.api_core.path_template.expand(
"projects/{project}/metrics/{metric}", project=project, metric=metric
) | def metric_path(cls, project, metric):
"""Return a fully-qualified metric string."""
return google.api_core.path_template.expand(
"projects/{project}/metrics/{metric}", project=project, metric=metric
) | [
"Return",
"a",
"fully",
"-",
"qualified",
"metric",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py#L87-L91 | [
"def",
"metric_path",
"(",
"cls",
",",
"project",
",",
"metric",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/metrics/{metric}\"",
",",
"project",
"=",
"project",
",",
"metric",
"=",
"metric",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | MetricsServiceV2Client.get_log_metric | Gets a logs-based metric.
Example:
>>> from google.cloud import logging_v2
>>>
>>> client = logging_v2.MetricsServiceV2Client()
>>>
>>> metric_name = client.metric_path('[PROJECT]', '[METRIC]')
>>>
>>> response = client.get_log... | logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py | def get_log_metric(
self,
metric_name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets a logs-based metric.
Example:
>>> from google.cloud import logging_v2
... | def get_log_metric(
self,
metric_name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets a logs-based metric.
Example:
>>> from google.cloud import logging_v2
... | [
"Gets",
"a",
"logs",
"-",
"based",
"metric",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py#L299-L370 | [
"def",
"get_log_metric",
"(",
"self",
",",
"metric_name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | MetricServiceClient.metric_descriptor_path | Return a fully-qualified metric_descriptor string. | monitoring/google/cloud/monitoring_v3/gapic/metric_service_client.py | def metric_descriptor_path(cls, project, metric_descriptor):
"""Return a fully-qualified metric_descriptor string."""
return google.api_core.path_template.expand(
"projects/{project}/metricDescriptors/{metric_descriptor=**}",
project=project,
metric_descriptor=metric_... | def metric_descriptor_path(cls, project, metric_descriptor):
"""Return a fully-qualified metric_descriptor string."""
return google.api_core.path_template.expand(
"projects/{project}/metricDescriptors/{metric_descriptor=**}",
project=project,
metric_descriptor=metric_... | [
"Return",
"a",
"fully",
"-",
"qualified",
"metric_descriptor",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/gapic/metric_service_client.py#L96-L102 | [
"def",
"metric_descriptor_path",
"(",
"cls",
",",
"project",
",",
"metric_descriptor",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/metricDescriptors/{metric_descriptor=**}\"",
",",
"project",
"=",
"proje... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | MetricServiceClient.monitored_resource_descriptor_path | Return a fully-qualified monitored_resource_descriptor string. | monitoring/google/cloud/monitoring_v3/gapic/metric_service_client.py | def monitored_resource_descriptor_path(cls, project, monitored_resource_descriptor):
"""Return a fully-qualified monitored_resource_descriptor string."""
return google.api_core.path_template.expand(
"projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}",
... | def monitored_resource_descriptor_path(cls, project, monitored_resource_descriptor):
"""Return a fully-qualified monitored_resource_descriptor string."""
return google.api_core.path_template.expand(
"projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}",
... | [
"Return",
"a",
"fully",
"-",
"qualified",
"monitored_resource_descriptor",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/gapic/metric_service_client.py#L105-L111 | [
"def",
"monitored_resource_descriptor_path",
"(",
"cls",
",",
"project",
",",
"monitored_resource_descriptor",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/monitoredResourceDescriptors/{monitored_resource_descrip... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | KeyRange._to_pb | Construct a KeyRange protobuf.
:rtype: :class:`~google.cloud.spanner_v1.proto.keys_pb2.KeyRange`
:returns: protobuf corresponding to this instance. | spanner/google/cloud/spanner_v1/keyset.py | def _to_pb(self):
"""Construct a KeyRange protobuf.
:rtype: :class:`~google.cloud.spanner_v1.proto.keys_pb2.KeyRange`
:returns: protobuf corresponding to this instance.
"""
kwargs = {}
if self.start_open is not None:
kwargs["start_open"] = _make_list_value_p... | def _to_pb(self):
"""Construct a KeyRange protobuf.
:rtype: :class:`~google.cloud.spanner_v1.proto.keys_pb2.KeyRange`
:returns: protobuf corresponding to this instance.
"""
kwargs = {}
if self.start_open is not None:
kwargs["start_open"] = _make_list_value_p... | [
"Construct",
"a",
"KeyRange",
"protobuf",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/keyset.py#L68-L88 | [
"def",
"_to_pb",
"(",
"self",
")",
":",
"kwargs",
"=",
"{",
"}",
"if",
"self",
".",
"start_open",
"is",
"not",
"None",
":",
"kwargs",
"[",
"\"start_open\"",
"]",
"=",
"_make_list_value_pb",
"(",
"self",
".",
"start_open",
")",
"if",
"self",
".",
"start... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | KeyRange._to_dict | Return keyrange's state as a dict.
:rtype: dict
:returns: state of this instance. | spanner/google/cloud/spanner_v1/keyset.py | def _to_dict(self):
"""Return keyrange's state as a dict.
:rtype: dict
:returns: state of this instance.
"""
mapping = {}
if self.start_open:
mapping["start_open"] = self.start_open
if self.start_closed:
mapping["start_closed"] = self.st... | def _to_dict(self):
"""Return keyrange's state as a dict.
:rtype: dict
:returns: state of this instance.
"""
mapping = {}
if self.start_open:
mapping["start_open"] = self.start_open
if self.start_closed:
mapping["start_closed"] = self.st... | [
"Return",
"keyrange",
"s",
"state",
"as",
"a",
"dict",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/keyset.py#L90-L110 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"mapping",
"=",
"{",
"}",
"if",
"self",
".",
"start_open",
":",
"mapping",
"[",
"\"start_open\"",
"]",
"=",
"self",
".",
"start_open",
"if",
"self",
".",
"start_closed",
":",
"mapping",
"[",
"\"start_closed\"",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | KeySet._to_pb | Construct a KeySet protobuf.
:rtype: :class:`~google.cloud.spanner_v1.proto.keys_pb2.KeySet`
:returns: protobuf corresponding to this instance. | spanner/google/cloud/spanner_v1/keyset.py | def _to_pb(self):
"""Construct a KeySet protobuf.
:rtype: :class:`~google.cloud.spanner_v1.proto.keys_pb2.KeySet`
:returns: protobuf corresponding to this instance.
"""
if self.all_:
return KeySetPB(all=True)
kwargs = {}
if self.keys:
kwa... | def _to_pb(self):
"""Construct a KeySet protobuf.
:rtype: :class:`~google.cloud.spanner_v1.proto.keys_pb2.KeySet`
:returns: protobuf corresponding to this instance.
"""
if self.all_:
return KeySetPB(all=True)
kwargs = {}
if self.keys:
kwa... | [
"Construct",
"a",
"KeySet",
"protobuf",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/keyset.py#L139-L155 | [
"def",
"_to_pb",
"(",
"self",
")",
":",
"if",
"self",
".",
"all_",
":",
"return",
"KeySetPB",
"(",
"all",
"=",
"True",
")",
"kwargs",
"=",
"{",
"}",
"if",
"self",
".",
"keys",
":",
"kwargs",
"[",
"\"keys\"",
"]",
"=",
"_make_list_value_pbs",
"(",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | KeySet._to_dict | Return keyset's state as a dict.
The result can be used to serialize the instance and reconstitute
it later using :meth:`_from_dict`.
:rtype: dict
:returns: state of this instance. | spanner/google/cloud/spanner_v1/keyset.py | def _to_dict(self):
"""Return keyset's state as a dict.
The result can be used to serialize the instance and reconstitute
it later using :meth:`_from_dict`.
:rtype: dict
:returns: state of this instance.
"""
if self.all_:
return {"all": True}
... | def _to_dict(self):
"""Return keyset's state as a dict.
The result can be used to serialize the instance and reconstitute
it later using :meth:`_from_dict`.
:rtype: dict
:returns: state of this instance.
"""
if self.all_:
return {"all": True}
... | [
"Return",
"keyset",
"s",
"state",
"as",
"a",
"dict",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/keyset.py#L157-L172 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"if",
"self",
".",
"all_",
":",
"return",
"{",
"\"all\"",
":",
"True",
"}",
"return",
"{",
"\"keys\"",
":",
"self",
".",
"keys",
",",
"\"ranges\"",
":",
"[",
"keyrange",
".",
"_to_dict",
"(",
")",
"for",
"k... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | KeySet._from_dict | Create an instance from the corresponding state mapping.
:type mapping: dict
:param mapping: the instance state. | spanner/google/cloud/spanner_v1/keyset.py | def _from_dict(cls, mapping):
"""Create an instance from the corresponding state mapping.
:type mapping: dict
:param mapping: the instance state.
"""
if mapping.get("all"):
return cls(all_=True)
r_mappings = mapping.get("ranges", ())
ranges = [KeyRan... | def _from_dict(cls, mapping):
"""Create an instance from the corresponding state mapping.
:type mapping: dict
:param mapping: the instance state.
"""
if mapping.get("all"):
return cls(all_=True)
r_mappings = mapping.get("ranges", ())
ranges = [KeyRan... | [
"Create",
"an",
"instance",
"from",
"the",
"corresponding",
"state",
"mapping",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/keyset.py#L181-L193 | [
"def",
"_from_dict",
"(",
"cls",
",",
"mapping",
")",
":",
"if",
"mapping",
".",
"get",
"(",
"\"all\"",
")",
":",
"return",
"cls",
"(",
"all_",
"=",
"True",
")",
"r_mappings",
"=",
"mapping",
".",
"get",
"(",
"\"ranges\"",
",",
"(",
")",
")",
"rang... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _wrap_unary_errors | Map errors for Unary-Unary and Stream-Unary gRPC callables. | api_core/google/api_core/grpc_helpers.py | def _wrap_unary_errors(callable_):
"""Map errors for Unary-Unary and Stream-Unary gRPC callables."""
_patch_callable_name(callable_)
@six.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
try:
return callable_(*args, **kwargs)
except grpc.RpcError as exc:
... | def _wrap_unary_errors(callable_):
"""Map errors for Unary-Unary and Stream-Unary gRPC callables."""
_patch_callable_name(callable_)
@six.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
try:
return callable_(*args, **kwargs)
except grpc.RpcError as exc:
... | [
"Map",
"errors",
"for",
"Unary",
"-",
"Unary",
"and",
"Stream",
"-",
"Unary",
"gRPC",
"callables",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/grpc_helpers.py#L50-L61 | [
"def",
"_wrap_unary_errors",
"(",
"callable_",
")",
":",
"_patch_callable_name",
"(",
"callable_",
")",
"@",
"six",
".",
"wraps",
"(",
"callable_",
")",
"def",
"error_remapped_callable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"ret... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _wrap_stream_errors | Wrap errors for Unary-Stream and Stream-Stream gRPC callables.
The callables that return iterators require a bit more logic to re-map
errors when iterating. This wraps both the initial invocation and the
iterator of the return value to re-map errors. | api_core/google/api_core/grpc_helpers.py | def _wrap_stream_errors(callable_):
"""Wrap errors for Unary-Stream and Stream-Stream gRPC callables.
The callables that return iterators require a bit more logic to re-map
errors when iterating. This wraps both the initial invocation and the
iterator of the return value to re-map errors.
"""
_... | def _wrap_stream_errors(callable_):
"""Wrap errors for Unary-Stream and Stream-Stream gRPC callables.
The callables that return iterators require a bit more logic to re-map
errors when iterating. This wraps both the initial invocation and the
iterator of the return value to re-map errors.
"""
_... | [
"Wrap",
"errors",
"for",
"Unary",
"-",
"Stream",
"and",
"Stream",
"-",
"Stream",
"gRPC",
"callables",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/grpc_helpers.py#L113-L130 | [
"def",
"_wrap_stream_errors",
"(",
"callable_",
")",
":",
"_patch_callable_name",
"(",
"callable_",
")",
"@",
"general_helpers",
".",
"wraps",
"(",
"callable_",
")",
"def",
"error_remapped_callable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | create_channel | Create a secure channel with credentials.
Args:
target (str): The target service address in the format 'hostname:port'.
credentials (google.auth.credentials.Credentials): The credentials. If
not specified, then this function will attempt to ascertain the
credentials from the... | api_core/google/api_core/grpc_helpers.py | def create_channel(
target, credentials=None, scopes=None, ssl_credentials=None, **kwargs
):
"""Create a secure channel with credentials.
Args:
target (str): The target service address in the format 'hostname:port'.
credentials (google.auth.credentials.Credentials): The credentials. If
... | def create_channel(
target, credentials=None, scopes=None, ssl_credentials=None, **kwargs
):
"""Create a secure channel with credentials.
Args:
target (str): The target service address in the format 'hostname:port'.
credentials (google.auth.credentials.Credentials): The credentials. If
... | [
"Create",
"a",
"secure",
"channel",
"with",
"credentials",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/grpc_helpers.py#L155-L206 | [
"def",
"create_channel",
"(",
"target",
",",
"credentials",
"=",
"None",
",",
"scopes",
"=",
"None",
",",
"ssl_credentials",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"credentials",
"is",
"None",
":",
"credentials",
",",
"_",
"=",
"google",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _StreamingResponseIterator.next | Get the next response from the stream.
Returns:
protobuf.Message: A single response from the stream. | api_core/google/api_core/grpc_helpers.py | def next(self):
"""Get the next response from the stream.
Returns:
protobuf.Message: A single response from the stream.
"""
try:
return six.next(self._wrapped)
except grpc.RpcError as exc:
six.raise_from(exceptions.from_grpc_error(exc), exc) | def next(self):
"""Get the next response from the stream.
Returns:
protobuf.Message: A single response from the stream.
"""
try:
return six.next(self._wrapped)
except grpc.RpcError as exc:
six.raise_from(exceptions.from_grpc_error(exc), exc) | [
"Get",
"the",
"next",
"response",
"from",
"the",
"stream",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/grpc_helpers.py#L72-L81 | [
"def",
"next",
"(",
"self",
")",
":",
"try",
":",
"return",
"six",
".",
"next",
"(",
"self",
".",
"_wrapped",
")",
"except",
"grpc",
".",
"RpcError",
"as",
"exc",
":",
"six",
".",
"raise_from",
"(",
"exceptions",
".",
"from_grpc_error",
"(",
"exc",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | wraps | A functools.wraps helper that handles partial objects on Python 2. | api_core/google/api_core/general_helpers.py | def wraps(wrapped):
"""A functools.wraps helper that handles partial objects on Python 2."""
if isinstance(wrapped, functools.partial):
return six.wraps(wrapped, assigned=_PARTIAL_VALID_ASSIGNMENTS)
else:
return six.wraps(wrapped) | def wraps(wrapped):
"""A functools.wraps helper that handles partial objects on Python 2."""
if isinstance(wrapped, functools.partial):
return six.wraps(wrapped, assigned=_PARTIAL_VALID_ASSIGNMENTS)
else:
return six.wraps(wrapped) | [
"A",
"functools",
".",
"wraps",
"helper",
"that",
"handles",
"partial",
"objects",
"on",
"Python",
"2",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/general_helpers.py#L27-L32 | [
"def",
"wraps",
"(",
"wrapped",
")",
":",
"if",
"isinstance",
"(",
"wrapped",
",",
"functools",
".",
"partial",
")",
":",
"return",
"six",
".",
"wraps",
"(",
"wrapped",
",",
"assigned",
"=",
"_PARTIAL_VALID_ASSIGNMENTS",
")",
"else",
":",
"return",
"six",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _determine_default_project | Determine default project explicitly or implicitly as fall-back.
In implicit case, supports four environments. In order of precedence, the
implicit environments are:
* DATASTORE_DATASET environment variable (for ``gcd`` / emulator testing)
* GOOGLE_CLOUD_PROJECT environment variable
* Google App E... | datastore/google/cloud/datastore/client.py | def _determine_default_project(project=None):
"""Determine default project explicitly or implicitly as fall-back.
In implicit case, supports four environments. In order of precedence, the
implicit environments are:
* DATASTORE_DATASET environment variable (for ``gcd`` / emulator testing)
* GOOGLE_... | def _determine_default_project(project=None):
"""Determine default project explicitly or implicitly as fall-back.
In implicit case, supports four environments. In order of precedence, the
implicit environments are:
* DATASTORE_DATASET environment variable (for ``gcd`` / emulator testing)
* GOOGLE_... | [
"Determine",
"default",
"project",
"explicitly",
"or",
"implicitly",
"as",
"fall",
"-",
"back",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L54-L77 | [
"def",
"_determine_default_project",
"(",
"project",
"=",
"None",
")",
":",
"if",
"project",
"is",
"None",
":",
"project",
"=",
"_get_gcd_project",
"(",
")",
"if",
"project",
"is",
"None",
":",
"project",
"=",
"_base_default_project",
"(",
"project",
"=",
"p... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _extended_lookup | Repeat lookup until all keys found (unless stop requested).
Helper function for :meth:`Client.get_multi`.
:type datastore_api:
:class:`google.cloud.datastore._http.HTTPDatastoreAPI`
or :class:`google.cloud.datastore_v1.gapic.DatastoreClient`
:param datastore_api: The datastore API object u... | datastore/google/cloud/datastore/client.py | def _extended_lookup(
datastore_api,
project,
key_pbs,
missing=None,
deferred=None,
eventual=False,
transaction_id=None,
):
"""Repeat lookup until all keys found (unless stop requested).
Helper function for :meth:`Client.get_multi`.
:type datastore_api:
:class:`google.c... | def _extended_lookup(
datastore_api,
project,
key_pbs,
missing=None,
deferred=None,
eventual=False,
transaction_id=None,
):
"""Repeat lookup until all keys found (unless stop requested).
Helper function for :meth:`Client.get_multi`.
:type datastore_api:
:class:`google.c... | [
"Repeat",
"lookup",
"until",
"all",
"keys",
"found",
"(",
"unless",
"stop",
"requested",
")",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L80-L162 | [
"def",
"_extended_lookup",
"(",
"datastore_api",
",",
"project",
",",
"key_pbs",
",",
"missing",
"=",
"None",
",",
"deferred",
"=",
"None",
",",
"eventual",
"=",
"False",
",",
"transaction_id",
"=",
"None",
",",
")",
":",
"if",
"missing",
"is",
"not",
"N... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client._datastore_api | Getter for a wrapped API object. | datastore/google/cloud/datastore/client.py | def _datastore_api(self):
"""Getter for a wrapped API object."""
if self._datastore_api_internal is None:
if self._use_grpc:
self._datastore_api_internal = make_datastore_api(self)
else:
self._datastore_api_internal = HTTPDatastoreAPI(self)
... | def _datastore_api(self):
"""Getter for a wrapped API object."""
if self._datastore_api_internal is None:
if self._use_grpc:
self._datastore_api_internal = make_datastore_api(self)
else:
self._datastore_api_internal = HTTPDatastoreAPI(self)
... | [
"Getter",
"for",
"a",
"wrapped",
"API",
"object",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L241-L248 | [
"def",
"_datastore_api",
"(",
"self",
")",
":",
"if",
"self",
".",
"_datastore_api_internal",
"is",
"None",
":",
"if",
"self",
".",
"_use_grpc",
":",
"self",
".",
"_datastore_api_internal",
"=",
"make_datastore_api",
"(",
"self",
")",
"else",
":",
"self",
".... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.get | Retrieve an entity from a single key (if it exists).
.. note::
This is just a thin wrapper over :meth:`get_multi`.
The backend API does not make a distinction between a single key or
multiple keys in a lookup request.
:type key: :class:`google.cloud.datastore.key.Key`... | datastore/google/cloud/datastore/client.py | def get(self, key, missing=None, deferred=None, transaction=None, eventual=False):
"""Retrieve an entity from a single key (if it exists).
.. note::
This is just a thin wrapper over :meth:`get_multi`.
The backend API does not make a distinction between a single key or
... | def get(self, key, missing=None, deferred=None, transaction=None, eventual=False):
"""Retrieve an entity from a single key (if it exists).
.. note::
This is just a thin wrapper over :meth:`get_multi`.
The backend API does not make a distinction between a single key or
... | [
"Retrieve",
"an",
"entity",
"from",
"a",
"single",
"key",
"(",
"if",
"it",
"exists",
")",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L296-L340 | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"missing",
"=",
"None",
",",
"deferred",
"=",
"None",
",",
"transaction",
"=",
"None",
",",
"eventual",
"=",
"False",
")",
":",
"entities",
"=",
"self",
".",
"get_multi",
"(",
"keys",
"=",
"[",
"key",
"]"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.get_multi | Retrieve entities, along with their attributes.
:type keys: list of :class:`google.cloud.datastore.key.Key`
:param keys: The keys to be retrieved from the datastore.
:type missing: list
:param missing: (Optional) If a list is passed, the key-only entities
return... | datastore/google/cloud/datastore/client.py | def get_multi(
self, keys, missing=None, deferred=None, transaction=None, eventual=False
):
"""Retrieve entities, along with their attributes.
:type keys: list of :class:`google.cloud.datastore.key.Key`
:param keys: The keys to be retrieved from the datastore.
:type missing... | def get_multi(
self, keys, missing=None, deferred=None, transaction=None, eventual=False
):
"""Retrieve entities, along with their attributes.
:type keys: list of :class:`google.cloud.datastore.key.Key`
:param keys: The keys to be retrieved from the datastore.
:type missing... | [
"Retrieve",
"entities",
"along",
"with",
"their",
"attributes",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L342-L407 | [
"def",
"get_multi",
"(",
"self",
",",
"keys",
",",
"missing",
"=",
"None",
",",
"deferred",
"=",
"None",
",",
"transaction",
"=",
"None",
",",
"eventual",
"=",
"False",
")",
":",
"if",
"not",
"keys",
":",
"return",
"[",
"]",
"ids",
"=",
"set",
"(",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.put_multi | Save entities in the Cloud Datastore.
:type entities: list of :class:`google.cloud.datastore.entity.Entity`
:param entities: The entities to be saved to the datastore.
:raises: :class:`ValueError` if ``entities`` is a single entity. | datastore/google/cloud/datastore/client.py | def put_multi(self, entities):
"""Save entities in the Cloud Datastore.
:type entities: list of :class:`google.cloud.datastore.entity.Entity`
:param entities: The entities to be saved to the datastore.
:raises: :class:`ValueError` if ``entities`` is a single entity.
"""
... | def put_multi(self, entities):
"""Save entities in the Cloud Datastore.
:type entities: list of :class:`google.cloud.datastore.entity.Entity`
:param entities: The entities to be saved to the datastore.
:raises: :class:`ValueError` if ``entities`` is a single entity.
"""
... | [
"Save",
"entities",
"in",
"the",
"Cloud",
"Datastore",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L423-L448 | [
"def",
"put_multi",
"(",
"self",
",",
"entities",
")",
":",
"if",
"isinstance",
"(",
"entities",
",",
"Entity",
")",
":",
"raise",
"ValueError",
"(",
"\"Pass a sequence of entities\"",
")",
"if",
"not",
"entities",
":",
"return",
"current",
"=",
"self",
".",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.delete_multi | Delete keys from the Cloud Datastore.
:type keys: list of :class:`google.cloud.datastore.key.Key`
:param keys: The keys to be deleted from the Datastore. | datastore/google/cloud/datastore/client.py | def delete_multi(self, keys):
"""Delete keys from the Cloud Datastore.
:type keys: list of :class:`google.cloud.datastore.key.Key`
:param keys: The keys to be deleted from the Datastore.
"""
if not keys:
return
# We allow partial keys to attempt a delete, th... | def delete_multi(self, keys):
"""Delete keys from the Cloud Datastore.
:type keys: list of :class:`google.cloud.datastore.key.Key`
:param keys: The keys to be deleted from the Datastore.
"""
if not keys:
return
# We allow partial keys to attempt a delete, th... | [
"Delete",
"keys",
"from",
"the",
"Cloud",
"Datastore",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L464-L485 | [
"def",
"delete_multi",
"(",
"self",
",",
"keys",
")",
":",
"if",
"not",
"keys",
":",
"return",
"# We allow partial keys to attempt a delete, the backend will fail.",
"current",
"=",
"self",
".",
"current_batch",
"in_batch",
"=",
"current",
"is",
"not",
"None",
"if",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.allocate_ids | Allocate a list of IDs from a partial key.
:type incomplete_key: :class:`google.cloud.datastore.key.Key`
:param incomplete_key: Partial key to use as base for allocated IDs.
:type num_ids: int
:param num_ids: The number of IDs to allocate.
:rtype: list of :class:`google.cloud.... | datastore/google/cloud/datastore/client.py | def allocate_ids(self, incomplete_key, num_ids):
"""Allocate a list of IDs from a partial key.
:type incomplete_key: :class:`google.cloud.datastore.key.Key`
:param incomplete_key: Partial key to use as base for allocated IDs.
:type num_ids: int
:param num_ids: The number of IDs... | def allocate_ids(self, incomplete_key, num_ids):
"""Allocate a list of IDs from a partial key.
:type incomplete_key: :class:`google.cloud.datastore.key.Key`
:param incomplete_key: Partial key to use as base for allocated IDs.
:type num_ids: int
:param num_ids: The number of IDs... | [
"Allocate",
"a",
"list",
"of",
"IDs",
"from",
"a",
"partial",
"key",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L487-L516 | [
"def",
"allocate_ids",
"(",
"self",
",",
"incomplete_key",
",",
"num_ids",
")",
":",
"if",
"not",
"incomplete_key",
".",
"is_partial",
":",
"raise",
"ValueError",
"(",
"(",
"\"Key is not partial.\"",
",",
"incomplete_key",
")",
")",
"incomplete_key_pb",
"=",
"in... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.key | Proxy to :class:`google.cloud.datastore.key.Key`.
Passes our ``project``. | datastore/google/cloud/datastore/client.py | def key(self, *path_args, **kwargs):
"""Proxy to :class:`google.cloud.datastore.key.Key`.
Passes our ``project``.
"""
if "project" in kwargs:
raise TypeError("Cannot pass project")
kwargs["project"] = self.project
if "namespace" not in kwargs:
kwa... | def key(self, *path_args, **kwargs):
"""Proxy to :class:`google.cloud.datastore.key.Key`.
Passes our ``project``.
"""
if "project" in kwargs:
raise TypeError("Cannot pass project")
kwargs["project"] = self.project
if "namespace" not in kwargs:
kwa... | [
"Proxy",
"to",
":",
"class",
":",
"google",
".",
"cloud",
".",
"datastore",
".",
"key",
".",
"Key",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L518-L528 | [
"def",
"key",
"(",
"self",
",",
"*",
"path_args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"project\"",
"in",
"kwargs",
":",
"raise",
"TypeError",
"(",
"\"Cannot pass project\"",
")",
"kwargs",
"[",
"\"project\"",
"]",
"=",
"self",
".",
"project",
"if"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.query | Proxy to :class:`google.cloud.datastore.query.Query`.
Passes our ``project``.
Using query to search a datastore:
.. testsetup:: query
import os
import uuid
from google.cloud import datastore
unique = os.getenv('CIRCLE_BUILD_NUM', str(uuid.uui... | datastore/google/cloud/datastore/client.py | def query(self, **kwargs):
"""Proxy to :class:`google.cloud.datastore.query.Query`.
Passes our ``project``.
Using query to search a datastore:
.. testsetup:: query
import os
import uuid
from google.cloud import datastore
unique = os.g... | def query(self, **kwargs):
"""Proxy to :class:`google.cloud.datastore.query.Query`.
Passes our ``project``.
Using query to search a datastore:
.. testsetup:: query
import os
import uuid
from google.cloud import datastore
unique = os.g... | [
"Proxy",
"to",
":",
"class",
":",
"google",
".",
"cloud",
".",
"datastore",
".",
"query",
".",
"Query",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/client.py#L542-L624 | [
"def",
"query",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"client\"",
"in",
"kwargs",
":",
"raise",
"TypeError",
"(",
"\"Cannot pass client\"",
")",
"if",
"\"project\"",
"in",
"kwargs",
":",
"raise",
"TypeError",
"(",
"\"Cannot pass project\"",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | MutationsBatcher.mutate | Add a row to the batch. If the current batch meets one of the size
limits, the batch is sent synchronously.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_batcher_mutate]
:end-before: [END bigtable_batcher_mutate]
:type row: class
... | bigtable/google/cloud/bigtable/batcher.py | def mutate(self, row):
""" Add a row to the batch. If the current batch meets one of the size
limits, the batch is sent synchronously.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_batcher_mutate]
:end-before: [END bigtable_batcher_m... | def mutate(self, row):
""" Add a row to the batch. If the current batch meets one of the size
limits, the batch is sent synchronously.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_batcher_mutate]
:end-before: [END bigtable_batcher_m... | [
"Add",
"a",
"row",
"to",
"the",
"batch",
".",
"If",
"the",
"current",
"batch",
"meets",
"one",
"of",
"the",
"size",
"limits",
"the",
"batch",
"is",
"sent",
"synchronously",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/batcher.py#L67-L104 | [
"def",
"mutate",
"(",
"self",
",",
"row",
")",
":",
"mutation_count",
"=",
"len",
"(",
"row",
".",
"_get_mutations",
"(",
")",
")",
"if",
"mutation_count",
">",
"MAX_MUTATIONS",
":",
"raise",
"MaxMutationsError",
"(",
"\"The row key {} exceeds the number of mutati... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | MutationsBatcher.flush | Sends the current. batch to Cloud Bigtable.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_batcher_flush]
:end-before: [END bigtable_batcher_flush] | bigtable/google/cloud/bigtable/batcher.py | def flush(self):
""" Sends the current. batch to Cloud Bigtable.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_batcher_flush]
:end-before: [END bigtable_batcher_flush]
"""
if len(self.rows) != 0:
self.table.mutate... | def flush(self):
""" Sends the current. batch to Cloud Bigtable.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_batcher_flush]
:end-before: [END bigtable_batcher_flush]
"""
if len(self.rows) != 0:
self.table.mutate... | [
"Sends",
"the",
"current",
".",
"batch",
"to",
"Cloud",
"Bigtable",
".",
"For",
"example",
":"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/batcher.py#L130-L143 | [
"def",
"flush",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"rows",
")",
"!=",
"0",
":",
"self",
".",
"table",
".",
"mutate_rows",
"(",
"self",
".",
"rows",
")",
"self",
".",
"total_mutation_count",
"=",
"0",
"self",
".",
"total_size",
"=... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _parse_topic_path | Verify that a topic path is in the correct format.
.. _resource manager docs: https://cloud.google.com/resource-manager/\
reference/rest/v1beta1/projects#\
Project.FIELDS.project_id
.. _topic spec: https://cloud.google.com/storage/docs/json_api/v1/\... | storage/google/cloud/storage/notification.py | def _parse_topic_path(topic_path):
"""Verify that a topic path is in the correct format.
.. _resource manager docs: https://cloud.google.com/resource-manager/\
reference/rest/v1beta1/projects#\
Project.FIELDS.project_id
.. _topic spec: https://c... | def _parse_topic_path(topic_path):
"""Verify that a topic path is in the correct format.
.. _resource manager docs: https://cloud.google.com/resource-manager/\
reference/rest/v1beta1/projects#\
Project.FIELDS.project_id
.. _topic spec: https://c... | [
"Verify",
"that",
"a",
"topic",
"path",
"is",
"in",
"the",
"correct",
"format",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/notification.py#L355-L389 | [
"def",
"_parse_topic_path",
"(",
"topic_path",
")",
":",
"match",
"=",
"_TOPIC_REF_RE",
".",
"match",
"(",
"topic_path",
")",
"if",
"match",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"_BAD_TOPIC",
".",
"format",
"(",
"topic_path",
")",
")",
"return",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | BucketNotification.from_api_repr | Construct an instance from the JSON repr returned by the server.
See: https://cloud.google.com/storage/docs/json_api/v1/notifications
:type resource: dict
:param resource: JSON repr of the notification
:type bucket: :class:`google.cloud.storage.bucket.Bucket`
:param bucket: Bu... | storage/google/cloud/storage/notification.py | def from_api_repr(cls, resource, bucket):
"""Construct an instance from the JSON repr returned by the server.
See: https://cloud.google.com/storage/docs/json_api/v1/notifications
:type resource: dict
:param resource: JSON repr of the notification
:type bucket: :class:`google.c... | def from_api_repr(cls, resource, bucket):
"""Construct an instance from the JSON repr returned by the server.
See: https://cloud.google.com/storage/docs/json_api/v1/notifications
:type resource: dict
:param resource: JSON repr of the notification
:type bucket: :class:`google.c... | [
"Construct",
"an",
"instance",
"from",
"the",
"JSON",
"repr",
"returned",
"by",
"the",
"server",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/notification.py#L111-L133 | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
",",
"bucket",
")",
":",
"topic_path",
"=",
"resource",
".",
"get",
"(",
"\"topic\"",
")",
"if",
"topic_path",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Resource has no topic\"",
")",
"name",
",",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | BucketNotification._set_properties | Helper for :meth:`reload`.
:type response: dict
:param response: resource mapping from server | storage/google/cloud/storage/notification.py | def _set_properties(self, response):
"""Helper for :meth:`reload`.
:type response: dict
:param response: resource mapping from server
"""
self._properties.clear()
self._properties.update(response) | def _set_properties(self, response):
"""Helper for :meth:`reload`.
:type response: dict
:param response: resource mapping from server
"""
self._properties.clear()
self._properties.update(response) | [
"Helper",
"for",
":",
"meth",
":",
"reload",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/notification.py#L215-L222 | [
"def",
"_set_properties",
"(",
"self",
",",
"response",
")",
":",
"self",
".",
"_properties",
".",
"clear",
"(",
")",
"self",
".",
"_properties",
".",
"update",
"(",
"response",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | BucketNotification.create | API wrapper: create the notification.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/insert
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client`
:param clie... | storage/google/cloud/storage/notification.py | def create(self, client=None):
"""API wrapper: create the notification.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/insert
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.... | def create(self, client=None):
"""API wrapper: create the notification.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/insert
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.... | [
"API",
"wrapper",
":",
"create",
"the",
"notification",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/notification.py#L224-L253 | [
"def",
"create",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"if",
"self",
".",
"notification_id",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"Notification already exists w/ id: {}\"",
".",
"format",
"(",
"self",
".",
"notification_id",
")"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | BucketNotification.exists | Test whether this notification exists.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/get
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
... | storage/google/cloud/storage/notification.py | def exists(self, client=None):
"""Test whether this notification exists.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/get
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.st... | def exists(self, client=None):
"""Test whether this notification exists.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/get
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.st... | [
"Test",
"whether",
"this",
"notification",
"exists",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/notification.py#L255-L289 | [
"def",
"exists",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"if",
"self",
".",
"notification_id",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Notification not intialized by server\"",
")",
"client",
"=",
"self",
".",
"_require_client",
"(",
"clie... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | BucketNotification.reload | Update this notification from the server configuration.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/get
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
... | storage/google/cloud/storage/notification.py | def reload(self, client=None):
"""Update this notification from the server configuration.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/get
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:... | def reload(self, client=None):
"""Update this notification from the server configuration.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/get
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:... | [
"Update",
"this",
"notification",
"from",
"the",
"server",
"configuration",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/notification.py#L291-L321 | [
"def",
"reload",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"if",
"self",
".",
"notification_id",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Notification not intialized by server\"",
")",
"client",
"=",
"self",
".",
"_require_client",
"(",
"clie... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | BucketNotification.delete | Delete this notification.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/delete
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``None... | storage/google/cloud/storage/notification.py | def delete(self, client=None):
"""Delete this notification.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/delete
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.clie... | def delete(self, client=None):
"""Delete this notification.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/delete
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.clie... | [
"Delete",
"this",
"notification",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/notification.py#L323-L352 | [
"def",
"delete",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"if",
"self",
".",
"notification_id",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Notification not intialized by server\"",
")",
"client",
"=",
"self",
".",
"_require_client",
"(",
"clie... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | CloudRedisClient.create_instance | Creates a Redis instance based on the specified tier and memory size.
By default, the instance is accessible from the project's `default
network <https://cloud.google.com/compute/docs/networks-and-firewalls#networks>`__.
The creation is executed asynchronously and callers may check the
... | redis/google/cloud/redis_v1/gapic/cloud_redis_client.py | def create_instance(
self,
parent,
instance_id,
instance,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a Redis instance based on the specified tier and memory size... | def create_instance(
self,
parent,
instance_id,
instance,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a Redis instance based on the specified tier and memory size... | [
"Creates",
"a",
"Redis",
"instance",
"based",
"on",
"the",
"specified",
"tier",
"and",
"memory",
"size",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/redis/google/cloud/redis_v1/gapic/cloud_redis_client.py#L367-L471 | [
"def",
"create_instance",
"(",
"self",
",",
"parent",
",",
"instance_id",
",",
"instance",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | CloudRedisClient.import_instance | Import a Redis RDB snapshot file from GCS into a Redis instance.
Redis may stop serving during this operation. Instance state will be
IMPORTING for entire operation. When complete, the instance will contain
only data from the imported file.
The returned operation is automatically delet... | redis/google/cloud/redis_v1/gapic/cloud_redis_client.py | def import_instance(
self,
name,
input_config,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Import a Redis RDB snapshot file from GCS into a Redis instance.
Redis may sto... | def import_instance(
self,
name,
input_config,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Import a Redis RDB snapshot file from GCS into a Redis instance.
Redis may sto... | [
"Import",
"a",
"Redis",
"RDB",
"snapshot",
"file",
"from",
"GCS",
"into",
"a",
"Redis",
"instance",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/redis/google/cloud/redis_v1/gapic/cloud_redis_client.py#L646-L734 | [
"def",
"import_instance",
"(",
"self",
",",
"name",
",",
"input_config",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"D... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | NotificationChannelServiceClient.notification_channel_path | Return a fully-qualified notification_channel string. | monitoring/google/cloud/monitoring_v3/gapic/notification_channel_service_client.py | def notification_channel_path(cls, project, notification_channel):
"""Return a fully-qualified notification_channel string."""
return google.api_core.path_template.expand(
"projects/{project}/notificationChannels/{notification_channel}",
project=project,
notification_... | def notification_channel_path(cls, project, notification_channel):
"""Return a fully-qualified notification_channel string."""
return google.api_core.path_template.expand(
"projects/{project}/notificationChannels/{notification_channel}",
project=project,
notification_... | [
"Return",
"a",
"fully",
"-",
"qualified",
"notification_channel",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/gapic/notification_channel_service_client.py#L101-L107 | [
"def",
"notification_channel_path",
"(",
"cls",
",",
"project",
",",
"notification_channel",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/notificationChannels/{notification_channel}\"",
",",
"project",
"=",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | NotificationChannelServiceClient.notification_channel_descriptor_path | Return a fully-qualified notification_channel_descriptor string. | monitoring/google/cloud/monitoring_v3/gapic/notification_channel_service_client.py | def notification_channel_descriptor_path(cls, project, channel_descriptor):
"""Return a fully-qualified notification_channel_descriptor string."""
return google.api_core.path_template.expand(
"projects/{project}/notificationChannelDescriptors/{channel_descriptor}",
project=projec... | def notification_channel_descriptor_path(cls, project, channel_descriptor):
"""Return a fully-qualified notification_channel_descriptor string."""
return google.api_core.path_template.expand(
"projects/{project}/notificationChannelDescriptors/{channel_descriptor}",
project=projec... | [
"Return",
"a",
"fully",
"-",
"qualified",
"notification_channel_descriptor",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/gapic/notification_channel_service_client.py#L110-L116 | [
"def",
"notification_channel_descriptor_path",
"(",
"cls",
",",
"project",
",",
"channel_descriptor",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/notificationChannelDescriptors/{channel_descriptor}\"",
",",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Logger.batch | Return a batch to use as a context manager.
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not passed, falls back to the
``client`` stored on the current topic.
:rtype: :class:`Batch`... | logging/google/cloud/logging/logger.py | def batch(self, client=None):
"""Return a batch to use as a context manager.
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not passed, falls back to the
``client`` stored on the curre... | def batch(self, client=None):
"""Return a batch to use as a context manager.
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not passed, falls back to the
``client`` stored on the curre... | [
"Return",
"a",
"batch",
"to",
"use",
"as",
"a",
"context",
"manager",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L102-L114 | [
"def",
"batch",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"return",
"Batch",
"(",
"self",
",",
"client",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Logger._do_log | Helper for :meth:`log_empty`, :meth:`log_text`, etc. | logging/google/cloud/logging/logger.py | def _do_log(self, client, _entry_class, payload=None, **kw):
"""Helper for :meth:`log_empty`, :meth:`log_text`, etc.
"""
client = self._require_client(client)
# Apply defaults
kw["log_name"] = kw.pop("log_name", self.full_name)
kw["labels"] = kw.pop("labels", self.labels... | def _do_log(self, client, _entry_class, payload=None, **kw):
"""Helper for :meth:`log_empty`, :meth:`log_text`, etc.
"""
client = self._require_client(client)
# Apply defaults
kw["log_name"] = kw.pop("log_name", self.full_name)
kw["labels"] = kw.pop("labels", self.labels... | [
"Helper",
"for",
":",
"meth",
":",
"log_empty",
":",
"meth",
":",
"log_text",
"etc",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L116-L132 | [
"def",
"_do_log",
"(",
"self",
",",
"client",
",",
"_entry_class",
",",
"payload",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"# Apply defaults",
"kw",
"[",
"\"log_name\"",
"]",
"=",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Logger.log_text | API call: log a text message via a POST request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write
:type text: str
:param text: the log message.
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
... | logging/google/cloud/logging/logger.py | def log_text(self, text, client=None, **kw):
"""API call: log a text message via a POST request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write
:type text: str
:param text: the log message.
:type client: :class:`~google.cloud.logging.clien... | def log_text(self, text, client=None, **kw):
"""API call: log a text message via a POST request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write
:type text: str
:param text: the log message.
:type client: :class:`~google.cloud.logging.clien... | [
"API",
"call",
":",
"log",
"a",
"text",
"message",
"via",
"a",
"POST",
"request"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L151-L169 | [
"def",
"log_text",
"(",
"self",
",",
"text",
",",
"client",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"_do_log",
"(",
"client",
",",
"TextEntry",
",",
"text",
",",
"*",
"*",
"kw",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Logger.log_struct | API call: log a structured message via a POST request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write
:type info: dict
:param info: the log entry information
:type client: :class:`~google.cloud.logging.client.Client` or
``Non... | logging/google/cloud/logging/logger.py | def log_struct(self, info, client=None, **kw):
"""API call: log a structured message via a POST request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write
:type info: dict
:param info: the log entry information
:type client: :class:`~google.c... | def log_struct(self, info, client=None, **kw):
"""API call: log a structured message via a POST request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write
:type info: dict
:param info: the log entry information
:type client: :class:`~google.c... | [
"API",
"call",
":",
"log",
"a",
"structured",
"message",
"via",
"a",
"POST",
"request"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L171-L189 | [
"def",
"log_struct",
"(",
"self",
",",
"info",
",",
"client",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"_do_log",
"(",
"client",
",",
"StructEntry",
",",
"info",
",",
"*",
"*",
"kw",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Logger.log_proto | API call: log a protobuf message via a POST request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list
:type message: :class:`~google.protobuf.message.Message`
:param message: The protobuf message to be logged.
:type client: :class:`~google.cloud.logg... | logging/google/cloud/logging/logger.py | def log_proto(self, message, client=None, **kw):
"""API call: log a protobuf message via a POST request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list
:type message: :class:`~google.protobuf.message.Message`
:param message: The protobuf message to ... | def log_proto(self, message, client=None, **kw):
"""API call: log a protobuf message via a POST request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list
:type message: :class:`~google.protobuf.message.Message`
:param message: The protobuf message to ... | [
"API",
"call",
":",
"log",
"a",
"protobuf",
"message",
"via",
"a",
"POST",
"request"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L191-L209 | [
"def",
"log_proto",
"(",
"self",
",",
"message",
",",
"client",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"_do_log",
"(",
"client",
",",
"ProtobufEntry",
",",
"message",
",",
"*",
"*",
"kw",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Logger.delete | API call: delete all entries in a logger via a DELETE request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs/delete
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not ... | logging/google/cloud/logging/logger.py | def delete(self, client=None):
"""API call: delete all entries in a logger via a DELETE request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs/delete
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
... | def delete(self, client=None):
"""API call: delete all entries in a logger via a DELETE request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs/delete
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
... | [
"API",
"call",
":",
"delete",
"all",
"entries",
"in",
"a",
"logger",
"via",
"a",
"DELETE",
"request"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L211-L223 | [
"def",
"delete",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"client",
".",
"logging_api",
".",
"logger_delete",
"(",
"self",
".",
"project",
",",
"self",
".",
"name",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Logger.list_entries | Return a page of log entries.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list
:type projects: list of strings
:param projects: project IDs to include. If not passed,
defaults to the project bound to the client.
:type filt... | logging/google/cloud/logging/logger.py | def list_entries(
self,
projects=None,
filter_=None,
order_by=None,
page_size=None,
page_token=None,
):
"""Return a page of log entries.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list
:type projects: list ... | def list_entries(
self,
projects=None,
filter_=None,
order_by=None,
page_size=None,
page_token=None,
):
"""Return a page of log entries.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list
:type projects: list ... | [
"Return",
"a",
"page",
"of",
"log",
"entries",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L225-L280 | [
"def",
"list_entries",
"(",
"self",
",",
"projects",
"=",
"None",
",",
"filter_",
"=",
"None",
",",
"order_by",
"=",
"None",
",",
"page_size",
"=",
"None",
",",
"page_token",
"=",
"None",
",",
")",
":",
"log_filter",
"=",
"\"logName=%s\"",
"%",
"(",
"s... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Batch.log_text | Add a text entry to be logged during :meth:`commit`.
:type text: str
:param text: the text entry
:type kw: dict
:param kw: (optional) additional keyword arguments for the entry.
See :class:`~google.cloud.logging.entries.LogEntry`. | logging/google/cloud/logging/logger.py | def log_text(self, text, **kw):
"""Add a text entry to be logged during :meth:`commit`.
:type text: str
:param text: the text entry
:type kw: dict
:param kw: (optional) additional keyword arguments for the entry.
See :class:`~google.cloud.logging.entries.LogE... | def log_text(self, text, **kw):
"""Add a text entry to be logged during :meth:`commit`.
:type text: str
:param text: the text entry
:type kw: dict
:param kw: (optional) additional keyword arguments for the entry.
See :class:`~google.cloud.logging.entries.LogE... | [
"Add",
"a",
"text",
"entry",
"to",
"be",
"logged",
"during",
":",
"meth",
":",
"commit",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L326-L336 | [
"def",
"log_text",
"(",
"self",
",",
"text",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"entries",
".",
"append",
"(",
"TextEntry",
"(",
"payload",
"=",
"text",
",",
"*",
"*",
"kw",
")",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Batch.log_struct | Add a struct entry to be logged during :meth:`commit`.
:type info: dict
:param info: the struct entry
:type kw: dict
:param kw: (optional) additional keyword arguments for the entry.
See :class:`~google.cloud.logging.entries.LogEntry`. | logging/google/cloud/logging/logger.py | def log_struct(self, info, **kw):
"""Add a struct entry to be logged during :meth:`commit`.
:type info: dict
:param info: the struct entry
:type kw: dict
:param kw: (optional) additional keyword arguments for the entry.
See :class:`~google.cloud.logging.entri... | def log_struct(self, info, **kw):
"""Add a struct entry to be logged during :meth:`commit`.
:type info: dict
:param info: the struct entry
:type kw: dict
:param kw: (optional) additional keyword arguments for the entry.
See :class:`~google.cloud.logging.entri... | [
"Add",
"a",
"struct",
"entry",
"to",
"be",
"logged",
"during",
":",
"meth",
":",
"commit",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L338-L348 | [
"def",
"log_struct",
"(",
"self",
",",
"info",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"entries",
".",
"append",
"(",
"StructEntry",
"(",
"payload",
"=",
"info",
",",
"*",
"*",
"kw",
")",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Batch.log_proto | Add a protobuf entry to be logged during :meth:`commit`.
:type message: protobuf message
:param message: the protobuf entry
:type kw: dict
:param kw: (optional) additional keyword arguments for the entry.
See :class:`~google.cloud.logging.entries.LogEntry`. | logging/google/cloud/logging/logger.py | def log_proto(self, message, **kw):
"""Add a protobuf entry to be logged during :meth:`commit`.
:type message: protobuf message
:param message: the protobuf entry
:type kw: dict
:param kw: (optional) additional keyword arguments for the entry.
See :class:`~go... | def log_proto(self, message, **kw):
"""Add a protobuf entry to be logged during :meth:`commit`.
:type message: protobuf message
:param message: the protobuf entry
:type kw: dict
:param kw: (optional) additional keyword arguments for the entry.
See :class:`~go... | [
"Add",
"a",
"protobuf",
"entry",
"to",
"be",
"logged",
"during",
":",
"meth",
":",
"commit",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L350-L360 | [
"def",
"log_proto",
"(",
"self",
",",
"message",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"entries",
".",
"append",
"(",
"ProtobufEntry",
"(",
"payload",
"=",
"message",
",",
"*",
"*",
"kw",
")",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Batch.commit | Send saved log entries as a single API call.
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not passed, falls back to the
``client`` stored on the current batch. | logging/google/cloud/logging/logger.py | def commit(self, client=None):
"""Send saved log entries as a single API call.
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not passed, falls back to the
``client`` stored on the cur... | def commit(self, client=None):
"""Send saved log entries as a single API call.
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not passed, falls back to the
``client`` stored on the cur... | [
"Send",
"saved",
"log",
"entries",
"as",
"a",
"single",
"API",
"call",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/logger.py#L362-L384 | [
"def",
"commit",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"if",
"client",
"is",
"None",
":",
"client",
"=",
"self",
".",
"client",
"kwargs",
"=",
"{",
"\"logger_name\"",
":",
"self",
".",
"logger",
".",
"full_name",
"}",
"if",
"self",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Config.full_name | Fully-qualified name of this variable.
Example:
``projects/my-project/configs/my-config``
:rtype: str
:returns: The full name based on project and config names.
:raises: :class:`ValueError` if the config is missing a name. | runtimeconfig/google/cloud/runtimeconfig/config.py | def full_name(self):
"""Fully-qualified name of this variable.
Example:
``projects/my-project/configs/my-config``
:rtype: str
:returns: The full name based on project and config names.
:raises: :class:`ValueError` if the config is missing a name.
"""
if... | def full_name(self):
"""Fully-qualified name of this variable.
Example:
``projects/my-project/configs/my-config``
:rtype: str
:returns: The full name based on project and config names.
:raises: :class:`ValueError` if the config is missing a name.
"""
if... | [
"Fully",
"-",
"qualified",
"name",
"of",
"this",
"variable",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/runtimeconfig/google/cloud/runtimeconfig/config.py#L74-L87 | [
"def",
"full_name",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"name",
":",
"raise",
"ValueError",
"(",
"\"Missing config name.\"",
")",
"return",
"\"projects/%s/configs/%s\"",
"%",
"(",
"self",
".",
"_client",
".",
"project",
",",
"self",
".",
"name",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Config._set_properties | Update properties from resource in body of ``api_response``
:type api_response: dict
:param api_response: response returned from an API call | runtimeconfig/google/cloud/runtimeconfig/config.py | def _set_properties(self, api_response):
"""Update properties from resource in body of ``api_response``
:type api_response: dict
:param api_response: response returned from an API call
"""
self._properties.clear()
cleaned = api_response.copy()
if "name" in cleane... | def _set_properties(self, api_response):
"""Update properties from resource in body of ``api_response``
:type api_response: dict
:param api_response: response returned from an API call
"""
self._properties.clear()
cleaned = api_response.copy()
if "name" in cleane... | [
"Update",
"properties",
"from",
"resource",
"in",
"body",
"of",
"api_response"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/runtimeconfig/google/cloud/runtimeconfig/config.py#L128-L138 | [
"def",
"_set_properties",
"(",
"self",
",",
"api_response",
")",
":",
"self",
".",
"_properties",
".",
"clear",
"(",
")",
"cleaned",
"=",
"api_response",
".",
"copy",
"(",
")",
"if",
"\"name\"",
"in",
"cleaned",
":",
"self",
".",
"name",
"=",
"config_nam... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Config.reload | API call: reload the config via a ``GET`` request.
This method will reload the newest data for the config.
See
https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs/get
:type client: :class:`google.cloud.runtimeconfig.client.Client`
... | runtimeconfig/google/cloud/runtimeconfig/config.py | def reload(self, client=None):
"""API call: reload the config via a ``GET`` request.
This method will reload the newest data for the config.
See
https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs/get
:type client: :class:`... | def reload(self, client=None):
"""API call: reload the config via a ``GET`` request.
This method will reload the newest data for the config.
See
https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs/get
:type client: :class:`... | [
"API",
"call",
":",
"reload",
"the",
"config",
"via",
"a",
"GET",
"request",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/runtimeconfig/google/cloud/runtimeconfig/config.py#L163-L181 | [
"def",
"reload",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"# We assume the config exists. If it doesn't it will raise a NotFound",
"# exception.",
"resp",
"=",
"client",
".",
"_connection",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Config.get_variable | API call: get a variable via a ``GET`` request.
This will return None if the variable doesn't exist::
>>> from google.cloud import runtimeconfig
>>> client = runtimeconfig.Client()
>>> config = client.config('my-config')
>>> print(config.get_variable('variable-name'))
... | runtimeconfig/google/cloud/runtimeconfig/config.py | def get_variable(self, variable_name, client=None):
"""API call: get a variable via a ``GET`` request.
This will return None if the variable doesn't exist::
>>> from google.cloud import runtimeconfig
>>> client = runtimeconfig.Client()
>>> config = client.config('my-conf... | def get_variable(self, variable_name, client=None):
"""API call: get a variable via a ``GET`` request.
This will return None if the variable doesn't exist::
>>> from google.cloud import runtimeconfig
>>> client = runtimeconfig.Client()
>>> config = client.config('my-conf... | [
"API",
"call",
":",
"get",
"a",
"variable",
"via",
"a",
"GET",
"request",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/runtimeconfig/google/cloud/runtimeconfig/config.py#L183-L213 | [
"def",
"get_variable",
"(",
"self",
",",
"variable_name",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"variable",
"=",
"Variable",
"(",
"config",
"=",
"self",
",",
"name",
"=",
"variable_name",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Config.list_variables | API call: list variables for this config.
This only lists variable names, not the values.
See
https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/list
:type page_size: int
:param page_size:
Optional. T... | runtimeconfig/google/cloud/runtimeconfig/config.py | def list_variables(self, page_size=None, page_token=None, client=None):
"""API call: list variables for this config.
This only lists variable names, not the values.
See
https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/l... | def list_variables(self, page_size=None, page_token=None, client=None):
"""API call: list variables for this config.
This only lists variable names, not the values.
See
https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/l... | [
"API",
"call",
":",
"list",
"variables",
"for",
"this",
"config",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/runtimeconfig/google/cloud/runtimeconfig/config.py#L215-L260 | [
"def",
"list_variables",
"(",
"self",
",",
"page_size",
"=",
"None",
",",
"page_token",
"=",
"None",
",",
"client",
"=",
"None",
")",
":",
"path",
"=",
"\"%s/variables\"",
"%",
"(",
"self",
".",
"path",
",",
")",
"client",
"=",
"self",
".",
"_require_c... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _bytes_from_json | Base64-decode value | bigquery/google/cloud/bigquery/_helpers.py | def _bytes_from_json(value, field):
"""Base64-decode value"""
if _not_null(value, field):
return base64.standard_b64decode(_to_bytes(value)) | def _bytes_from_json(value, field):
"""Base64-decode value"""
if _not_null(value, field):
return base64.standard_b64decode(_to_bytes(value)) | [
"Base64",
"-",
"decode",
"value"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L68-L71 | [
"def",
"_bytes_from_json",
"(",
"value",
",",
"field",
")",
":",
"if",
"_not_null",
"(",
"value",
",",
"field",
")",
":",
"return",
"base64",
".",
"standard_b64decode",
"(",
"_to_bytes",
"(",
"value",
")",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _timestamp_query_param_from_json | Coerce 'value' to a datetime, if set or not nullable.
Args:
value (str): The timestamp.
field (.SchemaField): The field corresponding to the value.
Returns:
Optional[datetime.datetime]: The parsed datetime object from
``value`` if the ``field`` is not null (otherwise it is
... | bigquery/google/cloud/bigquery/_helpers.py | def _timestamp_query_param_from_json(value, field):
"""Coerce 'value' to a datetime, if set or not nullable.
Args:
value (str): The timestamp.
field (.SchemaField): The field corresponding to the value.
Returns:
Optional[datetime.datetime]: The parsed datetime object from
`... | def _timestamp_query_param_from_json(value, field):
"""Coerce 'value' to a datetime, if set or not nullable.
Args:
value (str): The timestamp.
field (.SchemaField): The field corresponding to the value.
Returns:
Optional[datetime.datetime]: The parsed datetime object from
`... | [
"Coerce",
"value",
"to",
"a",
"datetime",
"if",
"set",
"or",
"not",
"nullable",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L81-L113 | [
"def",
"_timestamp_query_param_from_json",
"(",
"value",
",",
"field",
")",
":",
"if",
"_not_null",
"(",
"value",
",",
"field",
")",
":",
"# Canonical formats for timestamps in BigQuery are flexible. See:",
"# g.co/cloud/bigquery/docs/reference/standard-sql/data-types#timestamp-typ... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _datetime_from_json | Coerce 'value' to a datetime, if set or not nullable.
Args:
value (str): The timestamp.
field (.SchemaField): The field corresponding to the value.
Returns:
Optional[datetime.datetime]: The parsed datetime object from
``value`` if the ``field`` is not null (otherwise it is
... | bigquery/google/cloud/bigquery/_helpers.py | def _datetime_from_json(value, field):
"""Coerce 'value' to a datetime, if set or not nullable.
Args:
value (str): The timestamp.
field (.SchemaField): The field corresponding to the value.
Returns:
Optional[datetime.datetime]: The parsed datetime object from
``value`` if t... | def _datetime_from_json(value, field):
"""Coerce 'value' to a datetime, if set or not nullable.
Args:
value (str): The timestamp.
field (.SchemaField): The field corresponding to the value.
Returns:
Optional[datetime.datetime]: The parsed datetime object from
``value`` if t... | [
"Coerce",
"value",
"to",
"a",
"datetime",
"if",
"set",
"or",
"not",
"nullable",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L116-L136 | [
"def",
"_datetime_from_json",
"(",
"value",
",",
"field",
")",
":",
"if",
"_not_null",
"(",
"value",
",",
"field",
")",
":",
"if",
"\".\"",
"in",
"value",
":",
"# YYYY-MM-DDTHH:MM:SS.ffffff",
"return",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"valu... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _time_from_json | Coerce 'value' to a datetime date, if set or not nullable | bigquery/google/cloud/bigquery/_helpers.py | def _time_from_json(value, field):
"""Coerce 'value' to a datetime date, if set or not nullable"""
if _not_null(value, field):
if len(value) == 8: # HH:MM:SS
fmt = _TIMEONLY_WO_MICROS
elif len(value) == 15: # HH:MM:SS.micros
fmt = _TIMEONLY_W_MICROS
else:
... | def _time_from_json(value, field):
"""Coerce 'value' to a datetime date, if set or not nullable"""
if _not_null(value, field):
if len(value) == 8: # HH:MM:SS
fmt = _TIMEONLY_WO_MICROS
elif len(value) == 15: # HH:MM:SS.micros
fmt = _TIMEONLY_W_MICROS
else:
... | [
"Coerce",
"value",
"to",
"a",
"datetime",
"date",
"if",
"set",
"or",
"not",
"nullable"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L146-L155 | [
"def",
"_time_from_json",
"(",
"value",
",",
"field",
")",
":",
"if",
"_not_null",
"(",
"value",
",",
"field",
")",
":",
"if",
"len",
"(",
"value",
")",
"==",
"8",
":",
"# HH:MM:SS",
"fmt",
"=",
"_TIMEONLY_WO_MICROS",
"elif",
"len",
"(",
"value",
")",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _record_from_json | Coerce 'value' to a mapping, if set or not nullable. | bigquery/google/cloud/bigquery/_helpers.py | def _record_from_json(value, field):
"""Coerce 'value' to a mapping, if set or not nullable."""
if _not_null(value, field):
record = {}
record_iter = zip(field.fields, value["f"])
for subfield, cell in record_iter:
converter = _CELLDATA_FROM_JSON[subfield.field_type]
... | def _record_from_json(value, field):
"""Coerce 'value' to a mapping, if set or not nullable."""
if _not_null(value, field):
record = {}
record_iter = zip(field.fields, value["f"])
for subfield, cell in record_iter:
converter = _CELLDATA_FROM_JSON[subfield.field_type]
... | [
"Coerce",
"value",
"to",
"a",
"mapping",
"if",
"set",
"or",
"not",
"nullable",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L158-L170 | [
"def",
"_record_from_json",
"(",
"value",
",",
"field",
")",
":",
"if",
"_not_null",
"(",
"value",
",",
"field",
")",
":",
"record",
"=",
"{",
"}",
"record_iter",
"=",
"zip",
"(",
"field",
".",
"fields",
",",
"value",
"[",
"\"f\"",
"]",
")",
"for",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _row_tuple_from_json | Convert JSON row data to row with appropriate types.
Note: ``row['f']`` and ``schema`` are presumed to be of the same length.
:type row: dict
:param row: A JSON response row to be converted.
:type schema: tuple
:param schema: A tuple of
:class:`~google.cloud.bigquery.schema.Sc... | bigquery/google/cloud/bigquery/_helpers.py | def _row_tuple_from_json(row, schema):
"""Convert JSON row data to row with appropriate types.
Note: ``row['f']`` and ``schema`` are presumed to be of the same length.
:type row: dict
:param row: A JSON response row to be converted.
:type schema: tuple
:param schema: A tuple of
... | def _row_tuple_from_json(row, schema):
"""Convert JSON row data to row with appropriate types.
Note: ``row['f']`` and ``schema`` are presumed to be of the same length.
:type row: dict
:param row: A JSON response row to be converted.
:type schema: tuple
:param schema: A tuple of
... | [
"Convert",
"JSON",
"row",
"data",
"to",
"row",
"with",
"appropriate",
"types",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L200-L223 | [
"def",
"_row_tuple_from_json",
"(",
"row",
",",
"schema",
")",
":",
"row_data",
"=",
"[",
"]",
"for",
"field",
",",
"cell",
"in",
"zip",
"(",
"schema",
",",
"row",
"[",
"\"f\"",
"]",
")",
":",
"converter",
"=",
"_CELLDATA_FROM_JSON",
"[",
"field",
".",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _rows_from_json | Convert JSON row data to rows with appropriate types. | bigquery/google/cloud/bigquery/_helpers.py | def _rows_from_json(values, schema):
"""Convert JSON row data to rows with appropriate types."""
from google.cloud.bigquery import Row
field_to_index = _field_to_index_mapping(schema)
return [Row(_row_tuple_from_json(r, schema), field_to_index) for r in values] | def _rows_from_json(values, schema):
"""Convert JSON row data to rows with appropriate types."""
from google.cloud.bigquery import Row
field_to_index = _field_to_index_mapping(schema)
return [Row(_row_tuple_from_json(r, schema), field_to_index) for r in values] | [
"Convert",
"JSON",
"row",
"data",
"to",
"rows",
"with",
"appropriate",
"types",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L226-L231 | [
"def",
"_rows_from_json",
"(",
"values",
",",
"schema",
")",
":",
"from",
"google",
".",
"cloud",
".",
"bigquery",
"import",
"Row",
"field_to_index",
"=",
"_field_to_index_mapping",
"(",
"schema",
")",
"return",
"[",
"Row",
"(",
"_row_tuple_from_json",
"(",
"r... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _decimal_to_json | Coerce 'value' to a JSON-compatible representation. | bigquery/google/cloud/bigquery/_helpers.py | def _decimal_to_json(value):
"""Coerce 'value' to a JSON-compatible representation."""
if isinstance(value, decimal.Decimal):
value = str(value)
return value | def _decimal_to_json(value):
"""Coerce 'value' to a JSON-compatible representation."""
if isinstance(value, decimal.Decimal):
value = str(value)
return value | [
"Coerce",
"value",
"to",
"a",
"JSON",
"-",
"compatible",
"representation",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L246-L250 | [
"def",
"_decimal_to_json",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"decimal",
".",
"Decimal",
")",
":",
"value",
"=",
"str",
"(",
"value",
")",
"return",
"value"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _bytes_to_json | Coerce 'value' to an JSON-compatible representation. | bigquery/google/cloud/bigquery/_helpers.py | def _bytes_to_json(value):
"""Coerce 'value' to an JSON-compatible representation."""
if isinstance(value, bytes):
value = base64.standard_b64encode(value).decode("ascii")
return value | def _bytes_to_json(value):
"""Coerce 'value' to an JSON-compatible representation."""
if isinstance(value, bytes):
value = base64.standard_b64encode(value).decode("ascii")
return value | [
"Coerce",
"value",
"to",
"an",
"JSON",
"-",
"compatible",
"representation",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L260-L264 | [
"def",
"_bytes_to_json",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"bytes",
")",
":",
"value",
"=",
"base64",
".",
"standard_b64encode",
"(",
"value",
")",
".",
"decode",
"(",
"\"ascii\"",
")",
"return",
"value"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _timestamp_to_json_parameter | Coerce 'value' to an JSON-compatible representation.
This version returns the string representation used in query parameters. | bigquery/google/cloud/bigquery/_helpers.py | def _timestamp_to_json_parameter(value):
"""Coerce 'value' to an JSON-compatible representation.
This version returns the string representation used in query parameters.
"""
if isinstance(value, datetime.datetime):
if value.tzinfo not in (None, UTC):
# Convert to UTC and remove the ... | def _timestamp_to_json_parameter(value):
"""Coerce 'value' to an JSON-compatible representation.
This version returns the string representation used in query parameters.
"""
if isinstance(value, datetime.datetime):
if value.tzinfo not in (None, UTC):
# Convert to UTC and remove the ... | [
"Coerce",
"value",
"to",
"an",
"JSON",
"-",
"compatible",
"representation",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L267-L277 | [
"def",
"_timestamp_to_json_parameter",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"datetime",
".",
"datetime",
")",
":",
"if",
"value",
".",
"tzinfo",
"not",
"in",
"(",
"None",
",",
"UTC",
")",
":",
"# Convert to UTC and remove the time zon... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _timestamp_to_json_row | Coerce 'value' to an JSON-compatible representation.
This version returns floating-point seconds value used in row data. | bigquery/google/cloud/bigquery/_helpers.py | def _timestamp_to_json_row(value):
"""Coerce 'value' to an JSON-compatible representation.
This version returns floating-point seconds value used in row data.
"""
if isinstance(value, datetime.datetime):
value = _microseconds_from_datetime(value) * 1e-6
return value | def _timestamp_to_json_row(value):
"""Coerce 'value' to an JSON-compatible representation.
This version returns floating-point seconds value used in row data.
"""
if isinstance(value, datetime.datetime):
value = _microseconds_from_datetime(value) * 1e-6
return value | [
"Coerce",
"value",
"to",
"an",
"JSON",
"-",
"compatible",
"representation",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L280-L287 | [
"def",
"_timestamp_to_json_row",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"datetime",
".",
"datetime",
")",
":",
"value",
"=",
"_microseconds_from_datetime",
"(",
"value",
")",
"*",
"1e-6",
"return",
"value"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _datetime_to_json | Coerce 'value' to an JSON-compatible representation. | bigquery/google/cloud/bigquery/_helpers.py | def _datetime_to_json(value):
"""Coerce 'value' to an JSON-compatible representation."""
if isinstance(value, datetime.datetime):
value = value.strftime(_RFC3339_MICROS_NO_ZULU)
return value | def _datetime_to_json(value):
"""Coerce 'value' to an JSON-compatible representation."""
if isinstance(value, datetime.datetime):
value = value.strftime(_RFC3339_MICROS_NO_ZULU)
return value | [
"Coerce",
"value",
"to",
"an",
"JSON",
"-",
"compatible",
"representation",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L290-L294 | [
"def",
"_datetime_to_json",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"datetime",
".",
"datetime",
")",
":",
"value",
"=",
"value",
".",
"strftime",
"(",
"_RFC3339_MICROS_NO_ZULU",
")",
"return",
"value"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _date_to_json | Coerce 'value' to an JSON-compatible representation. | bigquery/google/cloud/bigquery/_helpers.py | def _date_to_json(value):
"""Coerce 'value' to an JSON-compatible representation."""
if isinstance(value, datetime.date):
value = value.isoformat()
return value | def _date_to_json(value):
"""Coerce 'value' to an JSON-compatible representation."""
if isinstance(value, datetime.date):
value = value.isoformat()
return value | [
"Coerce",
"value",
"to",
"an",
"JSON",
"-",
"compatible",
"representation",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L297-L301 | [
"def",
"_date_to_json",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"datetime",
".",
"date",
")",
":",
"value",
"=",
"value",
".",
"isoformat",
"(",
")",
"return",
"value"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.