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 | datastore/google/cloud/datastore/_http.py | HTTPDatastoreAPI.begin_transaction | def begin_transaction(self, project_id, transaction_options=None):
"""Perform a ``beginTransaction`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type transaction_options... | python | def begin_transaction(self, project_id, transaction_options=None):
"""Perform a ``beginTransaction`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type transaction_options... | [
"def",
"begin_transaction",
"(",
"self",
",",
"project_id",
",",
"transaction_options",
"=",
"None",
")",
":",
"request_pb",
"=",
"_datastore_pb2",
".",
"BeginTransactionRequest",
"(",
")",
"return",
"_rpc",
"(",
"self",
".",
"client",
".",
"_http",
",",
"proj... | Perform a ``beginTransaction`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type transaction_options: ~.datastore_v1.types.TransactionOptions
:param transaction_options: ... | [
"Perform",
"a",
"beginTransaction",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/_http.py#L224-L245 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/_http.py | HTTPDatastoreAPI.commit | def commit(self, project_id, mode, mutations, transaction=None):
"""Perform a ``commit`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type mode: :class:`.gapic.datastore.... | python | def commit(self, project_id, mode, mutations, transaction=None):
"""Perform a ``commit`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type mode: :class:`.gapic.datastore.... | [
"def",
"commit",
"(",
"self",
",",
"project_id",
",",
"mode",
",",
"mutations",
",",
"transaction",
"=",
"None",
")",
":",
"request_pb",
"=",
"_datastore_pb2",
".",
"CommitRequest",
"(",
"project_id",
"=",
"project_id",
",",
"mode",
"=",
"mode",
",",
"tran... | Perform a ``commit`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type mode: :class:`.gapic.datastore.v1.enums.CommitRequest.Mode`
:param mode: The type of commit to perf... | [
"Perform",
"a",
"commit",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/_http.py#L247-L283 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/_http.py | HTTPDatastoreAPI.rollback | def rollback(self, project_id, transaction):
"""Perform a ``rollback`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type transaction: bytes
:param transaction: Th... | python | def rollback(self, project_id, transaction):
"""Perform a ``rollback`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type transaction: bytes
:param transaction: Th... | [
"def",
"rollback",
"(",
"self",
",",
"project_id",
",",
"transaction",
")",
":",
"request_pb",
"=",
"_datastore_pb2",
".",
"RollbackRequest",
"(",
"project_id",
"=",
"project_id",
",",
"transaction",
"=",
"transaction",
")",
"# Response is empty (i.e. no fields) but w... | Perform a ``rollback`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type transaction: bytes
:param transaction: The transaction ID to rollback.
:rtype: :class:`.... | [
"Perform",
"a",
"rollback",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/_http.py#L285-L309 | train |
googleapis/google-cloud-python | datastore/google/cloud/datastore/_http.py | HTTPDatastoreAPI.allocate_ids | def allocate_ids(self, project_id, keys):
"""Perform an ``allocateIds`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type keys: List[.entity_pb2.Key]
:param keys:... | python | def allocate_ids(self, project_id, keys):
"""Perform an ``allocateIds`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type keys: List[.entity_pb2.Key]
:param keys:... | [
"def",
"allocate_ids",
"(",
"self",
",",
"project_id",
",",
"keys",
")",
":",
"request_pb",
"=",
"_datastore_pb2",
".",
"AllocateIdsRequest",
"(",
"keys",
"=",
"keys",
")",
"return",
"_rpc",
"(",
"self",
".",
"client",
".",
"_http",
",",
"project_id",
",",... | Perform an ``allocateIds`` request.
:type project_id: str
:param project_id: The project to connect to. This is
usually your project name in the cloud console.
:type keys: List[.entity_pb2.Key]
:param keys: The keys for which the backend should allocate IDs.
... | [
"Perform",
"an",
"allocateIds",
"request",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/_http.py#L311-L332 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | _create_row_request | def _create_row_request(
table_name,
start_key=None,
end_key=None,
filter_=None,
limit=None,
end_inclusive=False,
app_profile_id=None,
row_set=None,
):
"""Creates a request to read rows in a table.
:type table_name: str
:param table_name: The name of the table to read from.
... | python | def _create_row_request(
table_name,
start_key=None,
end_key=None,
filter_=None,
limit=None,
end_inclusive=False,
app_profile_id=None,
row_set=None,
):
"""Creates a request to read rows in a table.
:type table_name: str
:param table_name: The name of the table to read from.
... | [
"def",
"_create_row_request",
"(",
"table_name",
",",
"start_key",
"=",
"None",
",",
"end_key",
"=",
"None",
",",
"filter_",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"end_inclusive",
"=",
"False",
",",
"app_profile_id",
"=",
"None",
",",
"row_set",
"="... | Creates a request to read rows in a table.
:type table_name: str
:param table_name: The name of the table to read from.
:type start_key: bytes
:param start_key: (Optional) The beginning of a range of row keys to
read from. The range will include ``start_key``. If
... | [
"Creates",
"a",
"request",
"to",
"read",
"rows",
"in",
"a",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L862-L932 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | _mutate_rows_request | def _mutate_rows_request(table_name, rows, app_profile_id=None):
"""Creates a request to mutate rows in a table.
:type table_name: str
:param table_name: The name of the table to write to.
:type rows: list
:param rows: List or other iterable of :class:`.DirectRow` instances.
:type: app_profil... | python | def _mutate_rows_request(table_name, rows, app_profile_id=None):
"""Creates a request to mutate rows in a table.
:type table_name: str
:param table_name: The name of the table to write to.
:type rows: list
:param rows: List or other iterable of :class:`.DirectRow` instances.
:type: app_profil... | [
"def",
"_mutate_rows_request",
"(",
"table_name",
",",
"rows",
",",
"app_profile_id",
"=",
"None",
")",
":",
"request_pb",
"=",
"data_messages_v2_pb2",
".",
"MutateRowsRequest",
"(",
"table_name",
"=",
"table_name",
",",
"app_profile_id",
"=",
"app_profile_id",
")",... | Creates a request to mutate rows in a table.
:type table_name: str
:param table_name: The name of the table to write to.
:type rows: list
:param rows: List or other iterable of :class:`.DirectRow` instances.
:type: app_profile_id: str
:param app_profile_id: (Optional) The unique name of the A... | [
"Creates",
"a",
"request",
"to",
"mutate",
"rows",
"in",
"a",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L935-L966 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | _check_row_table_name | def _check_row_table_name(table_name, row):
"""Checks that a row belongs to a table.
:type table_name: str
:param table_name: The name of the table.
:type row: :class:`~google.cloud.bigtable.row.Row`
:param row: An instance of :class:`~google.cloud.bigtable.row.Row`
subclasses.
... | python | def _check_row_table_name(table_name, row):
"""Checks that a row belongs to a table.
:type table_name: str
:param table_name: The name of the table.
:type row: :class:`~google.cloud.bigtable.row.Row`
:param row: An instance of :class:`~google.cloud.bigtable.row.Row`
subclasses.
... | [
"def",
"_check_row_table_name",
"(",
"table_name",
",",
"row",
")",
":",
"if",
"row",
".",
"table",
"is",
"not",
"None",
"and",
"row",
".",
"table",
".",
"name",
"!=",
"table_name",
":",
"raise",
"TableMismatchError",
"(",
"\"Row %s is a part of %s table. Curren... | Checks that a row belongs to a table.
:type table_name: str
:param table_name: The name of the table.
:type row: :class:`~google.cloud.bigtable.row.Row`
:param row: An instance of :class:`~google.cloud.bigtable.row.Row`
subclasses.
:raises: :exc:`~.table.TableMismatchError` if the... | [
"Checks",
"that",
"a",
"row",
"belongs",
"to",
"a",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L969-L986 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.name | def name(self):
"""Table name used in requests.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_table_name]
:end-before: [END bigtable_table_name]
.. note::
This property will not change if ``table_id`` does not, but ... | python | def name(self):
"""Table name used in requests.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_table_name]
:end-before: [END bigtable_table_name]
.. note::
This property will not change if ``table_id`` does not, but ... | [
"def",
"name",
"(",
"self",
")",
":",
"project",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"project",
"instance_id",
"=",
"self",
".",
"_instance",
".",
"instance_id",
"table_client",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"table_dat... | Table name used in requests.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_table_name]
:end-before: [END bigtable_table_name]
.. note::
This property will not change if ``table_id`` does not, but the
return value ... | [
"Table",
"name",
"used",
"in",
"requests",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L113-L139 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.row | def row(self, row_key, filter_=None, append=False):
"""Factory to create a row associated with this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_table_row]
:end-before: [END bigtable_table_row]
.. warning::
... | python | def row(self, row_key, filter_=None, append=False):
"""Factory to create a row associated with this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_table_row]
:end-before: [END bigtable_table_row]
.. warning::
... | [
"def",
"row",
"(",
"self",
",",
"row_key",
",",
"filter_",
"=",
"None",
",",
"append",
"=",
"False",
")",
":",
"if",
"append",
"and",
"filter_",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"At most one of filter_ and append can be set\"",
")",
"i... | Factory to create a row associated with this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_table_row]
:end-before: [END bigtable_table_row]
.. warning::
At most one of ``filter_`` and ``append`` can be used in a
... | [
"Factory",
"to",
"create",
"a",
"row",
"associated",
"with",
"this",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L163-L200 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.create | def create(self, initial_split_keys=[], column_families={}):
"""Creates this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_table]
:end-before: [END bigtable_create_table]
.. note::
A create request r... | python | def create(self, initial_split_keys=[], column_families={}):
"""Creates this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_table]
:end-before: [END bigtable_create_table]
.. note::
A create request r... | [
"def",
"create",
"(",
"self",
",",
"initial_split_keys",
"=",
"[",
"]",
",",
"column_families",
"=",
"{",
"}",
")",
":",
"table_client",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"table_admin_client",
"instance_name",
"=",
"self",
".",
"_instance",... | Creates this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_table]
:end-before: [END bigtable_create_table]
.. note::
A create request returns a
:class:`._generated.table_pb2.Table` but we don't u... | [
"Creates",
"this",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L210-L252 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.exists | def exists(self):
"""Check whether the table exists.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_check_table_exists]
:end-before: [END bigtable_check_table_exists]
:rtype: bool
:returns: True if the table exists, els... | python | def exists(self):
"""Check whether the table exists.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_check_table_exists]
:end-before: [END bigtable_check_table_exists]
:rtype: bool
:returns: True if the table exists, els... | [
"def",
"exists",
"(",
"self",
")",
":",
"table_client",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"table_admin_client",
"try",
":",
"table_client",
".",
"get_table",
"(",
"name",
"=",
"self",
".",
"name",
",",
"view",
"=",
"VIEW_NAME_ONLY",
")",
... | Check whether the table exists.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_check_table_exists]
:end-before: [END bigtable_check_table_exists]
:rtype: bool
:returns: True if the table exists, else False. | [
"Check",
"whether",
"the",
"table",
"exists",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L254-L271 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.delete | def delete(self):
"""Delete this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_delete_table]
:end-before: [END bigtable_delete_table]
"""
table_client = self._instance._client.table_admin_client
table_cl... | python | def delete(self):
"""Delete this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_delete_table]
:end-before: [END bigtable_delete_table]
"""
table_client = self._instance._client.table_admin_client
table_cl... | [
"def",
"delete",
"(",
"self",
")",
":",
"table_client",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"table_admin_client",
"table_client",
".",
"delete_table",
"(",
"name",
"=",
"self",
".",
"name",
")"
] | Delete this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_delete_table]
:end-before: [END bigtable_delete_table] | [
"Delete",
"this",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L273-L284 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.list_column_families | def list_column_families(self):
"""List the column families owned by this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_list_column_families]
:end-before: [END bigtable_list_column_families]
:rtype: dict
:return... | python | def list_column_families(self):
"""List the column families owned by this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_list_column_families]
:end-before: [END bigtable_list_column_families]
:rtype: dict
:return... | [
"def",
"list_column_families",
"(",
"self",
")",
":",
"table_client",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"table_admin_client",
"table_pb",
"=",
"table_client",
".",
"get_table",
"(",
"self",
".",
"name",
")",
"result",
"=",
"{",
"}",
"for",
... | List the column families owned by this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_list_column_families]
:end-before: [END bigtable_list_column_families]
:rtype: dict
:returns: Dictionary of column families attached t... | [
"List",
"the",
"column",
"families",
"owned",
"by",
"this",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L286-L311 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.get_cluster_states | def get_cluster_states(self):
"""List the cluster states owned by this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_get_cluster_states]
:end-before: [END bigtable_get_cluster_states]
:rtype: dict
:returns: Dict... | python | def get_cluster_states(self):
"""List the cluster states owned by this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_get_cluster_states]
:end-before: [END bigtable_get_cluster_states]
:rtype: dict
:returns: Dict... | [
"def",
"get_cluster_states",
"(",
"self",
")",
":",
"REPLICATION_VIEW",
"=",
"enums",
".",
"Table",
".",
"View",
".",
"REPLICATION_VIEW",
"table_client",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"table_admin_client",
"table_pb",
"=",
"table_client",
"... | List the cluster states owned by this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_get_cluster_states]
:end-before: [END bigtable_get_cluster_states]
:rtype: dict
:returns: Dictionary of cluster states for this table.
... | [
"List",
"the",
"cluster",
"states",
"owned",
"by",
"this",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L313-L335 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.read_row | def read_row(self, row_key, filter_=None):
"""Read a single row from this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_read_row]
:end-before: [END bigtable_read_row]
:type row_key: bytes
:param row_key: The key... | python | def read_row(self, row_key, filter_=None):
"""Read a single row from this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_read_row]
:end-before: [END bigtable_read_row]
:type row_key: bytes
:param row_key: The key... | [
"def",
"read_row",
"(",
"self",
",",
"row_key",
",",
"filter_",
"=",
"None",
")",
":",
"row_set",
"=",
"RowSet",
"(",
")",
"row_set",
".",
"add_row_key",
"(",
"row_key",
")",
"result_iter",
"=",
"iter",
"(",
"self",
".",
"read_rows",
"(",
"filter_",
"=... | Read a single row from this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_read_row]
:end-before: [END bigtable_read_row]
:type row_key: bytes
:param row_key: The key of the row to read from.
:type filter_: :cla... | [
"Read",
"a",
"single",
"row",
"from",
"this",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L337-L365 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.read_rows | def read_rows(
self,
start_key=None,
end_key=None,
limit=None,
filter_=None,
end_inclusive=False,
row_set=None,
retry=DEFAULT_RETRY_READ_ROWS,
):
"""Read rows from this table.
For example:
.. literalinclude:: snippets_table.py... | python | def read_rows(
self,
start_key=None,
end_key=None,
limit=None,
filter_=None,
end_inclusive=False,
row_set=None,
retry=DEFAULT_RETRY_READ_ROWS,
):
"""Read rows from this table.
For example:
.. literalinclude:: snippets_table.py... | [
"def",
"read_rows",
"(",
"self",
",",
"start_key",
"=",
"None",
",",
"end_key",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"filter_",
"=",
"None",
",",
"end_inclusive",
"=",
"False",
",",
"row_set",
"=",
"None",
",",
"retry",
"=",
"DEFAULT_RETRY_READ_R... | Read rows from this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_read_rows]
:end-before: [END bigtable_read_rows]
:type start_key: bytes
:param start_key: (Optional) The beginning of a range of row keys to
... | [
"Read",
"rows",
"from",
"this",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L367-L436 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.yield_rows | def yield_rows(self, **kwargs):
"""Read rows from this table.
.. warning::
This method will be removed in future releases. Please use
``read_rows`` instead.
:type start_key: bytes
:param start_key: (Optional) The beginning of a range of row keys to
... | python | def yield_rows(self, **kwargs):
"""Read rows from this table.
.. warning::
This method will be removed in future releases. Please use
``read_rows`` instead.
:type start_key: bytes
:param start_key: (Optional) The beginning of a range of row keys to
... | [
"def",
"yield_rows",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"`yield_rows()` is depricated; use `red_rows()` instead\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
",",
")",
"return",
"self",
".",
"read_rows",
... | Read rows from this table.
.. warning::
This method will be removed in future releases. Please use
``read_rows`` instead.
:type start_key: bytes
:param start_key: (Optional) The beginning of a range of row keys to
read from. The range will inclu... | [
"Read",
"rows",
"from",
"this",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L438-L477 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.mutate_rows | def mutate_rows(self, rows, retry=DEFAULT_RETRY):
"""Mutates multiple rows in bulk.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_mutate_rows]
:end-before: [END bigtable_mutate_rows]
The method tries to update all specified ro... | python | def mutate_rows(self, rows, retry=DEFAULT_RETRY):
"""Mutates multiple rows in bulk.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_mutate_rows]
:end-before: [END bigtable_mutate_rows]
The method tries to update all specified ro... | [
"def",
"mutate_rows",
"(",
"self",
",",
"rows",
",",
"retry",
"=",
"DEFAULT_RETRY",
")",
":",
"retryable_mutate_rows",
"=",
"_RetryableMutateRowsWorker",
"(",
"self",
".",
"_instance",
".",
"_client",
",",
"self",
".",
"name",
",",
"rows",
",",
"app_profile_id... | Mutates multiple rows in bulk.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_mutate_rows]
:end-before: [END bigtable_mutate_rows]
The method tries to update all specified rows.
If some of the rows weren't updated, it would not... | [
"Mutates",
"multiple",
"rows",
"in",
"bulk",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L479-L521 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.sample_row_keys | def sample_row_keys(self):
"""Read a sample of row keys in the table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_sample_row_keys]
:end-before: [END bigtable_sample_row_keys]
The returned row keys will delimit contiguous sec... | python | def sample_row_keys(self):
"""Read a sample of row keys in the table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_sample_row_keys]
:end-before: [END bigtable_sample_row_keys]
The returned row keys will delimit contiguous sec... | [
"def",
"sample_row_keys",
"(",
"self",
")",
":",
"data_client",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"table_data_client",
"response_iterator",
"=",
"data_client",
".",
"sample_row_keys",
"(",
"self",
".",
"name",
",",
"app_profile_id",
"=",
"self"... | Read a sample of row keys in the table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_sample_row_keys]
:end-before: [END bigtable_sample_row_keys]
The returned row keys will delimit contiguous sections of the table of
approxim... | [
"Read",
"a",
"sample",
"of",
"row",
"keys",
"in",
"the",
"table",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L523-L565 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.truncate | def truncate(self, timeout=None):
"""Truncate the table
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_truncate_table]
:end-before: [END bigtable_truncate_table]
:type timeout: float
:param timeout: (Optional) The amoun... | python | def truncate(self, timeout=None):
"""Truncate the table
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_truncate_table]
:end-before: [END bigtable_truncate_table]
:type timeout: float
:param timeout: (Optional) The amoun... | [
"def",
"truncate",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"_instance",
".",
"_client",
"table_admin_client",
"=",
"client",
".",
"table_admin_client",
"if",
"timeout",
":",
"table_admin_client",
".",
"drop_row_range",
"... | Truncate the table
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_truncate_table]
:end-before: [END bigtable_truncate_table]
:type timeout: float
:param timeout: (Optional) The amount of time, in seconds, to wait
... | [
"Truncate",
"the",
"table"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L567-L595 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | Table.mutations_batcher | def mutations_batcher(self, flush_count=FLUSH_COUNT, max_row_bytes=MAX_ROW_BYTES):
"""Factory to create a mutation batcher associated with this instance.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_mutations_batcher]
:end-before: [EN... | python | def mutations_batcher(self, flush_count=FLUSH_COUNT, max_row_bytes=MAX_ROW_BYTES):
"""Factory to create a mutation batcher associated with this instance.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_mutations_batcher]
:end-before: [EN... | [
"def",
"mutations_batcher",
"(",
"self",
",",
"flush_count",
"=",
"FLUSH_COUNT",
",",
"max_row_bytes",
"=",
"MAX_ROW_BYTES",
")",
":",
"return",
"MutationsBatcher",
"(",
"self",
",",
"flush_count",
",",
"max_row_bytes",
")"
] | Factory to create a mutation batcher associated with this instance.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_mutations_batcher]
:end-before: [END bigtable_mutations_batcher]
:type table: class
:param table: class:`~google... | [
"Factory",
"to",
"create",
"a",
"mutation",
"batcher",
"associated",
"with",
"this",
"instance",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L631-L655 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/table.py | _RetryableMutateRowsWorker._do_mutate_retryable_rows | def _do_mutate_retryable_rows(self):
"""Mutate all the rows that are eligible for retry.
A row is eligible for retry if it has not been tried or if it resulted
in a transient error in a previous call.
:rtype: list
:return: The responses statuses, which is a list of
... | python | def _do_mutate_retryable_rows(self):
"""Mutate all the rows that are eligible for retry.
A row is eligible for retry if it has not been tried or if it resulted
in a transient error in a previous call.
:rtype: list
:return: The responses statuses, which is a list of
... | [
"def",
"_do_mutate_retryable_rows",
"(",
"self",
")",
":",
"retryable_rows",
"=",
"[",
"]",
"index_into_all_rows",
"=",
"[",
"]",
"for",
"index",
",",
"status",
"in",
"enumerate",
"(",
"self",
".",
"responses_statuses",
")",
":",
"if",
"self",
".",
"_is_retr... | Mutate all the rows that are eligible for retry.
A row is eligible for retry if it has not been tried or if it resulted
in a transient error in a previous call.
:rtype: list
:return: The responses statuses, which is a list of
:class:`~google.rpc.status_pb2.Status`.
... | [
"Mutate",
"all",
"the",
"rows",
"that",
"are",
"eligible",
"for",
"retry",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L712-L784 | train |
googleapis/google-cloud-python | pubsub/google/cloud/pubsub_v1/subscriber/_protocol/heartbeater.py | Heartbeater.heartbeat | def heartbeat(self):
"""Periodically send heartbeats."""
while self._manager.is_active and not self._stop_event.is_set():
self._manager.heartbeat()
_LOGGER.debug("Sent heartbeat.")
self._stop_event.wait(timeout=self._period)
_LOGGER.info("%s exiting.", _HEART... | python | def heartbeat(self):
"""Periodically send heartbeats."""
while self._manager.is_active and not self._stop_event.is_set():
self._manager.heartbeat()
_LOGGER.debug("Sent heartbeat.")
self._stop_event.wait(timeout=self._period)
_LOGGER.info("%s exiting.", _HEART... | [
"def",
"heartbeat",
"(",
"self",
")",
":",
"while",
"self",
".",
"_manager",
".",
"is_active",
"and",
"not",
"self",
".",
"_stop_event",
".",
"is_set",
"(",
")",
":",
"self",
".",
"_manager",
".",
"heartbeat",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
... | Periodically send heartbeats. | [
"Periodically",
"send",
"heartbeats",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/heartbeater.py#L37-L44 | train |
googleapis/google-cloud-python | error_reporting/google/cloud/errorreporting_v1beta1/gapic/report_errors_service_client.py | ReportErrorsServiceClient.report_error_event | def report_error_event(
self,
project_name,
event,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Report an individual error event.
Example:
>>> from google.clo... | python | def report_error_event(
self,
project_name,
event,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Report an individual error event.
Example:
>>> from google.clo... | [
"def",
"report_error_event",
"(",
"self",
",",
"project_name",
",",
"event",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
... | Report an individual error event.
Example:
>>> from google.cloud import errorreporting_v1beta1
>>>
>>> client = errorreporting_v1beta1.ReportErrorsServiceClient()
>>>
>>> project_name = client.project_path('[PROJECT]')
>>>
>>> ... | [
"Report",
"an",
"individual",
"error",
"event",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/errorreporting_v1beta1/gapic/report_errors_service_client.py#L188-L268 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/_helpers.py | scalar_to_query_parameter | def scalar_to_query_parameter(value, name=None):
"""Convert a scalar value into a query parameter.
:type value: any
:param value: A scalar value to convert into a query parameter.
:type name: str
:param name: (Optional) Name of the query parameter.
:rtype: :class:`~google.cloud.bigquery.Scala... | python | def scalar_to_query_parameter(value, name=None):
"""Convert a scalar value into a query parameter.
:type value: any
:param value: A scalar value to convert into a query parameter.
:type name: str
:param name: (Optional) Name of the query parameter.
:rtype: :class:`~google.cloud.bigquery.Scala... | [
"def",
"scalar_to_query_parameter",
"(",
"value",
",",
"name",
"=",
"None",
")",
":",
"parameter_type",
"=",
"None",
"if",
"isinstance",
"(",
"value",
",",
"bool",
")",
":",
"parameter_type",
"=",
"\"BOOL\"",
"elif",
"isinstance",
"(",
"value",
",",
"numbers... | Convert a scalar value into a query parameter.
:type value: any
:param value: A scalar value to convert into a query parameter.
:type name: str
:param name: (Optional) Name of the query parameter.
:rtype: :class:`~google.cloud.bigquery.ScalarQueryParameter`
:returns:
A query parameter... | [
"Convert",
"a",
"scalar",
"value",
"into",
"a",
"query",
"parameter",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/_helpers.py#L30-L72 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/_helpers.py | to_query_parameters_dict | def to_query_parameters_dict(parameters):
"""Converts a dictionary of parameter values into query parameters.
:type parameters: Mapping[str, Any]
:param parameters: Dictionary of query parameter values.
:rtype: List[google.cloud.bigquery.query._AbstractQueryParameter]
:returns: A list of named que... | python | def to_query_parameters_dict(parameters):
"""Converts a dictionary of parameter values into query parameters.
:type parameters: Mapping[str, Any]
:param parameters: Dictionary of query parameter values.
:rtype: List[google.cloud.bigquery.query._AbstractQueryParameter]
:returns: A list of named que... | [
"def",
"to_query_parameters_dict",
"(",
"parameters",
")",
":",
"return",
"[",
"scalar_to_query_parameter",
"(",
"value",
",",
"name",
"=",
"name",
")",
"for",
"name",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"parameters",
")",
"]"
] | Converts a dictionary of parameter values into query parameters.
:type parameters: Mapping[str, Any]
:param parameters: Dictionary of query parameter values.
:rtype: List[google.cloud.bigquery.query._AbstractQueryParameter]
:returns: A list of named query parameters. | [
"Converts",
"a",
"dictionary",
"of",
"parameter",
"values",
"into",
"query",
"parameters",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/_helpers.py#L87-L99 | train |
googleapis/google-cloud-python | bigquery/google/cloud/bigquery/dbapi/_helpers.py | to_query_parameters | def to_query_parameters(parameters):
"""Converts DB-API parameter values into query parameters.
:type parameters: Mapping[str, Any] or Sequence[Any]
:param parameters: A dictionary or sequence of query parameter values.
:rtype: List[google.cloud.bigquery.query._AbstractQueryParameter]
:returns: A ... | python | def to_query_parameters(parameters):
"""Converts DB-API parameter values into query parameters.
:type parameters: Mapping[str, Any] or Sequence[Any]
:param parameters: A dictionary or sequence of query parameter values.
:rtype: List[google.cloud.bigquery.query._AbstractQueryParameter]
:returns: A ... | [
"def",
"to_query_parameters",
"(",
"parameters",
")",
":",
"if",
"parameters",
"is",
"None",
":",
"return",
"[",
"]",
"if",
"isinstance",
"(",
"parameters",
",",
"collections_abc",
".",
"Mapping",
")",
":",
"return",
"to_query_parameters_dict",
"(",
"parameters"... | Converts DB-API parameter values into query parameters.
:type parameters: Mapping[str, Any] or Sequence[Any]
:param parameters: A dictionary or sequence of query parameter values.
:rtype: List[google.cloud.bigquery.query._AbstractQueryParameter]
:returns: A list of query parameters. | [
"Converts",
"DB",
"-",
"API",
"parameter",
"values",
"into",
"query",
"parameters",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/_helpers.py#L102-L117 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | _refresh_http | def _refresh_http(api_request, operation_name):
"""Refresh an operation using a JSON/HTTP client.
Args:
api_request (Callable): A callable used to make an API request. This
should generally be
:meth:`google.cloud._http.Connection.api_request`.
operation_name (str): The n... | python | def _refresh_http(api_request, operation_name):
"""Refresh an operation using a JSON/HTTP client.
Args:
api_request (Callable): A callable used to make an API request. This
should generally be
:meth:`google.cloud._http.Connection.api_request`.
operation_name (str): The n... | [
"def",
"_refresh_http",
"(",
"api_request",
",",
"operation_name",
")",
":",
"path",
"=",
"\"operations/{}\"",
".",
"format",
"(",
"operation_name",
")",
"api_response",
"=",
"api_request",
"(",
"method",
"=",
"\"GET\"",
",",
"path",
"=",
"path",
")",
"return"... | Refresh an operation using a JSON/HTTP client.
Args:
api_request (Callable): A callable used to make an API request. This
should generally be
:meth:`google.cloud._http.Connection.api_request`.
operation_name (str): The name of the operation.
Returns:
google.long... | [
"Refresh",
"an",
"operation",
"using",
"a",
"JSON",
"/",
"HTTP",
"client",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L187-L201 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | _cancel_http | def _cancel_http(api_request, operation_name):
"""Cancel an operation using a JSON/HTTP client.
Args:
api_request (Callable): A callable used to make an API request. This
should generally be
:meth:`google.cloud._http.Connection.api_request`.
operation_name (str): The nam... | python | def _cancel_http(api_request, operation_name):
"""Cancel an operation using a JSON/HTTP client.
Args:
api_request (Callable): A callable used to make an API request. This
should generally be
:meth:`google.cloud._http.Connection.api_request`.
operation_name (str): The nam... | [
"def",
"_cancel_http",
"(",
"api_request",
",",
"operation_name",
")",
":",
"path",
"=",
"\"operations/{}:cancel\"",
".",
"format",
"(",
"operation_name",
")",
"api_request",
"(",
"method",
"=",
"\"POST\"",
",",
"path",
"=",
"path",
")"
] | Cancel an operation using a JSON/HTTP client.
Args:
api_request (Callable): A callable used to make an API request. This
should generally be
:meth:`google.cloud._http.Connection.api_request`.
operation_name (str): The name of the operation. | [
"Cancel",
"an",
"operation",
"using",
"a",
"JSON",
"/",
"HTTP",
"client",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L204-L214 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | from_http_json | def from_http_json(operation, api_request, result_type, **kwargs):
"""Create an operation future using a HTTP/JSON client.
This interacts with the long-running operations `service`_ (specific
to a given API) via `HTTP/JSON`_.
.. _HTTP/JSON: https://cloud.google.com/speech/reference/rest/\
... | python | def from_http_json(operation, api_request, result_type, **kwargs):
"""Create an operation future using a HTTP/JSON client.
This interacts with the long-running operations `service`_ (specific
to a given API) via `HTTP/JSON`_.
.. _HTTP/JSON: https://cloud.google.com/speech/reference/rest/\
... | [
"def",
"from_http_json",
"(",
"operation",
",",
"api_request",
",",
"result_type",
",",
"*",
"*",
"kwargs",
")",
":",
"operation_proto",
"=",
"json_format",
".",
"ParseDict",
"(",
"operation",
",",
"operations_pb2",
".",
"Operation",
"(",
")",
")",
"refresh",
... | Create an operation future using a HTTP/JSON client.
This interacts with the long-running operations `service`_ (specific
to a given API) via `HTTP/JSON`_.
.. _HTTP/JSON: https://cloud.google.com/speech/reference/rest/\
v1beta1/operations#Operation
Args:
operation (dict): Operatio... | [
"Create",
"an",
"operation",
"future",
"using",
"a",
"HTTP",
"/",
"JSON",
"client",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L217-L241 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | _refresh_grpc | def _refresh_grpc(operations_stub, operation_name):
"""Refresh an operation using a gRPC client.
Args:
operations_stub (google.longrunning.operations_pb2.OperationsStub):
The gRPC operations stub.
operation_name (str): The name of the operation.
Returns:
google.longrunn... | python | def _refresh_grpc(operations_stub, operation_name):
"""Refresh an operation using a gRPC client.
Args:
operations_stub (google.longrunning.operations_pb2.OperationsStub):
The gRPC operations stub.
operation_name (str): The name of the operation.
Returns:
google.longrunn... | [
"def",
"_refresh_grpc",
"(",
"operations_stub",
",",
"operation_name",
")",
":",
"request_pb",
"=",
"operations_pb2",
".",
"GetOperationRequest",
"(",
"name",
"=",
"operation_name",
")",
"return",
"operations_stub",
".",
"GetOperation",
"(",
"request_pb",
")"
] | Refresh an operation using a gRPC client.
Args:
operations_stub (google.longrunning.operations_pb2.OperationsStub):
The gRPC operations stub.
operation_name (str): The name of the operation.
Returns:
google.longrunning.operations_pb2.Operation: The operation. | [
"Refresh",
"an",
"operation",
"using",
"a",
"gRPC",
"client",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L244-L256 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | _cancel_grpc | def _cancel_grpc(operations_stub, operation_name):
"""Cancel an operation using a gRPC client.
Args:
operations_stub (google.longrunning.operations_pb2.OperationsStub):
The gRPC operations stub.
operation_name (str): The name of the operation.
"""
request_pb = operations_pb2... | python | def _cancel_grpc(operations_stub, operation_name):
"""Cancel an operation using a gRPC client.
Args:
operations_stub (google.longrunning.operations_pb2.OperationsStub):
The gRPC operations stub.
operation_name (str): The name of the operation.
"""
request_pb = operations_pb2... | [
"def",
"_cancel_grpc",
"(",
"operations_stub",
",",
"operation_name",
")",
":",
"request_pb",
"=",
"operations_pb2",
".",
"CancelOperationRequest",
"(",
"name",
"=",
"operation_name",
")",
"operations_stub",
".",
"CancelOperation",
"(",
"request_pb",
")"
] | Cancel an operation using a gRPC client.
Args:
operations_stub (google.longrunning.operations_pb2.OperationsStub):
The gRPC operations stub.
operation_name (str): The name of the operation. | [
"Cancel",
"an",
"operation",
"using",
"a",
"gRPC",
"client",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L259-L268 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | from_grpc | def from_grpc(operation, operations_stub, result_type, **kwargs):
"""Create an operation future using a gRPC client.
This interacts with the long-running operations `service`_ (specific
to a given API) via gRPC.
.. _service: https://github.com/googleapis/googleapis/blob/\
050400df0fdb... | python | def from_grpc(operation, operations_stub, result_type, **kwargs):
"""Create an operation future using a gRPC client.
This interacts with the long-running operations `service`_ (specific
to a given API) via gRPC.
.. _service: https://github.com/googleapis/googleapis/blob/\
050400df0fdb... | [
"def",
"from_grpc",
"(",
"operation",
",",
"operations_stub",
",",
"result_type",
",",
"*",
"*",
"kwargs",
")",
":",
"refresh",
"=",
"functools",
".",
"partial",
"(",
"_refresh_grpc",
",",
"operations_stub",
",",
"operation",
".",
"name",
")",
"cancel",
"=",... | Create an operation future using a gRPC client.
This interacts with the long-running operations `service`_ (specific
to a given API) via gRPC.
.. _service: https://github.com/googleapis/googleapis/blob/\
050400df0fdb16f63b63e9dee53819044bffc857/\
google/longrunning/operat... | [
"Create",
"an",
"operation",
"future",
"using",
"a",
"gRPC",
"client",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L271-L294 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | from_gapic | def from_gapic(operation, operations_client, result_type, **kwargs):
"""Create an operation future from a gapic client.
This interacts with the long-running operations `service`_ (specific
to a given API) via a gapic client.
.. _service: https://github.com/googleapis/googleapis/blob/\
... | python | def from_gapic(operation, operations_client, result_type, **kwargs):
"""Create an operation future from a gapic client.
This interacts with the long-running operations `service`_ (specific
to a given API) via a gapic client.
.. _service: https://github.com/googleapis/googleapis/blob/\
... | [
"def",
"from_gapic",
"(",
"operation",
",",
"operations_client",
",",
"result_type",
",",
"*",
"*",
"kwargs",
")",
":",
"refresh",
"=",
"functools",
".",
"partial",
"(",
"operations_client",
".",
"get_operation",
",",
"operation",
".",
"name",
")",
"cancel",
... | Create an operation future from a gapic client.
This interacts with the long-running operations `service`_ (specific
to a given API) via a gapic client.
.. _service: https://github.com/googleapis/googleapis/blob/\
050400df0fdb16f63b63e9dee53819044bffc857/\
google/longrunn... | [
"Create",
"an",
"operation",
"future",
"from",
"a",
"gapic",
"client",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L297-L320 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | Operation.metadata | def metadata(self):
"""google.protobuf.Message: the current operation metadata."""
if not self._operation.HasField("metadata"):
return None
return protobuf_helpers.from_any_pb(
self._metadata_type, self._operation.metadata
) | python | def metadata(self):
"""google.protobuf.Message: the current operation metadata."""
if not self._operation.HasField("metadata"):
return None
return protobuf_helpers.from_any_pb(
self._metadata_type, self._operation.metadata
) | [
"def",
"metadata",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_operation",
".",
"HasField",
"(",
"\"metadata\"",
")",
":",
"return",
"None",
"return",
"protobuf_helpers",
".",
"from_any_pb",
"(",
"self",
".",
"_metadata_type",
",",
"self",
".",
"_op... | google.protobuf.Message: the current operation metadata. | [
"google",
".",
"protobuf",
".",
"Message",
":",
"the",
"current",
"operation",
"metadata",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L95-L102 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | Operation._set_result_from_operation | def _set_result_from_operation(self):
"""Set the result or exception from the operation if it is complete."""
# This must be done in a lock to prevent the polling thread
# and main thread from both executing the completion logic
# at the same time.
with self._completion_lock:
... | python | def _set_result_from_operation(self):
"""Set the result or exception from the operation if it is complete."""
# This must be done in a lock to prevent the polling thread
# and main thread from both executing the completion logic
# at the same time.
with self._completion_lock:
... | [
"def",
"_set_result_from_operation",
"(",
"self",
")",
":",
"# This must be done in a lock to prevent the polling thread",
"# and main thread from both executing the completion logic",
"# at the same time.",
"with",
"self",
".",
"_completion_lock",
":",
"# If the operation isn't complete... | Set the result or exception from the operation if it is complete. | [
"Set",
"the",
"result",
"or",
"exception",
"from",
"the",
"operation",
"if",
"it",
"is",
"complete",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L116-L146 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | Operation._refresh_and_update | def _refresh_and_update(self):
"""Refresh the operation and update the result if needed."""
# If the currently cached operation is done, no need to make another
# RPC as it will not change once done.
if not self._operation.done:
self._operation = self._refresh()
s... | python | def _refresh_and_update(self):
"""Refresh the operation and update the result if needed."""
# If the currently cached operation is done, no need to make another
# RPC as it will not change once done.
if not self._operation.done:
self._operation = self._refresh()
s... | [
"def",
"_refresh_and_update",
"(",
"self",
")",
":",
"# If the currently cached operation is done, no need to make another",
"# RPC as it will not change once done.",
"if",
"not",
"self",
".",
"_operation",
".",
"done",
":",
"self",
".",
"_operation",
"=",
"self",
".",
"_... | Refresh the operation and update the result if needed. | [
"Refresh",
"the",
"operation",
"and",
"update",
"the",
"result",
"if",
"needed",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L148-L154 | train |
googleapis/google-cloud-python | api_core/google/api_core/operation.py | Operation.cancelled | def cancelled(self):
"""True if the operation was cancelled."""
self._refresh_and_update()
return (
self._operation.HasField("error")
and self._operation.error.code == code_pb2.CANCELLED
) | python | def cancelled(self):
"""True if the operation was cancelled."""
self._refresh_and_update()
return (
self._operation.HasField("error")
and self._operation.error.code == code_pb2.CANCELLED
) | [
"def",
"cancelled",
"(",
"self",
")",
":",
"self",
".",
"_refresh_and_update",
"(",
")",
"return",
"(",
"self",
".",
"_operation",
".",
"HasField",
"(",
"\"error\"",
")",
"and",
"self",
".",
"_operation",
".",
"error",
".",
"code",
"==",
"code_pb2",
".",... | True if the operation was cancelled. | [
"True",
"if",
"the",
"operation",
"was",
"cancelled",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L178-L184 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/acl.py | _ACLEntity.revoke | def revoke(self, role):
"""Remove a role from the entity.
:type role: str
:param role: The role to remove from the entity.
"""
if role in self.roles:
self.roles.remove(role) | python | def revoke(self, role):
"""Remove a role from the entity.
:type role: str
:param role: The role to remove from the entity.
"""
if role in self.roles:
self.roles.remove(role) | [
"def",
"revoke",
"(",
"self",
",",
"role",
")",
":",
"if",
"role",
"in",
"self",
".",
"roles",
":",
"self",
".",
"roles",
".",
"remove",
"(",
"role",
")"
] | Remove a role from the entity.
:type role: str
:param role: The role to remove from the entity. | [
"Remove",
"a",
"role",
"from",
"the",
"entity",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/acl.py#L133-L140 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/acl.py | ACL.validate_predefined | def validate_predefined(cls, predefined):
"""Ensures predefined is in list of predefined json values
:type predefined: str
:param predefined: name of a predefined acl
:type predefined: str
:param predefined: validated JSON name of predefined acl
:raises: :exc: `ValueEr... | python | def validate_predefined(cls, predefined):
"""Ensures predefined is in list of predefined json values
:type predefined: str
:param predefined: name of a predefined acl
:type predefined: str
:param predefined: validated JSON name of predefined acl
:raises: :exc: `ValueEr... | [
"def",
"validate_predefined",
"(",
"cls",
",",
"predefined",
")",
":",
"predefined",
"=",
"cls",
".",
"PREDEFINED_XML_ACLS",
".",
"get",
"(",
"predefined",
",",
"predefined",
")",
"if",
"predefined",
"and",
"predefined",
"not",
"in",
"cls",
".",
"PREDEFINED_JS... | Ensures predefined is in list of predefined json values
:type predefined: str
:param predefined: name of a predefined acl
:type predefined: str
:param predefined: validated JSON name of predefined acl
:raises: :exc: `ValueError`: If predefined is not a valid acl | [
"Ensures",
"predefined",
"is",
"in",
"list",
"of",
"predefined",
"json",
"values"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/acl.py#L215-L229 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/acl.py | ACL.entity_from_dict | def entity_from_dict(self, entity_dict):
"""Build an _ACLEntity object from a dictionary of data.
An entity is a mutable object that represents a list of roles
belonging to either a user or group or the special types for all
users and all authenticated users.
:type entity_dict:... | python | def entity_from_dict(self, entity_dict):
"""Build an _ACLEntity object from a dictionary of data.
An entity is a mutable object that represents a list of roles
belonging to either a user or group or the special types for all
users and all authenticated users.
:type entity_dict:... | [
"def",
"entity_from_dict",
"(",
"self",
",",
"entity_dict",
")",
":",
"entity",
"=",
"entity_dict",
"[",
"\"entity\"",
"]",
"role",
"=",
"entity_dict",
"[",
"\"role\"",
"]",
"if",
"entity",
"==",
"\"allUsers\"",
":",
"entity",
"=",
"self",
".",
"all",
"(",... | Build an _ACLEntity object from a dictionary of data.
An entity is a mutable object that represents a list of roles
belonging to either a user or group or the special types for all
users and all authenticated users.
:type entity_dict: dict
:param entity_dict: Dictionary full of... | [
"Build",
"an",
"_ACLEntity",
"object",
"from",
"a",
"dictionary",
"of",
"data",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/acl.py#L244-L274 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/acl.py | ACL.get_entity | def get_entity(self, entity, default=None):
"""Gets an entity object from the ACL.
:type entity: :class:`_ACLEntity` or string
:param entity: The entity to get lookup in the ACL.
:type default: anything
:param default: This value will be returned if the entity
... | python | def get_entity(self, entity, default=None):
"""Gets an entity object from the ACL.
:type entity: :class:`_ACLEntity` or string
:param entity: The entity to get lookup in the ACL.
:type default: anything
:param default: This value will be returned if the entity
... | [
"def",
"get_entity",
"(",
"self",
",",
"entity",
",",
"default",
"=",
"None",
")",
":",
"self",
".",
"_ensure_loaded",
"(",
")",
"return",
"self",
".",
"entities",
".",
"get",
"(",
"str",
"(",
"entity",
")",
",",
"default",
")"
] | Gets an entity object from the ACL.
:type entity: :class:`_ACLEntity` or string
:param entity: The entity to get lookup in the ACL.
:type default: anything
:param default: This value will be returned if the entity
doesn't exist.
:rtype: :class:`_ACLEnti... | [
"Gets",
"an",
"entity",
"object",
"from",
"the",
"ACL",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/acl.py#L288-L303 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/acl.py | ACL.add_entity | def add_entity(self, entity):
"""Add an entity to the ACL.
:type entity: :class:`_ACLEntity`
:param entity: The entity to add to this ACL.
"""
self._ensure_loaded()
self.entities[str(entity)] = entity | python | def add_entity(self, entity):
"""Add an entity to the ACL.
:type entity: :class:`_ACLEntity`
:param entity: The entity to add to this ACL.
"""
self._ensure_loaded()
self.entities[str(entity)] = entity | [
"def",
"add_entity",
"(",
"self",
",",
"entity",
")",
":",
"self",
".",
"_ensure_loaded",
"(",
")",
"self",
".",
"entities",
"[",
"str",
"(",
"entity",
")",
"]",
"=",
"entity"
] | Add an entity to the ACL.
:type entity: :class:`_ACLEntity`
:param entity: The entity to add to this ACL. | [
"Add",
"an",
"entity",
"to",
"the",
"ACL",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/acl.py#L305-L312 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/acl.py | ACL.entity | def entity(self, entity_type, identifier=None):
"""Factory method for creating an Entity.
If an entity with the same type and identifier already exists,
this will return a reference to that entity. If not, it will
create a new one and add it to the list of known entities for
th... | python | def entity(self, entity_type, identifier=None):
"""Factory method for creating an Entity.
If an entity with the same type and identifier already exists,
this will return a reference to that entity. If not, it will
create a new one and add it to the list of known entities for
th... | [
"def",
"entity",
"(",
"self",
",",
"entity_type",
",",
"identifier",
"=",
"None",
")",
":",
"entity",
"=",
"_ACLEntity",
"(",
"entity_type",
"=",
"entity_type",
",",
"identifier",
"=",
"identifier",
")",
"if",
"self",
".",
"has_entity",
"(",
"entity",
")",... | Factory method for creating an Entity.
If an entity with the same type and identifier already exists,
this will return a reference to that entity. If not, it will
create a new one and add it to the list of known entities for
this ACL.
:type entity_type: str
:param enti... | [
"Factory",
"method",
"for",
"creating",
"an",
"Entity",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/acl.py#L314-L338 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/acl.py | ACL.reload | def reload(self, client=None):
"""Reload the ACL data from Cloud Storage.
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. ... | python | def reload(self, client=None):
"""Reload the ACL data from Cloud Storage.
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. ... | [
"def",
"reload",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"path",
"=",
"self",
".",
"reload_path",
"client",
"=",
"self",
".",
"_require_client",
"(",
"client",
")",
"query_params",
"=",
"{",
"}",
"if",
"self",
".",
"user_project",
"is",
"not... | Reload the ACL data from Cloud Storage.
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: Optional. The client to use. If not passed, falls back
... | [
"Reload",
"the",
"ACL",
"data",
"from",
"Cloud",
"Storage",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/acl.py#L418-L442 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/acl.py | ACL._save | def _save(self, acl, predefined, client):
"""Helper for :meth:`save` and :meth:`save_predefined`.
:type acl: :class:`google.cloud.storage.acl.ACL`, or a compatible list.
:param acl: The ACL object to save. If left blank, this will save
current entries.
:type predef... | python | def _save(self, acl, predefined, client):
"""Helper for :meth:`save` and :meth:`save_predefined`.
:type acl: :class:`google.cloud.storage.acl.ACL`, or a compatible list.
:param acl: The ACL object to save. If left blank, this will save
current entries.
:type predef... | [
"def",
"_save",
"(",
"self",
",",
"acl",
",",
"predefined",
",",
"client",
")",
":",
"query_params",
"=",
"{",
"\"projection\"",
":",
"\"full\"",
"}",
"if",
"predefined",
"is",
"not",
"None",
":",
"acl",
"=",
"[",
"]",
"query_params",
"[",
"self",
".",... | Helper for :meth:`save` and :meth:`save_predefined`.
:type acl: :class:`google.cloud.storage.acl.ACL`, or a compatible list.
:param acl: The ACL object to save. If left blank, this will save
current entries.
:type predefined: str
:param predefined:
(Opt... | [
"Helper",
"for",
":",
"meth",
":",
"save",
"and",
":",
"meth",
":",
"save_predefined",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/acl.py#L444-L481 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/acl.py | ACL.save | def save(self, acl=None, client=None):
"""Save this ACL for the current bucket.
If :attr:`user_project` is set, bills the API request to that project.
:type acl: :class:`google.cloud.storage.acl.ACL`, or a compatible list.
:param acl: The ACL object to save. If left blank, this will s... | python | def save(self, acl=None, client=None):
"""Save this ACL for the current bucket.
If :attr:`user_project` is set, bills the API request to that project.
:type acl: :class:`google.cloud.storage.acl.ACL`, or a compatible list.
:param acl: The ACL object to save. If left blank, this will s... | [
"def",
"save",
"(",
"self",
",",
"acl",
"=",
"None",
",",
"client",
"=",
"None",
")",
":",
"if",
"acl",
"is",
"None",
":",
"acl",
"=",
"self",
"save_to_backend",
"=",
"acl",
".",
"loaded",
"else",
":",
"save_to_backend",
"=",
"True",
"if",
"save_to_b... | Save this ACL for the current bucket.
If :attr:`user_project` is set, bills the API request to that project.
:type acl: :class:`google.cloud.storage.acl.ACL`, or a compatible list.
:param acl: The ACL object to save. If left blank, this will save
current entries.
... | [
"Save",
"this",
"ACL",
"for",
"the",
"current",
"bucket",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/acl.py#L483-L504 | train |
googleapis/google-cloud-python | storage/google/cloud/storage/acl.py | ACL.save_predefined | def save_predefined(self, predefined, client=None):
"""Save this ACL for the current bucket using a predefined ACL.
If :attr:`user_project` is set, bills the API request to that project.
:type predefined: str
:param predefined: An identifier for a predefined ACL. Must be one
... | python | def save_predefined(self, predefined, client=None):
"""Save this ACL for the current bucket using a predefined ACL.
If :attr:`user_project` is set, bills the API request to that project.
:type predefined: str
:param predefined: An identifier for a predefined ACL. Must be one
... | [
"def",
"save_predefined",
"(",
"self",
",",
"predefined",
",",
"client",
"=",
"None",
")",
":",
"predefined",
"=",
"self",
".",
"validate_predefined",
"(",
"predefined",
")",
"self",
".",
"_save",
"(",
"None",
",",
"predefined",
",",
"client",
")"
] | Save this ACL for the current bucket using a predefined ACL.
If :attr:`user_project` is set, bills the API request to that project.
:type predefined: str
:param predefined: An identifier for a predefined ACL. Must be one
of the keys in :attr:`PREDEFINED_JSON_ACLS`
... | [
"Save",
"this",
"ACL",
"for",
"the",
"current",
"bucket",
"using",
"a",
"predefined",
"ACL",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/acl.py#L506-L524 | train |
googleapis/google-cloud-python | irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py | IncidentServiceClient.incident_path | def incident_path(cls, project, incident):
"""Return a fully-qualified incident string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}",
project=project,
incident=incident,
) | python | def incident_path(cls, project, incident):
"""Return a fully-qualified incident string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}",
project=project,
incident=incident,
) | [
"def",
"incident_path",
"(",
"cls",
",",
"project",
",",
"incident",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/incidents/{incident}\"",
",",
"project",
"=",
"project",
",",
"incident",
"=",
"in... | Return a fully-qualified incident string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"incident",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py#L82-L88 | train |
googleapis/google-cloud-python | irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py | IncidentServiceClient.annotation_path | def annotation_path(cls, project, incident, annotation):
"""Return a fully-qualified annotation string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/annotations/{annotation}",
project=project,
incident=incident,
... | python | def annotation_path(cls, project, incident, annotation):
"""Return a fully-qualified annotation string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/annotations/{annotation}",
project=project,
incident=incident,
... | [
"def",
"annotation_path",
"(",
"cls",
",",
"project",
",",
"incident",
",",
"annotation",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/incidents/{incident}/annotations/{annotation}\"",
",",
"project",
"... | Return a fully-qualified annotation string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"annotation",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py#L91-L98 | train |
googleapis/google-cloud-python | irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py | IncidentServiceClient.artifact_path | def artifact_path(cls, project, incident, artifact):
"""Return a fully-qualified artifact string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/artifacts/{artifact}",
project=project,
incident=incident,
artifact=a... | python | def artifact_path(cls, project, incident, artifact):
"""Return a fully-qualified artifact string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/artifacts/{artifact}",
project=project,
incident=incident,
artifact=a... | [
"def",
"artifact_path",
"(",
"cls",
",",
"project",
",",
"incident",
",",
"artifact",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/incidents/{incident}/artifacts/{artifact}\"",
",",
"project",
"=",
"p... | Return a fully-qualified artifact string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"artifact",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py#L101-L108 | train |
googleapis/google-cloud-python | irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py | IncidentServiceClient.role_assignment_path | def role_assignment_path(cls, project, incident, role_assignment):
"""Return a fully-qualified role_assignment string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/roleAssignments/{role_assignment}",
project=project,
inciden... | python | def role_assignment_path(cls, project, incident, role_assignment):
"""Return a fully-qualified role_assignment string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/roleAssignments/{role_assignment}",
project=project,
inciden... | [
"def",
"role_assignment_path",
"(",
"cls",
",",
"project",
",",
"incident",
",",
"role_assignment",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/incidents/{incident}/roleAssignments/{role_assignment}\"",
",... | Return a fully-qualified role_assignment string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"role_assignment",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py#L111-L118 | train |
googleapis/google-cloud-python | irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py | IncidentServiceClient.subscription_path | def subscription_path(cls, project, incident, subscription):
"""Return a fully-qualified subscription string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/subscriptions/{subscription}",
project=project,
incident=incident,
... | python | def subscription_path(cls, project, incident, subscription):
"""Return a fully-qualified subscription string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/subscriptions/{subscription}",
project=project,
incident=incident,
... | [
"def",
"subscription_path",
"(",
"cls",
",",
"project",
",",
"incident",
",",
"subscription",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/incidents/{incident}/subscriptions/{subscription}\"",
",",
"proje... | Return a fully-qualified subscription string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"subscription",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py#L121-L128 | train |
googleapis/google-cloud-python | irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py | IncidentServiceClient.tag_path | def tag_path(cls, project, incident, tag):
"""Return a fully-qualified tag string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/tags/{tag}",
project=project,
incident=incident,
tag=tag,
) | python | def tag_path(cls, project, incident, tag):
"""Return a fully-qualified tag string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/tags/{tag}",
project=project,
incident=incident,
tag=tag,
) | [
"def",
"tag_path",
"(",
"cls",
",",
"project",
",",
"incident",
",",
"tag",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/incidents/{incident}/tags/{tag}\"",
",",
"project",
"=",
"project",
",",
"i... | Return a fully-qualified tag string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"tag",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py#L131-L138 | train |
googleapis/google-cloud-python | irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py | IncidentServiceClient.signal_path | def signal_path(cls, project, signal):
"""Return a fully-qualified signal string."""
return google.api_core.path_template.expand(
"projects/{project}/signals/{signal}", project=project, signal=signal
) | python | def signal_path(cls, project, signal):
"""Return a fully-qualified signal string."""
return google.api_core.path_template.expand(
"projects/{project}/signals/{signal}", project=project, signal=signal
) | [
"def",
"signal_path",
"(",
"cls",
",",
"project",
",",
"signal",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/signals/{signal}\"",
",",
"project",
"=",
"project",
",",
"signal",
"=",
"signal",
"... | Return a fully-qualified signal string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"signal",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py#L141-L145 | train |
googleapis/google-cloud-python | irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py | IncidentServiceClient.create_annotation | def create_annotation(
self,
parent,
annotation,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates an annotation on an existing incident. Only 'text/plain' and
'text/ma... | python | def create_annotation(
self,
parent,
annotation,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates an annotation on an existing incident. Only 'text/plain' and
'text/ma... | [
"def",
"create_annotation",
"(",
"self",
",",
"parent",
",",
"annotation",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
... | Creates an annotation on an existing incident. Only 'text/plain' and
'text/markdown' annotations can be created via this method.
Example:
>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> p... | [
"Creates",
"an",
"annotation",
"on",
"an",
"existing",
"incident",
".",
"Only",
"text",
"/",
"plain",
"and",
"text",
"/",
"markdown",
"annotations",
"can",
"be",
"created",
"via",
"this",
"method",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py#L755-L834 | train |
googleapis/google-cloud-python | irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py | IncidentServiceClient.escalate_incident | def escalate_incident(
self,
incident,
update_mask=None,
subscriptions=None,
tags=None,
roles=None,
artifacts=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
... | python | def escalate_incident(
self,
incident,
update_mask=None,
subscriptions=None,
tags=None,
roles=None,
artifacts=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
... | [
"def",
"escalate_incident",
"(",
"self",
",",
"incident",
",",
"update_mask",
"=",
"None",
",",
"subscriptions",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"roles",
"=",
"None",
",",
"artifacts",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core"... | Escalates an incident.
Example:
>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> # TODO: Initialize `incident`:
>>> incident = {}
>>>
>>> response = client.esca... | [
"Escalates",
"an",
"incident",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py#L1527-L1632 | train |
googleapis/google-cloud-python | irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py | IncidentServiceClient.send_shift_handoff | def send_shift_handoff(
self,
parent,
recipients,
subject,
cc=None,
notes_content_type=None,
notes_content=None,
incidents=None,
preview_only=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.meth... | python | def send_shift_handoff(
self,
parent,
recipients,
subject,
cc=None,
notes_content_type=None,
notes_content=None,
incidents=None,
preview_only=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.meth... | [
"def",
"send_shift_handoff",
"(",
"self",
",",
"parent",
",",
"recipients",
",",
"subject",
",",
"cc",
"=",
"None",
",",
"notes_content_type",
"=",
"None",
",",
"notes_content",
"=",
"None",
",",
"incidents",
"=",
"None",
",",
"preview_only",
"=",
"None",
... | Sends a summary of the shift for oncall handoff.
Example:
>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # TODO: Initial... | [
"Sends",
"a",
"summary",
"of",
"the",
"shift",
"for",
"oncall",
"handoff",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py#L1964-L2066 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/policy.py | Policy.bigtable_admins | def bigtable_admins(self):
"""Access to bigtable.admin role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_admins_policy]
:end-before: [END bigtable_admins_policy]
"""
result = set()
for member in self._bindin... | python | def bigtable_admins(self):
"""Access to bigtable.admin role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_admins_policy]
:end-before: [END bigtable_admins_policy]
"""
result = set()
for member in self._bindin... | [
"def",
"bigtable_admins",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"member",
"in",
"self",
".",
"_bindings",
".",
"get",
"(",
"BIGTABLE_ADMIN_ROLE",
",",
"(",
")",
")",
":",
"result",
".",
"add",
"(",
"member",
")",
"return",
"fr... | Access to bigtable.admin role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_admins_policy]
:end-before: [END bigtable_admins_policy] | [
"Access",
"to",
"bigtable",
".",
"admin",
"role",
"memebers"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/policy.py#L83-L95 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/policy.py | Policy.bigtable_readers | def bigtable_readers(self):
"""Access to bigtable.reader role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_readers_policy]
:end-before: [END bigtable_readers_policy]
"""
result = set()
for member in self._bi... | python | def bigtable_readers(self):
"""Access to bigtable.reader role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_readers_policy]
:end-before: [END bigtable_readers_policy]
"""
result = set()
for member in self._bi... | [
"def",
"bigtable_readers",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"member",
"in",
"self",
".",
"_bindings",
".",
"get",
"(",
"BIGTABLE_READER_ROLE",
",",
"(",
")",
")",
":",
"result",
".",
"add",
"(",
"member",
")",
"return",
"... | Access to bigtable.reader role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_readers_policy]
:end-before: [END bigtable_readers_policy] | [
"Access",
"to",
"bigtable",
".",
"reader",
"role",
"memebers"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/policy.py#L98-L110 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/policy.py | Policy.bigtable_users | def bigtable_users(self):
"""Access to bigtable.user role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_users_policy]
:end-before: [END bigtable_users_policy]
"""
result = set()
for member in self._bindings.g... | python | def bigtable_users(self):
"""Access to bigtable.user role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_users_policy]
:end-before: [END bigtable_users_policy]
"""
result = set()
for member in self._bindings.g... | [
"def",
"bigtable_users",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"member",
"in",
"self",
".",
"_bindings",
".",
"get",
"(",
"BIGTABLE_USER_ROLE",
",",
"(",
")",
")",
":",
"result",
".",
"add",
"(",
"member",
")",
"return",
"froz... | Access to bigtable.user role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_users_policy]
:end-before: [END bigtable_users_policy] | [
"Access",
"to",
"bigtable",
".",
"user",
"role",
"memebers"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/policy.py#L113-L125 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/policy.py | Policy.bigtable_viewers | def bigtable_viewers(self):
"""Access to bigtable.viewer role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_viewers_policy]
:end-before: [END bigtable_viewers_policy]
"""
result = set()
for member in self._bi... | python | def bigtable_viewers(self):
"""Access to bigtable.viewer role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_viewers_policy]
:end-before: [END bigtable_viewers_policy]
"""
result = set()
for member in self._bi... | [
"def",
"bigtable_viewers",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"member",
"in",
"self",
".",
"_bindings",
".",
"get",
"(",
"BIGTABLE_VIEWER_ROLE",
",",
"(",
")",
")",
":",
"result",
".",
"add",
"(",
"member",
")",
"return",
"... | Access to bigtable.viewer role memebers
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_viewers_policy]
:end-before: [END bigtable_viewers_policy] | [
"Access",
"to",
"bigtable",
".",
"viewer",
"role",
"memebers"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/policy.py#L128-L140 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/policy.py | Policy.from_pb | def from_pb(cls, policy_pb):
"""Factory: create a policy from a protobuf message.
Args:
policy_pb (google.iam.policy_pb2.Policy): message returned by
``get_iam_policy`` gRPC API.
Returns:
:class:`Policy`: the parsed policy
"""
policy = cls(po... | python | def from_pb(cls, policy_pb):
"""Factory: create a policy from a protobuf message.
Args:
policy_pb (google.iam.policy_pb2.Policy): message returned by
``get_iam_policy`` gRPC API.
Returns:
:class:`Policy`: the parsed policy
"""
policy = cls(po... | [
"def",
"from_pb",
"(",
"cls",
",",
"policy_pb",
")",
":",
"policy",
"=",
"cls",
"(",
"policy_pb",
".",
"etag",
",",
"policy_pb",
".",
"version",
")",
"for",
"binding",
"in",
"policy_pb",
".",
"bindings",
":",
"policy",
"[",
"binding",
".",
"role",
"]",... | Factory: create a policy from a protobuf message.
Args:
policy_pb (google.iam.policy_pb2.Policy): message returned by
``get_iam_policy`` gRPC API.
Returns:
:class:`Policy`: the parsed policy | [
"Factory",
":",
"create",
"a",
"policy",
"from",
"a",
"protobuf",
"message",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/policy.py#L143-L158 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/policy.py | Policy.to_pb | def to_pb(self):
"""Render a protobuf message.
Returns:
google.iam.policy_pb2.Policy: a message to be passed to the
``set_iam_policy`` gRPC API.
"""
return policy_pb2.Policy(
etag=self.etag,
version=self.version or 0,
bindings... | python | def to_pb(self):
"""Render a protobuf message.
Returns:
google.iam.policy_pb2.Policy: a message to be passed to the
``set_iam_policy`` gRPC API.
"""
return policy_pb2.Policy(
etag=self.etag,
version=self.version or 0,
bindings... | [
"def",
"to_pb",
"(",
"self",
")",
":",
"return",
"policy_pb2",
".",
"Policy",
"(",
"etag",
"=",
"self",
".",
"etag",
",",
"version",
"=",
"self",
".",
"version",
"or",
"0",
",",
"bindings",
"=",
"[",
"policy_pb2",
".",
"Binding",
"(",
"role",
"=",
... | Render a protobuf message.
Returns:
google.iam.policy_pb2.Policy: a message to be passed to the
``set_iam_policy`` gRPC API. | [
"Render",
"a",
"protobuf",
"message",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/policy.py#L160-L175 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/policy.py | Policy.from_api_repr | def from_api_repr(cls, resource):
"""Factory: create a policy from a JSON resource.
Overrides the base class version to store :attr:`etag` as bytes.
Args:
resource (dict): JSON policy resource returned by the
``getIamPolicy`` REST API.
Returns:
:cla... | python | def from_api_repr(cls, resource):
"""Factory: create a policy from a JSON resource.
Overrides the base class version to store :attr:`etag` as bytes.
Args:
resource (dict): JSON policy resource returned by the
``getIamPolicy`` REST API.
Returns:
:cla... | [
"def",
"from_api_repr",
"(",
"cls",
",",
"resource",
")",
":",
"etag",
"=",
"resource",
".",
"get",
"(",
"\"etag\"",
")",
"if",
"etag",
"is",
"not",
"None",
":",
"resource",
"=",
"resource",
".",
"copy",
"(",
")",
"resource",
"[",
"\"etag\"",
"]",
"=... | Factory: create a policy from a JSON resource.
Overrides the base class version to store :attr:`etag` as bytes.
Args:
resource (dict): JSON policy resource returned by the
``getIamPolicy`` REST API.
Returns:
:class:`Policy`: the parsed policy | [
"Factory",
":",
"create",
"a",
"policy",
"from",
"a",
"JSON",
"resource",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/policy.py#L178-L196 | train |
googleapis/google-cloud-python | bigtable/google/cloud/bigtable/policy.py | Policy.to_api_repr | def to_api_repr(self):
"""Render a JSON policy resource.
Overrides the base class version to convert :attr:`etag` from bytes
to JSON-compatible base64-encoded text.
Returns:
dict: a JSON resource to be passed to the
``setIamPolicy`` REST API.
"""
... | python | def to_api_repr(self):
"""Render a JSON policy resource.
Overrides the base class version to convert :attr:`etag` from bytes
to JSON-compatible base64-encoded text.
Returns:
dict: a JSON resource to be passed to the
``setIamPolicy`` REST API.
"""
... | [
"def",
"to_api_repr",
"(",
"self",
")",
":",
"resource",
"=",
"super",
"(",
"Policy",
",",
"self",
")",
".",
"to_api_repr",
"(",
")",
"if",
"self",
".",
"etag",
"is",
"not",
"None",
":",
"resource",
"[",
"\"etag\"",
"]",
"=",
"base64",
".",
"b64encod... | Render a JSON policy resource.
Overrides the base class version to convert :attr:`etag` from bytes
to JSON-compatible base64-encoded text.
Returns:
dict: a JSON resource to be passed to the
``setIamPolicy`` REST API. | [
"Render",
"a",
"JSON",
"policy",
"resource",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/policy.py#L198-L213 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | _check_ddl_statements | def _check_ddl_statements(value):
"""Validate DDL Statements used to define database schema.
See
https://cloud.google.com/spanner/docs/data-definition-language
:type value: list of string
:param value: DDL statements, excluding the 'CREATE DATABSE' statement
:rtype: tuple
:returns: tuple ... | python | def _check_ddl_statements(value):
"""Validate DDL Statements used to define database schema.
See
https://cloud.google.com/spanner/docs/data-definition-language
:type value: list of string
:param value: DDL statements, excluding the 'CREATE DATABSE' statement
:rtype: tuple
:returns: tuple ... | [
"def",
"_check_ddl_statements",
"(",
"value",
")",
":",
"if",
"not",
"all",
"(",
"isinstance",
"(",
"line",
",",
"six",
".",
"string_types",
")",
"for",
"line",
"in",
"value",
")",
":",
"raise",
"ValueError",
"(",
"\"Pass a list of strings\"",
")",
"if",
"... | Validate DDL Statements used to define database schema.
See
https://cloud.google.com/spanner/docs/data-definition-language
:type value: list of string
:param value: DDL statements, excluding the 'CREATE DATABSE' statement
:rtype: tuple
:returns: tuple of validated DDL statement strings.
:... | [
"Validate",
"DDL",
"Statements",
"used",
"to",
"define",
"database",
"schema",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L790-L811 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | Database.from_pb | def from_pb(cls, database_pb, instance, pool=None):
"""Creates an instance of this class from a protobuf.
:type database_pb:
:class:`google.spanner.v2.spanner_instance_admin_pb2.Instance`
:param database_pb: A instance protobuf object.
:type instance: :class:`~google.cloud.... | python | def from_pb(cls, database_pb, instance, pool=None):
"""Creates an instance of this class from a protobuf.
:type database_pb:
:class:`google.spanner.v2.spanner_instance_admin_pb2.Instance`
:param database_pb: A instance protobuf object.
:type instance: :class:`~google.cloud.... | [
"def",
"from_pb",
"(",
"cls",
",",
"database_pb",
",",
"instance",
",",
"pool",
"=",
"None",
")",
":",
"match",
"=",
"_DATABASE_NAME_RE",
".",
"match",
"(",
"database_pb",
".",
"name",
")",
"if",
"match",
"is",
"None",
":",
"raise",
"ValueError",
"(",
... | Creates an instance of this class from a protobuf.
:type database_pb:
:class:`google.spanner.v2.spanner_instance_admin_pb2.Instance`
:param database_pb: A instance protobuf object.
:type instance: :class:`~google.cloud.spanner_v1.instance.Instance`
:param instance: The inst... | [
"Creates",
"an",
"instance",
"of",
"this",
"class",
"from",
"a",
"protobuf",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L102-L143 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | Database.spanner_api | def spanner_api(self):
"""Helper for session-related API calls."""
if self._spanner_api is None:
credentials = self._instance._client.credentials
if isinstance(credentials, google.auth.credentials.Scoped):
credentials = credentials.with_scopes((SPANNER_DATA_SCOPE,... | python | def spanner_api(self):
"""Helper for session-related API calls."""
if self._spanner_api is None:
credentials = self._instance._client.credentials
if isinstance(credentials, google.auth.credentials.Scoped):
credentials = credentials.with_scopes((SPANNER_DATA_SCOPE,... | [
"def",
"spanner_api",
"(",
"self",
")",
":",
"if",
"self",
".",
"_spanner_api",
"is",
"None",
":",
"credentials",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"credentials",
"if",
"isinstance",
"(",
"credentials",
",",
"google",
".",
"auth",
".",
... | Helper for session-related API calls. | [
"Helper",
"for",
"session",
"-",
"related",
"API",
"calls",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L176-L185 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | Database.create | def create(self):
"""Create this database within its instance
Inclues any configured schema assigned to :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase
:rt... | python | def create(self):
"""Create this database within its instance
Inclues any configured schema assigned to :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase
:rt... | [
"def",
"create",
"(",
"self",
")",
":",
"api",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"database_admin_api",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self",
".",
"name",
")",
"db_name",
"=",
"self",
".",
"database_id",
"if",
"\"-\"",
"in... | Create this database within its instance
Inclues any configured schema assigned to :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase
:rtype: :class:`~google.api_core... | [
"Create",
"this",
"database",
"within",
"its",
"instance"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L197-L222 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | Database.exists | def exists(self):
"""Test whether this database exists.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDDL
:rtype: bool
:returns: True if the database exists, else false.
"""
... | python | def exists(self):
"""Test whether this database exists.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDDL
:rtype: bool
:returns: True if the database exists, else false.
"""
... | [
"def",
"exists",
"(",
"self",
")",
":",
"api",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"database_admin_api",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self",
".",
"name",
")",
"try",
":",
"api",
".",
"get_database_ddl",
"(",
"self",
".",
... | Test whether this database exists.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDDL
:rtype: bool
:returns: True if the database exists, else false. | [
"Test",
"whether",
"this",
"database",
"exists",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L224-L240 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | Database.reload | def reload(self):
"""Reload this database.
Refresh any configured schema into :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDDL
:raises NotFound: if the data... | python | def reload(self):
"""Reload this database.
Refresh any configured schema into :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDDL
:raises NotFound: if the data... | [
"def",
"reload",
"(",
"self",
")",
":",
"api",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"database_admin_api",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self",
".",
"name",
")",
"response",
"=",
"api",
".",
"get_database_ddl",
"(",
"self",
... | Reload this database.
Refresh any configured schema into :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDDL
:raises NotFound: if the database does not exist | [
"Reload",
"this",
"database",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L242-L255 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | Database.update_ddl | def update_ddl(self, ddl_statements, operation_id=""):
"""Update DDL for this database.
Apply any configured schema from :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.UpdateData... | python | def update_ddl(self, ddl_statements, operation_id=""):
"""Update DDL for this database.
Apply any configured schema from :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.UpdateData... | [
"def",
"update_ddl",
"(",
"self",
",",
"ddl_statements",
",",
"operation_id",
"=",
"\"\"",
")",
":",
"client",
"=",
"self",
".",
"_instance",
".",
"_client",
"api",
"=",
"client",
".",
"database_admin_api",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self"... | Update DDL for this database.
Apply any configured schema from :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase
:type ddl_statements: Sequence[str]
:param d... | [
"Update",
"DDL",
"for",
"this",
"database",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L257-L281 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | Database.drop | def drop(self):
"""Drop this database.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase
"""
api = self._instance._client.database_admin_api
metadata = _metadata_with_prefix(sel... | python | def drop(self):
"""Drop this database.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase
"""
api = self._instance._client.database_admin_api
metadata = _metadata_with_prefix(sel... | [
"def",
"drop",
"(",
"self",
")",
":",
"api",
"=",
"self",
".",
"_instance",
".",
"_client",
".",
"database_admin_api",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self",
".",
"name",
")",
"api",
".",
"drop_database",
"(",
"self",
".",
"name",
",",
"m... | Drop this database.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase | [
"Drop",
"this",
"database",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L283-L291 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | Database.execute_partitioned_dml | def execute_partitioned_dml(self, dml, params=None, param_types=None):
"""Execute a partitionable DML statement.
:type dml: str
:param dml: DML statement
:type params: dict, {str -> column value}
:param params: values for parameter replacement. Keys must match
... | python | def execute_partitioned_dml(self, dml, params=None, param_types=None):
"""Execute a partitionable DML statement.
:type dml: str
:param dml: DML statement
:type params: dict, {str -> column value}
:param params: values for parameter replacement. Keys must match
... | [
"def",
"execute_partitioned_dml",
"(",
"self",
",",
"dml",
",",
"params",
"=",
"None",
",",
"param_types",
"=",
"None",
")",
":",
"if",
"params",
"is",
"not",
"None",
":",
"if",
"param_types",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Specify 'para... | Execute a partitionable DML statement.
:type dml: str
:param dml: DML statement
:type params: dict, {str -> column value}
:param params: values for parameter replacement. Keys must match
the names used in ``dml``.
:type param_types: dict[str -> Union[di... | [
"Execute",
"a",
"partitionable",
"DML",
"statement",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L293-L349 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | Database.batch_snapshot | def batch_snapshot(self, read_timestamp=None, exact_staleness=None):
"""Return an object which wraps a batch read / query.
:type read_timestamp: :class:`datetime.datetime`
:param read_timestamp: Execute all reads at the given timestamp.
:type exact_staleness: :class:`datetime.timedelta... | python | def batch_snapshot(self, read_timestamp=None, exact_staleness=None):
"""Return an object which wraps a batch read / query.
:type read_timestamp: :class:`datetime.datetime`
:param read_timestamp: Execute all reads at the given timestamp.
:type exact_staleness: :class:`datetime.timedelta... | [
"def",
"batch_snapshot",
"(",
"self",
",",
"read_timestamp",
"=",
"None",
",",
"exact_staleness",
"=",
"None",
")",
":",
"return",
"BatchSnapshot",
"(",
"self",
",",
"read_timestamp",
"=",
"read_timestamp",
",",
"exact_staleness",
"=",
"exact_staleness",
")"
] | Return an object which wraps a batch read / query.
:type read_timestamp: :class:`datetime.datetime`
:param read_timestamp: Execute all reads at the given timestamp.
:type exact_staleness: :class:`datetime.timedelta`
:param exact_staleness: Execute all reads at a timestamp that is
... | [
"Return",
"an",
"object",
"which",
"wraps",
"a",
"batch",
"read",
"/",
"query",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L392-L407 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | Database.run_in_transaction | def run_in_transaction(self, func, *args, **kw):
"""Perform a unit of work in a transaction, retrying on abort.
:type func: callable
:param func: takes a required positional argument, the transaction,
and additional positional / keyword arguments as supplied
... | python | def run_in_transaction(self, func, *args, **kw):
"""Perform a unit of work in a transaction, retrying on abort.
:type func: callable
:param func: takes a required positional argument, the transaction,
and additional positional / keyword arguments as supplied
... | [
"def",
"run_in_transaction",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"# Sanity check: Is there a transaction already running?",
"# If there is, then raise a red flag. Otherwise, mark that this one",
"# is running.",
"if",
"getattr",
"(",
"... | Perform a unit of work in a transaction, retrying on abort.
:type func: callable
:param func: takes a required positional argument, the transaction,
and additional positional / keyword arguments as supplied
by the caller.
:type args: tuple
:par... | [
"Perform",
"a",
"unit",
"of",
"work",
"in",
"a",
"transaction",
"retrying",
"on",
"abort",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L409-L441 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | BatchSnapshot.from_dict | def from_dict(cls, database, mapping):
"""Reconstruct an instance from a mapping.
:type database: :class:`~google.cloud.spanner.database.Database`
:param database: database to use
:type mapping: mapping
:param mapping: serialized state of the instance
:rtype: :class:`B... | python | def from_dict(cls, database, mapping):
"""Reconstruct an instance from a mapping.
:type database: :class:`~google.cloud.spanner.database.Database`
:param database: database to use
:type mapping: mapping
:param mapping: serialized state of the instance
:rtype: :class:`B... | [
"def",
"from_dict",
"(",
"cls",
",",
"database",
",",
"mapping",
")",
":",
"instance",
"=",
"cls",
"(",
"database",
")",
"session",
"=",
"instance",
".",
"_session",
"=",
"database",
".",
"session",
"(",
")",
"session",
".",
"_session_id",
"=",
"mapping"... | Reconstruct an instance from a mapping.
:type database: :class:`~google.cloud.spanner.database.Database`
:param database: database to use
:type mapping: mapping
:param mapping: serialized state of the instance
:rtype: :class:`BatchSnapshot` | [
"Reconstruct",
"an",
"instance",
"from",
"a",
"mapping",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L531-L547 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | BatchSnapshot.to_dict | def to_dict(self):
"""Return state as a dictionary.
Result can be used to serialize the instance and reconstitute
it later using :meth:`from_dict`.
:rtype: dict
"""
session = self._get_session()
snapshot = self._get_snapshot()
return {
"sessi... | python | def to_dict(self):
"""Return state as a dictionary.
Result can be used to serialize the instance and reconstitute
it later using :meth:`from_dict`.
:rtype: dict
"""
session = self._get_session()
snapshot = self._get_snapshot()
return {
"sessi... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"session",
"=",
"self",
".",
"_get_session",
"(",
")",
"snapshot",
"=",
"self",
".",
"_get_snapshot",
"(",
")",
"return",
"{",
"\"session_id\"",
":",
"session",
".",
"_session_id",
",",
"\"transaction_id\"",
":",
"s... | Return state as a dictionary.
Result can be used to serialize the instance and reconstitute
it later using :meth:`from_dict`.
:rtype: dict | [
"Return",
"state",
"as",
"a",
"dictionary",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L549-L562 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | BatchSnapshot._get_session | def _get_session(self):
"""Create session as needed.
.. note::
Caller is responsible for cleaning up the session after
all partitions have been processed.
"""
if self._session is None:
session = self._session = self._database.session()
sess... | python | def _get_session(self):
"""Create session as needed.
.. note::
Caller is responsible for cleaning up the session after
all partitions have been processed.
"""
if self._session is None:
session = self._session = self._database.session()
sess... | [
"def",
"_get_session",
"(",
"self",
")",
":",
"if",
"self",
".",
"_session",
"is",
"None",
":",
"session",
"=",
"self",
".",
"_session",
"=",
"self",
".",
"_database",
".",
"session",
"(",
")",
"session",
".",
"create",
"(",
")",
"return",
"self",
".... | Create session as needed.
.. note::
Caller is responsible for cleaning up the session after
all partitions have been processed. | [
"Create",
"session",
"as",
"needed",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L564-L575 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | BatchSnapshot._get_snapshot | def _get_snapshot(self):
"""Create snapshot if needed."""
if self._snapshot is None:
self._snapshot = self._get_session().snapshot(
read_timestamp=self._read_timestamp,
exact_staleness=self._exact_staleness,
multi_use=True,
)
... | python | def _get_snapshot(self):
"""Create snapshot if needed."""
if self._snapshot is None:
self._snapshot = self._get_session().snapshot(
read_timestamp=self._read_timestamp,
exact_staleness=self._exact_staleness,
multi_use=True,
)
... | [
"def",
"_get_snapshot",
"(",
"self",
")",
":",
"if",
"self",
".",
"_snapshot",
"is",
"None",
":",
"self",
".",
"_snapshot",
"=",
"self",
".",
"_get_session",
"(",
")",
".",
"snapshot",
"(",
"read_timestamp",
"=",
"self",
".",
"_read_timestamp",
",",
"exa... | Create snapshot if needed. | [
"Create",
"snapshot",
"if",
"needed",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L577-L586 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | BatchSnapshot.generate_read_batches | def generate_read_batches(
self,
table,
columns,
keyset,
index="",
partition_size_bytes=None,
max_partitions=None,
):
"""Start a partitioned batch read operation.
Uses the ``PartitionRead`` API request to initiate the partitioned
read.... | python | def generate_read_batches(
self,
table,
columns,
keyset,
index="",
partition_size_bytes=None,
max_partitions=None,
):
"""Start a partitioned batch read operation.
Uses the ``PartitionRead`` API request to initiate the partitioned
read.... | [
"def",
"generate_read_batches",
"(",
"self",
",",
"table",
",",
"columns",
",",
"keyset",
",",
"index",
"=",
"\"\"",
",",
"partition_size_bytes",
"=",
"None",
",",
"max_partitions",
"=",
"None",
",",
")",
":",
"partitions",
"=",
"self",
".",
"_get_snapshot",... | Start a partitioned batch read operation.
Uses the ``PartitionRead`` API request to initiate the partitioned
read. Returns a list of batch information needed to perform the
actual reads.
:type table: str
:param table: name of the table from which to fetch data
:type c... | [
"Start",
"a",
"partitioned",
"batch",
"read",
"operation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L602-L662 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | BatchSnapshot.process_read_batch | def process_read_batch(self, batch):
"""Process a single, partitioned read.
:type batch: mapping
:param batch:
one of the mappings returned from an earlier call to
:meth:`generate_read_batches`.
:rtype: :class:`~google.cloud.spanner_v1.streamed.StreamedResultSet... | python | def process_read_batch(self, batch):
"""Process a single, partitioned read.
:type batch: mapping
:param batch:
one of the mappings returned from an earlier call to
:meth:`generate_read_batches`.
:rtype: :class:`~google.cloud.spanner_v1.streamed.StreamedResultSet... | [
"def",
"process_read_batch",
"(",
"self",
",",
"batch",
")",
":",
"kwargs",
"=",
"copy",
".",
"deepcopy",
"(",
"batch",
"[",
"\"read\"",
"]",
")",
"keyset_dict",
"=",
"kwargs",
".",
"pop",
"(",
"\"keyset\"",
")",
"kwargs",
"[",
"\"keyset\"",
"]",
"=",
... | Process a single, partitioned read.
:type batch: mapping
:param batch:
one of the mappings returned from an earlier call to
:meth:`generate_read_batches`.
:rtype: :class:`~google.cloud.spanner_v1.streamed.StreamedResultSet`
:returns: a result set instance which ... | [
"Process",
"a",
"single",
"partitioned",
"read",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L664-L678 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | BatchSnapshot.generate_query_batches | def generate_query_batches(
self,
sql,
params=None,
param_types=None,
partition_size_bytes=None,
max_partitions=None,
):
"""Start a partitioned query operation.
Uses the ``PartitionQuery`` API request to start a partitioned
query operation. R... | python | def generate_query_batches(
self,
sql,
params=None,
param_types=None,
partition_size_bytes=None,
max_partitions=None,
):
"""Start a partitioned query operation.
Uses the ``PartitionQuery`` API request to start a partitioned
query operation. R... | [
"def",
"generate_query_batches",
"(",
"self",
",",
"sql",
",",
"params",
"=",
"None",
",",
"param_types",
"=",
"None",
",",
"partition_size_bytes",
"=",
"None",
",",
"max_partitions",
"=",
"None",
",",
")",
":",
"partitions",
"=",
"self",
".",
"_get_snapshot... | Start a partitioned query operation.
Uses the ``PartitionQuery`` API request to start a partitioned
query operation. Returns a list of batch information needed to
peform the actual queries.
:type sql: str
:param sql: SQL query statement
:type params: dict, {str -> col... | [
"Start",
"a",
"partitioned",
"query",
"operation",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L680-L741 | train |
googleapis/google-cloud-python | spanner/google/cloud/spanner_v1/database.py | BatchSnapshot.process | def process(self, batch):
"""Process a single, partitioned query or read.
:type batch: mapping
:param batch:
one of the mappings returned from an earlier call to
:meth:`generate_query_batches`.
:rtype: :class:`~google.cloud.spanner_v1.streamed.StreamedResultSet`... | python | def process(self, batch):
"""Process a single, partitioned query or read.
:type batch: mapping
:param batch:
one of the mappings returned from an earlier call to
:meth:`generate_query_batches`.
:rtype: :class:`~google.cloud.spanner_v1.streamed.StreamedResultSet`... | [
"def",
"process",
"(",
"self",
",",
"batch",
")",
":",
"if",
"\"query\"",
"in",
"batch",
":",
"return",
"self",
".",
"process_query_batch",
"(",
"batch",
")",
"if",
"\"read\"",
"in",
"batch",
":",
"return",
"self",
".",
"process_read_batch",
"(",
"batch",
... | Process a single, partitioned query or read.
:type batch: mapping
:param batch:
one of the mappings returned from an earlier call to
:meth:`generate_query_batches`.
:rtype: :class:`~google.cloud.spanner_v1.streamed.StreamedResultSet`
:returns: a result set insta... | [
"Process",
"a",
"single",
"partitioned",
"query",
"or",
"read",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L758-L774 | train |
googleapis/google-cloud-python | automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py | AutoMlClient.location_path | def location_path(cls, project, location):
"""Return a fully-qualified location string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}",
project=project,
location=location,
) | python | def location_path(cls, project, location):
"""Return a fully-qualified location string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}",
project=project,
location=location,
) | [
"def",
"location_path",
"(",
"cls",
",",
"project",
",",
"location",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}\"",
",",
"project",
"=",
"project",
",",
"location",
"=",
"lo... | Return a fully-qualified location string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"location",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py#L101-L107 | train |
googleapis/google-cloud-python | automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py | AutoMlClient.model_path | def model_path(cls, project, location, model):
"""Return a fully-qualified model string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}",
project=project,
location=location,
model=model,
) | python | def model_path(cls, project, location, model):
"""Return a fully-qualified model string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}",
project=project,
location=location,
model=model,
) | [
"def",
"model_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"model",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/models/{model}\"",
",",
"project",
"=",
"project",
"... | Return a fully-qualified model string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"model",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py#L120-L127 | train |
googleapis/google-cloud-python | automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py | AutoMlClient.model_evaluation_path | def model_evaluation_path(cls, project, location, model, model_evaluation):
"""Return a fully-qualified model_evaluation string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}/modelEvaluations/{model_evaluation}",
project=p... | python | def model_evaluation_path(cls, project, location, model, model_evaluation):
"""Return a fully-qualified model_evaluation string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}/modelEvaluations/{model_evaluation}",
project=p... | [
"def",
"model_evaluation_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"model",
",",
"model_evaluation",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/models/{model}/modelEv... | Return a fully-qualified model_evaluation string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"model_evaluation",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py#L130-L138 | train |
googleapis/google-cloud-python | automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py | AutoMlClient.annotation_spec_path | def annotation_spec_path(cls, project, location, dataset, annotation_spec):
"""Return a fully-qualified annotation_spec string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}",
project=... | python | def annotation_spec_path(cls, project, location, dataset, annotation_spec):
"""Return a fully-qualified annotation_spec string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}",
project=... | [
"def",
"annotation_spec_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"dataset",
",",
"annotation_spec",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/datasets/{dataset}/ann... | Return a fully-qualified annotation_spec string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"annotation_spec",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py#L141-L149 | train |
googleapis/google-cloud-python | automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py | AutoMlClient.table_spec_path | def table_spec_path(cls, project, location, dataset, table_spec):
"""Return a fully-qualified table_spec string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}",
project=project,
loca... | python | def table_spec_path(cls, project, location, dataset, table_spec):
"""Return a fully-qualified table_spec string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}",
project=project,
loca... | [
"def",
"table_spec_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"dataset",
",",
"table_spec",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{t... | Return a fully-qualified table_spec string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"table_spec",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py#L152-L160 | train |
googleapis/google-cloud-python | automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py | AutoMlClient.column_spec_path | def column_spec_path(cls, project, location, dataset, table_spec, column_spec):
"""Return a fully-qualified column_spec string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}/columnSpecs/{column_spec}",
... | python | def column_spec_path(cls, project, location, dataset, table_spec, column_spec):
"""Return a fully-qualified column_spec string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}/columnSpecs/{column_spec}",
... | [
"def",
"column_spec_path",
"(",
"cls",
",",
"project",
",",
"location",
",",
"dataset",
",",
"table_spec",
",",
"column_spec",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/locations/{location}/dataset... | Return a fully-qualified column_spec string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"column_spec",
"string",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py#L163-L172 | train |
googleapis/google-cloud-python | automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py | AutoMlClient.create_dataset | def create_dataset(
self,
parent,
dataset,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a dataset.
Example:
>>> from google.cloud import automl_v1beta... | python | def create_dataset(
self,
parent,
dataset,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a dataset.
Example:
>>> from google.cloud import automl_v1beta... | [
"def",
"create_dataset",
"(",
"self",
",",
"parent",
",",
"dataset",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAU... | Creates a dataset.
Example:
>>> from google.cloud import automl_v1beta1
>>>
>>> client = automl_v1beta1.AutoMlClient()
>>>
>>> parent = client.location_path('[PROJECT]', '[LOCATION]')
>>>
>>> # TODO: Initialize `dataset`:
... | [
"Creates",
"a",
"dataset",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py#L273-L348 | train |
googleapis/google-cloud-python | automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py | AutoMlClient.delete_dataset | def delete_dataset(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes a dataset and all of its contents. Returns empty response in the
``response`` field when it co... | python | def delete_dataset(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes a dataset and all of its contents. Returns empty response in the
``response`` field when it co... | [
"def",
"delete_dataset",
"(",
"self",
",",
"name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"metadat... | Deletes a dataset and all of its contents. Returns empty response in the
``response`` field when it completes, and ``delete_details`` in the
``metadata`` field.
Example:
>>> from google.cloud import automl_v1beta1
>>>
>>> client = automl_v1beta1.AutoMlClient(... | [
"Deletes",
"a",
"dataset",
"and",
"all",
"of",
"its",
"contents",
".",
"Returns",
"empty",
"response",
"in",
"the",
"response",
"field",
"when",
"it",
"completes",
"and",
"delete_details",
"in",
"the",
"metadata",
"field",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py#L615-L699 | train |
googleapis/google-cloud-python | automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py | AutoMlClient.create_model | def create_model(
self,
parent,
model,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a model. Returns a Model in the ``response`` field when it
completes. When you ... | python | def create_model(
self,
parent,
model,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a model. Returns a Model in the ``response`` field when it
completes. When you ... | [
"def",
"create_model",
"(",
"self",
",",
"parent",
",",
"model",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",... | Creates a model. Returns a Model in the ``response`` field when it
completes. When you create a model, several model evaluations are
created for it: a global evaluation, and one evaluation for each
annotation spec.
Example:
>>> from google.cloud import automl_v1beta1
... | [
"Creates",
"a",
"model",
".",
"Returns",
"a",
"Model",
"in",
"the",
"response",
"field",
"when",
"it",
"completes",
".",
"When",
"you",
"create",
"a",
"model",
"several",
"model",
"evaluations",
"are",
"created",
"for",
"it",
":",
"a",
"global",
"evaluatio... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py#L895-L988 | train |
googleapis/google-cloud-python | api_core/google/api_core/retry.py | exponential_sleep_generator | def exponential_sleep_generator(initial, maximum, multiplier=_DEFAULT_DELAY_MULTIPLIER):
"""Generates sleep intervals based on the exponential back-off algorithm.
This implements the `Truncated Exponential Back-off`_ algorithm.
.. _Truncated Exponential Back-off:
https://cloud.google.com/storage/d... | python | def exponential_sleep_generator(initial, maximum, multiplier=_DEFAULT_DELAY_MULTIPLIER):
"""Generates sleep intervals based on the exponential back-off algorithm.
This implements the `Truncated Exponential Back-off`_ algorithm.
.. _Truncated Exponential Back-off:
https://cloud.google.com/storage/d... | [
"def",
"exponential_sleep_generator",
"(",
"initial",
",",
"maximum",
",",
"multiplier",
"=",
"_DEFAULT_DELAY_MULTIPLIER",
")",
":",
"delay",
"=",
"initial",
"while",
"True",
":",
"# Introduce jitter by yielding a delay that is uniformly distributed",
"# to average out to the d... | Generates sleep intervals based on the exponential back-off algorithm.
This implements the `Truncated Exponential Back-off`_ algorithm.
.. _Truncated Exponential Back-off:
https://cloud.google.com/storage/docs/exponential-backoff
Args:
initial (float): The minimum about of time to delay. ... | [
"Generates",
"sleep",
"intervals",
"based",
"on",
"the",
"exponential",
"back",
"-",
"off",
"algorithm",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/retry.py#L116-L138 | train |
googleapis/google-cloud-python | api_core/google/api_core/retry.py | retry_target | def retry_target(target, predicate, sleep_generator, deadline, on_error=None):
"""Call a function and retry if it fails.
This is the lowest-level retry helper. Generally, you'll use the
higher-level retry helper :class:`Retry`.
Args:
target(Callable): The function to call and retry. This must ... | python | def retry_target(target, predicate, sleep_generator, deadline, on_error=None):
"""Call a function and retry if it fails.
This is the lowest-level retry helper. Generally, you'll use the
higher-level retry helper :class:`Retry`.
Args:
target(Callable): The function to call and retry. This must ... | [
"def",
"retry_target",
"(",
"target",
",",
"predicate",
",",
"sleep_generator",
",",
"deadline",
",",
"on_error",
"=",
"None",
")",
":",
"if",
"deadline",
"is",
"not",
"None",
":",
"deadline_datetime",
"=",
"datetime_helpers",
".",
"utcnow",
"(",
")",
"+",
... | Call a function and retry if it fails.
This is the lowest-level retry helper. Generally, you'll use the
higher-level retry helper :class:`Retry`.
Args:
target(Callable): The function to call and retry. This must be a
nullary function - apply arguments with `functools.partial`.
... | [
"Call",
"a",
"function",
"and",
"retry",
"if",
"it",
"fails",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/retry.py#L141-L207 | train |
googleapis/google-cloud-python | api_core/google/api_core/bidi.py | BidiRpc.open | def open(self):
"""Opens the stream."""
if self.is_active:
raise ValueError("Can not open an already open stream.")
request_generator = _RequestQueueGenerator(
self._request_queue, initial_request=self._initial_request
)
call = self._start_rpc(iter(reques... | python | def open(self):
"""Opens the stream."""
if self.is_active:
raise ValueError("Can not open an already open stream.")
request_generator = _RequestQueueGenerator(
self._request_queue, initial_request=self._initial_request
)
call = self._start_rpc(iter(reques... | [
"def",
"open",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_active",
":",
"raise",
"ValueError",
"(",
"\"Can not open an already open stream.\"",
")",
"request_generator",
"=",
"_RequestQueueGenerator",
"(",
"self",
".",
"_request_queue",
",",
"initial_request",
"=... | Opens the stream. | [
"Opens",
"the",
"stream",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/bidi.py#L202-L222 | train |
googleapis/google-cloud-python | api_core/google/api_core/bidi.py | BidiRpc.close | def close(self):
"""Closes the stream."""
if self.call is None:
return
self._request_queue.put(None)
self.call.cancel()
self._request_generator = None | python | def close(self):
"""Closes the stream."""
if self.call is None:
return
self._request_queue.put(None)
self.call.cancel()
self._request_generator = None | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"call",
"is",
"None",
":",
"return",
"self",
".",
"_request_queue",
".",
"put",
"(",
"None",
")",
"self",
".",
"call",
".",
"cancel",
"(",
")",
"self",
".",
"_request_generator",
"=",
"None"
] | Closes the stream. | [
"Closes",
"the",
"stream",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/bidi.py#L224-L231 | train |
googleapis/google-cloud-python | api_core/google/api_core/bidi.py | BidiRpc.send | def send(self, request):
"""Queue a message to be sent on the stream.
Send is non-blocking.
If the underlying RPC has been closed, this will raise.
Args:
request (protobuf.Message): The request to send.
"""
if self.call is None:
raise ValueError... | python | def send(self, request):
"""Queue a message to be sent on the stream.
Send is non-blocking.
If the underlying RPC has been closed, this will raise.
Args:
request (protobuf.Message): The request to send.
"""
if self.call is None:
raise ValueError... | [
"def",
"send",
"(",
"self",
",",
"request",
")",
":",
"if",
"self",
".",
"call",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Can not send() on an RPC that has never been open()ed.\"",
")",
"# Don't use self.is_active(), as ResumableBidiRpc will overload it",
"# to mea... | Queue a message to be sent on the stream.
Send is non-blocking.
If the underlying RPC has been closed, this will raise.
Args:
request (protobuf.Message): The request to send. | [
"Queue",
"a",
"message",
"to",
"be",
"sent",
"on",
"the",
"stream",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/bidi.py#L235-L254 | train |
googleapis/google-cloud-python | api_core/google/api_core/bidi.py | ResumableBidiRpc._recoverable | def _recoverable(self, method, *args, **kwargs):
"""Wraps a method to recover the stream and retry on error.
If a retryable error occurs while making the call, then the stream will
be re-opened and the method will be retried. This happens indefinitely
so long as the error is a retryable... | python | def _recoverable(self, method, *args, **kwargs):
"""Wraps a method to recover the stream and retry on error.
If a retryable error occurs while making the call, then the stream will
be re-opened and the method will be retried. This happens indefinitely
so long as the error is a retryable... | [
"def",
"_recoverable",
"(",
"self",
",",
"method",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"while",
"True",
":",
"try",
":",
"return",
"method",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"Exception",
"as",
"exc",
":",
... | Wraps a method to recover the stream and retry on error.
If a retryable error occurs while making the call, then the stream will
be re-opened and the method will be retried. This happens indefinitely
so long as the error is a retryable one. If an error occurs while
re-opening the stream... | [
"Wraps",
"a",
"method",
"to",
"recover",
"the",
"stream",
"and",
"retry",
"on",
"error",
"."
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/bidi.py#L387-L416 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.