repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
googleapis/google-cloud-python | core/google/cloud/operation.py | register_type | def register_type(klass, type_url=None):
"""Register a klass as the factory for a given type URL.
:type klass: :class:`type`
:param klass: class to be used as a factory for the given type
:type type_url: str
:param type_url: (Optional) URL naming the type. If not provided,
inf... | python | def register_type(klass, type_url=None):
"""Register a klass as the factory for a given type URL.
:type klass: :class:`type`
:param klass: class to be used as a factory for the given type
:type type_url: str
:param type_url: (Optional) URL naming the type. If not provided,
inf... | [
"def",
"register_type",
"(",
"klass",
",",
"type_url",
"=",
"None",
")",
":",
"if",
"type_url",
"is",
"None",
":",
"type_url",
"=",
"_compute_type_url",
"(",
"klass",
")",
"if",
"type_url",
"in",
"_TYPE_URL_MAP",
":",
"if",
"_TYPE_URL_MAP",
"[",
"type_url",
... | Register a klass as the factory for a given type URL.
:type klass: :class:`type`
:param klass: class to be used as a factory for the given type
:type type_url: str
:param type_url: (Optional) URL naming the type. If not provided,
infers the URL from the type descriptor.
:rais... | [
"Register",
"a",
"klass",
"as",
"the",
"factory",
"for",
"a",
"given",
"type",
"URL",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/operation.py#L42-L60 | train |
googleapis/google-cloud-python | core/google/cloud/operation.py | _from_any | def _from_any(any_pb):
"""Convert an ``Any`` protobuf into the actual class.
Uses the type URL to do the conversion.
.. note::
This assumes that the type URL is already registered.
:type any_pb: :class:`google.protobuf.any_pb2.Any`
:param any_pb: An any object to be converted.
:rtyp... | python | def _from_any(any_pb):
"""Convert an ``Any`` protobuf into the actual class.
Uses the type URL to do the conversion.
.. note::
This assumes that the type URL is already registered.
:type any_pb: :class:`google.protobuf.any_pb2.Any`
:param any_pb: An any object to be converted.
:rtyp... | [
"def",
"_from_any",
"(",
"any_pb",
")",
":",
"klass",
"=",
"_TYPE_URL_MAP",
"[",
"any_pb",
".",
"type_url",
"]",
"return",
"klass",
".",
"FromString",
"(",
"any_pb",
".",
"value",
")"
] | Convert an ``Any`` protobuf into the actual class.
Uses the type URL to do the conversion.
.. note::
This assumes that the type URL is already registered.
:type any_pb: :class:`google.protobuf.any_pb2.Any`
:param any_pb: An any object to be converted.
:rtype: object
:returns: The in... | [
"Convert",
"an",
"Any",
"protobuf",
"into",
"the",
"actual",
"class",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/operation.py#L63-L80 | train |
googleapis/google-cloud-python | core/google/cloud/operation.py | Operation.from_pb | def from_pb(cls, operation_pb, client, **caller_metadata):
"""Factory: construct an instance from a protobuf.
:type operation_pb:
:class:`~google.longrunning.operations_pb2.Operation`
:param operation_pb: Protobuf to be parsed.
:type client: object: must provide ``_operati... | python | def from_pb(cls, operation_pb, client, **caller_metadata):
"""Factory: construct an instance from a protobuf.
:type operation_pb:
:class:`~google.longrunning.operations_pb2.Operation`
:param operation_pb: Protobuf to be parsed.
:type client: object: must provide ``_operati... | [
"def",
"from_pb",
"(",
"cls",
",",
"operation_pb",
",",
"client",
",",
"*",
"*",
"caller_metadata",
")",
":",
"result",
"=",
"cls",
"(",
"operation_pb",
".",
"name",
",",
"client",
",",
"*",
"*",
"caller_metadata",
")",
"result",
".",
"_update_state",
"(... | Factory: construct an instance from a protobuf.
:type operation_pb:
:class:`~google.longrunning.operations_pb2.Operation`
:param operation_pb: Protobuf to be parsed.
:type client: object: must provide ``_operations_stub`` accessor.
:param client: The client used to poll fo... | [
"Factory",
":",
"construct",
"an",
"instance",
"from",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/operation.py#L147-L166 | train |
googleapis/google-cloud-python | core/google/cloud/operation.py | Operation.from_dict | def from_dict(cls, operation, client, **caller_metadata):
"""Factory: construct an instance from a dictionary.
:type operation: dict
:param operation: Operation as a JSON object.
:type client: :class:`~google.cloud.client.Client`
:param client: The client used to poll for the s... | python | def from_dict(cls, operation, client, **caller_metadata):
"""Factory: construct an instance from a dictionary.
:type operation: dict
:param operation: Operation as a JSON object.
:type client: :class:`~google.cloud.client.Client`
:param client: The client used to poll for the s... | [
"def",
"from_dict",
"(",
"cls",
",",
"operation",
",",
"client",
",",
"*",
"*",
"caller_metadata",
")",
":",
"operation_pb",
"=",
"json_format",
".",
"ParseDict",
"(",
"operation",
",",
"operations_pb2",
".",
"Operation",
"(",
")",
")",
"result",
"=",
"cls... | Factory: construct an instance from a dictionary.
:type operation: dict
:param operation: Operation as a JSON object.
:type client: :class:`~google.cloud.client.Client`
:param client: The client used to poll for the status of the operation.
:type caller_metadata: dict
... | [
"Factory",
":",
"construct",
"an",
"instance",
"from",
"a",
"dictionary",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/operation.py#L169-L188 | train |
googleapis/google-cloud-python | core/google/cloud/operation.py | Operation._get_operation_rpc | def _get_operation_rpc(self):
"""Polls the status of the current operation.
Uses gRPC request to check.
:rtype: :class:`~google.longrunning.operations_pb2.Operation`
:returns: The latest status of the current operation.
"""
request_pb = operations_pb2.GetOperationReques... | python | def _get_operation_rpc(self):
"""Polls the status of the current operation.
Uses gRPC request to check.
:rtype: :class:`~google.longrunning.operations_pb2.Operation`
:returns: The latest status of the current operation.
"""
request_pb = operations_pb2.GetOperationReques... | [
"def",
"_get_operation_rpc",
"(",
"self",
")",
":",
"request_pb",
"=",
"operations_pb2",
".",
"GetOperationRequest",
"(",
"name",
"=",
"self",
".",
"name",
")",
"return",
"self",
".",
"client",
".",
"_operations_stub",
".",
"GetOperation",
"(",
"request_pb",
"... | Polls the status of the current operation.
Uses gRPC request to check.
:rtype: :class:`~google.longrunning.operations_pb2.Operation`
:returns: The latest status of the current operation. | [
"Polls",
"the",
"status",
"of",
"the",
"current",
"operation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/operation.py#L199-L208 | train |
googleapis/google-cloud-python | core/google/cloud/operation.py | Operation._get_operation_http | def _get_operation_http(self):
"""Checks the status of the current operation.
Uses HTTP request to check.
:rtype: :class:`~google.longrunning.operations_pb2.Operation`
:returns: The latest status of the current operation.
"""
path = "operations/%s" % (self.name,)
... | python | def _get_operation_http(self):
"""Checks the status of the current operation.
Uses HTTP request to check.
:rtype: :class:`~google.longrunning.operations_pb2.Operation`
:returns: The latest status of the current operation.
"""
path = "operations/%s" % (self.name,)
... | [
"def",
"_get_operation_http",
"(",
"self",
")",
":",
"path",
"=",
"\"operations/%s\"",
"%",
"(",
"self",
".",
"name",
",",
")",
"api_response",
"=",
"self",
".",
"client",
".",
"_connection",
".",
"api_request",
"(",
"method",
"=",
"\"GET\"",
",",
"path",
... | Checks the status of the current operation.
Uses HTTP request to check.
:rtype: :class:`~google.longrunning.operations_pb2.Operation`
:returns: The latest status of the current operation. | [
"Checks",
"the",
"status",
"of",
"the",
"current",
"operation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/operation.py#L210-L220 | train |
googleapis/google-cloud-python | core/google/cloud/operation.py | Operation._update_state | def _update_state(self, operation_pb):
"""Update the state of the current object based on operation.
:type operation_pb:
:class:`~google.longrunning.operations_pb2.Operation`
:param operation_pb: Protobuf to be parsed.
"""
if operation_pb.done:
self._comp... | python | def _update_state(self, operation_pb):
"""Update the state of the current object based on operation.
:type operation_pb:
:class:`~google.longrunning.operations_pb2.Operation`
:param operation_pb: Protobuf to be parsed.
"""
if operation_pb.done:
self._comp... | [
"def",
"_update_state",
"(",
"self",
",",
"operation_pb",
")",
":",
"if",
"operation_pb",
".",
"done",
":",
"self",
".",
"_complete",
"=",
"True",
"if",
"operation_pb",
".",
"HasField",
"(",
"\"metadata\"",
")",
":",
"self",
".",
"metadata",
"=",
"_from_an... | Update the state of the current object based on operation.
:type operation_pb:
:class:`~google.longrunning.operations_pb2.Operation`
:param operation_pb: Protobuf to be parsed. | [
"Update",
"the",
"state",
"of",
"the",
"current",
"object",
"based",
"on",
"operation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/operation.py#L233-L250 | train |
googleapis/google-cloud-python | core/google/cloud/operation.py | Operation.poll | def poll(self):
"""Check if the operation has finished.
:rtype: bool
:returns: A boolean indicating if the current operation has completed.
:raises ValueError: if the operation
has already completed.
"""
if self.complete:
raise ValueError("Th... | python | def poll(self):
"""Check if the operation has finished.
:rtype: bool
:returns: A boolean indicating if the current operation has completed.
:raises ValueError: if the operation
has already completed.
"""
if self.complete:
raise ValueError("Th... | [
"def",
"poll",
"(",
"self",
")",
":",
"if",
"self",
".",
"complete",
":",
"raise",
"ValueError",
"(",
"\"The operation has completed.\"",
")",
"operation_pb",
"=",
"self",
".",
"_get_operation",
"(",
")",
"self",
".",
"_update_state",
"(",
"operation_pb",
")",... | Check if the operation has finished.
:rtype: bool
:returns: A boolean indicating if the current operation has completed.
:raises ValueError: if the operation
has already completed. | [
"Check",
"if",
"the",
"operation",
"has",
"finished",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/operation.py#L252-L266 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | _parse_rmw_row_response | def _parse_rmw_row_response(row_response):
"""Parses the response to a ``ReadModifyWriteRow`` request.
:type row_response: :class:`.data_v2_pb2.Row`
:param row_response: The response row (with only modified cells) from a
``ReadModifyWriteRow`` request.
:rtype: dict
:return... | python | def _parse_rmw_row_response(row_response):
"""Parses the response to a ``ReadModifyWriteRow`` request.
:type row_response: :class:`.data_v2_pb2.Row`
:param row_response: The response row (with only modified cells) from a
``ReadModifyWriteRow`` request.
:rtype: dict
:return... | [
"def",
"_parse_rmw_row_response",
"(",
"row_response",
")",
":",
"result",
"=",
"{",
"}",
"for",
"column_family",
"in",
"row_response",
".",
"row",
".",
"families",
":",
"column_family_id",
",",
"curr_family",
"=",
"_parse_family_pb",
"(",
"column_family",
")",
... | Parses the response to a ``ReadModifyWriteRow`` request.
:type row_response: :class:`.data_v2_pb2.Row`
:param row_response: The response row (with only modified cells) from a
``ReadModifyWriteRow`` request.
:rtype: dict
:returns: The new contents of all modified cells. Returne... | [
"Parses",
"the",
"response",
"to",
"a",
"ReadModifyWriteRow",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L921-L958 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | _parse_family_pb | def _parse_family_pb(family_pb):
"""Parses a Family protobuf into a dictionary.
:type family_pb: :class:`._generated.data_pb2.Family`
:param family_pb: A protobuf
:rtype: tuple
:returns: A string and dictionary. The string is the name of the
column family and the dictionary has colum... | python | def _parse_family_pb(family_pb):
"""Parses a Family protobuf into a dictionary.
:type family_pb: :class:`._generated.data_pb2.Family`
:param family_pb: A protobuf
:rtype: tuple
:returns: A string and dictionary. The string is the name of the
column family and the dictionary has colum... | [
"def",
"_parse_family_pb",
"(",
"family_pb",
")",
":",
"result",
"=",
"{",
"}",
"for",
"column",
"in",
"family_pb",
".",
"columns",
":",
"result",
"[",
"column",
".",
"qualifier",
"]",
"=",
"cells",
"=",
"[",
"]",
"for",
"cell",
"in",
"column",
".",
... | Parses a Family protobuf into a dictionary.
:type family_pb: :class:`._generated.data_pb2.Family`
:param family_pb: A protobuf
:rtype: tuple
:returns: A string and dictionary. The string is the name of the
column family and the dictionary has column names (within the
family... | [
"Parses",
"a",
"Family",
"protobuf",
"into",
"a",
"dictionary",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L961-L993 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | _SetDeleteRow._set_cell | def _set_cell(self, column_family_id, column, value, timestamp=None, state=None):
"""Helper for :meth:`set_cell`
Adds a mutation to set the value in a specific cell.
``state`` is unused by :class:`DirectRow` but is used by
subclasses.
:type column_family_id: str
:param... | python | def _set_cell(self, column_family_id, column, value, timestamp=None, state=None):
"""Helper for :meth:`set_cell`
Adds a mutation to set the value in a specific cell.
``state`` is unused by :class:`DirectRow` but is used by
subclasses.
:type column_family_id: str
:param... | [
"def",
"_set_cell",
"(",
"self",
",",
"column_family_id",
",",
"column",
",",
"value",
",",
"timestamp",
"=",
"None",
",",
"state",
"=",
"None",
")",
":",
"column",
"=",
"_to_bytes",
"(",
"column",
")",
"if",
"isinstance",
"(",
"value",
",",
"six",
"."... | Helper for :meth:`set_cell`
Adds a mutation to set the value in a specific cell.
``state`` is unused by :class:`DirectRow` but is used by
subclasses.
:type column_family_id: str
:param column_family_id: The column family that contains the column.
... | [
"Helper",
"for",
":",
"meth",
":",
"set_cell"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L122-L170 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | _SetDeleteRow._delete | def _delete(self, state=None):
"""Helper for :meth:`delete`
Adds a delete mutation (for the entire row) to the accumulated
mutations.
``state`` is unused by :class:`DirectRow` but is used by
subclasses.
:type state: bool
:param state: (Optional) The state that ... | python | def _delete(self, state=None):
"""Helper for :meth:`delete`
Adds a delete mutation (for the entire row) to the accumulated
mutations.
``state`` is unused by :class:`DirectRow` but is used by
subclasses.
:type state: bool
:param state: (Optional) The state that ... | [
"def",
"_delete",
"(",
"self",
",",
"state",
"=",
"None",
")",
":",
"mutation_val",
"=",
"data_v2_pb2",
".",
"Mutation",
".",
"DeleteFromRow",
"(",
")",
"mutation_pb",
"=",
"data_v2_pb2",
".",
"Mutation",
"(",
"delete_from_row",
"=",
"mutation_val",
")",
"se... | Helper for :meth:`delete`
Adds a delete mutation (for the entire row) to the accumulated
mutations.
``state`` is unused by :class:`DirectRow` but is used by
subclasses.
:type state: bool
:param state: (Optional) The state that is passed along to
:... | [
"Helper",
"for",
":",
"meth",
":",
"delete"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L172-L187 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | _SetDeleteRow._delete_cells | def _delete_cells(self, column_family_id, columns, time_range=None, state=None):
"""Helper for :meth:`delete_cell` and :meth:`delete_cells`.
``state`` is unused by :class:`DirectRow` but is used by
subclasses.
:type column_family_id: str
:param column_family_id: The column fami... | python | def _delete_cells(self, column_family_id, columns, time_range=None, state=None):
"""Helper for :meth:`delete_cell` and :meth:`delete_cells`.
``state`` is unused by :class:`DirectRow` but is used by
subclasses.
:type column_family_id: str
:param column_family_id: The column fami... | [
"def",
"_delete_cells",
"(",
"self",
",",
"column_family_id",
",",
"columns",
",",
"time_range",
"=",
"None",
",",
"state",
"=",
"None",
")",
":",
"mutations_list",
"=",
"self",
".",
"_get_mutations",
"(",
"state",
")",
"if",
"columns",
"is",
"self",
".",
... | Helper for :meth:`delete_cell` and :meth:`delete_cells`.
``state`` is unused by :class:`DirectRow` but is used by
subclasses.
:type column_family_id: str
:param column_family_id: The column family that contains the column
or columns with cells being del... | [
"Helper",
"for",
":",
"meth",
":",
"delete_cell",
"and",
":",
"meth",
":",
"delete_cells",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L189-L240 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | DirectRow.get_mutations_size | def get_mutations_size(self):
""" Gets the total mutations size for current row
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_row_get_mutations_size]
:end-before: [END bigtable_row_get_mutations_size]
"""
mutation_siz... | python | def get_mutations_size(self):
""" Gets the total mutations size for current row
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_row_get_mutations_size]
:end-before: [END bigtable_row_get_mutations_size]
"""
mutation_siz... | [
"def",
"get_mutations_size",
"(",
"self",
")",
":",
"mutation_size",
"=",
"0",
"for",
"mutation",
"in",
"self",
".",
"_get_mutations",
"(",
")",
":",
"mutation_size",
"+=",
"mutation",
".",
"ByteSize",
"(",
")",
"return",
"mutation_size"
] | Gets the total mutations size for current row
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_row_get_mutations_size]
:end-before: [END bigtable_row_get_mutations_size] | [
"Gets",
"the",
"total",
"mutations",
"size",
"for",
"current",
"row"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L295-L310 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | DirectRow.set_cell | def set_cell(self, column_family_id, column, value, timestamp=None):
"""Sets a value in this row.
The cell is determined by the ``row_key`` of this :class:`DirectRow`
and the ``column``. The ``column`` must be in an existing
:class:`.ColumnFamily` (as determined by ``column_family_id``)... | python | def set_cell(self, column_family_id, column, value, timestamp=None):
"""Sets a value in this row.
The cell is determined by the ``row_key`` of this :class:`DirectRow`
and the ``column``. The ``column`` must be in an existing
:class:`.ColumnFamily` (as determined by ``column_family_id``)... | [
"def",
"set_cell",
"(",
"self",
",",
"column_family_id",
",",
"column",
",",
"value",
",",
"timestamp",
"=",
"None",
")",
":",
"self",
".",
"_set_cell",
"(",
"column_family_id",
",",
"column",
",",
"value",
",",
"timestamp",
"=",
"timestamp",
",",
"state",... | Sets a value in this row.
The cell is determined by the ``row_key`` of this :class:`DirectRow`
and the ``column``. The ``column`` must be in an existing
:class:`.ColumnFamily` (as determined by ``column_family_id``).
.. note::
This method adds a mutation to the accumulated... | [
"Sets",
"a",
"value",
"in",
"this",
"row",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L312-L349 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | DirectRow.delete_cell | def delete_cell(self, column_family_id, column, time_range=None):
"""Deletes cell in this row.
.. note::
This method adds a mutation to the accumulated mutations on this
row, but does not make an API request. To actually
send an API request (with the mutations) to t... | python | def delete_cell(self, column_family_id, column, time_range=None):
"""Deletes cell in this row.
.. note::
This method adds a mutation to the accumulated mutations on this
row, but does not make an API request. To actually
send an API request (with the mutations) to t... | [
"def",
"delete_cell",
"(",
"self",
",",
"column_family_id",
",",
"column",
",",
"time_range",
"=",
"None",
")",
":",
"self",
".",
"_delete_cells",
"(",
"column_family_id",
",",
"[",
"column",
"]",
",",
"time_range",
"=",
"time_range",
",",
"state",
"=",
"N... | Deletes cell in this row.
.. note::
This method adds a mutation to the accumulated mutations on this
row, but does not make an API request. To actually
send an API request (with the mutations) to the Google Cloud
Bigtable API, call :meth:`commit`.
For e... | [
"Deletes",
"cell",
"in",
"this",
"row",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L370-L401 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | DirectRow.delete_cells | def delete_cells(self, column_family_id, columns, time_range=None):
"""Deletes cells in this row.
.. note::
This method adds a mutation to the accumulated mutations on this
row, but does not make an API request. To actually
send an API request (with the mutations) t... | python | def delete_cells(self, column_family_id, columns, time_range=None):
"""Deletes cells in this row.
.. note::
This method adds a mutation to the accumulated mutations on this
row, but does not make an API request. To actually
send an API request (with the mutations) t... | [
"def",
"delete_cells",
"(",
"self",
",",
"column_family_id",
",",
"columns",
",",
"time_range",
"=",
"None",
")",
":",
"self",
".",
"_delete_cells",
"(",
"column_family_id",
",",
"columns",
",",
"time_range",
"=",
"time_range",
",",
"state",
"=",
"None",
")"... | Deletes cells in this row.
.. note::
This method adds a mutation to the accumulated mutations on this
row, but does not make an API request. To actually
send an API request (with the mutations) to the Google Cloud
Bigtable API, call :meth:`commit`.
For ... | [
"Deletes",
"cells",
"in",
"this",
"row",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L403-L434 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | ConditionalRow.commit | def commit(self):
"""Makes a ``CheckAndMutateRow`` API request.
If no mutations have been created in the row, no request is made.
The mutations will be applied conditionally, based on whether the
filter matches any cells in the :class:`ConditionalRow` or not. (Each
method which... | python | def commit(self):
"""Makes a ``CheckAndMutateRow`` API request.
If no mutations have been created in the row, no request is made.
The mutations will be applied conditionally, based on whether the
filter matches any cells in the :class:`ConditionalRow` or not. (Each
method which... | [
"def",
"commit",
"(",
"self",
")",
":",
"true_mutations",
"=",
"self",
".",
"_get_mutations",
"(",
"state",
"=",
"True",
")",
"false_mutations",
"=",
"self",
".",
"_get_mutations",
"(",
"state",
"=",
"False",
")",
"num_true_mutations",
"=",
"len",
"(",
"tr... | Makes a ``CheckAndMutateRow`` API request.
If no mutations have been created in the row, no request is made.
The mutations will be applied conditionally, based on whether the
filter matches any cells in the :class:`ConditionalRow` or not. (Each
method which adds a mutation has a ``stat... | [
"Makes",
"a",
"CheckAndMutateRow",
"API",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L538-L589 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | AppendRow.append_cell_value | def append_cell_value(self, column_family_id, column, value):
"""Appends a value to an existing cell.
.. note::
This method adds a read-modify rule protobuf to the accumulated
read-modify rules on this row, but does not make an API
request. To actually send an API r... | python | def append_cell_value(self, column_family_id, column, value):
"""Appends a value to an existing cell.
.. note::
This method adds a read-modify rule protobuf to the accumulated
read-modify rules on this row, but does not make an API
request. To actually send an API r... | [
"def",
"append_cell_value",
"(",
"self",
",",
"column_family_id",
",",
"column",
",",
"value",
")",
":",
"column",
"=",
"_to_bytes",
"(",
"column",
")",
"value",
"=",
"_to_bytes",
"(",
"value",
")",
"rule_pb",
"=",
"data_v2_pb2",
".",
"ReadModifyWriteRule",
... | Appends a value to an existing cell.
.. note::
This method adds a read-modify rule protobuf to the accumulated
read-modify rules on this row, but does not make an API
request. To actually send an API request (with the rules) to the
Google Cloud Bigtable API, cal... | [
"Appends",
"a",
"value",
"to",
"an",
"existing",
"cell",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L789-L824 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | AppendRow.increment_cell_value | def increment_cell_value(self, column_family_id, column, int_value):
"""Increments a value in an existing cell.
Assumes the value in the cell is stored as a 64 bit integer
serialized to bytes.
.. note::
This method adds a read-modify rule protobuf to the accumulated
... | python | def increment_cell_value(self, column_family_id, column, int_value):
"""Increments a value in an existing cell.
Assumes the value in the cell is stored as a 64 bit integer
serialized to bytes.
.. note::
This method adds a read-modify rule protobuf to the accumulated
... | [
"def",
"increment_cell_value",
"(",
"self",
",",
"column_family_id",
",",
"column",
",",
"int_value",
")",
":",
"column",
"=",
"_to_bytes",
"(",
"column",
")",
"rule_pb",
"=",
"data_v2_pb2",
".",
"ReadModifyWriteRule",
"(",
"family_name",
"=",
"column_family_id",
... | Increments a value in an existing cell.
Assumes the value in the cell is stored as a 64 bit integer
serialized to bytes.
.. note::
This method adds a read-modify rule protobuf to the accumulated
read-modify rules on this row, but does not make an API
reques... | [
"Increments",
"a",
"value",
"in",
"an",
"existing",
"cell",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L826-L868 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/row.py | AppendRow.commit | def commit(self):
"""Makes a ``ReadModifyWriteRow`` API request.
This commits modifications made by :meth:`append_cell_value` and
:meth:`increment_cell_value`. If no modifications were made, makes
no API request and just returns ``{}``.
Modifies a row atomically, reading the la... | python | def commit(self):
"""Makes a ``ReadModifyWriteRow`` API request.
This commits modifications made by :meth:`append_cell_value` and
:meth:`increment_cell_value`. If no modifications were made, makes
no API request and just returns ``{}``.
Modifies a row atomically, reading the la... | [
"def",
"commit",
"(",
"self",
")",
":",
"num_mutations",
"=",
"len",
"(",
"self",
".",
"_rule_pb_list",
")",
"if",
"num_mutations",
"==",
"0",
":",
"return",
"{",
"}",
"if",
"num_mutations",
">",
"MAX_MUTATIONS",
":",
"raise",
"ValueError",
"(",
"\"%d tota... | Makes a ``ReadModifyWriteRow`` API request.
This commits modifications made by :meth:`append_cell_value` and
:meth:`increment_cell_value`. If no modifications were made, makes
no API request and just returns ``{}``.
Modifies a row atomically, reading the latest existing
timesta... | [
"Makes",
"a",
"ReadModifyWriteRow",
"API",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/row.py#L870-L918 | train |
googleapis/google-cloud-python | api_core/google/api_core/gapic_v1/config.py | _retry_from_retry_config | def _retry_from_retry_config(retry_params, retry_codes):
"""Creates a Retry object given a gapic retry configuration.
Args:
retry_params (dict): The retry parameter values, for example::
{
"initial_retry_delay_millis": 1000,
"retry_delay_multiplier": 2.5,
... | python | def _retry_from_retry_config(retry_params, retry_codes):
"""Creates a Retry object given a gapic retry configuration.
Args:
retry_params (dict): The retry parameter values, for example::
{
"initial_retry_delay_millis": 1000,
"retry_delay_multiplier": 2.5,
... | [
"def",
"_retry_from_retry_config",
"(",
"retry_params",
",",
"retry_codes",
")",
":",
"exception_classes",
"=",
"[",
"_exception_class_for_grpc_status_name",
"(",
"code",
")",
"for",
"code",
"in",
"retry_codes",
"]",
"return",
"retry",
".",
"Retry",
"(",
"retry",
... | Creates a Retry object given a gapic retry configuration.
Args:
retry_params (dict): The retry parameter values, for example::
{
"initial_retry_delay_millis": 1000,
"retry_delay_multiplier": 2.5,
"max_retry_delay_millis": 120000,
... | [
"Creates",
"a",
"Retry",
"object",
"given",
"a",
"gapic",
"retry",
"configuration",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/gapic_v1/config.py#L48-L79 | train |
googleapis/google-cloud-python | api_core/google/api_core/gapic_v1/config.py | _timeout_from_retry_config | def _timeout_from_retry_config(retry_params):
"""Creates a ExponentialTimeout object given a gapic retry configuration.
Args:
retry_params (dict): The retry parameter values, for example::
{
"initial_retry_delay_millis": 1000,
"retry_delay_multiplier": 2.5,
... | python | def _timeout_from_retry_config(retry_params):
"""Creates a ExponentialTimeout object given a gapic retry configuration.
Args:
retry_params (dict): The retry parameter values, for example::
{
"initial_retry_delay_millis": 1000,
"retry_delay_multiplier": 2.5,
... | [
"def",
"_timeout_from_retry_config",
"(",
"retry_params",
")",
":",
"return",
"timeout",
".",
"ExponentialTimeout",
"(",
"initial",
"=",
"(",
"retry_params",
"[",
"\"initial_rpc_timeout_millis\"",
"]",
"/",
"_MILLIS_PER_SECOND",
")",
",",
"maximum",
"=",
"(",
"retry... | Creates a ExponentialTimeout object given a gapic retry configuration.
Args:
retry_params (dict): The retry parameter values, for example::
{
"initial_retry_delay_millis": 1000,
"retry_delay_multiplier": 2.5,
"max_retry_delay_millis": 120000,
... | [
"Creates",
"a",
"ExponentialTimeout",
"object",
"given",
"a",
"gapic",
"retry",
"configuration",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/gapic_v1/config.py#L82-L107 | train |
googleapis/google-cloud-python | api_core/google/api_core/gapic_v1/config.py | parse_method_configs | def parse_method_configs(interface_config):
"""Creates default retry and timeout objects for each method in a gapic
interface config.
Args:
interface_config (Mapping): The interface config section of the full
gapic library config. For example, If the full configuration has
a... | python | def parse_method_configs(interface_config):
"""Creates default retry and timeout objects for each method in a gapic
interface config.
Args:
interface_config (Mapping): The interface config section of the full
gapic library config. For example, If the full configuration has
a... | [
"def",
"parse_method_configs",
"(",
"interface_config",
")",
":",
"# Grab all the retry codes",
"retry_codes_map",
"=",
"{",
"name",
":",
"retry_codes",
"for",
"name",
",",
"retry_codes",
"in",
"six",
".",
"iteritems",
"(",
"interface_config",
".",
"get",
"(",
"\"... | Creates default retry and timeout objects for each method in a gapic
interface config.
Args:
interface_config (Mapping): The interface config section of the full
gapic library config. For example, If the full configuration has
an interface named ``google.example.v1.ExampleServic... | [
"Creates",
"default",
"retry",
"and",
"timeout",
"objects",
"for",
"each",
"method",
"in",
"a",
"gapic",
"interface",
"config",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/gapic_v1/config.py#L113-L167 | train |
googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/futures.py | Future.done | def done(self):
"""Return True the future is done, False otherwise.
This still returns True in failure cases; checking :meth:`result` or
:meth:`exception` is the canonical way to assess success or failure.
"""
return self._exception != self._SENTINEL or self._result != self._SEN... | python | def done(self):
"""Return True the future is done, False otherwise.
This still returns True in failure cases; checking :meth:`result` or
:meth:`exception` is the canonical way to assess success or failure.
"""
return self._exception != self._SENTINEL or self._result != self._SEN... | [
"def",
"done",
"(",
"self",
")",
":",
"return",
"self",
".",
"_exception",
"!=",
"self",
".",
"_SENTINEL",
"or",
"self",
".",
"_result",
"!=",
"self",
".",
"_SENTINEL"
] | Return True the future is done, False otherwise.
This still returns True in failure cases; checking :meth:`result` or
:meth:`exception` is the canonical way to assess success or failure. | [
"Return",
"True",
"the",
"future",
"is",
"done",
"False",
"otherwise",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/futures.py#L81-L87 | train |
googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/futures.py | Future.exception | def exception(self, timeout=None):
"""Return the exception raised by the call, if any.
This blocks until the message has successfully been published, and
returns the exception. If the call succeeded, return None.
Args:
timeout (Union[int, float]): The number of seconds befo... | python | def exception(self, timeout=None):
"""Return the exception raised by the call, if any.
This blocks until the message has successfully been published, and
returns the exception. If the call succeeded, return None.
Args:
timeout (Union[int, float]): The number of seconds befo... | [
"def",
"exception",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"# Wait until the future is done.",
"if",
"not",
"self",
".",
"_completed",
".",
"wait",
"(",
"timeout",
"=",
"timeout",
")",
":",
"raise",
"exceptions",
".",
"TimeoutError",
"(",
"\"Tim... | Return the exception raised by the call, if any.
This blocks until the message has successfully been published, and
returns the exception. If the call succeeded, return None.
Args:
timeout (Union[int, float]): The number of seconds before this call
times out and rai... | [
"Return",
"the",
"exception",
"raised",
"by",
"the",
"call",
"if",
"any",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/futures.py#L115-L140 | train |
googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/futures.py | Future.add_done_callback | def add_done_callback(self, fn):
"""Attach the provided callable to the future.
The provided function is called, with this future as its only argument,
when the future finishes running.
"""
if self.done():
return fn(self)
self._callbacks.append(fn) | python | def add_done_callback(self, fn):
"""Attach the provided callable to the future.
The provided function is called, with this future as its only argument,
when the future finishes running.
"""
if self.done():
return fn(self)
self._callbacks.append(fn) | [
"def",
"add_done_callback",
"(",
"self",
",",
"fn",
")",
":",
"if",
"self",
".",
"done",
"(",
")",
":",
"return",
"fn",
"(",
"self",
")",
"self",
".",
"_callbacks",
".",
"append",
"(",
"fn",
")"
] | Attach the provided callable to the future.
The provided function is called, with this future as its only argument,
when the future finishes running. | [
"Attach",
"the",
"provided",
"callable",
"to",
"the",
"future",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/futures.py#L142-L150 | train |
googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/futures.py | Future.set_result | def set_result(self, result):
"""Set the result of the future to the provided result.
Args:
result (Any): The result
"""
# Sanity check: A future can only complete once.
if self.done():
raise RuntimeError("set_result can only be called once.")
# ... | python | def set_result(self, result):
"""Set the result of the future to the provided result.
Args:
result (Any): The result
"""
# Sanity check: A future can only complete once.
if self.done():
raise RuntimeError("set_result can only be called once.")
# ... | [
"def",
"set_result",
"(",
"self",
",",
"result",
")",
":",
"# Sanity check: A future can only complete once.",
"if",
"self",
".",
"done",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"\"set_result can only be called once.\"",
")",
"# Set the result and trigger the future.",... | Set the result of the future to the provided result.
Args:
result (Any): The result | [
"Set",
"the",
"result",
"of",
"the",
"future",
"to",
"the",
"provided",
"result",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/futures.py#L152-L164 | train |
googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/futures.py | Future.set_exception | def set_exception(self, exception):
"""Set the result of the future to the given exception.
Args:
exception (:exc:`Exception`): The exception raised.
"""
# Sanity check: A future can only complete once.
if self.done():
raise RuntimeError("set_exception ca... | python | def set_exception(self, exception):
"""Set the result of the future to the given exception.
Args:
exception (:exc:`Exception`): The exception raised.
"""
# Sanity check: A future can only complete once.
if self.done():
raise RuntimeError("set_exception ca... | [
"def",
"set_exception",
"(",
"self",
",",
"exception",
")",
":",
"# Sanity check: A future can only complete once.",
"if",
"self",
".",
"done",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"\"set_exception can only be called once.\"",
")",
"# Set the exception and trigger t... | Set the result of the future to the given exception.
Args:
exception (:exc:`Exception`): The exception raised. | [
"Set",
"the",
"result",
"of",
"the",
"future",
"to",
"the",
"given",
"exception",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/futures.py#L166-L178 | train |
googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/futures.py | Future._trigger | def _trigger(self):
"""Trigger all callbacks registered to this Future.
This method is called internally by the batch once the batch
completes.
Args:
message_id (str): The message ID, as a string.
"""
self._completed.set()
for callback in self._callb... | python | def _trigger(self):
"""Trigger all callbacks registered to this Future.
This method is called internally by the batch once the batch
completes.
Args:
message_id (str): The message ID, as a string.
"""
self._completed.set()
for callback in self._callb... | [
"def",
"_trigger",
"(",
"self",
")",
":",
"self",
".",
"_completed",
".",
"set",
"(",
")",
"for",
"callback",
"in",
"self",
".",
"_callbacks",
":",
"callback",
"(",
"self",
")"
] | Trigger all callbacks registered to this Future.
This method is called internally by the batch once the batch
completes.
Args:
message_id (str): The message ID, as a string. | [
"Trigger",
"all",
"callbacks",
"registered",
"to",
"this",
"Future",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/futures.py#L180-L191 | train |
googleapis/google-cloud-python | logging/google/cloud/logging/handlers/transports/sync.py | SyncTransport.send | def send(
self, record, message, resource=None, labels=None, trace=None, span_id=None
):
"""Overrides transport.send().
:type record: :class:`logging.LogRecord`
:param record: Python log record that the handler was called with.
:type message: str
:param message: The... | python | def send(
self, record, message, resource=None, labels=None, trace=None, span_id=None
):
"""Overrides transport.send().
:type record: :class:`logging.LogRecord`
:param record: Python log record that the handler was called with.
:type message: str
:param message: The... | [
"def",
"send",
"(",
"self",
",",
"record",
",",
"message",
",",
"resource",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"trace",
"=",
"None",
",",
"span_id",
"=",
"None",
")",
":",
"info",
"=",
"{",
"\"message\"",
":",
"message",
",",
"\"python_log... | Overrides transport.send().
:type record: :class:`logging.LogRecord`
:param record: Python log record that the handler was called with.
:type message: str
:param message: The message from the ``LogRecord`` after being
formatted by the associated log formatters.
... | [
"Overrides",
"transport",
".",
"send",
"()",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/transports/sync.py#L32-L58 | train |
googleapis/google-cloud-python | bigquery_storage/google/cloud/bigquery_storage_v1beta1/gapic/big_query_storage_client.py | BigQueryStorageClient.create_read_session | def create_read_session(
self,
table_reference,
parent,
table_modifiers=None,
requested_streams=None,
read_options=None,
format_=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=... | python | def create_read_session(
self,
table_reference,
parent,
table_modifiers=None,
requested_streams=None,
read_options=None,
format_=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=... | [
"def",
"create_read_session",
"(",
"self",
",",
"table_reference",
",",
"parent",
",",
"table_modifiers",
"=",
"None",
",",
"requested_streams",
"=",
"None",
",",
"read_options",
"=",
"None",
",",
"format_",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"ap... | Creates a new read session. A read session divides the contents of a
BigQuery table into one or more streams, which can then be used to read
data from the table. The read session also specifies properties of the
data to be read, such as a list of columns or a push-down filter describing
... | [
"Creates",
"a",
"new",
"read",
"session",
".",
"A",
"read",
"session",
"divides",
"the",
"contents",
"of",
"a",
"BigQuery",
"table",
"into",
"one",
"or",
"more",
"streams",
"which",
"can",
"then",
"be",
"used",
"to",
"read",
"data",
"from",
"the",
"table... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/gapic/big_query_storage_client.py#L179-L298 | train |
googleapis/google-cloud-python | bigquery_storage/google/cloud/bigquery_storage_v1beta1/gapic/big_query_storage_client.py | BigQueryStorageClient.read_rows | def read_rows(
self,
read_position,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Reads rows from the table in the format prescribed by the read session.
Each response contains one... | python | def read_rows(
self,
read_position,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Reads rows from the table in the format prescribed by the read session.
Each response contains one... | [
"def",
"read_rows",
"(",
"self",
",",
"read_position",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"met... | Reads rows from the table in the format prescribed by the read session.
Each response contains one or more table rows, up to a maximum of 10 MiB
per response; read requests which attempt to read individual rows larger
than this will fail.
Each request also returns a set of stream statis... | [
"Reads",
"rows",
"from",
"the",
"table",
"in",
"the",
"format",
"prescribed",
"by",
"the",
"read",
"session",
".",
"Each",
"response",
"contains",
"one",
"or",
"more",
"table",
"rows",
"up",
"to",
"a",
"maximum",
"of",
"10",
"MiB",
"per",
"response",
";"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/gapic/big_query_storage_client.py#L300-L383 | train |
googleapis/google-cloud-python | bigquery_storage/google/cloud/bigquery_storage_v1beta1/gapic/big_query_storage_client.py | BigQueryStorageClient.batch_create_read_session_streams | def batch_create_read_session_streams(
self,
session,
requested_streams,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates additional streams for a ReadSession. This API can be... | python | def batch_create_read_session_streams(
self,
session,
requested_streams,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates additional streams for a ReadSession. This API can be... | [
"def",
"batch_create_read_session_streams",
"(",
"self",
",",
"session",
",",
"requested_streams",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".... | Creates additional streams for a ReadSession. This API can be used to
dynamically adjust the parallelism of a batch processing task upwards by
adding additional workers.
Example:
>>> from google.cloud import bigquery_storage_v1beta1
>>>
>>> client = bigquery_... | [
"Creates",
"additional",
"streams",
"for",
"a",
"ReadSession",
".",
"This",
"API",
"can",
"be",
"used",
"to",
"dynamically",
"adjust",
"the",
"parallelism",
"of",
"a",
"batch",
"processing",
"task",
"upwards",
"by",
"adding",
"additional",
"workers",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/gapic/big_query_storage_client.py#L385-L472 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/external_config.py | BigtableColumn.qualifier_encoded | def qualifier_encoded(self):
"""Union[str, bytes]: The qualifier encoded in binary.
The type is ``str`` (Python 2.x) or ``bytes`` (Python 3.x). The module
will handle base64 encoding for you.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.... | python | def qualifier_encoded(self):
"""Union[str, bytes]: The qualifier encoded in binary.
The type is ``str`` (Python 2.x) or ``bytes`` (Python 3.x). The module
will handle base64 encoding for you.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.... | [
"def",
"qualifier_encoded",
"(",
"self",
")",
":",
"prop",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"qualifierEncoded\"",
")",
"if",
"prop",
"is",
"None",
":",
"return",
"None",
"return",
"base64",
".",
"standard_b64decode",
"(",
"_to_bytes",
"(",... | Union[str, bytes]: The qualifier encoded in binary.
The type is ``str`` (Python 2.x) or ``bytes`` (Python 3.x). The module
will handle base64 encoding for you.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.%28key%29.bigtableOptio... | [
"Union",
"[",
"str",
"bytes",
"]",
":",
"The",
"qualifier",
"encoded",
"in",
"binary",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/external_config.py#L110-L123 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/external_config.py | BigtableColumnFamily.columns | def columns(self):
"""List[:class:`~.external_config.BigtableColumn`]: Lists of columns
that should be exposed as individual fields.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies.columns
... | python | def columns(self):
"""List[:class:`~.external_config.BigtableColumn`]: Lists of columns
that should be exposed as individual fields.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies.columns
... | [
"def",
"columns",
"(",
"self",
")",
":",
"prop",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"columns\"",
",",
"[",
"]",
")",
"return",
"[",
"BigtableColumn",
".",
"from_api_repr",
"(",
"col",
")",
"for",
"col",
"in",
"prop",
"]"
] | List[:class:`~.external_config.BigtableColumn`]: Lists of columns
that should be exposed as individual fields.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies.columns
https://cloud.google.com/big... | [
"List",
"[",
":",
"class",
":",
"~",
".",
"external_config",
".",
"BigtableColumn",
"]",
":",
"Lists",
"of",
"columns",
"that",
"should",
"be",
"exposed",
"as",
"individual",
"fields",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/external_config.py#L250-L259 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/external_config.py | BigtableOptions.column_families | def column_families(self):
"""List[:class:`~.external_config.BigtableColumnFamily`]: List of
column families to expose in the table schema along with their types.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).bigtableOptions... | python | def column_families(self):
"""List[:class:`~.external_config.BigtableColumnFamily`]: List of
column families to expose in the table schema along with their types.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).bigtableOptions... | [
"def",
"column_families",
"(",
"self",
")",
":",
"prop",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"columnFamilies\"",
",",
"[",
"]",
")",
"return",
"[",
"BigtableColumnFamily",
".",
"from_api_repr",
"(",
"cf",
")",
"for",
"cf",
"in",
"prop",
"... | List[:class:`~.external_config.BigtableColumnFamily`]: List of
column families to expose in the table schema along with their types.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).bigtableOptions.columnFamilies
https://cloud.... | [
"List",
"[",
":",
"class",
":",
"~",
".",
"external_config",
".",
"BigtableColumnFamily",
"]",
":",
"List",
"of",
"column",
"families",
"to",
"expose",
"in",
"the",
"table",
"schema",
"along",
"with",
"their",
"types",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/external_config.py#L335-L344 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/external_config.py | ExternalConfig.schema | def schema(self):
"""List[:class:`~google.cloud.bigquery.schema.SchemaField`]: The schema
for the data.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).schema
https://cloud.google.com/bigquery/docs/reference/rest/v2/ta... | python | def schema(self):
"""List[:class:`~google.cloud.bigquery.schema.SchemaField`]: The schema
for the data.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).schema
https://cloud.google.com/bigquery/docs/reference/rest/v2/ta... | [
"def",
"schema",
"(",
"self",
")",
":",
"prop",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"schema\"",
",",
"{",
"}",
")",
"return",
"[",
"SchemaField",
".",
"from_api_repr",
"(",
"field",
")",
"for",
"field",
"in",
"prop",
".",
"get",
"(",
... | List[:class:`~google.cloud.bigquery.schema.SchemaField`]: The schema
for the data.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.tableDefinitions.(key).schema
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#externalDataConfiguratio... | [
"List",
"[",
":",
"class",
":",
"~google",
".",
"cloud",
".",
"bigquery",
".",
"schema",
".",
"SchemaField",
"]",
":",
"The",
"schema",
"for",
"the",
"data",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/external_config.py#L664-L673 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/external_config.py | ExternalConfig.to_api_repr | def to_api_repr(self):
"""Build an API representation of this object.
Returns:
Dict[str, Any]:
A dictionary in the format used by the BigQuery API.
"""
config = copy.deepcopy(self._properties)
if self.options is not None:
r = self.options.... | python | def to_api_repr(self):
"""Build an API representation of this object.
Returns:
Dict[str, Any]:
A dictionary in the format used by the BigQuery API.
"""
config = copy.deepcopy(self._properties)
if self.options is not None:
r = self.options.... | [
"def",
"to_api_repr",
"(",
"self",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
".",
"_properties",
")",
"if",
"self",
".",
"options",
"is",
"not",
"None",
":",
"r",
"=",
"self",
".",
"options",
".",
"to_api_repr",
"(",
")",
"if",
... | Build an API representation of this object.
Returns:
Dict[str, Any]:
A dictionary in the format used by the BigQuery API. | [
"Build",
"an",
"API",
"representation",
"of",
"this",
"object",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/external_config.py#L682-L694 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/external_config.py | ExternalConfig.from_api_repr | def from_api_repr(cls, resource):
"""Factory: construct an :class:`~.external_config.ExternalConfig`
instance given its API representation.
Args:
resource (Dict[str, Any]):
Definition of an :class:`~.external_config.ExternalConfig`
instance in the sam... | python | def from_api_repr(cls, resource):
"""Factory: construct an :class:`~.external_config.ExternalConfig`
instance given its API representation.
Args:
resource (Dict[str, Any]):
Definition of an :class:`~.external_config.ExternalConfig`
instance in the sam... | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
")",
":",
"config",
"=",
"cls",
"(",
"resource",
"[",
"\"sourceFormat\"",
"]",
")",
"for",
"optcls",
"in",
"_OPTION_CLASSES",
":",
"opts",
"=",
"resource",
".",
"get",
"(",
"optcls",
".",
"_RESOURCE_NAME... | Factory: construct an :class:`~.external_config.ExternalConfig`
instance given its API representation.
Args:
resource (Dict[str, Any]):
Definition of an :class:`~.external_config.ExternalConfig`
instance in the same representation as is returned from the
... | [
"Factory",
":",
"construct",
"an",
":",
"class",
":",
"~",
".",
"external_config",
".",
"ExternalConfig",
"instance",
"given",
"its",
"API",
"representation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/external_config.py#L697-L718 | train |
googleapis/google-cloud-python | bigquery_storage/noxfile.py | lint | def lint(session):
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install('flake8', *LOCAL_DEPS)
session.install('-e', '.')
session.run(
'flake8', os.path.join('google', 'cloud', 'bigquery_storage_v1beta1... | python | def lint(session):
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install('flake8', *LOCAL_DEPS)
session.install('-e', '.')
session.run(
'flake8', os.path.join('google', 'cloud', 'bigquery_storage_v1beta1... | [
"def",
"lint",
"(",
"session",
")",
":",
"session",
".",
"install",
"(",
"'flake8'",
",",
"*",
"LOCAL_DEPS",
")",
"session",
".",
"install",
"(",
"'-e'",
",",
"'.'",
")",
"session",
".",
"run",
"(",
"'flake8'",
",",
"os",
".",
"path",
".",
"join",
... | Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues. | [
"Run",
"linters",
".",
"Returns",
"a",
"failure",
"if",
"the",
"linters",
"find",
"linting",
"errors",
"or",
"sufficiently",
"serious",
"code",
"quality",
"issues",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/noxfile.py#L63-L73 | train |
googleapis/google-cloud-python | bigquery_storage/noxfile.py | system | def system(session):
"""Run the system test suite."""
# Sanity check: Only run system tests if the environment variable is set.
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
session.skip('Credentials must be set via environment variable.')
# Install all test dependencies, then i... | python | def system(session):
"""Run the system test suite."""
# Sanity check: Only run system tests if the environment variable is set.
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
session.skip('Credentials must be set via environment variable.')
# Install all test dependencies, then i... | [
"def",
"system",
"(",
"session",
")",
":",
"# Sanity check: Only run system tests if the environment variable is set.",
"if",
"not",
"os",
".",
"environ",
".",
"get",
"(",
"'GOOGLE_APPLICATION_CREDENTIALS'",
",",
"''",
")",
":",
"session",
".",
"skip",
"(",
"'Credenti... | Run the system test suite. | [
"Run",
"the",
"system",
"test",
"suite",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/noxfile.py#L111-L127 | train |
googleapis/google-cloud-python | bigquery_storage/noxfile.py | docs | def docs(session):
"""Build the docs."""
session.install('sphinx', 'sphinx_rtd_theme')
session.install('-e', '.[pandas,fastavro]')
shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True)
session.run(
'sphinx-build',
'-W', # warnings as errors
'-T', # show full t... | python | def docs(session):
"""Build the docs."""
session.install('sphinx', 'sphinx_rtd_theme')
session.install('-e', '.[pandas,fastavro]')
shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True)
session.run(
'sphinx-build',
'-W', # warnings as errors
'-T', # show full t... | [
"def",
"docs",
"(",
"session",
")",
":",
"session",
".",
"install",
"(",
"'sphinx'",
",",
"'sphinx_rtd_theme'",
")",
"session",
".",
"install",
"(",
"'-e'",
",",
"'.[pandas,fastavro]'",
")",
"shutil",
".",
"rmtree",
"(",
"os",
".",
"path",
".",
"join",
"... | Build the docs. | [
"Build",
"the",
"docs",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/noxfile.py#L152-L168 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | _enum_from_op_string | def _enum_from_op_string(op_string):
"""Convert a string representation of a binary operator to an enum.
These enums come from the protobuf message definition
``StructuredQuery.FieldFilter.Operator``.
Args:
op_string (str): A comparison operation in the form of a string.
Acceptable... | python | def _enum_from_op_string(op_string):
"""Convert a string representation of a binary operator to an enum.
These enums come from the protobuf message definition
``StructuredQuery.FieldFilter.Operator``.
Args:
op_string (str): A comparison operation in the form of a string.
Acceptable... | [
"def",
"_enum_from_op_string",
"(",
"op_string",
")",
":",
"try",
":",
"return",
"_COMPARISON_OPERATORS",
"[",
"op_string",
"]",
"except",
"KeyError",
":",
"choices",
"=",
"\", \"",
".",
"join",
"(",
"sorted",
"(",
"_COMPARISON_OPERATORS",
".",
"keys",
"(",
")... | Convert a string representation of a binary operator to an enum.
These enums come from the protobuf message definition
``StructuredQuery.FieldFilter.Operator``.
Args:
op_string (str): A comparison operation in the form of a string.
Acceptable values are ``<``, ``<=``, ``==``, ``>=``
... | [
"Convert",
"a",
"string",
"representation",
"of",
"a",
"binary",
"operator",
"to",
"an",
"enum",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L825-L847 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | _enum_from_direction | def _enum_from_direction(direction):
"""Convert a string representation of a direction to an enum.
Args:
direction (str): A direction to order by. Must be one of
:attr:`~.firestore.Query.ASCENDING` or
:attr:`~.firestore.Query.DESCENDING`.
Returns:
int: The enum corr... | python | def _enum_from_direction(direction):
"""Convert a string representation of a direction to an enum.
Args:
direction (str): A direction to order by. Must be one of
:attr:`~.firestore.Query.ASCENDING` or
:attr:`~.firestore.Query.DESCENDING`.
Returns:
int: The enum corr... | [
"def",
"_enum_from_direction",
"(",
"direction",
")",
":",
"if",
"isinstance",
"(",
"direction",
",",
"int",
")",
":",
"return",
"direction",
"if",
"direction",
"==",
"Query",
".",
"ASCENDING",
":",
"return",
"enums",
".",
"StructuredQuery",
".",
"Direction",
... | Convert a string representation of a direction to an enum.
Args:
direction (str): A direction to order by. Must be one of
:attr:`~.firestore.Query.ASCENDING` or
:attr:`~.firestore.Query.DESCENDING`.
Returns:
int: The enum corresponding to ``direction``.
Raises:
... | [
"Convert",
"a",
"string",
"representation",
"of",
"a",
"direction",
"to",
"an",
"enum",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L868-L891 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | _filter_pb | def _filter_pb(field_or_unary):
"""Convert a specific protobuf filter to the generic filter type.
Args:
field_or_unary (Union[google.cloud.proto.firestore.v1beta1.\
query_pb2.StructuredQuery.FieldFilter, google.cloud.proto.\
firestore.v1beta1.query_pb2.StructuredQuery.FieldFilte... | python | def _filter_pb(field_or_unary):
"""Convert a specific protobuf filter to the generic filter type.
Args:
field_or_unary (Union[google.cloud.proto.firestore.v1beta1.\
query_pb2.StructuredQuery.FieldFilter, google.cloud.proto.\
firestore.v1beta1.query_pb2.StructuredQuery.FieldFilte... | [
"def",
"_filter_pb",
"(",
"field_or_unary",
")",
":",
"if",
"isinstance",
"(",
"field_or_unary",
",",
"query_pb2",
".",
"StructuredQuery",
".",
"FieldFilter",
")",
":",
"return",
"query_pb2",
".",
"StructuredQuery",
".",
"Filter",
"(",
"field_filter",
"=",
"fiel... | Convert a specific protobuf filter to the generic filter type.
Args:
field_or_unary (Union[google.cloud.proto.firestore.v1beta1.\
query_pb2.StructuredQuery.FieldFilter, google.cloud.proto.\
firestore.v1beta1.query_pb2.StructuredQuery.FieldFilter]): A
field or unary filte... | [
"Convert",
"a",
"specific",
"protobuf",
"filter",
"to",
"the",
"generic",
"filter",
"type",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L894-L915 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | _cursor_pb | def _cursor_pb(cursor_pair):
"""Convert a cursor pair to a protobuf.
If ``cursor_pair`` is :data:`None`, just returns :data:`None`.
Args:
cursor_pair (Optional[Tuple[list, bool]]): Two-tuple of
* a list of field values.
* a ``before`` flag
Returns:
Optional[go... | python | def _cursor_pb(cursor_pair):
"""Convert a cursor pair to a protobuf.
If ``cursor_pair`` is :data:`None`, just returns :data:`None`.
Args:
cursor_pair (Optional[Tuple[list, bool]]): Two-tuple of
* a list of field values.
* a ``before`` flag
Returns:
Optional[go... | [
"def",
"_cursor_pb",
"(",
"cursor_pair",
")",
":",
"if",
"cursor_pair",
"is",
"not",
"None",
":",
"data",
",",
"before",
"=",
"cursor_pair",
"value_pbs",
"=",
"[",
"_helpers",
".",
"encode_value",
"(",
"value",
")",
"for",
"value",
"in",
"data",
"]",
"re... | Convert a cursor pair to a protobuf.
If ``cursor_pair`` is :data:`None`, just returns :data:`None`.
Args:
cursor_pair (Optional[Tuple[list, bool]]): Two-tuple of
* a list of field values.
* a ``before`` flag
Returns:
Optional[google.cloud.firestore_v1beta1.types.C... | [
"Convert",
"a",
"cursor",
"pair",
"to",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L918-L936 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | _query_response_to_snapshot | def _query_response_to_snapshot(response_pb, collection, expected_prefix):
"""Parse a query response protobuf to a document snapshot.
Args:
response_pb (google.cloud.proto.firestore.v1beta1.\
firestore_pb2.RunQueryResponse): A
collection (~.firestore_v1beta1.collection.CollectionRef... | python | def _query_response_to_snapshot(response_pb, collection, expected_prefix):
"""Parse a query response protobuf to a document snapshot.
Args:
response_pb (google.cloud.proto.firestore.v1beta1.\
firestore_pb2.RunQueryResponse): A
collection (~.firestore_v1beta1.collection.CollectionRef... | [
"def",
"_query_response_to_snapshot",
"(",
"response_pb",
",",
"collection",
",",
"expected_prefix",
")",
":",
"if",
"not",
"response_pb",
".",
"HasField",
"(",
"\"document\"",
")",
":",
"return",
"None",
"document_id",
"=",
"_helpers",
".",
"get_doc_id",
"(",
"... | Parse a query response protobuf to a document snapshot.
Args:
response_pb (google.cloud.proto.firestore.v1beta1.\
firestore_pb2.RunQueryResponse): A
collection (~.firestore_v1beta1.collection.CollectionReference): A
reference to the collection that initiated the query.
... | [
"Parse",
"a",
"query",
"response",
"protobuf",
"to",
"a",
"document",
"snapshot",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L939-L970 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.select | def select(self, field_paths):
"""Project documents matching query to a limited set of fields.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
If the current query already has a projection set (i.e. has already
called :meth:`~.f... | python | def select(self, field_paths):
"""Project documents matching query to a limited set of fields.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
If the current query already has a projection set (i.e. has already
called :meth:`~.f... | [
"def",
"select",
"(",
"self",
",",
"field_paths",
")",
":",
"field_paths",
"=",
"list",
"(",
"field_paths",
")",
"for",
"field_path",
"in",
"field_paths",
":",
"field_path_module",
".",
"split_field_path",
"(",
"field_path",
")",
"# raises",
"new_projection",
"=... | Project documents matching query to a limited set of fields.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
If the current query already has a projection set (i.e. has already
called :meth:`~.firestore_v1beta1.query.Query.select`), thi... | [
"Project",
"documents",
"matching",
"query",
"to",
"a",
"limited",
"set",
"of",
"fields",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L165-L206 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.where | def where(self, field_path, op_string, value):
"""Filter the query on a field.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
Returns a new :class:`~.firestore_v1beta1.query.Query` that
filters on a specific field path, accordi... | python | def where(self, field_path, op_string, value):
"""Filter the query on a field.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
Returns a new :class:`~.firestore_v1beta1.query.Query` that
filters on a specific field path, accordi... | [
"def",
"where",
"(",
"self",
",",
"field_path",
",",
"op_string",
",",
"value",
")",
":",
"field_path_module",
".",
"split_field_path",
"(",
"field_path",
")",
"# raises",
"if",
"value",
"is",
"None",
":",
"if",
"op_string",
"!=",
"_EQ_OP",
":",
"raise",
"... | Filter the query on a field.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
Returns a new :class:`~.firestore_v1beta1.query.Query` that
filters on a specific field path, according to an operation (e.g.
``==`` or "equals") and a... | [
"Filter",
"the",
"query",
"on",
"a",
"field",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L208-L273 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query._make_order | def _make_order(field_path, direction):
"""Helper for :meth:`order_by`."""
return query_pb2.StructuredQuery.Order(
field=query_pb2.StructuredQuery.FieldReference(field_path=field_path),
direction=_enum_from_direction(direction),
) | python | def _make_order(field_path, direction):
"""Helper for :meth:`order_by`."""
return query_pb2.StructuredQuery.Order(
field=query_pb2.StructuredQuery.FieldReference(field_path=field_path),
direction=_enum_from_direction(direction),
) | [
"def",
"_make_order",
"(",
"field_path",
",",
"direction",
")",
":",
"return",
"query_pb2",
".",
"StructuredQuery",
".",
"Order",
"(",
"field",
"=",
"query_pb2",
".",
"StructuredQuery",
".",
"FieldReference",
"(",
"field_path",
"=",
"field_path",
")",
",",
"di... | Helper for :meth:`order_by`. | [
"Helper",
"for",
":",
"meth",
":",
"order_by",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L276-L281 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.order_by | def order_by(self, field_path, direction=ASCENDING):
"""Modify the query to add an order clause on a specific field.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
Successive :meth:`~.firestore_v1beta1.query.Query.order_by` calls
... | python | def order_by(self, field_path, direction=ASCENDING):
"""Modify the query to add an order clause on a specific field.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
Successive :meth:`~.firestore_v1beta1.query.Query.order_by` calls
... | [
"def",
"order_by",
"(",
"self",
",",
"field_path",
",",
"direction",
"=",
"ASCENDING",
")",
":",
"field_path_module",
".",
"split_field_path",
"(",
"field_path",
")",
"# raises",
"order_pb",
"=",
"self",
".",
"_make_order",
"(",
"field_path",
",",
"direction",
... | Modify the query to add an order clause on a specific field.
See :meth:`~.firestore_v1beta1.client.Client.field_path` for
more information on **field paths**.
Successive :meth:`~.firestore_v1beta1.query.Query.order_by` calls
will further refine the ordering of results returned by the q... | [
"Modify",
"the",
"query",
"to",
"add",
"an",
"order",
"clause",
"on",
"a",
"specific",
"field",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L283-L324 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.limit | def limit(self, count):
"""Limit a query to return a fixed number of results.
If the current query already has a limit set, this will overwrite it.
Args:
count (int): Maximum number of documents to return that match
the query.
Returns:
~.firesto... | python | def limit(self, count):
"""Limit a query to return a fixed number of results.
If the current query already has a limit set, this will overwrite it.
Args:
count (int): Maximum number of documents to return that match
the query.
Returns:
~.firesto... | [
"def",
"limit",
"(",
"self",
",",
"count",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"_parent",
",",
"projection",
"=",
"self",
".",
"_projection",
",",
"field_filters",
"=",
"self",
".",
"_field_filters",
",",
"orders",
"=",
"self"... | Limit a query to return a fixed number of results.
If the current query already has a limit set, this will overwrite it.
Args:
count (int): Maximum number of documents to return that match
the query.
Returns:
~.firestore_v1beta1.query.Query: A limited q... | [
"Limit",
"a",
"query",
"to",
"return",
"a",
"fixed",
"number",
"of",
"results",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L326-L349 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.offset | def offset(self, num_to_skip):
"""Skip to an offset in a query.
If the current query already has specified an offset, this will
overwrite it.
Args:
num_to_skip (int): The number of results to skip at the beginning
of query results. (Must be non-negative.)
... | python | def offset(self, num_to_skip):
"""Skip to an offset in a query.
If the current query already has specified an offset, this will
overwrite it.
Args:
num_to_skip (int): The number of results to skip at the beginning
of query results. (Must be non-negative.)
... | [
"def",
"offset",
"(",
"self",
",",
"num_to_skip",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"_parent",
",",
"projection",
"=",
"self",
".",
"_projection",
",",
"field_filters",
"=",
"self",
".",
"_field_filters",
",",
"orders",
"=",
... | Skip to an offset in a query.
If the current query already has specified an offset, this will
overwrite it.
Args:
num_to_skip (int): The number of results to skip at the beginning
of query results. (Must be non-negative.)
Returns:
~.firestore_v1... | [
"Skip",
"to",
"an",
"offset",
"in",
"a",
"query",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L351-L375 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query._cursor_helper | def _cursor_helper(self, document_fields, before, start):
"""Set values to be used for a ``start_at`` or ``end_at`` cursor.
The values will later be used in a query protobuf.
When the query is sent to the server, the ``document_fields`` will
be used in the order given by fields set by
... | python | def _cursor_helper(self, document_fields, before, start):
"""Set values to be used for a ``start_at`` or ``end_at`` cursor.
The values will later be used in a query protobuf.
When the query is sent to the server, the ``document_fields`` will
be used in the order given by fields set by
... | [
"def",
"_cursor_helper",
"(",
"self",
",",
"document_fields",
",",
"before",
",",
"start",
")",
":",
"if",
"isinstance",
"(",
"document_fields",
",",
"tuple",
")",
":",
"document_fields",
"=",
"list",
"(",
"document_fields",
")",
"elif",
"isinstance",
"(",
"... | Set values to be used for a ``start_at`` or ``end_at`` cursor.
The values will later be used in a query protobuf.
When the query is sent to the server, the ``document_fields`` will
be used in the order given by fields set by
:meth:`~.firestore_v1beta1.query.Query.order_by`.
Ar... | [
"Set",
"values",
"to",
"be",
"used",
"for",
"a",
"start_at",
"or",
"end_at",
"cursor",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L377-L429 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.start_at | def start_at(self, document_fields):
"""Start query results at a particular document value.
The result set will **include** the document specified by
``document_fields``.
If the current query already has specified a start cursor -- either
via this method or
:meth:`~.fir... | python | def start_at(self, document_fields):
"""Start query results at a particular document value.
The result set will **include** the document specified by
``document_fields``.
If the current query already has specified a start cursor -- either
via this method or
:meth:`~.fir... | [
"def",
"start_at",
"(",
"self",
",",
"document_fields",
")",
":",
"return",
"self",
".",
"_cursor_helper",
"(",
"document_fields",
",",
"before",
"=",
"True",
",",
"start",
"=",
"True",
")"
] | Start query results at a particular document value.
The result set will **include** the document specified by
``document_fields``.
If the current query already has specified a start cursor -- either
via this method or
:meth:`~.firestore_v1beta1.query.Query.start_after` -- this ... | [
"Start",
"query",
"results",
"at",
"a",
"particular",
"document",
"value",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L431-L458 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.start_after | def start_after(self, document_fields):
"""Start query results after a particular document value.
The result set will **exclude** the document specified by
``document_fields``.
If the current query already has specified a start cursor -- either
via this method or
:meth:... | python | def start_after(self, document_fields):
"""Start query results after a particular document value.
The result set will **exclude** the document specified by
``document_fields``.
If the current query already has specified a start cursor -- either
via this method or
:meth:... | [
"def",
"start_after",
"(",
"self",
",",
"document_fields",
")",
":",
"return",
"self",
".",
"_cursor_helper",
"(",
"document_fields",
",",
"before",
"=",
"False",
",",
"start",
"=",
"True",
")"
] | Start query results after a particular document value.
The result set will **exclude** the document specified by
``document_fields``.
If the current query already has specified a start cursor -- either
via this method or
:meth:`~.firestore_v1beta1.query.Query.start_at` -- this ... | [
"Start",
"query",
"results",
"after",
"a",
"particular",
"document",
"value",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L460-L487 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.end_before | def end_before(self, document_fields):
"""End query results before a particular document value.
The result set will **exclude** the document specified by
``document_fields``.
If the current query already has specified an end cursor -- either
via this method or
:meth:`~.... | python | def end_before(self, document_fields):
"""End query results before a particular document value.
The result set will **exclude** the document specified by
``document_fields``.
If the current query already has specified an end cursor -- either
via this method or
:meth:`~.... | [
"def",
"end_before",
"(",
"self",
",",
"document_fields",
")",
":",
"return",
"self",
".",
"_cursor_helper",
"(",
"document_fields",
",",
"before",
"=",
"True",
",",
"start",
"=",
"False",
")"
] | End query results before a particular document value.
The result set will **exclude** the document specified by
``document_fields``.
If the current query already has specified an end cursor -- either
via this method or
:meth:`~.firestore_v1beta1.query.Query.end_at` -- this will... | [
"End",
"query",
"results",
"before",
"a",
"particular",
"document",
"value",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L489-L516 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.end_at | def end_at(self, document_fields):
"""End query results at a particular document value.
The result set will **include** the document specified by
``document_fields``.
If the current query already has specified an end cursor -- either
via this method or
:meth:`~.firestor... | python | def end_at(self, document_fields):
"""End query results at a particular document value.
The result set will **include** the document specified by
``document_fields``.
If the current query already has specified an end cursor -- either
via this method or
:meth:`~.firestor... | [
"def",
"end_at",
"(",
"self",
",",
"document_fields",
")",
":",
"return",
"self",
".",
"_cursor_helper",
"(",
"document_fields",
",",
"before",
"=",
"False",
",",
"start",
"=",
"False",
")"
] | End query results at a particular document value.
The result set will **include** the document specified by
``document_fields``.
If the current query already has specified an end cursor -- either
via this method or
:meth:`~.firestore_v1beta1.query.Query.end_before` -- this will... | [
"End",
"query",
"results",
"at",
"a",
"particular",
"document",
"value",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L518-L545 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query._filters_pb | def _filters_pb(self):
"""Convert all the filters into a single generic Filter protobuf.
This may be a lone field filter or unary filter, may be a composite
filter or may be :data:`None`.
Returns:
google.cloud.firestore_v1beta1.types.\
StructuredQuery.Filter: A ... | python | def _filters_pb(self):
"""Convert all the filters into a single generic Filter protobuf.
This may be a lone field filter or unary filter, may be a composite
filter or may be :data:`None`.
Returns:
google.cloud.firestore_v1beta1.types.\
StructuredQuery.Filter: A ... | [
"def",
"_filters_pb",
"(",
"self",
")",
":",
"num_filters",
"=",
"len",
"(",
"self",
".",
"_field_filters",
")",
"if",
"num_filters",
"==",
"0",
":",
"return",
"None",
"elif",
"num_filters",
"==",
"1",
":",
"return",
"_filter_pb",
"(",
"self",
".",
"_fie... | Convert all the filters into a single generic Filter protobuf.
This may be a lone field filter or unary filter, may be a composite
filter or may be :data:`None`.
Returns:
google.cloud.firestore_v1beta1.types.\
StructuredQuery.Filter: A "generic" filter representing the
... | [
"Convert",
"all",
"the",
"filters",
"into",
"a",
"single",
"generic",
"Filter",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L547-L568 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query._normalize_projection | def _normalize_projection(projection):
"""Helper: convert field paths to message."""
if projection is not None:
fields = list(projection.fields)
if not fields:
field_ref = query_pb2.StructuredQuery.FieldReference(
field_path="__name__"
... | python | def _normalize_projection(projection):
"""Helper: convert field paths to message."""
if projection is not None:
fields = list(projection.fields)
if not fields:
field_ref = query_pb2.StructuredQuery.FieldReference(
field_path="__name__"
... | [
"def",
"_normalize_projection",
"(",
"projection",
")",
":",
"if",
"projection",
"is",
"not",
"None",
":",
"fields",
"=",
"list",
"(",
"projection",
".",
"fields",
")",
"if",
"not",
"fields",
":",
"field_ref",
"=",
"query_pb2",
".",
"StructuredQuery",
".",
... | Helper: convert field paths to message. | [
"Helper",
":",
"convert",
"field",
"paths",
"to",
"message",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L571-L583 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query._normalize_orders | def _normalize_orders(self):
"""Helper: adjust orders based on cursors, where clauses."""
orders = list(self._orders)
_has_snapshot_cursor = False
if self._start_at:
if isinstance(self._start_at[0], document.DocumentSnapshot):
_has_snapshot_cursor = True
... | python | def _normalize_orders(self):
"""Helper: adjust orders based on cursors, where clauses."""
orders = list(self._orders)
_has_snapshot_cursor = False
if self._start_at:
if isinstance(self._start_at[0], document.DocumentSnapshot):
_has_snapshot_cursor = True
... | [
"def",
"_normalize_orders",
"(",
"self",
")",
":",
"orders",
"=",
"list",
"(",
"self",
".",
"_orders",
")",
"_has_snapshot_cursor",
"=",
"False",
"if",
"self",
".",
"_start_at",
":",
"if",
"isinstance",
"(",
"self",
".",
"_start_at",
"[",
"0",
"]",
",",
... | Helper: adjust orders based on cursors, where clauses. | [
"Helper",
":",
"adjust",
"orders",
"based",
"on",
"cursors",
"where",
"clauses",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L585-L617 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query._normalize_cursor | def _normalize_cursor(self, cursor, orders):
"""Helper: convert cursor to a list of values based on orders."""
if cursor is None:
return
if not orders:
raise ValueError(_NO_ORDERS_FOR_CURSOR)
document_fields, before = cursor
order_keys = [order.field.fi... | python | def _normalize_cursor(self, cursor, orders):
"""Helper: convert cursor to a list of values based on orders."""
if cursor is None:
return
if not orders:
raise ValueError(_NO_ORDERS_FOR_CURSOR)
document_fields, before = cursor
order_keys = [order.field.fi... | [
"def",
"_normalize_cursor",
"(",
"self",
",",
"cursor",
",",
"orders",
")",
":",
"if",
"cursor",
"is",
"None",
":",
"return",
"if",
"not",
"orders",
":",
"raise",
"ValueError",
"(",
"_NO_ORDERS_FOR_CURSOR",
")",
"document_fields",
",",
"before",
"=",
"cursor... | Helper: convert cursor to a list of values based on orders. | [
"Helper",
":",
"convert",
"cursor",
"to",
"a",
"list",
"of",
"values",
"based",
"on",
"orders",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L619-L664 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query._to_protobuf | def _to_protobuf(self):
"""Convert the current query into the equivalent protobuf.
Returns:
google.cloud.firestore_v1beta1.types.StructuredQuery: The
query protobuf.
"""
projection = self._normalize_projection(self._projection)
orders = self._normalize_or... | python | def _to_protobuf(self):
"""Convert the current query into the equivalent protobuf.
Returns:
google.cloud.firestore_v1beta1.types.StructuredQuery: The
query protobuf.
"""
projection = self._normalize_projection(self._projection)
orders = self._normalize_or... | [
"def",
"_to_protobuf",
"(",
"self",
")",
":",
"projection",
"=",
"self",
".",
"_normalize_projection",
"(",
"self",
".",
"_projection",
")",
"orders",
"=",
"self",
".",
"_normalize_orders",
"(",
")",
"start_at",
"=",
"self",
".",
"_normalize_cursor",
"(",
"s... | Convert the current query into the equivalent protobuf.
Returns:
google.cloud.firestore_v1beta1.types.StructuredQuery: The
query protobuf. | [
"Convert",
"the",
"current",
"query",
"into",
"the",
"equivalent",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L666-L695 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.get | def get(self, transaction=None):
"""Deprecated alias for :meth:`stream`."""
warnings.warn(
"'Query.get' is deprecated: please use 'Query.stream' instead.",
DeprecationWarning,
stacklevel=2,
)
return self.stream(transaction=transaction) | python | def get(self, transaction=None):
"""Deprecated alias for :meth:`stream`."""
warnings.warn(
"'Query.get' is deprecated: please use 'Query.stream' instead.",
DeprecationWarning,
stacklevel=2,
)
return self.stream(transaction=transaction) | [
"def",
"get",
"(",
"self",
",",
"transaction",
"=",
"None",
")",
":",
"warnings",
".",
"warn",
"(",
"\"'Query.get' is deprecated: please use 'Query.stream' instead.\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
",",
")",
"return",
"self",
".",
"stre... | Deprecated alias for :meth:`stream`. | [
"Deprecated",
"alias",
"for",
":",
"meth",
":",
"stream",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L697-L704 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.stream | def stream(self, transaction=None):
"""Read the documents in the collection that match this query.
This sends a ``RunQuery`` RPC and then returns an iterator which
consumes each document returned in the stream of ``RunQueryResponse``
messages.
.. note::
The underlyi... | python | def stream(self, transaction=None):
"""Read the documents in the collection that match this query.
This sends a ``RunQuery`` RPC and then returns an iterator which
consumes each document returned in the stream of ``RunQueryResponse``
messages.
.. note::
The underlyi... | [
"def",
"stream",
"(",
"self",
",",
"transaction",
"=",
"None",
")",
":",
"parent_path",
",",
"expected_prefix",
"=",
"self",
".",
"_parent",
".",
"_parent_info",
"(",
")",
"response_iterator",
"=",
"self",
".",
"_client",
".",
"_firestore_api",
".",
"run_que... | Read the documents in the collection that match this query.
This sends a ``RunQuery`` RPC and then returns an iterator which
consumes each document returned in the stream of ``RunQueryResponse``
messages.
.. note::
The underlying stream of responses will time out after
... | [
"Read",
"the",
"documents",
"in",
"the",
"collection",
"that",
"match",
"this",
"query",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L706-L746 | train |
googleapis/google-cloud-python | firestore/google/cloud/firestore_v1beta1/query.py | Query.on_snapshot | def on_snapshot(self, callback):
"""Monitor the documents in this collection that match this query.
This starts a watch on this query using a background thread. The
provided callback is run on the snapshot of the documents.
Args:
callback(~.firestore.query.QuerySnapshot): a... | python | def on_snapshot(self, callback):
"""Monitor the documents in this collection that match this query.
This starts a watch on this query using a background thread. The
provided callback is run on the snapshot of the documents.
Args:
callback(~.firestore.query.QuerySnapshot): a... | [
"def",
"on_snapshot",
"(",
"self",
",",
"callback",
")",
":",
"return",
"Watch",
".",
"for_query",
"(",
"self",
",",
"callback",
",",
"document",
".",
"DocumentSnapshot",
",",
"document",
".",
"DocumentReference",
")"
] | Monitor the documents in this collection that match this query.
This starts a watch on this query using a background thread. The
provided callback is run on the snapshot of the documents.
Args:
callback(~.firestore.query.QuerySnapshot): a callback to run when
a chan... | [
"Monitor",
"the",
"documents",
"in",
"this",
"collection",
"that",
"match",
"this",
"query",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L748-L776 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dataset.py | _get_model_reference | def _get_model_reference(self, model_id):
"""Constructs a ModelReference.
Args:
model_id (str): the ID of the model.
Returns:
google.cloud.bigquery.model.ModelReference:
A ModelReference for a model in this dataset.
"""
return ModelReference.from_api_repr(
{"pro... | python | def _get_model_reference(self, model_id):
"""Constructs a ModelReference.
Args:
model_id (str): the ID of the model.
Returns:
google.cloud.bigquery.model.ModelReference:
A ModelReference for a model in this dataset.
"""
return ModelReference.from_api_repr(
{"pro... | [
"def",
"_get_model_reference",
"(",
"self",
",",
"model_id",
")",
":",
"return",
"ModelReference",
".",
"from_api_repr",
"(",
"{",
"\"projectId\"",
":",
"self",
".",
"project",
",",
"\"datasetId\"",
":",
"self",
".",
"dataset_id",
",",
"\"modelId\"",
":",
"mod... | Constructs a ModelReference.
Args:
model_id (str): the ID of the model.
Returns:
google.cloud.bigquery.model.ModelReference:
A ModelReference for a model in this dataset. | [
"Constructs",
"a",
"ModelReference",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dataset.py#L41-L53 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dataset.py | AccessEntry.to_api_repr | def to_api_repr(self):
"""Construct the API resource representation of this access entry
Returns:
Dict[str, object]: Access entry represented as an API resource
"""
resource = {self.entity_type: self.entity_id}
if self.role is not None:
resource["role"] =... | python | def to_api_repr(self):
"""Construct the API resource representation of this access entry
Returns:
Dict[str, object]: Access entry represented as an API resource
"""
resource = {self.entity_type: self.entity_id}
if self.role is not None:
resource["role"] =... | [
"def",
"to_api_repr",
"(",
"self",
")",
":",
"resource",
"=",
"{",
"self",
".",
"entity_type",
":",
"self",
".",
"entity_id",
"}",
"if",
"self",
".",
"role",
"is",
"not",
"None",
":",
"resource",
"[",
"\"role\"",
"]",
"=",
"self",
".",
"role",
"retur... | Construct the API resource representation of this access entry
Returns:
Dict[str, object]: Access entry represented as an API resource | [
"Construct",
"the",
"API",
"resource",
"representation",
"of",
"this",
"access",
"entry"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dataset.py#L150-L159 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dataset.py | AccessEntry.from_api_repr | def from_api_repr(cls, resource):
"""Factory: construct an access entry given its API representation
Args:
resource (Dict[str, object]):
Access entry resource representation returned from the API
Returns:
google.cloud.bigquery.dataset.AccessEntry:
... | python | def from_api_repr(cls, resource):
"""Factory: construct an access entry given its API representation
Args:
resource (Dict[str, object]):
Access entry resource representation returned from the API
Returns:
google.cloud.bigquery.dataset.AccessEntry:
... | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
")",
":",
"entry",
"=",
"resource",
".",
"copy",
"(",
")",
"role",
"=",
"entry",
".",
"pop",
"(",
"\"role\"",
",",
"None",
")",
"entity_type",
",",
"entity_id",
"=",
"entry",
".",
"popitem",
"(",
"... | Factory: construct an access entry given its API representation
Args:
resource (Dict[str, object]):
Access entry resource representation returned from the API
Returns:
google.cloud.bigquery.dataset.AccessEntry:
Access entry parsed from ``resource... | [
"Factory",
":",
"construct",
"an",
"access",
"entry",
"given",
"its",
"API",
"representation"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dataset.py#L162-L183 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dataset.py | DatasetReference.from_api_repr | def from_api_repr(cls, resource):
"""Factory: construct a dataset reference given its API representation
Args:
resource (Dict[str, str]):
Dataset reference resource representation returned from the API
Returns:
google.cloud.bigquery.dataset.DatasetRefere... | python | def from_api_repr(cls, resource):
"""Factory: construct a dataset reference given its API representation
Args:
resource (Dict[str, str]):
Dataset reference resource representation returned from the API
Returns:
google.cloud.bigquery.dataset.DatasetRefere... | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
")",
":",
"project",
"=",
"resource",
"[",
"\"projectId\"",
"]",
"dataset_id",
"=",
"resource",
"[",
"\"datasetId\"",
"]",
"return",
"cls",
"(",
"project",
",",
"dataset_id",
")"
] | Factory: construct a dataset reference given its API representation
Args:
resource (Dict[str, str]):
Dataset reference resource representation returned from the API
Returns:
google.cloud.bigquery.dataset.DatasetReference:
Dataset reference parsed... | [
"Factory",
":",
"construct",
"a",
"dataset",
"reference",
"given",
"its",
"API",
"representation"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dataset.py#L228-L241 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dataset.py | DatasetReference.from_string | def from_string(cls, dataset_id, default_project=None):
"""Construct a dataset reference from dataset ID string.
Args:
dataset_id (str):
A dataset ID in standard SQL format. If ``default_project``
is not specified, this must included both the project ID and
... | python | def from_string(cls, dataset_id, default_project=None):
"""Construct a dataset reference from dataset ID string.
Args:
dataset_id (str):
A dataset ID in standard SQL format. If ``default_project``
is not specified, this must included both the project ID and
... | [
"def",
"from_string",
"(",
"cls",
",",
"dataset_id",
",",
"default_project",
"=",
"None",
")",
":",
"output_dataset_id",
"=",
"dataset_id",
"output_project_id",
"=",
"default_project",
"parts",
"=",
"dataset_id",
".",
"split",
"(",
"\".\"",
")",
"if",
"len",
"... | Construct a dataset reference from dataset ID string.
Args:
dataset_id (str):
A dataset ID in standard SQL format. If ``default_project``
is not specified, this must included both the project ID and
the dataset ID, separated by ``.``.
defa... | [
"Construct",
"a",
"dataset",
"reference",
"from",
"dataset",
"ID",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dataset.py#L244-L288 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dataset.py | Dataset.access_entries | def access_entries(self):
"""List[google.cloud.bigquery.dataset.AccessEntry]: Dataset's access
entries.
``role`` augments the entity type and must be present **unless** the
entity type is ``view``.
Raises:
TypeError: If 'value' is not a sequence
ValueErr... | python | def access_entries(self):
"""List[google.cloud.bigquery.dataset.AccessEntry]: Dataset's access
entries.
``role`` augments the entity type and must be present **unless** the
entity type is ``view``.
Raises:
TypeError: If 'value' is not a sequence
ValueErr... | [
"def",
"access_entries",
"(",
"self",
")",
":",
"entries",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"access\"",
",",
"[",
"]",
")",
"return",
"[",
"AccessEntry",
".",
"from_api_repr",
"(",
"entry",
")",
"for",
"entry",
"in",
"entries",
"]"
] | List[google.cloud.bigquery.dataset.AccessEntry]: Dataset's access
entries.
``role`` augments the entity type and must be present **unless** the
entity type is ``view``.
Raises:
TypeError: If 'value' is not a sequence
ValueError:
If any item in th... | [
"List",
"[",
"google",
".",
"cloud",
".",
"bigquery",
".",
"dataset",
".",
"AccessEntry",
"]",
":",
"Dataset",
"s",
"access",
"entries",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dataset.py#L362-L376 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dataset.py | Dataset.created | def created(self):
"""Union[datetime.datetime, None]: Datetime at which the dataset was
created (:data:`None` until set from the server).
"""
creation_time = self._properties.get("creationTime")
if creation_time is not None:
# creation_time will be in milliseconds.
... | python | def created(self):
"""Union[datetime.datetime, None]: Datetime at which the dataset was
created (:data:`None` until set from the server).
"""
creation_time = self._properties.get("creationTime")
if creation_time is not None:
# creation_time will be in milliseconds.
... | [
"def",
"created",
"(",
"self",
")",
":",
"creation_time",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"creationTime\"",
")",
"if",
"creation_time",
"is",
"not",
"None",
":",
"# creation_time will be in milliseconds.",
"return",
"google",
".",
"cloud",
".... | Union[datetime.datetime, None]: Datetime at which the dataset was
created (:data:`None` until set from the server). | [
"Union",
"[",
"datetime",
".",
"datetime",
"None",
"]",
":",
"Datetime",
"at",
"which",
"the",
"dataset",
"was",
"created",
"(",
":",
"data",
":",
"None",
"until",
"set",
"from",
"the",
"server",
")",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dataset.py#L386-L395 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dataset.py | Dataset.modified | def modified(self):
"""Union[datetime.datetime, None]: Datetime at which the dataset was
last modified (:data:`None` until set from the server).
"""
modified_time = self._properties.get("lastModifiedTime")
if modified_time is not None:
# modified_time will be in milli... | python | def modified(self):
"""Union[datetime.datetime, None]: Datetime at which the dataset was
last modified (:data:`None` until set from the server).
"""
modified_time = self._properties.get("lastModifiedTime")
if modified_time is not None:
# modified_time will be in milli... | [
"def",
"modified",
"(",
"self",
")",
":",
"modified_time",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"lastModifiedTime\"",
")",
"if",
"modified_time",
"is",
"not",
"None",
":",
"# modified_time will be in milliseconds.",
"return",
"google",
".",
"cloud",... | Union[datetime.datetime, None]: Datetime at which the dataset was
last modified (:data:`None` until set from the server). | [
"Union",
"[",
"datetime",
".",
"datetime",
"None",
"]",
":",
"Datetime",
"at",
"which",
"the",
"dataset",
"was",
"last",
"modified",
"(",
":",
"data",
":",
"None",
"until",
"set",
"from",
"the",
"server",
")",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dataset.py#L426-L435 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dataset.py | Dataset.from_api_repr | def from_api_repr(cls, resource):
"""Factory: construct a dataset given its API representation
Args:
resource (Dict[str: object]):
Dataset resource representation returned from the API
Returns:
google.cloud.bigquery.dataset.Dataset:
Datas... | python | def from_api_repr(cls, resource):
"""Factory: construct a dataset given its API representation
Args:
resource (Dict[str: object]):
Dataset resource representation returned from the API
Returns:
google.cloud.bigquery.dataset.Dataset:
Datas... | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
")",
":",
"if",
"(",
"\"datasetReference\"",
"not",
"in",
"resource",
"or",
"\"datasetId\"",
"not",
"in",
"resource",
"[",
"\"datasetReference\"",
"]",
")",
":",
"raise",
"KeyError",
"(",
"\"Resource lacks req... | Factory: construct a dataset given its API representation
Args:
resource (Dict[str: object]):
Dataset resource representation returned from the API
Returns:
google.cloud.bigquery.dataset.Dataset:
Dataset parsed from ``resource``. | [
"Factory",
":",
"construct",
"a",
"dataset",
"given",
"its",
"API",
"representation"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dataset.py#L553-L576 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | _blobs_page_start | def _blobs_page_start(iterator, page, response):
"""Grab prefixes after a :class:`~google.cloud.iterator.Page` started.
:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that is currently in use.
:type page: :class:`~google.cloud.api.core.page_iterator.Page... | python | def _blobs_page_start(iterator, page, response):
"""Grab prefixes after a :class:`~google.cloud.iterator.Page` started.
:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that is currently in use.
:type page: :class:`~google.cloud.api.core.page_iterator.Page... | [
"def",
"_blobs_page_start",
"(",
"iterator",
",",
"page",
",",
"response",
")",
":",
"page",
".",
"prefixes",
"=",
"tuple",
"(",
"response",
".",
"get",
"(",
"\"prefixes\"",
",",
"(",
")",
")",
")",
"iterator",
".",
"prefixes",
".",
"update",
"(",
"pag... | Grab prefixes after a :class:`~google.cloud.iterator.Page` started.
:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that is currently in use.
:type page: :class:`~google.cloud.api.core.page_iterator.Page`
:param page: The page that was just created.
... | [
"Grab",
"prefixes",
"after",
"a",
":",
"class",
":",
"~google",
".",
"cloud",
".",
"iterator",
".",
"Page",
"started",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L53-L66 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | _item_to_blob | def _item_to_blob(iterator, item):
"""Convert a JSON blob to the native object.
.. note::
This assumes that the ``bucket`` attribute has been
added to the iterator after being created.
:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that ... | python | def _item_to_blob(iterator, item):
"""Convert a JSON blob to the native object.
.. note::
This assumes that the ``bucket`` attribute has been
added to the iterator after being created.
:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that ... | [
"def",
"_item_to_blob",
"(",
"iterator",
",",
"item",
")",
":",
"name",
"=",
"item",
".",
"get",
"(",
"\"name\"",
")",
"blob",
"=",
"Blob",
"(",
"name",
",",
"bucket",
"=",
"iterator",
".",
"bucket",
")",
"blob",
".",
"_set_properties",
"(",
"item",
... | Convert a JSON blob to the native object.
.. note::
This assumes that the ``bucket`` attribute has been
added to the iterator after being created.
:type iterator: :class:`~google.api_core.page_iterator.Iterator`
:param iterator: The iterator that has retrieved the item.
:type item: d... | [
"Convert",
"a",
"JSON",
"blob",
"to",
"the",
"native",
"object",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L69-L89 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | LifecycleRuleSetStorageClass.from_api_repr | def from_api_repr(cls, resource):
"""Factory: construct instance from resource.
:type resource: dict
:param resource: mapping as returned from API call.
:rtype: :class:`LifecycleRuleDelete`
:returns: Instance created from resource.
"""
action = resource["action... | python | def from_api_repr(cls, resource):
"""Factory: construct instance from resource.
:type resource: dict
:param resource: mapping as returned from API call.
:rtype: :class:`LifecycleRuleDelete`
:returns: Instance created from resource.
"""
action = resource["action... | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
")",
":",
"action",
"=",
"resource",
"[",
"\"action\"",
"]",
"instance",
"=",
"cls",
"(",
"action",
"[",
"\"storageClass\"",
"]",
",",
"_factory",
"=",
"True",
")",
"instance",
".",
"update",
"(",
"res... | Factory: construct instance from resource.
:type resource: dict
:param resource: mapping as returned from API call.
:rtype: :class:`LifecycleRuleDelete`
:returns: Instance created from resource. | [
"Factory",
":",
"construct",
"instance",
"from",
"resource",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L262-L274 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | IAMConfiguration.from_api_repr | def from_api_repr(cls, resource, bucket):
"""Factory: construct instance from resource.
:type bucket: :class:`Bucket`
:params bucket: Bucket for which this instance is the policy.
:type resource: dict
:param resource: mapping as returned from API call.
:rtype: :class:... | python | def from_api_repr(cls, resource, bucket):
"""Factory: construct instance from resource.
:type bucket: :class:`Bucket`
:params bucket: Bucket for which this instance is the policy.
:type resource: dict
:param resource: mapping as returned from API call.
:rtype: :class:... | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
",",
"bucket",
")",
":",
"instance",
"=",
"cls",
"(",
"bucket",
")",
"instance",
".",
"update",
"(",
"resource",
")",
"return",
"instance"
] | Factory: construct instance from resource.
:type bucket: :class:`Bucket`
:params bucket: Bucket for which this instance is the policy.
:type resource: dict
:param resource: mapping as returned from API call.
:rtype: :class:`IAMConfiguration`
:returns: Instance created... | [
"Factory",
":",
"construct",
"instance",
"from",
"resource",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L305-L319 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | IAMConfiguration.bucket_policy_only_locked_time | def bucket_policy_only_locked_time(self):
"""Deadline for changing :attr:`bucket_policy_only_enabled` from true to false.
If the bucket's :attr:`bucket_policy_only_enabled` is true, this property
is time time after which that setting becomes immutable.
If the bucket's :attr:`bucket_pol... | python | def bucket_policy_only_locked_time(self):
"""Deadline for changing :attr:`bucket_policy_only_enabled` from true to false.
If the bucket's :attr:`bucket_policy_only_enabled` is true, this property
is time time after which that setting becomes immutable.
If the bucket's :attr:`bucket_pol... | [
"def",
"bucket_policy_only_locked_time",
"(",
"self",
")",
":",
"bpo",
"=",
"self",
".",
"get",
"(",
"\"bucketPolicyOnly\"",
",",
"{",
"}",
")",
"stamp",
"=",
"bpo",
".",
"get",
"(",
"\"lockedTime\"",
")",
"if",
"stamp",
"is",
"not",
"None",
":",
"stamp"... | Deadline for changing :attr:`bucket_policy_only_enabled` from true to false.
If the bucket's :attr:`bucket_policy_only_enabled` is true, this property
is time time after which that setting becomes immutable.
If the bucket's :attr:`bucket_policy_only_enabled` is false, this property
is ... | [
"Deadline",
"for",
"changing",
":",
"attr",
":",
"bucket_policy_only_enabled",
"from",
"true",
"to",
"false",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L347-L364 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket._set_properties | def _set_properties(self, value):
"""Set the properties for the current object.
:type value: dict or :class:`google.cloud.storage.batch._FutureDict`
:param value: The properties to be set.
"""
self._label_removals.clear()
return super(Bucket, self)._set_properties(value) | python | def _set_properties(self, value):
"""Set the properties for the current object.
:type value: dict or :class:`google.cloud.storage.batch._FutureDict`
:param value: The properties to be set.
"""
self._label_removals.clear()
return super(Bucket, self)._set_properties(value) | [
"def",
"_set_properties",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_label_removals",
".",
"clear",
"(",
")",
"return",
"super",
"(",
"Bucket",
",",
"self",
")",
".",
"_set_properties",
"(",
"value",
")"
] | Set the properties for the current object.
:type value: dict or :class:`google.cloud.storage.batch._FutureDict`
:param value: The properties to be set. | [
"Set",
"the",
"properties",
"for",
"the",
"current",
"object",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L421-L428 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.blob | def blob(
self,
blob_name,
chunk_size=None,
encryption_key=None,
kms_key_name=None,
generation=None,
):
"""Factory constructor for blob object.
.. note::
This will not make an HTTP request; it simply instantiates
a blob object owne... | python | def blob(
self,
blob_name,
chunk_size=None,
encryption_key=None,
kms_key_name=None,
generation=None,
):
"""Factory constructor for blob object.
.. note::
This will not make an HTTP request; it simply instantiates
a blob object owne... | [
"def",
"blob",
"(",
"self",
",",
"blob_name",
",",
"chunk_size",
"=",
"None",
",",
"encryption_key",
"=",
"None",
",",
"kms_key_name",
"=",
"None",
",",
"generation",
"=",
"None",
",",
")",
":",
"return",
"Blob",
"(",
"name",
"=",
"blob_name",
",",
"bu... | Factory constructor for blob object.
.. note::
This will not make an HTTP request; it simply instantiates
a blob object owned by this bucket.
:type blob_name: str
:param blob_name: The name of the blob to be instantiated.
:type chunk_size: int
:param chunk_... | [
"Factory",
"constructor",
"for",
"blob",
"object",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L440-L484 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.notification | def notification(
self,
topic_name,
topic_project=None,
custom_attributes=None,
event_types=None,
blob_name_prefix=None,
payload_format=NONE_PAYLOAD_FORMAT,
):
"""Factory: create a notification resource for the bucket.
See: :class:`.BucketNot... | python | def notification(
self,
topic_name,
topic_project=None,
custom_attributes=None,
event_types=None,
blob_name_prefix=None,
payload_format=NONE_PAYLOAD_FORMAT,
):
"""Factory: create a notification resource for the bucket.
See: :class:`.BucketNot... | [
"def",
"notification",
"(",
"self",
",",
"topic_name",
",",
"topic_project",
"=",
"None",
",",
"custom_attributes",
"=",
"None",
",",
"event_types",
"=",
"None",
",",
"blob_name_prefix",
"=",
"None",
",",
"payload_format",
"=",
"NONE_PAYLOAD_FORMAT",
",",
")",
... | Factory: create a notification resource for the bucket.
See: :class:`.BucketNotification` for parameters.
:rtype: :class:`.BucketNotification` | [
"Factory",
":",
"create",
"a",
"notification",
"resource",
"for",
"the",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L486-L509 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.create | def create(self, client=None, project=None, location=None):
"""Creates current bucket.
If the bucket already exists, will raise
:class:`google.cloud.exceptions.Conflict`.
This implements "storage.buckets.insert".
If :attr:`user_project` is set, bills the API request to that pr... | python | def create(self, client=None, project=None, location=None):
"""Creates current bucket.
If the bucket already exists, will raise
:class:`google.cloud.exceptions.Conflict`.
This implements "storage.buckets.insert".
If :attr:`user_project` is set, bills the API request to that pr... | [
"def",
"create",
"(",
"self",
",",
"client",
"=",
"None",
",",
"project",
"=",
"None",
",",
"location",
"=",
"None",
")",
":",
"if",
"self",
".",
"user_project",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"Cannot create bucket with 'user_project... | Creates current bucket.
If the bucket already exists, will raise
:class:`google.cloud.exceptions.Conflict`.
This implements "storage.buckets.insert".
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.storage.client.Clie... | [
"Creates",
"current",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L548-L601 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.patch | def patch(self, client=None):
"""Sends all changed properties in a PATCH request.
Updates the ``_properties`` with the response from the backend.
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
... | python | def patch(self, client=None):
"""Sends all changed properties in a PATCH request.
Updates the ``_properties`` with the response from the backend.
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
... | [
"def",
"patch",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"# Special case: For buckets, it is possible that labels are being",
"# removed; this requires special handling.",
"if",
"self",
".",
"_label_removals",
":",
"self",
".",
"_changes",
".",
"add",
"(",
"\"... | Sends all changed properties in a PATCH request.
Updates the ``_properties`` with the response from the backend.
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:par... | [
"Sends",
"all",
"changed",
"properties",
"in",
"a",
"PATCH",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L603-L624 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.get_blob | def get_blob(
self, blob_name, client=None, encryption_key=None, generation=None, **kwargs
):
"""Get a blob object by name.
This will return None if the blob doesn't exist:
.. literalinclude:: snippets.py
:start-after: [START get_blob]
:end-before: [END get_blob... | python | def get_blob(
self, blob_name, client=None, encryption_key=None, generation=None, **kwargs
):
"""Get a blob object by name.
This will return None if the blob doesn't exist:
.. literalinclude:: snippets.py
:start-after: [START get_blob]
:end-before: [END get_blob... | [
"def",
"get_blob",
"(",
"self",
",",
"blob_name",
",",
"client",
"=",
"None",
",",
"encryption_key",
"=",
"None",
",",
"generation",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"blob",
"=",
"Blob",
"(",
"bucket",
"=",
"self",
",",
"name",
"=",
... | Get a blob object by name.
This will return None if the blob doesn't exist:
.. literalinclude:: snippets.py
:start-after: [START get_blob]
:end-before: [END get_blob]
If :attr:`user_project` is set, bills the API request to that project.
:type blob_name: str
... | [
"Get",
"a",
"blob",
"object",
"by",
"name",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L656-L709 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.list_blobs | def list_blobs(
self,
max_results=None,
page_token=None,
prefix=None,
delimiter=None,
versions=None,
projection="noAcl",
fields=None,
client=None,
):
"""Return an iterator used to find blobs in the bucket.
If :attr:`user_projec... | python | def list_blobs(
self,
max_results=None,
page_token=None,
prefix=None,
delimiter=None,
versions=None,
projection="noAcl",
fields=None,
client=None,
):
"""Return an iterator used to find blobs in the bucket.
If :attr:`user_projec... | [
"def",
"list_blobs",
"(",
"self",
",",
"max_results",
"=",
"None",
",",
"page_token",
"=",
"None",
",",
"prefix",
"=",
"None",
",",
"delimiter",
"=",
"None",
",",
"versions",
"=",
"None",
",",
"projection",
"=",
"\"noAcl\"",
",",
"fields",
"=",
"None",
... | Return an iterator used to find blobs in the bucket.
If :attr:`user_project` is set, bills the API request to that project.
:type max_results: int
:param max_results:
(Optional) The maximum number of blobs in each page of results
from this request. Non-positive values a... | [
"Return",
"an",
"iterator",
"used",
"to",
"find",
"blobs",
"in",
"the",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L711-L802 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.list_notifications | def list_notifications(self, client=None):
"""List Pub / Sub notifications for this bucket.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/list
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.stor... | python | def list_notifications(self, client=None):
"""List Pub / Sub notifications for this bucket.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/list
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.stor... | [
"def",
"list_notifications",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"path",
"=",
"self",
".",
"path",
"+",
"\"/notificationConfigs\"",
"iterator",
"=",
"page_iterator",
".",
"HTTP... | List Pub / Sub notifications for this bucket.
See:
https://cloud.google.com/storage/docs/json_api/v1/notifications/list
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType... | [
"List",
"Pub",
"/",
"Sub",
"notifications",
"for",
"this",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L804-L829 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.delete | def delete(self, force=False, client=None):
"""Delete this bucket.
The bucket **must** be empty in order to submit a delete request. If
``force=True`` is passed, this will first attempt to delete all the
objects / blobs in the bucket (i.e. try to empty the bucket).
If the bucke... | python | def delete(self, force=False, client=None):
"""Delete this bucket.
The bucket **must** be empty in order to submit a delete request. If
``force=True`` is passed, this will first attempt to delete all the
objects / blobs in the bucket (i.e. try to empty the bucket).
If the bucke... | [
"def",
"delete",
"(",
"self",
",",
"force",
"=",
"False",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"query_params",
"=",
"{",
"}",
"if",
"self",
".",
"user_project",
"is",
"not",
"None",
... | Delete this bucket.
The bucket **must** be empty in order to submit a delete request. If
``force=True`` is passed, this will first attempt to delete all the
objects / blobs in the bucket (i.e. try to empty the bucket).
If the bucket doesn't exist, this will raise
:class:`google... | [
"Delete",
"this",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L831-L893 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.delete_blob | def delete_blob(self, blob_name, client=None, generation=None):
"""Deletes a blob from the current bucket.
If the blob isn't found (backend 404), raises a
:class:`google.cloud.exceptions.NotFound`.
For example:
.. literalinclude:: snippets.py
:start-after: [START del... | python | def delete_blob(self, blob_name, client=None, generation=None):
"""Deletes a blob from the current bucket.
If the blob isn't found (backend 404), raises a
:class:`google.cloud.exceptions.NotFound`.
For example:
.. literalinclude:: snippets.py
:start-after: [START del... | [
"def",
"delete_blob",
"(",
"self",
",",
"blob_name",
",",
"client",
"=",
"None",
",",
"generation",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"blob",
"=",
"Blob",
"(",
"blob_name",
",",
"bucket",
"=",
"se... | Deletes a blob from the current bucket.
If the blob isn't found (backend 404), raises a
:class:`google.cloud.exceptions.NotFound`.
For example:
.. literalinclude:: snippets.py
:start-after: [START delete_blob]
:end-before: [END delete_blob]
If :attr:`user_... | [
"Deletes",
"a",
"blob",
"from",
"the",
"current",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L895-L941 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.delete_blobs | def delete_blobs(self, blobs, on_error=None, client=None):
"""Deletes a list of blobs from the current bucket.
Uses :meth:`delete_blob` to delete each individual blob.
If :attr:`user_project` is set, bills the API request to that project.
:type blobs: list
:param blobs: A list... | python | def delete_blobs(self, blobs, on_error=None, client=None):
"""Deletes a list of blobs from the current bucket.
Uses :meth:`delete_blob` to delete each individual blob.
If :attr:`user_project` is set, bills the API request to that project.
:type blobs: list
:param blobs: A list... | [
"def",
"delete_blobs",
"(",
"self",
",",
"blobs",
",",
"on_error",
"=",
"None",
",",
"client",
"=",
"None",
")",
":",
"for",
"blob",
"in",
"blobs",
":",
"try",
":",
"blob_name",
"=",
"blob",
"if",
"not",
"isinstance",
"(",
"blob_name",
",",
"six",
".... | Deletes a list of blobs from the current bucket.
Uses :meth:`delete_blob` to delete each individual blob.
If :attr:`user_project` is set, bills the API request to that project.
:type blobs: list
:param blobs: A list of :class:`~google.cloud.storage.blob.Blob`-s or
... | [
"Deletes",
"a",
"list",
"of",
"blobs",
"from",
"the",
"current",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L943-L977 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.copy_blob | def copy_blob(
self,
blob,
destination_bucket,
new_name=None,
client=None,
preserve_acl=True,
source_generation=None,
):
"""Copy the given blob to the given bucket, optionally with a new name.
If :attr:`user_project` is set, bills the API requ... | python | def copy_blob(
self,
blob,
destination_bucket,
new_name=None,
client=None,
preserve_acl=True,
source_generation=None,
):
"""Copy the given blob to the given bucket, optionally with a new name.
If :attr:`user_project` is set, bills the API requ... | [
"def",
"copy_blob",
"(",
"self",
",",
"blob",
",",
"destination_bucket",
",",
"new_name",
"=",
"None",
",",
"client",
"=",
"None",
",",
"preserve_acl",
"=",
"True",
",",
"source_generation",
"=",
"None",
",",
")",
":",
"client",
"=",
"self",
".",
"_requi... | Copy the given blob to the given bucket, optionally with a new name.
If :attr:`user_project` is set, bills the API request to that project.
:type blob: :class:`google.cloud.storage.blob.Blob`
:param blob: The blob to be copied.
:type destination_bucket: :class:`google.cloud.storage.bu... | [
"Copy",
"the",
"given",
"blob",
"to",
"the",
"given",
"bucket",
"optionally",
"with",
"a",
"new",
"name",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L979-L1043 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.rename_blob | def rename_blob(self, blob, new_name, client=None):
"""Rename the given blob using copy and delete operations.
If :attr:`user_project` is set, bills the API request to that project.
Effectively, copies blob to the same bucket with a new name, then
deletes the blob.
.. warning:... | python | def rename_blob(self, blob, new_name, client=None):
"""Rename the given blob using copy and delete operations.
If :attr:`user_project` is set, bills the API request to that project.
Effectively, copies blob to the same bucket with a new name, then
deletes the blob.
.. warning:... | [
"def",
"rename_blob",
"(",
"self",
",",
"blob",
",",
"new_name",
",",
"client",
"=",
"None",
")",
":",
"same_name",
"=",
"blob",
".",
"name",
"==",
"new_name",
"new_blob",
"=",
"self",
".",
"copy_blob",
"(",
"blob",
",",
"self",
",",
"new_name",
",",
... | Rename the given blob using copy and delete operations.
If :attr:`user_project` is set, bills the API request to that project.
Effectively, copies blob to the same bucket with a new name, then
deletes the blob.
.. warning::
This method will first duplicate the data and then... | [
"Rename",
"the",
"given",
"blob",
"using",
"copy",
"and",
"delete",
"operations",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L1045-L1080 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.default_kms_key_name | def default_kms_key_name(self, value):
"""Set default KMS encryption key for objects in the bucket.
:type value: str or None
:param value: new KMS key name (None to clear any existing key).
"""
encryption_config = self._properties.get("encryption", {})
encryption_config[... | python | def default_kms_key_name(self, value):
"""Set default KMS encryption key for objects in the bucket.
:type value: str or None
:param value: new KMS key name (None to clear any existing key).
"""
encryption_config = self._properties.get("encryption", {})
encryption_config[... | [
"def",
"default_kms_key_name",
"(",
"self",
",",
"value",
")",
":",
"encryption_config",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"encryption\"",
",",
"{",
"}",
")",
"encryption_config",
"[",
"\"defaultKmsKeyName\"",
"]",
"=",
"value",
"self",
".",
... | Set default KMS encryption key for objects in the bucket.
:type value: str or None
:param value: new KMS key name (None to clear any existing key). | [
"Set",
"default",
"KMS",
"encryption",
"key",
"for",
"objects",
"in",
"the",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L1154-L1162 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.labels | def labels(self):
"""Retrieve or set labels assigned to this bucket.
See
https://cloud.google.com/storage/docs/json_api/v1/buckets#labels
.. note::
The getter for this property returns a dict which is a *copy*
of the bucket's labels. Mutating that dict has no ef... | python | def labels(self):
"""Retrieve or set labels assigned to this bucket.
See
https://cloud.google.com/storage/docs/json_api/v1/buckets#labels
.. note::
The getter for this property returns a dict which is a *copy*
of the bucket's labels. Mutating that dict has no ef... | [
"def",
"labels",
"(",
"self",
")",
":",
"labels",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"labels\"",
")",
"if",
"labels",
"is",
"None",
":",
"return",
"{",
"}",
"return",
"copy",
".",
"deepcopy",
"(",
"labels",
")"
] | Retrieve or set labels assigned to this bucket.
See
https://cloud.google.com/storage/docs/json_api/v1/buckets#labels
.. note::
The getter for this property returns a dict which is a *copy*
of the bucket's labels. Mutating that dict has no effect unless
you th... | [
"Retrieve",
"or",
"set",
"labels",
"assigned",
"to",
"this",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L1165-L1192 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.labels | def labels(self, mapping):
"""Set labels assigned to this bucket.
See
https://cloud.google.com/storage/docs/json_api/v1/buckets#labels
:type mapping: :class:`dict`
:param mapping: Name-value pairs (string->string) labelling the bucket.
"""
# If any labels have b... | python | def labels(self, mapping):
"""Set labels assigned to this bucket.
See
https://cloud.google.com/storage/docs/json_api/v1/buckets#labels
:type mapping: :class:`dict`
:param mapping: Name-value pairs (string->string) labelling the bucket.
"""
# If any labels have b... | [
"def",
"labels",
"(",
"self",
",",
"mapping",
")",
":",
"# If any labels have been expressly removed, we need to track this",
"# so that a future .patch() call can do the correct thing.",
"existing",
"=",
"set",
"(",
"[",
"k",
"for",
"k",
"in",
"self",
".",
"labels",
".",... | Set labels assigned to this bucket.
See
https://cloud.google.com/storage/docs/json_api/v1/buckets#labels
:type mapping: :class:`dict`
:param mapping: Name-value pairs (string->string) labelling the bucket. | [
"Set",
"labels",
"assigned",
"to",
"this",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L1195-L1211 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.iam_configuration | def iam_configuration(self):
"""Retrieve IAM configuration for this bucket.
:rtype: :class:`IAMConfiguration`
:returns: an instance for managing the bucket's IAM configuration.
"""
info = self._properties.get("iamConfiguration", {})
return IAMConfiguration.from_api_repr(... | python | def iam_configuration(self):
"""Retrieve IAM configuration for this bucket.
:rtype: :class:`IAMConfiguration`
:returns: an instance for managing the bucket's IAM configuration.
"""
info = self._properties.get("iamConfiguration", {})
return IAMConfiguration.from_api_repr(... | [
"def",
"iam_configuration",
"(",
"self",
")",
":",
"info",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"iamConfiguration\"",
",",
"{",
"}",
")",
"return",
"IAMConfiguration",
".",
"from_api_repr",
"(",
"info",
",",
"self",
")"
] | Retrieve IAM configuration for this bucket.
:rtype: :class:`IAMConfiguration`
:returns: an instance for managing the bucket's IAM configuration. | [
"Retrieve",
"IAM",
"configuration",
"for",
"this",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L1239-L1246 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.lifecycle_rules | def lifecycle_rules(self):
"""Retrieve or set lifecycle rules configured for this bucket.
See https://cloud.google.com/storage/docs/lifecycle and
https://cloud.google.com/storage/docs/json_api/v1/buckets
.. note::
The getter for this property returns a list which conta... | python | def lifecycle_rules(self):
"""Retrieve or set lifecycle rules configured for this bucket.
See https://cloud.google.com/storage/docs/lifecycle and
https://cloud.google.com/storage/docs/json_api/v1/buckets
.. note::
The getter for this property returns a list which conta... | [
"def",
"lifecycle_rules",
"(",
"self",
")",
":",
"info",
"=",
"self",
".",
"_properties",
".",
"get",
"(",
"\"lifecycle\"",
",",
"{",
"}",
")",
"for",
"rule",
"in",
"info",
".",
"get",
"(",
"\"rule\"",
",",
"(",
")",
")",
":",
"action_type",
"=",
"... | Retrieve or set lifecycle rules configured for this bucket.
See https://cloud.google.com/storage/docs/lifecycle and
https://cloud.google.com/storage/docs/json_api/v1/buckets
.. note::
The getter for this property returns a list which contains
*copies* of the bucket'... | [
"Retrieve",
"or",
"set",
"lifecycle",
"rules",
"configured",
"for",
"this",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L1249-L1283 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/bucket.py | Bucket.lifecycle_rules | def lifecycle_rules(self, rules):
"""Set lifestyle rules configured for this bucket.
See https://cloud.google.com/storage/docs/lifecycle and
https://cloud.google.com/storage/docs/json_api/v1/buckets
:type entries: list of dictionaries
:param entries: A sequence of mappings... | python | def lifecycle_rules(self, rules):
"""Set lifestyle rules configured for this bucket.
See https://cloud.google.com/storage/docs/lifecycle and
https://cloud.google.com/storage/docs/json_api/v1/buckets
:type entries: list of dictionaries
:param entries: A sequence of mappings... | [
"def",
"lifecycle_rules",
"(",
"self",
",",
"rules",
")",
":",
"rules",
"=",
"[",
"dict",
"(",
"rule",
")",
"for",
"rule",
"in",
"rules",
"]",
"# Convert helpers if needed",
"self",
".",
"_patch_property",
"(",
"\"lifecycle\"",
",",
"{",
"\"rule\"",
":",
"... | Set lifestyle rules configured for this bucket.
See https://cloud.google.com/storage/docs/lifecycle and
https://cloud.google.com/storage/docs/json_api/v1/buckets
:type entries: list of dictionaries
:param entries: A sequence of mappings describing each lifecycle rule. | [
"Set",
"lifestyle",
"rules",
"configured",
"for",
"this",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L1286-L1296 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.