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 | Client.extract_table | Start a job to extract a table into Cloud Storage files.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.extract
Arguments:
source (Union[ \
:class:`google.cloud.bigquery.table.Table`, \
:class:`google.cloud.bigquery.t... | bigquery/google/cloud/bigquery/client.py | def extract_table(
self,
source,
destination_uris,
job_id=None,
job_id_prefix=None,
location=None,
project=None,
job_config=None,
retry=DEFAULT_RETRY,
):
"""Start a job to extract a table into Cloud Storage files.
See
h... | def extract_table(
self,
source,
destination_uris,
job_id=None,
job_id_prefix=None,
location=None,
project=None,
job_config=None,
retry=DEFAULT_RETRY,
):
"""Start a job to extract a table into Cloud Storage files.
See
h... | [
"Start",
"a",
"job",
"to",
"extract",
"a",
"table",
"into",
"Cloud",
"Storage",
"files",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1511-L1581 | [
"def",
"extract_table",
"(",
"self",
",",
"source",
",",
"destination_uris",
",",
"job_id",
"=",
"None",
",",
"job_id_prefix",
"=",
"None",
",",
"location",
"=",
"None",
",",
"project",
"=",
"None",
",",
"job_config",
"=",
"None",
",",
"retry",
"=",
"DEF... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.query | Run a SQL query.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query
Arguments:
query (str):
SQL query to be executed. Defaults to the standard SQL
dialect. Use the ``job_config`` parameter to change dialects.
... | bigquery/google/cloud/bigquery/client.py | def query(
self,
query,
job_config=None,
job_id=None,
job_id_prefix=None,
location=None,
project=None,
retry=DEFAULT_RETRY,
):
"""Run a SQL query.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.... | def query(
self,
query,
job_config=None,
job_id=None,
job_id_prefix=None,
location=None,
project=None,
retry=DEFAULT_RETRY,
):
"""Run a SQL query.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.... | [
"Run",
"a",
"SQL",
"query",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1583-L1650 | [
"def",
"query",
"(",
"self",
",",
"query",
",",
"job_config",
"=",
"None",
",",
"job_id",
"=",
"None",
",",
"job_id_prefix",
"=",
"None",
",",
"location",
"=",
"None",
",",
"project",
"=",
"None",
",",
"retry",
"=",
"DEFAULT_RETRY",
",",
")",
":",
"j... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.insert_rows | Insert rows into a table via the streaming API.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll
Args:
table (Union[ \
:class:`~google.cloud.bigquery.table.Table`, \
:class:`~google.cloud.bigquery.table.TableReference`... | bigquery/google/cloud/bigquery/client.py | def insert_rows(self, table, rows, selected_fields=None, **kwargs):
"""Insert rows into a table via the streaming API.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll
Args:
table (Union[ \
:class:`~google.cloud.bigquery.table... | def insert_rows(self, table, rows, selected_fields=None, **kwargs):
"""Insert rows into a table via the streaming API.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll
Args:
table (Union[ \
:class:`~google.cloud.bigquery.table... | [
"Insert",
"rows",
"into",
"a",
"table",
"via",
"the",
"streaming",
"API",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1652-L1714 | [
"def",
"insert_rows",
"(",
"self",
",",
"table",
",",
"rows",
",",
"selected_fields",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"table",
"=",
"_table_arg_to_table",
"(",
"table",
",",
"default_project",
"=",
"self",
".",
"project",
")",
"if",
"not"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.insert_rows_json | Insert rows into a table without applying local type conversions.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll
table (Union[ \
:class:`~google.cloud.bigquery.table.Table` \
:class:`~google.cloud.bigquery.table.TableReference`, \
... | bigquery/google/cloud/bigquery/client.py | def insert_rows_json(
self,
table,
json_rows,
row_ids=None,
skip_invalid_rows=None,
ignore_unknown_values=None,
template_suffix=None,
retry=DEFAULT_RETRY,
):
"""Insert rows into a table without applying local type conversions.
See
... | def insert_rows_json(
self,
table,
json_rows,
row_ids=None,
skip_invalid_rows=None,
ignore_unknown_values=None,
template_suffix=None,
retry=DEFAULT_RETRY,
):
"""Insert rows into a table without applying local type conversions.
See
... | [
"Insert",
"rows",
"into",
"a",
"table",
"without",
"applying",
"local",
"type",
"conversions",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1716-L1798 | [
"def",
"insert_rows_json",
"(",
"self",
",",
"table",
",",
"json_rows",
",",
"row_ids",
"=",
"None",
",",
"skip_invalid_rows",
"=",
"None",
",",
"ignore_unknown_values",
"=",
"None",
",",
"template_suffix",
"=",
"None",
",",
"retry",
"=",
"DEFAULT_RETRY",
",",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.list_partitions | List the partitions in a table.
Arguments:
table (Union[ \
:class:`~google.cloud.bigquery.table.Table`, \
:class:`~google.cloud.bigquery.table.TableReference`, \
str, \
]):
The table or reference from which to get partition... | bigquery/google/cloud/bigquery/client.py | def list_partitions(self, table, retry=DEFAULT_RETRY):
"""List the partitions in a table.
Arguments:
table (Union[ \
:class:`~google.cloud.bigquery.table.Table`, \
:class:`~google.cloud.bigquery.table.TableReference`, \
str, \
]):
... | def list_partitions(self, table, retry=DEFAULT_RETRY):
"""List the partitions in a table.
Arguments:
table (Union[ \
:class:`~google.cloud.bigquery.table.Table`, \
:class:`~google.cloud.bigquery.table.TableReference`, \
str, \
]):
... | [
"List",
"the",
"partitions",
"in",
"a",
"table",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1800-L1829 | [
"def",
"list_partitions",
"(",
"self",
",",
"table",
",",
"retry",
"=",
"DEFAULT_RETRY",
")",
":",
"table",
"=",
"_table_arg_to_table_ref",
"(",
"table",
",",
"default_project",
"=",
"self",
".",
"project",
")",
"meta_table",
"=",
"self",
".",
"get_table",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.list_rows | List the rows of the table.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/list
.. note::
This method assumes that the provided schema is up-to-date with the
schema as defined on the back-end: if the two schemas are not
identical, the v... | bigquery/google/cloud/bigquery/client.py | def list_rows(
self,
table,
selected_fields=None,
max_results=None,
page_token=None,
start_index=None,
page_size=None,
retry=DEFAULT_RETRY,
):
"""List the rows of the table.
See
https://cloud.google.com/bigquery/docs/reference/... | def list_rows(
self,
table,
selected_fields=None,
max_results=None,
page_token=None,
start_index=None,
page_size=None,
retry=DEFAULT_RETRY,
):
"""List the rows of the table.
See
https://cloud.google.com/bigquery/docs/reference/... | [
"List",
"the",
"rows",
"of",
"the",
"table",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1831-L1933 | [
"def",
"list_rows",
"(",
"self",
",",
"table",
",",
"selected_fields",
"=",
"None",
",",
"max_results",
"=",
"None",
",",
"page_token",
"=",
"None",
",",
"start_index",
"=",
"None",
",",
"page_size",
"=",
"None",
",",
"retry",
"=",
"DEFAULT_RETRY",
",",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client._schema_from_json_file_object | Helper function for schema_from_json that takes a
file object that describes a table schema.
Returns:
List of schema field objects. | bigquery/google/cloud/bigquery/client.py | def _schema_from_json_file_object(self, file_obj):
"""Helper function for schema_from_json that takes a
file object that describes a table schema.
Returns:
List of schema field objects.
"""
json_data = json.load(file_obj)
return [SchemaField.from_api_repr(field... | def _schema_from_json_file_object(self, file_obj):
"""Helper function for schema_from_json that takes a
file object that describes a table schema.
Returns:
List of schema field objects.
"""
json_data = json.load(file_obj)
return [SchemaField.from_api_repr(field... | [
"Helper",
"function",
"for",
"schema_from_json",
"that",
"takes",
"a",
"file",
"object",
"that",
"describes",
"a",
"table",
"schema",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1935-L1943 | [
"def",
"_schema_from_json_file_object",
"(",
"self",
",",
"file_obj",
")",
":",
"json_data",
"=",
"json",
".",
"load",
"(",
"file_obj",
")",
"return",
"[",
"SchemaField",
".",
"from_api_repr",
"(",
"field",
")",
"for",
"field",
"in",
"json_data",
"]"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client._schema_to_json_file_object | Helper function for schema_to_json that takes a schema list and file
object and writes the schema list to the file object with json.dump | bigquery/google/cloud/bigquery/client.py | def _schema_to_json_file_object(self, schema_list, file_obj):
"""Helper function for schema_to_json that takes a schema list and file
object and writes the schema list to the file object with json.dump
"""
json.dump(schema_list, file_obj, indent=2, sort_keys=True) | def _schema_to_json_file_object(self, schema_list, file_obj):
"""Helper function for schema_to_json that takes a schema list and file
object and writes the schema list to the file object with json.dump
"""
json.dump(schema_list, file_obj, indent=2, sort_keys=True) | [
"Helper",
"function",
"for",
"schema_to_json",
"that",
"takes",
"a",
"schema",
"list",
"and",
"file",
"object",
"and",
"writes",
"the",
"schema",
"list",
"to",
"the",
"file",
"object",
"with",
"json",
".",
"dump"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1945-L1949 | [
"def",
"_schema_to_json_file_object",
"(",
"self",
",",
"schema_list",
",",
"file_obj",
")",
":",
"json",
".",
"dump",
"(",
"schema_list",
",",
"file_obj",
",",
"indent",
"=",
"2",
",",
"sort_keys",
"=",
"True",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.schema_from_json | Takes a file object or file path that contains json that describes
a table schema.
Returns:
List of schema field objects. | bigquery/google/cloud/bigquery/client.py | def schema_from_json(self, file_or_path):
"""Takes a file object or file path that contains json that describes
a table schema.
Returns:
List of schema field objects.
"""
if isinstance(file_or_path, io.IOBase):
return self._schema_from_json_file_object(fi... | def schema_from_json(self, file_or_path):
"""Takes a file object or file path that contains json that describes
a table schema.
Returns:
List of schema field objects.
"""
if isinstance(file_or_path, io.IOBase):
return self._schema_from_json_file_object(fi... | [
"Takes",
"a",
"file",
"object",
"or",
"file",
"path",
"that",
"contains",
"json",
"that",
"describes",
"a",
"table",
"schema",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1951-L1962 | [
"def",
"schema_from_json",
"(",
"self",
",",
"file_or_path",
")",
":",
"if",
"isinstance",
"(",
"file_or_path",
",",
"io",
".",
"IOBase",
")",
":",
"return",
"self",
".",
"_schema_from_json_file_object",
"(",
"file_or_path",
")",
"with",
"open",
"(",
"file_or_... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.schema_to_json | Takes a list of schema field objects.
Serializes the list of schema field objects as json to a file.
Destination is a file path or a file object. | bigquery/google/cloud/bigquery/client.py | def schema_to_json(self, schema_list, destination):
"""Takes a list of schema field objects.
Serializes the list of schema field objects as json to a file.
Destination is a file path or a file object.
"""
json_schema_list = [f.to_api_repr() for f in schema_list]
if isi... | def schema_to_json(self, schema_list, destination):
"""Takes a list of schema field objects.
Serializes the list of schema field objects as json to a file.
Destination is a file path or a file object.
"""
json_schema_list = [f.to_api_repr() for f in schema_list]
if isi... | [
"Takes",
"a",
"list",
"of",
"schema",
"field",
"objects",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1964-L1977 | [
"def",
"schema_to_json",
"(",
"self",
",",
"schema_list",
",",
"destination",
")",
":",
"json_schema_list",
"=",
"[",
"f",
".",
"to_api_repr",
"(",
")",
"for",
"f",
"in",
"schema_list",
"]",
"if",
"isinstance",
"(",
"destination",
",",
"io",
".",
"IOBase",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance._update_from_pb | Refresh self from the server-provided protobuf.
Helper for :meth:`from_pb` and :meth:`reload`. | spanner/google/cloud/spanner_v1/instance.py | def _update_from_pb(self, instance_pb):
"""Refresh self from the server-provided protobuf.
Helper for :meth:`from_pb` and :meth:`reload`.
"""
if not instance_pb.display_name: # Simple field (string)
raise ValueError("Instance protobuf does not contain display_name")
... | def _update_from_pb(self, instance_pb):
"""Refresh self from the server-provided protobuf.
Helper for :meth:`from_pb` and :meth:`reload`.
"""
if not instance_pb.display_name: # Simple field (string)
raise ValueError("Instance protobuf does not contain display_name")
... | [
"Refresh",
"self",
"from",
"the",
"server",
"-",
"provided",
"protobuf",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L86-L95 | [
"def",
"_update_from_pb",
"(",
"self",
",",
"instance_pb",
")",
":",
"if",
"not",
"instance_pb",
".",
"display_name",
":",
"# Simple field (string)",
"raise",
"ValueError",
"(",
"\"Instance protobuf does not contain display_name\"",
")",
"self",
".",
"display_name",
"="... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance.from_pb | Creates an instance from a protobuf.
:type instance_pb:
:class:`google.spanner.v2.spanner_instance_admin_pb2.Instance`
:param instance_pb: A instance protobuf object.
:type client: :class:`~google.cloud.spanner_v1.client.Client`
:param client: The client that owns the insta... | spanner/google/cloud/spanner_v1/instance.py | def from_pb(cls, instance_pb, client):
"""Creates an instance from a protobuf.
:type instance_pb:
:class:`google.spanner.v2.spanner_instance_admin_pb2.Instance`
:param instance_pb: A instance protobuf object.
:type client: :class:`~google.cloud.spanner_v1.client.Client`
... | def from_pb(cls, instance_pb, client):
"""Creates an instance from a protobuf.
:type instance_pb:
:class:`google.spanner.v2.spanner_instance_admin_pb2.Instance`
:param instance_pb: A instance protobuf object.
:type client: :class:`~google.cloud.spanner_v1.client.Client`
... | [
"Creates",
"an",
"instance",
"from",
"a",
"protobuf",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L98-L130 | [
"def",
"from_pb",
"(",
"cls",
",",
"instance_pb",
",",
"client",
")",
":",
"match",
"=",
"_INSTANCE_NAME_RE",
".",
"match",
"(",
"instance_pb",
".",
"name",
")",
"if",
"match",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Instance protobuf name was not in... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance.copy | Make a copy of this instance.
Copies the local data stored as simple types and copies the client
attached to this instance.
:rtype: :class:`~google.cloud.spanner_v1.instance.Instance`
:returns: A copy of the current instance. | spanner/google/cloud/spanner_v1/instance.py | def copy(self):
"""Make a copy of this instance.
Copies the local data stored as simple types and copies the client
attached to this instance.
:rtype: :class:`~google.cloud.spanner_v1.instance.Instance`
:returns: A copy of the current instance.
"""
new_client = ... | def copy(self):
"""Make a copy of this instance.
Copies the local data stored as simple types and copies the client
attached to this instance.
:rtype: :class:`~google.cloud.spanner_v1.instance.Instance`
:returns: A copy of the current instance.
"""
new_client = ... | [
"Make",
"a",
"copy",
"of",
"this",
"instance",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L164-L180 | [
"def",
"copy",
"(",
"self",
")",
":",
"new_client",
"=",
"self",
".",
"_client",
".",
"copy",
"(",
")",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"instance_id",
",",
"new_client",
",",
"self",
".",
"configuration_name",
",",
"node_count",
"="... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance.create | Create this instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance
.. note::
Uses the ``project`` and ``instance_id`` on the current
:class:`Instance` in addition to the ... | spanner/google/cloud/spanner_v1/instance.py | def create(self):
"""Create this instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance
.. note::
Uses the ``project`` and ``instance_id`` on the current
:class:`... | def create(self):
"""Create this instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance
.. note::
Uses the ``project`` and ``instance_id`` on the current
:class:`... | [
"Create",
"this",
"instance",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L182-L221 | [
"def",
"create",
"(",
"self",
")",
":",
"api",
"=",
"self",
".",
"_client",
".",
"instance_admin_api",
"instance_pb",
"=",
"admin_v1_pb2",
".",
"Instance",
"(",
"name",
"=",
"self",
".",
"name",
",",
"config",
"=",
"self",
".",
"configuration_name",
",",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance.exists | Test whether this instance exists.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig
:rtype: bool
:returns: True if the instance exists, else false | spanner/google/cloud/spanner_v1/instance.py | def exists(self):
"""Test whether this instance exists.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig
:rtype: bool
:returns: True if the instance exists, else false
""... | def exists(self):
"""Test whether this instance exists.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig
:rtype: bool
:returns: True if the instance exists, else false
""... | [
"Test",
"whether",
"this",
"instance",
"exists",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L223-L240 | [
"def",
"exists",
"(",
"self",
")",
":",
"api",
"=",
"self",
".",
"_client",
".",
"instance_admin_api",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self",
".",
"name",
")",
"try",
":",
"api",
".",
"get_instance",
"(",
"self",
".",
"name",
",",
"metada... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance.reload | Reload the metadata for this instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig
:raises NotFound: if the instance does not exist | spanner/google/cloud/spanner_v1/instance.py | def reload(self):
"""Reload the metadata for this instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig
:raises NotFound: if the instance does not exist
"""
api = se... | def reload(self):
"""Reload the metadata for this instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig
:raises NotFound: if the instance does not exist
"""
api = se... | [
"Reload",
"the",
"metadata",
"for",
"this",
"instance",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L242-L255 | [
"def",
"reload",
"(",
"self",
")",
":",
"api",
"=",
"self",
".",
"_client",
".",
"instance_admin_api",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self",
".",
"name",
")",
"instance_pb",
"=",
"api",
".",
"get_instance",
"(",
"self",
".",
"name",
",",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance.update | Update this instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance
.. note::
Updates the ``display_name`` and ``node_count``. To change those
values before updating, set ... | spanner/google/cloud/spanner_v1/instance.py | def update(self):
"""Update this instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance
.. note::
Updates the ``display_name`` and ``node_count``. To change those
... | def update(self):
"""Update this instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance
.. note::
Updates the ``display_name`` and ``node_count``. To change those
... | [
"Update",
"this",
"instance",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L257-L293 | [
"def",
"update",
"(",
"self",
")",
":",
"api",
"=",
"self",
".",
"_client",
".",
"instance_admin_api",
"instance_pb",
"=",
"admin_v1_pb2",
".",
"Instance",
"(",
"name",
"=",
"self",
".",
"name",
",",
"config",
"=",
"self",
".",
"configuration_name",
",",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance.delete | Mark an instance and all of its databases for permanent deletion.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance
Immediately upon completion of the request:
* Billing will cease for all ... | spanner/google/cloud/spanner_v1/instance.py | def delete(self):
"""Mark an instance and all of its databases for permanent deletion.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance
Immediately upon completion of the request:
... | def delete(self):
"""Mark an instance and all of its databases for permanent deletion.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance
Immediately upon completion of the request:
... | [
"Mark",
"an",
"instance",
"and",
"all",
"of",
"its",
"databases",
"for",
"permanent",
"deletion",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L295-L313 | [
"def",
"delete",
"(",
"self",
")",
":",
"api",
"=",
"self",
".",
"_client",
".",
"instance_admin_api",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self",
".",
"name",
")",
"api",
".",
"delete_instance",
"(",
"self",
".",
"name",
",",
"metadata",
"=",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance.database | Factory to create a database within this instance.
:type database_id: str
:param database_id: The ID of the instance.
:type ddl_statements: list of string
:param ddl_statements: (Optional) DDL statements, excluding the
'CREATE DATABSE' statement.
... | spanner/google/cloud/spanner_v1/instance.py | def database(self, database_id, ddl_statements=(), pool=None):
"""Factory to create a database within this instance.
:type database_id: str
:param database_id: The ID of the instance.
:type ddl_statements: list of string
:param ddl_statements: (Optional) DDL statements, excludi... | def database(self, database_id, ddl_statements=(), pool=None):
"""Factory to create a database within this instance.
:type database_id: str
:param database_id: The ID of the instance.
:type ddl_statements: list of string
:param ddl_statements: (Optional) DDL statements, excludi... | [
"Factory",
"to",
"create",
"a",
"database",
"within",
"this",
"instance",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L315-L332 | [
"def",
"database",
"(",
"self",
",",
"database_id",
",",
"ddl_statements",
"=",
"(",
")",
",",
"pool",
"=",
"None",
")",
":",
"return",
"Database",
"(",
"database_id",
",",
"self",
",",
"ddl_statements",
"=",
"ddl_statements",
",",
"pool",
"=",
"pool",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance.list_databases | List databases for the instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases
:type page_size: int
:param page_size:
Optional. The maximum number of databases in each page of... | spanner/google/cloud/spanner_v1/instance.py | def list_databases(self, page_size=None, page_token=None):
"""List databases for the instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases
:type page_size: int
:param page_size:... | def list_databases(self, page_size=None, page_token=None):
"""List databases for the instance.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases
:type page_size: int
:param page_size:... | [
"List",
"databases",
"for",
"the",
"instance",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L334-L365 | [
"def",
"list_databases",
"(",
"self",
",",
"page_size",
"=",
"None",
",",
"page_token",
"=",
"None",
")",
":",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self",
".",
"name",
")",
"page_iter",
"=",
"self",
".",
"_client",
".",
"database_admin_api",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Instance._item_to_database | Convert a database protobuf to the native object.
:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that is currently in use.
:type database_pb: :class:`~google.spanner.admin.database.v1.Database`
:param database_pb: A database returned from... | spanner/google/cloud/spanner_v1/instance.py | def _item_to_database(self, iterator, database_pb):
"""Convert a database protobuf to the native object.
:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that is currently in use.
:type database_pb: :class:`~google.spanner.admin.database.v1... | def _item_to_database(self, iterator, database_pb):
"""Convert a database protobuf to the native object.
:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that is currently in use.
:type database_pb: :class:`~google.spanner.admin.database.v1... | [
"Convert",
"a",
"database",
"protobuf",
"to",
"the",
"native",
"object",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L367-L379 | [
"def",
"_item_to_database",
"(",
"self",
",",
"iterator",
",",
"database_pb",
")",
":",
"return",
"Database",
".",
"from_pb",
"(",
"database_pb",
",",
"self",
",",
"pool",
"=",
"BurstyPool",
"(",
")",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | PollingFuture._blocking_poll | Poll and wait for the Future to be resolved.
Args:
timeout (int):
How long (in seconds) to wait for the operation to complete.
If None, wait indefinitely. | api_core/google/api_core/future/polling.py | def _blocking_poll(self, timeout=None):
"""Poll and wait for the Future to be resolved.
Args:
timeout (int):
How long (in seconds) to wait for the operation to complete.
If None, wait indefinitely.
"""
if self._result_set:
return
... | def _blocking_poll(self, timeout=None):
"""Poll and wait for the Future to be resolved.
Args:
timeout (int):
How long (in seconds) to wait for the operation to complete.
If None, wait indefinitely.
"""
if self._result_set:
return
... | [
"Poll",
"and",
"wait",
"for",
"the",
"Future",
"to",
"be",
"resolved",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L87-L105 | [
"def",
"_blocking_poll",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"self",
".",
"_result_set",
":",
"return",
"retry_",
"=",
"self",
".",
"_retry",
".",
"with_deadline",
"(",
"timeout",
")",
"try",
":",
"retry_",
"(",
"self",
".",
"_don... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | PollingFuture.result | Get the result of the operation, blocking if necessary.
Args:
timeout (int):
How long (in seconds) to wait for the operation to complete.
If None, wait indefinitely.
Returns:
google.protobuf.Message: The Operation's result.
Raises:
... | api_core/google/api_core/future/polling.py | def result(self, timeout=None):
"""Get the result of the operation, blocking if necessary.
Args:
timeout (int):
How long (in seconds) to wait for the operation to complete.
If None, wait indefinitely.
Returns:
google.protobuf.Message: The... | def result(self, timeout=None):
"""Get the result of the operation, blocking if necessary.
Args:
timeout (int):
How long (in seconds) to wait for the operation to complete.
If None, wait indefinitely.
Returns:
google.protobuf.Message: The... | [
"Get",
"the",
"result",
"of",
"the",
"operation",
"blocking",
"if",
"necessary",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L107-L129 | [
"def",
"result",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"_blocking_poll",
"(",
"timeout",
"=",
"timeout",
")",
"if",
"self",
".",
"_exception",
"is",
"not",
"None",
":",
"# pylint: disable=raising-bad-type",
"# Pylint doesn't recognize ... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | PollingFuture.add_done_callback | Add a callback to be executed when the operation is complete.
If the operation is not already complete, this will start a helper
thread to poll for the status of the operation in the background.
Args:
fn (Callable[Future]): The callback to execute when the operation
... | api_core/google/api_core/future/polling.py | def add_done_callback(self, fn):
"""Add a callback to be executed when the operation is complete.
If the operation is not already complete, this will start a helper
thread to poll for the status of the operation in the background.
Args:
fn (Callable[Future]): The callback t... | def add_done_callback(self, fn):
"""Add a callback to be executed when the operation is complete.
If the operation is not already complete, this will start a helper
thread to poll for the status of the operation in the background.
Args:
fn (Callable[Future]): The callback t... | [
"Add",
"a",
"callback",
"to",
"be",
"executed",
"when",
"the",
"operation",
"is",
"complete",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L145-L166 | [
"def",
"add_done_callback",
"(",
"self",
",",
"fn",
")",
":",
"if",
"self",
".",
"_result_set",
":",
"_helpers",
".",
"safe_invoke_callback",
"(",
"fn",
",",
"self",
")",
"return",
"self",
".",
"_done_callbacks",
".",
"append",
"(",
"fn",
")",
"if",
"sel... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | PollingFuture._invoke_callbacks | Invoke all done callbacks. | api_core/google/api_core/future/polling.py | def _invoke_callbacks(self, *args, **kwargs):
"""Invoke all done callbacks."""
for callback in self._done_callbacks:
_helpers.safe_invoke_callback(callback, *args, **kwargs) | def _invoke_callbacks(self, *args, **kwargs):
"""Invoke all done callbacks."""
for callback in self._done_callbacks:
_helpers.safe_invoke_callback(callback, *args, **kwargs) | [
"Invoke",
"all",
"done",
"callbacks",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L168-L171 | [
"def",
"_invoke_callbacks",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"callback",
"in",
"self",
".",
"_done_callbacks",
":",
"_helpers",
".",
"safe_invoke_callback",
"(",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | PollingFuture.set_result | Set the Future's result. | api_core/google/api_core/future/polling.py | def set_result(self, result):
"""Set the Future's result."""
self._result = result
self._result_set = True
self._invoke_callbacks(self) | def set_result(self, result):
"""Set the Future's result."""
self._result = result
self._result_set = True
self._invoke_callbacks(self) | [
"Set",
"the",
"Future",
"s",
"result",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L173-L177 | [
"def",
"set_result",
"(",
"self",
",",
"result",
")",
":",
"self",
".",
"_result",
"=",
"result",
"self",
".",
"_result_set",
"=",
"True",
"self",
".",
"_invoke_callbacks",
"(",
"self",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | PollingFuture.set_exception | Set the Future's exception. | api_core/google/api_core/future/polling.py | def set_exception(self, exception):
"""Set the Future's exception."""
self._exception = exception
self._result_set = True
self._invoke_callbacks(self) | def set_exception(self, exception):
"""Set the Future's exception."""
self._exception = exception
self._result_set = True
self._invoke_callbacks(self) | [
"Set",
"the",
"Future",
"s",
"exception",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L179-L183 | [
"def",
"set_exception",
"(",
"self",
",",
"exception",
")",
":",
"self",
".",
"_exception",
"=",
"exception",
"self",
".",
"_result_set",
"=",
"True",
"self",
".",
"_invoke_callbacks",
"(",
"self",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | build_flask_context | Builds an HTTP context object from a Flask (Werkzeug) request object.
This helper method extracts the relevant HTTP context from a Flask request
object into an object ready to be sent to Error Reporting.
.. code-block:: python
>>> @app.errorhandler(HTTPException)
... def handle_error(ex... | error_reporting/google/cloud/error_reporting/util.py | def build_flask_context(request):
"""Builds an HTTP context object from a Flask (Werkzeug) request object.
This helper method extracts the relevant HTTP context from a Flask request
object into an object ready to be sent to Error Reporting.
.. code-block:: python
>>> @app.errorhandler(HTTPE... | def build_flask_context(request):
"""Builds an HTTP context object from a Flask (Werkzeug) request object.
This helper method extracts the relevant HTTP context from a Flask request
object into an object ready to be sent to Error Reporting.
.. code-block:: python
>>> @app.errorhandler(HTTPE... | [
"Builds",
"an",
"HTTP",
"context",
"object",
"from",
"a",
"Flask",
"(",
"Werkzeug",
")",
"request",
"object",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/error_reporting/util.py#L20-L47 | [
"def",
"build_flask_context",
"(",
"request",
")",
":",
"return",
"HTTPContext",
"(",
"url",
"=",
"request",
".",
"url",
",",
"method",
"=",
"request",
".",
"method",
",",
"user_agent",
"=",
"request",
".",
"user_agent",
".",
"string",
",",
"referrer",
"="... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | instantiate_client | Instantiate client. | logging/docs/snippets.py | def instantiate_client(_unused_client, _unused_to_delete):
"""Instantiate client."""
# [START client_create_default]
from google.cloud import logging
client = logging.Client()
# [END client_create_default]
credentials = object()
# [START client_create_explicit]
from google.cloud impor... | def instantiate_client(_unused_client, _unused_to_delete):
"""Instantiate client."""
# [START client_create_default]
from google.cloud import logging
client = logging.Client()
# [END client_create_default]
credentials = object()
# [START client_create_explicit]
from google.cloud impor... | [
"Instantiate",
"client",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L47-L60 | [
"def",
"instantiate_client",
"(",
"_unused_client",
",",
"_unused_to_delete",
")",
":",
"# [START client_create_default]",
"from",
"google",
".",
"cloud",
"import",
"logging",
"client",
"=",
"logging",
".",
"Client",
"(",
")",
"# [END client_create_default]",
"credentia... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | client_list_entries | List entries via client. | logging/docs/snippets.py | def client_list_entries(client, to_delete): # pylint: disable=unused-argument
"""List entries via client."""
# [START client_list_entries_default]
for entry in client.list_entries(): # API call(s)
do_something_with(entry)
# [END client_list_entries_default]
# [START client_list_entries_f... | def client_list_entries(client, to_delete): # pylint: disable=unused-argument
"""List entries via client."""
# [START client_list_entries_default]
for entry in client.list_entries(): # API call(s)
do_something_with(entry)
# [END client_list_entries_default]
# [START client_list_entries_f... | [
"List",
"entries",
"via",
"client",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L68-L99 | [
"def",
"client_list_entries",
"(",
"client",
",",
"to_delete",
")",
":",
"# pylint: disable=unused-argument",
"# [START client_list_entries_default]",
"for",
"entry",
"in",
"client",
".",
"list_entries",
"(",
")",
":",
"# API call(s)",
"do_something_with",
"(",
"entry",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | client_list_entries_multi_project | List entries via client across multiple projects. | logging/docs/snippets.py | def client_list_entries_multi_project(
client, to_delete
): # pylint: disable=unused-argument
"""List entries via client across multiple projects."""
# [START client_list_entries_multi_project]
PROJECT_IDS = ["one-project", "another-project"]
for entry in client.list_entries(project_ids=PROJECT_ID... | def client_list_entries_multi_project(
client, to_delete
): # pylint: disable=unused-argument
"""List entries via client across multiple projects."""
# [START client_list_entries_multi_project]
PROJECT_IDS = ["one-project", "another-project"]
for entry in client.list_entries(project_ids=PROJECT_ID... | [
"List",
"entries",
"via",
"client",
"across",
"multiple",
"projects",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L104-L112 | [
"def",
"client_list_entries_multi_project",
"(",
"client",
",",
"to_delete",
")",
":",
"# pylint: disable=unused-argument",
"# [START client_list_entries_multi_project]",
"PROJECT_IDS",
"=",
"[",
"\"one-project\"",
",",
"\"another-project\"",
"]",
"for",
"entry",
"in",
"clien... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | logger_usage | Logger usage. | logging/docs/snippets.py | def logger_usage(client, to_delete):
"""Logger usage."""
LOG_NAME = "logger_usage_%d" % (_millis())
# [START logger_create]
logger = client.logger(LOG_NAME)
# [END logger_create]
to_delete.append(logger)
# [START logger_log_text]
logger.log_text("A simple entry") # API call
# [END... | def logger_usage(client, to_delete):
"""Logger usage."""
LOG_NAME = "logger_usage_%d" % (_millis())
# [START logger_create]
logger = client.logger(LOG_NAME)
# [END logger_create]
to_delete.append(logger)
# [START logger_log_text]
logger.log_text("A simple entry") # API call
# [END... | [
"Logger",
"usage",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L117-L165 | [
"def",
"logger_usage",
"(",
"client",
",",
"to_delete",
")",
":",
"LOG_NAME",
"=",
"\"logger_usage_%d\"",
"%",
"(",
"_millis",
"(",
")",
")",
"# [START logger_create]",
"logger",
"=",
"client",
".",
"logger",
"(",
"LOG_NAME",
")",
"# [END logger_create]",
"to_de... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | metric_crud | Metric CRUD. | logging/docs/snippets.py | def metric_crud(client, to_delete):
"""Metric CRUD."""
METRIC_NAME = "robots-%d" % (_millis(),)
DESCRIPTION = "Robots all up in your server"
FILTER = "logName:apache-access AND textPayload:robot"
UPDATED_FILTER = "textPayload:robot"
UPDATED_DESCRIPTION = "Danger, Will Robinson!"
# [START cl... | def metric_crud(client, to_delete):
"""Metric CRUD."""
METRIC_NAME = "robots-%d" % (_millis(),)
DESCRIPTION = "Robots all up in your server"
FILTER = "logName:apache-access AND textPayload:robot"
UPDATED_FILTER = "textPayload:robot"
UPDATED_DESCRIPTION = "Danger, Will Robinson!"
# [START cl... | [
"Metric",
"CRUD",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L169-L212 | [
"def",
"metric_crud",
"(",
"client",
",",
"to_delete",
")",
":",
"METRIC_NAME",
"=",
"\"robots-%d\"",
"%",
"(",
"_millis",
"(",
")",
",",
")",
"DESCRIPTION",
"=",
"\"Robots all up in your server\"",
"FILTER",
"=",
"\"logName:apache-access AND textPayload:robot\"",
"UP... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | sink_storage | Sink log entries to storage. | logging/docs/snippets.py | def sink_storage(client, to_delete):
"""Sink log entries to storage."""
bucket = _sink_storage_setup(client)
to_delete.append(bucket)
SINK_NAME = "robots-storage-%d" % (_millis(),)
FILTER = "textPayload:robot"
# [START sink_storage_create]
DESTINATION = "storage.googleapis.com/%s" % (bucket... | def sink_storage(client, to_delete):
"""Sink log entries to storage."""
bucket = _sink_storage_setup(client)
to_delete.append(bucket)
SINK_NAME = "robots-storage-%d" % (_millis(),)
FILTER = "textPayload:robot"
# [START sink_storage_create]
DESTINATION = "storage.googleapis.com/%s" % (bucket... | [
"Sink",
"log",
"entries",
"to",
"storage",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L235-L249 | [
"def",
"sink_storage",
"(",
"client",
",",
"to_delete",
")",
":",
"bucket",
"=",
"_sink_storage_setup",
"(",
"client",
")",
"to_delete",
".",
"append",
"(",
"bucket",
")",
"SINK_NAME",
"=",
"\"robots-storage-%d\"",
"%",
"(",
"_millis",
"(",
")",
",",
")",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | sink_bigquery | Sink log entries to bigquery. | logging/docs/snippets.py | def sink_bigquery(client, to_delete):
"""Sink log entries to bigquery."""
dataset = _sink_bigquery_setup(client)
to_delete.append(dataset)
SINK_NAME = "robots-bigquery-%d" % (_millis(),)
FILTER = "textPayload:robot"
# [START sink_bigquery_create]
DESTINATION = "bigquery.googleapis.com%s" % ... | def sink_bigquery(client, to_delete):
"""Sink log entries to bigquery."""
dataset = _sink_bigquery_setup(client)
to_delete.append(dataset)
SINK_NAME = "robots-bigquery-%d" % (_millis(),)
FILTER = "textPayload:robot"
# [START sink_bigquery_create]
DESTINATION = "bigquery.googleapis.com%s" % ... | [
"Sink",
"log",
"entries",
"to",
"bigquery",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L274-L288 | [
"def",
"sink_bigquery",
"(",
"client",
",",
"to_delete",
")",
":",
"dataset",
"=",
"_sink_bigquery_setup",
"(",
"client",
")",
"to_delete",
".",
"append",
"(",
"dataset",
")",
"SINK_NAME",
"=",
"\"robots-bigquery-%d\"",
"%",
"(",
"_millis",
"(",
")",
",",
")... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | sink_pubsub | Sink log entries to pubsub. | logging/docs/snippets.py | def sink_pubsub(client, to_delete):
"""Sink log entries to pubsub."""
topic = _sink_pubsub_setup(client)
to_delete.append(topic)
SINK_NAME = "robots-pubsub-%d" % (_millis(),)
FILTER = "logName:apache-access AND textPayload:robot"
UPDATED_FILTER = "textPayload:robot"
# [START sink_pubsub_cre... | def sink_pubsub(client, to_delete):
"""Sink log entries to pubsub."""
topic = _sink_pubsub_setup(client)
to_delete.append(topic)
SINK_NAME = "robots-pubsub-%d" % (_millis(),)
FILTER = "logName:apache-access AND textPayload:robot"
UPDATED_FILTER = "textPayload:robot"
# [START sink_pubsub_cre... | [
"Sink",
"log",
"entries",
"to",
"pubsub",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L309-L348 | [
"def",
"sink_pubsub",
"(",
"client",
",",
"to_delete",
")",
":",
"topic",
"=",
"_sink_pubsub_setup",
"(",
"client",
")",
"to_delete",
".",
"append",
"(",
"topic",
")",
"SINK_NAME",
"=",
"\"robots-pubsub-%d\"",
"%",
"(",
"_millis",
"(",
")",
",",
")",
"FILT... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | complain | Issue a warning if `distribution_name` is installed.
In a future release, this method will be updated to raise ImportError
rather than just send a warning.
Args:
distribution_name (str): The name of the obsolete distribution. | core/google/cloud/obsolete.py | def complain(distribution_name):
"""Issue a warning if `distribution_name` is installed.
In a future release, this method will be updated to raise ImportError
rather than just send a warning.
Args:
distribution_name (str): The name of the obsolete distribution.
"""
try:
pkg_res... | def complain(distribution_name):
"""Issue a warning if `distribution_name` is installed.
In a future release, this method will be updated to raise ImportError
rather than just send a warning.
Args:
distribution_name (str): The name of the obsolete distribution.
"""
try:
pkg_res... | [
"Issue",
"a",
"warning",
"if",
"distribution_name",
"is",
"installed",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/obsolete.py#L22-L42 | [
"def",
"complain",
"(",
"distribution_name",
")",
":",
"try",
":",
"pkg_resources",
".",
"get_distribution",
"(",
"distribution_name",
")",
"warnings",
".",
"warn",
"(",
"\"The {pkg} distribution is now obsolete. \"",
"\"Please `pip uninstall {pkg}`. \"",
"\"In the future, th... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _get_encryption_headers | Builds customer encryption key headers
:type key: bytes
:param key: 32 byte key to build request key and hash.
:type source: bool
:param source: If true, return headers for the "source" blob; otherwise,
return headers for the "destination" blob.
:rtype: dict
:returns: dict ... | storage/google/cloud/storage/blob.py | def _get_encryption_headers(key, source=False):
"""Builds customer encryption key headers
:type key: bytes
:param key: 32 byte key to build request key and hash.
:type source: bool
:param source: If true, return headers for the "source" blob; otherwise,
return headers for the "d... | def _get_encryption_headers(key, source=False):
"""Builds customer encryption key headers
:type key: bytes
:param key: 32 byte key to build request key and hash.
:type source: bool
:param source: If true, return headers for the "source" blob; otherwise,
return headers for the "d... | [
"Builds",
"customer",
"encryption",
"key",
"headers"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1953-L1983 | [
"def",
"_get_encryption_headers",
"(",
"key",
",",
"source",
"=",
"False",
")",
":",
"if",
"key",
"is",
"None",
":",
"return",
"{",
"}",
"key",
"=",
"_to_bytes",
"(",
"key",
")",
"key_hash",
"=",
"hashlib",
".",
"sha256",
"(",
"key",
")",
".",
"diges... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _raise_from_invalid_response | Re-wrap and raise an ``InvalidResponse`` exception.
:type error: :exc:`google.resumable_media.InvalidResponse`
:param error: A caught exception from the ``google-resumable-media``
library.
:raises: :class:`~google.cloud.exceptions.GoogleCloudError` corresponding
to the faile... | storage/google/cloud/storage/blob.py | def _raise_from_invalid_response(error):
"""Re-wrap and raise an ``InvalidResponse`` exception.
:type error: :exc:`google.resumable_media.InvalidResponse`
:param error: A caught exception from the ``google-resumable-media``
library.
:raises: :class:`~google.cloud.exceptions.GoogleClo... | def _raise_from_invalid_response(error):
"""Re-wrap and raise an ``InvalidResponse`` exception.
:type error: :exc:`google.resumable_media.InvalidResponse`
:param error: A caught exception from the ``google-resumable-media``
library.
:raises: :class:`~google.cloud.exceptions.GoogleClo... | [
"Re",
"-",
"wrap",
"and",
"raise",
"an",
"InvalidResponse",
"exception",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L2017-L2034 | [
"def",
"_raise_from_invalid_response",
"(",
"error",
")",
":",
"response",
"=",
"error",
".",
"response",
"error_message",
"=",
"str",
"(",
"error",
")",
"message",
"=",
"u\"{method} {url}: {error}\"",
".",
"format",
"(",
"method",
"=",
"response",
".",
"request... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _add_query_parameters | Add one query parameter to a base URL.
:type base_url: string
:param base_url: Base URL (may already contain query parameters)
:type name_value_pairs: list of (string, string) tuples.
:param name_value_pairs: Names and values of the query parameters to add
:rtype: string
:returns: URL with ad... | storage/google/cloud/storage/blob.py | def _add_query_parameters(base_url, name_value_pairs):
"""Add one query parameter to a base URL.
:type base_url: string
:param base_url: Base URL (may already contain query parameters)
:type name_value_pairs: list of (string, string) tuples.
:param name_value_pairs: Names and values of the query p... | def _add_query_parameters(base_url, name_value_pairs):
"""Add one query parameter to a base URL.
:type base_url: string
:param base_url: Base URL (may already contain query parameters)
:type name_value_pairs: list of (string, string) tuples.
:param name_value_pairs: Names and values of the query p... | [
"Add",
"one",
"query",
"parameter",
"to",
"a",
"base",
"URL",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L2037-L2055 | [
"def",
"_add_query_parameters",
"(",
"base_url",
",",
"name_value_pairs",
")",
":",
"if",
"len",
"(",
"name_value_pairs",
")",
"==",
"0",
":",
"return",
"base_url",
"scheme",
",",
"netloc",
",",
"path",
",",
"query",
",",
"frag",
"=",
"urlsplit",
"(",
"bas... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.chunk_size | Set the blob's default chunk size.
:type value: int
:param value: (Optional) The current blob's chunk size, if it is set.
:raises: :class:`ValueError` if ``value`` is not ``None`` and is not a
multiple of 256 KB. | storage/google/cloud/storage/blob.py | def chunk_size(self, value):
"""Set the blob's default chunk size.
:type value: int
:param value: (Optional) The current blob's chunk size, if it is set.
:raises: :class:`ValueError` if ``value`` is not ``None`` and is not a
multiple of 256 KB.
"""
if v... | def chunk_size(self, value):
"""Set the blob's default chunk size.
:type value: int
:param value: (Optional) The current blob's chunk size, if it is set.
:raises: :class:`ValueError` if ``value`` is not ``None`` and is not a
multiple of 256 KB.
"""
if v... | [
"Set",
"the",
"blob",
"s",
"default",
"chunk",
"size",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L200-L213 | [
"def",
"chunk_size",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"not",
"None",
"and",
"value",
">",
"0",
"and",
"value",
"%",
"self",
".",
"_CHUNK_SIZE_MULTIPLE",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
"\"Chunk size must be a multiple of ... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.path | Getter property for the URL path to this Blob.
:rtype: str
:returns: The URL path to this Blob. | storage/google/cloud/storage/blob.py | def path(self):
"""Getter property for the URL path to this Blob.
:rtype: str
:returns: The URL path to this Blob.
"""
if not self.name:
raise ValueError("Cannot determine path without a blob name.")
return self.path_helper(self.bucket.path, self.name) | def path(self):
"""Getter property for the URL path to this Blob.
:rtype: str
:returns: The URL path to this Blob.
"""
if not self.name:
raise ValueError("Cannot determine path without a blob name.")
return self.path_helper(self.bucket.path, self.name) | [
"Getter",
"property",
"for",
"the",
"URL",
"path",
"to",
"this",
"Blob",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L244-L253 | [
"def",
"path",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"name",
":",
"raise",
"ValueError",
"(",
"\"Cannot determine path without a blob name.\"",
")",
"return",
"self",
".",
"path_helper",
"(",
"self",
".",
"bucket",
".",
"path",
",",
"self",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob._query_params | Default query parameters. | storage/google/cloud/storage/blob.py | def _query_params(self):
"""Default query parameters."""
params = {}
if self.generation is not None:
params["generation"] = self.generation
if self.user_project is not None:
params["userProject"] = self.user_project
return params | def _query_params(self):
"""Default query parameters."""
params = {}
if self.generation is not None:
params["generation"] = self.generation
if self.user_project is not None:
params["userProject"] = self.user_project
return params | [
"Default",
"query",
"parameters",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L279-L286 | [
"def",
"_query_params",
"(",
"self",
")",
":",
"params",
"=",
"{",
"}",
"if",
"self",
".",
"generation",
"is",
"not",
"None",
":",
"params",
"[",
"\"generation\"",
"]",
"=",
"self",
".",
"generation",
"if",
"self",
".",
"user_project",
"is",
"not",
"No... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.public_url | The public URL for this blob.
Use :meth:`make_public` to enable anonymous access via the returned
URL.
:rtype: `string`
:returns: The public URL for this blob. | storage/google/cloud/storage/blob.py | def public_url(self):
"""The public URL for this blob.
Use :meth:`make_public` to enable anonymous access via the returned
URL.
:rtype: `string`
:returns: The public URL for this blob.
"""
return "{storage_base_url}/{bucket_name}/{quoted_name}".format(
... | def public_url(self):
"""The public URL for this blob.
Use :meth:`make_public` to enable anonymous access via the returned
URL.
:rtype: `string`
:returns: The public URL for this blob.
"""
return "{storage_base_url}/{bucket_name}/{quoted_name}".format(
... | [
"The",
"public",
"URL",
"for",
"this",
"blob",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L289-L302 | [
"def",
"public_url",
"(",
"self",
")",
":",
"return",
"\"{storage_base_url}/{bucket_name}/{quoted_name}\"",
".",
"format",
"(",
"storage_base_url",
"=",
"_API_ACCESS_ENDPOINT",
",",
"bucket_name",
"=",
"self",
".",
"bucket",
".",
"name",
",",
"quoted_name",
"=",
"qu... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.generate_signed_url | Generates a signed URL for this blob.
.. note::
If you are on Google Compute Engine, you can't generate a signed
URL using GCE service account. Follow `Issue 50`_ for updates on
this. If you'd like to be able to generate a signed URL from GCE,
you can use a stan... | storage/google/cloud/storage/blob.py | def generate_signed_url(
self,
expiration=None,
api_access_endpoint=_API_ACCESS_ENDPOINT,
method="GET",
content_md5=None,
content_type=None,
response_disposition=None,
response_type=None,
generation=None,
headers=None,
query_paramet... | def generate_signed_url(
self,
expiration=None,
api_access_endpoint=_API_ACCESS_ENDPOINT,
method="GET",
content_md5=None,
content_type=None,
response_disposition=None,
response_type=None,
generation=None,
headers=None,
query_paramet... | [
"Generates",
"a",
"signed",
"URL",
"for",
"this",
"blob",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L304-L445 | [
"def",
"generate_signed_url",
"(",
"self",
",",
"expiration",
"=",
"None",
",",
"api_access_endpoint",
"=",
"_API_ACCESS_ENDPOINT",
",",
"method",
"=",
"\"GET\"",
",",
"content_md5",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"response_disposition",
"=",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.exists | Determines whether or not this blob exists.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. If not passed, ... | storage/google/cloud/storage/blob.py | def exists(self, client=None):
"""Determines whether or not this blob exists.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Opt... | def exists(self, client=None):
"""Determines whether or not this blob exists.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Opt... | [
"Determines",
"whether",
"or",
"not",
"this",
"blob",
"exists",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L447-L481 | [
"def",
"exists",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"# We only need the status code (200 or not) so we seek to",
"# minimize the returned payload.",
"query_params",
"=",
"self",
".",
"_... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.delete | Deletes a blob from Cloud Storage.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. If not passed, falls bac... | storage/google/cloud/storage/blob.py | def delete(self, client=None):
"""Deletes a blob from Cloud Storage.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. Th... | def delete(self, client=None):
"""Deletes a blob from Cloud Storage.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. Th... | [
"Deletes",
"a",
"blob",
"from",
"Cloud",
"Storage",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L483-L502 | [
"def",
"delete",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"return",
"self",
".",
"bucket",
".",
"delete_blob",
"(",
"self",
".",
"name",
",",
"client",
"=",
"client",
",",
"generation",
"=",
"self",
".",
"generation",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob._get_download_url | Get the download URL for the current blob.
If the ``media_link`` has been loaded, it will be used, otherwise
the URL will be constructed from the current blob's path (and possibly
generation) to avoid a round trip.
:rtype: str
:returns: The download URL for the current blob. | storage/google/cloud/storage/blob.py | def _get_download_url(self):
"""Get the download URL for the current blob.
If the ``media_link`` has been loaded, it will be used, otherwise
the URL will be constructed from the current blob's path (and possibly
generation) to avoid a round trip.
:rtype: str
:returns: T... | def _get_download_url(self):
"""Get the download URL for the current blob.
If the ``media_link`` has been loaded, it will be used, otherwise
the URL will be constructed from the current blob's path (and possibly
generation) to avoid a round trip.
:rtype: str
:returns: T... | [
"Get",
"the",
"download",
"URL",
"for",
"the",
"current",
"blob",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L519-L540 | [
"def",
"_get_download_url",
"(",
"self",
")",
":",
"name_value_pairs",
"=",
"[",
"]",
"if",
"self",
".",
"media_link",
"is",
"None",
":",
"base_url",
"=",
"_DOWNLOAD_URL_TEMPLATE",
".",
"format",
"(",
"path",
"=",
"self",
".",
"path",
")",
"if",
"self",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob._do_download | Perform a download without any error handling.
This is intended to be called by :meth:`download_to_file` so it can
be wrapped with error handling / remapping.
:type transport:
:class:`~google.auth.transport.requests.AuthorizedSession`
:param transport: The transport (with c... | storage/google/cloud/storage/blob.py | def _do_download(
self, transport, file_obj, download_url, headers, start=None, end=None
):
"""Perform a download without any error handling.
This is intended to be called by :meth:`download_to_file` so it can
be wrapped with error handling / remapping.
:type transport:
... | def _do_download(
self, transport, file_obj, download_url, headers, start=None, end=None
):
"""Perform a download without any error handling.
This is intended to be called by :meth:`download_to_file` so it can
be wrapped with error handling / remapping.
:type transport:
... | [
"Perform",
"a",
"download",
"without",
"any",
"error",
"handling",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L542-L586 | [
"def",
"_do_download",
"(",
"self",
",",
"transport",
",",
"file_obj",
",",
"download_url",
",",
"headers",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"if",
"self",
".",
"chunk_size",
"is",
"None",
":",
"download",
"=",
"Download",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.download_to_file | Download the contents of this blob into a file-like object.
.. note::
If the server-set property, :attr:`media_link`, is not yet
initialized, makes an additional API request to load it.
Downloading a file that has been encrypted with a `customer-supplied`_
encryption key... | storage/google/cloud/storage/blob.py | def download_to_file(self, file_obj, client=None, start=None, end=None):
"""Download the contents of this blob into a file-like object.
.. note::
If the server-set property, :attr:`media_link`, is not yet
initialized, makes an additional API request to load it.
Downloadi... | def download_to_file(self, file_obj, client=None, start=None, end=None):
"""Download the contents of this blob into a file-like object.
.. note::
If the server-set property, :attr:`media_link`, is not yet
initialized, makes an additional API request to load it.
Downloadi... | [
"Download",
"the",
"contents",
"of",
"this",
"blob",
"into",
"a",
"file",
"-",
"like",
"object",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L588-L638 | [
"def",
"download_to_file",
"(",
"self",
",",
"file_obj",
",",
"client",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"download_url",
"=",
"self",
".",
"_get_download_url",
"(",
")",
"headers",
"=",
"_get_encryption_headers",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.download_to_filename | Download the contents of this blob into a named file.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type filename: str
:param filename: A filename to be passed to ``open``.
:type client: :class:`~google.cloud.storage.client.Client` or
... | storage/google/cloud/storage/blob.py | def download_to_filename(self, filename, client=None, start=None, end=None):
"""Download the contents of this blob into a named file.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type filename: str
:param filename: A filename to be passe... | def download_to_filename(self, filename, client=None, start=None, end=None):
"""Download the contents of this blob into a named file.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type filename: str
:param filename: A filename to be passe... | [
"Download",
"the",
"contents",
"of",
"this",
"blob",
"into",
"a",
"named",
"file",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L640-L673 | [
"def",
"download_to_filename",
"(",
"self",
",",
"filename",
",",
"client",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"\"wb\"",
")",
"as",
"file_obj",
":",
"self",
"."... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.download_as_string | Download the contents of this blob as a string.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. If not pass... | storage/google/cloud/storage/blob.py | def download_as_string(self, client=None, start=None, end=None):
"""Download the contents of this blob as a string.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
`... | def download_as_string(self, client=None, start=None, end=None):
"""Download the contents of this blob as a string.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
`... | [
"Download",
"the",
"contents",
"of",
"this",
"blob",
"as",
"a",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L675-L698 | [
"def",
"download_as_string",
"(",
"self",
",",
"client",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"string_buffer",
"=",
"BytesIO",
"(",
")",
"self",
".",
"download_to_file",
"(",
"string_buffer",
",",
"client",
"=",
"cli... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob._get_content_type | Determine the content type from the current object.
The return value will be determined in order of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The default value ('application/octet-stream')
:type content_type... | storage/google/cloud/storage/blob.py | def _get_content_type(self, content_type, filename=None):
"""Determine the content type from the current object.
The return value will be determined in order of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The d... | def _get_content_type(self, content_type, filename=None):
"""Determine the content type from the current object.
The return value will be determined in order of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The d... | [
"Determine",
"the",
"content",
"type",
"from",
"the",
"current",
"object",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L700-L728 | [
"def",
"_get_content_type",
"(",
"self",
",",
"content_type",
",",
"filename",
"=",
"None",
")",
":",
"if",
"content_type",
"is",
"None",
":",
"content_type",
"=",
"self",
".",
"content_type",
"if",
"content_type",
"is",
"None",
"and",
"filename",
"is",
"not... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob._get_writable_metadata | Get the object / blob metadata which is writable.
This is intended to be used when creating a new object / blob.
See the `API reference docs`_ for more information, the fields
marked as writable are:
* ``acl``
* ``cacheControl``
* ``contentDisposition``
* ``con... | storage/google/cloud/storage/blob.py | def _get_writable_metadata(self):
"""Get the object / blob metadata which is writable.
This is intended to be used when creating a new object / blob.
See the `API reference docs`_ for more information, the fields
marked as writable are:
* ``acl``
* ``cacheControl``
... | def _get_writable_metadata(self):
"""Get the object / blob metadata which is writable.
This is intended to be used when creating a new object / blob.
See the `API reference docs`_ for more information, the fields
marked as writable are:
* ``acl``
* ``cacheControl``
... | [
"Get",
"the",
"object",
"/",
"blob",
"metadata",
"which",
"is",
"writable",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L730-L759 | [
"def",
"_get_writable_metadata",
"(",
"self",
")",
":",
"# NOTE: This assumes `self.name` is unicode.",
"object_metadata",
"=",
"{",
"\"name\"",
":",
"self",
".",
"name",
"}",
"for",
"key",
"in",
"self",
".",
"_changes",
":",
"if",
"key",
"in",
"_WRITABLE_FIELDS",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob._get_upload_arguments | Get required arguments for performing an upload.
The content type returned will be determined in order of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The default value ('application/octet-stream')
:type conten... | storage/google/cloud/storage/blob.py | def _get_upload_arguments(self, content_type):
"""Get required arguments for performing an upload.
The content type returned will be determined in order of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The defaul... | def _get_upload_arguments(self, content_type):
"""Get required arguments for performing an upload.
The content type returned will be determined in order of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The defaul... | [
"Get",
"required",
"arguments",
"for",
"performing",
"an",
"upload",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L761-L783 | [
"def",
"_get_upload_arguments",
"(",
"self",
",",
"content_type",
")",
":",
"headers",
"=",
"_get_encryption_headers",
"(",
"self",
".",
"_encryption_key",
")",
"object_metadata",
"=",
"self",
".",
"_get_writable_metadata",
"(",
")",
"content_type",
"=",
"self",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob._do_multipart_upload | Perform a multipart upload.
The content type of the upload will be determined in order
of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The default value ('application/octet-stream')
:type client: :class... | storage/google/cloud/storage/blob.py | def _do_multipart_upload(
self, client, stream, content_type, size, num_retries, predefined_acl
):
"""Perform a multipart upload.
The content type of the upload will be determined in order
of precedence:
- The value passed in to this method (if not :data:`None`)
- T... | def _do_multipart_upload(
self, client, stream, content_type, size, num_retries, predefined_acl
):
"""Perform a multipart upload.
The content type of the upload will be determined in order
of precedence:
- The value passed in to this method (if not :data:`None`)
- T... | [
"Perform",
"a",
"multipart",
"upload",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L785-L859 | [
"def",
"_do_multipart_upload",
"(",
"self",
",",
"client",
",",
"stream",
",",
"content_type",
",",
"size",
",",
"num_retries",
",",
"predefined_acl",
")",
":",
"if",
"size",
"is",
"None",
":",
"data",
"=",
"stream",
".",
"read",
"(",
")",
"else",
":",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob._initiate_resumable_upload | Initiate a resumable upload.
The content type of the upload will be determined in order
of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The default value ('application/octet-stream')
:type client: :clas... | storage/google/cloud/storage/blob.py | def _initiate_resumable_upload(
self,
client,
stream,
content_type,
size,
num_retries,
predefined_acl=None,
extra_headers=None,
chunk_size=None,
):
"""Initiate a resumable upload.
The content type of the upload will be determin... | def _initiate_resumable_upload(
self,
client,
stream,
content_type,
size,
num_retries,
predefined_acl=None,
extra_headers=None,
chunk_size=None,
):
"""Initiate a resumable upload.
The content type of the upload will be determin... | [
"Initiate",
"a",
"resumable",
"upload",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L861-L962 | [
"def",
"_initiate_resumable_upload",
"(",
"self",
",",
"client",
",",
"stream",
",",
"content_type",
",",
"size",
",",
"num_retries",
",",
"predefined_acl",
"=",
"None",
",",
"extra_headers",
"=",
"None",
",",
"chunk_size",
"=",
"None",
",",
")",
":",
"if",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob._do_resumable_upload | Perform a resumable upload.
Assumes ``chunk_size`` is not :data:`None` on the current blob.
The content type of the upload will be determined in order
of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The... | storage/google/cloud/storage/blob.py | def _do_resumable_upload(
self, client, stream, content_type, size, num_retries, predefined_acl
):
"""Perform a resumable upload.
Assumes ``chunk_size`` is not :data:`None` on the current blob.
The content type of the upload will be determined in order
of precedence:
... | def _do_resumable_upload(
self, client, stream, content_type, size, num_retries, predefined_acl
):
"""Perform a resumable upload.
Assumes ``chunk_size`` is not :data:`None` on the current blob.
The content type of the upload will be determined in order
of precedence:
... | [
"Perform",
"a",
"resumable",
"upload",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L964-L1016 | [
"def",
"_do_resumable_upload",
"(",
"self",
",",
"client",
",",
"stream",
",",
"content_type",
",",
"size",
",",
"num_retries",
",",
"predefined_acl",
")",
":",
"upload",
",",
"transport",
"=",
"self",
".",
"_initiate_resumable_upload",
"(",
"client",
",",
"st... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob._do_upload | Determine an upload strategy and then perform the upload.
If the size of the data to be uploaded exceeds 5 MB a resumable media
request will be used, otherwise the content and the metadata will be
uploaded in a single multipart upload request.
The content type of the upload will be det... | storage/google/cloud/storage/blob.py | def _do_upload(
self, client, stream, content_type, size, num_retries, predefined_acl
):
"""Determine an upload strategy and then perform the upload.
If the size of the data to be uploaded exceeds 5 MB a resumable media
request will be used, otherwise the content and the metadata wi... | def _do_upload(
self, client, stream, content_type, size, num_retries, predefined_acl
):
"""Determine an upload strategy and then perform the upload.
If the size of the data to be uploaded exceeds 5 MB a resumable media
request will be used, otherwise the content and the metadata wi... | [
"Determine",
"an",
"upload",
"strategy",
"and",
"then",
"perform",
"the",
"upload",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1018-L1070 | [
"def",
"_do_upload",
"(",
"self",
",",
"client",
",",
"stream",
",",
"content_type",
",",
"size",
",",
"num_retries",
",",
"predefined_acl",
")",
":",
"if",
"size",
"is",
"not",
"None",
"and",
"size",
"<=",
"_MAX_MULTIPART_SIZE",
":",
"response",
"=",
"sel... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.upload_from_file | Upload the contents of this blob from a file-like object.
The content type of the upload will be determined in order
of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The default value ('application/octet-stream')... | storage/google/cloud/storage/blob.py | def upload_from_file(
self,
file_obj,
rewind=False,
size=None,
content_type=None,
num_retries=None,
client=None,
predefined_acl=None,
):
"""Upload the contents of this blob from a file-like object.
The content type of the upload will b... | def upload_from_file(
self,
file_obj,
rewind=False,
size=None,
content_type=None,
num_retries=None,
client=None,
predefined_acl=None,
):
"""Upload the contents of this blob from a file-like object.
The content type of the upload will b... | [
"Upload",
"the",
"contents",
"of",
"this",
"blob",
"from",
"a",
"file",
"-",
"like",
"object",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1072-L1161 | [
"def",
"upload_from_file",
"(",
"self",
",",
"file_obj",
",",
"rewind",
"=",
"False",
",",
"size",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"num_retries",
"=",
"None",
",",
"client",
"=",
"None",
",",
"predefined_acl",
"=",
"None",
",",
")",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.upload_from_filename | Upload this blob's contents from the content of a named file.
The content type of the upload will be determined in order
of precedence:
- The value passed in to this method (if not :data:`None`)
- The value stored on the current blob
- The value given by ``mimetypes.guess_type`... | storage/google/cloud/storage/blob.py | def upload_from_filename(
self, filename, content_type=None, client=None, predefined_acl=None
):
"""Upload this blob's contents from the content of a named file.
The content type of the upload will be determined in order
of precedence:
- The value passed in to this method (... | def upload_from_filename(
self, filename, content_type=None, client=None, predefined_acl=None
):
"""Upload this blob's contents from the content of a named file.
The content type of the upload will be determined in order
of precedence:
- The value passed in to this method (... | [
"Upload",
"this",
"blob",
"s",
"contents",
"from",
"the",
"content",
"of",
"a",
"named",
"file",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1163-L1213 | [
"def",
"upload_from_filename",
"(",
"self",
",",
"filename",
",",
"content_type",
"=",
"None",
",",
"client",
"=",
"None",
",",
"predefined_acl",
"=",
"None",
")",
":",
"content_type",
"=",
"self",
".",
"_get_content_type",
"(",
"content_type",
",",
"filename"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.upload_from_string | Upload contents of this blob from the provided string.
.. note::
The effect of uploading to an existing blob depends on the
"versioning" and "lifecycle" policies defined on the blob's
bucket. In the absence of those policies, upload will
overwrite any existing conte... | storage/google/cloud/storage/blob.py | def upload_from_string(
self, data, content_type="text/plain", client=None, predefined_acl=None
):
"""Upload contents of this blob from the provided string.
.. note::
The effect of uploading to an existing blob depends on the
"versioning" and "lifecycle" policies defin... | def upload_from_string(
self, data, content_type="text/plain", client=None, predefined_acl=None
):
"""Upload contents of this blob from the provided string.
.. note::
The effect of uploading to an existing blob depends on the
"versioning" and "lifecycle" policies defin... | [
"Upload",
"contents",
"of",
"this",
"blob",
"from",
"the",
"provided",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1215-L1258 | [
"def",
"upload_from_string",
"(",
"self",
",",
"data",
",",
"content_type",
"=",
"\"text/plain\"",
",",
"client",
"=",
"None",
",",
"predefined_acl",
"=",
"None",
")",
":",
"data",
"=",
"_to_bytes",
"(",
"data",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"str... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.create_resumable_upload_session | Create a resumable upload session.
Resumable upload sessions allow you to start an upload session from
one client and complete the session in another. This method is called
by the initiator to set the metadata and limits. The initiator then
passes the session URL to the client that will... | storage/google/cloud/storage/blob.py | def create_resumable_upload_session(
self, content_type=None, size=None, origin=None, client=None
):
"""Create a resumable upload session.
Resumable upload sessions allow you to start an upload session from
one client and complete the session in another. This method is called
... | def create_resumable_upload_session(
self, content_type=None, size=None, origin=None, client=None
):
"""Create a resumable upload session.
Resumable upload sessions allow you to start an upload session from
one client and complete the session in another. This method is called
... | [
"Create",
"a",
"resumable",
"upload",
"session",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1260-L1351 | [
"def",
"create_resumable_upload_session",
"(",
"self",
",",
"content_type",
"=",
"None",
",",
"size",
"=",
"None",
",",
"origin",
"=",
"None",
",",
"client",
"=",
"None",
")",
":",
"extra_headers",
"=",
"{",
"}",
"if",
"origin",
"is",
"not",
"None",
":",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.make_public | Update blob's ACL, granting read access to anonymous users.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. If not passed, falls back
to the ``client`` stored on the blob's bucket. | storage/google/cloud/storage/blob.py | def make_public(self, client=None):
"""Update blob's ACL, granting read access to anonymous users.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. If not passed, falls back
to th... | def make_public(self, client=None):
"""Update blob's ACL, granting read access to anonymous users.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. If not passed, falls back
to th... | [
"Update",
"blob",
"s",
"ACL",
"granting",
"read",
"access",
"to",
"anonymous",
"users",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1474-L1483 | [
"def",
"make_public",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"self",
".",
"acl",
".",
"all",
"(",
")",
".",
"grant_read",
"(",
")",
"self",
".",
"acl",
".",
"save",
"(",
"client",
"=",
"client",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.make_private | Update blob's ACL, revoking read access for anonymous users.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. If not passed, falls back
to the ``client`` stored on the blob's bucket. | storage/google/cloud/storage/blob.py | def make_private(self, client=None):
"""Update blob's ACL, revoking read access for anonymous users.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. If not passed, falls back
to ... | def make_private(self, client=None):
"""Update blob's ACL, revoking read access for anonymous users.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. If not passed, falls back
to ... | [
"Update",
"blob",
"s",
"ACL",
"revoking",
"read",
"access",
"for",
"anonymous",
"users",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1485-L1494 | [
"def",
"make_private",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"self",
".",
"acl",
".",
"all",
"(",
")",
".",
"revoke_read",
"(",
")",
"self",
".",
"acl",
".",
"save",
"(",
"client",
"=",
"client",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.compose | Concatenate source blobs into this one.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type sources: list of :class:`Blob`
:param sources: blobs whose contents will be composed into this blob.
:type client: :class:`~google.cloud.storage.c... | storage/google/cloud/storage/blob.py | def compose(self, sources, client=None):
"""Concatenate source blobs into this one.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type sources: list of :class:`Blob`
:param sources: blobs whose contents will be composed into this blob.
... | def compose(self, sources, client=None):
"""Concatenate source blobs into this one.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type sources: list of :class:`Blob`
:param sources: blobs whose contents will be composed into this blob.
... | [
"Concatenate",
"source",
"blobs",
"into",
"this",
"one",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1496-L1527 | [
"def",
"compose",
"(",
"self",
",",
"sources",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"query_params",
"=",
"{",
"}",
"if",
"self",
".",
"user_project",
"is",
"not",
"None",
":",
"query_p... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.rewrite | Rewrite source blob into this one.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type source: :class:`Blob`
:param source: blob whose contents will be rewritten into this blob.
:type token: str
:param token: Optional. Token retur... | storage/google/cloud/storage/blob.py | def rewrite(self, source, token=None, client=None):
"""Rewrite source blob into this one.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type source: :class:`Blob`
:param source: blob whose contents will be rewritten into this blob.
... | def rewrite(self, source, token=None, client=None):
"""Rewrite source blob into this one.
If :attr:`user_project` is set on the bucket, bills the API request
to that project.
:type source: :class:`Blob`
:param source: blob whose contents will be rewritten into this blob.
... | [
"Rewrite",
"source",
"blob",
"into",
"this",
"one",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1529-L1590 | [
"def",
"rewrite",
"(",
"self",
",",
"source",
",",
"token",
"=",
"None",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"headers",
"=",
"_get_encryption_headers",
"(",
"self",
".",
"_encryption_key"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Blob.update_storage_class | Update blob's storage class via a rewrite-in-place. This helper will
wait for the rewrite to complete before returning, so it may take some
time for large files.
See
https://cloud.google.com/storage/docs/per-object-storage-class
If :attr:`user_project` is set on the bucket, bil... | storage/google/cloud/storage/blob.py | def update_storage_class(self, new_class, client=None):
"""Update blob's storage class via a rewrite-in-place. This helper will
wait for the rewrite to complete before returning, so it may take some
time for large files.
See
https://cloud.google.com/storage/docs/per-object-stora... | def update_storage_class(self, new_class, client=None):
"""Update blob's storage class via a rewrite-in-place. This helper will
wait for the rewrite to complete before returning, so it may take some
time for large files.
See
https://cloud.google.com/storage/docs/per-object-stora... | [
"Update",
"blob",
"s",
"storage",
"class",
"via",
"a",
"rewrite",
"-",
"in",
"-",
"place",
".",
"This",
"helper",
"will",
"wait",
"for",
"the",
"rewrite",
"to",
"complete",
"before",
"returning",
"so",
"it",
"may",
"take",
"some",
"time",
"for",
"large",... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1592-L1619 | [
"def",
"update_storage_class",
"(",
"self",
",",
"new_class",
",",
"client",
"=",
"None",
")",
":",
"if",
"new_class",
"not",
"in",
"self",
".",
"_STORAGE_CLASSES",
":",
"raise",
"ValueError",
"(",
"\"Invalid storage class: %s\"",
"%",
"(",
"new_class",
",",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | verify_path | Verifies that a ``path`` has the correct form.
Checks that all of the elements in ``path`` are strings.
Args:
path (Tuple[str, ...]): The components in a collection or
document path.
is_collection (bool): Indicates if the ``path`` represents
a document or a collection.
... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def verify_path(path, is_collection):
"""Verifies that a ``path`` has the correct form.
Checks that all of the elements in ``path`` are strings.
Args:
path (Tuple[str, ...]): The components in a collection or
document path.
is_collection (bool): Indicates if the ``path`` repres... | def verify_path(path, is_collection):
"""Verifies that a ``path`` has the correct form.
Checks that all of the elements in ``path`` are strings.
Args:
path (Tuple[str, ...]): The components in a collection or
document path.
is_collection (bool): Indicates if the ``path`` repres... | [
"Verifies",
"that",
"a",
"path",
"has",
"the",
"correct",
"form",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L104-L137 | [
"def",
"verify_path",
"(",
"path",
",",
"is_collection",
")",
":",
"num_elements",
"=",
"len",
"(",
"path",
")",
"if",
"num_elements",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"Document or collection path cannot be empty\"",
")",
"if",
"is_collection",
":",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | encode_value | Converts a native Python value into a Firestore protobuf ``Value``.
Args:
value (Union[NoneType, bool, int, float, datetime.datetime, \
str, bytes, dict, ~google.cloud.Firestore.GeoPoint]): A native
Python value to convert to a protobuf field.
Returns:
~google.cloud.fir... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def encode_value(value):
"""Converts a native Python value into a Firestore protobuf ``Value``.
Args:
value (Union[NoneType, bool, int, float, datetime.datetime, \
str, bytes, dict, ~google.cloud.Firestore.GeoPoint]): A native
Python value to convert to a protobuf field.
Re... | def encode_value(value):
"""Converts a native Python value into a Firestore protobuf ``Value``.
Args:
value (Union[NoneType, bool, int, float, datetime.datetime, \
str, bytes, dict, ~google.cloud.Firestore.GeoPoint]): A native
Python value to convert to a protobuf field.
Re... | [
"Converts",
"a",
"native",
"Python",
"value",
"into",
"a",
"Firestore",
"protobuf",
"Value",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L140-L201 | [
"def",
"encode_value",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"document_pb2",
".",
"Value",
"(",
"null_value",
"=",
"struct_pb2",
".",
"NULL_VALUE",
")",
"# Must come before six.integer_types since ``bool`` is an integer subtype.",
"if",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | encode_dict | Encode a dictionary into protobuf ``Value``-s.
Args:
values_dict (dict): The dictionary to encode as protobuf fields.
Returns:
Dict[str, ~google.cloud.firestore_v1beta1.types.Value]: A
dictionary of string keys and ``Value`` protobufs as dictionary
values. | firestore/google/cloud/firestore_v1beta1/_helpers.py | def encode_dict(values_dict):
"""Encode a dictionary into protobuf ``Value``-s.
Args:
values_dict (dict): The dictionary to encode as protobuf fields.
Returns:
Dict[str, ~google.cloud.firestore_v1beta1.types.Value]: A
dictionary of string keys and ``Value`` protobufs as dictionary
... | def encode_dict(values_dict):
"""Encode a dictionary into protobuf ``Value``-s.
Args:
values_dict (dict): The dictionary to encode as protobuf fields.
Returns:
Dict[str, ~google.cloud.firestore_v1beta1.types.Value]: A
dictionary of string keys and ``Value`` protobufs as dictionary
... | [
"Encode",
"a",
"dictionary",
"into",
"protobuf",
"Value",
"-",
"s",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L204-L215 | [
"def",
"encode_dict",
"(",
"values_dict",
")",
":",
"return",
"{",
"key",
":",
"encode_value",
"(",
"value",
")",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"values_dict",
")",
"}"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | reference_value_to_document | Convert a reference value string to a document.
Args:
reference_value (str): A document reference value.
client (~.firestore_v1beta1.client.Client): A client that has
a document factory.
Returns:
~.firestore_v1beta1.document.DocumentReference: The document
correspon... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def reference_value_to_document(reference_value, client):
"""Convert a reference value string to a document.
Args:
reference_value (str): A document reference value.
client (~.firestore_v1beta1.client.Client): A client that has
a document factory.
Returns:
~.firestore_v... | def reference_value_to_document(reference_value, client):
"""Convert a reference value string to a document.
Args:
reference_value (str): A document reference value.
client (~.firestore_v1beta1.client.Client): A client that has
a document factory.
Returns:
~.firestore_v... | [
"Convert",
"a",
"reference",
"value",
"string",
"to",
"a",
"document",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L218-L249 | [
"def",
"reference_value_to_document",
"(",
"reference_value",
",",
"client",
")",
":",
"# The first 5 parts are",
"# projects, {project}, databases, {database}, documents",
"parts",
"=",
"reference_value",
".",
"split",
"(",
"DOCUMENT_PATH_DELIMITER",
",",
"5",
")",
"if",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | decode_value | Converts a Firestore protobuf ``Value`` to a native Python value.
Args:
value (google.cloud.firestore_v1beta1.types.Value): A
Firestore protobuf to be decoded / parsed / converted.
client (~.firestore_v1beta1.client.Client): A client that has
a document factory.
Returns... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def decode_value(value, client):
"""Converts a Firestore protobuf ``Value`` to a native Python value.
Args:
value (google.cloud.firestore_v1beta1.types.Value): A
Firestore protobuf to be decoded / parsed / converted.
client (~.firestore_v1beta1.client.Client): A client that has
... | def decode_value(value, client):
"""Converts a Firestore protobuf ``Value`` to a native Python value.
Args:
value (google.cloud.firestore_v1beta1.types.Value): A
Firestore protobuf to be decoded / parsed / converted.
client (~.firestore_v1beta1.client.Client): A client that has
... | [
"Converts",
"a",
"Firestore",
"protobuf",
"Value",
"to",
"a",
"native",
"Python",
"value",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L252-L295 | [
"def",
"decode_value",
"(",
"value",
",",
"client",
")",
":",
"value_type",
"=",
"value",
".",
"WhichOneof",
"(",
"\"value_type\"",
")",
"if",
"value_type",
"==",
"\"null_value\"",
":",
"return",
"None",
"elif",
"value_type",
"==",
"\"boolean_value\"",
":",
"r... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | decode_dict | Converts a protobuf map of Firestore ``Value``-s.
Args:
value_fields (google.protobuf.pyext._message.MessageMapContainer): A
protobuf map of Firestore ``Value``-s.
client (~.firestore_v1beta1.client.Client): A client that has
a document factory.
Returns:
Dict[st... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def decode_dict(value_fields, client):
"""Converts a protobuf map of Firestore ``Value``-s.
Args:
value_fields (google.protobuf.pyext._message.MessageMapContainer): A
protobuf map of Firestore ``Value``-s.
client (~.firestore_v1beta1.client.Client): A client that has
a d... | def decode_dict(value_fields, client):
"""Converts a protobuf map of Firestore ``Value``-s.
Args:
value_fields (google.protobuf.pyext._message.MessageMapContainer): A
protobuf map of Firestore ``Value``-s.
client (~.firestore_v1beta1.client.Client): A client that has
a d... | [
"Converts",
"a",
"protobuf",
"map",
"of",
"Firestore",
"Value",
"-",
"s",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L298-L314 | [
"def",
"decode_dict",
"(",
"value_fields",
",",
"client",
")",
":",
"return",
"{",
"key",
":",
"decode_value",
"(",
"value",
",",
"client",
")",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"value_fields",
")",
"}"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | get_doc_id | Parse a document ID from a document protobuf.
Args:
document_pb (google.cloud.proto.firestore.v1beta1.\
document_pb2.Document): A protobuf for a document that
was created in a ``CreateDocument`` RPC.
expected_prefix (str): The expected collection prefix for the
f... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def get_doc_id(document_pb, expected_prefix):
"""Parse a document ID from a document protobuf.
Args:
document_pb (google.cloud.proto.firestore.v1beta1.\
document_pb2.Document): A protobuf for a document that
was created in a ``CreateDocument`` RPC.
expected_prefix (str):... | def get_doc_id(document_pb, expected_prefix):
"""Parse a document ID from a document protobuf.
Args:
document_pb (google.cloud.proto.firestore.v1beta1.\
document_pb2.Document): A protobuf for a document that
was created in a ``CreateDocument`` RPC.
expected_prefix (str):... | [
"Parse",
"a",
"document",
"ID",
"from",
"a",
"document",
"protobuf",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L317-L342 | [
"def",
"get_doc_id",
"(",
"document_pb",
",",
"expected_prefix",
")",
":",
"prefix",
",",
"document_id",
"=",
"document_pb",
".",
"name",
".",
"rsplit",
"(",
"DOCUMENT_PATH_DELIMITER",
",",
"1",
")",
"if",
"prefix",
"!=",
"expected_prefix",
":",
"raise",
"Valu... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | extract_fields | Do depth-first walk of tree, yielding field_path, value | firestore/google/cloud/firestore_v1beta1/_helpers.py | def extract_fields(document_data, prefix_path, expand_dots=False):
"""Do depth-first walk of tree, yielding field_path, value"""
if not document_data:
yield prefix_path, _EmptyDict
else:
for key, value in sorted(six.iteritems(document_data)):
if expand_dots:
sub_... | def extract_fields(document_data, prefix_path, expand_dots=False):
"""Do depth-first walk of tree, yielding field_path, value"""
if not document_data:
yield prefix_path, _EmptyDict
else:
for key, value in sorted(six.iteritems(document_data)):
if expand_dots:
sub_... | [
"Do",
"depth",
"-",
"first",
"walk",
"of",
"tree",
"yielding",
"field_path",
"value"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L348-L366 | [
"def",
"extract_fields",
"(",
"document_data",
",",
"prefix_path",
",",
"expand_dots",
"=",
"False",
")",
":",
"if",
"not",
"document_data",
":",
"yield",
"prefix_path",
",",
"_EmptyDict",
"else",
":",
"for",
"key",
",",
"value",
"in",
"sorted",
"(",
"six",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | set_field_value | Set a value into a document for a field_path | firestore/google/cloud/firestore_v1beta1/_helpers.py | def set_field_value(document_data, field_path, value):
"""Set a value into a document for a field_path"""
current = document_data
for element in field_path.parts[:-1]:
current = current.setdefault(element, {})
if value is _EmptyDict:
value = {}
current[field_path.parts[-1]] = value | def set_field_value(document_data, field_path, value):
"""Set a value into a document for a field_path"""
current = document_data
for element in field_path.parts[:-1]:
current = current.setdefault(element, {})
if value is _EmptyDict:
value = {}
current[field_path.parts[-1]] = value | [
"Set",
"a",
"value",
"into",
"a",
"document",
"for",
"a",
"field_path"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L369-L376 | [
"def",
"set_field_value",
"(",
"document_data",
",",
"field_path",
",",
"value",
")",
":",
"current",
"=",
"document_data",
"for",
"element",
"in",
"field_path",
".",
"parts",
"[",
":",
"-",
"1",
"]",
":",
"current",
"=",
"current",
".",
"setdefault",
"(",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | pbs_for_create | Make ``Write`` protobufs for ``create()`` methods.
Args:
document_path (str): A fully-qualified document path.
document_data (dict): Property names and values to use for
creating a document.
Returns:
List[google.cloud.firestore_v1beta1.types.Write]: One or two
``Wri... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def pbs_for_create(document_path, document_data):
"""Make ``Write`` protobufs for ``create()`` methods.
Args:
document_path (str): A fully-qualified document path.
document_data (dict): Property names and values to use for
creating a document.
Returns:
List[google.cloud... | def pbs_for_create(document_path, document_data):
"""Make ``Write`` protobufs for ``create()`` methods.
Args:
document_path (str): A fully-qualified document path.
document_data (dict): Property names and values to use for
creating a document.
Returns:
List[google.cloud... | [
"Make",
"Write",
"protobufs",
"for",
"create",
"()",
"methods",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L520-L549 | [
"def",
"pbs_for_create",
"(",
"document_path",
",",
"document_data",
")",
":",
"extractor",
"=",
"DocumentExtractor",
"(",
"document_data",
")",
"if",
"extractor",
".",
"deleted_fields",
":",
"raise",
"ValueError",
"(",
"\"Cannot apply DELETE_FIELD in a create request.\""... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | pbs_for_set_no_merge | Make ``Write`` protobufs for ``set()`` methods.
Args:
document_path (str): A fully-qualified document path.
document_data (dict): Property names and values to use for
replacing a document.
Returns:
List[google.cloud.firestore_v1beta1.types.Write]: One
or two ``Write... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def pbs_for_set_no_merge(document_path, document_data):
"""Make ``Write`` protobufs for ``set()`` methods.
Args:
document_path (str): A fully-qualified document path.
document_data (dict): Property names and values to use for
replacing a document.
Returns:
List[google.c... | def pbs_for_set_no_merge(document_path, document_data):
"""Make ``Write`` protobufs for ``set()`` methods.
Args:
document_path (str): A fully-qualified document path.
document_data (dict): Property names and values to use for
replacing a document.
Returns:
List[google.c... | [
"Make",
"Write",
"protobufs",
"for",
"set",
"()",
"methods",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L552-L580 | [
"def",
"pbs_for_set_no_merge",
"(",
"document_path",
",",
"document_data",
")",
":",
"extractor",
"=",
"DocumentExtractor",
"(",
"document_data",
")",
"if",
"extractor",
".",
"deleted_fields",
":",
"raise",
"ValueError",
"(",
"\"Cannot apply DELETE_FIELD in a set request ... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | pbs_for_set_with_merge | Make ``Write`` protobufs for ``set()`` methods.
Args:
document_path (str): A fully-qualified document path.
document_data (dict): Property names and values to use for
replacing a document.
merge (Optional[bool] or Optional[List<apispec>]):
If True, merge all fields; ... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def pbs_for_set_with_merge(document_path, document_data, merge):
"""Make ``Write`` protobufs for ``set()`` methods.
Args:
document_path (str): A fully-qualified document path.
document_data (dict): Property names and values to use for
replacing a document.
merge (Optional[bo... | def pbs_for_set_with_merge(document_path, document_data, merge):
"""Make ``Write`` protobufs for ``set()`` methods.
Args:
document_path (str): A fully-qualified document path.
document_data (dict): Property names and values to use for
replacing a document.
merge (Optional[bo... | [
"Make",
"Write",
"protobufs",
"for",
"set",
"()",
"methods",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L722-L752 | [
"def",
"pbs_for_set_with_merge",
"(",
"document_path",
",",
"document_data",
",",
"merge",
")",
":",
"extractor",
"=",
"DocumentExtractorForMerge",
"(",
"document_data",
")",
"extractor",
".",
"apply_merge",
"(",
"merge",
")",
"merge_empty",
"=",
"not",
"document_da... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | pbs_for_update | Make ``Write`` protobufs for ``update()`` methods.
Args:
document_path (str): A fully-qualified document path.
field_updates (dict): Field names or paths to update and values
to update with.
option (optional[~.firestore_v1beta1.client.WriteOption]): A
write option to ... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def pbs_for_update(document_path, field_updates, option):
"""Make ``Write`` protobufs for ``update()`` methods.
Args:
document_path (str): A fully-qualified document path.
field_updates (dict): Field names or paths to update and values
to update with.
option (optional[~.fire... | def pbs_for_update(document_path, field_updates, option):
"""Make ``Write`` protobufs for ``update()`` methods.
Args:
document_path (str): A fully-qualified document path.
field_updates (dict): Field names or paths to update and values
to update with.
option (optional[~.fire... | [
"Make",
"Write",
"protobufs",
"for",
"update",
"()",
"methods",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L796-L834 | [
"def",
"pbs_for_update",
"(",
"document_path",
",",
"field_updates",
",",
"option",
")",
":",
"extractor",
"=",
"DocumentExtractorForUpdate",
"(",
"field_updates",
")",
"if",
"extractor",
".",
"empty_document",
":",
"raise",
"ValueError",
"(",
"\"Cannot update with an... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | pb_for_delete | Make a ``Write`` protobuf for ``delete()`` methods.
Args:
document_path (str): A fully-qualified document path.
option (optional[~.firestore_v1beta1.client.WriteOption]): A
write option to make assertions / preconditions on the server
state of the document before applying chan... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def pb_for_delete(document_path, option):
"""Make a ``Write`` protobuf for ``delete()`` methods.
Args:
document_path (str): A fully-qualified document path.
option (optional[~.firestore_v1beta1.client.WriteOption]): A
write option to make assertions / preconditions on the server
... | def pb_for_delete(document_path, option):
"""Make a ``Write`` protobuf for ``delete()`` methods.
Args:
document_path (str): A fully-qualified document path.
option (optional[~.firestore_v1beta1.client.WriteOption]): A
write option to make assertions / preconditions on the server
... | [
"Make",
"a",
"Write",
"protobuf",
"for",
"delete",
"()",
"methods",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L837-L854 | [
"def",
"pb_for_delete",
"(",
"document_path",
",",
"option",
")",
":",
"write_pb",
"=",
"write_pb2",
".",
"Write",
"(",
"delete",
"=",
"document_path",
")",
"if",
"option",
"is",
"not",
"None",
":",
"option",
".",
"modify_write",
"(",
"write_pb",
")",
"ret... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | get_transaction_id | Get the transaction ID from a ``Transaction`` object.
Args:
transaction (Optional[~.firestore_v1beta1.transaction.\
Transaction]): An existing transaction that this query will
run in.
read_operation (Optional[bool]): Indicates if the transaction ID
will be used i... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def get_transaction_id(transaction, read_operation=True):
"""Get the transaction ID from a ``Transaction`` object.
Args:
transaction (Optional[~.firestore_v1beta1.transaction.\
Transaction]): An existing transaction that this query will
run in.
read_operation (Optional[b... | def get_transaction_id(transaction, read_operation=True):
"""Get the transaction ID from a ``Transaction`` object.
Args:
transaction (Optional[~.firestore_v1beta1.transaction.\
Transaction]): An existing transaction that this query will
run in.
read_operation (Optional[b... | [
"Get",
"the",
"transaction",
"ID",
"from",
"a",
"Transaction",
"object",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L864-L891 | [
"def",
"get_transaction_id",
"(",
"transaction",
",",
"read_operation",
"=",
"True",
")",
":",
"if",
"transaction",
"is",
"None",
":",
"return",
"None",
"else",
":",
"if",
"not",
"transaction",
".",
"in_progress",
":",
"raise",
"ValueError",
"(",
"INACTIVE_TXN... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | LastUpdateOption.modify_write | Modify a ``Write`` protobuf based on the state of this write option.
The ``last_update_time`` is added to ``write_pb`` as an "update time"
precondition. When set, the target document must exist and have been
last updated at that time.
Args:
write_pb (google.cloud.firestore_... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def modify_write(self, write_pb, **unused_kwargs):
"""Modify a ``Write`` protobuf based on the state of this write option.
The ``last_update_time`` is added to ``write_pb`` as an "update time"
precondition. When set, the target document must exist and have been
last updated at that time... | def modify_write(self, write_pb, **unused_kwargs):
"""Modify a ``Write`` protobuf based on the state of this write option.
The ``last_update_time`` is added to ``write_pb`` as an "update time"
precondition. When set, the target document must exist and have been
last updated at that time... | [
"Modify",
"a",
"Write",
"protobuf",
"based",
"on",
"the",
"state",
"of",
"this",
"write",
"option",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L949-L964 | [
"def",
"modify_write",
"(",
"self",
",",
"write_pb",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"current_doc",
"=",
"types",
".",
"Precondition",
"(",
"update_time",
"=",
"self",
".",
"_last_update_time",
")",
"write_pb",
".",
"current_document",
".",
"CopyFrom... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ExistsOption.modify_write | Modify a ``Write`` protobuf based on the state of this write option.
If:
* ``exists=True``, adds a precondition that requires existence
* ``exists=False``, adds a precondition that requires non-existence
Args:
write_pb (google.cloud.firestore_v1beta1.types.Write): A
... | firestore/google/cloud/firestore_v1beta1/_helpers.py | def modify_write(self, write_pb, **unused_kwargs):
"""Modify a ``Write`` protobuf based on the state of this write option.
If:
* ``exists=True``, adds a precondition that requires existence
* ``exists=False``, adds a precondition that requires non-existence
Args:
w... | def modify_write(self, write_pb, **unused_kwargs):
"""Modify a ``Write`` protobuf based on the state of this write option.
If:
* ``exists=True``, adds a precondition that requires existence
* ``exists=False``, adds a precondition that requires non-existence
Args:
w... | [
"Modify",
"a",
"Write",
"protobuf",
"based",
"on",
"the",
"state",
"of",
"this",
"write",
"option",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/_helpers.py#L986-L1002 | [
"def",
"modify_write",
"(",
"self",
",",
"write_pb",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"current_doc",
"=",
"types",
".",
"Precondition",
"(",
"exists",
"=",
"self",
".",
"_exists",
")",
"write_pb",
".",
"current_document",
".",
"CopyFrom",
"(",
"cu... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | UptimeCheckServiceClient.uptime_check_config_path | Return a fully-qualified uptime_check_config string. | monitoring/google/cloud/monitoring_v3/gapic/uptime_check_service_client.py | def uptime_check_config_path(cls, project, uptime_check_config):
"""Return a fully-qualified uptime_check_config string."""
return google.api_core.path_template.expand(
"projects/{project}/uptimeCheckConfigs/{uptime_check_config}",
project=project,
uptime_check_config... | def uptime_check_config_path(cls, project, uptime_check_config):
"""Return a fully-qualified uptime_check_config string."""
return google.api_core.path_template.expand(
"projects/{project}/uptimeCheckConfigs/{uptime_check_config}",
project=project,
uptime_check_config... | [
"Return",
"a",
"fully",
"-",
"qualified",
"uptime_check_config",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/gapic/uptime_check_service_client.py#L110-L116 | [
"def",
"uptime_check_config_path",
"(",
"cls",
",",
"project",
",",
"uptime_check_config",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/uptimeCheckConfigs/{uptime_check_config}\"",
",",
"project",
"=",
"p... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | UptimeCheckServiceClient.create_uptime_check_config | Creates a new uptime check configuration.
Example:
>>> from google.cloud import monitoring_v3
>>>
>>> client = monitoring_v3.UptimeCheckServiceClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # TODO: Initializ... | monitoring/google/cloud/monitoring_v3/gapic/uptime_check_service_client.py | def create_uptime_check_config(
self,
parent,
uptime_check_config,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a new uptime check configuration.
Example:
... | def create_uptime_check_config(
self,
parent,
uptime_check_config,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a new uptime check configuration.
Example:
... | [
"Creates",
"a",
"new",
"uptime",
"check",
"configuration",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/gapic/uptime_check_service_client.py#L398-L479 | [
"def",
"create_uptime_check_config",
"(",
"self",
",",
"parent",
",",
"uptime_check_config",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | VideoIntelligenceServiceClient.annotate_video | Performs asynchronous video annotation. Progress and results can be
retrieved through the ``google.longrunning.Operations`` interface.
``Operation.metadata`` contains ``AnnotateVideoProgress`` (progress).
``Operation.response`` contains ``AnnotateVideoResponse`` (results).
Example:
... | videointelligence/google/cloud/videointelligence_v1beta2/gapic/video_intelligence_service_client.py | def annotate_video(
self,
input_uri=None,
input_content=None,
features=None,
video_context=None,
output_uri=None,
location_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=Non... | def annotate_video(
self,
input_uri=None,
input_content=None,
features=None,
video_context=None,
output_uri=None,
location_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=Non... | [
"Performs",
"asynchronous",
"video",
"annotation",
".",
"Progress",
"and",
"results",
"can",
"be",
"retrieved",
"through",
"the",
"google",
".",
"longrunning",
".",
"Operations",
"interface",
".",
"Operation",
".",
"metadata",
"contains",
"AnnotateVideoProgress",
"(... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/videointelligence/google/cloud/videointelligence_v1beta2/gapic/video_intelligence_service_client.py#L175-L289 | [
"def",
"annotate_video",
"(",
"self",
",",
"input_uri",
"=",
"None",
",",
"input_content",
"=",
"None",
",",
"features",
"=",
"None",
",",
"video_context",
"=",
"None",
",",
"output_uri",
"=",
"None",
",",
"location_id",
"=",
"None",
",",
"retry",
"=",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Policy.owners | Legacy access to owner role.
DEPRECATED: use ``policy["roles/owners"]`` instead. | api_core/google/api_core/iam.py | def owners(self):
"""Legacy access to owner role.
DEPRECATED: use ``policy["roles/owners"]`` instead."""
result = set()
for role in self._OWNER_ROLES:
for member in self._bindings.get(role, ()):
result.add(member)
return frozenset(result) | def owners(self):
"""Legacy access to owner role.
DEPRECATED: use ``policy["roles/owners"]`` instead."""
result = set()
for role in self._OWNER_ROLES:
for member in self._bindings.get(role, ()):
result.add(member)
return frozenset(result) | [
"Legacy",
"access",
"to",
"owner",
"role",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/iam.py#L99-L107 | [
"def",
"owners",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"role",
"in",
"self",
".",
"_OWNER_ROLES",
":",
"for",
"member",
"in",
"self",
".",
"_bindings",
".",
"get",
"(",
"role",
",",
"(",
")",
")",
":",
"result",
".",
"add"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Policy.owners | Update owners.
DEPRECATED: use ``policy["roles/owners"] = value`` instead. | api_core/google/api_core/iam.py | def owners(self, value):
"""Update owners.
DEPRECATED: use ``policy["roles/owners"] = value`` instead."""
warnings.warn(
_ASSIGNMENT_DEPRECATED_MSG.format("owners", OWNER_ROLE), DeprecationWarning
)
self[OWNER_ROLE] = value | def owners(self, value):
"""Update owners.
DEPRECATED: use ``policy["roles/owners"] = value`` instead."""
warnings.warn(
_ASSIGNMENT_DEPRECATED_MSG.format("owners", OWNER_ROLE), DeprecationWarning
)
self[OWNER_ROLE] = value | [
"Update",
"owners",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/iam.py#L110-L117 | [
"def",
"owners",
"(",
"self",
",",
"value",
")",
":",
"warnings",
".",
"warn",
"(",
"_ASSIGNMENT_DEPRECATED_MSG",
".",
"format",
"(",
"\"owners\"",
",",
"OWNER_ROLE",
")",
",",
"DeprecationWarning",
")",
"self",
"[",
"OWNER_ROLE",
"]",
"=",
"value"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Policy.editors | Legacy access to editor role.
DEPRECATED: use ``policy["roles/editors"]`` instead. | api_core/google/api_core/iam.py | def editors(self):
"""Legacy access to editor role.
DEPRECATED: use ``policy["roles/editors"]`` instead."""
result = set()
for role in self._EDITOR_ROLES:
for member in self._bindings.get(role, ()):
result.add(member)
return frozenset(result) | def editors(self):
"""Legacy access to editor role.
DEPRECATED: use ``policy["roles/editors"]`` instead."""
result = set()
for role in self._EDITOR_ROLES:
for member in self._bindings.get(role, ()):
result.add(member)
return frozenset(result) | [
"Legacy",
"access",
"to",
"editor",
"role",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/iam.py#L120-L128 | [
"def",
"editors",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"role",
"in",
"self",
".",
"_EDITOR_ROLES",
":",
"for",
"member",
"in",
"self",
".",
"_bindings",
".",
"get",
"(",
"role",
",",
"(",
")",
")",
":",
"result",
".",
"ad... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Policy.editors | Update editors.
DEPRECATED: use ``policy["roles/editors"] = value`` instead. | api_core/google/api_core/iam.py | def editors(self, value):
"""Update editors.
DEPRECATED: use ``policy["roles/editors"] = value`` instead."""
warnings.warn(
_ASSIGNMENT_DEPRECATED_MSG.format("editors", EDITOR_ROLE),
DeprecationWarning,
)
self[EDITOR_ROLE] = value | def editors(self, value):
"""Update editors.
DEPRECATED: use ``policy["roles/editors"] = value`` instead."""
warnings.warn(
_ASSIGNMENT_DEPRECATED_MSG.format("editors", EDITOR_ROLE),
DeprecationWarning,
)
self[EDITOR_ROLE] = value | [
"Update",
"editors",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/iam.py#L131-L139 | [
"def",
"editors",
"(",
"self",
",",
"value",
")",
":",
"warnings",
".",
"warn",
"(",
"_ASSIGNMENT_DEPRECATED_MSG",
".",
"format",
"(",
"\"editors\"",
",",
"EDITOR_ROLE",
")",
",",
"DeprecationWarning",
",",
")",
"self",
"[",
"EDITOR_ROLE",
"]",
"=",
"value"
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Policy.viewers | Legacy access to viewer role.
DEPRECATED: use ``policy["roles/viewers"]`` instead | api_core/google/api_core/iam.py | def viewers(self):
"""Legacy access to viewer role.
DEPRECATED: use ``policy["roles/viewers"]`` instead
"""
result = set()
for role in self._VIEWER_ROLES:
for member in self._bindings.get(role, ()):
result.add(member)
return frozenset(result) | def viewers(self):
"""Legacy access to viewer role.
DEPRECATED: use ``policy["roles/viewers"]`` instead
"""
result = set()
for role in self._VIEWER_ROLES:
for member in self._bindings.get(role, ()):
result.add(member)
return frozenset(result) | [
"Legacy",
"access",
"to",
"viewer",
"role",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/iam.py#L142-L151 | [
"def",
"viewers",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"role",
"in",
"self",
".",
"_VIEWER_ROLES",
":",
"for",
"member",
"in",
"self",
".",
"_bindings",
".",
"get",
"(",
"role",
",",
"(",
")",
")",
":",
"result",
".",
"ad... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Policy.viewers | Update viewers.
DEPRECATED: use ``policy["roles/viewers"] = value`` instead. | api_core/google/api_core/iam.py | def viewers(self, value):
"""Update viewers.
DEPRECATED: use ``policy["roles/viewers"] = value`` instead.
"""
warnings.warn(
_ASSIGNMENT_DEPRECATED_MSG.format("viewers", VIEWER_ROLE),
DeprecationWarning,
)
self[VIEWER_ROLE] = value | def viewers(self, value):
"""Update viewers.
DEPRECATED: use ``policy["roles/viewers"] = value`` instead.
"""
warnings.warn(
_ASSIGNMENT_DEPRECATED_MSG.format("viewers", VIEWER_ROLE),
DeprecationWarning,
)
self[VIEWER_ROLE] = value | [
"Update",
"viewers",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/iam.py#L154-L163 | [
"def",
"viewers",
"(",
"self",
",",
"value",
")",
":",
"warnings",
".",
"warn",
"(",
"_ASSIGNMENT_DEPRECATED_MSG",
".",
"format",
"(",
"\"viewers\"",
",",
"VIEWER_ROLE",
")",
",",
"DeprecationWarning",
",",
")",
"self",
"[",
"VIEWER_ROLE",
"]",
"=",
"value"
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Policy.from_api_repr | Factory: create a policy from a JSON resource.
Args:
resource (dict): policy resource returned by ``getIamPolicy`` API.
Returns:
:class:`Policy`: the parsed policy | api_core/google/api_core/iam.py | def from_api_repr(cls, resource):
"""Factory: create a policy from a JSON resource.
Args:
resource (dict): policy resource returned by ``getIamPolicy`` API.
Returns:
:class:`Policy`: the parsed policy
"""
version = resource.get("version")
etag = ... | def from_api_repr(cls, resource):
"""Factory: create a policy from a JSON resource.
Args:
resource (dict): policy resource returned by ``getIamPolicy`` API.
Returns:
:class:`Policy`: the parsed policy
"""
version = resource.get("version")
etag = ... | [
"Factory",
":",
"create",
"a",
"policy",
"from",
"a",
"JSON",
"resource",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/iam.py#L232-L248 | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
")",
":",
"version",
"=",
"resource",
".",
"get",
"(",
"\"version\"",
")",
"etag",
"=",
"resource",
".",
"get",
"(",
"\"etag\"",
")",
"policy",
"=",
"cls",
"(",
"etag",
",",
"version",
")",
"for",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Policy.to_api_repr | Render a JSON policy resource.
Returns:
dict: a resource to be passed to the ``setIamPolicy`` API. | api_core/google/api_core/iam.py | def to_api_repr(self):
"""Render a JSON policy resource.
Returns:
dict: a resource to be passed to the ``setIamPolicy`` API.
"""
resource = {}
if self.etag is not None:
resource["etag"] = self.etag
if self.version is not None:
resour... | def to_api_repr(self):
"""Render a JSON policy resource.
Returns:
dict: a resource to be passed to the ``setIamPolicy`` API.
"""
resource = {}
if self.etag is not None:
resource["etag"] = self.etag
if self.version is not None:
resour... | [
"Render",
"a",
"JSON",
"policy",
"resource",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/iam.py#L250-L273 | [
"def",
"to_api_repr",
"(",
"self",
")",
":",
"resource",
"=",
"{",
"}",
"if",
"self",
".",
"etag",
"is",
"not",
"None",
":",
"resource",
"[",
"\"etag\"",
"]",
"=",
"self",
".",
"etag",
"if",
"self",
".",
"version",
"is",
"not",
"None",
":",
"resour... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _reference_info | Get information about document references.
Helper for :meth:`~.firestore_v1beta1.client.Client.get_all`.
Args:
references (List[.DocumentReference, ...]): Iterable of document
references.
Returns:
Tuple[List[str, ...], Dict[str, .DocumentReference]]: A two-tuple of
* ... | firestore/google/cloud/firestore_v1beta1/client.py | def _reference_info(references):
"""Get information about document references.
Helper for :meth:`~.firestore_v1beta1.client.Client.get_all`.
Args:
references (List[.DocumentReference, ...]): Iterable of document
references.
Returns:
Tuple[List[str, ...], Dict[str, .Documen... | def _reference_info(references):
"""Get information about document references.
Helper for :meth:`~.firestore_v1beta1.client.Client.get_all`.
Args:
references (List[.DocumentReference, ...]): Iterable of document
references.
Returns:
Tuple[List[str, ...], Dict[str, .Documen... | [
"Get",
"information",
"about",
"document",
"references",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/client.py#L385-L409 | [
"def",
"_reference_info",
"(",
"references",
")",
":",
"document_paths",
"=",
"[",
"]",
"reference_map",
"=",
"{",
"}",
"for",
"reference",
"in",
"references",
":",
"doc_path",
"=",
"reference",
".",
"_document_path",
"document_paths",
".",
"append",
"(",
"doc... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _get_reference | Get a document reference from a dictionary.
This just wraps a simple dictionary look-up with a helpful error that is
specific to :meth:`~.firestore.client.Client.get_all`, the
**public** caller of this function.
Args:
document_path (str): A fully-qualified document path.
reference_map ... | firestore/google/cloud/firestore_v1beta1/client.py | def _get_reference(document_path, reference_map):
"""Get a document reference from a dictionary.
This just wraps a simple dictionary look-up with a helpful error that is
specific to :meth:`~.firestore.client.Client.get_all`, the
**public** caller of this function.
Args:
document_path (str)... | def _get_reference(document_path, reference_map):
"""Get a document reference from a dictionary.
This just wraps a simple dictionary look-up with a helpful error that is
specific to :meth:`~.firestore.client.Client.get_all`, the
**public** caller of this function.
Args:
document_path (str)... | [
"Get",
"a",
"document",
"reference",
"from",
"a",
"dictionary",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/client.py#L412-L435 | [
"def",
"_get_reference",
"(",
"document_path",
",",
"reference_map",
")",
":",
"try",
":",
"return",
"reference_map",
"[",
"document_path",
"]",
"except",
"KeyError",
":",
"msg",
"=",
"_BAD_DOC_TEMPLATE",
".",
"format",
"(",
"document_path",
")",
"raise",
"Value... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _parse_batch_get | Parse a `BatchGetDocumentsResponse` protobuf.
Args:
get_doc_response (~google.cloud.proto.firestore.v1beta1.\
firestore_pb2.BatchGetDocumentsResponse): A single response (from
a stream) containing the "get" response for a document.
reference_map (Dict[str, .DocumentReference... | firestore/google/cloud/firestore_v1beta1/client.py | def _parse_batch_get(get_doc_response, reference_map, client):
"""Parse a `BatchGetDocumentsResponse` protobuf.
Args:
get_doc_response (~google.cloud.proto.firestore.v1beta1.\
firestore_pb2.BatchGetDocumentsResponse): A single response (from
a stream) containing the "get" respon... | def _parse_batch_get(get_doc_response, reference_map, client):
"""Parse a `BatchGetDocumentsResponse` protobuf.
Args:
get_doc_response (~google.cloud.proto.firestore.v1beta1.\
firestore_pb2.BatchGetDocumentsResponse): A single response (from
a stream) containing the "get" respon... | [
"Parse",
"a",
"BatchGetDocumentsResponse",
"protobuf",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/client.py#L438-L484 | [
"def",
"_parse_batch_get",
"(",
"get_doc_response",
",",
"reference_map",
",",
"client",
")",
":",
"result_type",
"=",
"get_doc_response",
".",
"WhichOneof",
"(",
"\"result\"",
")",
"if",
"result_type",
"==",
"\"found\"",
":",
"reference",
"=",
"_get_reference",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client._firestore_api | Lazy-loading getter GAPIC Firestore API.
Returns:
~.gapic.firestore.v1beta1.firestore_client.FirestoreClient: The
GAPIC client with the credentials of the current client. | firestore/google/cloud/firestore_v1beta1/client.py | def _firestore_api(self):
"""Lazy-loading getter GAPIC Firestore API.
Returns:
~.gapic.firestore.v1beta1.firestore_client.FirestoreClient: The
GAPIC client with the credentials of the current client.
"""
if self._firestore_api_internal is None:
self._... | def _firestore_api(self):
"""Lazy-loading getter GAPIC Firestore API.
Returns:
~.gapic.firestore.v1beta1.firestore_client.FirestoreClient: The
GAPIC client with the credentials of the current client.
"""
if self._firestore_api_internal is None:
self._... | [
"Lazy",
"-",
"loading",
"getter",
"GAPIC",
"Firestore",
"API",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/client.py#L91-L103 | [
"def",
"_firestore_api",
"(",
"self",
")",
":",
"if",
"self",
".",
"_firestore_api_internal",
"is",
"None",
":",
"self",
".",
"_firestore_api_internal",
"=",
"firestore_client",
".",
"FirestoreClient",
"(",
"credentials",
"=",
"self",
".",
"_credentials",
")",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.