repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
googleapis/google-cloud-python | api_core/google/api_core/bidi.py | BackgroundConsumer.start | def start(self):
"""Start the background thread and begin consuming the thread."""
with self._operational_lock:
ready = threading.Event()
thread = threading.Thread(
name=_BIDIRECTIONAL_CONSUMER_NAME,
target=self._thread_main,
args=(... | python | def start(self):
"""Start the background thread and begin consuming the thread."""
with self._operational_lock:
ready = threading.Event()
thread = threading.Thread(
name=_BIDIRECTIONAL_CONSUMER_NAME,
target=self._thread_main,
args=(... | [
"def",
"start",
"(",
"self",
")",
":",
"with",
"self",
".",
"_operational_lock",
":",
"ready",
"=",
"threading",
".",
"Event",
"(",
")",
"thread",
"=",
"threading",
".",
"Thread",
"(",
"name",
"=",
"_BIDIRECTIONAL_CONSUMER_NAME",
",",
"target",
"=",
"self"... | Start the background thread and begin consuming the thread. | [
"Start",
"the",
"background",
"thread",
"and",
"begin",
"consuming",
"the",
"thread",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/bidi.py#L569-L586 | train |
googleapis/google-cloud-python | api_core/google/api_core/bidi.py | BackgroundConsumer.stop | def stop(self):
"""Stop consuming the stream and shutdown the background thread."""
with self._operational_lock:
self._bidi_rpc.close()
if self._thread is not None:
# Resume the thread to wake it up in case it is sleeping.
self.resume()
... | python | def stop(self):
"""Stop consuming the stream and shutdown the background thread."""
with self._operational_lock:
self._bidi_rpc.close()
if self._thread is not None:
# Resume the thread to wake it up in case it is sleeping.
self.resume()
... | [
"def",
"stop",
"(",
"self",
")",
":",
"with",
"self",
".",
"_operational_lock",
":",
"self",
".",
"_bidi_rpc",
".",
"close",
"(",
")",
"if",
"self",
".",
"_thread",
"is",
"not",
"None",
":",
"# Resume the thread to wake it up in case it is sleeping.",
"self",
... | Stop consuming the stream and shutdown the background thread. | [
"Stop",
"consuming",
"the",
"stream",
"and",
"shutdown",
"the",
"background",
"thread",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/bidi.py#L588-L598 | train |
googleapis/google-cloud-python | api_core/google/api_core/bidi.py | BackgroundConsumer.resume | def resume(self):
"""Resumes the response stream."""
with self._wake:
self._paused = False
self._wake.notifyAll() | python | def resume(self):
"""Resumes the response stream."""
with self._wake:
self._paused = False
self._wake.notifyAll() | [
"def",
"resume",
"(",
"self",
")",
":",
"with",
"self",
".",
"_wake",
":",
"self",
".",
"_paused",
"=",
"False",
"self",
".",
"_wake",
".",
"notifyAll",
"(",
")"
] | Resumes the response stream. | [
"Resumes",
"the",
"response",
"stream",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/bidi.py#L613-L617 | train |
googleapis/google-cloud-python | oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py | OsLoginServiceClient.project_path | def project_path(cls, user, project):
"""Return a fully-qualified project string."""
return google.api_core.path_template.expand(
"users/{user}/projects/{project}", user=user, project=project
) | python | def project_path(cls, user, project):
"""Return a fully-qualified project string."""
return google.api_core.path_template.expand(
"users/{user}/projects/{project}", user=user, project=project
) | [
"def",
"project_path",
"(",
"cls",
",",
"user",
",",
"project",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"users/{user}/projects/{project}\"",
",",
"user",
"=",
"user",
",",
"project",
"=",
"project",
")"
] | Return a fully-qualified project string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"project",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py#L81-L85 | train |
googleapis/google-cloud-python | oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py | OsLoginServiceClient.fingerprint_path | def fingerprint_path(cls, user, fingerprint):
"""Return a fully-qualified fingerprint string."""
return google.api_core.path_template.expand(
"users/{user}/sshPublicKeys/{fingerprint}",
user=user,
fingerprint=fingerprint,
) | python | def fingerprint_path(cls, user, fingerprint):
"""Return a fully-qualified fingerprint string."""
return google.api_core.path_template.expand(
"users/{user}/sshPublicKeys/{fingerprint}",
user=user,
fingerprint=fingerprint,
) | [
"def",
"fingerprint_path",
"(",
"cls",
",",
"user",
",",
"fingerprint",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"users/{user}/sshPublicKeys/{fingerprint}\"",
",",
"user",
"=",
"user",
",",
"fingerprint",
"=",
"f... | Return a fully-qualified fingerprint string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"fingerprint",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py#L88-L94 | train |
googleapis/google-cloud-python | oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py | OsLoginServiceClient.delete_posix_account | def delete_posix_account(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes a POSIX account.
Example:
>>> from google.cloud import oslogin_v1
... | python | def delete_posix_account(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes a POSIX account.
Example:
>>> from google.cloud import oslogin_v1
... | [
"def",
"delete_posix_account",
"(",
"self",
",",
"name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"m... | Deletes a POSIX account.
Example:
>>> from google.cloud import oslogin_v1
>>>
>>> client = oslogin_v1.OsLoginServiceClient()
>>>
>>> name = client.project_path('[USER]', '[PROJECT]')
>>>
>>> client.delete_posix_account(name)
... | [
"Deletes",
"a",
"POSIX",
"account",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py#L195-L248 | train |
googleapis/google-cloud-python | oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py | OsLoginServiceClient.import_ssh_public_key | def import_ssh_public_key(
self,
parent,
ssh_public_key,
project_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Adds an SSH public key and returns the profile infor... | python | def import_ssh_public_key(
self,
parent,
ssh_public_key,
project_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Adds an SSH public key and returns the profile infor... | [
"def",
"import_ssh_public_key",
"(",
"self",
",",
"parent",
",",
"ssh_public_key",
",",
"project_id",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
... | Adds an SSH public key and returns the profile information. Default POSIX
account information is set when no username and UID exist as part of the
login profile.
Example:
>>> from google.cloud import oslogin_v1
>>>
>>> client = oslogin_v1.OsLoginServiceClient... | [
"Adds",
"an",
"SSH",
"public",
"key",
"and",
"returns",
"the",
"profile",
"information",
".",
"Default",
"POSIX",
"account",
"information",
"is",
"set",
"when",
"no",
"username",
"and",
"UID",
"exist",
"as",
"part",
"of",
"the",
"login",
"profile",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py#L420-L488 | train |
googleapis/google-cloud-python | oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py | OsLoginServiceClient.update_ssh_public_key | def update_ssh_public_key(
self,
name,
ssh_public_key,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates an SSH public key and returns the profile inf... | python | def update_ssh_public_key(
self,
name,
ssh_public_key,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates an SSH public key and returns the profile inf... | [
"def",
"update_ssh_public_key",
"(",
"self",
",",
"name",
",",
"ssh_public_key",
",",
"update_mask",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
... | Updates an SSH public key and returns the profile information. This method
supports patch semantics.
Example:
>>> from google.cloud import oslogin_v1
>>>
>>> client = oslogin_v1.OsLoginServiceClient()
>>>
>>> name = client.fingerprint_path('[U... | [
"Updates",
"an",
"SSH",
"public",
"key",
"and",
"returns",
"the",
"profile",
"information",
".",
"This",
"method",
"supports",
"patch",
"semantics",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py#L490-L562 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/column_family.py | _gc_rule_from_pb | def _gc_rule_from_pb(gc_rule_pb):
"""Convert a protobuf GC rule to a native object.
:type gc_rule_pb: :class:`.table_v2_pb2.GcRule`
:param gc_rule_pb: The GC rule to convert.
:rtype: :class:`GarbageCollectionRule` or :data:`NoneType <types.NoneType>`
:returns: An instance of one of the native rule... | python | def _gc_rule_from_pb(gc_rule_pb):
"""Convert a protobuf GC rule to a native object.
:type gc_rule_pb: :class:`.table_v2_pb2.GcRule`
:param gc_rule_pb: The GC rule to convert.
:rtype: :class:`GarbageCollectionRule` or :data:`NoneType <types.NoneType>`
:returns: An instance of one of the native rule... | [
"def",
"_gc_rule_from_pb",
"(",
"gc_rule_pb",
")",
":",
"rule_name",
"=",
"gc_rule_pb",
".",
"WhichOneof",
"(",
"\"rule\"",
")",
"if",
"rule_name",
"is",
"None",
":",
"return",
"None",
"if",
"rule_name",
"==",
"\"max_num_versions\"",
":",
"return",
"MaxVersionsG... | Convert a protobuf GC rule to a native object.
:type gc_rule_pb: :class:`.table_v2_pb2.GcRule`
:param gc_rule_pb: The GC rule to convert.
:rtype: :class:`GarbageCollectionRule` or :data:`NoneType <types.NoneType>`
:returns: An instance of one of the native rules defined
in :module:`colum... | [
"Convert",
"a",
"protobuf",
"GC",
"rule",
"to",
"a",
"native",
"object",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L323-L351 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/column_family.py | MaxAgeGCRule.to_pb | def to_pb(self):
"""Converts the garbage collection rule to a protobuf.
:rtype: :class:`.table_v2_pb2.GcRule`
:returns: The converted current object.
"""
max_age = _helpers._timedelta_to_duration_pb(self.max_age)
return table_v2_pb2.GcRule(max_age=max_age) | python | def to_pb(self):
"""Converts the garbage collection rule to a protobuf.
:rtype: :class:`.table_v2_pb2.GcRule`
:returns: The converted current object.
"""
max_age = _helpers._timedelta_to_duration_pb(self.max_age)
return table_v2_pb2.GcRule(max_age=max_age) | [
"def",
"to_pb",
"(",
"self",
")",
":",
"max_age",
"=",
"_helpers",
".",
"_timedelta_to_duration_pb",
"(",
"self",
".",
"max_age",
")",
"return",
"table_v2_pb2",
".",
"GcRule",
"(",
"max_age",
"=",
"max_age",
")"
] | Converts the garbage collection rule to a protobuf.
:rtype: :class:`.table_v2_pb2.GcRule`
:returns: The converted current object. | [
"Converts",
"the",
"garbage",
"collection",
"rule",
"to",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L100-L107 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/column_family.py | GCRuleUnion.to_pb | def to_pb(self):
"""Converts the union into a single GC rule as a protobuf.
:rtype: :class:`.table_v2_pb2.GcRule`
:returns: The converted current object.
"""
union = table_v2_pb2.GcRule.Union(rules=[rule.to_pb() for rule in self.rules])
return table_v2_pb2.GcRule(union=u... | python | def to_pb(self):
"""Converts the union into a single GC rule as a protobuf.
:rtype: :class:`.table_v2_pb2.GcRule`
:returns: The converted current object.
"""
union = table_v2_pb2.GcRule.Union(rules=[rule.to_pb() for rule in self.rules])
return table_v2_pb2.GcRule(union=u... | [
"def",
"to_pb",
"(",
"self",
")",
":",
"union",
"=",
"table_v2_pb2",
".",
"GcRule",
".",
"Union",
"(",
"rules",
"=",
"[",
"rule",
".",
"to_pb",
"(",
")",
"for",
"rule",
"in",
"self",
".",
"rules",
"]",
")",
"return",
"table_v2_pb2",
".",
"GcRule",
... | Converts the union into a single GC rule as a protobuf.
:rtype: :class:`.table_v2_pb2.GcRule`
:returns: The converted current object. | [
"Converts",
"the",
"union",
"into",
"a",
"single",
"GC",
"rule",
"as",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L134-L141 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/column_family.py | GCRuleIntersection.to_pb | def to_pb(self):
"""Converts the intersection into a single GC rule as a protobuf.
:rtype: :class:`.table_v2_pb2.GcRule`
:returns: The converted current object.
"""
intersection = table_v2_pb2.GcRule.Intersection(
rules=[rule.to_pb() for rule in self.rules]
)... | python | def to_pb(self):
"""Converts the intersection into a single GC rule as a protobuf.
:rtype: :class:`.table_v2_pb2.GcRule`
:returns: The converted current object.
"""
intersection = table_v2_pb2.GcRule.Intersection(
rules=[rule.to_pb() for rule in self.rules]
)... | [
"def",
"to_pb",
"(",
"self",
")",
":",
"intersection",
"=",
"table_v2_pb2",
".",
"GcRule",
".",
"Intersection",
"(",
"rules",
"=",
"[",
"rule",
".",
"to_pb",
"(",
")",
"for",
"rule",
"in",
"self",
".",
"rules",
"]",
")",
"return",
"table_v2_pb2",
".",
... | Converts the intersection into a single GC rule as a protobuf.
:rtype: :class:`.table_v2_pb2.GcRule`
:returns: The converted current object. | [
"Converts",
"the",
"intersection",
"into",
"a",
"single",
"GC",
"rule",
"as",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L168-L177 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/column_family.py | ColumnFamily.to_pb | def to_pb(self):
"""Converts the column family to a protobuf.
:rtype: :class:`.table_v2_pb2.ColumnFamily`
:returns: The converted current object.
"""
if self.gc_rule is None:
return table_v2_pb2.ColumnFamily()
else:
return table_v2_pb2.ColumnFamil... | python | def to_pb(self):
"""Converts the column family to a protobuf.
:rtype: :class:`.table_v2_pb2.ColumnFamily`
:returns: The converted current object.
"""
if self.gc_rule is None:
return table_v2_pb2.ColumnFamily()
else:
return table_v2_pb2.ColumnFamil... | [
"def",
"to_pb",
"(",
"self",
")",
":",
"if",
"self",
".",
"gc_rule",
"is",
"None",
":",
"return",
"table_v2_pb2",
".",
"ColumnFamily",
"(",
")",
"else",
":",
"return",
"table_v2_pb2",
".",
"ColumnFamily",
"(",
"gc_rule",
"=",
"self",
".",
"gc_rule",
".",... | Converts the column family to a protobuf.
:rtype: :class:`.table_v2_pb2.ColumnFamily`
:returns: The converted current object. | [
"Converts",
"the",
"column",
"family",
"to",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L242-L251 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/column_family.py | ColumnFamily.create | def create(self):
"""Create this column family.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_column_family]
:end-before: [END bigtable_create_column_family]
"""
column_family = self.to_pb()
modification... | python | def create(self):
"""Create this column family.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_column_family]
:end-before: [END bigtable_create_column_family]
"""
column_family = self.to_pb()
modification... | [
"def",
"create",
"(",
"self",
")",
":",
"column_family",
"=",
"self",
".",
"to_pb",
"(",
")",
"modification",
"=",
"table_admin_v2_pb2",
".",
"ModifyColumnFamiliesRequest",
".",
"Modification",
"(",
"id",
"=",
"self",
".",
"column_family_id",
",",
"create",
"=... | Create this column family.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_column_family]
:end-before: [END bigtable_create_column_family] | [
"Create",
"this",
"column",
"family",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L253-L273 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/column_family.py | ColumnFamily.delete | def delete(self):
"""Delete this column family.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_delete_column_family]
:end-before: [END bigtable_delete_column_family]
"""
modification = table_admin_v2_pb2.ModifyColumnFam... | python | def delete(self):
"""Delete this column family.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_delete_column_family]
:end-before: [END bigtable_delete_column_family]
"""
modification = table_admin_v2_pb2.ModifyColumnFam... | [
"def",
"delete",
"(",
"self",
")",
":",
"modification",
"=",
"table_admin_v2_pb2",
".",
"ModifyColumnFamiliesRequest",
".",
"Modification",
"(",
"id",
"=",
"self",
".",
"column_family_id",
",",
"drop",
"=",
"True",
")",
"client",
"=",
"self",
".",
"_table",
... | Delete this column family.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_delete_column_family]
:end-before: [END bigtable_delete_column_family] | [
"Delete",
"this",
"column",
"family",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L301-L320 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/watch.py | _maybe_wrap_exception | def _maybe_wrap_exception(exception):
"""Wraps a gRPC exception class, if needed."""
if isinstance(exception, grpc.RpcError):
return exceptions.from_grpc_error(exception)
return exception | python | def _maybe_wrap_exception(exception):
"""Wraps a gRPC exception class, if needed."""
if isinstance(exception, grpc.RpcError):
return exceptions.from_grpc_error(exception)
return exception | [
"def",
"_maybe_wrap_exception",
"(",
"exception",
")",
":",
"if",
"isinstance",
"(",
"exception",
",",
"grpc",
".",
"RpcError",
")",
":",
"return",
"exceptions",
".",
"from_grpc_error",
"(",
"exception",
")",
"return",
"exception"
] | Wraps a gRPC exception class, if needed. | [
"Wraps",
"a",
"gRPC",
"exception",
"class",
"if",
"needed",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L144-L148 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/watch.py | Watch.close | def close(self, reason=None):
"""Stop consuming messages and shutdown all helper threads.
This method is idempotent. Additional calls will have no effect.
Args:
reason (Any): The reason to close this. If None, this is considered
an "intentional" shutdown.
""... | python | def close(self, reason=None):
"""Stop consuming messages and shutdown all helper threads.
This method is idempotent. Additional calls will have no effect.
Args:
reason (Any): The reason to close this. If None, this is considered
an "intentional" shutdown.
""... | [
"def",
"close",
"(",
"self",
",",
"reason",
"=",
"None",
")",
":",
"with",
"self",
".",
"_closing",
":",
"if",
"self",
".",
"_closed",
":",
"return",
"# Stop consuming messages.",
"if",
"self",
".",
"is_active",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Stop... | Stop consuming messages and shutdown all helper threads.
This method is idempotent. Additional calls will have no effect.
Args:
reason (Any): The reason to close this. If None, this is considered
an "intentional" shutdown. | [
"Stop",
"consuming",
"messages",
"and",
"shutdown",
"all",
"helper",
"threads",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L262-L291 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/watch.py | Watch._on_rpc_done | def _on_rpc_done(self, future):
"""Triggered whenever the underlying RPC terminates without recovery.
This is typically triggered from one of two threads: the background
consumer thread (when calling ``recv()`` produces a non-recoverable
error) or the grpc management thread (when cancel... | python | def _on_rpc_done(self, future):
"""Triggered whenever the underlying RPC terminates without recovery.
This is typically triggered from one of two threads: the background
consumer thread (when calling ``recv()`` produces a non-recoverable
error) or the grpc management thread (when cancel... | [
"def",
"_on_rpc_done",
"(",
"self",
",",
"future",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"RPC termination has signaled manager shutdown.\"",
")",
"future",
"=",
"_maybe_wrap_exception",
"(",
"future",
")",
"thread",
"=",
"threading",
".",
"Thread",
"(",
"name",... | Triggered whenever the underlying RPC terminates without recovery.
This is typically triggered from one of two threads: the background
consumer thread (when calling ``recv()`` produces a non-recoverable
error) or the grpc management thread (when cancelling the RPC).
This method is *non... | [
"Triggered",
"whenever",
"the",
"underlying",
"RPC",
"terminates",
"without",
"recovery",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L293-L310 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/watch.py | Watch.for_document | def for_document(
cls,
document_ref,
snapshot_callback,
snapshot_class_instance,
reference_class_instance,
):
"""
Creates a watch snapshot listener for a document. snapshot_callback
receives a DocumentChange object, but may also start to get
ta... | python | def for_document(
cls,
document_ref,
snapshot_callback,
snapshot_class_instance,
reference_class_instance,
):
"""
Creates a watch snapshot listener for a document. snapshot_callback
receives a DocumentChange object, but may also start to get
ta... | [
"def",
"for_document",
"(",
"cls",
",",
"document_ref",
",",
"snapshot_callback",
",",
"snapshot_class_instance",
",",
"reference_class_instance",
",",
")",
":",
"return",
"cls",
"(",
"document_ref",
",",
"document_ref",
".",
"_client",
",",
"{",
"\"documents\"",
... | Creates a watch snapshot listener for a document. snapshot_callback
receives a DocumentChange object, but may also start to get
targetChange and such soon
Args:
document_ref: Reference to Document
snapshot_callback: callback to be called on snapshot
snapshot_... | [
"Creates",
"a",
"watch",
"snapshot",
"listener",
"for",
"a",
"document",
".",
"snapshot_callback",
"receives",
"a",
"DocumentChange",
"object",
"but",
"may",
"also",
"start",
"to",
"get",
"targetChange",
"and",
"such",
"soon"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L316-L348 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/watch.py | Watch.on_snapshot | def on_snapshot(self, proto):
"""
Called everytime there is a response from listen. Collect changes
and 'push' the changes in a batch to the customer when we receive
'current' from the listen response.
Args:
listen_response(`google.cloud.firestore_v1beta1.types.Liste... | python | def on_snapshot(self, proto):
"""
Called everytime there is a response from listen. Collect changes
and 'push' the changes in a batch to the customer when we receive
'current' from the listen response.
Args:
listen_response(`google.cloud.firestore_v1beta1.types.Liste... | [
"def",
"on_snapshot",
"(",
"self",
",",
"proto",
")",
":",
"TargetChange",
"=",
"firestore_pb2",
".",
"TargetChange",
"target_changetype_dispatch",
"=",
"{",
"TargetChange",
".",
"NO_CHANGE",
":",
"self",
".",
"_on_snapshot_target_change_no_change",
",",
"TargetChange... | Called everytime there is a response from listen. Collect changes
and 'push' the changes in a batch to the customer when we receive
'current' from the listen response.
Args:
listen_response(`google.cloud.firestore_v1beta1.types.ListenResponse`):
Callback method that ... | [
"Called",
"everytime",
"there",
"is",
"a",
"response",
"from",
"listen",
".",
"Collect",
"changes",
"and",
"push",
"the",
"changes",
"in",
"a",
"batch",
"to",
"the",
"customer",
"when",
"we",
"receive",
"current",
"from",
"the",
"listen",
"response",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L408-L527 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/watch.py | Watch.push | def push(self, read_time, next_resume_token):
"""
Assembles a new snapshot from the current set of changes and invokes
the user's callback. Clears the current changes on completion.
"""
deletes, adds, updates = Watch._extract_changes(
self.doc_map, self.change_map, re... | python | def push(self, read_time, next_resume_token):
"""
Assembles a new snapshot from the current set of changes and invokes
the user's callback. Clears the current changes on completion.
"""
deletes, adds, updates = Watch._extract_changes(
self.doc_map, self.change_map, re... | [
"def",
"push",
"(",
"self",
",",
"read_time",
",",
"next_resume_token",
")",
":",
"deletes",
",",
"adds",
",",
"updates",
"=",
"Watch",
".",
"_extract_changes",
"(",
"self",
".",
"doc_map",
",",
"self",
".",
"change_map",
",",
"read_time",
")",
"updated_tr... | Assembles a new snapshot from the current set of changes and invokes
the user's callback. Clears the current changes on completion. | [
"Assembles",
"a",
"new",
"snapshot",
"from",
"the",
"current",
"set",
"of",
"changes",
"and",
"invokes",
"the",
"user",
"s",
"callback",
".",
"Clears",
"the",
"current",
"changes",
"on",
"completion",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L529-L558 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/watch.py | Watch._current_size | def _current_size(self):
"""
Returns the current count of all documents, including the changes from
the current changeMap.
"""
deletes, adds, _ = Watch._extract_changes(self.doc_map, self.change_map, None)
return len(self.doc_map) + len(adds) - len(deletes) | python | def _current_size(self):
"""
Returns the current count of all documents, including the changes from
the current changeMap.
"""
deletes, adds, _ = Watch._extract_changes(self.doc_map, self.change_map, None)
return len(self.doc_map) + len(adds) - len(deletes) | [
"def",
"_current_size",
"(",
"self",
")",
":",
"deletes",
",",
"adds",
",",
"_",
"=",
"Watch",
".",
"_extract_changes",
"(",
"self",
".",
"doc_map",
",",
"self",
".",
"change_map",
",",
"None",
")",
"return",
"len",
"(",
"self",
".",
"doc_map",
")",
... | Returns the current count of all documents, including the changes from
the current changeMap. | [
"Returns",
"the",
"current",
"count",
"of",
"all",
"documents",
"including",
"the",
"changes",
"from",
"the",
"current",
"changeMap",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L700-L706 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/watch.py | Watch._reset_docs | def _reset_docs(self):
"""
Helper to clear the docs on RESET or filter mismatch.
"""
_LOGGER.debug("resetting documents")
self.change_map.clear()
self.resume_token = None
# Mark each document as deleted. If documents are not deleted
# they will be sent ag... | python | def _reset_docs(self):
"""
Helper to clear the docs on RESET or filter mismatch.
"""
_LOGGER.debug("resetting documents")
self.change_map.clear()
self.resume_token = None
# Mark each document as deleted. If documents are not deleted
# they will be sent ag... | [
"def",
"_reset_docs",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"resetting documents\"",
")",
"self",
".",
"change_map",
".",
"clear",
"(",
")",
"self",
".",
"resume_token",
"=",
"None",
"# Mark each document as deleted. If documents are not deleted",
"... | Helper to clear the docs on RESET or filter mismatch. | [
"Helper",
"to",
"clear",
"the",
"docs",
"on",
"RESET",
"or",
"filter",
"mismatch",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L708-L722 | train |
googleapis/google-cloud-python | core/google/cloud/_http.py | JSONConnection.build_api_url | def build_api_url(
cls, path, query_params=None, api_base_url=None, api_version=None
):
"""Construct an API url given a few components, some optional.
Typically, you shouldn't need to use this method.
:type path: str
:param path: The path to the resource (ie, ``'/b/bucket-n... | python | def build_api_url(
cls, path, query_params=None, api_base_url=None, api_version=None
):
"""Construct an API url given a few components, some optional.
Typically, you shouldn't need to use this method.
:type path: str
:param path: The path to the resource (ie, ``'/b/bucket-n... | [
"def",
"build_api_url",
"(",
"cls",
",",
"path",
",",
"query_params",
"=",
"None",
",",
"api_base_url",
"=",
"None",
",",
"api_version",
"=",
"None",
")",
":",
"url",
"=",
"cls",
".",
"API_URL_TEMPLATE",
".",
"format",
"(",
"api_base_url",
"=",
"(",
"api... | Construct an API url given a few components, some optional.
Typically, you shouldn't need to use this method.
:type path: str
:param path: The path to the resource (ie, ``'/b/bucket-name'``).
:type query_params: dict or list
:param query_params: A dictionary of keys and values... | [
"Construct",
"an",
"API",
"url",
"given",
"a",
"few",
"components",
"some",
"optional",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_http.py#L105-L142 | train |
googleapis/google-cloud-python | core/google/cloud/_http.py | JSONConnection._make_request | def _make_request(
self,
method,
url,
data=None,
content_type=None,
headers=None,
target_object=None,
):
"""A low level method to send a request to the API.
Typically, you shouldn't need to use this method.
:type method: str
:... | python | def _make_request(
self,
method,
url,
data=None,
content_type=None,
headers=None,
target_object=None,
):
"""A low level method to send a request to the API.
Typically, you shouldn't need to use this method.
:type method: str
:... | [
"def",
"_make_request",
"(",
"self",
",",
"method",
",",
"url",
",",
"data",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"target_object",
"=",
"None",
",",
")",
":",
"headers",
"=",
"headers",
"or",
"{",
"}",
"hea... | A low level method to send a request to the API.
Typically, you shouldn't need to use this method.
:type method: str
:param method: The HTTP method to use in the request.
:type url: str
:param url: The URL to send the request to.
:type data: str
:param data: T... | [
"A",
"low",
"level",
"method",
"to",
"send",
"a",
"request",
"to",
"the",
"API",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_http.py#L144-L192 | train |
googleapis/google-cloud-python | core/google/cloud/_http.py | JSONConnection._do_request | def _do_request(
self, method, url, headers, data, target_object
): # pylint: disable=unused-argument
"""Low-level helper: perform the actual API request over HTTP.
Allows batch context managers to override and defer a request.
:type method: str
:param method: The HTTP me... | python | def _do_request(
self, method, url, headers, data, target_object
): # pylint: disable=unused-argument
"""Low-level helper: perform the actual API request over HTTP.
Allows batch context managers to override and defer a request.
:type method: str
:param method: The HTTP me... | [
"def",
"_do_request",
"(",
"self",
",",
"method",
",",
"url",
",",
"headers",
",",
"data",
",",
"target_object",
")",
":",
"# pylint: disable=unused-argument",
"return",
"self",
".",
"http",
".",
"request",
"(",
"url",
"=",
"url",
",",
"method",
"=",
"meth... | Low-level helper: perform the actual API request over HTTP.
Allows batch context managers to override and defer a request.
:type method: str
:param method: The HTTP method to use in the request.
:type url: str
:param url: The URL to send the request to.
:type headers... | [
"Low",
"-",
"level",
"helper",
":",
"perform",
"the",
"actual",
"API",
"request",
"over",
"HTTP",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_http.py#L194-L221 | train |
googleapis/google-cloud-python | core/google/cloud/_http.py | JSONConnection.api_request | def api_request(
self,
method,
path,
query_params=None,
data=None,
content_type=None,
headers=None,
api_base_url=None,
api_version=None,
expect_json=True,
_target_object=None,
):
"""Make a request over the HTTP transport... | python | def api_request(
self,
method,
path,
query_params=None,
data=None,
content_type=None,
headers=None,
api_base_url=None,
api_version=None,
expect_json=True,
_target_object=None,
):
"""Make a request over the HTTP transport... | [
"def",
"api_request",
"(",
"self",
",",
"method",
",",
"path",
",",
"query_params",
"=",
"None",
",",
"data",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"api_base_url",
"=",
"None",
",",
"api_version",
"=",
"None",
... | Make a request over the HTTP transport to the API.
You shouldn't need to use this method, but if you plan to
interact with the API using these primitives, this is the
correct one to use.
:type method: str
:param method: The HTTP method name (ie, ``GET``, ``POST``, etc).
... | [
"Make",
"a",
"request",
"over",
"the",
"HTTP",
"transport",
"to",
"the",
"API",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_http.py#L223-L324 | train |
googleapis/google-cloud-python | monitoring/google/cloud/monitoring_v3/query.py | _build_label_filter | def _build_label_filter(category, *args, **kwargs):
"""Construct a filter string to filter on metric or resource labels."""
terms = list(args)
for key, value in six.iteritems(kwargs):
if value is None:
continue
suffix = None
if key.endswith(
("_prefix", "_suf... | python | def _build_label_filter(category, *args, **kwargs):
"""Construct a filter string to filter on metric or resource labels."""
terms = list(args)
for key, value in six.iteritems(kwargs):
if value is None:
continue
suffix = None
if key.endswith(
("_prefix", "_suf... | [
"def",
"_build_label_filter",
"(",
"category",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"terms",
"=",
"list",
"(",
"args",
")",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"kwargs",
")",
":",
"if",
"value",
"is",
"No... | Construct a filter string to filter on metric or resource labels. | [
"Construct",
"a",
"filter",
"string",
"to",
"filter",
"on",
"metric",
"or",
"resource",
"labels",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L592-L627 | train |
googleapis/google-cloud-python | monitoring/google/cloud/monitoring_v3/query.py | Query.select_interval | def select_interval(self, end_time, start_time=None):
"""Copy the query and set the query time interval.
Example::
import datetime
now = datetime.datetime.utcnow()
query = query.select_interval(
end_time=now,
start_time=now - datetim... | python | def select_interval(self, end_time, start_time=None):
"""Copy the query and set the query time interval.
Example::
import datetime
now = datetime.datetime.utcnow()
query = query.select_interval(
end_time=now,
start_time=now - datetim... | [
"def",
"select_interval",
"(",
"self",
",",
"end_time",
",",
"start_time",
"=",
"None",
")",
":",
"new_query",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_query",
".",
"_end_time",
"=",
"end_time",
"new_query",
".",
"_start_time",
"=",
"start_time",... | Copy the query and set the query time interval.
Example::
import datetime
now = datetime.datetime.utcnow()
query = query.select_interval(
end_time=now,
start_time=now - datetime.timedelta(minutes=5))
As a convenience, you can altern... | [
"Copy",
"the",
"query",
"and",
"set",
"the",
"query",
"time",
"interval",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L134-L165 | train |
googleapis/google-cloud-python | monitoring/google/cloud/monitoring_v3/query.py | Query.select_group | def select_group(self, group_id):
"""Copy the query and add filtering by group.
Example::
query = query.select_group('1234567')
:type group_id: str
:param group_id: The ID of a group to filter by.
:rtype: :class:`Query`
:returns: The new query object.
... | python | def select_group(self, group_id):
"""Copy the query and add filtering by group.
Example::
query = query.select_group('1234567')
:type group_id: str
:param group_id: The ID of a group to filter by.
:rtype: :class:`Query`
:returns: The new query object.
... | [
"def",
"select_group",
"(",
"self",
",",
"group_id",
")",
":",
"new_query",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_query",
".",
"_filter",
".",
"group_id",
"=",
"group_id",
"return",
"new_query"
] | Copy the query and add filtering by group.
Example::
query = query.select_group('1234567')
:type group_id: str
:param group_id: The ID of a group to filter by.
:rtype: :class:`Query`
:returns: The new query object. | [
"Copy",
"the",
"query",
"and",
"add",
"filtering",
"by",
"group",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L167-L182 | train |
googleapis/google-cloud-python | monitoring/google/cloud/monitoring_v3/query.py | Query.select_projects | def select_projects(self, *args):
"""Copy the query and add filtering by monitored projects.
This is only useful if the target project represents a Stackdriver
account containing the specified monitored projects.
Examples::
query = query.select_projects('project-1')
... | python | def select_projects(self, *args):
"""Copy the query and add filtering by monitored projects.
This is only useful if the target project represents a Stackdriver
account containing the specified monitored projects.
Examples::
query = query.select_projects('project-1')
... | [
"def",
"select_projects",
"(",
"self",
",",
"*",
"args",
")",
":",
"new_query",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_query",
".",
"_filter",
".",
"projects",
"=",
"args",
"return",
"new_query"
] | Copy the query and add filtering by monitored projects.
This is only useful if the target project represents a Stackdriver
account containing the specified monitored projects.
Examples::
query = query.select_projects('project-1')
query = query.select_projects('project-... | [
"Copy",
"the",
"query",
"and",
"add",
"filtering",
"by",
"monitored",
"projects",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L184-L204 | train |
googleapis/google-cloud-python | monitoring/google/cloud/monitoring_v3/query.py | Query.select_resources | def select_resources(self, *args, **kwargs):
"""Copy the query and add filtering by resource labels.
Examples::
query = query.select_resources(zone='us-central1-a')
query = query.select_resources(zone_prefix='europe-')
query = query.select_resources(resource_type='g... | python | def select_resources(self, *args, **kwargs):
"""Copy the query and add filtering by resource labels.
Examples::
query = query.select_resources(zone='us-central1-a')
query = query.select_resources(zone_prefix='europe-')
query = query.select_resources(resource_type='g... | [
"def",
"select_resources",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"new_query",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_query",
".",
"_filter",
".",
"select_resources",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
... | Copy the query and add filtering by resource labels.
Examples::
query = query.select_resources(zone='us-central1-a')
query = query.select_resources(zone_prefix='europe-')
query = query.select_resources(resource_type='gce_instance')
A keyword argument ``<label>=<val... | [
"Copy",
"the",
"query",
"and",
"add",
"filtering",
"by",
"resource",
"labels",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L206-L262 | train |
googleapis/google-cloud-python | monitoring/google/cloud/monitoring_v3/query.py | Query.select_metrics | def select_metrics(self, *args, **kwargs):
"""Copy the query and add filtering by metric labels.
Examples::
query = query.select_metrics(instance_name='myinstance')
query = query.select_metrics(instance_name_prefix='mycluster-')
A keyword argument ``<label>=<value>`` o... | python | def select_metrics(self, *args, **kwargs):
"""Copy the query and add filtering by metric labels.
Examples::
query = query.select_metrics(instance_name='myinstance')
query = query.select_metrics(instance_name_prefix='mycluster-')
A keyword argument ``<label>=<value>`` o... | [
"def",
"select_metrics",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"new_query",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_query",
".",
"_filter",
".",
"select_metrics",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"... | Copy the query and add filtering by metric labels.
Examples::
query = query.select_metrics(instance_name='myinstance')
query = query.select_metrics(instance_name_prefix='mycluster-')
A keyword argument ``<label>=<value>`` ordinarily generates a filter
expression of the... | [
"Copy",
"the",
"query",
"and",
"add",
"filtering",
"by",
"metric",
"labels",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L264-L321 | train |
googleapis/google-cloud-python | monitoring/google/cloud/monitoring_v3/query.py | Query.align | def align(self, per_series_aligner, seconds=0, minutes=0, hours=0):
"""Copy the query and add temporal alignment.
If ``per_series_aligner`` is not :data:`Aligner.ALIGN_NONE`, each time
series will contain data points only on the period boundaries.
Example::
from google.clo... | python | def align(self, per_series_aligner, seconds=0, minutes=0, hours=0):
"""Copy the query and add temporal alignment.
If ``per_series_aligner`` is not :data:`Aligner.ALIGN_NONE`, each time
series will contain data points only on the period boundaries.
Example::
from google.clo... | [
"def",
"align",
"(",
"self",
",",
"per_series_aligner",
",",
"seconds",
"=",
"0",
",",
"minutes",
"=",
"0",
",",
"hours",
"=",
"0",
")",
":",
"new_query",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_query",
".",
"_per_series_aligner",
"=",
"pe... | Copy the query and add temporal alignment.
If ``per_series_aligner`` is not :data:`Aligner.ALIGN_NONE`, each time
series will contain data points only on the period boundaries.
Example::
from google.cloud.monitoring import enums
query = query.align(
enu... | [
"Copy",
"the",
"query",
"and",
"add",
"temporal",
"alignment",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L323-L366 | train |
googleapis/google-cloud-python | monitoring/google/cloud/monitoring_v3/query.py | Query.reduce | def reduce(self, cross_series_reducer, *group_by_fields):
"""Copy the query and add cross-series reduction.
Cross-series reduction combines time series by aggregating their
data points.
For example, you could request an aggregated time series for each
combination of project and... | python | def reduce(self, cross_series_reducer, *group_by_fields):
"""Copy the query and add cross-series reduction.
Cross-series reduction combines time series by aggregating their
data points.
For example, you could request an aggregated time series for each
combination of project and... | [
"def",
"reduce",
"(",
"self",
",",
"cross_series_reducer",
",",
"*",
"group_by_fields",
")",
":",
"new_query",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_query",
".",
"_cross_series_reducer",
"=",
"cross_series_reducer",
"new_query",
".",
"_group_by_fiel... | Copy the query and add cross-series reduction.
Cross-series reduction combines time series by aggregating their
data points.
For example, you could request an aggregated time series for each
combination of project and zone as follows::
from google.cloud.monitoring import e... | [
"Copy",
"the",
"query",
"and",
"add",
"cross",
"-",
"series",
"reduction",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L368-L405 | train |
googleapis/google-cloud-python | monitoring/google/cloud/monitoring_v3/query.py | Query.iter | def iter(self, headers_only=False, page_size=None):
"""Yield all time series objects selected by the query.
The generator returned iterates over
:class:`~google.cloud.monitoring_v3.types.TimeSeries` objects
containing points ordered from oldest to newest.
Note that the :class:`... | python | def iter(self, headers_only=False, page_size=None):
"""Yield all time series objects selected by the query.
The generator returned iterates over
:class:`~google.cloud.monitoring_v3.types.TimeSeries` objects
containing points ordered from oldest to newest.
Note that the :class:`... | [
"def",
"iter",
"(",
"self",
",",
"headers_only",
"=",
"False",
",",
"page_size",
"=",
"None",
")",
":",
"if",
"self",
".",
"_end_time",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Query time interval not specified.\"",
")",
"params",
"=",
"self",
".",
... | Yield all time series objects selected by the query.
The generator returned iterates over
:class:`~google.cloud.monitoring_v3.types.TimeSeries` objects
containing points ordered from oldest to newest.
Note that the :class:`Query` object itself is an iterable, such that
the foll... | [
"Yield",
"all",
"time",
"series",
"objects",
"selected",
"by",
"the",
"query",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L407-L441 | train |
googleapis/google-cloud-python | monitoring/google/cloud/monitoring_v3/query.py | Query._build_query_params | def _build_query_params(self, headers_only=False, page_size=None):
"""Return key-value pairs for the list_time_series API call.
:type headers_only: bool
:param headers_only:
Whether to omit the point data from the
:class:`~google.cloud.monitoring_v3.types.TimeSeries` o... | python | def _build_query_params(self, headers_only=False, page_size=None):
"""Return key-value pairs for the list_time_series API call.
:type headers_only: bool
:param headers_only:
Whether to omit the point data from the
:class:`~google.cloud.monitoring_v3.types.TimeSeries` o... | [
"def",
"_build_query_params",
"(",
"self",
",",
"headers_only",
"=",
"False",
",",
"page_size",
"=",
"None",
")",
":",
"params",
"=",
"{",
"\"name\"",
":",
"self",
".",
"_project_path",
",",
"\"filter_\"",
":",
"self",
".",
"filter",
"}",
"params",
"[",
... | Return key-value pairs for the list_time_series API call.
:type headers_only: bool
:param headers_only:
Whether to omit the point data from the
:class:`~google.cloud.monitoring_v3.types.TimeSeries` objects.
:type page_size: int
:param page_size:
(O... | [
"Return",
"key",
"-",
"value",
"pairs",
"for",
"the",
"list_time_series",
"API",
"call",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L443-L485 | train |
googleapis/google-cloud-python | resource_manager/google/cloud/resource_manager/project.py | Project.from_api_repr | def from_api_repr(cls, resource, client):
"""Factory: construct a project given its API representation.
:type resource: dict
:param resource: project resource representation returned from the API
:type client: :class:`google.cloud.resource_manager.client.Client`
:param client:... | python | def from_api_repr(cls, resource, client):
"""Factory: construct a project given its API representation.
:type resource: dict
:param resource: project resource representation returned from the API
:type client: :class:`google.cloud.resource_manager.client.Client`
:param client:... | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
",",
"client",
")",
":",
"project",
"=",
"cls",
"(",
"project_id",
"=",
"resource",
"[",
"\"projectId\"",
"]",
",",
"client",
"=",
"client",
")",
"project",
".",
"set_properties_from_api_repr",
"(",
"resou... | Factory: construct a project given its API representation.
:type resource: dict
:param resource: project resource representation returned from the API
:type client: :class:`google.cloud.resource_manager.client.Client`
:param client: The Client used with this project.
:rtype: ... | [
"Factory",
":",
"construct",
"a",
"project",
"given",
"its",
"API",
"representation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/resource_manager/google/cloud/resource_manager/project.py#L68-L82 | train |
googleapis/google-cloud-python | resource_manager/google/cloud/resource_manager/project.py | Project.set_properties_from_api_repr | def set_properties_from_api_repr(self, resource):
"""Update specific properties from its API representation."""
self.name = resource.get("name")
self.number = resource["projectNumber"]
self.labels = resource.get("labels", {})
self.status = resource["lifecycleState"]
if "p... | python | def set_properties_from_api_repr(self, resource):
"""Update specific properties from its API representation."""
self.name = resource.get("name")
self.number = resource["projectNumber"]
self.labels = resource.get("labels", {})
self.status = resource["lifecycleState"]
if "p... | [
"def",
"set_properties_from_api_repr",
"(",
"self",
",",
"resource",
")",
":",
"self",
".",
"name",
"=",
"resource",
".",
"get",
"(",
"\"name\"",
")",
"self",
".",
"number",
"=",
"resource",
"[",
"\"projectNumber\"",
"]",
"self",
".",
"labels",
"=",
"resou... | Update specific properties from its API representation. | [
"Update",
"specific",
"properties",
"from",
"its",
"API",
"representation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/resource_manager/google/cloud/resource_manager/project.py#L84-L91 | train |
googleapis/google-cloud-python | resource_manager/google/cloud/resource_manager/project.py | Project.create | def create(self, client=None):
"""API call: create the project via a ``POST`` request.
See
https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/create
:type client: :class:`google.cloud.resource_manager.client.Client` or
:data:`NoneType <type... | python | def create(self, client=None):
"""API call: create the project via a ``POST`` request.
See
https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/create
:type client: :class:`google.cloud.resource_manager.client.Client` or
:data:`NoneType <type... | [
"def",
"create",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"data",
"=",
"{",
"\"projectId\"",
":",
"self",
".",
"project_id",
",",
"\"name\"",
":",
"self",
".",
"name",
",",
... | API call: create the project via a ``POST`` request.
See
https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/create
:type client: :class:`google.cloud.resource_manager.client.Client` or
:data:`NoneType <types.NoneType>`
:param client: the cl... | [
"API",
"call",
":",
"create",
"the",
"project",
"via",
"a",
"POST",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/resource_manager/google/cloud/resource_manager/project.py#L120-L137 | train |
googleapis/google-cloud-python | resource_manager/google/cloud/resource_manager/project.py | Project.update | def update(self, client=None):
"""API call: update the project via a ``PUT`` request.
See
https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/update
:type client: :class:`google.cloud.resource_manager.client.Client` or
:data:`NoneType <types... | python | def update(self, client=None):
"""API call: update the project via a ``PUT`` request.
See
https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/update
:type client: :class:`google.cloud.resource_manager.client.Client` or
:data:`NoneType <types... | [
"def",
"update",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"data",
"=",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"labels\"",
":",
"self",
".",
"labels",
",",
"\"pare... | API call: update the project via a ``PUT`` request.
See
https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/update
:type client: :class:`google.cloud.resource_manager.client.Client` or
:data:`NoneType <types.NoneType>`
:param client: the cli... | [
"API",
"call",
":",
"update",
"the",
"project",
"via",
"a",
"PUT",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/resource_manager/google/cloud/resource_manager/project.py#L193-L209 | train |
googleapis/google-cloud-python | resource_manager/google/cloud/resource_manager/project.py | Project.delete | def delete(self, client=None, reload_data=False):
"""API call: delete the project via a ``DELETE`` request.
See
https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/delete
This actually changes the status (``lifecycleState``) from ``ACTIVE``
to ``DELETE_RE... | python | def delete(self, client=None, reload_data=False):
"""API call: delete the project via a ``DELETE`` request.
See
https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/delete
This actually changes the status (``lifecycleState``) from ``ACTIVE``
to ``DELETE_RE... | [
"def",
"delete",
"(",
"self",
",",
"client",
"=",
"None",
",",
"reload_data",
"=",
"False",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"client",
".",
"_connection",
".",
"api_request",
"(",
"method",
"=",
"\"DELETE\"",
"... | API call: delete the project via a ``DELETE`` request.
See
https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/delete
This actually changes the status (``lifecycleState``) from ``ACTIVE``
to ``DELETE_REQUESTED``.
Later (it's not specified when), the proje... | [
"API",
"call",
":",
"delete",
"the",
"project",
"via",
"a",
"DELETE",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/resource_manager/google/cloud/resource_manager/project.py#L211-L240 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/helpers.py | _get_meaning | def _get_meaning(value_pb, is_list=False):
"""Get the meaning from a protobuf value.
:type value_pb: :class:`.entity_pb2.Value`
:param value_pb: The protobuf value to be checked for an
associated meaning.
:type is_list: bool
:param is_list: Boolean indicating if the ``value_pb... | python | def _get_meaning(value_pb, is_list=False):
"""Get the meaning from a protobuf value.
:type value_pb: :class:`.entity_pb2.Value`
:param value_pb: The protobuf value to be checked for an
associated meaning.
:type is_list: bool
:param is_list: Boolean indicating if the ``value_pb... | [
"def",
"_get_meaning",
"(",
"value_pb",
",",
"is_list",
"=",
"False",
")",
":",
"meaning",
"=",
"None",
"if",
"is_list",
":",
"# An empty list will have no values, hence no shared meaning",
"# set among them.",
"if",
"len",
"(",
"value_pb",
".",
"array_value",
".",
... | Get the meaning from a protobuf value.
:type value_pb: :class:`.entity_pb2.Value`
:param value_pb: The protobuf value to be checked for an
associated meaning.
:type is_list: bool
:param is_list: Boolean indicating if the ``value_pb`` contains
a list value.
... | [
"Get",
"the",
"meaning",
"from",
"a",
"protobuf",
"value",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L35-L74 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/helpers.py | entity_from_protobuf | def entity_from_protobuf(pb):
"""Factory method for creating an entity based on a protobuf.
The protobuf should be one returned from the Cloud Datastore
Protobuf API.
:type pb: :class:`.entity_pb2.Entity`
:param pb: The Protobuf representing the entity.
:rtype: :class:`google.cloud.datastore.... | python | def entity_from_protobuf(pb):
"""Factory method for creating an entity based on a protobuf.
The protobuf should be one returned from the Cloud Datastore
Protobuf API.
:type pb: :class:`.entity_pb2.Entity`
:param pb: The Protobuf representing the entity.
:rtype: :class:`google.cloud.datastore.... | [
"def",
"entity_from_protobuf",
"(",
"pb",
")",
":",
"key",
"=",
"None",
"if",
"pb",
".",
"HasField",
"(",
"\"key\"",
")",
":",
"# Message field (Key)",
"key",
"=",
"key_from_protobuf",
"(",
"pb",
".",
"key",
")",
"entity_props",
"=",
"{",
"}",
"entity_mean... | Factory method for creating an entity based on a protobuf.
The protobuf should be one returned from the Cloud Datastore
Protobuf API.
:type pb: :class:`.entity_pb2.Entity`
:param pb: The Protobuf representing the entity.
:rtype: :class:`google.cloud.datastore.entity.Entity`
:returns: The enti... | [
"Factory",
"method",
"for",
"creating",
"an",
"entity",
"based",
"on",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L105-L159 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/helpers.py | _set_pb_meaning_from_entity | def _set_pb_meaning_from_entity(entity, name, value, value_pb, is_list=False):
"""Add meaning information (from an entity) to a protobuf.
:type entity: :class:`google.cloud.datastore.entity.Entity`
:param entity: The entity to be turned into a protobuf.
:type name: str
:param name: The name of the... | python | def _set_pb_meaning_from_entity(entity, name, value, value_pb, is_list=False):
"""Add meaning information (from an entity) to a protobuf.
:type entity: :class:`google.cloud.datastore.entity.Entity`
:param entity: The entity to be turned into a protobuf.
:type name: str
:param name: The name of the... | [
"def",
"_set_pb_meaning_from_entity",
"(",
"entity",
",",
"name",
",",
"value",
",",
"value_pb",
",",
"is_list",
"=",
"False",
")",
":",
"if",
"name",
"not",
"in",
"entity",
".",
"_meanings",
":",
"return",
"meaning",
",",
"orig_value",
"=",
"entity",
".",... | Add meaning information (from an entity) to a protobuf.
:type entity: :class:`google.cloud.datastore.entity.Entity`
:param entity: The entity to be turned into a protobuf.
:type name: str
:param name: The name of the property.
:type value: object
:param value: The current value stored as prop... | [
"Add",
"meaning",
"information",
"(",
"from",
"an",
"entity",
")",
"to",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L162-L199 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/helpers.py | entity_to_protobuf | def entity_to_protobuf(entity):
"""Converts an entity into a protobuf.
:type entity: :class:`google.cloud.datastore.entity.Entity`
:param entity: The entity to be turned into a protobuf.
:rtype: :class:`.entity_pb2.Entity`
:returns: The protobuf representing the entity.
"""
entity_pb = ent... | python | def entity_to_protobuf(entity):
"""Converts an entity into a protobuf.
:type entity: :class:`google.cloud.datastore.entity.Entity`
:param entity: The entity to be turned into a protobuf.
:rtype: :class:`.entity_pb2.Entity`
:returns: The protobuf representing the entity.
"""
entity_pb = ent... | [
"def",
"entity_to_protobuf",
"(",
"entity",
")",
":",
"entity_pb",
"=",
"entity_pb2",
".",
"Entity",
"(",
")",
"if",
"entity",
".",
"key",
"is",
"not",
"None",
":",
"key_pb",
"=",
"entity",
".",
"key",
".",
"to_protobuf",
"(",
")",
"entity_pb",
".",
"k... | Converts an entity into a protobuf.
:type entity: :class:`google.cloud.datastore.entity.Entity`
:param entity: The entity to be turned into a protobuf.
:rtype: :class:`.entity_pb2.Entity`
:returns: The protobuf representing the entity. | [
"Converts",
"an",
"entity",
"into",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L202-L236 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/helpers.py | get_read_options | def get_read_options(eventual, transaction_id):
"""Validate rules for read options, and assign to the request.
Helper method for ``lookup()`` and ``run_query``.
:type eventual: bool
:param eventual: Flag indicating if ``EVENTUAL`` or ``STRONG``
consistency should be used.
:ty... | python | def get_read_options(eventual, transaction_id):
"""Validate rules for read options, and assign to the request.
Helper method for ``lookup()`` and ``run_query``.
:type eventual: bool
:param eventual: Flag indicating if ``EVENTUAL`` or ``STRONG``
consistency should be used.
:ty... | [
"def",
"get_read_options",
"(",
"eventual",
",",
"transaction_id",
")",
":",
"if",
"transaction_id",
"is",
"None",
":",
"if",
"eventual",
":",
"return",
"datastore_pb2",
".",
"ReadOptions",
"(",
"read_consistency",
"=",
"datastore_pb2",
".",
"ReadOptions",
".",
... | Validate rules for read options, and assign to the request.
Helper method for ``lookup()`` and ``run_query``.
:type eventual: bool
:param eventual: Flag indicating if ``EVENTUAL`` or ``STRONG``
consistency should be used.
:type transaction_id: bytes
:param transaction_id: A t... | [
"Validate",
"rules",
"for",
"read",
"options",
"and",
"assign",
"to",
"the",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L239-L267 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/helpers.py | key_from_protobuf | def key_from_protobuf(pb):
"""Factory method for creating a key based on a protobuf.
The protobuf should be one returned from the Cloud Datastore
Protobuf API.
:type pb: :class:`.entity_pb2.Key`
:param pb: The Protobuf representing the key.
:rtype: :class:`google.cloud.datastore.key.Key`
... | python | def key_from_protobuf(pb):
"""Factory method for creating a key based on a protobuf.
The protobuf should be one returned from the Cloud Datastore
Protobuf API.
:type pb: :class:`.entity_pb2.Key`
:param pb: The Protobuf representing the key.
:rtype: :class:`google.cloud.datastore.key.Key`
... | [
"def",
"key_from_protobuf",
"(",
"pb",
")",
":",
"path_args",
"=",
"[",
"]",
"for",
"element",
"in",
"pb",
".",
"path",
":",
"path_args",
".",
"append",
"(",
"element",
".",
"kind",
")",
"if",
"element",
".",
"id",
":",
"# Simple field (int64)",
"path_ar... | Factory method for creating a key based on a protobuf.
The protobuf should be one returned from the Cloud Datastore
Protobuf API.
:type pb: :class:`.entity_pb2.Key`
:param pb: The Protobuf representing the key.
:rtype: :class:`google.cloud.datastore.key.Key`
:returns: a new `Key` instance | [
"Factory",
"method",
"for",
"creating",
"a",
"key",
"based",
"on",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L270-L299 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/helpers.py | _pb_attr_value | def _pb_attr_value(val):
"""Given a value, return the protobuf attribute name and proper value.
The Protobuf API uses different attribute names based on value types
rather than inferring the type. This function simply determines the
proper attribute name based on the type of the value provided and
... | python | def _pb_attr_value(val):
"""Given a value, return the protobuf attribute name and proper value.
The Protobuf API uses different attribute names based on value types
rather than inferring the type. This function simply determines the
proper attribute name based on the type of the value provided and
... | [
"def",
"_pb_attr_value",
"(",
"val",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"datetime",
".",
"datetime",
")",
":",
"name",
"=",
"\"timestamp\"",
"value",
"=",
"_datetime_to_pb_timestamp",
"(",
"val",
")",
"elif",
"isinstance",
"(",
"val",
",",
"Key... | Given a value, return the protobuf attribute name and proper value.
The Protobuf API uses different attribute names based on value types
rather than inferring the type. This function simply determines the
proper attribute name based on the type of the value provided and
returns the attribute name as w... | [
"Given",
"a",
"value",
"return",
"the",
"protobuf",
"attribute",
"name",
"and",
"proper",
"value",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L302-L368 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/helpers.py | _get_value_from_value_pb | def _get_value_from_value_pb(value_pb):
"""Given a protobuf for a Value, get the correct value.
The Cloud Datastore Protobuf API returns a Property Protobuf which
has one value set and the rest blank. This function retrieves the
the one value provided.
Some work is done to coerce the return value... | python | def _get_value_from_value_pb(value_pb):
"""Given a protobuf for a Value, get the correct value.
The Cloud Datastore Protobuf API returns a Property Protobuf which
has one value set and the rest blank. This function retrieves the
the one value provided.
Some work is done to coerce the return value... | [
"def",
"_get_value_from_value_pb",
"(",
"value_pb",
")",
":",
"value_type",
"=",
"value_pb",
".",
"WhichOneof",
"(",
"\"value_type\"",
")",
"if",
"value_type",
"==",
"\"timestamp_value\"",
":",
"result",
"=",
"_pb_timestamp_to_datetime",
"(",
"value_pb",
".",
"times... | Given a protobuf for a Value, get the correct value.
The Cloud Datastore Protobuf API returns a Property Protobuf which
has one value set and the rest blank. This function retrieves the
the one value provided.
Some work is done to coerce the return value into a more useful type
(particularly in t... | [
"Given",
"a",
"protobuf",
"for",
"a",
"Value",
"get",
"the",
"correct",
"value",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L371-L431 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/helpers.py | _set_protobuf_value | def _set_protobuf_value(value_pb, val):
"""Assign 'val' to the correct subfield of 'value_pb'.
The Protobuf API uses different attribute names based on value types
rather than inferring the type.
Some value types (entities, keys, lists) cannot be directly
assigned; this function handles them corre... | python | def _set_protobuf_value(value_pb, val):
"""Assign 'val' to the correct subfield of 'value_pb'.
The Protobuf API uses different attribute names based on value types
rather than inferring the type.
Some value types (entities, keys, lists) cannot be directly
assigned; this function handles them corre... | [
"def",
"_set_protobuf_value",
"(",
"value_pb",
",",
"val",
")",
":",
"attr",
",",
"val",
"=",
"_pb_attr_value",
"(",
"val",
")",
"if",
"attr",
"==",
"\"key_value\"",
":",
"value_pb",
".",
"key_value",
".",
"CopyFrom",
"(",
"val",
")",
"elif",
"attr",
"==... | Assign 'val' to the correct subfield of 'value_pb'.
The Protobuf API uses different attribute names based on value types
rather than inferring the type.
Some value types (entities, keys, lists) cannot be directly
assigned; this function handles them correctly.
:type value_pb: :class:`.entity_pb2.... | [
"Assign",
"val",
"to",
"the",
"correct",
"subfield",
"of",
"value_pb",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L434-L471 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/helpers.py | GeoPoint.to_protobuf | def to_protobuf(self):
"""Convert the current object to protobuf.
:rtype: :class:`google.type.latlng_pb2.LatLng`.
:returns: The current point as a protobuf.
"""
return latlng_pb2.LatLng(latitude=self.latitude, longitude=self.longitude) | python | def to_protobuf(self):
"""Convert the current object to protobuf.
:rtype: :class:`google.type.latlng_pb2.LatLng`.
:returns: The current point as a protobuf.
"""
return latlng_pb2.LatLng(latitude=self.latitude, longitude=self.longitude) | [
"def",
"to_protobuf",
"(",
"self",
")",
":",
"return",
"latlng_pb2",
".",
"LatLng",
"(",
"latitude",
"=",
"self",
".",
"latitude",
",",
"longitude",
"=",
"self",
".",
"longitude",
")"
] | Convert the current object to protobuf.
:rtype: :class:`google.type.latlng_pb2.LatLng`.
:returns: The current point as a protobuf. | [
"Convert",
"the",
"current",
"object",
"to",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L488-L494 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/entries.py | LogEntry.from_api_repr | def from_api_repr(cls, resource, client, loggers=None):
"""Factory: construct an entry given its API representation
:type resource: dict
:param resource: text entry resource representation returned from
the API
:type client: :class:`google.cloud.logging.client... | python | def from_api_repr(cls, resource, client, loggers=None):
"""Factory: construct an entry given its API representation
:type resource: dict
:param resource: text entry resource representation returned from
the API
:type client: :class:`google.cloud.logging.client... | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
",",
"client",
",",
"loggers",
"=",
"None",
")",
":",
"if",
"loggers",
"is",
"None",
":",
"loggers",
"=",
"{",
"}",
"logger_fullname",
"=",
"resource",
"[",
"\"logName\"",
"]",
"logger",
"=",
"loggers"... | Factory: construct an entry given its API representation
:type resource: dict
:param resource: text entry resource representation returned from
the API
:type client: :class:`google.cloud.logging.client.Client`
:param client: Client which holds credentials and ... | [
"Factory",
":",
"construct",
"an",
"entry",
"given",
"its",
"API",
"representation"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/entries.py#L165-L232 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/entries.py | LogEntry.to_api_repr | def to_api_repr(self):
"""API repr (JSON format) for entry.
"""
info = {}
if self.log_name is not None:
info["logName"] = self.log_name
if self.resource is not None:
info["resource"] = self.resource._to_dict()
if self.labels is not None:
... | python | def to_api_repr(self):
"""API repr (JSON format) for entry.
"""
info = {}
if self.log_name is not None:
info["logName"] = self.log_name
if self.resource is not None:
info["resource"] = self.resource._to_dict()
if self.labels is not None:
... | [
"def",
"to_api_repr",
"(",
"self",
")",
":",
"info",
"=",
"{",
"}",
"if",
"self",
".",
"log_name",
"is",
"not",
"None",
":",
"info",
"[",
"\"logName\"",
"]",
"=",
"self",
".",
"log_name",
"if",
"self",
".",
"resource",
"is",
"not",
"None",
":",
"in... | API repr (JSON format) for entry. | [
"API",
"repr",
"(",
"JSON",
"format",
")",
"for",
"entry",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/entries.py#L234-L264 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/entries.py | TextEntry.to_api_repr | def to_api_repr(self):
"""API repr (JSON format) for entry.
"""
info = super(TextEntry, self).to_api_repr()
info["textPayload"] = self.payload
return info | python | def to_api_repr(self):
"""API repr (JSON format) for entry.
"""
info = super(TextEntry, self).to_api_repr()
info["textPayload"] = self.payload
return info | [
"def",
"to_api_repr",
"(",
"self",
")",
":",
"info",
"=",
"super",
"(",
"TextEntry",
",",
"self",
")",
".",
"to_api_repr",
"(",
")",
"info",
"[",
"\"textPayload\"",
"]",
"=",
"self",
".",
"payload",
"return",
"info"
] | API repr (JSON format) for entry. | [
"API",
"repr",
"(",
"JSON",
"format",
")",
"for",
"entry",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/entries.py#L287-L292 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/entries.py | StructEntry.to_api_repr | def to_api_repr(self):
"""API repr (JSON format) for entry.
"""
info = super(StructEntry, self).to_api_repr()
info["jsonPayload"] = self.payload
return info | python | def to_api_repr(self):
"""API repr (JSON format) for entry.
"""
info = super(StructEntry, self).to_api_repr()
info["jsonPayload"] = self.payload
return info | [
"def",
"to_api_repr",
"(",
"self",
")",
":",
"info",
"=",
"super",
"(",
"StructEntry",
",",
"self",
")",
".",
"to_api_repr",
"(",
")",
"info",
"[",
"\"jsonPayload\"",
"]",
"=",
"self",
".",
"payload",
"return",
"info"
] | API repr (JSON format) for entry. | [
"API",
"repr",
"(",
"JSON",
"format",
")",
"for",
"entry",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/entries.py#L315-L320 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/entries.py | ProtobufEntry.to_api_repr | def to_api_repr(self):
"""API repr (JSON format) for entry.
"""
info = super(ProtobufEntry, self).to_api_repr()
info["protoPayload"] = MessageToDict(self.payload)
return info | python | def to_api_repr(self):
"""API repr (JSON format) for entry.
"""
info = super(ProtobufEntry, self).to_api_repr()
info["protoPayload"] = MessageToDict(self.payload)
return info | [
"def",
"to_api_repr",
"(",
"self",
")",
":",
"info",
"=",
"super",
"(",
"ProtobufEntry",
",",
"self",
")",
".",
"to_api_repr",
"(",
")",
"info",
"[",
"\"protoPayload\"",
"]",
"=",
"MessageToDict",
"(",
"self",
".",
"payload",
")",
"return",
"info"
] | API repr (JSON format) for entry. | [
"API",
"repr",
"(",
"JSON",
"format",
")",
"for",
"entry",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/entries.py#L353-L358 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/types.py | TimeFromTicks | def TimeFromTicks(ticks, tz=None):
"""Construct a DB-API time value from the given ticks value.
:type ticks: float
:param ticks:
a number of seconds since the epoch; see the documentation of the
standard Python time module for details.
:type tz: :class:`datetime.tzinfo`
:param tz: ... | python | def TimeFromTicks(ticks, tz=None):
"""Construct a DB-API time value from the given ticks value.
:type ticks: float
:param ticks:
a number of seconds since the epoch; see the documentation of the
standard Python time module for details.
:type tz: :class:`datetime.tzinfo`
:param tz: ... | [
"def",
"TimeFromTicks",
"(",
"ticks",
",",
"tz",
"=",
"None",
")",
":",
"dt",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"ticks",
",",
"tz",
"=",
"tz",
")",
"return",
"dt",
".",
"timetz",
"(",
")"
] | Construct a DB-API time value from the given ticks value.
:type ticks: float
:param ticks:
a number of seconds since the epoch; see the documentation of the
standard Python time module for details.
:type tz: :class:`datetime.tzinfo`
:param tz: (Optional) time zone to use for conversion... | [
"Construct",
"a",
"DB",
"-",
"API",
"time",
"value",
"from",
"the",
"given",
"ticks",
"value",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/types.py#L45-L60 | train |
googleapis/google-cloud-python | iot/google/cloud/iot_v1/gapic/device_manager_client.py | DeviceManagerClient.registry_path | def registry_path(cls, project, location, registry):
"""Return a fully-qualified registry string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/registries/{registry}",
project=project,
location=location,
registry=... | python | def registry_path(cls, project, location, registry):
"""Return a fully-qualified registry string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/registries/{registry}",
project=project,
location=location,
registry=... | [
"def",
"registry_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"registry",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/registries/{registry}\"",
",",
"project",
"=",
"... | Return a fully-qualified registry string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"registry",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iot/google/cloud/iot_v1/gapic/device_manager_client.py#L86-L93 | train |
googleapis/google-cloud-python | iot/google/cloud/iot_v1/gapic/device_manager_client.py | DeviceManagerClient.device_path | def device_path(cls, project, location, registry, device):
"""Return a fully-qualified device string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/registries/{registry}/devices/{device}",
project=project,
location=location,
... | python | def device_path(cls, project, location, registry, device):
"""Return a fully-qualified device string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/registries/{registry}/devices/{device}",
project=project,
location=location,
... | [
"def",
"device_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"registry",
",",
"device",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/registries/{registry}/devices/{device}\... | Return a fully-qualified device string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"device",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iot/google/cloud/iot_v1/gapic/device_manager_client.py#L96-L104 | train |
googleapis/google-cloud-python | iot/google/cloud/iot_v1/gapic/device_manager_client.py | DeviceManagerClient.create_device | def create_device(
self,
parent,
device,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a device in a device registry.
Example:
>>> from google.cloud im... | python | def create_device(
self,
parent,
device,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a device in a device registry.
Example:
>>> from google.cloud im... | [
"def",
"create_device",
"(",
"self",
",",
"parent",
",",
"device",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT... | Creates a device in a device registry.
Example:
>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> parent = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> # TODO: In... | [
"Creates",
"a",
"device",
"in",
"a",
"device",
"registry",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iot/google/cloud/iot_v1/gapic/device_manager_client.py#L618-L697 | train |
googleapis/google-cloud-python | iot/google/cloud/iot_v1/gapic/device_manager_client.py | DeviceManagerClient.set_iam_policy | def set_iam_policy(
self,
resource,
policy,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Sets the access control policy on the specified resource. Replaces any
existing po... | python | def set_iam_policy(
self,
resource,
policy,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Sets the access control policy on the specified resource. Replaces any
existing po... | [
"def",
"set_iam_policy",
"(",
"self",
",",
"resource",
",",
"policy",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFA... | Sets the access control policy on the specified resource. Replaces any
existing policy.
Example:
>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> resource = client.registry_path('[PROJECT]', '[LOCATION]... | [
"Sets",
"the",
"access",
"control",
"policy",
"on",
"the",
"specified",
"resource",
".",
"Replaces",
"any",
"existing",
"policy",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iot/google/cloud/iot_v1/gapic/device_manager_client.py#L1311-L1392 | train |
googleapis/google-cloud-python | iot/google/cloud/iot_v1/gapic/device_manager_client.py | DeviceManagerClient.bind_device_to_gateway | def bind_device_to_gateway(
self,
parent,
gateway_id,
device_id,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Associates the device with the gateway.
Example:
... | python | def bind_device_to_gateway(
self,
parent,
gateway_id,
device_id,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Associates the device with the gateway.
Example:
... | [
"def",
"bind_device_to_gateway",
"(",
"self",
",",
"parent",
",",
"gateway_id",
",",
"device_id",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
... | Associates the device with the gateway.
Example:
>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> parent = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> # TODO: I... | [
"Associates",
"the",
"device",
"with",
"the",
"gateway",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iot/google/cloud/iot_v1/gapic/device_manager_client.py#L1649-L1732 | train |
googleapis/google-cloud-python | tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py | CloudTasksClient.queue_path | def queue_path(cls, project, location, queue):
"""Return a fully-qualified queue string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/queues/{queue}",
project=project,
location=location,
queue=queue,
) | python | def queue_path(cls, project, location, queue):
"""Return a fully-qualified queue string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/queues/{queue}",
project=project,
location=location,
queue=queue,
) | [
"def",
"queue_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"queue",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/queues/{queue}\"",
",",
"project",
"=",
"project",
"... | Return a fully-qualified queue string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"queue",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py#L97-L104 | train |
googleapis/google-cloud-python | tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py | CloudTasksClient.task_path | def task_path(cls, project, location, queue, task):
"""Return a fully-qualified task string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/queues/{queue}/tasks/{task}",
project=project,
location=location,
queue=qu... | python | def task_path(cls, project, location, queue, task):
"""Return a fully-qualified task string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/queues/{queue}/tasks/{task}",
project=project,
location=location,
queue=qu... | [
"def",
"task_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"queue",
",",
"task",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/queues/{queue}/tasks/{task}\"",
",",
"proj... | Return a fully-qualified task string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"task",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py#L107-L115 | train |
googleapis/google-cloud-python | tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py | CloudTasksClient.create_queue | def create_queue(
self,
parent,
queue,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a queue.
Queues created with this method allow tasks to live for a maximum of ... | python | def create_queue(
self,
parent,
queue,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a queue.
Queues created with this method allow tasks to live for a maximum of ... | [
"def",
"create_queue",
"(",
"self",
",",
"parent",
",",
"queue",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",... | Creates a queue.
Queues created with this method allow tasks to live for a maximum of 31
days. After a task is 31 days old, the task will be deleted regardless
of whether it was dispatched or not.
WARNING: Using this method may have unintended side effects if you are
using an A... | [
"Creates",
"a",
"queue",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py#L407-L502 | train |
googleapis/google-cloud-python | tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py | CloudTasksClient.create_task | def create_task(
self,
parent,
task,
response_view=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a task and adds it to a queue.
Tasks cannot be updat... | python | def create_task(
self,
parent,
task,
response_view=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a task and adds it to a queue.
Tasks cannot be updat... | [
"def",
"create_task",
"(",
"self",
",",
"parent",
",",
"task",
",",
"response_view",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1... | Creates a task and adds it to a queue.
Tasks cannot be updated after creation; there is no UpdateTask command.
- For ``App Engine queues``, the maximum task size is 100KB.
Example:
>>> from google.cloud import tasks_v2
>>>
>>> client = tasks_v2.CloudTasksC... | [
"Creates",
"a",
"task",
"and",
"adds",
"it",
"to",
"a",
"queue",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py#L1387-L1516 | train |
googleapis/google-cloud-python | api_core/google/api_core/timeout.py | _exponential_timeout_generator | def _exponential_timeout_generator(initial, maximum, multiplier, deadline):
"""A generator that yields exponential timeout values.
Args:
initial (float): The initial timeout.
maximum (float): The maximum timeout.
multiplier (float): The multiplier applied to the timeout.
deadlin... | python | def _exponential_timeout_generator(initial, maximum, multiplier, deadline):
"""A generator that yields exponential timeout values.
Args:
initial (float): The initial timeout.
maximum (float): The maximum timeout.
multiplier (float): The multiplier applied to the timeout.
deadlin... | [
"def",
"_exponential_timeout_generator",
"(",
"initial",
",",
"maximum",
",",
"multiplier",
",",
"deadline",
")",
":",
"if",
"deadline",
"is",
"not",
"None",
":",
"deadline_datetime",
"=",
"datetime_helpers",
".",
"utcnow",
"(",
")",
"+",
"datetime",
".",
"tim... | A generator that yields exponential timeout values.
Args:
initial (float): The initial timeout.
maximum (float): The maximum timeout.
multiplier (float): The multiplier applied to the timeout.
deadline (float): The overall deadline across all invocations.
Yields:
float:... | [
"A",
"generator",
"that",
"yields",
"exponential",
"timeout",
"values",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/timeout.py#L110-L140 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/cursor.py | _format_operation_list | def _format_operation_list(operation, parameters):
"""Formats parameters in operation in the way BigQuery expects.
The input operation will be a query like ``SELECT %s`` and the output
will be a query like ``SELECT ?``.
:type operation: str
:param operation: A Google BigQuery query string.
:t... | python | def _format_operation_list(operation, parameters):
"""Formats parameters in operation in the way BigQuery expects.
The input operation will be a query like ``SELECT %s`` and the output
will be a query like ``SELECT ?``.
:type operation: str
:param operation: A Google BigQuery query string.
:t... | [
"def",
"_format_operation_list",
"(",
"operation",
",",
"parameters",
")",
":",
"formatted_params",
"=",
"[",
"\"?\"",
"for",
"_",
"in",
"parameters",
"]",
"try",
":",
"return",
"operation",
"%",
"tuple",
"(",
"formatted_params",
")",
"except",
"TypeError",
"a... | Formats parameters in operation in the way BigQuery expects.
The input operation will be a query like ``SELECT %s`` and the output
will be a query like ``SELECT ?``.
:type operation: str
:param operation: A Google BigQuery query string.
:type parameters: Sequence[Any]
:param parameters: Seque... | [
"Formats",
"parameters",
"in",
"operation",
"in",
"the",
"way",
"BigQuery",
"expects",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L282-L305 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/cursor.py | _format_operation_dict | def _format_operation_dict(operation, parameters):
"""Formats parameters in operation in the way BigQuery expects.
The input operation will be a query like ``SELECT %(namedparam)s`` and
the output will be a query like ``SELECT @namedparam``.
:type operation: str
:param operation: A Google BigQuery... | python | def _format_operation_dict(operation, parameters):
"""Formats parameters in operation in the way BigQuery expects.
The input operation will be a query like ``SELECT %(namedparam)s`` and
the output will be a query like ``SELECT @namedparam``.
:type operation: str
:param operation: A Google BigQuery... | [
"def",
"_format_operation_dict",
"(",
"operation",
",",
"parameters",
")",
":",
"formatted_params",
"=",
"{",
"}",
"for",
"name",
"in",
"parameters",
":",
"escaped_name",
"=",
"name",
".",
"replace",
"(",
"\"`\"",
",",
"r\"\\`\"",
")",
"formatted_params",
"[",... | Formats parameters in operation in the way BigQuery expects.
The input operation will be a query like ``SELECT %(namedparam)s`` and
the output will be a query like ``SELECT @namedparam``.
:type operation: str
:param operation: A Google BigQuery query string.
:type parameters: Mapping[str, Any]
... | [
"Formats",
"parameters",
"in",
"operation",
"in",
"the",
"way",
"BigQuery",
"expects",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L308-L334 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/cursor.py | _format_operation | def _format_operation(operation, parameters=None):
"""Formats parameters in operation in way BigQuery expects.
:type: str
:param operation: A Google BigQuery query string.
:type: Mapping[str, Any] or Sequence[Any]
:param parameters: Optional parameter values.
:rtype: str
:returns: A forma... | python | def _format_operation(operation, parameters=None):
"""Formats parameters in operation in way BigQuery expects.
:type: str
:param operation: A Google BigQuery query string.
:type: Mapping[str, Any] or Sequence[Any]
:param parameters: Optional parameter values.
:rtype: str
:returns: A forma... | [
"def",
"_format_operation",
"(",
"operation",
",",
"parameters",
"=",
"None",
")",
":",
"if",
"parameters",
"is",
"None",
":",
"return",
"operation",
"if",
"isinstance",
"(",
"parameters",
",",
"collections_abc",
".",
"Mapping",
")",
":",
"return",
"_format_op... | Formats parameters in operation in way BigQuery expects.
:type: str
:param operation: A Google BigQuery query string.
:type: Mapping[str, Any] or Sequence[Any]
:param parameters: Optional parameter values.
:rtype: str
:returns: A formatted query string.
:raises: :class:`~google.cloud.bigq... | [
"Formats",
"parameters",
"in",
"operation",
"in",
"way",
"BigQuery",
"expects",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L337-L358 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/cursor.py | Cursor._set_description | def _set_description(self, schema):
"""Set description from schema.
:type schema: Sequence[google.cloud.bigquery.schema.SchemaField]
:param schema: A description of fields in the schema.
"""
if schema is None:
self.description = None
return
self.... | python | def _set_description(self, schema):
"""Set description from schema.
:type schema: Sequence[google.cloud.bigquery.schema.SchemaField]
:param schema: A description of fields in the schema.
"""
if schema is None:
self.description = None
return
self.... | [
"def",
"_set_description",
"(",
"self",
",",
"schema",
")",
":",
"if",
"schema",
"is",
"None",
":",
"self",
".",
"description",
"=",
"None",
"return",
"self",
".",
"description",
"=",
"tuple",
"(",
"[",
"Column",
"(",
"name",
"=",
"field",
".",
"name",... | Set description from schema.
:type schema: Sequence[google.cloud.bigquery.schema.SchemaField]
:param schema: A description of fields in the schema. | [
"Set",
"description",
"from",
"schema",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L72-L95 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/cursor.py | Cursor._set_rowcount | def _set_rowcount(self, query_results):
"""Set the rowcount from query results.
Normally, this sets rowcount to the number of rows returned by the
query, but if it was a DML statement, it sets rowcount to the number
of modified rows.
:type query_results:
:class:`~go... | python | def _set_rowcount(self, query_results):
"""Set the rowcount from query results.
Normally, this sets rowcount to the number of rows returned by the
query, but if it was a DML statement, it sets rowcount to the number
of modified rows.
:type query_results:
:class:`~go... | [
"def",
"_set_rowcount",
"(",
"self",
",",
"query_results",
")",
":",
"total_rows",
"=",
"0",
"num_dml_affected_rows",
"=",
"query_results",
".",
"num_dml_affected_rows",
"if",
"query_results",
".",
"total_rows",
"is",
"not",
"None",
"and",
"query_results",
".",
"t... | Set the rowcount from query results.
Normally, this sets rowcount to the number of rows returned by the
query, but if it was a DML statement, it sets rowcount to the number
of modified rows.
:type query_results:
:class:`~google.cloud.bigquery.query._QueryResults`
:p... | [
"Set",
"the",
"rowcount",
"from",
"query",
"results",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L97-L115 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/cursor.py | Cursor.execute | def execute(self, operation, parameters=None, job_id=None):
"""Prepare and execute a database operation.
.. note::
When setting query parameters, values which are "text"
(``unicode`` in Python2, ``str`` in Python3) will use
the 'STRING' BigQuery type. Values which ar... | python | def execute(self, operation, parameters=None, job_id=None):
"""Prepare and execute a database operation.
.. note::
When setting query parameters, values which are "text"
(``unicode`` in Python2, ``str`` in Python3) will use
the 'STRING' BigQuery type. Values which ar... | [
"def",
"execute",
"(",
"self",
",",
"operation",
",",
"parameters",
"=",
"None",
",",
"job_id",
"=",
"None",
")",
":",
"self",
".",
"_query_data",
"=",
"None",
"self",
".",
"_query_job",
"=",
"None",
"client",
"=",
"self",
".",
"connection",
".",
"_cli... | Prepare and execute a database operation.
.. note::
When setting query parameters, values which are "text"
(``unicode`` in Python2, ``str`` in Python3) will use
the 'STRING' BigQuery type. Values which are "bytes" (``str`` in
Python2, ``bytes`` in Python3), will ... | [
"Prepare",
"and",
"execute",
"a",
"database",
"operation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L117-L176 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/cursor.py | Cursor._try_fetch | def _try_fetch(self, size=None):
"""Try to start fetching data, if not yet started.
Mutates self to indicate that iteration has started.
"""
if self._query_job is None:
raise exceptions.InterfaceError(
"No query results: execute() must be called before fetch.... | python | def _try_fetch(self, size=None):
"""Try to start fetching data, if not yet started.
Mutates self to indicate that iteration has started.
"""
if self._query_job is None:
raise exceptions.InterfaceError(
"No query results: execute() must be called before fetch.... | [
"def",
"_try_fetch",
"(",
"self",
",",
"size",
"=",
"None",
")",
":",
"if",
"self",
".",
"_query_job",
"is",
"None",
":",
"raise",
"exceptions",
".",
"InterfaceError",
"(",
"\"No query results: execute() must be called before fetch.\"",
")",
"is_dml",
"=",
"(",
... | Try to start fetching data, if not yet started.
Mutates self to indicate that iteration has started. | [
"Try",
"to",
"start",
"fetching",
"data",
"if",
"not",
"yet",
"started",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L190-L215 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/cursor.py | Cursor.fetchmany | def fetchmany(self, size=None):
"""Fetch multiple results from the last ``execute*()`` call.
.. note::
The size parameter is not used for the request/response size.
Set the ``arraysize`` attribute before calling ``execute()`` to
set the batch size.
:type siz... | python | def fetchmany(self, size=None):
"""Fetch multiple results from the last ``execute*()`` call.
.. note::
The size parameter is not used for the request/response size.
Set the ``arraysize`` attribute before calling ``execute()`` to
set the batch size.
:type siz... | [
"def",
"fetchmany",
"(",
"self",
",",
"size",
"=",
"None",
")",
":",
"if",
"size",
"is",
"None",
":",
"size",
"=",
"self",
".",
"arraysize",
"self",
".",
"_try_fetch",
"(",
"size",
"=",
"size",
")",
"rows",
"=",
"[",
"]",
"for",
"row",
"in",
"sel... | Fetch multiple results from the last ``execute*()`` call.
.. note::
The size parameter is not used for the request/response size.
Set the ``arraysize`` attribute before calling ``execute()`` to
set the batch size.
:type size: int
:param size:
(Op... | [
"Fetch",
"multiple",
"results",
"from",
"the",
"last",
"execute",
"*",
"()",
"call",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L233-L262 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/gapic/transports/spanner_grpc_transport.py | SpannerGrpcTransport.create_channel | def create_channel(cls, address="spanner.googleapis.com:443", credentials=None):
"""Create and return a gRPC channel object.
Args:
address (str): The host for the channel to use.
credentials (~.Credentials): The
authorization credentials to attach to requests. Th... | python | def create_channel(cls, address="spanner.googleapis.com:443", credentials=None):
"""Create and return a gRPC channel object.
Args:
address (str): The host for the channel to use.
credentials (~.Credentials): The
authorization credentials to attach to requests. Th... | [
"def",
"create_channel",
"(",
"cls",
",",
"address",
"=",
"\"spanner.googleapis.com:443\"",
",",
"credentials",
"=",
"None",
")",
":",
"grpc_gcp_config",
"=",
"grpc_gcp",
".",
"api_config_from_text_pb",
"(",
"pkg_resources",
".",
"resource_string",
"(",
"__name__",
... | Create and return a gRPC channel object.
Args:
address (str): The host for the channel to use.
credentials (~.Credentials): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If
... | [
"Create",
"and",
"return",
"a",
"gRPC",
"channel",
"object",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/gapic/transports/spanner_grpc_transport.py#L78-L98 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/sink.py | Sink._update_from_api_repr | def _update_from_api_repr(self, resource):
"""Helper for API methods returning sink resources."""
self.destination = resource["destination"]
self.filter_ = resource.get("filter")
self._writer_identity = resource.get("writerIdentity") | python | def _update_from_api_repr(self, resource):
"""Helper for API methods returning sink resources."""
self.destination = resource["destination"]
self.filter_ = resource.get("filter")
self._writer_identity = resource.get("writerIdentity") | [
"def",
"_update_from_api_repr",
"(",
"self",
",",
"resource",
")",
":",
"self",
".",
"destination",
"=",
"resource",
"[",
"\"destination\"",
"]",
"self",
".",
"filter_",
"=",
"resource",
".",
"get",
"(",
"\"filter\"",
")",
"self",
".",
"_writer_identity",
"=... | Helper for API methods returning sink resources. | [
"Helper",
"for",
"API",
"methods",
"returning",
"sink",
"resources",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/sink.py#L75-L79 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/sink.py | Sink.from_api_repr | def from_api_repr(cls, resource, client):
"""Factory: construct a sink given its API representation
:type resource: dict
:param resource: sink resource representation returned from the API
:type client: :class:`google.cloud.logging.client.Client`
:param client: Client which ho... | python | def from_api_repr(cls, resource, client):
"""Factory: construct a sink given its API representation
:type resource: dict
:param resource: sink resource representation returned from the API
:type client: :class:`google.cloud.logging.client.Client`
:param client: Client which ho... | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
",",
"client",
")",
":",
"sink_name",
"=",
"resource",
"[",
"\"name\"",
"]",
"instance",
"=",
"cls",
"(",
"sink_name",
",",
"client",
"=",
"client",
")",
"instance",
".",
"_update_from_api_repr",
"(",
"r... | Factory: construct a sink given its API representation
:type resource: dict
:param resource: sink resource representation returned from the API
:type client: :class:`google.cloud.logging.client.Client`
:param client: Client which holds credentials and project
co... | [
"Factory",
":",
"construct",
"a",
"sink",
"given",
"its",
"API",
"representation"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/sink.py#L82-L101 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/sink.py | Sink.create | def create(self, client=None, unique_writer_identity=False):
"""API call: create the sink via a PUT request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/create
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneTy... | python | def create(self, client=None, unique_writer_identity=False):
"""API call: create the sink via a PUT request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/create
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneTy... | [
"def",
"create",
"(",
"self",
",",
"client",
"=",
"None",
",",
"unique_writer_identity",
"=",
"False",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"resource",
"=",
"client",
".",
"sinks_api",
".",
"sink_create",
"(",
"self"... | API call: create the sink via a PUT request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/create
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not passed, falls bac... | [
"API",
"call",
":",
"create",
"the",
"sink",
"via",
"a",
"PUT",
"request"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/sink.py#L118-L142 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/sink.py | Sink.exists | def exists(self, client=None):
"""API call: test for the existence of the sink via a GET request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:... | python | def exists(self, client=None):
"""API call: test for the existence of the sink via a GET request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:... | [
"def",
"exists",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"try",
":",
"client",
".",
"sinks_api",
".",
"sink_get",
"(",
"self",
".",
"project",
",",
"self",
".",
"name",
")"... | API call: test for the existence of the sink via a GET request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not p... | [
"API",
"call",
":",
"test",
"for",
"the",
"existence",
"of",
"the",
"sink",
"via",
"a",
"GET",
"request"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/sink.py#L144-L165 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/sink.py | Sink.reload | def reload(self, client=None):
"""API call: sync local sink configuration via a GET request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param... | python | def reload(self, client=None):
"""API call: sync local sink configuration via a GET request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param... | [
"def",
"reload",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"resource",
"=",
"client",
".",
"sinks_api",
".",
"sink_get",
"(",
"self",
".",
"project",
",",
"self",
".",
"name",
... | API call: sync local sink configuration via a GET request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not passed... | [
"API",
"call",
":",
"sync",
"local",
"sink",
"configuration",
"via",
"a",
"GET",
"request"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/sink.py#L167-L180 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/sink.py | Sink.update | def update(self, client=None, unique_writer_identity=False):
"""API call: update sink configuration via a PUT request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/update
:type client: :class:`~google.cloud.logging.client.Client` or
... | python | def update(self, client=None, unique_writer_identity=False):
"""API call: update sink configuration via a PUT request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/update
:type client: :class:`~google.cloud.logging.client.Client` or
... | [
"def",
"update",
"(",
"self",
",",
"client",
"=",
"None",
",",
"unique_writer_identity",
"=",
"False",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"resource",
"=",
"client",
".",
"sinks_api",
".",
"sink_update",
"(",
"self"... | API call: update sink configuration via a PUT request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/update
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not passed,... | [
"API",
"call",
":",
"update",
"sink",
"configuration",
"via",
"a",
"PUT",
"request"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/sink.py#L182-L206 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/sink.py | Sink.delete | def delete(self, client=None):
"""API call: delete a sink via a DELETE request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/delete
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: t... | python | def delete(self, client=None):
"""API call: delete a sink via a DELETE request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/delete
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: t... | [
"def",
"delete",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"client",
".",
"sinks_api",
".",
"sink_delete",
"(",
"self",
".",
"project",
",",
"self",
".",
"name",
")"
] | API call: delete a sink via a DELETE request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/delete
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client: the client to use. If not passed, falls ba... | [
"API",
"call",
":",
"delete",
"a",
"sink",
"via",
"a",
"DELETE",
"request"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/sink.py#L208-L220 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/streamed.py | _merge_float64 | def _merge_float64(lhs, rhs, type_): # pylint: disable=unused-argument
"""Helper for '_merge_by_type'."""
lhs_kind = lhs.WhichOneof("kind")
if lhs_kind == "string_value":
return Value(string_value=lhs.string_value + rhs.string_value)
rhs_kind = rhs.WhichOneof("kind")
array_continuation = (
... | python | def _merge_float64(lhs, rhs, type_): # pylint: disable=unused-argument
"""Helper for '_merge_by_type'."""
lhs_kind = lhs.WhichOneof("kind")
if lhs_kind == "string_value":
return Value(string_value=lhs.string_value + rhs.string_value)
rhs_kind = rhs.WhichOneof("kind")
array_continuation = (
... | [
"def",
"_merge_float64",
"(",
"lhs",
",",
"rhs",
",",
"type_",
")",
":",
"# pylint: disable=unused-argument",
"lhs_kind",
"=",
"lhs",
".",
"WhichOneof",
"(",
"\"kind\"",
")",
"if",
"lhs_kind",
"==",
"\"string_value\"",
":",
"return",
"Value",
"(",
"string_value"... | Helper for '_merge_by_type'. | [
"Helper",
"for",
"_merge_by_type",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L222-L235 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/streamed.py | _merge_string | def _merge_string(lhs, rhs, type_): # pylint: disable=unused-argument
"""Helper for '_merge_by_type'."""
return Value(string_value=lhs.string_value + rhs.string_value) | python | def _merge_string(lhs, rhs, type_): # pylint: disable=unused-argument
"""Helper for '_merge_by_type'."""
return Value(string_value=lhs.string_value + rhs.string_value) | [
"def",
"_merge_string",
"(",
"lhs",
",",
"rhs",
",",
"type_",
")",
":",
"# pylint: disable=unused-argument",
"return",
"Value",
"(",
"string_value",
"=",
"lhs",
".",
"string_value",
"+",
"rhs",
".",
"string_value",
")"
] | Helper for '_merge_by_type'. | [
"Helper",
"for",
"_merge_by_type",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L238-L240 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/streamed.py | _merge_array | def _merge_array(lhs, rhs, type_):
"""Helper for '_merge_by_type'."""
element_type = type_.array_element_type
if element_type.code in _UNMERGEABLE_TYPES:
# Individual values cannot be merged, just concatenate
lhs.list_value.values.extend(rhs.list_value.values)
return lhs
lhs, rhs... | python | def _merge_array(lhs, rhs, type_):
"""Helper for '_merge_by_type'."""
element_type = type_.array_element_type
if element_type.code in _UNMERGEABLE_TYPES:
# Individual values cannot be merged, just concatenate
lhs.list_value.values.extend(rhs.list_value.values)
return lhs
lhs, rhs... | [
"def",
"_merge_array",
"(",
"lhs",
",",
"rhs",
",",
"type_",
")",
":",
"element_type",
"=",
"type_",
".",
"array_element_type",
"if",
"element_type",
".",
"code",
"in",
"_UNMERGEABLE_TYPES",
":",
"# Individual values cannot be merged, just concatenate",
"lhs",
".",
... | Helper for '_merge_by_type'. | [
"Helper",
"for",
"_merge_by_type",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L246-L272 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/streamed.py | _merge_struct | def _merge_struct(lhs, rhs, type_):
"""Helper for '_merge_by_type'."""
fields = type_.struct_type.fields
lhs, rhs = list(lhs.list_value.values), list(rhs.list_value.values)
candidate_type = fields[len(lhs) - 1].type
first = rhs.pop(0)
if first.HasField("null_value") or candidate_type.code in _UN... | python | def _merge_struct(lhs, rhs, type_):
"""Helper for '_merge_by_type'."""
fields = type_.struct_type.fields
lhs, rhs = list(lhs.list_value.values), list(rhs.list_value.values)
candidate_type = fields[len(lhs) - 1].type
first = rhs.pop(0)
if first.HasField("null_value") or candidate_type.code in _UN... | [
"def",
"_merge_struct",
"(",
"lhs",
",",
"rhs",
",",
"type_",
")",
":",
"fields",
"=",
"type_",
".",
"struct_type",
".",
"fields",
"lhs",
",",
"rhs",
"=",
"list",
"(",
"lhs",
".",
"list_value",
".",
"values",
")",
",",
"list",
"(",
"rhs",
".",
"lis... | Helper for '_merge_by_type'. | [
"Helper",
"for",
"_merge_by_type",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L275-L286 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/streamed.py | _merge_by_type | def _merge_by_type(lhs, rhs, type_):
"""Helper for '_merge_chunk'."""
merger = _MERGE_BY_TYPE[type_.code]
return merger(lhs, rhs, type_) | python | def _merge_by_type(lhs, rhs, type_):
"""Helper for '_merge_chunk'."""
merger = _MERGE_BY_TYPE[type_.code]
return merger(lhs, rhs, type_) | [
"def",
"_merge_by_type",
"(",
"lhs",
",",
"rhs",
",",
"type_",
")",
":",
"merger",
"=",
"_MERGE_BY_TYPE",
"[",
"type_",
".",
"code",
"]",
"return",
"merger",
"(",
"lhs",
",",
"rhs",
",",
"type_",
")"
] | Helper for '_merge_chunk'. | [
"Helper",
"for",
"_merge_chunk",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L302-L305 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/streamed.py | StreamedResultSet._merge_chunk | def _merge_chunk(self, value):
"""Merge pending chunk with next value.
:type value: :class:`~google.protobuf.struct_pb2.Value`
:param value: continuation of chunked value from previous
partial result set.
:rtype: :class:`~google.protobuf.struct_pb2.Value`
... | python | def _merge_chunk(self, value):
"""Merge pending chunk with next value.
:type value: :class:`~google.protobuf.struct_pb2.Value`
:param value: continuation of chunked value from previous
partial result set.
:rtype: :class:`~google.protobuf.struct_pb2.Value`
... | [
"def",
"_merge_chunk",
"(",
"self",
",",
"value",
")",
":",
"current_column",
"=",
"len",
"(",
"self",
".",
"_current_row",
")",
"field",
"=",
"self",
".",
"fields",
"[",
"current_column",
"]",
"merged",
"=",
"_merge_by_type",
"(",
"self",
".",
"_pending_c... | Merge pending chunk with next value.
:type value: :class:`~google.protobuf.struct_pb2.Value`
:param value: continuation of chunked value from previous
partial result set.
:rtype: :class:`~google.protobuf.struct_pb2.Value`
:returns: the merged value | [
"Merge",
"pending",
"chunk",
"with",
"next",
"value",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L80-L94 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/streamed.py | StreamedResultSet._merge_values | def _merge_values(self, values):
"""Merge values into rows.
:type values: list of :class:`~google.protobuf.struct_pb2.Value`
:param values: non-chunked values from partial result set.
"""
width = len(self.fields)
for value in values:
index = len(self._current... | python | def _merge_values(self, values):
"""Merge values into rows.
:type values: list of :class:`~google.protobuf.struct_pb2.Value`
:param values: non-chunked values from partial result set.
"""
width = len(self.fields)
for value in values:
index = len(self._current... | [
"def",
"_merge_values",
"(",
"self",
",",
"values",
")",
":",
"width",
"=",
"len",
"(",
"self",
".",
"fields",
")",
"for",
"value",
"in",
"values",
":",
"index",
"=",
"len",
"(",
"self",
".",
"_current_row",
")",
"field",
"=",
"self",
".",
"fields",
... | Merge values into rows.
:type values: list of :class:`~google.protobuf.struct_pb2.Value`
:param values: non-chunked values from partial result set. | [
"Merge",
"values",
"into",
"rows",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L96-L109 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/streamed.py | StreamedResultSet._consume_next | def _consume_next(self):
"""Consume the next partial result set from the stream.
Parse the result set into new/existing rows in :attr:`_rows`
"""
response = six.next(self._response_iterator)
self._counter += 1
if self._metadata is None: # first response
met... | python | def _consume_next(self):
"""Consume the next partial result set from the stream.
Parse the result set into new/existing rows in :attr:`_rows`
"""
response = six.next(self._response_iterator)
self._counter += 1
if self._metadata is None: # first response
met... | [
"def",
"_consume_next",
"(",
"self",
")",
":",
"response",
"=",
"six",
".",
"next",
"(",
"self",
".",
"_response_iterator",
")",
"self",
".",
"_counter",
"+=",
"1",
"if",
"self",
".",
"_metadata",
"is",
"None",
":",
"# first response",
"metadata",
"=",
"... | Consume the next partial result set from the stream.
Parse the result set into new/existing rows in :attr:`_rows` | [
"Consume",
"the",
"next",
"partial",
"result",
"set",
"from",
"the",
"stream",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L111-L136 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/streamed.py | StreamedResultSet.one_or_none | def one_or_none(self):
"""Return exactly one result, or None if there are no results.
:raises: :exc:`ValueError`: If there are multiple results.
:raises: :exc:`RuntimeError`: If consumption has already occurred,
in whole or in part.
"""
# Sanity check: Has consumptio... | python | def one_or_none(self):
"""Return exactly one result, or None if there are no results.
:raises: :exc:`ValueError`: If there are multiple results.
:raises: :exc:`RuntimeError`: If consumption has already occurred,
in whole or in part.
"""
# Sanity check: Has consumptio... | [
"def",
"one_or_none",
"(",
"self",
")",
":",
"# Sanity check: Has consumption of this query already started?",
"# If it has, then this is an exception.",
"if",
"self",
".",
"_metadata",
"is",
"not",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"Can not call `.one` or `.one_or_n... | Return exactly one result, or None if there are no results.
:raises: :exc:`ValueError`: If there are multiple results.
:raises: :exc:`RuntimeError`: If consumption has already occurred,
in whole or in part. | [
"Return",
"exactly",
"one",
"result",
"or",
"None",
"if",
"there",
"are",
"no",
"results",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L163-L192 | train |
googleapis/google-cloud-python | vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py | ProductSearchClient.product_set_path | def product_set_path(cls, project, location, product_set):
"""Return a fully-qualified product_set string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/productSets/{product_set}",
project=project,
location=location,
... | python | def product_set_path(cls, project, location, product_set):
"""Return a fully-qualified product_set string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/productSets/{product_set}",
project=project,
location=location,
... | [
"def",
"product_set_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"product_set",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/productSets/{product_set}\"",
",",
"project",
... | Return a fully-qualified product_set string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"product_set",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py#L101-L108 | train |
googleapis/google-cloud-python | vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py | ProductSearchClient.product_path | def product_path(cls, project, location, product):
"""Return a fully-qualified product string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/products/{product}",
project=project,
location=location,
product=product... | python | def product_path(cls, project, location, product):
"""Return a fully-qualified product string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/products/{product}",
project=project,
location=location,
product=product... | [
"def",
"product_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"product",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/products/{product}\"",
",",
"project",
"=",
"proje... | Return a fully-qualified product string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"product",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py#L111-L118 | train |
googleapis/google-cloud-python | vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py | ProductSearchClient.reference_image_path | def reference_image_path(cls, project, location, product, reference_image):
"""Return a fully-qualified reference_image string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}",
project=... | python | def reference_image_path(cls, project, location, product, reference_image):
"""Return a fully-qualified reference_image string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}",
project=... | [
"def",
"reference_image_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"product",
",",
"reference_image",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/products/{product}/ref... | Return a fully-qualified reference_image string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"reference_image",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py#L121-L129 | train |
googleapis/google-cloud-python | vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py | ProductSearchClient.create_product_set | def create_product_set(
self,
parent,
product_set,
product_set_id,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates and returns a new ProductSet resource.
Pos... | python | def create_product_set(
self,
parent,
product_set,
product_set_id,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates and returns a new ProductSet resource.
Pos... | [
"def",
"create_product_set",
"(",
"self",
",",
"parent",
",",
"product_set",
",",
"product_set_id",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",... | Creates and returns a new ProductSet resource.
Possible errors:
- Returns INVALID\_ARGUMENT if display\_name is missing, or is longer
than 4096 characters.
Example:
>>> from google.cloud import vision_v1p3beta1
>>>
>>> client = vision_v1p3beta1.... | [
"Creates",
"and",
"returns",
"a",
"new",
"ProductSet",
"resource",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py#L230-L322 | train |
googleapis/google-cloud-python | vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py | ProductSearchClient.create_reference_image | def create_reference_image(
self,
parent,
reference_image,
reference_image_id,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates and returns a new ReferenceImage resour... | python | def create_reference_image(
self,
parent,
reference_image,
reference_image_id,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates and returns a new ReferenceImage resour... | [
"def",
"create_reference_image",
"(",
"self",
",",
"parent",
",",
"reference_image",
",",
"reference_image_id",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
... | Creates and returns a new ReferenceImage resource.
The ``bounding_poly`` field is optional. If ``bounding_poly`` is not
specified, the system will try to detect regions of interest in the
image that are compatible with the product\_category on the parent
product. If it is specified, det... | [
"Creates",
"and",
"returns",
"a",
"new",
"ReferenceImage",
"resource",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py#L1136-L1246 | train |
googleapis/google-cloud-python | vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py | ProductSearchClient.import_product_sets | def import_product_sets(
self,
parent,
input_config,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Asynchronous API that imports a list of reference images to specified
pro... | python | def import_product_sets(
self,
parent,
input_config,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Asynchronous API that imports a list of reference images to specified
pro... | [
"def",
"import_product_sets",
"(",
"self",
",",
"parent",
",",
"input_config",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
"."... | Asynchronous API that imports a list of reference images to specified
product sets based on a list of image information.
The ``google.longrunning.Operation`` API can be used to keep track of
the progress and results of the request. ``Operation.metadata`` contains
``BatchOperationMetadat... | [
"Asynchronous",
"API",
"that",
"imports",
"a",
"list",
"of",
"reference",
"images",
"to",
"specified",
"product",
"sets",
"based",
"on",
"a",
"list",
"of",
"image",
"information",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py#L1800-L1904 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/_gapic.py | _parse_log_entry | def _parse_log_entry(entry_pb):
"""Special helper to parse ``LogEntry`` protobuf into a dictionary.
The ``proto_payload`` field in ``LogEntry`` is of type ``Any``. This
can be problematic if the type URL in the payload isn't in the
``google.protobuf`` registry. To help with parsing unregistered types,
... | python | def _parse_log_entry(entry_pb):
"""Special helper to parse ``LogEntry`` protobuf into a dictionary.
The ``proto_payload`` field in ``LogEntry`` is of type ``Any``. This
can be problematic if the type URL in the payload isn't in the
``google.protobuf`` registry. To help with parsing unregistered types,
... | [
"def",
"_parse_log_entry",
"(",
"entry_pb",
")",
":",
"try",
":",
"return",
"MessageToDict",
"(",
"entry_pb",
")",
"except",
"TypeError",
":",
"if",
"entry_pb",
".",
"HasField",
"(",
"\"proto_payload\"",
")",
":",
"proto_payload",
"=",
"entry_pb",
".",
"proto_... | Special helper to parse ``LogEntry`` protobuf into a dictionary.
The ``proto_payload`` field in ``LogEntry`` is of type ``Any``. This
can be problematic if the type URL in the payload isn't in the
``google.protobuf`` registry. To help with parsing unregistered types,
this function will remove ``proto_p... | [
"Special",
"helper",
"to",
"parse",
"LogEntry",
"protobuf",
"into",
"a",
"dictionary",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/_gapic.py#L421-L447 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.