partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
ClusterControllerClient.get_cluster
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 = '' ...
dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py
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.method.DEFAULT, metadata=None, ): """ Gets the resource representation for a cluster in a project. ...
[ "Gets", "the", "resource", "representation", "for", "a", "cluster", "in", "a", "project", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py#L750-L818
[ "def", "get_cluster", "(", "self", ",", "project_id", ",", "region", ",", "cluster_name", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ClusterControllerClient.list_clusters
Lists all regions/{region}/clusters in a project. Example: >>> from google.cloud import dataproc_v1beta2 >>> >>> client = dataproc_v1beta2.ClusterControllerClient() >>> >>> # TODO: Initialize `project_id`: >>> project_id = '' >...
dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py
def list_clusters( self, project_id, region, filter_=None, page_size=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Lists all regions/{region}/clusters in a pr...
def list_clusters( self, project_id, region, filter_=None, page_size=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Lists all regions/{region}/clusters in a pr...
[ "Lists", "all", "regions", "/", "{", "region", "}", "/", "clusters", "in", "a", "project", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py#L820-L936
[ "def", "list_clusters", "(", "self", ",", "project_id", ",", "region", ",", "filter_", "=", "None", ",", "page_size", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ClusterControllerClient.diagnose_cluster
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() ...
dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py
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.method.DEFAULT, metadata=None, ): """ Gets cluster diagnostic information. After the operation complet...
[ "Gets", "cluster", "diagnostic", "information", ".", "After", "the", "operation", "completes", "the", "Operation", ".", "response", "field", "contains", "DiagnoseClusterOutputLocation", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dataproc/google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py#L938-L1022
[ "def", "diagnose_cluster", "(", "self", ",", "project_id", ",", "region", ",", "cluster_name", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", "....
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Batch.commit
Actually publish all of the messages on the active batch. .. note:: This method is non-blocking. It opens a new thread, which calls :meth:`_commit`, which does block. This synchronously sets the batch status to "starting", and then opens a new thread, which handles act...
pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py
def commit(self): """Actually publish all of the messages on the active batch. .. note:: This method is non-blocking. It opens a new thread, which calls :meth:`_commit`, which does block. This synchronously sets the batch status to "starting", and then opens a ...
def commit(self): """Actually publish all of the messages on the active batch. .. note:: This method is non-blocking. It opens a new thread, which calls :meth:`_commit`, which does block. This synchronously sets the batch status to "starting", and then opens a ...
[ "Actually", "publish", "all", "of", "the", "messages", "on", "the", "active", "batch", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py#L140-L166
[ "def", "commit", "(", "self", ")", ":", "# Set the status to \"starting\" synchronously, to ensure that", "# this batch will necessarily not accept new messages.", "with", "self", ".", "_state_lock", ":", "if", "self", ".", "_status", "==", "base", ".", "BatchStatus", ".", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Batch._commit
Actually publish all of the messages on the active batch. This moves the batch out from being the active batch to an in progress batch on the publisher, and then the batch is discarded upon completion. .. note:: This method blocks. The :meth:`commit` method is the non-bloc...
pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py
def _commit(self): """Actually publish all of the messages on the active batch. This moves the batch out from being the active batch to an in progress batch on the publisher, and then the batch is discarded upon completion. .. note:: This method blocks. The :meth:`...
def _commit(self): """Actually publish all of the messages on the active batch. This moves the batch out from being the active batch to an in progress batch on the publisher, and then the batch is discarded upon completion. .. note:: This method blocks. The :meth:`...
[ "Actually", "publish", "all", "of", "the", "messages", "on", "the", "active", "batch", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py#L168-L239
[ "def", "_commit", "(", "self", ")", ":", "with", "self", ".", "_state_lock", ":", "if", "self", ".", "_status", "in", "_CAN_COMMIT", ":", "self", ".", "_status", "=", "base", ".", "BatchStatus", ".", "IN_PROGRESS", "else", ":", "# If, in the intervening peri...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Batch.monitor
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.
pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py
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): """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 #...
[ "Commit", "this", "batch", "after", "sufficient", "time", "has", "elapsed", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py#L241-L254
[ "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", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Batch.publish
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...
pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py
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): """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`. ...
[ "Publish", "a", "single", "message", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py#L256-L307
[ "def", "publish", "(", "self", ",", "message", ")", ":", "# Coerce the type, just in case.", "if", "not", "isinstance", "(", "message", ",", "types", ".", "PubsubMessage", ")", ":", "message", "=", "types", ".", "PubsubMessage", "(", "*", "*", "message", ")"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Changes.from_api_repr
Factory: construct a change set given its API representation :type resource: dict :param resource: change set representation returned from the API. :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds zero or more change sets. :rtype: :class:...
dns/google/cloud/dns/changes.py
def from_api_repr(cls, resource, zone): """Factory: construct a change set given its API representation :type resource: dict :param resource: change set representation returned from the API. :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds...
def from_api_repr(cls, resource, zone): """Factory: construct a change set given its API representation :type resource: dict :param resource: change set representation returned from the API. :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds...
[ "Factory", ":", "construct", "a", "change", "set", "given", "its", "API", "representation" ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L42-L56
[ "def", "from_api_repr", "(", "cls", ",", "resource", ",", "zone", ")", ":", "changes", "=", "cls", "(", "zone", "=", "zone", ")", "changes", ".", "_set_properties", "(", "resource", ")", "return", "changes" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Changes._set_properties
Helper method for :meth:`from_api_repr`, :meth:`create`, etc. :type resource: dict :param resource: change set representation returned from the API.
dns/google/cloud/dns/changes.py
def _set_properties(self, resource): """Helper method for :meth:`from_api_repr`, :meth:`create`, etc. :type resource: dict :param resource: change set representation returned from the API. """ resource = resource.copy() self._additions = tuple( [ ...
def _set_properties(self, resource): """Helper method for :meth:`from_api_repr`, :meth:`create`, etc. :type resource: dict :param resource: change set representation returned from the API. """ resource = resource.copy() self._additions = tuple( [ ...
[ "Helper", "method", "for", ":", "meth", ":", "from_api_repr", ":", "meth", ":", "create", "etc", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L58-L77
[ "def", "_set_properties", "(", "self", ",", "resource", ")", ":", "resource", "=", "resource", ".", "copy", "(", ")", "self", ".", "_additions", "=", "tuple", "(", "[", "ResourceRecordSet", ".", "from_api_repr", "(", "added_res", ",", "self", ".", "zone", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Changes.path
URL path for change set APIs. :rtype: str :returns: the path based on project, zone, and change set names.
dns/google/cloud/dns/changes.py
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): """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, )
[ "URL", "path", "for", "change", "set", "APIs", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L80-L90
[ "def", "path", "(", "self", ")", ":", "return", "\"/projects/%s/managedZones/%s/changes/%s\"", "%", "(", "self", ".", "zone", ".", "project", ",", "self", ".", "zone", ".", "name", ",", "self", ".", "name", ",", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Changes.name
Update name of the change set. :type value: str :param value: New name for the changeset.
dns/google/cloud/dns/changes.py
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): """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
[ "Update", "name", "of", "the", "change", "set", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L102-L110
[ "def", "name", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "raise", "ValueError", "(", "\"Pass a string\"", ")", "self", ".", "_properties", "[", "\"id\"", "]", "=", "value" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Changes.add_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 not of the required type.
dns/google/cloud/dns/changes.py
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): """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...
[ "Append", "a", "record", "set", "to", "the", "additions", "for", "the", "change", "set", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L152-L163
[ "def", "add_record_set", "(", "self", ",", "record_set", ")", ":", "if", "not", "isinstance", "(", "record_set", ",", "ResourceRecordSet", ")", ":", "raise", "ValueError", "(", "\"Pass a ResourceRecordSet\"", ")", "self", ".", "_additions", "+=", "(", "record_se...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Changes.delete_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 not of the required type.
dns/google/cloud/dns/changes.py
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): """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...
[ "Append", "a", "record", "set", "to", "the", "deletions", "for", "the", "change", "set", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L165-L176
[ "def", "delete_record_set", "(", "self", ",", "record_set", ")", ":", "if", "not", "isinstance", "(", "record_set", ",", "ResourceRecordSet", ")", ":", "raise", "ValueError", "(", "\"Pass a ResourceRecordSet\"", ")", "self", ".", "_deletions", "+=", "(", "record...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Changes._build_resource
Generate a resource for ``create``.
dns/google/cloud/dns/changes.py
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): """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...
[ "Generate", "a", "resource", "for", "create", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L193-L215
[ "def", "_build_resource", "(", "self", ")", ":", "additions", "=", "[", "{", "\"name\"", ":", "added", ".", "name", ",", "\"type\"", ":", "added", ".", "record_type", ",", "\"ttl\"", ":", "str", "(", "added", ".", "ttl", ")", ",", "\"rrdatas\"", ":", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Changes.create
API call: create the change set via a POST request. See https://cloud.google.com/dns/api/v1/changes/create :type client: :class:`google.cloud.dns.client.Client` :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on ...
dns/google/cloud/dns/changes.py
def create(self, client=None): """API call: create the change set via a POST request. See https://cloud.google.com/dns/api/v1/changes/create :type client: :class:`google.cloud.dns.client.Client` :param client: (Optional) the client to use. If not passed, falls bac...
def create(self, client=None): """API call: create the change set via a POST request. See https://cloud.google.com/dns/api/v1/changes/create :type client: :class:`google.cloud.dns.client.Client` :param client: (Optional) the client to use. If not passed, falls bac...
[ "API", "call", ":", "create", "the", "change", "set", "via", "a", "POST", "request", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L217-L238
[ "def", "create", "(", "self", ",", "client", "=", "None", ")", ":", "if", "len", "(", "self", ".", "additions", ")", "==", "0", "and", "len", "(", "self", ".", "deletions", ")", "==", "0", ":", "raise", "ValueError", "(", "\"No record sets added or del...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.logging_api
Helper for logging-related API calls. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs
logging/google/cloud/logging/client.py
def logging_api(self): """Helper for logging-related API calls. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs """ if self._logging_api is None: if self._use_grpc...
def logging_api(self): """Helper for logging-related API calls. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs """ if self._logging_api is None: if self._use_grpc...
[ "Helper", "for", "logging", "-", "related", "API", "calls", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L114-L126
[ "def", "logging_api", "(", "self", ")", ":", "if", "self", ".", "_logging_api", "is", "None", ":", "if", "self", ".", "_use_grpc", ":", "self", ".", "_logging_api", "=", "_gapic", ".", "make_logging_api", "(", "self", ")", "else", ":", "self", ".", "_l...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.sinks_api
Helper for log sink-related API calls. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks
logging/google/cloud/logging/client.py
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): """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...
[ "Helper", "for", "log", "sink", "-", "related", "API", "calls", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L129-L140
[ "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...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.metrics_api
Helper for log metric-related API calls. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics
logging/google/cloud/logging/client.py
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): """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) ...
[ "Helper", "for", "log", "metric", "-", "related", "API", "calls", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L143-L154
[ "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...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.list_entries
Return a page of log entries. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list :type projects: list of strings :param projects: project IDs to include. If not passed, defaults to the project bound to the client. :type filt...
logging/google/cloud/logging/client.py
def list_entries( self, projects=None, filter_=None, order_by=None, page_size=None, page_token=None, ): """Return a page of log entries. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list :type projects: list ...
def list_entries( self, projects=None, filter_=None, order_by=None, page_size=None, page_token=None, ): """Return a page of log entries. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list :type projects: list ...
[ "Return", "a", "page", "of", "log", "entries", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L167-L220
[ "def", "list_entries", "(", "self", ",", "projects", "=", "None", ",", "filter_", "=", "None", ",", "order_by", "=", "None", ",", "page_size", "=", "None", ",", "page_token", "=", "None", ",", ")", ":", "if", "projects", "is", "None", ":", "projects", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.sink
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 ...
logging/google/cloud/logging/client.py
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): """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...
[ "Creates", "a", "sink", "bound", "to", "the", "current", "client", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L222-L243
[ "def", "sink", "(", "self", ",", "name", ",", "filter_", "=", "None", ",", "destination", "=", "None", ")", ":", "return", "Sink", "(", "name", ",", "filter_", ",", "destination", ",", "client", "=", "self", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.list_sinks
List sinks for the project associated with this client. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/list :type page_size: int :param page_size: Optional. The maximum number of sinks in each page of results from this request. Non...
logging/google/cloud/logging/client.py
def list_sinks(self, page_size=None, page_token=None): """List sinks for the project associated with this client. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/list :type page_size: int :param page_size: Optional. The maximum number o...
def list_sinks(self, page_size=None, page_token=None): """List sinks for the project associated with this client. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/list :type page_size: int :param page_size: Optional. The maximum number o...
[ "List", "sinks", "for", "the", "project", "associated", "with", "this", "client", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L245-L270
[ "def", "list_sinks", "(", "self", ",", "page_size", "=", "None", ",", "page_token", "=", "None", ")", ":", "return", "self", ".", "sinks_api", ".", "list_sinks", "(", "self", ".", "project", ",", "page_size", ",", "page_token", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.metric
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 ...
logging/google/cloud/logging/client.py
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=""): """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 ...
[ "Creates", "a", "metric", "bound", "to", "the", "current", "client", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L272-L292
[ "def", "metric", "(", "self", ",", "name", ",", "filter_", "=", "None", ",", "description", "=", "\"\"", ")", ":", "return", "Metric", "(", "name", ",", "filter_", ",", "client", "=", "self", ",", "description", "=", "description", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.list_metrics
List metrics for the project associated with this client. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/list :type page_size: int :param page_size: Optional. The maximum number of metrics in each page of results from this reques...
logging/google/cloud/logging/client.py
def list_metrics(self, page_size=None, page_token=None): """List metrics for the project associated with this client. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/list :type page_size: int :param page_size: Optional. The maximum nu...
def list_metrics(self, page_size=None, page_token=None): """List metrics for the project associated with this client. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/list :type page_size: int :param page_size: Optional. The maximum nu...
[ "List", "metrics", "for", "the", "project", "associated", "with", "this", "client", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L294-L318
[ "def", "list_metrics", "(", "self", ",", "page_size", "=", "None", ",", "page_token", "=", "None", ")", ":", "return", "self", ".", "metrics_api", ".", "list_metrics", "(", "self", ".", "project", ",", "page_size", ",", "page_token", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.get_default_handler
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
logging/google/cloud/logging/client.py
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): """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", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L320-L339
[ "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", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.setup_logging
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...
logging/google/cloud/logging/client.py
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 ): """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...
[ "Attach", "default", "Stackdriver", "logging", "handler", "to", "the", "root", "logger", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/client.py#L341-L365
[ "def", "setup_logging", "(", "self", ",", "log_level", "=", "logging", ".", "INFO", ",", "excluded_loggers", "=", "EXCLUDED_LOGGER_DEFAULTS", ",", "*", "*", "kw", ")", ":", "handler", "=", "self", ".", "get_default_handler", "(", "*", "*", "kw", ")", "setu...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
KeyManagementServiceClient.key_ring_path
Return a fully-qualified key_ring string.
kms/google/cloud/kms_v1/gapic/key_management_service_client.py
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 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...
[ "Return", "a", "fully", "-", "qualified", "key_ring", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/kms/google/cloud/kms_v1/gapic/key_management_service_client.py#L88-L95
[ "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...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
KeyManagementServiceClient.crypto_key_path_path
Return a fully-qualified crypto_key_path string.
kms/google/cloud/kms_v1/gapic/key_management_service_client.py
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 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=...
[ "Return", "a", "fully", "-", "qualified", "crypto_key_path", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/kms/google/cloud/kms_v1/gapic/key_management_service_client.py#L98-L106
[ "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...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
KeyManagementServiceClient.crypto_key_version_path
Return a fully-qualified crypto_key_version string.
kms/google/cloud/kms_v1/gapic/key_management_service_client.py
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 a fully-qualified crypto_key_version string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_...
[ "Return", "a", "fully", "-", "qualified", "crypto_key_version", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/kms/google/cloud/kms_v1/gapic/key_management_service_client.py#L129-L140
[ "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...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
KeyManagementServiceClient.create_key_ring
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]') >>> >>...
kms/google/cloud/kms_v1/gapic/key_management_service_client.py
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.method.DEFAULT, metadata=None, ): """ Create a new ``KeyRing`` in a given Project and Location. E...
[ "Create", "a", "new", "KeyRing", "in", "a", "given", "Project", "and", "Location", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/kms/google/cloud/kms_v1/gapic/key_management_service_client.py#L763-L847
[ "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", ".", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
KeyManagementServiceClient.create_crypto_key
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...
kms/google/cloud/kms_v1/gapic/key_management_service_client.py
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.method.DEFAULT, metadata=None, ): """ Create a new ``CryptoKey`` within a ``KeyRing``. ``Cr...
[ "Create", "a", "new", "CryptoKey", "within", "a", "KeyRing", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/kms/google/cloud/kms_v1/gapic/key_management_service_client.py#L849-L938
[ "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", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TraceServiceClient.span_path
Return a fully-qualified span string.
trace/google/cloud/trace_v2/gapic/trace_service_client.py
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 a fully-qualified span string.""" return google.api_core.path_template.expand( "projects/{project}/traces/{trace}/spans/{span}", project=project, trace=trace, span=span, )
[ "Return", "a", "fully", "-", "qualified", "span", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/trace/google/cloud/trace_v2/gapic/trace_service_client.py#L88-L95
[ "def", "span_path", "(", "cls", ",", "project", ",", "trace", ",", "span", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/traces/{trace}/spans/{span}\"", ",", "project", "=", "project", ",", "trace"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TraceServiceClient.batch_write_spans
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]') >>> ...
trace/google/cloud/trace_v2/gapic/trace_service_client.py
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.DEFAULT, metadata=None, ): """ Sends new spans to new or existing traces. You cannot update existing spans. ...
[ "Sends", "new", "spans", "to", "new", "or", "existing", "traces", ".", "You", "cannot", "update", "existing", "spans", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/trace/google/cloud/trace_v2/gapic/trace_service_client.py#L196-L271
[ "def", "batch_write_spans", "(", "self", ",", "name", ",", "spans", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAUL...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TraceServiceClient.create_span
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`: ...
trace/google/cloud/trace_v2/gapic/trace_service_client.py
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, links=None, status=None, same_process_as_parent_span=None, c...
[ "Creates", "a", "new", "span", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/trace/google/cloud/trace_v2/gapic/trace_service_client.py#L273-L447
[ "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", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_wrap_callback_errors
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.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
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): """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:...
[ "Wraps", "a", "user", "callback", "so", "that", "if", "an", "exception", "occurs", "the", "message", "is", "nacked", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L55-L72
[ "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...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager.ack_deadline
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.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
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): """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: ...
[ "Return", "the", "current", "ack", "deadline", "based", "on", "historical", "time", "-", "to", "-", "ack", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L161-L174
[ "def", "ack_deadline", "(", "self", ")", ":", "target", "=", "min", "(", "[", "self", ".", "_last_histogram_size", "*", "2", ",", "self", ".", "_last_histogram_size", "+", "100", "]", ")", "if", "len", "(", "self", ".", "ack_histogram", ")", ">", "targ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager.load
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.) ...
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
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): """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...
[ "Return", "the", "current", "load", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L177-L201
[ "def", "load", "(", "self", ")", ":", "if", "self", ".", "_leaser", "is", "None", ":", "return", "0", "return", "max", "(", "[", "self", ".", "_leaser", ".", "message_count", "/", "self", ".", "_flow_control", ".", "max_messages", ",", "self", ".", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager.maybe_pause_consumer
Check the current load and pause the consumer if needed.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
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): """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...
[ "Check", "the", "current", "load", "and", "pause", "the", "consumer", "if", "needed", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L211-L216
[ "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...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager.maybe_resume_consumer
Check the current load and resume the consumer if needed.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
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): """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...
[ "Check", "the", "current", "load", "and", "resume", "the", "consumer", "if", "needed", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L218-L232
[ "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...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager._send_unary_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.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
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): """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...
[ "Send", "a", "request", "using", "a", "separate", "unary", "request", "instead", "of", "over", "the", "stream", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L234-L262
[ "def", "_send_unary_request", "(", "self", ",", "request", ")", ":", "if", "request", ".", "ack_ids", ":", "self", ".", "_client", ".", "acknowledge", "(", "subscription", "=", "self", ".", "_subscription", ",", "ack_ids", "=", "list", "(", "request", ".",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager.send
Queue a request to be sent to the RPC.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
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): """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 ...
[ "Queue", "a", "request", "to", "be", "sent", "to", "the", "RPC", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L264-L276
[ "def", "send", "(", "self", ",", "request", ")", ":", "if", "self", ".", "_UNARY_REQUESTS", ":", "try", ":", "self", ".", "_send_unary_request", "(", "request", ")", "except", "exceptions", ".", "GoogleAPICallError", ":", "_LOGGER", ".", "debug", "(", "\"E...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager.heartbeat
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.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
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): """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())
[ "Sends", "an", "empty", "request", "over", "the", "streaming", "pull", "RPC", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L278-L285
[ "def", "heartbeat", "(", "self", ")", ":", "if", "self", ".", "_rpc", "is", "not", "None", "and", "self", ".", "_rpc", ".", "is_active", ":", "self", ".", "_rpc", ".", "send", "(", "types", ".", "StreamingPullRequest", "(", ")", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager.open
Begin consuming messages. Args: callback (Callable[None, google.cloud.pubsub_v1.message.Messages]): A callback that will be called for each message received on the stream.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
def open(self, callback): """Begin consuming messages. Args: callback (Callable[None, google.cloud.pubsub_v1.message.Messages]): A callback that will be called for each message received on the stream. """ if self.is_active: raise V...
def open(self, callback): """Begin consuming messages. Args: callback (Callable[None, google.cloud.pubsub_v1.message.Messages]): A callback that will be called for each message received on the stream. """ if self.is_active: raise V...
[ "Begin", "consuming", "messages", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L287-L327
[ "def", "open", "(", "self", ",", "callback", ")", ":", "if", "self", ".", "is_active", ":", "raise", "ValueError", "(", "\"This manager is already open.\"", ")", "if", "self", ".", "_closed", ":", "raise", "ValueError", "(", "\"This manager has been closed and can...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager.close
Stop consuming messages and shutdown all helper threads. This method is idempotent. Additional calls will have no effect. Args: reason (Any): The reason to close this. If None, this is considered an "intentional" shutdown. This is passed to the callbacks spe...
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
def close(self, reason=None): """Stop consuming messages and shutdown all helper threads. This method is idempotent. Additional calls will have no effect. Args: reason (Any): The reason to close this. If None, this is considered an "intentional" shutdown. This is pa...
def close(self, reason=None): """Stop consuming messages and shutdown all helper threads. This method is idempotent. Additional calls will have no effect. Args: reason (Any): The reason to close this. If None, this is considered an "intentional" shutdown. This is pa...
[ "Stop", "consuming", "messages", "and", "shutdown", "all", "helper", "threads", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L329-L368
[ "def", "close", "(", "self", ",", "reason", "=", "None", ")", ":", "with", "self", ".", "_closing", ":", "if", "self", ".", "_closed", ":", "return", "# Stop consuming messages.", "if", "self", ".", "is_active", ":", "_LOGGER", ".", "debug", "(", "\"Stop...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager._get_initial_request
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...
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
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): """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...
[ "Return", "the", "initial", "request", "for", "the", "RPC", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L370-L399
[ "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", "#...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager._on_response
Process all received Pub/Sub messages. For each message, send a modified acknowledgment request to the server. This prevents expiration of the message due to buffering by gRPC or proxy/firewall. This makes the server and client expiration timer closer to each other thus preventing the m...
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
def _on_response(self, response): """Process all received Pub/Sub messages. For each message, send a modified acknowledgment request to the server. This prevents expiration of the message due to buffering by gRPC or proxy/firewall. This makes the server and client expiration tim...
def _on_response(self, response): """Process all received Pub/Sub messages. For each message, send a modified acknowledgment request to the server. This prevents expiration of the message due to buffering by gRPC or proxy/firewall. This makes the server and client expiration tim...
[ "Process", "all", "received", "Pub", "/", "Sub", "messages", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L401-L430
[ "def", "_on_response", "(", "self", ",", "response", ")", ":", "_LOGGER", ".", "debug", "(", "\"Scheduling callbacks for %s messages.\"", ",", "len", "(", "response", ".", "received_messages", ")", ")", "# Immediately modack the messages we received, as this tells the serve...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
StreamingPullManager._should_recover
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...
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py
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): """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...
[ "Determine", "if", "an", "error", "on", "the", "RPC", "stream", "should", "be", "recovered", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L432-L452
[ "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...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
WriteBatch.create
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...
firestore/google/cloud/firestore_v1beta1/batch.py
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): """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 ...
[ "Add", "a", "change", "to", "this", "batch", "to", "create", "a", "document", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L50-L63
[ "def", "create", "(", "self", ",", "reference", ",", "document_data", ")", ":", "write_pbs", "=", "_helpers", ".", "pbs_for_create", "(", "reference", ".", "_document_path", ",", "document_data", ")", "self", ".", "_add_write_pbs", "(", "write_pbs", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
WriteBatch.set
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...
firestore/google/cloud/firestore_v1beta1/batch.py
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): """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...
[ "Add", "a", "change", "to", "replace", "a", "document", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L65-L91
[ "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...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
WriteBatch.update
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...
firestore/google/cloud/firestore_v1beta1/batch.py
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): """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...
[ "Add", "a", "change", "to", "update", "a", "document", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L93-L114
[ "def", "update", "(", "self", ",", "reference", ",", "field_updates", ",", "option", "=", "None", ")", ":", "if", "option", ".", "__class__", ".", "__name__", "==", "\"ExistsOption\"", ":", "raise", "ValueError", "(", "\"you must not pass an explicit write option ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
WriteBatch.delete
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...
firestore/google/cloud/firestore_v1beta1/batch.py
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): """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...
[ "Add", "a", "change", "to", "delete", "a", "document", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L116-L132
[ "def", "delete", "(", "self", ",", "reference", ",", "option", "=", "None", ")", ":", "write_pb", "=", "_helpers", ".", "pb_for_delete", "(", "reference", ".", "_document_path", ",", "option", ")", "self", ".", "_add_write_pbs", "(", "[", "write_pb", "]", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
WriteBatch.commit
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...
firestore/google/cloud/firestore_v1beta1/batch.py
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 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...
[ "Commit", "the", "changes", "accumulated", "in", "this", "batch", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L134-L154
[ "def", "commit", "(", "self", ")", ":", "commit_response", "=", "self", ".", "_client", ".", "_firestore_api", ".", "commit", "(", "self", ".", "_client", ".", "_database_string", ",", "self", ".", "_write_pbs", ",", "transaction", "=", "None", ",", "metad...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_ensure_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: sequence of str :param tuple_or_list: Sequence to be verified...
core/google/cloud/_helpers.py
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): """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...
[ "Ensures", "an", "input", "is", "a", "tuple", "or", "list", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L149-L170
[ "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\"", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_microseconds_from_datetime
Convert non-none datetime to microseconds. :type value: :class:`datetime.datetime` :param value: The timestamp to convert. :rtype: int :returns: The timestamp, in microseconds.
core/google/cloud/_helpers.py
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): """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) ...
[ "Convert", "non", "-", "none", "datetime", "to", "microseconds", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L215-L229
[ "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",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_time_from_iso8601_time_naive
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.
core/google/cloud/_helpers.py
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): """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...
[ "Convert", "a", "zoneless", "ISO8601", "time", "string", "to", "naive", "datetime", "time" ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L258-L274
[ "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_...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_rfc3339_to_datetime
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.
core/google/cloud/_helpers.py
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): """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...
[ "Convert", "a", "microsecond", "-", "precision", "timestamp", "to", "a", "native", "datetime", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L277-L286
[ "def", "_rfc3339_to_datetime", "(", "dt_str", ")", ":", "return", "datetime", ".", "datetime", ".", "strptime", "(", "dt_str", ",", "_RFC3339_MICROS", ")", ".", "replace", "(", "tzinfo", "=", "UTC", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_rfc3339_nanos_to_datetime
Convert a nanosecond-precision timestamp to a native datetime. .. note:: Python datetimes do not support nanosecond precision; this function therefore truncates such values to microseconds. :type dt_str: str :param dt_str: The string to convert. :rtype: :class:`datetime.datetime` ...
core/google/cloud/_helpers.py
def _rfc3339_nanos_to_datetime(dt_str): """Convert a nanosecond-precision timestamp to a native datetime. .. note:: Python datetimes do not support nanosecond precision; this function therefore truncates such values to microseconds. :type dt_str: str :param dt_str: The string to conver...
def _rfc3339_nanos_to_datetime(dt_str): """Convert a nanosecond-precision timestamp to a native datetime. .. note:: Python datetimes do not support nanosecond precision; this function therefore truncates such values to microseconds. :type dt_str: str :param dt_str: The string to conver...
[ "Convert", "a", "nanosecond", "-", "precision", "timestamp", "to", "a", "native", "datetime", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L289-L321
[ "def", "_rfc3339_nanos_to_datetime", "(", "dt_str", ")", ":", "with_nanos", "=", "_RFC3339_NANOS", ".", "match", "(", "dt_str", ")", "if", "with_nanos", "is", "None", ":", "raise", "ValueError", "(", "\"Timestamp: %r, does not match pattern: %r\"", "%", "(", "dt_str...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_datetime_to_rfc3339
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...
core/google/cloud/_helpers.py
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): """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 ...
[ "Convert", "a", "timestamp", "to", "a", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L324-L341
[ "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", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_to_bytes
Converts a string value to bytes, if necessary. Unfortunately, ``six.b`` is insufficient for this task since in Python2 it does not modify ``unicode`` objects. :type value: str / bytes or unicode :param value: The string/bytes value to be converted. :type encoding: str :param encoding: The en...
core/google/cloud/_helpers.py
def _to_bytes(value, encoding="ascii"): """Converts a string value to bytes, if necessary. Unfortunately, ``six.b`` is insufficient for this task since in Python2 it does not modify ``unicode`` objects. :type value: str / bytes or unicode :param value: The string/bytes value to be converted. ...
def _to_bytes(value, encoding="ascii"): """Converts a string value to bytes, if necessary. Unfortunately, ``six.b`` is insufficient for this task since in Python2 it does not modify ``unicode`` objects. :type value: str / bytes or unicode :param value: The string/bytes value to be converted. ...
[ "Converts", "a", "string", "value", "to", "bytes", "if", "necessary", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L344-L370
[ "def", "_to_bytes", "(", "value", ",", "encoding", "=", "\"ascii\"", ")", ":", "result", "=", "value", ".", "encode", "(", "encoding", ")", "if", "isinstance", "(", "value", ",", "six", ".", "text_type", ")", "else", "value", "if", "isinstance", "(", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_bytes_to_unicode
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...
core/google/cloud/_helpers.py
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): """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. ...
[ "Converts", "bytes", "to", "a", "unicode", "value", "if", "necessary", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L373-L389
[ "def", "_bytes_to_unicode", "(", "value", ")", ":", "result", "=", "value", ".", "decode", "(", "\"utf-8\"", ")", "if", "isinstance", "(", "value", ",", "six", ".", "binary_type", ")", "else", "value", "if", "isinstance", "(", "result", ",", "six", ".", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_from_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: ...
core/google/cloud/_helpers.py
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): """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 ...
[ "Converts", "an", "Any", "protobuf", "to", "the", "specified", "message", "type" ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L392-L414
[ "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", ".", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_pb_timestamp_to_datetime
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.
core/google/cloud/_helpers.py
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): """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...
[ "Convert", "a", "Timestamp", "protobuf", "to", "a", "datetime", "object", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L417-L428
[ "def", "_pb_timestamp_to_datetime", "(", "timestamp_pb", ")", ":", "return", "_EPOCH", "+", "datetime", ".", "timedelta", "(", "seconds", "=", "timestamp_pb", ".", "seconds", ",", "microseconds", "=", "(", "timestamp_pb", ".", "nanos", "/", "1000.0", ")", ")" ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_datetime_to_pb_timestamp
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.
core/google/cloud/_helpers.py
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): """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...
[ "Convert", "a", "datetime", "object", "to", "a", "Timestamp", "protobuf", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L444-L456
[ "def", "_datetime_to_pb_timestamp", "(", "when", ")", ":", "ms_value", "=", "_microseconds_from_datetime", "(", "when", ")", "seconds", ",", "micros", "=", "divmod", "(", "ms_value", ",", "10", "**", "6", ")", "nanos", "=", "micros", "*", "10", "**", "3", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_duration_pb_to_timedelta
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...
core/google/cloud/_helpers.py
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): """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...
[ "Convert", "a", "duration", "protobuf", "to", "a", "Python", "timedelta", "object", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L478-L494
[ "def", "_duration_pb_to_timedelta", "(", "duration_pb", ")", ":", "return", "datetime", ".", "timedelta", "(", "seconds", "=", "duration_pb", ".", "seconds", ",", "microseconds", "=", "(", "duration_pb", ".", "nanos", "/", "1000.0", ")", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_name_from_project_path
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...
core/google/cloud/_helpers.py
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): """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...
[ "Validate", "a", "URI", "path", "and", "get", "the", "leaf", "object", "s", "name", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L497-L537
[ "def", "_name_from_project_path", "(", "path", ",", "project", ",", "template", ")", ":", "if", "isinstance", "(", "template", ",", "str", ")", ":", "template", "=", "re", ".", "compile", "(", "template", ")", "match", "=", "template", ".", "match", "(",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
make_secure_channel
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...
core/google/cloud/_helpers.py
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=()): """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 ...
[ "Makes", "a", "secure", "channel", "for", "an", "RPC", "service", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L540-L569
[ "def", "make_secure_channel", "(", "credentials", ",", "user_agent", ",", "host", ",", "extra_options", "=", "(", ")", ")", ":", "target", "=", "\"%s:%d\"", "%", "(", "host", ",", "http_client", ".", "HTTPS_PORT", ")", "http_request", "=", "google", ".", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
make_secure_stub
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 ...
core/google/cloud/_helpers.py
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=()): """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...
[ "Makes", "a", "secure", "stub", "for", "an", "RPC", "service", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L572-L600
[ "def", "make_secure_stub", "(", "credentials", ",", "user_agent", ",", "stub_class", ",", "host", ",", "extra_options", "=", "(", ")", ")", ":", "channel", "=", "make_secure_channel", "(", "credentials", ",", "user_agent", ",", "host", ",", "extra_options", "=...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
make_insecure_stub
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 ...
core/google/cloud/_helpers.py
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): """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 ...
[ "Makes", "an", "insecure", "stub", "for", "an", "RPC", "service", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L603-L627
[ "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\"", "%", "(", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_UTC.fromutc
Convert a timestamp from (naive) UTC to this timezone.
core/google/cloud/_helpers.py
def fromutc(self, dt): """Convert a timestamp from (naive) UTC to this timezone.""" if dt.tzinfo is None: return dt.replace(tzinfo=self) return super(_UTC, self).fromutc(dt)
def fromutc(self, dt): """Convert a timestamp from (naive) UTC to this timezone.""" if dt.tzinfo is None: return dt.replace(tzinfo=self) return super(_UTC, self).fromutc(dt)
[ "Convert", "a", "timestamp", "from", "(", "naive", ")", "UTC", "to", "this", "timezone", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L128-L132
[ "def", "fromutc", "(", "self", ",", "dt", ")", ":", "if", "dt", ".", "tzinfo", "is", "None", ":", "return", "dt", ".", "replace", "(", "tzinfo", "=", "self", ")", "return", "super", "(", "_UTC", ",", "self", ")", ".", "fromutc", "(", "dt", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
add_single_feature_methods
Custom decorator intended for :class:`~vision.helpers.VisionHelpers`. This metaclass adds a `{feature}` method for every feature defined on the Feature enum.
vision/google/cloud/vision_helpers/decorators.py
def add_single_feature_methods(cls): """Custom decorator intended for :class:`~vision.helpers.VisionHelpers`. This metaclass adds a `{feature}` method for every feature defined on the Feature enum. """ # Sanity check: This only makes sense if we are building the GAPIC # subclass and have enums ...
def add_single_feature_methods(cls): """Custom decorator intended for :class:`~vision.helpers.VisionHelpers`. This metaclass adds a `{feature}` method for every feature defined on the Feature enum. """ # Sanity check: This only makes sense if we are building the GAPIC # subclass and have enums ...
[ "Custom", "decorator", "intended", "for", ":", "class", ":", "~vision", ".", "helpers", ".", "VisionHelpers", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_helpers/decorators.py#L18-L49
[ "def", "add_single_feature_methods", "(", "cls", ")", ":", "# Sanity check: This only makes sense if we are building the GAPIC", "# subclass and have enums already attached.", "if", "not", "hasattr", "(", "cls", ",", "\"enums\"", ")", ":", "return", "cls", "# Add each single-fe...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_create_single_feature_method
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.
vision/google/cloud/vision_helpers/decorators.py
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): """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...
[ "Return", "a", "function", "that", "will", "detect", "a", "single", "feature", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_helpers/decorators.py#L52-L109
[ "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", "(...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ThreadScheduler.schedule
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
pubsub/google/cloud/pubsub_v1/subscriber/scheduler.py
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): """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...
[ "Schedule", "the", "callback", "to", "be", "called", "asynchronously", "in", "a", "thread", "pool", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/scheduler.py#L99-L110
[ "def", "schedule", "(", "self", ",", "callback", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_executor", ".", "submit", "(", "callback", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ThreadScheduler.shutdown
Shuts down the scheduler and immediately end all pending callbacks.
pubsub/google/cloud/pubsub_v1/subscriber/scheduler.py
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): """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: ...
[ "Shuts", "down", "the", "scheduler", "and", "immediately", "end", "all", "pending", "callbacks", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/scheduler.py#L112-L123
[ "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", "....
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ErrorStatsServiceClient.list_events
Lists the specified events. Example: >>> from google.cloud import errorreporting_v1beta1 >>> >>> client = errorreporting_v1beta1.ErrorStatsServiceClient() >>> >>> project_name = client.project_path('[PROJECT]') >>> >>> # TODO: ...
error_reporting/google/cloud/errorreporting_v1beta1/gapic/error_stats_service_client.py
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.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Lists the...
[ "Lists", "the", "specified", "events", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/errorreporting_v1beta1/gapic/error_stats_service_client.py#L343-L470
[ "def", "list_events", "(", "self", ",", "project_name", ",", "group_id", ",", "service_filter", "=", "None", ",", "time_range", "=", "None", ",", "page_size", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ErrorStatsServiceClient.delete_events
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]') >>> ...
error_reporting/google/cloud/errorreporting_v1beta1/gapic/error_stats_service_client.py
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, metadata=None, ): """ Deletes all error events of a given project. Example: >>> from google.cloud import...
[ "Deletes", "all", "error", "events", "of", "a", "given", "project", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/errorreporting_v1beta1/gapic/error_stats_service_client.py#L472-L542
[ "def", "delete_events", "(", "self", ",", "project_name", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_item_to_document_ref
Convert Document resource to document ref. Args: iterator (google.api_core.page_iterator.GRPCIterator): iterator response item (dict): document resource
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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] ...
[ "Convert", "Document", "resource", "to", "document", "ref", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L468-L477
[ "def", "_item_to_document_ref", "(", "iterator", ",", "item", ")", ":", "document_id", "=", "item", ".", "name", ".", "split", "(", "_helpers", ".", "DOCUMENT_PATH_DELIMITER", ")", "[", "-", "1", "]", "return", "iterator", ".", "collection", ".", "document",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.parent
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.
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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...
[ "Document", "that", "owns", "the", "current", "collection", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L80-L92
[ "def", "parent", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_path", ")", "==", "1", ":", "return", "None", "else", ":", "parent_path", "=", "self", ".", "_path", "[", ":", "-", "1", "]", "return", "self", ".", "_client", ".", "documen...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.document
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...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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 ...
[ "Create", "a", "sub", "-", "document", "underneath", "the", "current", "collection", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L94-L111
[ "def", "document", "(", "self", ",", "document_id", "=", "None", ")", ":", "if", "document_id", "is", "None", ":", "document_id", "=", "_auto_id", "(", ")", "child_path", "=", "self", ".", "_path", "+", "(", "document_id", ",", ")", "return", "self", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference._parent_info
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...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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 ...
[ "Get", "fully", "-", "qualified", "parent", "path", "and", "prefix", "for", "this", "collection", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L113-L133
[ "def", "_parent_info", "(", "self", ")", ":", "parent_doc", "=", "self", ".", "parent", "if", "parent_doc", "is", "None", ":", "parent_path", "=", "_helpers", ".", "DOCUMENT_PATH_DELIMITER", ".", "join", "(", "(", "self", ".", "_client", ".", "_database_stri...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.add
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...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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...
[ "Create", "a", "document", "in", "the", "Firestore", "database", "with", "the", "provided", "data", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L135-L180
[ "def", "add", "(", "self", ",", "document_data", ",", "document_id", "=", "None", ")", ":", "if", "document_id", "is", "None", ":", "parent_path", ",", "expected_prefix", "=", "self", ".", "_parent_info", "(", ")", "document_pb", "=", "document_pb2", ".", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.list_documents
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[...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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...
[ "List", "all", "subdocuments", "of", "the", "current", "collection", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L182-L207
[ "def", "list_documents", "(", "self", ",", "page_size", "=", "None", ")", ":", "parent", ",", "_", "=", "self", ".", "_parent_info", "(", ")", "iterator", "=", "self", ".", "_client", ".", "_firestore_api", ".", "list_documents", "(", "parent", ",", "sel...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.select
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...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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 (``.`...
[ "Create", "a", "select", "query", "with", "this", "collection", "as", "parent", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L209-L225
[ "def", "select", "(", "self", ",", "field_paths", ")", ":", "query", "=", "query_mod", ".", "Query", "(", "self", ")", "return", "query", ".", "select", "(", "field_paths", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.where
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...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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 ...
[ "Create", "a", "where", "query", "with", "this", "collection", "as", "parent", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L227-L248
[ "def", "where", "(", "self", ",", "field_path", ",", "op_string", ",", "value", ")", ":", "query", "=", "query_mod", ".", "Query", "(", "self", ")", "return", "query", ".", "where", "(", "field_path", ",", "op_string", ",", "value", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.order_by
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...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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 ...
[ "Create", "an", "order", "by", "query", "with", "this", "collection", "as", "parent", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L250-L269
[ "def", "order_by", "(", "self", ",", "field_path", ",", "*", "*", "kwargs", ")", ":", "query", "=", "query_mod", ".", "Query", "(", "self", ")", "return", "query", ".", "order_by", "(", "field_path", ",", "*", "*", "kwargs", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.limit
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...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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. ...
[ "Create", "a", "limited", "query", "with", "this", "collection", "as", "parent", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L271-L286
[ "def", "limit", "(", "self", ",", "count", ")", ":", "query", "=", "query_mod", ".", "Query", "(", "self", ")", "return", "query", ".", "limit", "(", "count", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.offset
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...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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 ...
[ "Skip", "to", "an", "offset", "in", "a", "query", "with", "this", "collection", "as", "parent", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L288-L303
[ "def", "offset", "(", "self", ",", "num_to_skip", ")", ":", "query", "=", "query_mod", ".", "Query", "(", "self", ")", "return", "query", ".", "offset", "(", "num_to_skip", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.start_at
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 ...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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...
[ "Start", "query", "at", "a", "cursor", "with", "this", "collection", "as", "parent", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L305-L323
[ "def", "start_at", "(", "self", ",", "document_fields", ")", ":", "query", "=", "query_mod", ".", "Query", "(", "self", ")", "return", "query", ".", "start_at", "(", "document_fields", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.start_after
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...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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...
[ "Start", "query", "after", "a", "cursor", "with", "this", "collection", "as", "parent", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L325-L343
[ "def", "start_after", "(", "self", ",", "document_fields", ")", ":", "query", "=", "query_mod", ".", "Query", "(", "self", ")", "return", "query", ".", "start_after", "(", "document_fields", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.end_before
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...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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...
[ "End", "query", "before", "a", "cursor", "with", "this", "collection", "as", "parent", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L345-L363
[ "def", "end_before", "(", "self", ",", "document_fields", ")", ":", "query", "=", "query_mod", ".", "Query", "(", "self", ")", "return", "query", ".", "end_before", "(", "document_fields", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.end_at
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 ...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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...
[ "End", "query", "at", "a", "cursor", "with", "this", "collection", "as", "parent", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L365-L383
[ "def", "end_at", "(", "self", ",", "document_fields", ")", ":", "query", "=", "query_mod", ".", "Query", "(", "self", ")", "return", "query", ".", "end_at", "(", "document_fields", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CollectionReference.stream
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_...
firestore/google/cloud/firestore_v1beta1/collection.py
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): """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...
[ "Read", "the", "documents", "in", "this", "collection", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L394-L422
[ "def", "stream", "(", "self", ",", "transaction", "=", "None", ")", ":", "query", "=", "query_mod", ".", "Query", "(", "self", ")", "return", "query", ".", "stream", "(", "transaction", "=", "transaction", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.get_languages
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...
translate/google/cloud/translate_v2/client.py
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): """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...
[ "Get", "list", "of", "supported", "languages", "for", "translation", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v2/client.py#L67-L95
[ "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",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.detect_language
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 ...
translate/google/cloud/translate_v2/client.py
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): """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. ...
[ "Detect", "the", "language", "of", "a", "string", "or", "list", "of", "strings", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v2/client.py#L97-L163
[ "def", "detect_language", "(", "self", ",", "values", ")", ":", "single_value", "=", "False", "if", "isinstance", "(", "values", ",", "six", ".", "string_types", ")", ":", "single_value", "=", "True", "values", "=", "[", "values", "]", "data", "=", "{", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.translate
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/google/cloud/translate_v2/client.py
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, ): """Translate a string or list of strings. See https://cloud.google.com/translate/docs/translating-text :type v...
[ "Translate", "a", "string", "or", "list", "of", "strings", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v2/client.py#L165-L252
[ "def", "translate", "(", "self", ",", "values", ",", "target_language", "=", "None", ",", "format_", "=", "None", ",", "source_language", "=", "None", ",", "customization_ids", "=", "(", ")", ",", "model", "=", "None", ",", ")", ":", "single_value", "=",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Leaser.add
Add messages to be managed by the leaser.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py
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): """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] =...
[ "Add", "messages", "to", "be", "managed", "by", "the", "leaser", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py#L65-L76
[ "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", "....
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Leaser.remove
Remove messages from lease management.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py
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 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 ...
[ "Remove", "messages", "from", "lease", "management", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py#L78-L90
[ "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", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Leaser.maintain_leases
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.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py
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): """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...
[ "Maintain", "all", "of", "the", "leases", "being", "managed", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py#L92-L159
[ "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 ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
make_report_error_api
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.
error_reporting/google/cloud/error_reporting/_gapic.py
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): """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...
[ "Create", "an", "instance", "of", "the", "gapic", "Logging", "API", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/error_reporting/_gapic.py#L27-L39
[ "def", "make_report_error_api", "(", "client", ")", ":", "gax_client", "=", "report_errors_service_client", ".", "ReportErrorsServiceClient", "(", "credentials", "=", "client", ".", "_credentials", ",", "client_info", "=", "_CLIENT_INFO", ")", "return", "_ErrorReporting...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_ErrorReportingGapicApi.report_error_event
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 ...
error_reporting/google/cloud/error_reporting/_gapic.py
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): """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 ...
[ "Uses", "the", "gapic", "client", "to", "report", "the", "error", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/error_reporting/_gapic.py#L57-L71
[ "def", "report_error_event", "(", "self", ",", "error_report", ")", ":", "project_name", "=", "self", ".", "_gapic_api", ".", "project_path", "(", "self", ".", "_project", ")", "error_report_payload", "=", "report_errors_service_pb2", ".", "ReportedErrorEvent", "(",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
BigtableClient.table_path
Return a fully-qualified table string.
bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py
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 a fully-qualified table string.""" return google.api_core.path_template.expand( "projects/{project}/instances/{instance}/tables/{table}", project=project, instance=instance, table=table, )
[ "Return", "a", "fully", "-", "qualified", "table", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py#L70-L77
[ "def", "table_path", "(", "cls", ",", "project", ",", "instance", ",", "table", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/instances/{instance}/tables/{table}\"", ",", "project", "=", "project", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
BigtableClient.read_rows
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 ...
bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py
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.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Streams back t...
[ "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", ...
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py#L178-L275
[ "def", "read_rows", "(", "self", ",", "table_name", ",", "app_profile_id", "=", "None", ",", "rows", "=", "None", ",", "filter_", "=", "None", ",", "rows_limit", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50