id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
27,600
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
27,601
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
27,602
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
27,603
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
27,604
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
27,605
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
27,606
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
27,607
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
27,608
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
27,609
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
27,610
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
27,611
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
27,612
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
27,613
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
27,614
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
27,615
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
27,616
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
27,617
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
27,618
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
27,619
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
27,620
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
27,621
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
27,622
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
27,623
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
27,624
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
27,625
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
27,626
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
27,627
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
27,628
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
27,629
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
27,630
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
27,631
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
27,632
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
27,633
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
27,634
googleapis/google-cloud-python
api_core/google/api_core/bidi.py
BackgroundConsumer.start
def start(self): """Start the background thread and begin consuming the thread.""" with self._operational_lock: ready = threading.Event() thread = threading.Thread( name=_BIDIRECTIONAL_CONSUMER_NAME, target=self._thread_main, args=(...
python
def start(self): """Start the background thread and begin consuming the thread.""" with self._operational_lock: ready = threading.Event() thread = threading.Thread( name=_BIDIRECTIONAL_CONSUMER_NAME, target=self._thread_main, args=(...
[ "def", "start", "(", "self", ")", ":", "with", "self", ".", "_operational_lock", ":", "ready", "=", "threading", ".", "Event", "(", ")", "thread", "=", "threading", ".", "Thread", "(", "name", "=", "_BIDIRECTIONAL_CONSUMER_NAME", ",", "target", "=", "self"...
Start the background thread and begin consuming the thread.
[ "Start", "the", "background", "thread", "and", "begin", "consuming", "the", "thread", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/bidi.py#L569-L586
27,635
googleapis/google-cloud-python
api_core/google/api_core/bidi.py
BackgroundConsumer.stop
def stop(self): """Stop consuming the stream and shutdown the background thread.""" with self._operational_lock: self._bidi_rpc.close() if self._thread is not None: # Resume the thread to wake it up in case it is sleeping. self.resume() ...
python
def stop(self): """Stop consuming the stream and shutdown the background thread.""" with self._operational_lock: self._bidi_rpc.close() if self._thread is not None: # Resume the thread to wake it up in case it is sleeping. self.resume() ...
[ "def", "stop", "(", "self", ")", ":", "with", "self", ".", "_operational_lock", ":", "self", ".", "_bidi_rpc", ".", "close", "(", ")", "if", "self", ".", "_thread", "is", "not", "None", ":", "# Resume the thread to wake it up in case it is sleeping.", "self", ...
Stop consuming the stream and shutdown the background thread.
[ "Stop", "consuming", "the", "stream", "and", "shutdown", "the", "background", "thread", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/bidi.py#L588-L598
27,636
googleapis/google-cloud-python
api_core/google/api_core/bidi.py
BackgroundConsumer.resume
def resume(self): """Resumes the response stream.""" with self._wake: self._paused = False self._wake.notifyAll()
python
def resume(self): """Resumes the response stream.""" with self._wake: self._paused = False self._wake.notifyAll()
[ "def", "resume", "(", "self", ")", ":", "with", "self", ".", "_wake", ":", "self", ".", "_paused", "=", "False", "self", ".", "_wake", ".", "notifyAll", "(", ")" ]
Resumes the response stream.
[ "Resumes", "the", "response", "stream", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/bidi.py#L613-L617
27,637
googleapis/google-cloud-python
oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py
OsLoginServiceClient.project_path
def project_path(cls, user, project): """Return a fully-qualified project string.""" return google.api_core.path_template.expand( "users/{user}/projects/{project}", user=user, project=project )
python
def project_path(cls, user, project): """Return a fully-qualified project string.""" return google.api_core.path_template.expand( "users/{user}/projects/{project}", user=user, project=project )
[ "def", "project_path", "(", "cls", ",", "user", ",", "project", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"users/{user}/projects/{project}\"", ",", "user", "=", "user", ",", "project", "=", "project", ")" ]
Return a fully-qualified project string.
[ "Return", "a", "fully", "-", "qualified", "project", "string", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py#L81-L85
27,638
googleapis/google-cloud-python
oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py
OsLoginServiceClient.fingerprint_path
def fingerprint_path(cls, user, fingerprint): """Return a fully-qualified fingerprint string.""" return google.api_core.path_template.expand( "users/{user}/sshPublicKeys/{fingerprint}", user=user, fingerprint=fingerprint, )
python
def fingerprint_path(cls, user, fingerprint): """Return a fully-qualified fingerprint string.""" return google.api_core.path_template.expand( "users/{user}/sshPublicKeys/{fingerprint}", user=user, fingerprint=fingerprint, )
[ "def", "fingerprint_path", "(", "cls", ",", "user", ",", "fingerprint", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"users/{user}/sshPublicKeys/{fingerprint}\"", ",", "user", "=", "user", ",", "fingerprint", "=", "f...
Return a fully-qualified fingerprint string.
[ "Return", "a", "fully", "-", "qualified", "fingerprint", "string", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py#L88-L94
27,639
googleapis/google-cloud-python
oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py
OsLoginServiceClient.delete_posix_account
def delete_posix_account( self, name, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Deletes a POSIX account. Example: >>> from google.cloud import oslogin_v1 ...
python
def delete_posix_account( self, name, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Deletes a POSIX account. Example: >>> from google.cloud import oslogin_v1 ...
[ "def", "delete_posix_account", "(", "self", ",", "name", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "m...
Deletes a POSIX account. Example: >>> from google.cloud import oslogin_v1 >>> >>> client = oslogin_v1.OsLoginServiceClient() >>> >>> name = client.project_path('[USER]', '[PROJECT]') >>> >>> client.delete_posix_account(name) ...
[ "Deletes", "a", "POSIX", "account", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py#L195-L248
27,640
googleapis/google-cloud-python
oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py
OsLoginServiceClient.import_ssh_public_key
def import_ssh_public_key( self, parent, ssh_public_key, project_id=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Adds an SSH public key and returns the profile infor...
python
def import_ssh_public_key( self, parent, ssh_public_key, project_id=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Adds an SSH public key and returns the profile infor...
[ "def", "import_ssh_public_key", "(", "self", ",", "parent", ",", "ssh_public_key", ",", "project_id", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ...
Adds an SSH public key and returns the profile information. Default POSIX account information is set when no username and UID exist as part of the login profile. Example: >>> from google.cloud import oslogin_v1 >>> >>> client = oslogin_v1.OsLoginServiceClient...
[ "Adds", "an", "SSH", "public", "key", "and", "returns", "the", "profile", "information", ".", "Default", "POSIX", "account", "information", "is", "set", "when", "no", "username", "and", "UID", "exist", "as", "part", "of", "the", "login", "profile", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py#L420-L488
27,641
googleapis/google-cloud-python
oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py
OsLoginServiceClient.update_ssh_public_key
def update_ssh_public_key( self, name, ssh_public_key, update_mask=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Updates an SSH public key and returns the profile inf...
python
def update_ssh_public_key( self, name, ssh_public_key, update_mask=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Updates an SSH public key and returns the profile inf...
[ "def", "update_ssh_public_key", "(", "self", ",", "name", ",", "ssh_public_key", ",", "update_mask", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ...
Updates an SSH public key and returns the profile information. This method supports patch semantics. Example: >>> from google.cloud import oslogin_v1 >>> >>> client = oslogin_v1.OsLoginServiceClient() >>> >>> name = client.fingerprint_path('[U...
[ "Updates", "an", "SSH", "public", "key", "and", "returns", "the", "profile", "information", ".", "This", "method", "supports", "patch", "semantics", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/oslogin/google/cloud/oslogin_v1/gapic/os_login_service_client.py#L490-L562
27,642
googleapis/google-cloud-python
bigtable/google/cloud/bigtable/column_family.py
_gc_rule_from_pb
def _gc_rule_from_pb(gc_rule_pb): """Convert a protobuf GC rule to a native object. :type gc_rule_pb: :class:`.table_v2_pb2.GcRule` :param gc_rule_pb: The GC rule to convert. :rtype: :class:`GarbageCollectionRule` or :data:`NoneType <types.NoneType>` :returns: An instance of one of the native rule...
python
def _gc_rule_from_pb(gc_rule_pb): """Convert a protobuf GC rule to a native object. :type gc_rule_pb: :class:`.table_v2_pb2.GcRule` :param gc_rule_pb: The GC rule to convert. :rtype: :class:`GarbageCollectionRule` or :data:`NoneType <types.NoneType>` :returns: An instance of one of the native rule...
[ "def", "_gc_rule_from_pb", "(", "gc_rule_pb", ")", ":", "rule_name", "=", "gc_rule_pb", ".", "WhichOneof", "(", "\"rule\"", ")", "if", "rule_name", "is", "None", ":", "return", "None", "if", "rule_name", "==", "\"max_num_versions\"", ":", "return", "MaxVersionsG...
Convert a protobuf GC rule to a native object. :type gc_rule_pb: :class:`.table_v2_pb2.GcRule` :param gc_rule_pb: The GC rule to convert. :rtype: :class:`GarbageCollectionRule` or :data:`NoneType <types.NoneType>` :returns: An instance of one of the native rules defined in :module:`colum...
[ "Convert", "a", "protobuf", "GC", "rule", "to", "a", "native", "object", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L323-L351
27,643
googleapis/google-cloud-python
bigtable/google/cloud/bigtable/column_family.py
MaxAgeGCRule.to_pb
def to_pb(self): """Converts the garbage collection rule to a protobuf. :rtype: :class:`.table_v2_pb2.GcRule` :returns: The converted current object. """ max_age = _helpers._timedelta_to_duration_pb(self.max_age) return table_v2_pb2.GcRule(max_age=max_age)
python
def to_pb(self): """Converts the garbage collection rule to a protobuf. :rtype: :class:`.table_v2_pb2.GcRule` :returns: The converted current object. """ max_age = _helpers._timedelta_to_duration_pb(self.max_age) return table_v2_pb2.GcRule(max_age=max_age)
[ "def", "to_pb", "(", "self", ")", ":", "max_age", "=", "_helpers", ".", "_timedelta_to_duration_pb", "(", "self", ".", "max_age", ")", "return", "table_v2_pb2", ".", "GcRule", "(", "max_age", "=", "max_age", ")" ]
Converts the garbage collection rule to a protobuf. :rtype: :class:`.table_v2_pb2.GcRule` :returns: The converted current object.
[ "Converts", "the", "garbage", "collection", "rule", "to", "a", "protobuf", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L100-L107
27,644
googleapis/google-cloud-python
bigtable/google/cloud/bigtable/column_family.py
GCRuleUnion.to_pb
def to_pb(self): """Converts the union into a single GC rule as a protobuf. :rtype: :class:`.table_v2_pb2.GcRule` :returns: The converted current object. """ union = table_v2_pb2.GcRule.Union(rules=[rule.to_pb() for rule in self.rules]) return table_v2_pb2.GcRule(union=u...
python
def to_pb(self): """Converts the union into a single GC rule as a protobuf. :rtype: :class:`.table_v2_pb2.GcRule` :returns: The converted current object. """ union = table_v2_pb2.GcRule.Union(rules=[rule.to_pb() for rule in self.rules]) return table_v2_pb2.GcRule(union=u...
[ "def", "to_pb", "(", "self", ")", ":", "union", "=", "table_v2_pb2", ".", "GcRule", ".", "Union", "(", "rules", "=", "[", "rule", ".", "to_pb", "(", ")", "for", "rule", "in", "self", ".", "rules", "]", ")", "return", "table_v2_pb2", ".", "GcRule", ...
Converts the union into a single GC rule as a protobuf. :rtype: :class:`.table_v2_pb2.GcRule` :returns: The converted current object.
[ "Converts", "the", "union", "into", "a", "single", "GC", "rule", "as", "a", "protobuf", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L134-L141
27,645
googleapis/google-cloud-python
bigtable/google/cloud/bigtable/column_family.py
GCRuleIntersection.to_pb
def to_pb(self): """Converts the intersection into a single GC rule as a protobuf. :rtype: :class:`.table_v2_pb2.GcRule` :returns: The converted current object. """ intersection = table_v2_pb2.GcRule.Intersection( rules=[rule.to_pb() for rule in self.rules] )...
python
def to_pb(self): """Converts the intersection into a single GC rule as a protobuf. :rtype: :class:`.table_v2_pb2.GcRule` :returns: The converted current object. """ intersection = table_v2_pb2.GcRule.Intersection( rules=[rule.to_pb() for rule in self.rules] )...
[ "def", "to_pb", "(", "self", ")", ":", "intersection", "=", "table_v2_pb2", ".", "GcRule", ".", "Intersection", "(", "rules", "=", "[", "rule", ".", "to_pb", "(", ")", "for", "rule", "in", "self", ".", "rules", "]", ")", "return", "table_v2_pb2", ".", ...
Converts the intersection into a single GC rule as a protobuf. :rtype: :class:`.table_v2_pb2.GcRule` :returns: The converted current object.
[ "Converts", "the", "intersection", "into", "a", "single", "GC", "rule", "as", "a", "protobuf", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L168-L177
27,646
googleapis/google-cloud-python
bigtable/google/cloud/bigtable/column_family.py
ColumnFamily.to_pb
def to_pb(self): """Converts the column family to a protobuf. :rtype: :class:`.table_v2_pb2.ColumnFamily` :returns: The converted current object. """ if self.gc_rule is None: return table_v2_pb2.ColumnFamily() else: return table_v2_pb2.ColumnFamil...
python
def to_pb(self): """Converts the column family to a protobuf. :rtype: :class:`.table_v2_pb2.ColumnFamily` :returns: The converted current object. """ if self.gc_rule is None: return table_v2_pb2.ColumnFamily() else: return table_v2_pb2.ColumnFamil...
[ "def", "to_pb", "(", "self", ")", ":", "if", "self", ".", "gc_rule", "is", "None", ":", "return", "table_v2_pb2", ".", "ColumnFamily", "(", ")", "else", ":", "return", "table_v2_pb2", ".", "ColumnFamily", "(", "gc_rule", "=", "self", ".", "gc_rule", ".",...
Converts the column family to a protobuf. :rtype: :class:`.table_v2_pb2.ColumnFamily` :returns: The converted current object.
[ "Converts", "the", "column", "family", "to", "a", "protobuf", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L242-L251
27,647
googleapis/google-cloud-python
bigtable/google/cloud/bigtable/column_family.py
ColumnFamily.create
def create(self): """Create this column family. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_create_column_family] :end-before: [END bigtable_create_column_family] """ column_family = self.to_pb() modification...
python
def create(self): """Create this column family. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_create_column_family] :end-before: [END bigtable_create_column_family] """ column_family = self.to_pb() modification...
[ "def", "create", "(", "self", ")", ":", "column_family", "=", "self", ".", "to_pb", "(", ")", "modification", "=", "table_admin_v2_pb2", ".", "ModifyColumnFamiliesRequest", ".", "Modification", "(", "id", "=", "self", ".", "column_family_id", ",", "create", "=...
Create this column family. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_create_column_family] :end-before: [END bigtable_create_column_family]
[ "Create", "this", "column", "family", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L253-L273
27,648
googleapis/google-cloud-python
bigtable/google/cloud/bigtable/column_family.py
ColumnFamily.delete
def delete(self): """Delete this column family. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_delete_column_family] :end-before: [END bigtable_delete_column_family] """ modification = table_admin_v2_pb2.ModifyColumnFam...
python
def delete(self): """Delete this column family. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_delete_column_family] :end-before: [END bigtable_delete_column_family] """ modification = table_admin_v2_pb2.ModifyColumnFam...
[ "def", "delete", "(", "self", ")", ":", "modification", "=", "table_admin_v2_pb2", ".", "ModifyColumnFamiliesRequest", ".", "Modification", "(", "id", "=", "self", ".", "column_family_id", ",", "drop", "=", "True", ")", "client", "=", "self", ".", "_table", ...
Delete this column family. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_delete_column_family] :end-before: [END bigtable_delete_column_family]
[ "Delete", "this", "column", "family", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/column_family.py#L301-L320
27,649
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/watch.py
_maybe_wrap_exception
def _maybe_wrap_exception(exception): """Wraps a gRPC exception class, if needed.""" if isinstance(exception, grpc.RpcError): return exceptions.from_grpc_error(exception) return exception
python
def _maybe_wrap_exception(exception): """Wraps a gRPC exception class, if needed.""" if isinstance(exception, grpc.RpcError): return exceptions.from_grpc_error(exception) return exception
[ "def", "_maybe_wrap_exception", "(", "exception", ")", ":", "if", "isinstance", "(", "exception", ",", "grpc", ".", "RpcError", ")", ":", "return", "exceptions", ".", "from_grpc_error", "(", "exception", ")", "return", "exception" ]
Wraps a gRPC exception class, if needed.
[ "Wraps", "a", "gRPC", "exception", "class", "if", "needed", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L144-L148
27,650
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/watch.py
Watch._on_rpc_done
def _on_rpc_done(self, future): """Triggered whenever the underlying RPC terminates without recovery. This is typically triggered from one of two threads: the background consumer thread (when calling ``recv()`` produces a non-recoverable error) or the grpc management thread (when cancel...
python
def _on_rpc_done(self, future): """Triggered whenever the underlying RPC terminates without recovery. This is typically triggered from one of two threads: the background consumer thread (when calling ``recv()`` produces a non-recoverable error) or the grpc management thread (when cancel...
[ "def", "_on_rpc_done", "(", "self", ",", "future", ")", ":", "_LOGGER", ".", "info", "(", "\"RPC termination has signaled manager shutdown.\"", ")", "future", "=", "_maybe_wrap_exception", "(", "future", ")", "thread", "=", "threading", ".", "Thread", "(", "name",...
Triggered whenever the underlying RPC terminates without recovery. This is typically triggered from one of two threads: the background consumer thread (when calling ``recv()`` produces a non-recoverable error) or the grpc management thread (when cancelling the RPC). This method is *non...
[ "Triggered", "whenever", "the", "underlying", "RPC", "terminates", "without", "recovery", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L293-L310
27,651
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/watch.py
Watch.for_document
def for_document( cls, document_ref, snapshot_callback, snapshot_class_instance, reference_class_instance, ): """ Creates a watch snapshot listener for a document. snapshot_callback receives a DocumentChange object, but may also start to get ta...
python
def for_document( cls, document_ref, snapshot_callback, snapshot_class_instance, reference_class_instance, ): """ Creates a watch snapshot listener for a document. snapshot_callback receives a DocumentChange object, but may also start to get ta...
[ "def", "for_document", "(", "cls", ",", "document_ref", ",", "snapshot_callback", ",", "snapshot_class_instance", ",", "reference_class_instance", ",", ")", ":", "return", "cls", "(", "document_ref", ",", "document_ref", ".", "_client", ",", "{", "\"documents\"", ...
Creates a watch snapshot listener for a document. snapshot_callback receives a DocumentChange object, but may also start to get targetChange and such soon Args: document_ref: Reference to Document snapshot_callback: callback to be called on snapshot snapshot_...
[ "Creates", "a", "watch", "snapshot", "listener", "for", "a", "document", ".", "snapshot_callback", "receives", "a", "DocumentChange", "object", "but", "may", "also", "start", "to", "get", "targetChange", "and", "such", "soon" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L316-L348
27,652
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/watch.py
Watch.on_snapshot
def on_snapshot(self, proto): """ Called everytime there is a response from listen. Collect changes and 'push' the changes in a batch to the customer when we receive 'current' from the listen response. Args: listen_response(`google.cloud.firestore_v1beta1.types.Liste...
python
def on_snapshot(self, proto): """ Called everytime there is a response from listen. Collect changes and 'push' the changes in a batch to the customer when we receive 'current' from the listen response. Args: listen_response(`google.cloud.firestore_v1beta1.types.Liste...
[ "def", "on_snapshot", "(", "self", ",", "proto", ")", ":", "TargetChange", "=", "firestore_pb2", ".", "TargetChange", "target_changetype_dispatch", "=", "{", "TargetChange", ".", "NO_CHANGE", ":", "self", ".", "_on_snapshot_target_change_no_change", ",", "TargetChange...
Called everytime there is a response from listen. Collect changes and 'push' the changes in a batch to the customer when we receive 'current' from the listen response. Args: listen_response(`google.cloud.firestore_v1beta1.types.ListenResponse`): Callback method that ...
[ "Called", "everytime", "there", "is", "a", "response", "from", "listen", ".", "Collect", "changes", "and", "push", "the", "changes", "in", "a", "batch", "to", "the", "customer", "when", "we", "receive", "current", "from", "the", "listen", "response", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L408-L527
27,653
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/watch.py
Watch.push
def push(self, read_time, next_resume_token): """ Assembles a new snapshot from the current set of changes and invokes the user's callback. Clears the current changes on completion. """ deletes, adds, updates = Watch._extract_changes( self.doc_map, self.change_map, re...
python
def push(self, read_time, next_resume_token): """ Assembles a new snapshot from the current set of changes and invokes the user's callback. Clears the current changes on completion. """ deletes, adds, updates = Watch._extract_changes( self.doc_map, self.change_map, re...
[ "def", "push", "(", "self", ",", "read_time", ",", "next_resume_token", ")", ":", "deletes", ",", "adds", ",", "updates", "=", "Watch", ".", "_extract_changes", "(", "self", ".", "doc_map", ",", "self", ".", "change_map", ",", "read_time", ")", "updated_tr...
Assembles a new snapshot from the current set of changes and invokes the user's callback. Clears the current changes on completion.
[ "Assembles", "a", "new", "snapshot", "from", "the", "current", "set", "of", "changes", "and", "invokes", "the", "user", "s", "callback", ".", "Clears", "the", "current", "changes", "on", "completion", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L529-L558
27,654
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/watch.py
Watch._current_size
def _current_size(self): """ Returns the current count of all documents, including the changes from the current changeMap. """ deletes, adds, _ = Watch._extract_changes(self.doc_map, self.change_map, None) return len(self.doc_map) + len(adds) - len(deletes)
python
def _current_size(self): """ Returns the current count of all documents, including the changes from the current changeMap. """ deletes, adds, _ = Watch._extract_changes(self.doc_map, self.change_map, None) return len(self.doc_map) + len(adds) - len(deletes)
[ "def", "_current_size", "(", "self", ")", ":", "deletes", ",", "adds", ",", "_", "=", "Watch", ".", "_extract_changes", "(", "self", ".", "doc_map", ",", "self", ".", "change_map", ",", "None", ")", "return", "len", "(", "self", ".", "doc_map", ")", ...
Returns the current count of all documents, including the changes from the current changeMap.
[ "Returns", "the", "current", "count", "of", "all", "documents", "including", "the", "changes", "from", "the", "current", "changeMap", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L700-L706
27,655
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/watch.py
Watch._reset_docs
def _reset_docs(self): """ Helper to clear the docs on RESET or filter mismatch. """ _LOGGER.debug("resetting documents") self.change_map.clear() self.resume_token = None # Mark each document as deleted. If documents are not deleted # they will be sent ag...
python
def _reset_docs(self): """ Helper to clear the docs on RESET or filter mismatch. """ _LOGGER.debug("resetting documents") self.change_map.clear() self.resume_token = None # Mark each document as deleted. If documents are not deleted # they will be sent ag...
[ "def", "_reset_docs", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"resetting documents\"", ")", "self", ".", "change_map", ".", "clear", "(", ")", "self", ".", "resume_token", "=", "None", "# Mark each document as deleted. If documents are not deleted", "...
Helper to clear the docs on RESET or filter mismatch.
[ "Helper", "to", "clear", "the", "docs", "on", "RESET", "or", "filter", "mismatch", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/watch.py#L708-L722
27,656
googleapis/google-cloud-python
core/google/cloud/_http.py
JSONConnection._make_request
def _make_request( self, method, url, data=None, content_type=None, headers=None, target_object=None, ): """A low level method to send a request to the API. Typically, you shouldn't need to use this method. :type method: str :...
python
def _make_request( self, method, url, data=None, content_type=None, headers=None, target_object=None, ): """A low level method to send a request to the API. Typically, you shouldn't need to use this method. :type method: str :...
[ "def", "_make_request", "(", "self", ",", "method", ",", "url", ",", "data", "=", "None", ",", "content_type", "=", "None", ",", "headers", "=", "None", ",", "target_object", "=", "None", ",", ")", ":", "headers", "=", "headers", "or", "{", "}", "hea...
A low level method to send a request to the API. Typically, you shouldn't need to use this method. :type method: str :param method: The HTTP method to use in the request. :type url: str :param url: The URL to send the request to. :type data: str :param data: T...
[ "A", "low", "level", "method", "to", "send", "a", "request", "to", "the", "API", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_http.py#L144-L192
27,657
googleapis/google-cloud-python
core/google/cloud/_http.py
JSONConnection.api_request
def api_request( self, method, path, query_params=None, data=None, content_type=None, headers=None, api_base_url=None, api_version=None, expect_json=True, _target_object=None, ): """Make a request over the HTTP transport...
python
def api_request( self, method, path, query_params=None, data=None, content_type=None, headers=None, api_base_url=None, api_version=None, expect_json=True, _target_object=None, ): """Make a request over the HTTP transport...
[ "def", "api_request", "(", "self", ",", "method", ",", "path", ",", "query_params", "=", "None", ",", "data", "=", "None", ",", "content_type", "=", "None", ",", "headers", "=", "None", ",", "api_base_url", "=", "None", ",", "api_version", "=", "None", ...
Make a request over the HTTP transport to the API. You shouldn't need to use this method, but if you plan to interact with the API using these primitives, this is the correct one to use. :type method: str :param method: The HTTP method name (ie, ``GET``, ``POST``, etc). ...
[ "Make", "a", "request", "over", "the", "HTTP", "transport", "to", "the", "API", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_http.py#L223-L324
27,658
googleapis/google-cloud-python
monitoring/google/cloud/monitoring_v3/query.py
_build_label_filter
def _build_label_filter(category, *args, **kwargs): """Construct a filter string to filter on metric or resource labels.""" terms = list(args) for key, value in six.iteritems(kwargs): if value is None: continue suffix = None if key.endswith( ("_prefix", "_suf...
python
def _build_label_filter(category, *args, **kwargs): """Construct a filter string to filter on metric or resource labels.""" terms = list(args) for key, value in six.iteritems(kwargs): if value is None: continue suffix = None if key.endswith( ("_prefix", "_suf...
[ "def", "_build_label_filter", "(", "category", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "terms", "=", "list", "(", "args", ")", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "kwargs", ")", ":", "if", "value", "is", "No...
Construct a filter string to filter on metric or resource labels.
[ "Construct", "a", "filter", "string", "to", "filter", "on", "metric", "or", "resource", "labels", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L592-L627
27,659
googleapis/google-cloud-python
monitoring/google/cloud/monitoring_v3/query.py
Query.select_interval
def select_interval(self, end_time, start_time=None): """Copy the query and set the query time interval. Example:: import datetime now = datetime.datetime.utcnow() query = query.select_interval( end_time=now, start_time=now - datetim...
python
def select_interval(self, end_time, start_time=None): """Copy the query and set the query time interval. Example:: import datetime now = datetime.datetime.utcnow() query = query.select_interval( end_time=now, start_time=now - datetim...
[ "def", "select_interval", "(", "self", ",", "end_time", ",", "start_time", "=", "None", ")", ":", "new_query", "=", "copy", ".", "deepcopy", "(", "self", ")", "new_query", ".", "_end_time", "=", "end_time", "new_query", ".", "_start_time", "=", "start_time",...
Copy the query and set the query time interval. Example:: import datetime now = datetime.datetime.utcnow() query = query.select_interval( end_time=now, start_time=now - datetime.timedelta(minutes=5)) As a convenience, you can altern...
[ "Copy", "the", "query", "and", "set", "the", "query", "time", "interval", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L134-L165
27,660
googleapis/google-cloud-python
monitoring/google/cloud/monitoring_v3/query.py
Query.select_group
def select_group(self, group_id): """Copy the query and add filtering by group. Example:: query = query.select_group('1234567') :type group_id: str :param group_id: The ID of a group to filter by. :rtype: :class:`Query` :returns: The new query object. ...
python
def select_group(self, group_id): """Copy the query and add filtering by group. Example:: query = query.select_group('1234567') :type group_id: str :param group_id: The ID of a group to filter by. :rtype: :class:`Query` :returns: The new query object. ...
[ "def", "select_group", "(", "self", ",", "group_id", ")", ":", "new_query", "=", "copy", ".", "deepcopy", "(", "self", ")", "new_query", ".", "_filter", ".", "group_id", "=", "group_id", "return", "new_query" ]
Copy the query and add filtering by group. Example:: query = query.select_group('1234567') :type group_id: str :param group_id: The ID of a group to filter by. :rtype: :class:`Query` :returns: The new query object.
[ "Copy", "the", "query", "and", "add", "filtering", "by", "group", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L167-L182
27,661
googleapis/google-cloud-python
monitoring/google/cloud/monitoring_v3/query.py
Query.select_projects
def select_projects(self, *args): """Copy the query and add filtering by monitored projects. This is only useful if the target project represents a Stackdriver account containing the specified monitored projects. Examples:: query = query.select_projects('project-1') ...
python
def select_projects(self, *args): """Copy the query and add filtering by monitored projects. This is only useful if the target project represents a Stackdriver account containing the specified monitored projects. Examples:: query = query.select_projects('project-1') ...
[ "def", "select_projects", "(", "self", ",", "*", "args", ")", ":", "new_query", "=", "copy", ".", "deepcopy", "(", "self", ")", "new_query", ".", "_filter", ".", "projects", "=", "args", "return", "new_query" ]
Copy the query and add filtering by monitored projects. This is only useful if the target project represents a Stackdriver account containing the specified monitored projects. Examples:: query = query.select_projects('project-1') query = query.select_projects('project-...
[ "Copy", "the", "query", "and", "add", "filtering", "by", "monitored", "projects", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L184-L204
27,662
googleapis/google-cloud-python
monitoring/google/cloud/monitoring_v3/query.py
Query.select_resources
def select_resources(self, *args, **kwargs): """Copy the query and add filtering by resource labels. Examples:: query = query.select_resources(zone='us-central1-a') query = query.select_resources(zone_prefix='europe-') query = query.select_resources(resource_type='g...
python
def select_resources(self, *args, **kwargs): """Copy the query and add filtering by resource labels. Examples:: query = query.select_resources(zone='us-central1-a') query = query.select_resources(zone_prefix='europe-') query = query.select_resources(resource_type='g...
[ "def", "select_resources", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "new_query", "=", "copy", ".", "deepcopy", "(", "self", ")", "new_query", ".", "_filter", ".", "select_resources", "(", "*", "args", ",", "*", "*", "kwargs", ...
Copy the query and add filtering by resource labels. Examples:: query = query.select_resources(zone='us-central1-a') query = query.select_resources(zone_prefix='europe-') query = query.select_resources(resource_type='gce_instance') A keyword argument ``<label>=<val...
[ "Copy", "the", "query", "and", "add", "filtering", "by", "resource", "labels", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L206-L262
27,663
googleapis/google-cloud-python
monitoring/google/cloud/monitoring_v3/query.py
Query.select_metrics
def select_metrics(self, *args, **kwargs): """Copy the query and add filtering by metric labels. Examples:: query = query.select_metrics(instance_name='myinstance') query = query.select_metrics(instance_name_prefix='mycluster-') A keyword argument ``<label>=<value>`` o...
python
def select_metrics(self, *args, **kwargs): """Copy the query and add filtering by metric labels. Examples:: query = query.select_metrics(instance_name='myinstance') query = query.select_metrics(instance_name_prefix='mycluster-') A keyword argument ``<label>=<value>`` o...
[ "def", "select_metrics", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "new_query", "=", "copy", ".", "deepcopy", "(", "self", ")", "new_query", ".", "_filter", ".", "select_metrics", "(", "*", "args", ",", "*", "*", "kwargs", ")"...
Copy the query and add filtering by metric labels. Examples:: query = query.select_metrics(instance_name='myinstance') query = query.select_metrics(instance_name_prefix='mycluster-') A keyword argument ``<label>=<value>`` ordinarily generates a filter expression of the...
[ "Copy", "the", "query", "and", "add", "filtering", "by", "metric", "labels", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L264-L321
27,664
googleapis/google-cloud-python
monitoring/google/cloud/monitoring_v3/query.py
Query.align
def align(self, per_series_aligner, seconds=0, minutes=0, hours=0): """Copy the query and add temporal alignment. If ``per_series_aligner`` is not :data:`Aligner.ALIGN_NONE`, each time series will contain data points only on the period boundaries. Example:: from google.clo...
python
def align(self, per_series_aligner, seconds=0, minutes=0, hours=0): """Copy the query and add temporal alignment. If ``per_series_aligner`` is not :data:`Aligner.ALIGN_NONE`, each time series will contain data points only on the period boundaries. Example:: from google.clo...
[ "def", "align", "(", "self", ",", "per_series_aligner", ",", "seconds", "=", "0", ",", "minutes", "=", "0", ",", "hours", "=", "0", ")", ":", "new_query", "=", "copy", ".", "deepcopy", "(", "self", ")", "new_query", ".", "_per_series_aligner", "=", "pe...
Copy the query and add temporal alignment. If ``per_series_aligner`` is not :data:`Aligner.ALIGN_NONE`, each time series will contain data points only on the period boundaries. Example:: from google.cloud.monitoring import enums query = query.align( enu...
[ "Copy", "the", "query", "and", "add", "temporal", "alignment", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L323-L366
27,665
googleapis/google-cloud-python
monitoring/google/cloud/monitoring_v3/query.py
Query.reduce
def reduce(self, cross_series_reducer, *group_by_fields): """Copy the query and add cross-series reduction. Cross-series reduction combines time series by aggregating their data points. For example, you could request an aggregated time series for each combination of project and...
python
def reduce(self, cross_series_reducer, *group_by_fields): """Copy the query and add cross-series reduction. Cross-series reduction combines time series by aggregating their data points. For example, you could request an aggregated time series for each combination of project and...
[ "def", "reduce", "(", "self", ",", "cross_series_reducer", ",", "*", "group_by_fields", ")", ":", "new_query", "=", "copy", ".", "deepcopy", "(", "self", ")", "new_query", ".", "_cross_series_reducer", "=", "cross_series_reducer", "new_query", ".", "_group_by_fiel...
Copy the query and add cross-series reduction. Cross-series reduction combines time series by aggregating their data points. For example, you could request an aggregated time series for each combination of project and zone as follows:: from google.cloud.monitoring import e...
[ "Copy", "the", "query", "and", "add", "cross", "-", "series", "reduction", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L368-L405
27,666
googleapis/google-cloud-python
monitoring/google/cloud/monitoring_v3/query.py
Query.iter
def iter(self, headers_only=False, page_size=None): """Yield all time series objects selected by the query. The generator returned iterates over :class:`~google.cloud.monitoring_v3.types.TimeSeries` objects containing points ordered from oldest to newest. Note that the :class:`...
python
def iter(self, headers_only=False, page_size=None): """Yield all time series objects selected by the query. The generator returned iterates over :class:`~google.cloud.monitoring_v3.types.TimeSeries` objects containing points ordered from oldest to newest. Note that the :class:`...
[ "def", "iter", "(", "self", ",", "headers_only", "=", "False", ",", "page_size", "=", "None", ")", ":", "if", "self", ".", "_end_time", "is", "None", ":", "raise", "ValueError", "(", "\"Query time interval not specified.\"", ")", "params", "=", "self", ".", ...
Yield all time series objects selected by the query. The generator returned iterates over :class:`~google.cloud.monitoring_v3.types.TimeSeries` objects containing points ordered from oldest to newest. Note that the :class:`Query` object itself is an iterable, such that the foll...
[ "Yield", "all", "time", "series", "objects", "selected", "by", "the", "query", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L407-L441
27,667
googleapis/google-cloud-python
monitoring/google/cloud/monitoring_v3/query.py
Query._build_query_params
def _build_query_params(self, headers_only=False, page_size=None): """Return key-value pairs for the list_time_series API call. :type headers_only: bool :param headers_only: Whether to omit the point data from the :class:`~google.cloud.monitoring_v3.types.TimeSeries` o...
python
def _build_query_params(self, headers_only=False, page_size=None): """Return key-value pairs for the list_time_series API call. :type headers_only: bool :param headers_only: Whether to omit the point data from the :class:`~google.cloud.monitoring_v3.types.TimeSeries` o...
[ "def", "_build_query_params", "(", "self", ",", "headers_only", "=", "False", ",", "page_size", "=", "None", ")", ":", "params", "=", "{", "\"name\"", ":", "self", ".", "_project_path", ",", "\"filter_\"", ":", "self", ".", "filter", "}", "params", "[", ...
Return key-value pairs for the list_time_series API call. :type headers_only: bool :param headers_only: Whether to omit the point data from the :class:`~google.cloud.monitoring_v3.types.TimeSeries` objects. :type page_size: int :param page_size: (O...
[ "Return", "key", "-", "value", "pairs", "for", "the", "list_time_series", "API", "call", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/query.py#L443-L485
27,668
googleapis/google-cloud-python
resource_manager/google/cloud/resource_manager/project.py
Project.set_properties_from_api_repr
def set_properties_from_api_repr(self, resource): """Update specific properties from its API representation.""" self.name = resource.get("name") self.number = resource["projectNumber"] self.labels = resource.get("labels", {}) self.status = resource["lifecycleState"] if "p...
python
def set_properties_from_api_repr(self, resource): """Update specific properties from its API representation.""" self.name = resource.get("name") self.number = resource["projectNumber"] self.labels = resource.get("labels", {}) self.status = resource["lifecycleState"] if "p...
[ "def", "set_properties_from_api_repr", "(", "self", ",", "resource", ")", ":", "self", ".", "name", "=", "resource", ".", "get", "(", "\"name\"", ")", "self", ".", "number", "=", "resource", "[", "\"projectNumber\"", "]", "self", ".", "labels", "=", "resou...
Update specific properties from its API representation.
[ "Update", "specific", "properties", "from", "its", "API", "representation", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/resource_manager/google/cloud/resource_manager/project.py#L84-L91
27,669
googleapis/google-cloud-python
datastore/google/cloud/datastore/helpers.py
_get_meaning
def _get_meaning(value_pb, is_list=False): """Get the meaning from a protobuf value. :type value_pb: :class:`.entity_pb2.Value` :param value_pb: The protobuf value to be checked for an associated meaning. :type is_list: bool :param is_list: Boolean indicating if the ``value_pb...
python
def _get_meaning(value_pb, is_list=False): """Get the meaning from a protobuf value. :type value_pb: :class:`.entity_pb2.Value` :param value_pb: The protobuf value to be checked for an associated meaning. :type is_list: bool :param is_list: Boolean indicating if the ``value_pb...
[ "def", "_get_meaning", "(", "value_pb", ",", "is_list", "=", "False", ")", ":", "meaning", "=", "None", "if", "is_list", ":", "# An empty list will have no values, hence no shared meaning", "# set among them.", "if", "len", "(", "value_pb", ".", "array_value", ".", ...
Get the meaning from a protobuf value. :type value_pb: :class:`.entity_pb2.Value` :param value_pb: The protobuf value to be checked for an associated meaning. :type is_list: bool :param is_list: Boolean indicating if the ``value_pb`` contains a list value. ...
[ "Get", "the", "meaning", "from", "a", "protobuf", "value", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L35-L74
27,670
googleapis/google-cloud-python
datastore/google/cloud/datastore/helpers.py
entity_from_protobuf
def entity_from_protobuf(pb): """Factory method for creating an entity based on a protobuf. The protobuf should be one returned from the Cloud Datastore Protobuf API. :type pb: :class:`.entity_pb2.Entity` :param pb: The Protobuf representing the entity. :rtype: :class:`google.cloud.datastore....
python
def entity_from_protobuf(pb): """Factory method for creating an entity based on a protobuf. The protobuf should be one returned from the Cloud Datastore Protobuf API. :type pb: :class:`.entity_pb2.Entity` :param pb: The Protobuf representing the entity. :rtype: :class:`google.cloud.datastore....
[ "def", "entity_from_protobuf", "(", "pb", ")", ":", "key", "=", "None", "if", "pb", ".", "HasField", "(", "\"key\"", ")", ":", "# Message field (Key)", "key", "=", "key_from_protobuf", "(", "pb", ".", "key", ")", "entity_props", "=", "{", "}", "entity_mean...
Factory method for creating an entity based on a protobuf. The protobuf should be one returned from the Cloud Datastore Protobuf API. :type pb: :class:`.entity_pb2.Entity` :param pb: The Protobuf representing the entity. :rtype: :class:`google.cloud.datastore.entity.Entity` :returns: The enti...
[ "Factory", "method", "for", "creating", "an", "entity", "based", "on", "a", "protobuf", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L105-L159
27,671
googleapis/google-cloud-python
datastore/google/cloud/datastore/helpers.py
entity_to_protobuf
def entity_to_protobuf(entity): """Converts an entity into a protobuf. :type entity: :class:`google.cloud.datastore.entity.Entity` :param entity: The entity to be turned into a protobuf. :rtype: :class:`.entity_pb2.Entity` :returns: The protobuf representing the entity. """ entity_pb = ent...
python
def entity_to_protobuf(entity): """Converts an entity into a protobuf. :type entity: :class:`google.cloud.datastore.entity.Entity` :param entity: The entity to be turned into a protobuf. :rtype: :class:`.entity_pb2.Entity` :returns: The protobuf representing the entity. """ entity_pb = ent...
[ "def", "entity_to_protobuf", "(", "entity", ")", ":", "entity_pb", "=", "entity_pb2", ".", "Entity", "(", ")", "if", "entity", ".", "key", "is", "not", "None", ":", "key_pb", "=", "entity", ".", "key", ".", "to_protobuf", "(", ")", "entity_pb", ".", "k...
Converts an entity into a protobuf. :type entity: :class:`google.cloud.datastore.entity.Entity` :param entity: The entity to be turned into a protobuf. :rtype: :class:`.entity_pb2.Entity` :returns: The protobuf representing the entity.
[ "Converts", "an", "entity", "into", "a", "protobuf", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L202-L236
27,672
googleapis/google-cloud-python
datastore/google/cloud/datastore/helpers.py
get_read_options
def get_read_options(eventual, transaction_id): """Validate rules for read options, and assign to the request. Helper method for ``lookup()`` and ``run_query``. :type eventual: bool :param eventual: Flag indicating if ``EVENTUAL`` or ``STRONG`` consistency should be used. :ty...
python
def get_read_options(eventual, transaction_id): """Validate rules for read options, and assign to the request. Helper method for ``lookup()`` and ``run_query``. :type eventual: bool :param eventual: Flag indicating if ``EVENTUAL`` or ``STRONG`` consistency should be used. :ty...
[ "def", "get_read_options", "(", "eventual", ",", "transaction_id", ")", ":", "if", "transaction_id", "is", "None", ":", "if", "eventual", ":", "return", "datastore_pb2", ".", "ReadOptions", "(", "read_consistency", "=", "datastore_pb2", ".", "ReadOptions", ".", ...
Validate rules for read options, and assign to the request. Helper method for ``lookup()`` and ``run_query``. :type eventual: bool :param eventual: Flag indicating if ``EVENTUAL`` or ``STRONG`` consistency should be used. :type transaction_id: bytes :param transaction_id: A t...
[ "Validate", "rules", "for", "read", "options", "and", "assign", "to", "the", "request", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L239-L267
27,673
googleapis/google-cloud-python
datastore/google/cloud/datastore/helpers.py
key_from_protobuf
def key_from_protobuf(pb): """Factory method for creating a key based on a protobuf. The protobuf should be one returned from the Cloud Datastore Protobuf API. :type pb: :class:`.entity_pb2.Key` :param pb: The Protobuf representing the key. :rtype: :class:`google.cloud.datastore.key.Key` ...
python
def key_from_protobuf(pb): """Factory method for creating a key based on a protobuf. The protobuf should be one returned from the Cloud Datastore Protobuf API. :type pb: :class:`.entity_pb2.Key` :param pb: The Protobuf representing the key. :rtype: :class:`google.cloud.datastore.key.Key` ...
[ "def", "key_from_protobuf", "(", "pb", ")", ":", "path_args", "=", "[", "]", "for", "element", "in", "pb", ".", "path", ":", "path_args", ".", "append", "(", "element", ".", "kind", ")", "if", "element", ".", "id", ":", "# Simple field (int64)", "path_ar...
Factory method for creating a key based on a protobuf. The protobuf should be one returned from the Cloud Datastore Protobuf API. :type pb: :class:`.entity_pb2.Key` :param pb: The Protobuf representing the key. :rtype: :class:`google.cloud.datastore.key.Key` :returns: a new `Key` instance
[ "Factory", "method", "for", "creating", "a", "key", "based", "on", "a", "protobuf", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L270-L299
27,674
googleapis/google-cloud-python
datastore/google/cloud/datastore/helpers.py
_pb_attr_value
def _pb_attr_value(val): """Given a value, return the protobuf attribute name and proper value. The Protobuf API uses different attribute names based on value types rather than inferring the type. This function simply determines the proper attribute name based on the type of the value provided and ...
python
def _pb_attr_value(val): """Given a value, return the protobuf attribute name and proper value. The Protobuf API uses different attribute names based on value types rather than inferring the type. This function simply determines the proper attribute name based on the type of the value provided and ...
[ "def", "_pb_attr_value", "(", "val", ")", ":", "if", "isinstance", "(", "val", ",", "datetime", ".", "datetime", ")", ":", "name", "=", "\"timestamp\"", "value", "=", "_datetime_to_pb_timestamp", "(", "val", ")", "elif", "isinstance", "(", "val", ",", "Key...
Given a value, return the protobuf attribute name and proper value. The Protobuf API uses different attribute names based on value types rather than inferring the type. This function simply determines the proper attribute name based on the type of the value provided and returns the attribute name as w...
[ "Given", "a", "value", "return", "the", "protobuf", "attribute", "name", "and", "proper", "value", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L302-L368
27,675
googleapis/google-cloud-python
datastore/google/cloud/datastore/helpers.py
_get_value_from_value_pb
def _get_value_from_value_pb(value_pb): """Given a protobuf for a Value, get the correct value. The Cloud Datastore Protobuf API returns a Property Protobuf which has one value set and the rest blank. This function retrieves the the one value provided. Some work is done to coerce the return value...
python
def _get_value_from_value_pb(value_pb): """Given a protobuf for a Value, get the correct value. The Cloud Datastore Protobuf API returns a Property Protobuf which has one value set and the rest blank. This function retrieves the the one value provided. Some work is done to coerce the return value...
[ "def", "_get_value_from_value_pb", "(", "value_pb", ")", ":", "value_type", "=", "value_pb", ".", "WhichOneof", "(", "\"value_type\"", ")", "if", "value_type", "==", "\"timestamp_value\"", ":", "result", "=", "_pb_timestamp_to_datetime", "(", "value_pb", ".", "times...
Given a protobuf for a Value, get the correct value. The Cloud Datastore Protobuf API returns a Property Protobuf which has one value set and the rest blank. This function retrieves the the one value provided. Some work is done to coerce the return value into a more useful type (particularly in t...
[ "Given", "a", "protobuf", "for", "a", "Value", "get", "the", "correct", "value", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L371-L431
27,676
googleapis/google-cloud-python
datastore/google/cloud/datastore/helpers.py
_set_protobuf_value
def _set_protobuf_value(value_pb, val): """Assign 'val' to the correct subfield of 'value_pb'. The Protobuf API uses different attribute names based on value types rather than inferring the type. Some value types (entities, keys, lists) cannot be directly assigned; this function handles them corre...
python
def _set_protobuf_value(value_pb, val): """Assign 'val' to the correct subfield of 'value_pb'. The Protobuf API uses different attribute names based on value types rather than inferring the type. Some value types (entities, keys, lists) cannot be directly assigned; this function handles them corre...
[ "def", "_set_protobuf_value", "(", "value_pb", ",", "val", ")", ":", "attr", ",", "val", "=", "_pb_attr_value", "(", "val", ")", "if", "attr", "==", "\"key_value\"", ":", "value_pb", ".", "key_value", ".", "CopyFrom", "(", "val", ")", "elif", "attr", "==...
Assign 'val' to the correct subfield of 'value_pb'. The Protobuf API uses different attribute names based on value types rather than inferring the type. Some value types (entities, keys, lists) cannot be directly assigned; this function handles them correctly. :type value_pb: :class:`.entity_pb2....
[ "Assign", "val", "to", "the", "correct", "subfield", "of", "value_pb", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/helpers.py#L434-L471
27,677
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/dbapi/types.py
TimeFromTicks
def TimeFromTicks(ticks, tz=None): """Construct a DB-API time value from the given ticks value. :type ticks: float :param ticks: a number of seconds since the epoch; see the documentation of the standard Python time module for details. :type tz: :class:`datetime.tzinfo` :param tz: ...
python
def TimeFromTicks(ticks, tz=None): """Construct a DB-API time value from the given ticks value. :type ticks: float :param ticks: a number of seconds since the epoch; see the documentation of the standard Python time module for details. :type tz: :class:`datetime.tzinfo` :param tz: ...
[ "def", "TimeFromTicks", "(", "ticks", ",", "tz", "=", "None", ")", ":", "dt", "=", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "ticks", ",", "tz", "=", "tz", ")", "return", "dt", ".", "timetz", "(", ")" ]
Construct a DB-API time value from the given ticks value. :type ticks: float :param ticks: a number of seconds since the epoch; see the documentation of the standard Python time module for details. :type tz: :class:`datetime.tzinfo` :param tz: (Optional) time zone to use for conversion...
[ "Construct", "a", "DB", "-", "API", "time", "value", "from", "the", "given", "ticks", "value", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/types.py#L45-L60
27,678
googleapis/google-cloud-python
iot/google/cloud/iot_v1/gapic/device_manager_client.py
DeviceManagerClient.registry_path
def registry_path(cls, project, location, registry): """Return a fully-qualified registry string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/registries/{registry}", project=project, location=location, registry=...
python
def registry_path(cls, project, location, registry): """Return a fully-qualified registry string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/registries/{registry}", project=project, location=location, registry=...
[ "def", "registry_path", "(", "cls", ",", "project", ",", "location", ",", "registry", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/locations/{location}/registries/{registry}\"", ",", "project", "=", "...
Return a fully-qualified registry string.
[ "Return", "a", "fully", "-", "qualified", "registry", "string", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iot/google/cloud/iot_v1/gapic/device_manager_client.py#L86-L93
27,679
googleapis/google-cloud-python
iot/google/cloud/iot_v1/gapic/device_manager_client.py
DeviceManagerClient.device_path
def device_path(cls, project, location, registry, device): """Return a fully-qualified device string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/registries/{registry}/devices/{device}", project=project, location=location, ...
python
def device_path(cls, project, location, registry, device): """Return a fully-qualified device string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/registries/{registry}/devices/{device}", project=project, location=location, ...
[ "def", "device_path", "(", "cls", ",", "project", ",", "location", ",", "registry", ",", "device", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/locations/{location}/registries/{registry}/devices/{device}\...
Return a fully-qualified device string.
[ "Return", "a", "fully", "-", "qualified", "device", "string", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iot/google/cloud/iot_v1/gapic/device_manager_client.py#L96-L104
27,680
googleapis/google-cloud-python
iot/google/cloud/iot_v1/gapic/device_manager_client.py
DeviceManagerClient.create_device
def create_device( self, parent, device, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a device in a device registry. Example: >>> from google.cloud im...
python
def create_device( self, parent, device, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a device in a device registry. Example: >>> from google.cloud im...
[ "def", "create_device", "(", "self", ",", "parent", ",", "device", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT...
Creates a device in a device registry. Example: >>> from google.cloud import iot_v1 >>> >>> client = iot_v1.DeviceManagerClient() >>> >>> parent = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]') >>> >>> # TODO: In...
[ "Creates", "a", "device", "in", "a", "device", "registry", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iot/google/cloud/iot_v1/gapic/device_manager_client.py#L618-L697
27,681
googleapis/google-cloud-python
iot/google/cloud/iot_v1/gapic/device_manager_client.py
DeviceManagerClient.set_iam_policy
def set_iam_policy( self, resource, policy, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Sets the access control policy on the specified resource. Replaces any existing po...
python
def set_iam_policy( self, resource, policy, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Sets the access control policy on the specified resource. Replaces any existing po...
[ "def", "set_iam_policy", "(", "self", ",", "resource", ",", "policy", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFA...
Sets the access control policy on the specified resource. Replaces any existing policy. Example: >>> from google.cloud import iot_v1 >>> >>> client = iot_v1.DeviceManagerClient() >>> >>> resource = client.registry_path('[PROJECT]', '[LOCATION]...
[ "Sets", "the", "access", "control", "policy", "on", "the", "specified", "resource", ".", "Replaces", "any", "existing", "policy", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iot/google/cloud/iot_v1/gapic/device_manager_client.py#L1311-L1392
27,682
googleapis/google-cloud-python
iot/google/cloud/iot_v1/gapic/device_manager_client.py
DeviceManagerClient.bind_device_to_gateway
def bind_device_to_gateway( self, parent, gateway_id, device_id, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Associates the device with the gateway. Example: ...
python
def bind_device_to_gateway( self, parent, gateway_id, device_id, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Associates the device with the gateway. Example: ...
[ "def", "bind_device_to_gateway", "(", "self", ",", "parent", ",", "gateway_id", ",", "device_id", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ...
Associates the device with the gateway. Example: >>> from google.cloud import iot_v1 >>> >>> client = iot_v1.DeviceManagerClient() >>> >>> parent = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]') >>> >>> # TODO: I...
[ "Associates", "the", "device", "with", "the", "gateway", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/iot/google/cloud/iot_v1/gapic/device_manager_client.py#L1649-L1732
27,683
googleapis/google-cloud-python
tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py
CloudTasksClient.queue_path
def queue_path(cls, project, location, queue): """Return a fully-qualified queue string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/queues/{queue}", project=project, location=location, queue=queue, )
python
def queue_path(cls, project, location, queue): """Return a fully-qualified queue string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/queues/{queue}", project=project, location=location, queue=queue, )
[ "def", "queue_path", "(", "cls", ",", "project", ",", "location", ",", "queue", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/locations/{location}/queues/{queue}\"", ",", "project", "=", "project", "...
Return a fully-qualified queue string.
[ "Return", "a", "fully", "-", "qualified", "queue", "string", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py#L97-L104
27,684
googleapis/google-cloud-python
tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py
CloudTasksClient.task_path
def task_path(cls, project, location, queue, task): """Return a fully-qualified task string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/queues/{queue}/tasks/{task}", project=project, location=location, queue=qu...
python
def task_path(cls, project, location, queue, task): """Return a fully-qualified task string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/queues/{queue}/tasks/{task}", project=project, location=location, queue=qu...
[ "def", "task_path", "(", "cls", ",", "project", ",", "location", ",", "queue", ",", "task", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/locations/{location}/queues/{queue}/tasks/{task}\"", ",", "proj...
Return a fully-qualified task string.
[ "Return", "a", "fully", "-", "qualified", "task", "string", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py#L107-L115
27,685
googleapis/google-cloud-python
tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py
CloudTasksClient.create_queue
def create_queue( self, parent, queue, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a queue. Queues created with this method allow tasks to live for a maximum of ...
python
def create_queue( self, parent, queue, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a queue. Queues created with this method allow tasks to live for a maximum of ...
[ "def", "create_queue", "(", "self", ",", "parent", ",", "queue", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT",...
Creates a queue. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an A...
[ "Creates", "a", "queue", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py#L407-L502
27,686
googleapis/google-cloud-python
tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py
CloudTasksClient.create_task
def create_task( self, parent, task, response_view=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a task and adds it to a queue. Tasks cannot be updat...
python
def create_task( self, parent, task, response_view=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a task and adds it to a queue. Tasks cannot be updat...
[ "def", "create_task", "(", "self", ",", "parent", ",", "task", ",", "response_view", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1...
Creates a task and adds it to a queue. Tasks cannot be updated after creation; there is no UpdateTask command. - For ``App Engine queues``, the maximum task size is 100KB. Example: >>> from google.cloud import tasks_v2 >>> >>> client = tasks_v2.CloudTasksC...
[ "Creates", "a", "task", "and", "adds", "it", "to", "a", "queue", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/tasks/google/cloud/tasks_v2/gapic/cloud_tasks_client.py#L1387-L1516
27,687
googleapis/google-cloud-python
api_core/google/api_core/timeout.py
_exponential_timeout_generator
def _exponential_timeout_generator(initial, maximum, multiplier, deadline): """A generator that yields exponential timeout values. Args: initial (float): The initial timeout. maximum (float): The maximum timeout. multiplier (float): The multiplier applied to the timeout. deadlin...
python
def _exponential_timeout_generator(initial, maximum, multiplier, deadline): """A generator that yields exponential timeout values. Args: initial (float): The initial timeout. maximum (float): The maximum timeout. multiplier (float): The multiplier applied to the timeout. deadlin...
[ "def", "_exponential_timeout_generator", "(", "initial", ",", "maximum", ",", "multiplier", ",", "deadline", ")", ":", "if", "deadline", "is", "not", "None", ":", "deadline_datetime", "=", "datetime_helpers", ".", "utcnow", "(", ")", "+", "datetime", ".", "tim...
A generator that yields exponential timeout values. Args: initial (float): The initial timeout. maximum (float): The maximum timeout. multiplier (float): The multiplier applied to the timeout. deadline (float): The overall deadline across all invocations. Yields: float:...
[ "A", "generator", "that", "yields", "exponential", "timeout", "values", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/timeout.py#L110-L140
27,688
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/dbapi/cursor.py
_format_operation
def _format_operation(operation, parameters=None): """Formats parameters in operation in way BigQuery expects. :type: str :param operation: A Google BigQuery query string. :type: Mapping[str, Any] or Sequence[Any] :param parameters: Optional parameter values. :rtype: str :returns: A forma...
python
def _format_operation(operation, parameters=None): """Formats parameters in operation in way BigQuery expects. :type: str :param operation: A Google BigQuery query string. :type: Mapping[str, Any] or Sequence[Any] :param parameters: Optional parameter values. :rtype: str :returns: A forma...
[ "def", "_format_operation", "(", "operation", ",", "parameters", "=", "None", ")", ":", "if", "parameters", "is", "None", ":", "return", "operation", "if", "isinstance", "(", "parameters", ",", "collections_abc", ".", "Mapping", ")", ":", "return", "_format_op...
Formats parameters in operation in way BigQuery expects. :type: str :param operation: A Google BigQuery query string. :type: Mapping[str, Any] or Sequence[Any] :param parameters: Optional parameter values. :rtype: str :returns: A formatted query string. :raises: :class:`~google.cloud.bigq...
[ "Formats", "parameters", "in", "operation", "in", "way", "BigQuery", "expects", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L337-L358
27,689
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/dbapi/cursor.py
Cursor._set_description
def _set_description(self, schema): """Set description from schema. :type schema: Sequence[google.cloud.bigquery.schema.SchemaField] :param schema: A description of fields in the schema. """ if schema is None: self.description = None return self....
python
def _set_description(self, schema): """Set description from schema. :type schema: Sequence[google.cloud.bigquery.schema.SchemaField] :param schema: A description of fields in the schema. """ if schema is None: self.description = None return self....
[ "def", "_set_description", "(", "self", ",", "schema", ")", ":", "if", "schema", "is", "None", ":", "self", ".", "description", "=", "None", "return", "self", ".", "description", "=", "tuple", "(", "[", "Column", "(", "name", "=", "field", ".", "name",...
Set description from schema. :type schema: Sequence[google.cloud.bigquery.schema.SchemaField] :param schema: A description of fields in the schema.
[ "Set", "description", "from", "schema", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L72-L95
27,690
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/dbapi/cursor.py
Cursor._set_rowcount
def _set_rowcount(self, query_results): """Set the rowcount from query results. Normally, this sets rowcount to the number of rows returned by the query, but if it was a DML statement, it sets rowcount to the number of modified rows. :type query_results: :class:`~go...
python
def _set_rowcount(self, query_results): """Set the rowcount from query results. Normally, this sets rowcount to the number of rows returned by the query, but if it was a DML statement, it sets rowcount to the number of modified rows. :type query_results: :class:`~go...
[ "def", "_set_rowcount", "(", "self", ",", "query_results", ")", ":", "total_rows", "=", "0", "num_dml_affected_rows", "=", "query_results", ".", "num_dml_affected_rows", "if", "query_results", ".", "total_rows", "is", "not", "None", "and", "query_results", ".", "t...
Set the rowcount from query results. Normally, this sets rowcount to the number of rows returned by the query, but if it was a DML statement, it sets rowcount to the number of modified rows. :type query_results: :class:`~google.cloud.bigquery.query._QueryResults` :p...
[ "Set", "the", "rowcount", "from", "query", "results", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L97-L115
27,691
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/dbapi/cursor.py
Cursor.execute
def execute(self, operation, parameters=None, job_id=None): """Prepare and execute a database operation. .. note:: When setting query parameters, values which are "text" (``unicode`` in Python2, ``str`` in Python3) will use the 'STRING' BigQuery type. Values which ar...
python
def execute(self, operation, parameters=None, job_id=None): """Prepare and execute a database operation. .. note:: When setting query parameters, values which are "text" (``unicode`` in Python2, ``str`` in Python3) will use the 'STRING' BigQuery type. Values which ar...
[ "def", "execute", "(", "self", ",", "operation", ",", "parameters", "=", "None", ",", "job_id", "=", "None", ")", ":", "self", ".", "_query_data", "=", "None", "self", ".", "_query_job", "=", "None", "client", "=", "self", ".", "connection", ".", "_cli...
Prepare and execute a database operation. .. note:: When setting query parameters, values which are "text" (``unicode`` in Python2, ``str`` in Python3) will use the 'STRING' BigQuery type. Values which are "bytes" (``str`` in Python2, ``bytes`` in Python3), will ...
[ "Prepare", "and", "execute", "a", "database", "operation", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L117-L176
27,692
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/dbapi/cursor.py
Cursor._try_fetch
def _try_fetch(self, size=None): """Try to start fetching data, if not yet started. Mutates self to indicate that iteration has started. """ if self._query_job is None: raise exceptions.InterfaceError( "No query results: execute() must be called before fetch....
python
def _try_fetch(self, size=None): """Try to start fetching data, if not yet started. Mutates self to indicate that iteration has started. """ if self._query_job is None: raise exceptions.InterfaceError( "No query results: execute() must be called before fetch....
[ "def", "_try_fetch", "(", "self", ",", "size", "=", "None", ")", ":", "if", "self", ".", "_query_job", "is", "None", ":", "raise", "exceptions", ".", "InterfaceError", "(", "\"No query results: execute() must be called before fetch.\"", ")", "is_dml", "=", "(", ...
Try to start fetching data, if not yet started. Mutates self to indicate that iteration has started.
[ "Try", "to", "start", "fetching", "data", "if", "not", "yet", "started", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L190-L215
27,693
googleapis/google-cloud-python
logging/google/cloud/logging/sink.py
Sink._update_from_api_repr
def _update_from_api_repr(self, resource): """Helper for API methods returning sink resources.""" self.destination = resource["destination"] self.filter_ = resource.get("filter") self._writer_identity = resource.get("writerIdentity")
python
def _update_from_api_repr(self, resource): """Helper for API methods returning sink resources.""" self.destination = resource["destination"] self.filter_ = resource.get("filter") self._writer_identity = resource.get("writerIdentity")
[ "def", "_update_from_api_repr", "(", "self", ",", "resource", ")", ":", "self", ".", "destination", "=", "resource", "[", "\"destination\"", "]", "self", ".", "filter_", "=", "resource", ".", "get", "(", "\"filter\"", ")", "self", ".", "_writer_identity", "=...
Helper for API methods returning sink resources.
[ "Helper", "for", "API", "methods", "returning", "sink", "resources", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/sink.py#L75-L79
27,694
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/streamed.py
_merge_by_type
def _merge_by_type(lhs, rhs, type_): """Helper for '_merge_chunk'.""" merger = _MERGE_BY_TYPE[type_.code] return merger(lhs, rhs, type_)
python
def _merge_by_type(lhs, rhs, type_): """Helper for '_merge_chunk'.""" merger = _MERGE_BY_TYPE[type_.code] return merger(lhs, rhs, type_)
[ "def", "_merge_by_type", "(", "lhs", ",", "rhs", ",", "type_", ")", ":", "merger", "=", "_MERGE_BY_TYPE", "[", "type_", ".", "code", "]", "return", "merger", "(", "lhs", ",", "rhs", ",", "type_", ")" ]
Helper for '_merge_chunk'.
[ "Helper", "for", "_merge_chunk", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L302-L305
27,695
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/streamed.py
StreamedResultSet._merge_chunk
def _merge_chunk(self, value): """Merge pending chunk with next value. :type value: :class:`~google.protobuf.struct_pb2.Value` :param value: continuation of chunked value from previous partial result set. :rtype: :class:`~google.protobuf.struct_pb2.Value` ...
python
def _merge_chunk(self, value): """Merge pending chunk with next value. :type value: :class:`~google.protobuf.struct_pb2.Value` :param value: continuation of chunked value from previous partial result set. :rtype: :class:`~google.protobuf.struct_pb2.Value` ...
[ "def", "_merge_chunk", "(", "self", ",", "value", ")", ":", "current_column", "=", "len", "(", "self", ".", "_current_row", ")", "field", "=", "self", ".", "fields", "[", "current_column", "]", "merged", "=", "_merge_by_type", "(", "self", ".", "_pending_c...
Merge pending chunk with next value. :type value: :class:`~google.protobuf.struct_pb2.Value` :param value: continuation of chunked value from previous partial result set. :rtype: :class:`~google.protobuf.struct_pb2.Value` :returns: the merged value
[ "Merge", "pending", "chunk", "with", "next", "value", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L80-L94
27,696
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/streamed.py
StreamedResultSet._merge_values
def _merge_values(self, values): """Merge values into rows. :type values: list of :class:`~google.protobuf.struct_pb2.Value` :param values: non-chunked values from partial result set. """ width = len(self.fields) for value in values: index = len(self._current...
python
def _merge_values(self, values): """Merge values into rows. :type values: list of :class:`~google.protobuf.struct_pb2.Value` :param values: non-chunked values from partial result set. """ width = len(self.fields) for value in values: index = len(self._current...
[ "def", "_merge_values", "(", "self", ",", "values", ")", ":", "width", "=", "len", "(", "self", ".", "fields", ")", "for", "value", "in", "values", ":", "index", "=", "len", "(", "self", ".", "_current_row", ")", "field", "=", "self", ".", "fields", ...
Merge values into rows. :type values: list of :class:`~google.protobuf.struct_pb2.Value` :param values: non-chunked values from partial result set.
[ "Merge", "values", "into", "rows", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L96-L109
27,697
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/streamed.py
StreamedResultSet._consume_next
def _consume_next(self): """Consume the next partial result set from the stream. Parse the result set into new/existing rows in :attr:`_rows` """ response = six.next(self._response_iterator) self._counter += 1 if self._metadata is None: # first response met...
python
def _consume_next(self): """Consume the next partial result set from the stream. Parse the result set into new/existing rows in :attr:`_rows` """ response = six.next(self._response_iterator) self._counter += 1 if self._metadata is None: # first response met...
[ "def", "_consume_next", "(", "self", ")", ":", "response", "=", "six", ".", "next", "(", "self", ".", "_response_iterator", ")", "self", ".", "_counter", "+=", "1", "if", "self", ".", "_metadata", "is", "None", ":", "# first response", "metadata", "=", "...
Consume the next partial result set from the stream. Parse the result set into new/existing rows in :attr:`_rows`
[ "Consume", "the", "next", "partial", "result", "set", "from", "the", "stream", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L111-L136
27,698
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/streamed.py
StreamedResultSet.one_or_none
def one_or_none(self): """Return exactly one result, or None if there are no results. :raises: :exc:`ValueError`: If there are multiple results. :raises: :exc:`RuntimeError`: If consumption has already occurred, in whole or in part. """ # Sanity check: Has consumptio...
python
def one_or_none(self): """Return exactly one result, or None if there are no results. :raises: :exc:`ValueError`: If there are multiple results. :raises: :exc:`RuntimeError`: If consumption has already occurred, in whole or in part. """ # Sanity check: Has consumptio...
[ "def", "one_or_none", "(", "self", ")", ":", "# Sanity check: Has consumption of this query already started?", "# If it has, then this is an exception.", "if", "self", ".", "_metadata", "is", "not", "None", ":", "raise", "RuntimeError", "(", "\"Can not call `.one` or `.one_or_n...
Return exactly one result, or None if there are no results. :raises: :exc:`ValueError`: If there are multiple results. :raises: :exc:`RuntimeError`: If consumption has already occurred, in whole or in part.
[ "Return", "exactly", "one", "result", "or", "None", "if", "there", "are", "no", "results", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L163-L192
27,699
googleapis/google-cloud-python
vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py
ProductSearchClient.product_set_path
def product_set_path(cls, project, location, product_set): """Return a fully-qualified product_set string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/productSets/{product_set}", project=project, location=location, ...
python
def product_set_path(cls, project, location, product_set): """Return a fully-qualified product_set string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/productSets/{product_set}", project=project, location=location, ...
[ "def", "product_set_path", "(", "cls", ",", "project", ",", "location", ",", "product_set", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/locations/{location}/productSets/{product_set}\"", ",", "project", ...
Return a fully-qualified product_set string.
[ "Return", "a", "fully", "-", "qualified", "product_set", "string", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_v1p3beta1/gapic/product_search_client.py#L101-L108