id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,900 | googleapis/google-cloud-python | api_core/google/api_core/datetime_helpers.py | DatetimeWithNanoseconds.rfc3339 | def rfc3339(self):
"""Return an RFC 3339-compliant timestamp.
Returns:
(str): Timestamp string according to RFC 3339 spec.
"""
if self._nanosecond == 0:
return to_rfc3339(self)
nanos = str(self._nanosecond).rjust(9, '0').rstrip("0")
return "{}.{}Z... | python | def rfc3339(self):
"""Return an RFC 3339-compliant timestamp.
Returns:
(str): Timestamp string according to RFC 3339 spec.
"""
if self._nanosecond == 0:
return to_rfc3339(self)
nanos = str(self._nanosecond).rjust(9, '0').rstrip("0")
return "{}.{}Z... | [
"def",
"rfc3339",
"(",
"self",
")",
":",
"if",
"self",
".",
"_nanosecond",
"==",
"0",
":",
"return",
"to_rfc3339",
"(",
"self",
")",
"nanos",
"=",
"str",
"(",
"self",
".",
"_nanosecond",
")",
".",
"rjust",
"(",
"9",
",",
"'0'",
")",
".",
"rstrip",
... | Return an RFC 3339-compliant timestamp.
Returns:
(str): Timestamp string according to RFC 3339 spec. | [
"Return",
"an",
"RFC",
"3339",
"-",
"compliant",
"timestamp",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/datetime_helpers.py#L217-L226 |
27,901 | googleapis/google-cloud-python | api_core/google/api_core/datetime_helpers.py | DatetimeWithNanoseconds.timestamp_pb | def timestamp_pb(self):
"""Return a timestamp message.
Returns:
(:class:`~google.protobuf.timestamp_pb2.Timestamp`): Timestamp message
"""
inst = self if self.tzinfo is not None else self.replace(tzinfo=pytz.UTC)
delta = inst - _UTC_EPOCH
seconds = int(delta.... | python | def timestamp_pb(self):
"""Return a timestamp message.
Returns:
(:class:`~google.protobuf.timestamp_pb2.Timestamp`): Timestamp message
"""
inst = self if self.tzinfo is not None else self.replace(tzinfo=pytz.UTC)
delta = inst - _UTC_EPOCH
seconds = int(delta.... | [
"def",
"timestamp_pb",
"(",
"self",
")",
":",
"inst",
"=",
"self",
"if",
"self",
".",
"tzinfo",
"is",
"not",
"None",
"else",
"self",
".",
"replace",
"(",
"tzinfo",
"=",
"pytz",
".",
"UTC",
")",
"delta",
"=",
"inst",
"-",
"_UTC_EPOCH",
"seconds",
"=",... | Return a timestamp message.
Returns:
(:class:`~google.protobuf.timestamp_pb2.Timestamp`): Timestamp message | [
"Return",
"a",
"timestamp",
"message",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/datetime_helpers.py#L269-L279 |
27,902 | googleapis/google-cloud-python | dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py | ClusterControllerClient.create_cluster | def create_cluster(
self,
project_id,
region,
cluster,
request_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a cluster in a project.
Examp... | python | def create_cluster(
self,
project_id,
region,
cluster,
request_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a cluster in a project.
Examp... | [
"def",
"create_cluster",
"(",
"self",
",",
"project_id",
",",
"region",
",",
"cluster",
",",
"request_id",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api... | Creates a cluster in a project.
Example:
>>> from google.cloud import dataproc_v1beta2
>>>
>>> client = dataproc_v1beta2.ClusterControllerClient()
>>>
>>> # TODO: Initialize `project_id`:
>>> project_id = ''
>>>
>>>... | [
"Creates",
"a",
"cluster",
"in",
"a",
"project",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py#L180-L278 |
27,903 | googleapis/google-cloud-python | dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py | ClusterControllerClient.delete_cluster | def delete_cluster(
self,
project_id,
region,
cluster_name,
cluster_uuid=None,
request_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes a clus... | python | def delete_cluster(
self,
project_id,
region,
cluster_name,
cluster_uuid=None,
request_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes a clus... | [
"def",
"delete_cluster",
"(",
"self",
",",
"project_id",
",",
"region",
",",
"cluster_name",
",",
"cluster_uuid",
"=",
"None",
",",
"request_id",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
","... | Deletes a cluster in a project.
Example:
>>> from google.cloud import dataproc_v1beta2
>>>
>>> client = dataproc_v1beta2.ClusterControllerClient()
>>>
>>> # TODO: Initialize `project_id`:
>>> project_id = ''
>>>
>>>... | [
"Deletes",
"a",
"cluster",
"in",
"a",
"project",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py#L646-L748 |
27,904 | googleapis/google-cloud-python | dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py | ClusterControllerClient.get_cluster | def get_cluster(
self,
project_id,
region,
cluster_name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets the resource representation for a cluster in a project.
... | python | def get_cluster(
self,
project_id,
region,
cluster_name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets the resource representation for a cluster in a project.
... | [
"def",
"get_cluster",
"(",
"self",
",",
"project_id",
",",
"region",
",",
"cluster_name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
... | Gets the resource representation for a cluster in a project.
Example:
>>> from google.cloud import dataproc_v1beta2
>>>
>>> client = dataproc_v1beta2.ClusterControllerClient()
>>>
>>> # TODO: Initialize `project_id`:
>>> project_id = ''
... | [
"Gets",
"the",
"resource",
"representation",
"for",
"a",
"cluster",
"in",
"a",
"project",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py#L750-L818 |
27,905 | googleapis/google-cloud-python | dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py | ClusterControllerClient.diagnose_cluster | def diagnose_cluster(
self,
project_id,
region,
cluster_name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets cluster diagnostic information. After the operation complet... | python | def diagnose_cluster(
self,
project_id,
region,
cluster_name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets cluster diagnostic information. After the operation complet... | [
"def",
"diagnose_cluster",
"(",
"self",
",",
"project_id",
",",
"region",
",",
"cluster_name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".... | Gets cluster diagnostic information. After the operation completes, the
Operation.response field contains ``DiagnoseClusterOutputLocation``.
Example:
>>> from google.cloud import dataproc_v1beta2
>>>
>>> client = dataproc_v1beta2.ClusterControllerClient()
... | [
"Gets",
"cluster",
"diagnostic",
"information",
".",
"After",
"the",
"operation",
"completes",
"the",
"Operation",
".",
"response",
"field",
"contains",
"DiagnoseClusterOutputLocation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py#L938-L1022 |
27,906 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py | Batch.monitor | def monitor(self):
"""Commit this batch after sufficient time has elapsed.
This simply sleeps for ``self._settings.max_latency`` seconds,
and then calls commit unless the batch has already been committed.
"""
# NOTE: This blocks; it is up to the calling code to call it
#... | python | def monitor(self):
"""Commit this batch after sufficient time has elapsed.
This simply sleeps for ``self._settings.max_latency`` seconds,
and then calls commit unless the batch has already been committed.
"""
# NOTE: This blocks; it is up to the calling code to call it
#... | [
"def",
"monitor",
"(",
"self",
")",
":",
"# NOTE: This blocks; it is up to the calling code to call it",
"# in a separate thread.",
"# Sleep for however long we should be waiting.",
"time",
".",
"sleep",
"(",
"self",
".",
"_settings",
".",
"max_latency",
")",
"_LOGGER",
... | Commit this batch after sufficient time has elapsed.
This simply sleeps for ``self._settings.max_latency`` seconds,
and then calls commit unless the batch has already been committed. | [
"Commit",
"this",
"batch",
"after",
"sufficient",
"time",
"has",
"elapsed",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py#L241-L254 |
27,907 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py | Batch.publish | def publish(self, message):
"""Publish a single message.
Add the given message to this object; this will cause it to be
published once the batch either has enough messages or a sufficient
period of time has elapsed.
This method is called by :meth:`~.PublisherClient.publish`.
... | python | def publish(self, message):
"""Publish a single message.
Add the given message to this object; this will cause it to be
published once the batch either has enough messages or a sufficient
period of time has elapsed.
This method is called by :meth:`~.PublisherClient.publish`.
... | [
"def",
"publish",
"(",
"self",
",",
"message",
")",
":",
"# Coerce the type, just in case.",
"if",
"not",
"isinstance",
"(",
"message",
",",
"types",
".",
"PubsubMessage",
")",
":",
"message",
"=",
"types",
".",
"PubsubMessage",
"(",
"*",
"*",
"message",
")"... | Publish a single message.
Add the given message to this object; this will cause it to be
published once the batch either has enough messages or a sufficient
period of time has elapsed.
This method is called by :meth:`~.PublisherClient.publish`.
Args:
message (~.pub... | [
"Publish",
"a",
"single",
"message",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py#L256-L307 |
27,908 | googleapis/google-cloud-python | dns/google/cloud/dns/changes.py | Changes.path | def path(self):
"""URL path for change set APIs.
:rtype: str
:returns: the path based on project, zone, and change set names.
"""
return "/projects/%s/managedZones/%s/changes/%s" % (
self.zone.project,
self.zone.name,
self.name,
) | python | def path(self):
"""URL path for change set APIs.
:rtype: str
:returns: the path based on project, zone, and change set names.
"""
return "/projects/%s/managedZones/%s/changes/%s" % (
self.zone.project,
self.zone.name,
self.name,
) | [
"def",
"path",
"(",
"self",
")",
":",
"return",
"\"/projects/%s/managedZones/%s/changes/%s\"",
"%",
"(",
"self",
".",
"zone",
".",
"project",
",",
"self",
".",
"zone",
".",
"name",
",",
"self",
".",
"name",
",",
")"
] | URL path for change set APIs.
:rtype: str
:returns: the path based on project, zone, and change set names. | [
"URL",
"path",
"for",
"change",
"set",
"APIs",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L80-L90 |
27,909 | googleapis/google-cloud-python | dns/google/cloud/dns/changes.py | Changes.name | def name(self, value):
"""Update name of the change set.
:type value: str
:param value: New name for the changeset.
"""
if not isinstance(value, six.string_types):
raise ValueError("Pass a string")
self._properties["id"] = value | python | def name(self, value):
"""Update name of the change set.
:type value: str
:param value: New name for the changeset.
"""
if not isinstance(value, six.string_types):
raise ValueError("Pass a string")
self._properties["id"] = value | [
"def",
"name",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"ValueError",
"(",
"\"Pass a string\"",
")",
"self",
".",
"_properties",
"[",
"\"id\"",
"]",
"=",
"value"
] | Update name of the change set.
:type value: str
:param value: New name for the changeset. | [
"Update",
"name",
"of",
"the",
"change",
"set",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L102-L110 |
27,910 | googleapis/google-cloud-python | dns/google/cloud/dns/changes.py | Changes.add_record_set | def add_record_set(self, record_set):
"""Append a record set to the 'additions' for the change set.
:type record_set:
:class:`google.cloud.dns.resource_record_set.ResourceRecordSet`
:param record_set: the record set to append.
:raises: ``ValueError`` if ``record_set`` is no... | python | def add_record_set(self, record_set):
"""Append a record set to the 'additions' for the change set.
:type record_set:
:class:`google.cloud.dns.resource_record_set.ResourceRecordSet`
:param record_set: the record set to append.
:raises: ``ValueError`` if ``record_set`` is no... | [
"def",
"add_record_set",
"(",
"self",
",",
"record_set",
")",
":",
"if",
"not",
"isinstance",
"(",
"record_set",
",",
"ResourceRecordSet",
")",
":",
"raise",
"ValueError",
"(",
"\"Pass a ResourceRecordSet\"",
")",
"self",
".",
"_additions",
"+=",
"(",
"record_se... | Append a record set to the 'additions' for the change set.
:type record_set:
:class:`google.cloud.dns.resource_record_set.ResourceRecordSet`
:param record_set: the record set to append.
:raises: ``ValueError`` if ``record_set`` is not of the required type. | [
"Append",
"a",
"record",
"set",
"to",
"the",
"additions",
"for",
"the",
"change",
"set",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L152-L163 |
27,911 | googleapis/google-cloud-python | dns/google/cloud/dns/changes.py | Changes.delete_record_set | def delete_record_set(self, record_set):
"""Append a record set to the 'deletions' for the change set.
:type record_set:
:class:`google.cloud.dns.resource_record_set.ResourceRecordSet`
:param record_set: the record set to append.
:raises: ``ValueError`` if ``record_set`` is... | python | def delete_record_set(self, record_set):
"""Append a record set to the 'deletions' for the change set.
:type record_set:
:class:`google.cloud.dns.resource_record_set.ResourceRecordSet`
:param record_set: the record set to append.
:raises: ``ValueError`` if ``record_set`` is... | [
"def",
"delete_record_set",
"(",
"self",
",",
"record_set",
")",
":",
"if",
"not",
"isinstance",
"(",
"record_set",
",",
"ResourceRecordSet",
")",
":",
"raise",
"ValueError",
"(",
"\"Pass a ResourceRecordSet\"",
")",
"self",
".",
"_deletions",
"+=",
"(",
"record... | Append a record set to the 'deletions' for the change set.
:type record_set:
:class:`google.cloud.dns.resource_record_set.ResourceRecordSet`
:param record_set: the record set to append.
:raises: ``ValueError`` if ``record_set`` is not of the required type. | [
"Append",
"a",
"record",
"set",
"to",
"the",
"deletions",
"for",
"the",
"change",
"set",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L165-L176 |
27,912 | googleapis/google-cloud-python | dns/google/cloud/dns/changes.py | Changes._build_resource | def _build_resource(self):
"""Generate a resource for ``create``."""
additions = [
{
"name": added.name,
"type": added.record_type,
"ttl": str(added.ttl),
"rrdatas": added.rrdatas,
}
for added in self.add... | python | def _build_resource(self):
"""Generate a resource for ``create``."""
additions = [
{
"name": added.name,
"type": added.record_type,
"ttl": str(added.ttl),
"rrdatas": added.rrdatas,
}
for added in self.add... | [
"def",
"_build_resource",
"(",
"self",
")",
":",
"additions",
"=",
"[",
"{",
"\"name\"",
":",
"added",
".",
"name",
",",
"\"type\"",
":",
"added",
".",
"record_type",
",",
"\"ttl\"",
":",
"str",
"(",
"added",
".",
"ttl",
")",
",",
"\"rrdatas\"",
":",
... | Generate a resource for ``create``. | [
"Generate",
"a",
"resource",
"for",
"create",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L193-L215 |
27,913 | googleapis/google-cloud-python | logging/google/cloud/logging/client.py | Client.sinks_api | def sinks_api(self):
"""Helper for log sink-related API calls.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks
"""
if self._sinks_api is None:
if self._use_grpc:
self._sinks_api = _gapic.make_sinks_api(self)
e... | python | def sinks_api(self):
"""Helper for log sink-related API calls.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks
"""
if self._sinks_api is None:
if self._use_grpc:
self._sinks_api = _gapic.make_sinks_api(self)
e... | [
"def",
"sinks_api",
"(",
"self",
")",
":",
"if",
"self",
".",
"_sinks_api",
"is",
"None",
":",
"if",
"self",
".",
"_use_grpc",
":",
"self",
".",
"_sinks_api",
"=",
"_gapic",
".",
"make_sinks_api",
"(",
"self",
")",
"else",
":",
"self",
".",
"_sinks_api... | Helper for log sink-related API calls.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks | [
"Helper",
"for",
"log",
"sink",
"-",
"related",
"API",
"calls",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L129-L140 |
27,914 | googleapis/google-cloud-python | logging/google/cloud/logging/client.py | Client.metrics_api | def metrics_api(self):
"""Helper for log metric-related API calls.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics
"""
if self._metrics_api is None:
if self._use_grpc:
self._metrics_api = _gapic.make_metrics_api(self)
... | python | def metrics_api(self):
"""Helper for log metric-related API calls.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics
"""
if self._metrics_api is None:
if self._use_grpc:
self._metrics_api = _gapic.make_metrics_api(self)
... | [
"def",
"metrics_api",
"(",
"self",
")",
":",
"if",
"self",
".",
"_metrics_api",
"is",
"None",
":",
"if",
"self",
".",
"_use_grpc",
":",
"self",
".",
"_metrics_api",
"=",
"_gapic",
".",
"make_metrics_api",
"(",
"self",
")",
"else",
":",
"self",
".",
"_m... | Helper for log metric-related API calls.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics | [
"Helper",
"for",
"log",
"metric",
"-",
"related",
"API",
"calls",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L143-L154 |
27,915 | googleapis/google-cloud-python | logging/google/cloud/logging/client.py | Client.sink | def sink(self, name, filter_=None, destination=None):
"""Creates a sink bound to the current client.
:type name: str
:param name: the name of the sink to be constructed.
:type filter_: str
:param filter_: (optional) the advanced logs filter expression
de... | python | def sink(self, name, filter_=None, destination=None):
"""Creates a sink bound to the current client.
:type name: str
:param name: the name of the sink to be constructed.
:type filter_: str
:param filter_: (optional) the advanced logs filter expression
de... | [
"def",
"sink",
"(",
"self",
",",
"name",
",",
"filter_",
"=",
"None",
",",
"destination",
"=",
"None",
")",
":",
"return",
"Sink",
"(",
"name",
",",
"filter_",
",",
"destination",
",",
"client",
"=",
"self",
")"
] | Creates a sink bound to the current client.
:type name: str
:param name: the name of the sink to be constructed.
:type filter_: str
:param filter_: (optional) the advanced logs filter expression
defining the entries exported by the sink. If not
... | [
"Creates",
"a",
"sink",
"bound",
"to",
"the",
"current",
"client",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L222-L243 |
27,916 | googleapis/google-cloud-python | logging/google/cloud/logging/client.py | Client.metric | def metric(self, name, filter_=None, description=""):
"""Creates a metric bound to the current client.
:type name: str
:param name: the name of the metric to be constructed.
:type filter_: str
:param filter_: the advanced logs filter expression defining the
... | python | def metric(self, name, filter_=None, description=""):
"""Creates a metric bound to the current client.
:type name: str
:param name: the name of the metric to be constructed.
:type filter_: str
:param filter_: the advanced logs filter expression defining the
... | [
"def",
"metric",
"(",
"self",
",",
"name",
",",
"filter_",
"=",
"None",
",",
"description",
"=",
"\"\"",
")",
":",
"return",
"Metric",
"(",
"name",
",",
"filter_",
",",
"client",
"=",
"self",
",",
"description",
"=",
"description",
")"
] | Creates a metric bound to the current client.
:type name: str
:param name: the name of the metric to be constructed.
:type filter_: str
:param filter_: the advanced logs filter expression defining the
entries tracked by the metric. If not
... | [
"Creates",
"a",
"metric",
"bound",
"to",
"the",
"current",
"client",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L272-L292 |
27,917 | googleapis/google-cloud-python | logging/google/cloud/logging/client.py | Client.get_default_handler | def get_default_handler(self, **kw):
"""Return the default logging handler based on the local environment.
:type kw: dict
:param kw: keyword args passed to handler constructor
:rtype: :class:`logging.Handler`
:returns: The default log handler based on the environment
""... | python | def get_default_handler(self, **kw):
"""Return the default logging handler based on the local environment.
:type kw: dict
:param kw: keyword args passed to handler constructor
:rtype: :class:`logging.Handler`
:returns: The default log handler based on the environment
""... | [
"def",
"get_default_handler",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"gke_cluster_name",
"=",
"retrieve_metadata_server",
"(",
"_GKE_CLUSTER_NAME",
")",
"if",
"(",
"_APPENGINE_FLEXIBLE_ENV_VM",
"in",
"os",
".",
"environ",
"or",
"_APPENGINE_INSTANCE_ID",
"in",
... | Return the default logging handler based on the local environment.
:type kw: dict
:param kw: keyword args passed to handler constructor
:rtype: :class:`logging.Handler`
:returns: The default log handler based on the environment | [
"Return",
"the",
"default",
"logging",
"handler",
"based",
"on",
"the",
"local",
"environment",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L320-L339 |
27,918 | googleapis/google-cloud-python | logging/google/cloud/logging/client.py | Client.setup_logging | def setup_logging(
self, log_level=logging.INFO, excluded_loggers=EXCLUDED_LOGGER_DEFAULTS, **kw
):
"""Attach default Stackdriver logging handler to the root logger.
This method uses the default log handler, obtained by
:meth:`~get_default_handler`, and attaches it to the root Pytho... | python | def setup_logging(
self, log_level=logging.INFO, excluded_loggers=EXCLUDED_LOGGER_DEFAULTS, **kw
):
"""Attach default Stackdriver logging handler to the root logger.
This method uses the default log handler, obtained by
:meth:`~get_default_handler`, and attaches it to the root Pytho... | [
"def",
"setup_logging",
"(",
"self",
",",
"log_level",
"=",
"logging",
".",
"INFO",
",",
"excluded_loggers",
"=",
"EXCLUDED_LOGGER_DEFAULTS",
",",
"*",
"*",
"kw",
")",
":",
"handler",
"=",
"self",
".",
"get_default_handler",
"(",
"*",
"*",
"kw",
")",
"setu... | Attach default Stackdriver logging handler to the root logger.
This method uses the default log handler, obtained by
:meth:`~get_default_handler`, and attaches it to the root Python
logger, so that a call such as ``logging.warn``, as well as all child
loggers, will report to Stackdriver... | [
"Attach",
"default",
"Stackdriver",
"logging",
"handler",
"to",
"the",
"root",
"logger",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L341-L365 |
27,919 | googleapis/google-cloud-python | kms/google/cloud/kms_v1/gapic/key_management_service_client.py | KeyManagementServiceClient.key_ring_path | def key_ring_path(cls, project, location, key_ring):
"""Return a fully-qualified key_ring string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/keyRings/{key_ring}",
project=project,
location=location,
key_ring=ke... | python | def key_ring_path(cls, project, location, key_ring):
"""Return a fully-qualified key_ring string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/keyRings/{key_ring}",
project=project,
location=location,
key_ring=ke... | [
"def",
"key_ring_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"key_ring",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/keyRings/{key_ring}\"",
",",
"project",
"=",
"pr... | Return a fully-qualified key_ring string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"key_ring",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/kms/google/cloud/kms_v1/gapic/key_management_service_client.py#L88-L95 |
27,920 | googleapis/google-cloud-python | kms/google/cloud/kms_v1/gapic/key_management_service_client.py | KeyManagementServiceClient.crypto_key_path_path | def crypto_key_path_path(cls, project, location, key_ring, crypto_key_path):
"""Return a fully-qualified crypto_key_path string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key_path=**}",
project=... | python | def crypto_key_path_path(cls, project, location, key_ring, crypto_key_path):
"""Return a fully-qualified crypto_key_path string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key_path=**}",
project=... | [
"def",
"crypto_key_path_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"key_ring",
",",
"crypto_key_path",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/keyRings/{key_ring}/c... | Return a fully-qualified crypto_key_path string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"crypto_key_path",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/kms/google/cloud/kms_v1/gapic/key_management_service_client.py#L98-L106 |
27,921 | googleapis/google-cloud-python | kms/google/cloud/kms_v1/gapic/key_management_service_client.py | KeyManagementServiceClient.crypto_key_version_path | def crypto_key_version_path(
cls, project, location, key_ring, crypto_key, crypto_key_version
):
"""Return a fully-qualified crypto_key_version string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_... | python | def crypto_key_version_path(
cls, project, location, key_ring, crypto_key, crypto_key_version
):
"""Return a fully-qualified crypto_key_version string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_... | [
"def",
"crypto_key_version_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"key_ring",
",",
"crypto_key",
",",
"crypto_key_version",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{lo... | Return a fully-qualified crypto_key_version string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"crypto_key_version",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/kms/google/cloud/kms_v1/gapic/key_management_service_client.py#L129-L140 |
27,922 | googleapis/google-cloud-python | kms/google/cloud/kms_v1/gapic/key_management_service_client.py | KeyManagementServiceClient.create_key_ring | def create_key_ring(
self,
parent,
key_ring_id,
key_ring,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Create a new ``KeyRing`` in a given Project and Location.
E... | python | def create_key_ring(
self,
parent,
key_ring_id,
key_ring,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Create a new ``KeyRing`` in a given Project and Location.
E... | [
"def",
"create_key_ring",
"(",
"self",
",",
"parent",
",",
"key_ring_id",
",",
"key_ring",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
... | Create a new ``KeyRing`` in a given Project and Location.
Example:
>>> from google.cloud import kms_v1
>>>
>>> client = kms_v1.KeyManagementServiceClient()
>>>
>>> parent = client.location_path('[PROJECT]', '[LOCATION]')
>>>
>>... | [
"Create",
"a",
"new",
"KeyRing",
"in",
"a",
"given",
"Project",
"and",
"Location",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/kms/google/cloud/kms_v1/gapic/key_management_service_client.py#L763-L847 |
27,923 | googleapis/google-cloud-python | kms/google/cloud/kms_v1/gapic/key_management_service_client.py | KeyManagementServiceClient.create_crypto_key | def create_crypto_key(
self,
parent,
crypto_key_id,
crypto_key,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Create a new ``CryptoKey`` within a ``KeyRing``.
``Cr... | python | def create_crypto_key(
self,
parent,
crypto_key_id,
crypto_key,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Create a new ``CryptoKey`` within a ``KeyRing``.
``Cr... | [
"def",
"create_crypto_key",
"(",
"self",
",",
"parent",
",",
"crypto_key_id",
",",
"crypto_key",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
... | Create a new ``CryptoKey`` within a ``KeyRing``.
``CryptoKey.purpose`` and ``CryptoKey.version_template.algorithm`` are
required.
Example:
>>> from google.cloud import kms_v1
>>> from google.cloud.kms_v1 import enums
>>>
>>> client = kms_v1.KeyMa... | [
"Create",
"a",
"new",
"CryptoKey",
"within",
"a",
"KeyRing",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/kms/google/cloud/kms_v1/gapic/key_management_service_client.py#L849-L938 |
27,924 | googleapis/google-cloud-python | trace/google/cloud/trace_v2/gapic/trace_service_client.py | TraceServiceClient.span_path | def span_path(cls, project, trace, span):
"""Return a fully-qualified span string."""
return google.api_core.path_template.expand(
"projects/{project}/traces/{trace}/spans/{span}",
project=project,
trace=trace,
span=span,
) | python | def span_path(cls, project, trace, span):
"""Return a fully-qualified span string."""
return google.api_core.path_template.expand(
"projects/{project}/traces/{trace}/spans/{span}",
project=project,
trace=trace,
span=span,
) | [
"def",
"span_path",
"(",
"cls",
",",
"project",
",",
"trace",
",",
"span",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/traces/{trace}/spans/{span}\"",
",",
"project",
"=",
"project",
",",
"trace"... | Return a fully-qualified span string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"span",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/trace/google/cloud/trace_v2/gapic/trace_service_client.py#L88-L95 |
27,925 | googleapis/google-cloud-python | trace/google/cloud/trace_v2/gapic/trace_service_client.py | TraceServiceClient.batch_write_spans | def batch_write_spans(
self,
name,
spans,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Sends new spans to new or existing traces. You cannot update
existing spans.
... | python | def batch_write_spans(
self,
name,
spans,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Sends new spans to new or existing traces. You cannot update
existing spans.
... | [
"def",
"batch_write_spans",
"(",
"self",
",",
"name",
",",
"spans",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAUL... | Sends new spans to new or existing traces. You cannot update
existing spans.
Example:
>>> from google.cloud import trace_v2
>>>
>>> client = trace_v2.TraceServiceClient()
>>>
>>> name = client.project_path('[PROJECT]')
>>>
... | [
"Sends",
"new",
"spans",
"to",
"new",
"or",
"existing",
"traces",
".",
"You",
"cannot",
"update",
"existing",
"spans",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/trace/google/cloud/trace_v2/gapic/trace_service_client.py#L196-L271 |
27,926 | googleapis/google-cloud-python | trace/google/cloud/trace_v2/gapic/trace_service_client.py | TraceServiceClient.create_span | def create_span(
self,
name,
span_id,
display_name,
start_time,
end_time,
parent_span_id=None,
attributes=None,
stack_trace=None,
time_events=None,
links=None,
status=None,
same_process_as_parent_span=None,
c... | python | def create_span(
self,
name,
span_id,
display_name,
start_time,
end_time,
parent_span_id=None,
attributes=None,
stack_trace=None,
time_events=None,
links=None,
status=None,
same_process_as_parent_span=None,
c... | [
"def",
"create_span",
"(",
"self",
",",
"name",
",",
"span_id",
",",
"display_name",
",",
"start_time",
",",
"end_time",
",",
"parent_span_id",
"=",
"None",
",",
"attributes",
"=",
"None",
",",
"stack_trace",
"=",
"None",
",",
"time_events",
"=",
"None",
"... | Creates a new span.
Example:
>>> from google.cloud import trace_v2
>>>
>>> client = trace_v2.TraceServiceClient()
>>>
>>> name = client.span_path('[PROJECT]', '[TRACE]', '[SPAN]')
>>>
>>> # TODO: Initialize `span_id`:
... | [
"Creates",
"a",
"new",
"span",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/trace/google/cloud/trace_v2/gapic/trace_service_client.py#L273-L447 |
27,927 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | _wrap_callback_errors | def _wrap_callback_errors(callback, message):
"""Wraps a user callback so that if an exception occurs the message is
nacked.
Args:
callback (Callable[None, Message]): The user callback.
message (~Message): The Pub/Sub message.
"""
try:
callback(message)
except Exception:... | python | def _wrap_callback_errors(callback, message):
"""Wraps a user callback so that if an exception occurs the message is
nacked.
Args:
callback (Callable[None, Message]): The user callback.
message (~Message): The Pub/Sub message.
"""
try:
callback(message)
except Exception:... | [
"def",
"_wrap_callback_errors",
"(",
"callback",
",",
"message",
")",
":",
"try",
":",
"callback",
"(",
"message",
")",
"except",
"Exception",
":",
"# Note: the likelihood of this failing is extremely low. This just adds",
"# a message to a queue, so if this doesn't work the worl... | Wraps a user callback so that if an exception occurs the message is
nacked.
Args:
callback (Callable[None, Message]): The user callback.
message (~Message): The Pub/Sub message. | [
"Wraps",
"a",
"user",
"callback",
"so",
"that",
"if",
"an",
"exception",
"occurs",
"the",
"message",
"is",
"nacked",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L55-L72 |
27,928 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | StreamingPullManager.ack_deadline | def ack_deadline(self):
"""Return the current ack deadline based on historical time-to-ack.
This method is "sticky". It will only perform the computations to
check on the right ack deadline if the histogram has gained a
significant amount of new information.
Returns:
... | python | def ack_deadline(self):
"""Return the current ack deadline based on historical time-to-ack.
This method is "sticky". It will only perform the computations to
check on the right ack deadline if the histogram has gained a
significant amount of new information.
Returns:
... | [
"def",
"ack_deadline",
"(",
"self",
")",
":",
"target",
"=",
"min",
"(",
"[",
"self",
".",
"_last_histogram_size",
"*",
"2",
",",
"self",
".",
"_last_histogram_size",
"+",
"100",
"]",
")",
"if",
"len",
"(",
"self",
".",
"ack_histogram",
")",
">",
"targ... | Return the current ack deadline based on historical time-to-ack.
This method is "sticky". It will only perform the computations to
check on the right ack deadline if the histogram has gained a
significant amount of new information.
Returns:
int: The ack deadline. | [
"Return",
"the",
"current",
"ack",
"deadline",
"based",
"on",
"historical",
"time",
"-",
"to",
"-",
"ack",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L161-L174 |
27,929 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | StreamingPullManager.load | def load(self):
"""Return the current load.
The load is represented as a float, where 1.0 represents having
hit one of the flow control limits, and values between 0.0 and 1.0
represent how close we are to them. (0.5 means we have exactly half
of what the flow control setting all... | python | def load(self):
"""Return the current load.
The load is represented as a float, where 1.0 represents having
hit one of the flow control limits, and values between 0.0 and 1.0
represent how close we are to them. (0.5 means we have exactly half
of what the flow control setting all... | [
"def",
"load",
"(",
"self",
")",
":",
"if",
"self",
".",
"_leaser",
"is",
"None",
":",
"return",
"0",
"return",
"max",
"(",
"[",
"self",
".",
"_leaser",
".",
"message_count",
"/",
"self",
".",
"_flow_control",
".",
"max_messages",
",",
"self",
".",
"... | Return the current load.
The load is represented as a float, where 1.0 represents having
hit one of the flow control limits, and values between 0.0 and 1.0
represent how close we are to them. (0.5 means we have exactly half
of what the flow control setting allows, for example.)
... | [
"Return",
"the",
"current",
"load",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L177-L201 |
27,930 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | StreamingPullManager.maybe_pause_consumer | def maybe_pause_consumer(self):
"""Check the current load and pause the consumer if needed."""
if self.load >= 1.0:
if self._consumer is not None and not self._consumer.is_paused:
_LOGGER.debug("Message backlog over load at %.2f, pausing.", self.load)
self._co... | python | def maybe_pause_consumer(self):
"""Check the current load and pause the consumer if needed."""
if self.load >= 1.0:
if self._consumer is not None and not self._consumer.is_paused:
_LOGGER.debug("Message backlog over load at %.2f, pausing.", self.load)
self._co... | [
"def",
"maybe_pause_consumer",
"(",
"self",
")",
":",
"if",
"self",
".",
"load",
">=",
"1.0",
":",
"if",
"self",
".",
"_consumer",
"is",
"not",
"None",
"and",
"not",
"self",
".",
"_consumer",
".",
"is_paused",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Mess... | Check the current load and pause the consumer if needed. | [
"Check",
"the",
"current",
"load",
"and",
"pause",
"the",
"consumer",
"if",
"needed",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L211-L216 |
27,931 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | StreamingPullManager.maybe_resume_consumer | def maybe_resume_consumer(self):
"""Check the current load and resume the consumer if needed."""
# If we have been paused by flow control, check and see if we are
# back within our limits.
#
# In order to not thrash too much, require us to have passed below
# the resume t... | python | def maybe_resume_consumer(self):
"""Check the current load and resume the consumer if needed."""
# If we have been paused by flow control, check and see if we are
# back within our limits.
#
# In order to not thrash too much, require us to have passed below
# the resume t... | [
"def",
"maybe_resume_consumer",
"(",
"self",
")",
":",
"# If we have been paused by flow control, check and see if we are",
"# back within our limits.",
"#",
"# In order to not thrash too much, require us to have passed below",
"# the resume threshold (80% by default) of each flow control settin... | Check the current load and resume the consumer if needed. | [
"Check",
"the",
"current",
"load",
"and",
"resume",
"the",
"consumer",
"if",
"needed",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L218-L232 |
27,932 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | StreamingPullManager._send_unary_request | def _send_unary_request(self, request):
"""Send a request using a separate unary request instead of over the
stream.
Args:
request (types.StreamingPullRequest): The stream request to be
mapped into unary requests.
"""
if request.ack_ids:
s... | python | def _send_unary_request(self, request):
"""Send a request using a separate unary request instead of over the
stream.
Args:
request (types.StreamingPullRequest): The stream request to be
mapped into unary requests.
"""
if request.ack_ids:
s... | [
"def",
"_send_unary_request",
"(",
"self",
",",
"request",
")",
":",
"if",
"request",
".",
"ack_ids",
":",
"self",
".",
"_client",
".",
"acknowledge",
"(",
"subscription",
"=",
"self",
".",
"_subscription",
",",
"ack_ids",
"=",
"list",
"(",
"request",
".",... | Send a request using a separate unary request instead of over the
stream.
Args:
request (types.StreamingPullRequest): The stream request to be
mapped into unary requests. | [
"Send",
"a",
"request",
"using",
"a",
"separate",
"unary",
"request",
"instead",
"of",
"over",
"the",
"stream",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L234-L262 |
27,933 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | StreamingPullManager.send | def send(self, request):
"""Queue a request to be sent to the RPC."""
if self._UNARY_REQUESTS:
try:
self._send_unary_request(request)
except exceptions.GoogleAPICallError:
_LOGGER.debug(
"Exception while sending unary RPC. This ... | python | def send(self, request):
"""Queue a request to be sent to the RPC."""
if self._UNARY_REQUESTS:
try:
self._send_unary_request(request)
except exceptions.GoogleAPICallError:
_LOGGER.debug(
"Exception while sending unary RPC. This ... | [
"def",
"send",
"(",
"self",
",",
"request",
")",
":",
"if",
"self",
".",
"_UNARY_REQUESTS",
":",
"try",
":",
"self",
".",
"_send_unary_request",
"(",
"request",
")",
"except",
"exceptions",
".",
"GoogleAPICallError",
":",
"_LOGGER",
".",
"debug",
"(",
"\"E... | Queue a request to be sent to the RPC. | [
"Queue",
"a",
"request",
"to",
"be",
"sent",
"to",
"the",
"RPC",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L264-L276 |
27,934 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | StreamingPullManager.heartbeat | def heartbeat(self):
"""Sends an empty request over the streaming pull RPC.
This always sends over the stream, regardless of if
``self._UNARY_REQUESTS`` is set or not.
"""
if self._rpc is not None and self._rpc.is_active:
self._rpc.send(types.StreamingPullRequest()) | python | def heartbeat(self):
"""Sends an empty request over the streaming pull RPC.
This always sends over the stream, regardless of if
``self._UNARY_REQUESTS`` is set or not.
"""
if self._rpc is not None and self._rpc.is_active:
self._rpc.send(types.StreamingPullRequest()) | [
"def",
"heartbeat",
"(",
"self",
")",
":",
"if",
"self",
".",
"_rpc",
"is",
"not",
"None",
"and",
"self",
".",
"_rpc",
".",
"is_active",
":",
"self",
".",
"_rpc",
".",
"send",
"(",
"types",
".",
"StreamingPullRequest",
"(",
")",
")"
] | Sends an empty request over the streaming pull RPC.
This always sends over the stream, regardless of if
``self._UNARY_REQUESTS`` is set or not. | [
"Sends",
"an",
"empty",
"request",
"over",
"the",
"streaming",
"pull",
"RPC",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L278-L285 |
27,935 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | StreamingPullManager._get_initial_request | def _get_initial_request(self):
"""Return the initial request for the RPC.
This defines the initial request that must always be sent to Pub/Sub
immediately upon opening the subscription.
Returns:
google.cloud.pubsub_v1.types.StreamingPullRequest: A request
suita... | python | def _get_initial_request(self):
"""Return the initial request for the RPC.
This defines the initial request that must always be sent to Pub/Sub
immediately upon opening the subscription.
Returns:
google.cloud.pubsub_v1.types.StreamingPullRequest: A request
suita... | [
"def",
"_get_initial_request",
"(",
"self",
")",
":",
"# Any ack IDs that are under lease management need to have their",
"# deadline extended immediately.",
"if",
"self",
".",
"_leaser",
"is",
"not",
"None",
":",
"# Explicitly copy the list, as it could be modified by another",
"#... | Return the initial request for the RPC.
This defines the initial request that must always be sent to Pub/Sub
immediately upon opening the subscription.
Returns:
google.cloud.pubsub_v1.types.StreamingPullRequest: A request
suitable for being the first request on the stre... | [
"Return",
"the",
"initial",
"request",
"for",
"the",
"RPC",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L370-L399 |
27,936 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py | StreamingPullManager._should_recover | def _should_recover(self, exception):
"""Determine if an error on the RPC stream should be recovered.
If the exception is one of the retryable exceptions, this will signal
to the consumer thread that it should "recover" from the failure.
This will cause the stream to exit when it retur... | python | def _should_recover(self, exception):
"""Determine if an error on the RPC stream should be recovered.
If the exception is one of the retryable exceptions, this will signal
to the consumer thread that it should "recover" from the failure.
This will cause the stream to exit when it retur... | [
"def",
"_should_recover",
"(",
"self",
",",
"exception",
")",
":",
"exception",
"=",
"_maybe_wrap_exception",
"(",
"exception",
")",
"# If this is in the list of idempotent exceptions, then we want to",
"# recover.",
"if",
"isinstance",
"(",
"exception",
",",
"_RETRYABLE_ST... | Determine if an error on the RPC stream should be recovered.
If the exception is one of the retryable exceptions, this will signal
to the consumer thread that it should "recover" from the failure.
This will cause the stream to exit when it returns :data:`False`.
Returns:
b... | [
"Determine",
"if",
"an",
"error",
"on",
"the",
"RPC",
"stream",
"should",
"be",
"recovered",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L432-L452 |
27,937 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/batch.py | WriteBatch.create | def create(self, reference, document_data):
"""Add a "change" to this batch to create a document.
If the document given by ``reference`` already exists, then this
batch will fail when :meth:`commit`-ed.
Args:
reference (~.firestore_v1beta1.document.DocumentReference): A
... | python | def create(self, reference, document_data):
"""Add a "change" to this batch to create a document.
If the document given by ``reference`` already exists, then this
batch will fail when :meth:`commit`-ed.
Args:
reference (~.firestore_v1beta1.document.DocumentReference): A
... | [
"def",
"create",
"(",
"self",
",",
"reference",
",",
"document_data",
")",
":",
"write_pbs",
"=",
"_helpers",
".",
"pbs_for_create",
"(",
"reference",
".",
"_document_path",
",",
"document_data",
")",
"self",
".",
"_add_write_pbs",
"(",
"write_pbs",
")"
] | Add a "change" to this batch to create a document.
If the document given by ``reference`` already exists, then this
batch will fail when :meth:`commit`-ed.
Args:
reference (~.firestore_v1beta1.document.DocumentReference): A
document reference to be created in this b... | [
"Add",
"a",
"change",
"to",
"this",
"batch",
"to",
"create",
"a",
"document",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L50-L63 |
27,938 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/batch.py | WriteBatch.set | def set(self, reference, document_data, merge=False):
"""Add a "change" to replace a document.
See
:meth:`~.firestore_v1beta1.document.DocumentReference.set` for
more information on how ``option`` determines how the change is
applied.
Args:
reference (~.fire... | python | def set(self, reference, document_data, merge=False):
"""Add a "change" to replace a document.
See
:meth:`~.firestore_v1beta1.document.DocumentReference.set` for
more information on how ``option`` determines how the change is
applied.
Args:
reference (~.fire... | [
"def",
"set",
"(",
"self",
",",
"reference",
",",
"document_data",
",",
"merge",
"=",
"False",
")",
":",
"if",
"merge",
"is",
"not",
"False",
":",
"write_pbs",
"=",
"_helpers",
".",
"pbs_for_set_with_merge",
"(",
"reference",
".",
"_document_path",
",",
"d... | Add a "change" to replace a document.
See
:meth:`~.firestore_v1beta1.document.DocumentReference.set` for
more information on how ``option`` determines how the change is
applied.
Args:
reference (~.firestore_v1beta1.document.DocumentReference):
A docu... | [
"Add",
"a",
"change",
"to",
"replace",
"a",
"document",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L65-L91 |
27,939 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/batch.py | WriteBatch.update | def update(self, reference, field_updates, option=None):
"""Add a "change" to update a document.
See
:meth:`~.firestore_v1beta1.document.DocumentReference.update` for
more information on ``field_updates`` and ``option``.
Args:
reference (~.firestore_v1beta1.document... | python | def update(self, reference, field_updates, option=None):
"""Add a "change" to update a document.
See
:meth:`~.firestore_v1beta1.document.DocumentReference.update` for
more information on ``field_updates`` and ``option``.
Args:
reference (~.firestore_v1beta1.document... | [
"def",
"update",
"(",
"self",
",",
"reference",
",",
"field_updates",
",",
"option",
"=",
"None",
")",
":",
"if",
"option",
".",
"__class__",
".",
"__name__",
"==",
"\"ExistsOption\"",
":",
"raise",
"ValueError",
"(",
"\"you must not pass an explicit write option ... | Add a "change" to update a document.
See
:meth:`~.firestore_v1beta1.document.DocumentReference.update` for
more information on ``field_updates`` and ``option``.
Args:
reference (~.firestore_v1beta1.document.DocumentReference): A
document reference that will b... | [
"Add",
"a",
"change",
"to",
"update",
"a",
"document",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L93-L114 |
27,940 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/batch.py | WriteBatch.delete | def delete(self, reference, option=None):
"""Add a "change" to delete a document.
See
:meth:`~.firestore_v1beta1.document.DocumentReference.delete` for
more information on how ``option`` determines how the change is
applied.
Args:
reference (~.firestore_v1be... | python | def delete(self, reference, option=None):
"""Add a "change" to delete a document.
See
:meth:`~.firestore_v1beta1.document.DocumentReference.delete` for
more information on how ``option`` determines how the change is
applied.
Args:
reference (~.firestore_v1be... | [
"def",
"delete",
"(",
"self",
",",
"reference",
",",
"option",
"=",
"None",
")",
":",
"write_pb",
"=",
"_helpers",
".",
"pb_for_delete",
"(",
"reference",
".",
"_document_path",
",",
"option",
")",
"self",
".",
"_add_write_pbs",
"(",
"[",
"write_pb",
"]",
... | Add a "change" to delete a document.
See
:meth:`~.firestore_v1beta1.document.DocumentReference.delete` for
more information on how ``option`` determines how the change is
applied.
Args:
reference (~.firestore_v1beta1.document.DocumentReference): A
doc... | [
"Add",
"a",
"change",
"to",
"delete",
"a",
"document",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L116-L132 |
27,941 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/batch.py | WriteBatch.commit | def commit(self):
"""Commit the changes accumulated in this batch.
Returns:
List[google.cloud.proto.firestore.v1beta1.\
write_pb2.WriteResult, ...]: The write results corresponding
to the changes committed, returned in the same order as the
changes we... | python | def commit(self):
"""Commit the changes accumulated in this batch.
Returns:
List[google.cloud.proto.firestore.v1beta1.\
write_pb2.WriteResult, ...]: The write results corresponding
to the changes committed, returned in the same order as the
changes we... | [
"def",
"commit",
"(",
"self",
")",
":",
"commit_response",
"=",
"self",
".",
"_client",
".",
"_firestore_api",
".",
"commit",
"(",
"self",
".",
"_client",
".",
"_database_string",
",",
"self",
".",
"_write_pbs",
",",
"transaction",
"=",
"None",
",",
"metad... | Commit the changes accumulated in this batch.
Returns:
List[google.cloud.proto.firestore.v1beta1.\
write_pb2.WriteResult, ...]: The write results corresponding
to the changes committed, returned in the same order as the
changes were applied to this batch. A w... | [
"Commit",
"the",
"changes",
"accumulated",
"in",
"this",
"batch",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L134-L154 |
27,942 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _ensure_tuple_or_list | def _ensure_tuple_or_list(arg_name, tuple_or_list):
"""Ensures an input is a tuple or list.
This effectively reduces the iterable types allowed to a very short
whitelist: list and tuple.
:type arg_name: str
:param arg_name: Name of argument to use in error message.
:type tuple_or_list: sequen... | python | def _ensure_tuple_or_list(arg_name, tuple_or_list):
"""Ensures an input is a tuple or list.
This effectively reduces the iterable types allowed to a very short
whitelist: list and tuple.
:type arg_name: str
:param arg_name: Name of argument to use in error message.
:type tuple_or_list: sequen... | [
"def",
"_ensure_tuple_or_list",
"(",
"arg_name",
",",
"tuple_or_list",
")",
":",
"if",
"not",
"isinstance",
"(",
"tuple_or_list",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"Expected %s to be a tuple or list. \"",
"\"Received %r\"",
... | Ensures an input is a tuple or list.
This effectively reduces the iterable types allowed to a very short
whitelist: list and tuple.
:type arg_name: str
:param arg_name: Name of argument to use in error message.
:type tuple_or_list: sequence of str
:param tuple_or_list: Sequence to be verified... | [
"Ensures",
"an",
"input",
"is",
"a",
"tuple",
"or",
"list",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L149-L170 |
27,943 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _microseconds_from_datetime | def _microseconds_from_datetime(value):
"""Convert non-none datetime to microseconds.
:type value: :class:`datetime.datetime`
:param value: The timestamp to convert.
:rtype: int
:returns: The timestamp, in microseconds.
"""
if not value.tzinfo:
value = value.replace(tzinfo=UTC)
... | python | def _microseconds_from_datetime(value):
"""Convert non-none datetime to microseconds.
:type value: :class:`datetime.datetime`
:param value: The timestamp to convert.
:rtype: int
:returns: The timestamp, in microseconds.
"""
if not value.tzinfo:
value = value.replace(tzinfo=UTC)
... | [
"def",
"_microseconds_from_datetime",
"(",
"value",
")",
":",
"if",
"not",
"value",
".",
"tzinfo",
":",
"value",
"=",
"value",
".",
"replace",
"(",
"tzinfo",
"=",
"UTC",
")",
"# Regardless of what timezone is on the value, convert it to UTC.",
"value",
"=",
"value",... | Convert non-none datetime to microseconds.
:type value: :class:`datetime.datetime`
:param value: The timestamp to convert.
:rtype: int
:returns: The timestamp, in microseconds. | [
"Convert",
"non",
"-",
"none",
"datetime",
"to",
"microseconds",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L215-L229 |
27,944 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _time_from_iso8601_time_naive | def _time_from_iso8601_time_naive(value):
"""Convert a zoneless ISO8601 time string to naive datetime time
:type value: str
:param value: The time string to convert
:rtype: :class:`datetime.time`
:returns: A datetime time object created from the string
:raises ValueError: if the value does not... | python | def _time_from_iso8601_time_naive(value):
"""Convert a zoneless ISO8601 time string to naive datetime time
:type value: str
:param value: The time string to convert
:rtype: :class:`datetime.time`
:returns: A datetime time object created from the string
:raises ValueError: if the value does not... | [
"def",
"_time_from_iso8601_time_naive",
"(",
"value",
")",
":",
"if",
"len",
"(",
"value",
")",
"==",
"8",
":",
"# HH:MM:SS",
"fmt",
"=",
"_TIMEONLY_NO_FRACTION",
"elif",
"len",
"(",
"value",
")",
"==",
"15",
":",
"# HH:MM:SS.micros",
"fmt",
"=",
"_TIMEONLY_... | Convert a zoneless ISO8601 time string to naive datetime time
:type value: str
:param value: The time string to convert
:rtype: :class:`datetime.time`
:returns: A datetime time object created from the string
:raises ValueError: if the value does not match a known format. | [
"Convert",
"a",
"zoneless",
"ISO8601",
"time",
"string",
"to",
"naive",
"datetime",
"time"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L258-L274 |
27,945 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _rfc3339_to_datetime | def _rfc3339_to_datetime(dt_str):
"""Convert a microsecond-precision timestamp to a native datetime.
:type dt_str: str
:param dt_str: The string to convert.
:rtype: :class:`datetime.datetime`
:returns: The datetime object created from the string.
"""
return datetime.datetime.strptime(dt_st... | python | def _rfc3339_to_datetime(dt_str):
"""Convert a microsecond-precision timestamp to a native datetime.
:type dt_str: str
:param dt_str: The string to convert.
:rtype: :class:`datetime.datetime`
:returns: The datetime object created from the string.
"""
return datetime.datetime.strptime(dt_st... | [
"def",
"_rfc3339_to_datetime",
"(",
"dt_str",
")",
":",
"return",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"dt_str",
",",
"_RFC3339_MICROS",
")",
".",
"replace",
"(",
"tzinfo",
"=",
"UTC",
")"
] | Convert a microsecond-precision timestamp to a native datetime.
:type dt_str: str
:param dt_str: The string to convert.
:rtype: :class:`datetime.datetime`
:returns: The datetime object created from the string. | [
"Convert",
"a",
"microsecond",
"-",
"precision",
"timestamp",
"to",
"a",
"native",
"datetime",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L277-L286 |
27,946 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _datetime_to_rfc3339 | def _datetime_to_rfc3339(value, ignore_zone=True):
"""Convert a timestamp to a string.
:type value: :class:`datetime.datetime`
:param value: The datetime object to be converted to a string.
:type ignore_zone: bool
:param ignore_zone: If True, then the timezone (if any) of the datetime
... | python | def _datetime_to_rfc3339(value, ignore_zone=True):
"""Convert a timestamp to a string.
:type value: :class:`datetime.datetime`
:param value: The datetime object to be converted to a string.
:type ignore_zone: bool
:param ignore_zone: If True, then the timezone (if any) of the datetime
... | [
"def",
"_datetime_to_rfc3339",
"(",
"value",
",",
"ignore_zone",
"=",
"True",
")",
":",
"if",
"not",
"ignore_zone",
"and",
"value",
".",
"tzinfo",
"is",
"not",
"None",
":",
"# Convert to UTC and remove the time zone info.",
"value",
"=",
"value",
".",
"replace",
... | Convert a timestamp to a string.
:type value: :class:`datetime.datetime`
:param value: The datetime object to be converted to a string.
:type ignore_zone: bool
:param ignore_zone: If True, then the timezone (if any) of the datetime
object is ignored.
:rtype: str
:retur... | [
"Convert",
"a",
"timestamp",
"to",
"a",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L324-L341 |
27,947 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _bytes_to_unicode | def _bytes_to_unicode(value):
"""Converts bytes to a unicode value, if necessary.
:type value: bytes
:param value: bytes value to attempt string conversion on.
:rtype: str
:returns: The original value converted to unicode (if bytes) or as passed
in if it started out as unicode.
... | python | def _bytes_to_unicode(value):
"""Converts bytes to a unicode value, if necessary.
:type value: bytes
:param value: bytes value to attempt string conversion on.
:rtype: str
:returns: The original value converted to unicode (if bytes) or as passed
in if it started out as unicode.
... | [
"def",
"_bytes_to_unicode",
"(",
"value",
")",
":",
"result",
"=",
"value",
".",
"decode",
"(",
"\"utf-8\"",
")",
"if",
"isinstance",
"(",
"value",
",",
"six",
".",
"binary_type",
")",
"else",
"value",
"if",
"isinstance",
"(",
"result",
",",
"six",
".",
... | Converts bytes to a unicode value, if necessary.
:type value: bytes
:param value: bytes value to attempt string conversion on.
:rtype: str
:returns: The original value converted to unicode (if bytes) or as passed
in if it started out as unicode.
:raises ValueError: if the value coul... | [
"Converts",
"bytes",
"to",
"a",
"unicode",
"value",
"if",
"necessary",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L373-L389 |
27,948 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _from_any_pb | def _from_any_pb(pb_type, any_pb):
"""Converts an Any protobuf to the specified message type
Args:
pb_type (type): the type of the message that any_pb stores an instance
of.
any_pb (google.protobuf.any_pb2.Any): the object to be converted.
Returns:
pb_type: An instance ... | python | def _from_any_pb(pb_type, any_pb):
"""Converts an Any protobuf to the specified message type
Args:
pb_type (type): the type of the message that any_pb stores an instance
of.
any_pb (google.protobuf.any_pb2.Any): the object to be converted.
Returns:
pb_type: An instance ... | [
"def",
"_from_any_pb",
"(",
"pb_type",
",",
"any_pb",
")",
":",
"msg",
"=",
"pb_type",
"(",
")",
"if",
"not",
"any_pb",
".",
"Unpack",
"(",
"msg",
")",
":",
"raise",
"TypeError",
"(",
"\"Could not convert {} to {}\"",
".",
"format",
"(",
"any_pb",
".",
"... | Converts an Any protobuf to the specified message type
Args:
pb_type (type): the type of the message that any_pb stores an instance
of.
any_pb (google.protobuf.any_pb2.Any): the object to be converted.
Returns:
pb_type: An instance of the pb_type message.
Raises:
... | [
"Converts",
"an",
"Any",
"protobuf",
"to",
"the",
"specified",
"message",
"type"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L392-L414 |
27,949 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _pb_timestamp_to_datetime | def _pb_timestamp_to_datetime(timestamp_pb):
"""Convert a Timestamp protobuf to a datetime object.
:type timestamp_pb: :class:`google.protobuf.timestamp_pb2.Timestamp`
:param timestamp_pb: A Google returned timestamp protobuf.
:rtype: :class:`datetime.datetime`
:returns: A UTC datetime object conv... | python | def _pb_timestamp_to_datetime(timestamp_pb):
"""Convert a Timestamp protobuf to a datetime object.
:type timestamp_pb: :class:`google.protobuf.timestamp_pb2.Timestamp`
:param timestamp_pb: A Google returned timestamp protobuf.
:rtype: :class:`datetime.datetime`
:returns: A UTC datetime object conv... | [
"def",
"_pb_timestamp_to_datetime",
"(",
"timestamp_pb",
")",
":",
"return",
"_EPOCH",
"+",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"timestamp_pb",
".",
"seconds",
",",
"microseconds",
"=",
"(",
"timestamp_pb",
".",
"nanos",
"/",
"1000.0",
")",
")"
... | Convert a Timestamp protobuf to a datetime object.
:type timestamp_pb: :class:`google.protobuf.timestamp_pb2.Timestamp`
:param timestamp_pb: A Google returned timestamp protobuf.
:rtype: :class:`datetime.datetime`
:returns: A UTC datetime object converted from a protobuf timestamp. | [
"Convert",
"a",
"Timestamp",
"protobuf",
"to",
"a",
"datetime",
"object",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L417-L428 |
27,950 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _datetime_to_pb_timestamp | def _datetime_to_pb_timestamp(when):
"""Convert a datetime object to a Timestamp protobuf.
:type when: :class:`datetime.datetime`
:param when: the datetime to convert
:rtype: :class:`google.protobuf.timestamp_pb2.Timestamp`
:returns: A timestamp protobuf corresponding to the object.
"""
ms... | python | def _datetime_to_pb_timestamp(when):
"""Convert a datetime object to a Timestamp protobuf.
:type when: :class:`datetime.datetime`
:param when: the datetime to convert
:rtype: :class:`google.protobuf.timestamp_pb2.Timestamp`
:returns: A timestamp protobuf corresponding to the object.
"""
ms... | [
"def",
"_datetime_to_pb_timestamp",
"(",
"when",
")",
":",
"ms_value",
"=",
"_microseconds_from_datetime",
"(",
"when",
")",
"seconds",
",",
"micros",
"=",
"divmod",
"(",
"ms_value",
",",
"10",
"**",
"6",
")",
"nanos",
"=",
"micros",
"*",
"10",
"**",
"3",
... | Convert a datetime object to a Timestamp protobuf.
:type when: :class:`datetime.datetime`
:param when: the datetime to convert
:rtype: :class:`google.protobuf.timestamp_pb2.Timestamp`
:returns: A timestamp protobuf corresponding to the object. | [
"Convert",
"a",
"datetime",
"object",
"to",
"a",
"Timestamp",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L444-L456 |
27,951 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _duration_pb_to_timedelta | def _duration_pb_to_timedelta(duration_pb):
"""Convert a duration protobuf to a Python timedelta object.
.. note::
The Python timedelta has a granularity of microseconds while
the protobuf duration type has a duration of nanoseconds.
:type duration_pb: :class:`google.protobuf.duration_pb2... | python | def _duration_pb_to_timedelta(duration_pb):
"""Convert a duration protobuf to a Python timedelta object.
.. note::
The Python timedelta has a granularity of microseconds while
the protobuf duration type has a duration of nanoseconds.
:type duration_pb: :class:`google.protobuf.duration_pb2... | [
"def",
"_duration_pb_to_timedelta",
"(",
"duration_pb",
")",
":",
"return",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"duration_pb",
".",
"seconds",
",",
"microseconds",
"=",
"(",
"duration_pb",
".",
"nanos",
"/",
"1000.0",
")",
")"
] | Convert a duration protobuf to a Python timedelta object.
.. note::
The Python timedelta has a granularity of microseconds while
the protobuf duration type has a duration of nanoseconds.
:type duration_pb: :class:`google.protobuf.duration_pb2.Duration`
:param duration_pb: A protobuf durat... | [
"Convert",
"a",
"duration",
"protobuf",
"to",
"a",
"Python",
"timedelta",
"object",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L478-L494 |
27,952 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | _name_from_project_path | def _name_from_project_path(path, project, template):
"""Validate a URI path and get the leaf object's name.
:type path: str
:param path: URI path containing the name.
:type project: str
:param project: (Optional) The project associated with the request. It is
included for vali... | python | def _name_from_project_path(path, project, template):
"""Validate a URI path and get the leaf object's name.
:type path: str
:param path: URI path containing the name.
:type project: str
:param project: (Optional) The project associated with the request. It is
included for vali... | [
"def",
"_name_from_project_path",
"(",
"path",
",",
"project",
",",
"template",
")",
":",
"if",
"isinstance",
"(",
"template",
",",
"str",
")",
":",
"template",
"=",
"re",
".",
"compile",
"(",
"template",
")",
"match",
"=",
"template",
".",
"match",
"(",... | Validate a URI path and get the leaf object's name.
:type path: str
:param path: URI path containing the name.
:type project: str
:param project: (Optional) The project associated with the request. It is
included for validation purposes. If passed as None,
disa... | [
"Validate",
"a",
"URI",
"path",
"and",
"get",
"the",
"leaf",
"object",
"s",
"name",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L497-L537 |
27,953 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | make_secure_channel | def make_secure_channel(credentials, user_agent, host, extra_options=()):
"""Makes a secure channel for an RPC service.
Uses / depends on gRPC.
:type credentials: :class:`google.auth.credentials.Credentials`
:param credentials: The OAuth2 Credentials to use for creating
access ... | python | def make_secure_channel(credentials, user_agent, host, extra_options=()):
"""Makes a secure channel for an RPC service.
Uses / depends on gRPC.
:type credentials: :class:`google.auth.credentials.Credentials`
:param credentials: The OAuth2 Credentials to use for creating
access ... | [
"def",
"make_secure_channel",
"(",
"credentials",
",",
"user_agent",
",",
"host",
",",
"extra_options",
"=",
"(",
")",
")",
":",
"target",
"=",
"\"%s:%d\"",
"%",
"(",
"host",
",",
"http_client",
".",
"HTTPS_PORT",
")",
"http_request",
"=",
"google",
".",
"... | Makes a secure channel for an RPC service.
Uses / depends on gRPC.
:type credentials: :class:`google.auth.credentials.Credentials`
:param credentials: The OAuth2 Credentials to use for creating
access tokens.
:type user_agent: str
:param user_agent: The user agent to be us... | [
"Makes",
"a",
"secure",
"channel",
"for",
"an",
"RPC",
"service",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L540-L569 |
27,954 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | make_secure_stub | def make_secure_stub(credentials, user_agent, stub_class, host, extra_options=()):
"""Makes a secure stub for an RPC service.
Uses / depends on gRPC.
:type credentials: :class:`google.auth.credentials.Credentials`
:param credentials: The OAuth2 Credentials to use for creating
a... | python | def make_secure_stub(credentials, user_agent, stub_class, host, extra_options=()):
"""Makes a secure stub for an RPC service.
Uses / depends on gRPC.
:type credentials: :class:`google.auth.credentials.Credentials`
:param credentials: The OAuth2 Credentials to use for creating
a... | [
"def",
"make_secure_stub",
"(",
"credentials",
",",
"user_agent",
",",
"stub_class",
",",
"host",
",",
"extra_options",
"=",
"(",
")",
")",
":",
"channel",
"=",
"make_secure_channel",
"(",
"credentials",
",",
"user_agent",
",",
"host",
",",
"extra_options",
"=... | Makes a secure stub for an RPC service.
Uses / depends on gRPC.
:type credentials: :class:`google.auth.credentials.Credentials`
:param credentials: The OAuth2 Credentials to use for creating
access tokens.
:type user_agent: str
:param user_agent: The user agent to be used ... | [
"Makes",
"a",
"secure",
"stub",
"for",
"an",
"RPC",
"service",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L572-L600 |
27,955 | googleapis/google-cloud-python | core/google/cloud/_helpers.py | make_insecure_stub | def make_insecure_stub(stub_class, host, port=None):
"""Makes an insecure stub for an RPC service.
Uses / depends on gRPC.
:type stub_class: type
:param stub_class: A gRPC stub type for a given service.
:type host: str
:param host: The host for the service. May also include the port
... | python | def make_insecure_stub(stub_class, host, port=None):
"""Makes an insecure stub for an RPC service.
Uses / depends on gRPC.
:type stub_class: type
:param stub_class: A gRPC stub type for a given service.
:type host: str
:param host: The host for the service. May also include the port
... | [
"def",
"make_insecure_stub",
"(",
"stub_class",
",",
"host",
",",
"port",
"=",
"None",
")",
":",
"if",
"port",
"is",
"None",
":",
"target",
"=",
"host",
"else",
":",
"# NOTE: This assumes port != http_client.HTTPS_PORT:",
"target",
"=",
"\"%s:%d\"",
"%",
"(",
... | Makes an insecure stub for an RPC service.
Uses / depends on gRPC.
:type stub_class: type
:param stub_class: A gRPC stub type for a given service.
:type host: str
:param host: The host for the service. May also include the port
if ``port`` is unspecified.
:type port: int
... | [
"Makes",
"an",
"insecure",
"stub",
"for",
"an",
"RPC",
"service",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L603-L627 |
27,956 | googleapis/google-cloud-python | vision/google/cloud/vision_helpers/decorators.py | _create_single_feature_method | def _create_single_feature_method(feature):
"""Return a function that will detect a single feature.
Args:
feature (enum): A specific feature defined as a member of
:class:`~enums.Feature.Type`.
Returns:
function: A helper function to detect just that feature.
"""
# Defi... | python | def _create_single_feature_method(feature):
"""Return a function that will detect a single feature.
Args:
feature (enum): A specific feature defined as a member of
:class:`~enums.Feature.Type`.
Returns:
function: A helper function to detect just that feature.
"""
# Defi... | [
"def",
"_create_single_feature_method",
"(",
"feature",
")",
":",
"# Define the function properties.",
"fx_name",
"=",
"feature",
".",
"name",
".",
"lower",
"(",
")",
"if",
"\"detection\"",
"in",
"fx_name",
":",
"fx_doc",
"=",
"\"Perform {0}.\"",
".",
"format",
"(... | Return a function that will detect a single feature.
Args:
feature (enum): A specific feature defined as a member of
:class:`~enums.Feature.Type`.
Returns:
function: A helper function to detect just that feature. | [
"Return",
"a",
"function",
"that",
"will",
"detect",
"a",
"single",
"feature",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_helpers/decorators.py#L52-L109 |
27,957 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/scheduler.py | ThreadScheduler.schedule | def schedule(self, callback, *args, **kwargs):
"""Schedule the callback to be called asynchronously in a thread pool.
Args:
callback (Callable): The function to call.
args: Positional arguments passed to the function.
kwargs: Key-word arguments passed to the function... | python | def schedule(self, callback, *args, **kwargs):
"""Schedule the callback to be called asynchronously in a thread pool.
Args:
callback (Callable): The function to call.
args: Positional arguments passed to the function.
kwargs: Key-word arguments passed to the function... | [
"def",
"schedule",
"(",
"self",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_executor",
".",
"submit",
"(",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Schedule the callback to be called asynchronously in a thread pool.
Args:
callback (Callable): The function to call.
args: Positional arguments passed to the function.
kwargs: Key-word arguments passed to the function.
Returns:
None | [
"Schedule",
"the",
"callback",
"to",
"be",
"called",
"asynchronously",
"in",
"a",
"thread",
"pool",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/scheduler.py#L99-L110 |
27,958 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/scheduler.py | ThreadScheduler.shutdown | def shutdown(self):
"""Shuts down the scheduler and immediately end all pending callbacks.
"""
# Drop all pending item from the executor. Without this, the executor
# will block until all pending items are complete, which is
# undesirable.
try:
while True:
... | python | def shutdown(self):
"""Shuts down the scheduler and immediately end all pending callbacks.
"""
# Drop all pending item from the executor. Without this, the executor
# will block until all pending items are complete, which is
# undesirable.
try:
while True:
... | [
"def",
"shutdown",
"(",
"self",
")",
":",
"# Drop all pending item from the executor. Without this, the executor",
"# will block until all pending items are complete, which is",
"# undesirable.",
"try",
":",
"while",
"True",
":",
"self",
".",
"_executor",
".",
"_work_queue",
".... | Shuts down the scheduler and immediately end all pending callbacks. | [
"Shuts",
"down",
"the",
"scheduler",
"and",
"immediately",
"end",
"all",
"pending",
"callbacks",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/scheduler.py#L112-L123 |
27,959 | googleapis/google-cloud-python | error_reporting/google/cloud/errorreporting_v1beta1/gapic/error_stats_service_client.py | ErrorStatsServiceClient.list_events | def list_events(
self,
project_name,
group_id,
service_filter=None,
time_range=None,
page_size=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Lists the... | python | def list_events(
self,
project_name,
group_id,
service_filter=None,
time_range=None,
page_size=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Lists the... | [
"def",
"list_events",
"(",
"self",
",",
"project_name",
",",
"group_id",
",",
"service_filter",
"=",
"None",
",",
"time_range",
"=",
"None",
",",
"page_size",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
... | Lists the specified events.
Example:
>>> from google.cloud import errorreporting_v1beta1
>>>
>>> client = errorreporting_v1beta1.ErrorStatsServiceClient()
>>>
>>> project_name = client.project_path('[PROJECT]')
>>>
>>> # TODO: ... | [
"Lists",
"the",
"specified",
"events",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/errorreporting_v1beta1/gapic/error_stats_service_client.py#L343-L470 |
27,960 | googleapis/google-cloud-python | error_reporting/google/cloud/errorreporting_v1beta1/gapic/error_stats_service_client.py | ErrorStatsServiceClient.delete_events | def delete_events(
self,
project_name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes all error events of a given project.
Example:
>>> from google.cloud import... | python | def delete_events(
self,
project_name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes all error events of a given project.
Example:
>>> from google.cloud import... | [
"def",
"delete_events",
"(",
"self",
",",
"project_name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"... | Deletes all error events of a given project.
Example:
>>> from google.cloud import errorreporting_v1beta1
>>>
>>> client = errorreporting_v1beta1.ErrorStatsServiceClient()
>>>
>>> project_name = client.project_path('[PROJECT]')
>>>
... | [
"Deletes",
"all",
"error",
"events",
"of",
"a",
"given",
"project",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/errorreporting_v1beta1/gapic/error_stats_service_client.py#L472-L542 |
27,961 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | _item_to_document_ref | def _item_to_document_ref(iterator, item):
"""Convert Document resource to document ref.
Args:
iterator (google.api_core.page_iterator.GRPCIterator):
iterator response
item (dict): document resource
"""
document_id = item.name.split(_helpers.DOCUMENT_PATH_DELIMITER)[-1]
... | python | def _item_to_document_ref(iterator, item):
"""Convert Document resource to document ref.
Args:
iterator (google.api_core.page_iterator.GRPCIterator):
iterator response
item (dict): document resource
"""
document_id = item.name.split(_helpers.DOCUMENT_PATH_DELIMITER)[-1]
... | [
"def",
"_item_to_document_ref",
"(",
"iterator",
",",
"item",
")",
":",
"document_id",
"=",
"item",
".",
"name",
".",
"split",
"(",
"_helpers",
".",
"DOCUMENT_PATH_DELIMITER",
")",
"[",
"-",
"1",
"]",
"return",
"iterator",
".",
"collection",
".",
"document",... | Convert Document resource to document ref.
Args:
iterator (google.api_core.page_iterator.GRPCIterator):
iterator response
item (dict): document resource | [
"Convert",
"Document",
"resource",
"to",
"document",
"ref",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L468-L477 |
27,962 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.parent | def parent(self):
"""Document that owns the current collection.
Returns:
Optional[~.firestore_v1beta1.document.DocumentReference]: The
parent document, if the current collection is not a
top-level collection.
"""
if len(self._path) == 1:
r... | python | def parent(self):
"""Document that owns the current collection.
Returns:
Optional[~.firestore_v1beta1.document.DocumentReference]: The
parent document, if the current collection is not a
top-level collection.
"""
if len(self._path) == 1:
r... | [
"def",
"parent",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_path",
")",
"==",
"1",
":",
"return",
"None",
"else",
":",
"parent_path",
"=",
"self",
".",
"_path",
"[",
":",
"-",
"1",
"]",
"return",
"self",
".",
"_client",
".",
"documen... | Document that owns the current collection.
Returns:
Optional[~.firestore_v1beta1.document.DocumentReference]: The
parent document, if the current collection is not a
top-level collection. | [
"Document",
"that",
"owns",
"the",
"current",
"collection",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L80-L92 |
27,963 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.document | def document(self, document_id=None):
"""Create a sub-document underneath the current collection.
Args:
document_id (Optional[str]): The document identifier
within the current collection. If not provided, will default
to a random 20 character string composed ... | python | def document(self, document_id=None):
"""Create a sub-document underneath the current collection.
Args:
document_id (Optional[str]): The document identifier
within the current collection. If not provided, will default
to a random 20 character string composed ... | [
"def",
"document",
"(",
"self",
",",
"document_id",
"=",
"None",
")",
":",
"if",
"document_id",
"is",
"None",
":",
"document_id",
"=",
"_auto_id",
"(",
")",
"child_path",
"=",
"self",
".",
"_path",
"+",
"(",
"document_id",
",",
")",
"return",
"self",
"... | Create a sub-document underneath the current collection.
Args:
document_id (Optional[str]): The document identifier
within the current collection. If not provided, will default
to a random 20 character string composed of digits,
uppercase and lowercas... | [
"Create",
"a",
"sub",
"-",
"document",
"underneath",
"the",
"current",
"collection",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L94-L111 |
27,964 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference._parent_info | def _parent_info(self):
"""Get fully-qualified parent path and prefix for this collection.
Returns:
Tuple[str, str]: Pair of
* the fully-qualified (with database and project) path to the
parent of this collection (will either be the database path
or ... | python | def _parent_info(self):
"""Get fully-qualified parent path and prefix for this collection.
Returns:
Tuple[str, str]: Pair of
* the fully-qualified (with database and project) path to the
parent of this collection (will either be the database path
or ... | [
"def",
"_parent_info",
"(",
"self",
")",
":",
"parent_doc",
"=",
"self",
".",
"parent",
"if",
"parent_doc",
"is",
"None",
":",
"parent_path",
"=",
"_helpers",
".",
"DOCUMENT_PATH_DELIMITER",
".",
"join",
"(",
"(",
"self",
".",
"_client",
".",
"_database_stri... | Get fully-qualified parent path and prefix for this collection.
Returns:
Tuple[str, str]: Pair of
* the fully-qualified (with database and project) path to the
parent of this collection (will either be the database path
or a document path).
* the... | [
"Get",
"fully",
"-",
"qualified",
"parent",
"path",
"and",
"prefix",
"for",
"this",
"collection",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L113-L133 |
27,965 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.add | def add(self, document_data, document_id=None):
"""Create a document in the Firestore database with the provided data.
Args:
document_data (dict): Property names and values to use for
creating the document.
document_id (Optional[str]): The document identifier wit... | python | def add(self, document_data, document_id=None):
"""Create a document in the Firestore database with the provided data.
Args:
document_data (dict): Property names and values to use for
creating the document.
document_id (Optional[str]): The document identifier wit... | [
"def",
"add",
"(",
"self",
",",
"document_data",
",",
"document_id",
"=",
"None",
")",
":",
"if",
"document_id",
"is",
"None",
":",
"parent_path",
",",
"expected_prefix",
"=",
"self",
".",
"_parent_info",
"(",
")",
"document_pb",
"=",
"document_pb2",
".",
... | Create a document in the Firestore database with the provided data.
Args:
document_data (dict): Property names and values to use for
creating the document.
document_id (Optional[str]): The document identifier within the
current collection. If not provided... | [
"Create",
"a",
"document",
"in",
"the",
"Firestore",
"database",
"with",
"the",
"provided",
"data",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L135-L180 |
27,966 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.list_documents | def list_documents(self, page_size=None):
"""List all subdocuments of the current collection.
Args:
page_size (Optional[int]]): The maximum number of documents
in each page of results from this request. Non-positive values
are ignored. Defaults to a sensible value se... | python | def list_documents(self, page_size=None):
"""List all subdocuments of the current collection.
Args:
page_size (Optional[int]]): The maximum number of documents
in each page of results from this request. Non-positive values
are ignored. Defaults to a sensible value se... | [
"def",
"list_documents",
"(",
"self",
",",
"page_size",
"=",
"None",
")",
":",
"parent",
",",
"_",
"=",
"self",
".",
"_parent_info",
"(",
")",
"iterator",
"=",
"self",
".",
"_client",
".",
"_firestore_api",
".",
"list_documents",
"(",
"parent",
",",
"sel... | List all subdocuments of the current collection.
Args:
page_size (Optional[int]]): The maximum number of documents
in each page of results from this request. Non-positive values
are ignored. Defaults to a sensible value set by the API.
Returns:
Sequence[... | [
"List",
"all",
"subdocuments",
"of",
"the",
"current",
"collection",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L182-L207 |
27,967 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.select | def select(self, field_paths):
"""Create a "select" query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.select` for
more information on this method.
Args:
field_paths (Iterable[str, ...]): An iterable of field paths
(``.`... | python | def select(self, field_paths):
"""Create a "select" query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.select` for
more information on this method.
Args:
field_paths (Iterable[str, ...]): An iterable of field paths
(``.`... | [
"def",
"select",
"(",
"self",
",",
"field_paths",
")",
":",
"query",
"=",
"query_mod",
".",
"Query",
"(",
"self",
")",
"return",
"query",
".",
"select",
"(",
"field_paths",
")"
] | Create a "select" query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.select` for
more information on this method.
Args:
field_paths (Iterable[str, ...]): An iterable of field paths
(``.``-delimited list of field names) to use as... | [
"Create",
"a",
"select",
"query",
"with",
"this",
"collection",
"as",
"parent",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L209-L225 |
27,968 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.where | def where(self, field_path, op_string, value):
"""Create a "where" query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.where` for
more information on this method.
Args:
field_path (str): A field path (``.``-delimited list of
... | python | def where(self, field_path, op_string, value):
"""Create a "where" query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.where` for
more information on this method.
Args:
field_path (str): A field path (``.``-delimited list of
... | [
"def",
"where",
"(",
"self",
",",
"field_path",
",",
"op_string",
",",
"value",
")",
":",
"query",
"=",
"query_mod",
".",
"Query",
"(",
"self",
")",
"return",
"query",
".",
"where",
"(",
"field_path",
",",
"op_string",
",",
"value",
")"
] | Create a "where" query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.where` for
more information on this method.
Args:
field_path (str): A field path (``.``-delimited list of
field names) for the field to filter on.
o... | [
"Create",
"a",
"where",
"query",
"with",
"this",
"collection",
"as",
"parent",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L227-L248 |
27,969 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.order_by | def order_by(self, field_path, **kwargs):
"""Create an "order by" query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.order_by` for
more information on this method.
Args:
field_path (str): A field path (``.``-delimited list of
... | python | def order_by(self, field_path, **kwargs):
"""Create an "order by" query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.order_by` for
more information on this method.
Args:
field_path (str): A field path (``.``-delimited list of
... | [
"def",
"order_by",
"(",
"self",
",",
"field_path",
",",
"*",
"*",
"kwargs",
")",
":",
"query",
"=",
"query_mod",
".",
"Query",
"(",
"self",
")",
"return",
"query",
".",
"order_by",
"(",
"field_path",
",",
"*",
"*",
"kwargs",
")"
] | Create an "order by" query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.order_by` for
more information on this method.
Args:
field_path (str): A field path (``.``-delimited list of
field names) on which to order the query result... | [
"Create",
"an",
"order",
"by",
"query",
"with",
"this",
"collection",
"as",
"parent",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L250-L269 |
27,970 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.limit | def limit(self, count):
"""Create a limited query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.limit` for
more information on this method.
Args:
count (int): Maximum number of documents to return that match
the query.
... | python | def limit(self, count):
"""Create a limited query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.limit` for
more information on this method.
Args:
count (int): Maximum number of documents to return that match
the query.
... | [
"def",
"limit",
"(",
"self",
",",
"count",
")",
":",
"query",
"=",
"query_mod",
".",
"Query",
"(",
"self",
")",
"return",
"query",
".",
"limit",
"(",
"count",
")"
] | Create a limited query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.limit` for
more information on this method.
Args:
count (int): Maximum number of documents to return that match
the query.
Returns:
~.fires... | [
"Create",
"a",
"limited",
"query",
"with",
"this",
"collection",
"as",
"parent",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L271-L286 |
27,971 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.offset | def offset(self, num_to_skip):
"""Skip to an offset in a query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.offset` for
more information on this method.
Args:
num_to_skip (int): The number of results to skip at the beginning
... | python | def offset(self, num_to_skip):
"""Skip to an offset in a query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.offset` for
more information on this method.
Args:
num_to_skip (int): The number of results to skip at the beginning
... | [
"def",
"offset",
"(",
"self",
",",
"num_to_skip",
")",
":",
"query",
"=",
"query_mod",
".",
"Query",
"(",
"self",
")",
"return",
"query",
".",
"offset",
"(",
"num_to_skip",
")"
] | Skip to an offset in a query with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.offset` for
more information on this method.
Args:
num_to_skip (int): The number of results to skip at the beginning
of query results. (Must be non-negati... | [
"Skip",
"to",
"an",
"offset",
"in",
"a",
"query",
"with",
"this",
"collection",
"as",
"parent",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L288-L303 |
27,972 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.start_at | def start_at(self, document_fields):
"""Start query at a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.start_at` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
document.Docu... | python | def start_at(self, document_fields):
"""Start query at a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.start_at` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
document.Docu... | [
"def",
"start_at",
"(",
"self",
",",
"document_fields",
")",
":",
"query",
"=",
"query_mod",
".",
"Query",
"(",
"self",
")",
"return",
"query",
".",
"start_at",
"(",
"document_fields",
")"
] | Start query at a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.start_at` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
document.DocumentSnapshot, dict, list, tuple]): a document
... | [
"Start",
"query",
"at",
"a",
"cursor",
"with",
"this",
"collection",
"as",
"parent",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L305-L323 |
27,973 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.start_after | def start_after(self, document_fields):
"""Start query after a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.start_after` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
docu... | python | def start_after(self, document_fields):
"""Start query after a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.start_after` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
docu... | [
"def",
"start_after",
"(",
"self",
",",
"document_fields",
")",
":",
"query",
"=",
"query_mod",
".",
"Query",
"(",
"self",
")",
"return",
"query",
".",
"start_after",
"(",
"document_fields",
")"
] | Start query after a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.start_after` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
document.DocumentSnapshot, dict, list, tuple]): a docum... | [
"Start",
"query",
"after",
"a",
"cursor",
"with",
"this",
"collection",
"as",
"parent",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L325-L343 |
27,974 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.end_before | def end_before(self, document_fields):
"""End query before a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.end_before` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
documen... | python | def end_before(self, document_fields):
"""End query before a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.end_before` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
documen... | [
"def",
"end_before",
"(",
"self",
",",
"document_fields",
")",
":",
"query",
"=",
"query_mod",
".",
"Query",
"(",
"self",
")",
"return",
"query",
".",
"end_before",
"(",
"document_fields",
")"
] | End query before a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.end_before` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
document.DocumentSnapshot, dict, list, tuple]): a documen... | [
"End",
"query",
"before",
"a",
"cursor",
"with",
"this",
"collection",
"as",
"parent",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L345-L363 |
27,975 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.end_at | def end_at(self, document_fields):
"""End query at a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.end_at` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
document.DocumentSn... | python | def end_at(self, document_fields):
"""End query at a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.end_at` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
document.DocumentSn... | [
"def",
"end_at",
"(",
"self",
",",
"document_fields",
")",
":",
"query",
"=",
"query_mod",
".",
"Query",
"(",
"self",
")",
"return",
"query",
".",
"end_at",
"(",
"document_fields",
")"
] | End query at a cursor with this collection as parent.
See
:meth:`~.firestore_v1beta1.query.Query.end_at` for
more information on this method.
Args:
document_fields (Union[~.firestore_v1beta1.\
document.DocumentSnapshot, dict, list, tuple]): a document
... | [
"End",
"query",
"at",
"a",
"cursor",
"with",
"this",
"collection",
"as",
"parent",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L365-L383 |
27,976 | googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/collection.py | CollectionReference.stream | def stream(self, transaction=None):
"""Read the documents in this collection.
This sends a ``RunQuery`` RPC and then returns an iterator which
consumes each document returned in the stream of ``RunQueryResponse``
messages.
.. note::
The underlying stream of response... | python | def stream(self, transaction=None):
"""Read the documents in this collection.
This sends a ``RunQuery`` RPC and then returns an iterator which
consumes each document returned in the stream of ``RunQueryResponse``
messages.
.. note::
The underlying stream of response... | [
"def",
"stream",
"(",
"self",
",",
"transaction",
"=",
"None",
")",
":",
"query",
"=",
"query_mod",
".",
"Query",
"(",
"self",
")",
"return",
"query",
".",
"stream",
"(",
"transaction",
"=",
"transaction",
")"
] | Read the documents in this collection.
This sends a ``RunQuery`` RPC and then returns an iterator which
consumes each document returned in the stream of ``RunQueryResponse``
messages.
.. note::
The underlying stream of responses will time out after
the ``max_rpc_... | [
"Read",
"the",
"documents",
"in",
"this",
"collection",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L394-L422 |
27,977 | googleapis/google-cloud-python | translate/google/cloud/translate_v2/client.py | Client.get_languages | def get_languages(self, target_language=None):
"""Get list of supported languages for translation.
Response
See
https://cloud.google.com/translate/docs/discovering-supported-languages
:type target_language: str
:param target_language: (Optional) The language used to lo... | python | def get_languages(self, target_language=None):
"""Get list of supported languages for translation.
Response
See
https://cloud.google.com/translate/docs/discovering-supported-languages
:type target_language: str
:param target_language: (Optional) The language used to lo... | [
"def",
"get_languages",
"(",
"self",
",",
"target_language",
"=",
"None",
")",
":",
"query_params",
"=",
"{",
"}",
"if",
"target_language",
"is",
"None",
":",
"target_language",
"=",
"self",
".",
"target_language",
"if",
"target_language",
"is",
"not",
"None",... | Get list of supported languages for translation.
Response
See
https://cloud.google.com/translate/docs/discovering-supported-languages
:type target_language: str
:param target_language: (Optional) The language used to localize
returned language n... | [
"Get",
"list",
"of",
"supported",
"languages",
"for",
"translation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v2/client.py#L67-L95 |
27,978 | googleapis/google-cloud-python | translate/google/cloud/translate_v2/client.py | Client.detect_language | def detect_language(self, values):
"""Detect the language of a string or list of strings.
See https://cloud.google.com/translate/docs/detecting-language
:type values: str or list
:param values: String or list of strings that will have
language detected.
... | python | def detect_language(self, values):
"""Detect the language of a string or list of strings.
See https://cloud.google.com/translate/docs/detecting-language
:type values: str or list
:param values: String or list of strings that will have
language detected.
... | [
"def",
"detect_language",
"(",
"self",
",",
"values",
")",
":",
"single_value",
"=",
"False",
"if",
"isinstance",
"(",
"values",
",",
"six",
".",
"string_types",
")",
":",
"single_value",
"=",
"True",
"values",
"=",
"[",
"values",
"]",
"data",
"=",
"{",
... | Detect the language of a string or list of strings.
See https://cloud.google.com/translate/docs/detecting-language
:type values: str or list
:param values: String or list of strings that will have
language detected.
:rtype: dict or list
:returns: A list ... | [
"Detect",
"the",
"language",
"of",
"a",
"string",
"or",
"list",
"of",
"strings",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v2/client.py#L97-L163 |
27,979 | googleapis/google-cloud-python | translate/google/cloud/translate_v2/client.py | Client.translate | def translate(
self,
values,
target_language=None,
format_=None,
source_language=None,
customization_ids=(),
model=None,
):
"""Translate a string or list of strings.
See https://cloud.google.com/translate/docs/translating-text
:type v... | python | def translate(
self,
values,
target_language=None,
format_=None,
source_language=None,
customization_ids=(),
model=None,
):
"""Translate a string or list of strings.
See https://cloud.google.com/translate/docs/translating-text
:type v... | [
"def",
"translate",
"(",
"self",
",",
"values",
",",
"target_language",
"=",
"None",
",",
"format_",
"=",
"None",
",",
"source_language",
"=",
"None",
",",
"customization_ids",
"=",
"(",
")",
",",
"model",
"=",
"None",
",",
")",
":",
"single_value",
"=",... | Translate a string or list of strings.
See https://cloud.google.com/translate/docs/translating-text
:type values: str or list
:param values: String or list of strings to translate.
:type target_language: str
:param target_language: The language to translate results into. This
... | [
"Translate",
"a",
"string",
"or",
"list",
"of",
"strings",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v2/client.py#L165-L252 |
27,980 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py | Leaser.add | def add(self, items):
"""Add messages to be managed by the leaser."""
for item in items:
# Add the ack ID to the set of managed ack IDs, and increment
# the size counter.
if item.ack_id not in self._leased_messages:
self._leased_messages[item.ack_id] =... | python | def add(self, items):
"""Add messages to be managed by the leaser."""
for item in items:
# Add the ack ID to the set of managed ack IDs, and increment
# the size counter.
if item.ack_id not in self._leased_messages:
self._leased_messages[item.ack_id] =... | [
"def",
"add",
"(",
"self",
",",
"items",
")",
":",
"for",
"item",
"in",
"items",
":",
"# Add the ack ID to the set of managed ack IDs, and increment",
"# the size counter.",
"if",
"item",
".",
"ack_id",
"not",
"in",
"self",
".",
"_leased_messages",
":",
"self",
".... | Add messages to be managed by the leaser. | [
"Add",
"messages",
"to",
"be",
"managed",
"by",
"the",
"leaser",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py#L65-L76 |
27,981 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py | Leaser.remove | def remove(self, items):
"""Remove messages from lease management."""
# Remove the ack ID from lease management, and decrement the
# byte counter.
for item in items:
if self._leased_messages.pop(item.ack_id, None) is not None:
self._bytes -= item.byte_size
... | python | def remove(self, items):
"""Remove messages from lease management."""
# Remove the ack ID from lease management, and decrement the
# byte counter.
for item in items:
if self._leased_messages.pop(item.ack_id, None) is not None:
self._bytes -= item.byte_size
... | [
"def",
"remove",
"(",
"self",
",",
"items",
")",
":",
"# Remove the ack ID from lease management, and decrement the",
"# byte counter.",
"for",
"item",
"in",
"items",
":",
"if",
"self",
".",
"_leased_messages",
".",
"pop",
"(",
"item",
".",
"ack_id",
",",
"None",
... | Remove messages from lease management. | [
"Remove",
"messages",
"from",
"lease",
"management",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py#L78-L90 |
27,982 | googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py | Leaser.maintain_leases | def maintain_leases(self):
"""Maintain all of the leases being managed.
This method modifies the ack deadline for all of the managed
ack IDs, then waits for most of that time (but with jitter), and
repeats.
"""
while self._manager.is_active and not self._stop_event.is_se... | python | def maintain_leases(self):
"""Maintain all of the leases being managed.
This method modifies the ack deadline for all of the managed
ack IDs, then waits for most of that time (but with jitter), and
repeats.
"""
while self._manager.is_active and not self._stop_event.is_se... | [
"def",
"maintain_leases",
"(",
"self",
")",
":",
"while",
"self",
".",
"_manager",
".",
"is_active",
"and",
"not",
"self",
".",
"_stop_event",
".",
"is_set",
"(",
")",
":",
"# Determine the appropriate duration for the lease. This is",
"# based off of how long previous ... | Maintain all of the leases being managed.
This method modifies the ack deadline for all of the managed
ack IDs, then waits for most of that time (but with jitter), and
repeats. | [
"Maintain",
"all",
"of",
"the",
"leases",
"being",
"managed",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py#L92-L159 |
27,983 | googleapis/google-cloud-python | error_reporting/google/cloud/error_reporting/_gapic.py | make_report_error_api | def make_report_error_api(client):
"""Create an instance of the gapic Logging API.
:type client::class:`google.cloud.error_reporting.Client`
:param client: Error Reporting client.
:rtype: :class:_ErrorReportingGapicApi
:returns: An Error Reporting API instance.
"""
gax_client = report_erro... | python | def make_report_error_api(client):
"""Create an instance of the gapic Logging API.
:type client::class:`google.cloud.error_reporting.Client`
:param client: Error Reporting client.
:rtype: :class:_ErrorReportingGapicApi
:returns: An Error Reporting API instance.
"""
gax_client = report_erro... | [
"def",
"make_report_error_api",
"(",
"client",
")",
":",
"gax_client",
"=",
"report_errors_service_client",
".",
"ReportErrorsServiceClient",
"(",
"credentials",
"=",
"client",
".",
"_credentials",
",",
"client_info",
"=",
"_CLIENT_INFO",
")",
"return",
"_ErrorReporting... | Create an instance of the gapic Logging API.
:type client::class:`google.cloud.error_reporting.Client`
:param client: Error Reporting client.
:rtype: :class:_ErrorReportingGapicApi
:returns: An Error Reporting API instance. | [
"Create",
"an",
"instance",
"of",
"the",
"gapic",
"Logging",
"API",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/error_reporting/_gapic.py#L27-L39 |
27,984 | googleapis/google-cloud-python | error_reporting/google/cloud/error_reporting/_gapic.py | _ErrorReportingGapicApi.report_error_event | def report_error_event(self, error_report):
"""Uses the gapic client to report the error.
:type error_report: dict
:param error_report:
payload of the error report formatted according to
https://cloud.google.com/error-reporting/docs/formatting-error-messages
... | python | def report_error_event(self, error_report):
"""Uses the gapic client to report the error.
:type error_report: dict
:param error_report:
payload of the error report formatted according to
https://cloud.google.com/error-reporting/docs/formatting-error-messages
... | [
"def",
"report_error_event",
"(",
"self",
",",
"error_report",
")",
":",
"project_name",
"=",
"self",
".",
"_gapic_api",
".",
"project_path",
"(",
"self",
".",
"_project",
")",
"error_report_payload",
"=",
"report_errors_service_pb2",
".",
"ReportedErrorEvent",
"(",... | Uses the gapic client to report the error.
:type error_report: dict
:param error_report:
payload of the error report formatted according to
https://cloud.google.com/error-reporting/docs/formatting-error-messages
This object should be built using
Use
... | [
"Uses",
"the",
"gapic",
"client",
"to",
"report",
"the",
"error",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/error_reporting/_gapic.py#L57-L71 |
27,985 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py | BigtableClient.table_path | def table_path(cls, project, instance, table):
"""Return a fully-qualified table string."""
return google.api_core.path_template.expand(
"projects/{project}/instances/{instance}/tables/{table}",
project=project,
instance=instance,
table=table,
) | python | def table_path(cls, project, instance, table):
"""Return a fully-qualified table string."""
return google.api_core.path_template.expand(
"projects/{project}/instances/{instance}/tables/{table}",
project=project,
instance=instance,
table=table,
) | [
"def",
"table_path",
"(",
"cls",
",",
"project",
",",
"instance",
",",
"table",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/instances/{instance}/tables/{table}\"",
",",
"project",
"=",
"project",
"... | Return a fully-qualified table string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"table",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py#L70-L77 |
27,986 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py | BigtableClient.read_rows | def read_rows(
self,
table_name,
app_profile_id=None,
rows=None,
filter_=None,
rows_limit=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Streams back t... | python | def read_rows(
self,
table_name,
app_profile_id=None,
rows=None,
filter_=None,
rows_limit=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Streams back t... | [
"def",
"read_rows",
"(",
"self",
",",
"table_name",
",",
"app_profile_id",
"=",
"None",
",",
"rows",
"=",
"None",
",",
"filter_",
"=",
"None",
",",
"rows_limit",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
... | Streams back the contents of all requested rows in key order, optionally
applying the same Reader filter to each. Depending on their size,
rows and cells may be broken up across multiple responses, but
atomicity of each row will still be preserved. See the
ReadRowsResponse documentation ... | [
"Streams",
"back",
"the",
"contents",
"of",
"all",
"requested",
"rows",
"in",
"key",
"order",
"optionally",
"applying",
"the",
"same",
"Reader",
"filter",
"to",
"each",
".",
"Depending",
"on",
"their",
"size",
"rows",
"and",
"cells",
"may",
"be",
"broken",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py#L178-L275 |
27,987 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py | BigtableClient.mutate_rows | def mutate_rows(
self,
table_name,
entries,
app_profile_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Mutates multiple rows in a batch. Each individual row is muta... | python | def mutate_rows(
self,
table_name,
entries,
app_profile_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Mutates multiple rows in a batch. Each individual row is muta... | [
"def",
"mutate_rows",
"(",
"self",
",",
"table_name",
",",
"entries",
",",
"app_profile_id",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"... | Mutates multiple rows in a batch. Each individual row is mutated
atomically as in MutateRow, but the entire batch is not executed
atomically.
Example:
>>> from google.cloud import bigtable_v2
>>>
>>> client = bigtable_v2.BigtableClient()
>>>
... | [
"Mutates",
"multiple",
"rows",
"in",
"a",
"batch",
".",
"Each",
"individual",
"row",
"is",
"mutated",
"atomically",
"as",
"in",
"MutateRow",
"but",
"the",
"entire",
"batch",
"is",
"not",
"executed",
"atomically",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py#L452-L540 |
27,988 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py | BigtableClient.check_and_mutate_row | def check_and_mutate_row(
self,
table_name,
row_key,
app_profile_id=None,
predicate_filter=None,
true_mutations=None,
false_mutations=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
meta... | python | def check_and_mutate_row(
self,
table_name,
row_key,
app_profile_id=None,
predicate_filter=None,
true_mutations=None,
false_mutations=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
meta... | [
"def",
"check_and_mutate_row",
"(",
"self",
",",
"table_name",
",",
"row_key",
",",
"app_profile_id",
"=",
"None",
",",
"predicate_filter",
"=",
"None",
",",
"true_mutations",
"=",
"None",
",",
"false_mutations",
"=",
"None",
",",
"retry",
"=",
"google",
".",
... | Mutates a row atomically based on the output of a predicate Reader filter.
Example:
>>> from google.cloud import bigtable_v2
>>>
>>> client = bigtable_v2.BigtableClient()
>>>
>>> table_name = client.table_path('[PROJECT]', '[INSTANCE]', '[TABLE]')
... | [
"Mutates",
"a",
"row",
"atomically",
"based",
"on",
"the",
"output",
"of",
"a",
"predicate",
"Reader",
"filter",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py#L542-L652 |
27,989 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable/instance.py | Instance.name | def name(self):
"""Instance name used in requests.
.. note::
This property will not change if ``instance_id`` does not,
but the return value is not cached.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_instance_name]
... | python | def name(self):
"""Instance name used in requests.
.. note::
This property will not change if ``instance_id`` does not,
but the return value is not cached.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_instance_name]
... | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_client",
".",
"instance_admin_client",
".",
"instance_path",
"(",
"project",
"=",
"self",
".",
"_client",
".",
"project",
",",
"instance",
"=",
"self",
".",
"instance_id",
")"
] | Instance name used in requests.
.. note::
This property will not change if ``instance_id`` does not,
but the return value is not cached.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_instance_name]
:end-before: [END bigt... | [
"Instance",
"name",
"used",
"in",
"requests",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/instance.py#L170-L192 |
27,990 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable/instance.py | Instance.exists | def exists(self):
"""Check whether the instance already exists.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_check_instance_exists]
:end-before: [END bigtable_check_instance_exists]
:rtype: bool
:returns: True if the table ... | python | def exists(self):
"""Check whether the instance already exists.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_check_instance_exists]
:end-before: [END bigtable_check_instance_exists]
:rtype: bool
:returns: True if the table ... | [
"def",
"exists",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_client",
".",
"instance_admin_client",
".",
"get_instance",
"(",
"name",
"=",
"self",
".",
"name",
")",
"return",
"True",
"# NOTE: There could be other exceptions that are returned to the user.",
"ex... | Check whether the instance already exists.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_check_instance_exists]
:end-before: [END bigtable_check_instance_exists]
:rtype: bool
:returns: True if the table exists, else False. | [
"Check",
"whether",
"the",
"instance",
"already",
"exists",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/instance.py#L327-L344 |
27,991 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable/instance.py | Instance.get_iam_policy | def get_iam_policy(self):
"""Gets the access control policy for an instance resource.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_get_iam_policy]
:end-before: [END bigtable_get_iam_policy]
:rtype: :class:`google.cloud.bigtable.pol... | python | def get_iam_policy(self):
"""Gets the access control policy for an instance resource.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_get_iam_policy]
:end-before: [END bigtable_get_iam_policy]
:rtype: :class:`google.cloud.bigtable.pol... | [
"def",
"get_iam_policy",
"(",
"self",
")",
":",
"instance_admin_client",
"=",
"self",
".",
"_client",
".",
"instance_admin_client",
"resp",
"=",
"instance_admin_client",
".",
"get_iam_policy",
"(",
"resource",
"=",
"self",
".",
"name",
")",
"return",
"Policy",
"... | Gets the access control policy for an instance resource.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_get_iam_policy]
:end-before: [END bigtable_get_iam_policy]
:rtype: :class:`google.cloud.bigtable.policy.Policy`
:returns: The cur... | [
"Gets",
"the",
"access",
"control",
"policy",
"for",
"an",
"instance",
"resource",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/instance.py#L437-L451 |
27,992 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable/instance.py | Instance.set_iam_policy | def set_iam_policy(self, policy):
"""Sets the access control policy on an instance resource. Replaces any
existing policy.
For more information about policy, please see documentation of
class `google.cloud.bigtable.policy.Policy`
For example:
.. literalinclude:: snippe... | python | def set_iam_policy(self, policy):
"""Sets the access control policy on an instance resource. Replaces any
existing policy.
For more information about policy, please see documentation of
class `google.cloud.bigtable.policy.Policy`
For example:
.. literalinclude:: snippe... | [
"def",
"set_iam_policy",
"(",
"self",
",",
"policy",
")",
":",
"instance_admin_client",
"=",
"self",
".",
"_client",
".",
"instance_admin_client",
"resp",
"=",
"instance_admin_client",
".",
"set_iam_policy",
"(",
"resource",
"=",
"self",
".",
"name",
",",
"polic... | Sets the access control policy on an instance resource. Replaces any
existing policy.
For more information about policy, please see documentation of
class `google.cloud.bigtable.policy.Policy`
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtab... | [
"Sets",
"the",
"access",
"control",
"policy",
"on",
"an",
"instance",
"resource",
".",
"Replaces",
"any",
"existing",
"policy",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/instance.py#L453-L477 |
27,993 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable/instance.py | Instance.cluster | def cluster(
self, cluster_id, location_id=None, serve_nodes=None, default_storage_type=None
):
"""Factory to create a cluster associated with this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_cluster]
:end-befo... | python | def cluster(
self, cluster_id, location_id=None, serve_nodes=None, default_storage_type=None
):
"""Factory to create a cluster associated with this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_cluster]
:end-befo... | [
"def",
"cluster",
"(",
"self",
",",
"cluster_id",
",",
"location_id",
"=",
"None",
",",
"serve_nodes",
"=",
"None",
",",
"default_storage_type",
"=",
"None",
")",
":",
"return",
"Cluster",
"(",
"cluster_id",
",",
"self",
",",
"location_id",
"=",
"location_id... | Factory to create a cluster associated with this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_cluster]
:end-before: [END bigtable_create_cluster]
:type cluster_id: str
:param cluster_id: The ID of the cluster.
... | [
"Factory",
"to",
"create",
"a",
"cluster",
"associated",
"with",
"this",
"instance",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/instance.py#L507-L553 |
27,994 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable/instance.py | Instance.list_clusters | def list_clusters(self):
"""List the clusters in this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_clusters_on_instance]
:end-before: [END bigtable_list_clusters_on_instance]
:rtype: tuple
:returns:
... | python | def list_clusters(self):
"""List the clusters in this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_clusters_on_instance]
:end-before: [END bigtable_list_clusters_on_instance]
:rtype: tuple
:returns:
... | [
"def",
"list_clusters",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"_client",
".",
"instance_admin_client",
".",
"list_clusters",
"(",
"self",
".",
"name",
")",
"clusters",
"=",
"[",
"Cluster",
".",
"from_pb",
"(",
"cluster",
",",
"self",
")",
"for... | List the clusters in this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_clusters_on_instance]
:end-before: [END bigtable_list_clusters_on_instance]
:rtype: tuple
:returns:
(clusters, failed_locations), whe... | [
"List",
"the",
"clusters",
"in",
"this",
"instance",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/instance.py#L555-L573 |
27,995 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable/instance.py | Instance.table | def table(self, table_id, mutation_timeout=None, app_profile_id=None):
"""Factory to create a table associated with this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_table]
:end-before: [END bigtable_create_table]
... | python | def table(self, table_id, mutation_timeout=None, app_profile_id=None):
"""Factory to create a table associated with this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_table]
:end-before: [END bigtable_create_table]
... | [
"def",
"table",
"(",
"self",
",",
"table_id",
",",
"mutation_timeout",
"=",
"None",
",",
"app_profile_id",
"=",
"None",
")",
":",
"return",
"Table",
"(",
"table_id",
",",
"self",
",",
"app_profile_id",
"=",
"app_profile_id",
",",
"mutation_timeout",
"=",
"mu... | Factory to create a table associated with this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_table]
:end-before: [END bigtable_create_table]
:type table_id: str
:param table_id: The ID of the table.
:type a... | [
"Factory",
"to",
"create",
"a",
"table",
"associated",
"with",
"this",
"instance",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/instance.py#L575-L598 |
27,996 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable/instance.py | Instance.list_tables | def list_tables(self):
"""List the tables in this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_tables]
:end-before: [END bigtable_list_tables]
:rtype: list of :class:`Table <google.cloud.bigtable.table.Table>`
... | python | def list_tables(self):
"""List the tables in this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_tables]
:end-before: [END bigtable_list_tables]
:rtype: list of :class:`Table <google.cloud.bigtable.table.Table>`
... | [
"def",
"list_tables",
"(",
"self",
")",
":",
"table_list_pb",
"=",
"self",
".",
"_client",
".",
"table_admin_client",
".",
"list_tables",
"(",
"self",
".",
"name",
")",
"result",
"=",
"[",
"]",
"for",
"table_pb",
"in",
"table_list_pb",
":",
"table_prefix",
... | List the tables in this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_tables]
:end-before: [END bigtable_list_tables]
:rtype: list of :class:`Table <google.cloud.bigtable.table.Table>`
:returns: The list of tables own... | [
"List",
"the",
"tables",
"in",
"this",
"instance",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/instance.py#L600-L626 |
27,997 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable/instance.py | Instance.app_profile | def app_profile(
self,
app_profile_id,
routing_policy_type=None,
description=None,
cluster_id=None,
allow_transactional_writes=None,
):
"""Factory to create AppProfile associated with this instance.
For example:
.. literalinclude:: snippets.p... | python | def app_profile(
self,
app_profile_id,
routing_policy_type=None,
description=None,
cluster_id=None,
allow_transactional_writes=None,
):
"""Factory to create AppProfile associated with this instance.
For example:
.. literalinclude:: snippets.p... | [
"def",
"app_profile",
"(",
"self",
",",
"app_profile_id",
",",
"routing_policy_type",
"=",
"None",
",",
"description",
"=",
"None",
",",
"cluster_id",
"=",
"None",
",",
"allow_transactional_writes",
"=",
"None",
",",
")",
":",
"return",
"AppProfile",
"(",
"app... | Factory to create AppProfile associated with this instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_app_profile]
:end-before: [END bigtable_create_app_profile]
:type app_profile_id: str
:param app_profile_id: The ID of ... | [
"Factory",
"to",
"create",
"AppProfile",
"associated",
"with",
"this",
"instance",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/instance.py#L628-L679 |
27,998 | googleapis/google-cloud-python | bigtable/google/cloud/bigtable/instance.py | Instance.list_app_profiles | def list_app_profiles(self):
"""Lists information about AppProfiles in an instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_app_profiles]
:end-before: [END bigtable_list_app_profiles]
:rtype: :list:[`~google.cloud.bigtabl... | python | def list_app_profiles(self):
"""Lists information about AppProfiles in an instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_app_profiles]
:end-before: [END bigtable_list_app_profiles]
:rtype: :list:[`~google.cloud.bigtabl... | [
"def",
"list_app_profiles",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"_client",
".",
"instance_admin_client",
".",
"list_app_profiles",
"(",
"self",
".",
"name",
")",
"return",
"[",
"AppProfile",
".",
"from_pb",
"(",
"app_profile",
",",
"self",
")",
... | Lists information about AppProfiles in an instance.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_app_profiles]
:end-before: [END bigtable_list_app_profiles]
:rtype: :list:[`~google.cloud.bigtable.app_profile.AppProfile`]
:retu... | [
"Lists",
"information",
"about",
"AppProfiles",
"in",
"an",
"instance",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/instance.py#L681-L697 |
27,999 | googleapis/google-cloud-python | bigquery/google/cloud/bigquery/table.py | _row_from_mapping | def _row_from_mapping(mapping, schema):
"""Convert a mapping to a row tuple using the schema.
Args:
mapping (Dict[str, object])
Mapping of row data: must contain keys for all required fields in
the schema. Keys which do not correspond to a field in the schema
are ign... | python | def _row_from_mapping(mapping, schema):
"""Convert a mapping to a row tuple using the schema.
Args:
mapping (Dict[str, object])
Mapping of row data: must contain keys for all required fields in
the schema. Keys which do not correspond to a field in the schema
are ign... | [
"def",
"_row_from_mapping",
"(",
"mapping",
",",
"schema",
")",
":",
"if",
"len",
"(",
"schema",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"_TABLE_HAS_NO_SCHEMA",
")",
"row",
"=",
"[",
"]",
"for",
"field",
"in",
"schema",
":",
"if",
"field",
"."... | Convert a mapping to a row tuple using the schema.
Args:
mapping (Dict[str, object])
Mapping of row data: must contain keys for all required fields in
the schema. Keys which do not correspond to a field in the schema
are ignored.
schema (List[google.cloud.bigquer... | [
"Convert",
"a",
"mapping",
"to",
"a",
"row",
"tuple",
"using",
"the",
"schema",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L1105-L1136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.