partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
_time_to_json
Coerce 'value' to an JSON-compatible representation.
bigquery/google/cloud/bigquery/_helpers.py
def _time_to_json(value): """Coerce 'value' to an JSON-compatible representation.""" if isinstance(value, datetime.time): value = value.isoformat() return value
def _time_to_json(value): """Coerce 'value' to an JSON-compatible representation.""" if isinstance(value, datetime.time): value = value.isoformat() return value
[ "Coerce", "value", "to", "an", "JSON", "-", "compatible", "representation", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L304-L308
[ "def", "_time_to_json", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "datetime", ".", "time", ")", ":", "value", "=", "value", ".", "isoformat", "(", ")", "return", "value" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_scalar_field_to_json
Maps a field and value to a JSON-safe value. Args: field ( \ :class:`~google.cloud.bigquery.schema.SchemaField`, \ ): The SchemaField to use for type conversion and field name. row_value (any): Value to be converted, based on the field's type. Return...
bigquery/google/cloud/bigquery/_helpers.py
def _scalar_field_to_json(field, row_value): """Maps a field and value to a JSON-safe value. Args: field ( \ :class:`~google.cloud.bigquery.schema.SchemaField`, \ ): The SchemaField to use for type conversion and field name. row_value (any): Value to ...
def _scalar_field_to_json(field, row_value): """Maps a field and value to a JSON-safe value. Args: field ( \ :class:`~google.cloud.bigquery.schema.SchemaField`, \ ): The SchemaField to use for type conversion and field name. row_value (any): Value to ...
[ "Maps", "a", "field", "and", "value", "to", "a", "JSON", "-", "safe", "value", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L333-L351
[ "def", "_scalar_field_to_json", "(", "field", ",", "row_value", ")", ":", "converter", "=", "_SCALAR_VALUE_TO_JSON_ROW", ".", "get", "(", "field", ".", "field_type", ")", "if", "converter", "is", "None", ":", "# STRING doesn't need converting", "return", "row_value"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_repeated_field_to_json
Convert a repeated/array field to its JSON representation. Args: field ( \ :class:`~google.cloud.bigquery.schema.SchemaField`, \ ): The SchemaField to use for type conversion and field name. The field mode must equal ``REPEATED``. row_value (Sequence[any]...
bigquery/google/cloud/bigquery/_helpers.py
def _repeated_field_to_json(field, row_value): """Convert a repeated/array field to its JSON representation. Args: field ( \ :class:`~google.cloud.bigquery.schema.SchemaField`, \ ): The SchemaField to use for type conversion and field name. The field mode mus...
def _repeated_field_to_json(field, row_value): """Convert a repeated/array field to its JSON representation. Args: field ( \ :class:`~google.cloud.bigquery.schema.SchemaField`, \ ): The SchemaField to use for type conversion and field name. The field mode mus...
[ "Convert", "a", "repeated", "/", "array", "field", "to", "its", "JSON", "representation", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L354-L377
[ "def", "_repeated_field_to_json", "(", "field", ",", "row_value", ")", ":", "# Remove the REPEATED, but keep the other fields. This allows us to process", "# each item as if it were a top-level field.", "item_field", "=", "copy", ".", "deepcopy", "(", "field", ")", "item_field", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_record_field_to_json
Convert a record/struct field to its JSON representation. Args: fields ( \ Sequence[:class:`~google.cloud.bigquery.schema.SchemaField`], \ ): The :class:`~google.cloud.bigquery.schema.SchemaField`s of the record's subfields to use for type conversion and field na...
bigquery/google/cloud/bigquery/_helpers.py
def _record_field_to_json(fields, row_value): """Convert a record/struct field to its JSON representation. Args: fields ( \ Sequence[:class:`~google.cloud.bigquery.schema.SchemaField`], \ ): The :class:`~google.cloud.bigquery.schema.SchemaField`s of the recor...
def _record_field_to_json(fields, row_value): """Convert a record/struct field to its JSON representation. Args: fields ( \ Sequence[:class:`~google.cloud.bigquery.schema.SchemaField`], \ ): The :class:`~google.cloud.bigquery.schema.SchemaField`s of the recor...
[ "Convert", "a", "record", "/", "struct", "field", "to", "its", "JSON", "representation", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L380-L406
[ "def", "_record_field_to_json", "(", "fields", ",", "row_value", ")", ":", "record", "=", "{", "}", "isdict", "=", "isinstance", "(", "row_value", ",", "dict", ")", "for", "subindex", ",", "subfield", "in", "enumerate", "(", "fields", ")", ":", "subname", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_field_to_json
Convert a field into JSON-serializable values. Args: field ( \ :class:`~google.cloud.bigquery.schema.SchemaField`, \ ): The SchemaField to use for type conversion and field name. row_value (Union[ \ Sequence[list], \ any, \ ]): ...
bigquery/google/cloud/bigquery/_helpers.py
def _field_to_json(field, row_value): """Convert a field into JSON-serializable values. Args: field ( \ :class:`~google.cloud.bigquery.schema.SchemaField`, \ ): The SchemaField to use for type conversion and field name. row_value (Union[ \ Sequence[l...
def _field_to_json(field, row_value): """Convert a field into JSON-serializable values. Args: field ( \ :class:`~google.cloud.bigquery.schema.SchemaField`, \ ): The SchemaField to use for type conversion and field name. row_value (Union[ \ Sequence[l...
[ "Convert", "a", "field", "into", "JSON", "-", "serializable", "values", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L409-L439
[ "def", "_field_to_json", "(", "field", ",", "row_value", ")", ":", "if", "row_value", "is", "None", ":", "return", "None", "if", "field", ".", "mode", "==", "\"REPEATED\"", ":", "return", "_repeated_field_to_json", "(", "field", ",", "row_value", ")", "if", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_snake_to_camel_case
Convert snake case string to camel case.
bigquery/google/cloud/bigquery/_helpers.py
def _snake_to_camel_case(value): """Convert snake case string to camel case.""" words = value.split("_") return words[0] + "".join(map(str.capitalize, words[1:]))
def _snake_to_camel_case(value): """Convert snake case string to camel case.""" words = value.split("_") return words[0] + "".join(map(str.capitalize, words[1:]))
[ "Convert", "snake", "case", "string", "to", "camel", "case", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L442-L445
[ "def", "_snake_to_camel_case", "(", "value", ")", ":", "words", "=", "value", ".", "split", "(", "\"_\"", ")", "return", "words", "[", "0", "]", "+", "\"\"", ".", "join", "(", "map", "(", "str", ".", "capitalize", ",", "words", "[", "1", ":", "]", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_get_sub_prop
Get a nested value from a dictionary. This method works like ``dict.get(key)``, but for nested values. Arguments: container (dict): A dictionary which may contain other dictionaries as values. keys (iterable): A sequence of keys to attempt to get the value for. Each ite...
bigquery/google/cloud/bigquery/_helpers.py
def _get_sub_prop(container, keys, default=None): """Get a nested value from a dictionary. This method works like ``dict.get(key)``, but for nested values. Arguments: container (dict): A dictionary which may contain other dictionaries as values. keys (iterable): A s...
def _get_sub_prop(container, keys, default=None): """Get a nested value from a dictionary. This method works like ``dict.get(key)``, but for nested values. Arguments: container (dict): A dictionary which may contain other dictionaries as values. keys (iterable): A s...
[ "Get", "a", "nested", "value", "from", "a", "dictionary", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L448-L490
[ "def", "_get_sub_prop", "(", "container", ",", "keys", ",", "default", "=", "None", ")", ":", "sub_val", "=", "container", "for", "key", "in", "keys", ":", "if", "key", "not", "in", "sub_val", ":", "return", "default", "sub_val", "=", "sub_val", "[", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_set_sub_prop
Set a nested value in a dictionary. Arguments: container (dict): A dictionary which may contain other dictionaries as values. keys (iterable): A sequence of keys to attempt to set the value for. Each item in the sequence represents a deeper nesting. The first key...
bigquery/google/cloud/bigquery/_helpers.py
def _set_sub_prop(container, keys, value): """Set a nested value in a dictionary. Arguments: container (dict): A dictionary which may contain other dictionaries as values. keys (iterable): A sequence of keys to attempt to set the value for. Each item in the s...
def _set_sub_prop(container, keys, value): """Set a nested value in a dictionary. Arguments: container (dict): A dictionary which may contain other dictionaries as values. keys (iterable): A sequence of keys to attempt to set the value for. Each item in the s...
[ "Set", "a", "nested", "value", "in", "a", "dictionary", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L493-L533
[ "def", "_set_sub_prop", "(", "container", ",", "keys", ",", "value", ")", ":", "sub_val", "=", "container", "for", "key", "in", "keys", "[", ":", "-", "1", "]", ":", "if", "key", "not", "in", "sub_val", ":", "sub_val", "[", "key", "]", "=", "{", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_del_sub_prop
Remove a nested key fro a dictionary. Arguments: container (dict): A dictionary which may contain other dictionaries as values. keys (iterable): A sequence of keys to attempt to clear the value for. Each item in the sequence represents a deeper nesting. The first...
bigquery/google/cloud/bigquery/_helpers.py
def _del_sub_prop(container, keys): """Remove a nested key fro a dictionary. Arguments: container (dict): A dictionary which may contain other dictionaries as values. keys (iterable): A sequence of keys to attempt to clear the value for. Each item in the sequ...
def _del_sub_prop(container, keys): """Remove a nested key fro a dictionary. Arguments: container (dict): A dictionary which may contain other dictionaries as values. keys (iterable): A sequence of keys to attempt to clear the value for. Each item in the sequ...
[ "Remove", "a", "nested", "key", "fro", "a", "dictionary", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L536-L569
[ "def", "_del_sub_prop", "(", "container", ",", "keys", ")", ":", "sub_val", "=", "container", "for", "key", "in", "keys", "[", ":", "-", "1", "]", ":", "if", "key", "not", "in", "sub_val", ":", "sub_val", "[", "key", "]", "=", "{", "}", "sub_val", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_build_resource_from_properties
Build a resource based on a ``_properties`` dictionary, filtered by ``filter_fields``, which follow the name of the Python object.
bigquery/google/cloud/bigquery/_helpers.py
def _build_resource_from_properties(obj, filter_fields): """Build a resource based on a ``_properties`` dictionary, filtered by ``filter_fields``, which follow the name of the Python object. """ partial = {} for filter_field in filter_fields: api_field = obj._PROPERTY_TO_API_FIELD.get(filter...
def _build_resource_from_properties(obj, filter_fields): """Build a resource based on a ``_properties`` dictionary, filtered by ``filter_fields``, which follow the name of the Python object. """ partial = {} for filter_field in filter_fields: api_field = obj._PROPERTY_TO_API_FIELD.get(filter...
[ "Build", "a", "resource", "based", "on", "a", "_properties", "dictionary", "filtered", "by", "filter_fields", "which", "follow", "the", "name", "of", "the", "Python", "object", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/_helpers.py#L616-L632
[ "def", "_build_resource_from_properties", "(", "obj", ",", "filter_fields", ")", ":", "partial", "=", "{", "}", "for", "filter_field", "in", "filter_fields", ":", "api_field", "=", "obj", ".", "_PROPERTY_TO_API_FIELD", ".", "get", "(", "filter_field", ")", "if",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
get_model
Sample ID: go/samples-tracker/1510
bigquery/samples/get_model.py
def get_model(client, model_id): """Sample ID: go/samples-tracker/1510""" # [START bigquery_get_model] from google.cloud import bigquery # TODO(developer): Construct a BigQuery client object. # client = bigquery.Client() # TODO(developer): Set model_id to the ID of the model to fetch. # m...
def get_model(client, model_id): """Sample ID: go/samples-tracker/1510""" # [START bigquery_get_model] from google.cloud import bigquery # TODO(developer): Construct a BigQuery client object. # client = bigquery.Client() # TODO(developer): Set model_id to the ID of the model to fetch. # m...
[ "Sample", "ID", ":", "go", "/", "samples", "-", "tracker", "/", "1510" ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/samples/get_model.py#L16-L34
[ "def", "get_model", "(", "client", ",", "model_id", ")", ":", "# [START bigquery_get_model]", "from", "google", ".", "cloud", "import", "bigquery", "# TODO(developer): Construct a BigQuery client object.", "# client = bigquery.Client()", "# TODO(developer): Set model_id to the ID o...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_check_database_id
Make sure a "Reference" database ID is empty. :type database_id: unicode :param database_id: The ``database_id`` field from a "Reference" protobuf. :raises: :exc:`ValueError` if the ``database_id`` is not empty.
datastore/google/cloud/datastore/key.py
def _check_database_id(database_id): """Make sure a "Reference" database ID is empty. :type database_id: unicode :param database_id: The ``database_id`` field from a "Reference" protobuf. :raises: :exc:`ValueError` if the ``database_id`` is not empty. """ if database_id != u"": msg = _...
def _check_database_id(database_id): """Make sure a "Reference" database ID is empty. :type database_id: unicode :param database_id: The ``database_id`` field from a "Reference" protobuf. :raises: :exc:`ValueError` if the ``database_id`` is not empty. """ if database_id != u"": msg = _...
[ "Make", "sure", "a", "Reference", "database", "ID", "is", "empty", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L549-L559
[ "def", "_check_database_id", "(", "database_id", ")", ":", "if", "database_id", "!=", "u\"\"", ":", "msg", "=", "_DATABASE_ID_TEMPLATE", ".", "format", "(", "database_id", ")", "raise", "ValueError", "(", "msg", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_add_id_or_name
Add the ID or name from an element to a list. :type flat_path: list :param flat_path: List of accumulated path parts. :type element_pb: :class:`._app_engine_key_pb2.Path.Element` :param element_pb: The element containing ID or name. :type empty_allowed: bool :param empty_allowed: Indicates if...
datastore/google/cloud/datastore/key.py
def _add_id_or_name(flat_path, element_pb, empty_allowed): """Add the ID or name from an element to a list. :type flat_path: list :param flat_path: List of accumulated path parts. :type element_pb: :class:`._app_engine_key_pb2.Path.Element` :param element_pb: The element containing ID or name. ...
def _add_id_or_name(flat_path, element_pb, empty_allowed): """Add the ID or name from an element to a list. :type flat_path: list :param flat_path: List of accumulated path parts. :type element_pb: :class:`._app_engine_key_pb2.Path.Element` :param element_pb: The element containing ID or name. ...
[ "Add", "the", "ID", "or", "name", "from", "an", "element", "to", "a", "list", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L562-L593
[ "def", "_add_id_or_name", "(", "flat_path", ",", "element_pb", ",", "empty_allowed", ")", ":", "id_", "=", "element_pb", ".", "id", "name", "=", "element_pb", ".", "name", "# NOTE: Below 0 and the empty string are the \"null\" values for their", "# respective types, i...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_get_flat_path
Convert a legacy "Path" protobuf to a flat path. For example Element { type: "parent" id: 59 } Element { type: "child" name: "naem" } would convert to ``('parent', 59, 'child', 'naem')``. :type path_pb: :class:`._app_engine_key_pb2....
datastore/google/cloud/datastore/key.py
def _get_flat_path(path_pb): """Convert a legacy "Path" protobuf to a flat path. For example Element { type: "parent" id: 59 } Element { type: "child" name: "naem" } would convert to ``('parent', 59, 'child', 'naem')``. :type pa...
def _get_flat_path(path_pb): """Convert a legacy "Path" protobuf to a flat path. For example Element { type: "parent" id: 59 } Element { type: "child" name: "naem" } would convert to ``('parent', 59, 'child', 'naem')``. :type pa...
[ "Convert", "a", "legacy", "Path", "protobuf", "to", "a", "flat", "path", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L596-L626
[ "def", "_get_flat_path", "(", "path_pb", ")", ":", "num_elts", "=", "len", "(", "path_pb", ".", "element", ")", "last_index", "=", "num_elts", "-", "1", "result", "=", "[", "]", "for", "index", ",", "element", "in", "enumerate", "(", "path_pb", ".", "e...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_to_legacy_path
Convert a tuple of ints and strings in a legacy "Path". .. note: This assumes, but does not verify, that each entry in ``dict_path`` is valid (i.e. doesn't have more than one key out of "name" / "id"). :type dict_path: lsit :param dict_path: The "structured" path for a key, i.e. i...
datastore/google/cloud/datastore/key.py
def _to_legacy_path(dict_path): """Convert a tuple of ints and strings in a legacy "Path". .. note: This assumes, but does not verify, that each entry in ``dict_path`` is valid (i.e. doesn't have more than one key out of "name" / "id"). :type dict_path: lsit :param dict_path: ...
def _to_legacy_path(dict_path): """Convert a tuple of ints and strings in a legacy "Path". .. note: This assumes, but does not verify, that each entry in ``dict_path`` is valid (i.e. doesn't have more than one key out of "name" / "id"). :type dict_path: lsit :param dict_path: ...
[ "Convert", "a", "tuple", "of", "ints", "and", "strings", "in", "a", "legacy", "Path", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L629-L656
[ "def", "_to_legacy_path", "(", "dict_path", ")", ":", "elements", "=", "[", "]", "for", "part", "in", "dict_path", ":", "element_kwargs", "=", "{", "\"type\"", ":", "part", "[", "\"kind\"", "]", "}", "if", "\"id\"", "in", "part", ":", "element_kwargs", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Key._parse_path
Parses positional arguments into key path with kinds and IDs. :type path_args: tuple :param path_args: A tuple from positional arguments. Should be alternating list of kinds (string) and ID/name parts (int or string). :rtype: :class:`list` of...
datastore/google/cloud/datastore/key.py
def _parse_path(path_args): """Parses positional arguments into key path with kinds and IDs. :type path_args: tuple :param path_args: A tuple from positional arguments. Should be alternating list of kinds (string) and ID/name parts (int or str...
def _parse_path(path_args): """Parses positional arguments into key path with kinds and IDs. :type path_args: tuple :param path_args: A tuple from positional arguments. Should be alternating list of kinds (string) and ID/name parts (int or str...
[ "Parses", "positional", "arguments", "into", "key", "path", "with", "kinds", "and", "IDs", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L162-L203
[ "def", "_parse_path", "(", "path_args", ")", ":", "if", "len", "(", "path_args", ")", "==", "0", ":", "raise", "ValueError", "(", "\"Key path must not be empty.\"", ")", "kind_list", "=", "path_args", "[", ":", ":", "2", "]", "id_or_name_list", "=", "path_ar...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Key._combine_args
Sets protected data by combining raw data set from the constructor. If a ``_parent`` is set, updates the ``_flat_path`` and sets the ``_namespace`` and ``_project`` if not already set. :rtype: :class:`list` of :class:`dict` :returns: A list of key parts with kind and ID or name set. ...
datastore/google/cloud/datastore/key.py
def _combine_args(self): """Sets protected data by combining raw data set from the constructor. If a ``_parent`` is set, updates the ``_flat_path`` and sets the ``_namespace`` and ``_project`` if not already set. :rtype: :class:`list` of :class:`dict` :returns: A list of key pa...
def _combine_args(self): """Sets protected data by combining raw data set from the constructor. If a ``_parent`` is set, updates the ``_flat_path`` and sets the ``_namespace`` and ``_project`` if not already set. :rtype: :class:`list` of :class:`dict` :returns: A list of key pa...
[ "Sets", "protected", "data", "by", "combining", "raw", "data", "set", "from", "the", "constructor", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L205-L234
[ "def", "_combine_args", "(", "self", ")", ":", "child_path", "=", "self", ".", "_parse_path", "(", "self", ".", "_flat_path", ")", "if", "self", ".", "_parent", "is", "not", "None", ":", "if", "self", ".", "_parent", ".", "is_partial", ":", "raise", "V...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Key._clone
Duplicates the Key. Most attributes are simple types, so don't require copying. Other attributes like ``parent`` are long-lived and so we re-use them. :rtype: :class:`google.cloud.datastore.key.Key` :returns: A new ``Key`` instance with the same data as the current one.
datastore/google/cloud/datastore/key.py
def _clone(self): """Duplicates the Key. Most attributes are simple types, so don't require copying. Other attributes like ``parent`` are long-lived and so we re-use them. :rtype: :class:`google.cloud.datastore.key.Key` :returns: A new ``Key`` instance with the same data as the...
def _clone(self): """Duplicates the Key. Most attributes are simple types, so don't require copying. Other attributes like ``parent`` are long-lived and so we re-use them. :rtype: :class:`google.cloud.datastore.key.Key` :returns: A new ``Key`` instance with the same data as the...
[ "Duplicates", "the", "Key", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L236-L251
[ "def", "_clone", "(", "self", ")", ":", "cloned_self", "=", "self", ".", "__class__", "(", "*", "self", ".", "flat_path", ",", "project", "=", "self", ".", "project", ",", "namespace", "=", "self", ".", "namespace", ")", "# If the current parent has already ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Key.completed_key
Creates new key from existing partial key by adding final ID/name. :type id_or_name: str or integer :param id_or_name: ID or name to be added to the key. :rtype: :class:`google.cloud.datastore.key.Key` :returns: A new ``Key`` instance with the same data as the current one ...
datastore/google/cloud/datastore/key.py
def completed_key(self, id_or_name): """Creates new key from existing partial key by adding final ID/name. :type id_or_name: str or integer :param id_or_name: ID or name to be added to the key. :rtype: :class:`google.cloud.datastore.key.Key` :returns: A new ``Key`` instance wit...
def completed_key(self, id_or_name): """Creates new key from existing partial key by adding final ID/name. :type id_or_name: str or integer :param id_or_name: ID or name to be added to the key. :rtype: :class:`google.cloud.datastore.key.Key` :returns: A new ``Key`` instance wit...
[ "Creates", "new", "key", "from", "existing", "partial", "key", "by", "adding", "final", "ID", "/", "name", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L253-L278
[ "def", "completed_key", "(", "self", ",", "id_or_name", ")", ":", "if", "not", "self", ".", "is_partial", ":", "raise", "ValueError", "(", "\"Only a partial key can be completed.\"", ")", "if", "isinstance", "(", "id_or_name", ",", "six", ".", "string_types", ")...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Key.to_protobuf
Return a protobuf corresponding to the key. :rtype: :class:`.entity_pb2.Key` :returns: The protobuf representing the key.
datastore/google/cloud/datastore/key.py
def to_protobuf(self): """Return a protobuf corresponding to the key. :rtype: :class:`.entity_pb2.Key` :returns: The protobuf representing the key. """ key = _entity_pb2.Key() key.partition_id.project_id = self.project if self.namespace: key.partitio...
def to_protobuf(self): """Return a protobuf corresponding to the key. :rtype: :class:`.entity_pb2.Key` :returns: The protobuf representing the key. """ key = _entity_pb2.Key() key.partition_id.project_id = self.project if self.namespace: key.partitio...
[ "Return", "a", "protobuf", "corresponding", "to", "the", "key", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L280-L301
[ "def", "to_protobuf", "(", "self", ")", ":", "key", "=", "_entity_pb2", ".", "Key", "(", ")", "key", ".", "partition_id", ".", "project_id", "=", "self", ".", "project", "if", "self", ".", "namespace", ":", "key", ".", "partition_id", ".", "namespace_id"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Key.to_legacy_urlsafe
Convert to a base64 encode urlsafe string for App Engine. This is intended to work with the "legacy" representation of a datastore "Key" used within Google App Engine (a so-called "Reference"). The returned string can be used as the ``urlsafe`` argument to ``ndb.Key(urlsafe=...)``. The ...
datastore/google/cloud/datastore/key.py
def to_legacy_urlsafe(self, location_prefix=None): """Convert to a base64 encode urlsafe string for App Engine. This is intended to work with the "legacy" representation of a datastore "Key" used within Google App Engine (a so-called "Reference"). The returned string can be used as the ...
def to_legacy_urlsafe(self, location_prefix=None): """Convert to a base64 encode urlsafe string for App Engine. This is intended to work with the "legacy" representation of a datastore "Key" used within Google App Engine (a so-called "Reference"). The returned string can be used as the ...
[ "Convert", "to", "a", "base64", "encode", "urlsafe", "string", "for", "App", "Engine", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L303-L339
[ "def", "to_legacy_urlsafe", "(", "self", ",", "location_prefix", "=", "None", ")", ":", "if", "location_prefix", "is", "None", ":", "project_id", "=", "self", ".", "project", "else", ":", "project_id", "=", "location_prefix", "+", "self", ".", "project", "re...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Key.from_legacy_urlsafe
Convert urlsafe string to :class:`~google.cloud.datastore.key.Key`. This is intended to work with the "legacy" representation of a datastore "Key" used within Google App Engine (a so-called "Reference"). This assumes that ``urlsafe`` was created within an App Engine app via something li...
datastore/google/cloud/datastore/key.py
def from_legacy_urlsafe(cls, urlsafe): """Convert urlsafe string to :class:`~google.cloud.datastore.key.Key`. This is intended to work with the "legacy" representation of a datastore "Key" used within Google App Engine (a so-called "Reference"). This assumes that ``urlsafe`` was created...
def from_legacy_urlsafe(cls, urlsafe): """Convert urlsafe string to :class:`~google.cloud.datastore.key.Key`. This is intended to work with the "legacy" representation of a datastore "Key" used within Google App Engine (a so-called "Reference"). This assumes that ``urlsafe`` was created...
[ "Convert", "urlsafe", "string", "to", ":", "class", ":", "~google", ".", "cloud", ".", "datastore", ".", "key", ".", "Key", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L342-L369
[ "def", "from_legacy_urlsafe", "(", "cls", ",", "urlsafe", ")", ":", "urlsafe", "=", "_to_bytes", "(", "urlsafe", ",", "encoding", "=", "\"ascii\"", ")", "padding", "=", "b\"=\"", "*", "(", "-", "len", "(", "urlsafe", ")", "%", "4", ")", "urlsafe", "+="...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Key._make_parent
Creates a parent key for the current path. Extracts all but the last element in the key path and creates a new key, while still matching the namespace and the project. :rtype: :class:`google.cloud.datastore.key.Key` or :class:`NoneType` :returns: A new ``Key`` instance, whose path cons...
datastore/google/cloud/datastore/key.py
def _make_parent(self): """Creates a parent key for the current path. Extracts all but the last element in the key path and creates a new key, while still matching the namespace and the project. :rtype: :class:`google.cloud.datastore.key.Key` or :class:`NoneType` :returns: A ne...
def _make_parent(self): """Creates a parent key for the current path. Extracts all but the last element in the key path and creates a new key, while still matching the namespace and the project. :rtype: :class:`google.cloud.datastore.key.Key` or :class:`NoneType` :returns: A ne...
[ "Creates", "a", "parent", "key", "for", "the", "current", "path", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L456-L474
[ "def", "_make_parent", "(", "self", ")", ":", "if", "self", ".", "is_partial", ":", "parent_args", "=", "self", ".", "flat_path", "[", ":", "-", "1", "]", "else", ":", "parent_args", "=", "self", ".", "flat_path", "[", ":", "-", "2", "]", "if", "pa...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Key.parent
The parent of the current key. :rtype: :class:`google.cloud.datastore.key.Key` or :class:`NoneType` :returns: A new ``Key`` instance, whose path consists of all but the last element of current path. If the current key has only one path element, returns ``None``.
datastore/google/cloud/datastore/key.py
def parent(self): """The parent of the current key. :rtype: :class:`google.cloud.datastore.key.Key` or :class:`NoneType` :returns: A new ``Key`` instance, whose path consists of all but the last element of current path. If the current key has only one path el...
def parent(self): """The parent of the current key. :rtype: :class:`google.cloud.datastore.key.Key` or :class:`NoneType` :returns: A new ``Key`` instance, whose path consists of all but the last element of current path. If the current key has only one path el...
[ "The", "parent", "of", "the", "current", "key", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/key.py#L477-L488
[ "def", "parent", "(", "self", ")", ":", "if", "self", ".", "_parent", "is", "None", ":", "self", ".", "_parent", "=", "self", ".", "_make_parent", "(", ")", "return", "self", ".", "_parent" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ResourceRecordSet.from_api_repr
Factory: construct a record set given its API representation :type resource: dict :param resource: record sets representation returned from the API :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds one or more record sets. :rtype: :class:`...
dns/google/cloud/dns/resource_record_set.py
def from_api_repr(cls, resource, zone): """Factory: construct a record set given its API representation :type resource: dict :param resource: record sets representation returned from the API :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds...
def from_api_repr(cls, resource, zone): """Factory: construct a record set given its API representation :type resource: dict :param resource: record sets representation returned from the API :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds...
[ "Factory", ":", "construct", "a", "record", "set", "given", "its", "API", "representation" ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/resource_record_set.py#L50-L66
[ "def", "from_api_repr", "(", "cls", ",", "resource", ",", "zone", ")", ":", "name", "=", "resource", "[", "\"name\"", "]", "record_type", "=", "resource", "[", "\"type\"", "]", "ttl", "=", "int", "(", "resource", "[", "\"ttl\"", "]", ")", "rrdatas", "=...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_Worker._thread_main
The entry point for the worker thread. Pulls pending log entries off the queue and writes them in batches to the Cloud Logger.
logging/google/cloud/logging/handlers/transports/background_thread.py
def _thread_main(self): """The entry point for the worker thread. Pulls pending log entries off the queue and writes them in batches to the Cloud Logger. """ _LOGGER.debug("Background thread started.") quit_ = False while True: batch = self._cloud_lo...
def _thread_main(self): """The entry point for the worker thread. Pulls pending log entries off the queue and writes them in batches to the Cloud Logger. """ _LOGGER.debug("Background thread started.") quit_ = False while True: batch = self._cloud_lo...
[ "The", "entry", "point", "for", "the", "worker", "thread", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/transports/background_thread.py#L127-L160
[ "def", "_thread_main", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Background thread started.\"", ")", "quit_", "=", "False", "while", "True", ":", "batch", "=", "self", ".", "_cloud_logger", ".", "batch", "(", ")", "items", "=", "_get_many", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_Worker.start
Starts the background thread. Additionally, this registers a handler for process exit to attempt to send any pending log entries before shutdown.
logging/google/cloud/logging/handlers/transports/background_thread.py
def start(self): """Starts the background thread. Additionally, this registers a handler for process exit to attempt to send any pending log entries before shutdown. """ with self._operational_lock: if self.is_alive: return self._thread =...
def start(self): """Starts the background thread. Additionally, this registers a handler for process exit to attempt to send any pending log entries before shutdown. """ with self._operational_lock: if self.is_alive: return self._thread =...
[ "Starts", "the", "background", "thread", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/transports/background_thread.py#L162-L177
[ "def", "start", "(", "self", ")", ":", "with", "self", ".", "_operational_lock", ":", "if", "self", ".", "is_alive", ":", "return", "self", ".", "_thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_thread_main", ",", "name", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_Worker.stop
Signals the background thread to stop. This does not terminate the background thread. It simply queues the stop signal. If the main process exits before the background thread processes the stop signal, it will be terminated without finishing work. The ``grace_period`` parameter will giv...
logging/google/cloud/logging/handlers/transports/background_thread.py
def stop(self, grace_period=None): """Signals the background thread to stop. This does not terminate the background thread. It simply queues the stop signal. If the main process exits before the background thread processes the stop signal, it will be terminated without finishing ...
def stop(self, grace_period=None): """Signals the background thread to stop. This does not terminate the background thread. It simply queues the stop signal. If the main process exits before the background thread processes the stop signal, it will be terminated without finishing ...
[ "Signals", "the", "background", "thread", "to", "stop", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/transports/background_thread.py#L179-L215
[ "def", "stop", "(", "self", ",", "grace_period", "=", "None", ")", ":", "if", "not", "self", ".", "is_alive", ":", "return", "True", "with", "self", ".", "_operational_lock", ":", "self", ".", "_queue", ".", "put_nowait", "(", "_WORKER_TERMINATOR", ")", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_Worker._main_thread_terminated
Callback that attempts to send pending logs before termination.
logging/google/cloud/logging/handlers/transports/background_thread.py
def _main_thread_terminated(self): """Callback that attempts to send pending logs before termination.""" if not self.is_alive: return if not self._queue.empty(): print( "Program shutting down, attempting to send %d queued log " "entries to...
def _main_thread_terminated(self): """Callback that attempts to send pending logs before termination.""" if not self.is_alive: return if not self._queue.empty(): print( "Program shutting down, attempting to send %d queued log " "entries to...
[ "Callback", "that", "attempts", "to", "send", "pending", "logs", "before", "termination", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/transports/background_thread.py#L217-L235
[ "def", "_main_thread_terminated", "(", "self", ")", ":", "if", "not", "self", ".", "is_alive", ":", "return", "if", "not", "self", ".", "_queue", ".", "empty", "(", ")", ":", "print", "(", "\"Program shutting down, attempting to send %d queued log \"", "\"entries ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_Worker.enqueue
Queues a log entry to be written by the background thread. :type record: :class:`logging.LogRecord` :param record: Python log record that the handler was called with. :type message: str :param message: The message from the ``LogRecord`` after being formatted by ...
logging/google/cloud/logging/handlers/transports/background_thread.py
def enqueue( self, record, message, resource=None, labels=None, trace=None, span_id=None ): """Queues a log entry to be written by the background thread. :type record: :class:`logging.LogRecord` :param record: Python log record that the handler was called with. :type messag...
def enqueue( self, record, message, resource=None, labels=None, trace=None, span_id=None ): """Queues a log entry to be written by the background thread. :type record: :class:`logging.LogRecord` :param record: Python log record that the handler was called with. :type messag...
[ "Queues", "a", "log", "entry", "to", "be", "written", "by", "the", "background", "thread", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/transports/background_thread.py#L237-L271
[ "def", "enqueue", "(", "self", ",", "record", ",", "message", ",", "resource", "=", "None", ",", "labels", "=", "None", ",", "trace", "=", "None", ",", "span_id", "=", "None", ")", ":", "self", ".", "_queue", ".", "put_nowait", "(", "{", "\"info\"", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
BackgroundThreadTransport.send
Overrides Transport.send(). :type record: :class:`logging.LogRecord` :param record: Python log record that the handler was called with. :type message: str :param message: The message from the ``LogRecord`` after being formatted by the associated log formatters. ...
logging/google/cloud/logging/handlers/transports/background_thread.py
def send( self, record, message, resource=None, labels=None, trace=None, span_id=None ): """Overrides Transport.send(). :type record: :class:`logging.LogRecord` :param record: Python log record that the handler was called with. :type message: str :param message: The...
def send( self, record, message, resource=None, labels=None, trace=None, span_id=None ): """Overrides Transport.send(). :type record: :class:`logging.LogRecord` :param record: Python log record that the handler was called with. :type message: str :param message: The...
[ "Overrides", "Transport", ".", "send", "()", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/transports/background_thread.py#L321-L353
[ "def", "send", "(", "self", ",", "record", ",", "message", ",", "resource", "=", "None", ",", "labels", "=", "None", ",", "trace", "=", "None", ",", "span_id", "=", "None", ")", ":", "self", ".", "worker", ".", "enqueue", "(", "record", ",", "messa...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_tokenize_field_path
Lex a field path into tokens (including dots). Args: path (str): field path to be lexed. Returns: List(str): tokens
firestore/google/cloud/firestore_v1beta1/field_path.py
def _tokenize_field_path(path): """Lex a field path into tokens (including dots). Args: path (str): field path to be lexed. Returns: List(str): tokens """ pos = 0 get_token = TOKENS_REGEX.match match = get_token(path) while match is not None: type_ = match.lastgr...
def _tokenize_field_path(path): """Lex a field path into tokens (including dots). Args: path (str): field path to be lexed. Returns: List(str): tokens """ pos = 0 get_token = TOKENS_REGEX.match match = get_token(path) while match is not None: type_ = match.lastgr...
[ "Lex", "a", "field", "path", "into", "tokens", "(", "including", "dots", ")", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/field_path.py#L50-L68
[ "def", "_tokenize_field_path", "(", "path", ")", ":", "pos", "=", "0", "get_token", "=", "TOKENS_REGEX", ".", "match", "match", "=", "get_token", "(", "path", ")", "while", "match", "is", "not", "None", ":", "type_", "=", "match", ".", "lastgroup", "valu...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
split_field_path
Split a field path into valid elements (without dots). Args: path (str): field path to be lexed. Returns: List(str): tokens Raises: ValueError: if the path does not match the elements-interspersed- with-dots pattern.
firestore/google/cloud/firestore_v1beta1/field_path.py
def split_field_path(path): """Split a field path into valid elements (without dots). Args: path (str): field path to be lexed. Returns: List(str): tokens Raises: ValueError: if the path does not match the elements-interspersed- with-dots pattern. """ ...
def split_field_path(path): """Split a field path into valid elements (without dots). Args: path (str): field path to be lexed. Returns: List(str): tokens Raises: ValueError: if the path does not match the elements-interspersed- with-dots pattern. """ ...
[ "Split", "a", "field", "path", "into", "valid", "elements", "(", "without", "dots", ")", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/field_path.py#L71-L103
[ "def", "split_field_path", "(", "path", ")", ":", "if", "not", "path", ":", "return", "[", "]", "elements", "=", "[", "]", "want_dot", "=", "False", "for", "element", "in", "_tokenize_field_path", "(", "path", ")", ":", "if", "want_dot", ":", "if", "el...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
parse_field_path
Parse a **field path** from into a list of nested field names. See :func:`field_path` for more on **field paths**. Args: api_repr (str): The unique Firestore api representation which consists of either simple or UTF-8 field names. It cannot exceed 1500 bytes, and ca...
firestore/google/cloud/firestore_v1beta1/field_path.py
def parse_field_path(api_repr): """Parse a **field path** from into a list of nested field names. See :func:`field_path` for more on **field paths**. Args: api_repr (str): The unique Firestore api representation which consists of either simple or UTF-8 field names. It canno...
def parse_field_path(api_repr): """Parse a **field path** from into a list of nested field names. See :func:`field_path` for more on **field paths**. Args: api_repr (str): The unique Firestore api representation which consists of either simple or UTF-8 field names. It canno...
[ "Parse", "a", "**", "field", "path", "**", "from", "into", "a", "list", "of", "nested", "field", "names", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/field_path.py#L106-L132
[ "def", "parse_field_path", "(", "api_repr", ")", ":", "# code dredged back up from", "# https://github.com/googleapis/google-cloud-python/pull/5109/files", "field_names", "=", "[", "]", "for", "field_name", "in", "split_field_path", "(", "api_repr", ")", ":", "# non-simple fi...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
render_field_path
Create a **field path** from a list of nested field names. A **field path** is a ``.``-delimited concatenation of the field names. It is used to represent a nested field. For example, in the data .. code-block: python data = { 'aa': { 'bb': { 'cc': 10,...
firestore/google/cloud/firestore_v1beta1/field_path.py
def render_field_path(field_names): """Create a **field path** from a list of nested field names. A **field path** is a ``.``-delimited concatenation of the field names. It is used to represent a nested field. For example, in the data .. code-block: python data = { 'aa': { ...
def render_field_path(field_names): """Create a **field path** from a list of nested field names. A **field path** is a ``.``-delimited concatenation of the field names. It is used to represent a nested field. For example, in the data .. code-block: python data = { 'aa': { ...
[ "Create", "a", "**", "field", "path", "**", "from", "a", "list", "of", "nested", "field", "names", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/field_path.py#L135-L173
[ "def", "render_field_path", "(", "field_names", ")", ":", "result", "=", "[", "]", "for", "field_name", "in", "field_names", ":", "match", "=", "_SIMPLE_FIELD_NAME", ".", "match", "(", "field_name", ")", "if", "match", "and", "match", ".", "group", "(", "0...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
get_nested_value
Get a (potentially nested) value from a dictionary. If the data is nested, for example: .. code-block:: python >>> data { 'top1': { 'middle2': { 'bottom3': 20, 'bottom4': 22, }, 'middle5': True, ...
firestore/google/cloud/firestore_v1beta1/field_path.py
def get_nested_value(field_path, data): """Get a (potentially nested) value from a dictionary. If the data is nested, for example: .. code-block:: python >>> data { 'top1': { 'middle2': { 'bottom3': 20, 'bottom4': 22, ...
def get_nested_value(field_path, data): """Get a (potentially nested) value from a dictionary. If the data is nested, for example: .. code-block:: python >>> data { 'top1': { 'middle2': { 'bottom3': 20, 'bottom4': 22, ...
[ "Get", "a", "(", "potentially", "nested", ")", "value", "from", "a", "dictionary", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/field_path.py#L179-L253
[ "def", "get_nested_value", "(", "field_path", ",", "data", ")", ":", "field_names", "=", "parse_field_path", "(", "field_path", ")", "nested_data", "=", "data", "for", "index", ",", "field_name", "in", "enumerate", "(", "field_names", ")", ":", "if", "isinstan...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
FieldPath.from_api_repr
Factory: create a FieldPath from the string formatted per the API. Args: api_repr (str): a string path, with non-identifier elements quoted It cannot exceed 1500 characters, and cannot be empty. Returns: (:class:`FieldPath`) An instance parsed from ``api_repr``. ...
firestore/google/cloud/firestore_v1beta1/field_path.py
def from_api_repr(cls, api_repr): """Factory: create a FieldPath from the string formatted per the API. Args: api_repr (str): a string path, with non-identifier elements quoted It cannot exceed 1500 characters, and cannot be empty. Returns: (:class:`FieldPath...
def from_api_repr(cls, api_repr): """Factory: create a FieldPath from the string formatted per the API. Args: api_repr (str): a string path, with non-identifier elements quoted It cannot exceed 1500 characters, and cannot be empty. Returns: (:class:`FieldPath...
[ "Factory", ":", "create", "a", "FieldPath", "from", "the", "string", "formatted", "per", "the", "API", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/field_path.py#L280-L294
[ "def", "from_api_repr", "(", "cls", ",", "api_repr", ")", ":", "api_repr", "=", "api_repr", ".", "strip", "(", ")", "if", "not", "api_repr", ":", "raise", "ValueError", "(", "\"Field path API representation cannot be empty.\"", ")", "return", "cls", "(", "*", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
FieldPath.from_string
Factory: create a FieldPath from a unicode string representation. This method splits on the character `.` and disallows the characters `~*/[]`. To create a FieldPath whose components have those characters, call the constructor. Args: path_string (str): A unicode string whic...
firestore/google/cloud/firestore_v1beta1/field_path.py
def from_string(cls, path_string): """Factory: create a FieldPath from a unicode string representation. This method splits on the character `.` and disallows the characters `~*/[]`. To create a FieldPath whose components have those characters, call the constructor. Args: ...
def from_string(cls, path_string): """Factory: create a FieldPath from a unicode string representation. This method splits on the character `.` and disallows the characters `~*/[]`. To create a FieldPath whose components have those characters, call the constructor. Args: ...
[ "Factory", ":", "create", "a", "FieldPath", "from", "a", "unicode", "string", "representation", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/field_path.py#L297-L324
[ "def", "from_string", "(", "cls", ",", "path_string", ")", ":", "try", ":", "return", "cls", ".", "from_api_repr", "(", "path_string", ")", "except", "ValueError", ":", "elements", "=", "path_string", ".", "split", "(", "\".\"", ")", "for", "element", "in"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
FieldPath.eq_or_parent
Check whether ``other`` is an ancestor. Returns: (bool) True IFF ``other`` is an ancestor or equal to ``self``, else False.
firestore/google/cloud/firestore_v1beta1/field_path.py
def eq_or_parent(self, other): """Check whether ``other`` is an ancestor. Returns: (bool) True IFF ``other`` is an ancestor or equal to ``self``, else False. """ return self.parts[: len(other.parts)] == other.parts[: len(self.parts)]
def eq_or_parent(self, other): """Check whether ``other`` is an ancestor. Returns: (bool) True IFF ``other`` is an ancestor or equal to ``self``, else False. """ return self.parts[: len(other.parts)] == other.parts[: len(self.parts)]
[ "Check", "whether", "other", "is", "an", "ancestor", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/field_path.py#L371-L378
[ "def", "eq_or_parent", "(", "self", ",", "other", ")", ":", "return", "self", ".", "parts", "[", ":", "len", "(", "other", ".", "parts", ")", "]", "==", "other", ".", "parts", "[", ":", "len", "(", "self", ".", "parts", ")", "]" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
FieldPath.lineage
Return field paths for all parents. Returns: Set[:class:`FieldPath`]
firestore/google/cloud/firestore_v1beta1/field_path.py
def lineage(self): """Return field paths for all parents. Returns: Set[:class:`FieldPath`] """ indexes = six.moves.range(1, len(self.parts)) return {FieldPath(*self.parts[:index]) for index in indexes}
def lineage(self): """Return field paths for all parents. Returns: Set[:class:`FieldPath`] """ indexes = six.moves.range(1, len(self.parts)) return {FieldPath(*self.parts[:index]) for index in indexes}
[ "Return", "field", "paths", "for", "all", "parents", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/field_path.py#L380-L386
[ "def", "lineage", "(", "self", ")", ":", "indexes", "=", "six", ".", "moves", ".", "range", "(", "1", ",", "len", "(", "self", ".", "parts", ")", ")", "return", "{", "FieldPath", "(", "*", "self", ".", "parts", "[", ":", "index", "]", ")", "for...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
OperationsClient.get_operation
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. Example: >>> from google.api_core import operations_v1 >>> api = operations_v1.OperationsClient() >>> ...
api_core/google/api_core/operations_v1/operations_client.py
def get_operation( self, name, retry=gapic_v1.method.DEFAULT, timeout=gapic_v1.method.DEFAULT ): """Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. Example: ...
def get_operation( self, name, retry=gapic_v1.method.DEFAULT, timeout=gapic_v1.method.DEFAULT ): """Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. Example: ...
[ "Gets", "the", "latest", "state", "of", "a", "long", "-", "running", "operation", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operations_v1/operations_client.py#L93-L131
[ "def", "get_operation", "(", "self", ",", "name", ",", "retry", "=", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "gapic_v1", ".", "method", ".", "DEFAULT", ")", ":", "request", "=", "operations_pb2", ".", "GetOperationRequest", "(", "na...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
OperationsClient.list_operations
Lists operations that match the specified filter in the request. Example: >>> from google.api_core import operations_v1 >>> api = operations_v1.OperationsClient() >>> name = '' >>> >>> # Iterate over all results >>> for operation in api.li...
api_core/google/api_core/operations_v1/operations_client.py
def list_operations( self, name, filter_, retry=gapic_v1.method.DEFAULT, timeout=gapic_v1.method.DEFAULT, ): """ Lists operations that match the specified filter in the request. Example: >>> from google.api_core import operations_v1 ...
def list_operations( self, name, filter_, retry=gapic_v1.method.DEFAULT, timeout=gapic_v1.method.DEFAULT, ): """ Lists operations that match the specified filter in the request. Example: >>> from google.api_core import operations_v1 ...
[ "Lists", "operations", "that", "match", "the", "specified", "filter", "in", "the", "request", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operations_v1/operations_client.py#L133-L202
[ "def", "list_operations", "(", "self", ",", "name", ",", "filter_", ",", "retry", "=", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "gapic_v1", ".", "method", ".", "DEFAULT", ",", ")", ":", "# Create the request object.", "request", "=", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
OperationsClient.cancel_operation
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. Clients can use :meth:`get_operation` or service- specific methods to check whether the cancellation succeeded or whether the operation co...
api_core/google/api_core/operations_v1/operations_client.py
def cancel_operation( self, name, retry=gapic_v1.method.DEFAULT, timeout=gapic_v1.method.DEFAULT ): """Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. Clients can use :meth:`get_oper...
def cancel_operation( self, name, retry=gapic_v1.method.DEFAULT, timeout=gapic_v1.method.DEFAULT ): """Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. Clients can use :meth:`get_oper...
[ "Starts", "asynchronous", "cancellation", "on", "a", "long", "-", "running", "operation", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operations_v1/operations_client.py#L204-L248
[ "def", "cancel_operation", "(", "self", ",", "name", ",", "retry", "=", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "gapic_v1", ".", "method", ".", "DEFAULT", ")", ":", "# Create the request object.", "request", "=", "operations_pb2", ".", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
OperationsClient.delete_operation
Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. Example: >>> from google.api_core import operations_v1 >>> api = operations_v1.OperationsClient() >>> n...
api_core/google/api_core/operations_v1/operations_client.py
def delete_operation( self, name, retry=gapic_v1.method.DEFAULT, timeout=gapic_v1.method.DEFAULT ): """Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. Example: ...
def delete_operation( self, name, retry=gapic_v1.method.DEFAULT, timeout=gapic_v1.method.DEFAULT ): """Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. Example: ...
[ "Deletes", "a", "long", "-", "running", "operation", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operations_v1/operations_client.py#L250-L288
[ "def", "delete_operation", "(", "self", ",", "name", ",", "retry", "=", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "gapic_v1", ".", "method", ".", "DEFAULT", ")", ":", "# Create the request object.", "request", "=", "operations_pb2", ".", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
config_name_from_full_name
Extract the config name from a full resource name. >>> config_name_from_full_name('projects/my-proj/configs/my-config') "my-config" :type full_name: str :param full_name: The full resource name of a config. The full resource name looks like ``projects/project-name/configs/config-na...
runtimeconfig/google/cloud/runtimeconfig/_helpers.py
def config_name_from_full_name(full_name): """Extract the config name from a full resource name. >>> config_name_from_full_name('projects/my-proj/configs/my-config') "my-config" :type full_name: str :param full_name: The full resource name of a config. The full resource name looks like...
def config_name_from_full_name(full_name): """Extract the config name from a full resource name. >>> config_name_from_full_name('projects/my-proj/configs/my-config') "my-config" :type full_name: str :param full_name: The full resource name of a config. The full resource name looks like...
[ "Extract", "the", "config", "name", "from", "a", "full", "resource", "name", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/runtimeconfig/google/cloud/runtimeconfig/_helpers.py#L18-L42
[ "def", "config_name_from_full_name", "(", "full_name", ")", ":", "projects", ",", "_", ",", "configs", ",", "result", "=", "full_name", ".", "split", "(", "\"/\"", ")", "if", "projects", "!=", "\"projects\"", "or", "configs", "!=", "\"configs\"", ":", "raise...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
variable_name_from_full_name
Extract the variable name from a full resource name. >>> variable_name_from_full_name( 'projects/my-proj/configs/my-config/variables/var-name') "var-name" >>> variable_name_from_full_name( 'projects/my-proj/configs/my-config/variables/another/var/name') "another/var/...
runtimeconfig/google/cloud/runtimeconfig/_helpers.py
def variable_name_from_full_name(full_name): """Extract the variable name from a full resource name. >>> variable_name_from_full_name( 'projects/my-proj/configs/my-config/variables/var-name') "var-name" >>> variable_name_from_full_name( 'projects/my-proj/configs/my-con...
def variable_name_from_full_name(full_name): """Extract the variable name from a full resource name. >>> variable_name_from_full_name( 'projects/my-proj/configs/my-config/variables/var-name') "var-name" >>> variable_name_from_full_name( 'projects/my-proj/configs/my-con...
[ "Extract", "the", "variable", "name", "from", "a", "full", "resource", "name", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/runtimeconfig/google/cloud/runtimeconfig/_helpers.py#L45-L73
[ "def", "variable_name_from_full_name", "(", "full_name", ")", ":", "projects", ",", "_", ",", "configs", ",", "_", ",", "variables", ",", "result", "=", "full_name", ".", "split", "(", "\"/\"", ",", "5", ")", "if", "projects", "!=", "\"projects\"", "or", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Histogram.max
Return the maximum value in this histogram. If there are no values in the histogram at all, return 600. Returns: int: The maximum value in the histogram.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py
def max(self): """Return the maximum value in this histogram. If there are no values in the histogram at all, return 600. Returns: int: The maximum value in the histogram. """ if len(self._data) == 0: return 600 return next(iter(reversed(sorted(s...
def max(self): """Return the maximum value in this histogram. If there are no values in the histogram at all, return 600. Returns: int: The maximum value in the histogram. """ if len(self._data) == 0: return 600 return next(iter(reversed(sorted(s...
[ "Return", "the", "maximum", "value", "in", "this", "histogram", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py#L83-L93
[ "def", "max", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_data", ")", "==", "0", ":", "return", "600", "return", "next", "(", "iter", "(", "reversed", "(", "sorted", "(", "self", ".", "_data", ".", "keys", "(", ")", ")", ")", ")", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Histogram.min
Return the minimum value in this histogram. If there are no values in the histogram at all, return 10. Returns: int: The minimum value in the histogram.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py
def min(self): """Return the minimum value in this histogram. If there are no values in the histogram at all, return 10. Returns: int: The minimum value in the histogram. """ if len(self._data) == 0: return 10 return next(iter(sorted(self._data.k...
def min(self): """Return the minimum value in this histogram. If there are no values in the histogram at all, return 10. Returns: int: The minimum value in the histogram. """ if len(self._data) == 0: return 10 return next(iter(sorted(self._data.k...
[ "Return", "the", "minimum", "value", "in", "this", "histogram", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py#L96-L106
[ "def", "min", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_data", ")", "==", "0", ":", "return", "10", "return", "next", "(", "iter", "(", "sorted", "(", "self", ".", "_data", ".", "keys", "(", ")", ")", ")", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Histogram.add
Add the value to this histogram. Args: value (int): The value. Values outside of ``10 <= x <= 600`` will be raised to ``10`` or reduced to ``600``.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py
def add(self, value): """Add the value to this histogram. Args: value (int): The value. Values outside of ``10 <= x <= 600`` will be raised to ``10`` or reduced to ``600``. """ # If the value is out of bounds, bring it in bounds. value = int(value) ...
def add(self, value): """Add the value to this histogram. Args: value (int): The value. Values outside of ``10 <= x <= 600`` will be raised to ``10`` or reduced to ``600``. """ # If the value is out of bounds, bring it in bounds. value = int(value) ...
[ "Add", "the", "value", "to", "this", "histogram", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py#L108-L125
[ "def", "add", "(", "self", ",", "value", ")", ":", "# If the value is out of bounds, bring it in bounds.", "value", "=", "int", "(", "value", ")", "if", "value", "<", "10", ":", "value", "=", "10", "if", "value", ">", "600", ":", "value", "=", "600", "# ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Histogram.percentile
Return the value that is the Nth precentile in the histogram. Args: percent (Union[int, float]): The precentile being sought. The default consumer implementations use consistently use ``99``. Returns: int: The value corresponding to the requested percentile.
pubsub/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py
def percentile(self, percent): """Return the value that is the Nth precentile in the histogram. Args: percent (Union[int, float]): The precentile being sought. The default consumer implementations use consistently use ``99``. Returns: int: The value corr...
def percentile(self, percent): """Return the value that is the Nth precentile in the histogram. Args: percent (Union[int, float]): The precentile being sought. The default consumer implementations use consistently use ``99``. Returns: int: The value corr...
[ "Return", "the", "value", "that", "is", "the", "Nth", "precentile", "in", "the", "histogram", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py#L127-L154
[ "def", "percentile", "(", "self", ",", "percent", ")", ":", "# Sanity check: Any value over 100 should become 100.", "if", "percent", ">=", "100", ":", "percent", "=", "100", "# Determine the actual target number.", "target", "=", "len", "(", "self", ")", "-", "len"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CloudSchedulerClient.job_path
Return a fully-qualified job string.
scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client.py
def job_path(cls, project, location, job): """Return a fully-qualified job string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/jobs/{job}", project=project, location=location, job=job, )
def job_path(cls, project, location, job): """Return a fully-qualified job string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/jobs/{job}", project=project, location=location, job=job, )
[ "Return", "a", "fully", "-", "qualified", "job", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client.py#L98-L105
[ "def", "job_path", "(", "cls", ",", "project", ",", "location", ",", "job", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/locations/{location}/jobs/{job}\"", ",", "project", "=", "project", ",", "l...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CloudSchedulerClient.create_job
Creates a job. Example: >>> from google.cloud import scheduler_v1beta1 >>> >>> client = scheduler_v1beta1.CloudSchedulerClient() >>> >>> parent = client.location_path('[PROJECT]', '[LOCATION]') >>> >>> # TODO: Initialize `job`:...
scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client.py
def create_job( self, parent, job, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a job. Example: >>> from google.cloud import scheduler_v1beta1 ...
def create_job( self, parent, job, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a job. Example: >>> from google.cloud import scheduler_v1beta1 ...
[ "Creates", "a", "job", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client.py#L382-L465
[ "def", "create_job", "(", "self", ",", "parent", ",", "job", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Model.reference
A :class:`~google.cloud.bigquery.model.ModelReference` pointing to this model. Read-only. Returns: google.cloud.bigquery.model.ModelReference: pointer to this model.
bigquery/google/cloud/bigquery/model.py
def reference(self): """A :class:`~google.cloud.bigquery.model.ModelReference` pointing to this model. Read-only. Returns: google.cloud.bigquery.model.ModelReference: pointer to this model. """ ref = ModelReference() ref._proto = self._proto.model_re...
def reference(self): """A :class:`~google.cloud.bigquery.model.ModelReference` pointing to this model. Read-only. Returns: google.cloud.bigquery.model.ModelReference: pointer to this model. """ ref = ModelReference() ref._proto = self._proto.model_re...
[ "A", ":", "class", ":", "~google", ".", "cloud", ".", "bigquery", ".", "model", ".", "ModelReference", "pointing", "to", "this", "model", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/model.py#L74-L85
[ "def", "reference", "(", "self", ")", ":", "ref", "=", "ModelReference", "(", ")", "ref", ".", "_proto", "=", "self", ".", "_proto", ".", "model_reference", "return", "ref" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Model.created
Union[datetime.datetime, None]: Datetime at which the model was created (:data:`None` until set from the server). Read-only.
bigquery/google/cloud/bigquery/model.py
def created(self): """Union[datetime.datetime, None]: Datetime at which the model was created (:data:`None` until set from the server). Read-only. """ value = self._proto.creation_time if value is not None and value != 0: # value will be in milliseconds. ...
def created(self): """Union[datetime.datetime, None]: Datetime at which the model was created (:data:`None` until set from the server). Read-only. """ value = self._proto.creation_time if value is not None and value != 0: # value will be in milliseconds. ...
[ "Union", "[", "datetime", ".", "datetime", "None", "]", ":", "Datetime", "at", "which", "the", "model", "was", "created", "(", ":", "data", ":", "None", "until", "set", "from", "the", "server", ")", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/model.py#L126-L137
[ "def", "created", "(", "self", ")", ":", "value", "=", "self", ".", "_proto", ".", "creation_time", "if", "value", "is", "not", "None", "and", "value", "!=", "0", ":", "# value will be in milliseconds.", "return", "google", ".", "cloud", ".", "_helpers", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Model.modified
Union[datetime.datetime, None]: Datetime at which the model was last modified (:data:`None` until set from the server). Read-only.
bigquery/google/cloud/bigquery/model.py
def modified(self): """Union[datetime.datetime, None]: Datetime at which the model was last modified (:data:`None` until set from the server). Read-only. """ value = self._proto.last_modified_time if value is not None and value != 0: # value will be in millis...
def modified(self): """Union[datetime.datetime, None]: Datetime at which the model was last modified (:data:`None` until set from the server). Read-only. """ value = self._proto.last_modified_time if value is not None and value != 0: # value will be in millis...
[ "Union", "[", "datetime", ".", "datetime", "None", "]", ":", "Datetime", "at", "which", "the", "model", "was", "last", "modified", "(", ":", "data", ":", "None", "until", "set", "from", "the", "server", ")", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/model.py#L140-L151
[ "def", "modified", "(", "self", ")", ":", "value", "=", "self", ".", "_proto", ".", "last_modified_time", "if", "value", "is", "not", "None", "and", "value", "!=", "0", ":", "# value will be in milliseconds.", "return", "google", ".", "cloud", ".", "_helpers...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Model.expires
Union[datetime.datetime, None]: The datetime when this model expires. If not present, the model will persist indefinitely. Expired models will be deleted and their storage reclaimed.
bigquery/google/cloud/bigquery/model.py
def expires(self): """Union[datetime.datetime, None]: The datetime when this model expires. If not present, the model will persist indefinitely. Expired models will be deleted and their storage reclaimed. """ value = self._properties.get("expirationTime") if value is not ...
def expires(self): """Union[datetime.datetime, None]: The datetime when this model expires. If not present, the model will persist indefinitely. Expired models will be deleted and their storage reclaimed. """ value = self._properties.get("expirationTime") if value is not ...
[ "Union", "[", "datetime", ".", "datetime", "None", "]", ":", "The", "datetime", "when", "this", "model", "expires", ".", "If", "not", "present", "the", "model", "will", "persist", "indefinitely", ".", "Expired", "models", "will", "be", "deleted", "and", "t...
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/model.py#L201-L211
[ "def", "expires", "(", "self", ")", ":", "value", "=", "self", ".", "_properties", ".", "get", "(", "\"expirationTime\"", ")", "if", "value", "is", "not", "None", ":", "# value will be in milliseconds.", "return", "google", ".", "cloud", ".", "_helpers", "."...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Model.from_api_repr
Factory: construct a model resource given its API representation Args: resource (Dict[str, object]): Model resource representation from the API Returns: google.cloud.bigquery.model.Model: Model parsed from ``resource``.
bigquery/google/cloud/bigquery/model.py
def from_api_repr(cls, resource): """Factory: construct a model resource given its API representation Args: resource (Dict[str, object]): Model resource representation from the API Returns: google.cloud.bigquery.model.Model: Model parsed from ``resource`...
def from_api_repr(cls, resource): """Factory: construct a model resource given its API representation Args: resource (Dict[str, object]): Model resource representation from the API Returns: google.cloud.bigquery.model.Model: Model parsed from ``resource`...
[ "Factory", ":", "construct", "a", "model", "resource", "given", "its", "API", "representation" ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/model.py#L260-L288
[ "def", "from_api_repr", "(", "cls", ",", "resource", ")", ":", "this", "=", "cls", "(", "None", ")", "# Convert from millis-from-epoch to timestamp well-known type.", "# TODO: Remove this hack once CL 238585470 hits prod.", "resource", "=", "copy", ".", "deepcopy", "(", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ModelReference.path
str: URL path for the model's APIs.
bigquery/google/cloud/bigquery/model.py
def path(self): """str: URL path for the model's APIs.""" return "/projects/%s/datasets/%s/models/%s" % ( self._proto.project_id, self._proto.dataset_id, self._proto.model_id, )
def path(self): """str: URL path for the model's APIs.""" return "/projects/%s/datasets/%s/models/%s" % ( self._proto.project_id, self._proto.dataset_id, self._proto.model_id, )
[ "str", ":", "URL", "path", "for", "the", "model", "s", "APIs", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/model.py#L324-L330
[ "def", "path", "(", "self", ")", ":", "return", "\"/projects/%s/datasets/%s/models/%s\"", "%", "(", "self", ".", "_proto", ".", "project_id", ",", "self", ".", "_proto", ".", "dataset_id", ",", "self", ".", "_proto", ".", "model_id", ",", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ModelReference.from_api_repr
Factory: construct a model reference given its API representation Args: resource (Dict[str, object]): Model reference representation returned from the API Returns: google.cloud.bigquery.model.ModelReference: Model reference parsed from ``resourc...
bigquery/google/cloud/bigquery/model.py
def from_api_repr(cls, resource): """Factory: construct a model reference given its API representation Args: resource (Dict[str, object]): Model reference representation returned from the API Returns: google.cloud.bigquery.model.ModelReference: ...
def from_api_repr(cls, resource): """Factory: construct a model reference given its API representation Args: resource (Dict[str, object]): Model reference representation returned from the API Returns: google.cloud.bigquery.model.ModelReference: ...
[ "Factory", ":", "construct", "a", "model", "reference", "given", "its", "API", "representation" ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/model.py#L333-L346
[ "def", "from_api_repr", "(", "cls", ",", "resource", ")", ":", "ref", "=", "cls", "(", ")", "ref", ".", "_proto", "=", "json_format", ".", "ParseDict", "(", "resource", ",", "types", ".", "ModelReference", "(", ")", ")", "return", "ref" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ModelReference.from_string
Construct a model reference from model ID string. Args: model_id (str): A model ID in standard SQL format. If ``default_project`` is not specified, this must included a project ID, dataset ID, and model ID, each separated by ``.``. default...
bigquery/google/cloud/bigquery/model.py
def from_string(cls, model_id, default_project=None): """Construct a model reference from model ID string. Args: model_id (str): A model ID in standard SQL format. If ``default_project`` is not specified, this must included a project ID, dataset ...
def from_string(cls, model_id, default_project=None): """Construct a model reference from model ID string. Args: model_id (str): A model ID in standard SQL format. If ``default_project`` is not specified, this must included a project ID, dataset ...
[ "Construct", "a", "model", "reference", "from", "model", "ID", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/model.py#L349-L375
[ "def", "from_string", "(", "cls", ",", "model_id", ",", "default_project", "=", "None", ")", ":", "proj", ",", "dset", ",", "model", "=", "_helpers", ".", "_parse_3_part_id", "(", "model_id", ",", "default_project", "=", "default_project", ",", "property_name"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
CloudTasksClient.lease_tasks
Leases tasks from a pull queue for ``lease_duration``. This method is invoked by the worker to obtain a lease. The worker must acknowledge the task via ``AcknowledgeTask`` after they have performed the work associated with the task. The ``payload`` is intended to store data that the wo...
tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py
def lease_tasks( self, parent, lease_duration, max_tasks=None, response_view=None, filter_=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Leases tasks ...
def lease_tasks( self, parent, lease_duration, max_tasks=None, response_view=None, filter_=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Leases tasks ...
[ "Leases", "tasks", "from", "a", "pull", "queue", "for", "lease_duration", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py#L1594-L1743
[ "def", "lease_tasks", "(", "self", ",", "parent", ",", "lease_duration", ",", "max_tasks", "=", "None", ",", "response_view", "=", "None", ",", "filter_", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DE...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
format_stackdriver_json
Helper to format a LogRecord in in Stackdriver fluentd format. :rtype: str :returns: JSON str to be written to the log file.
logging/google/cloud/logging/handlers/_helpers.py
def format_stackdriver_json(record, message): """Helper to format a LogRecord in in Stackdriver fluentd format. :rtype: str :returns: JSON str to be written to the log file. """ subsecond, second = math.modf(record.created) payload = { "message": message, "timestamp": {...
def format_stackdriver_json(record, message): """Helper to format a LogRecord in in Stackdriver fluentd format. :rtype: str :returns: JSON str to be written to the log file. """ subsecond, second = math.modf(record.created) payload = { "message": message, "timestamp": {...
[ "Helper", "to", "format", "a", "LogRecord", "in", "in", "Stackdriver", "fluentd", "format", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/_helpers.py#L41-L56
[ "def", "format_stackdriver_json", "(", "record", ",", "message", ")", ":", "subsecond", ",", "second", "=", "math", ".", "modf", "(", "record", ".", "created", ")", "payload", "=", "{", "\"message\"", ":", "message", ",", "\"timestamp\"", ":", "{", "\"seco...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
get_trace_id_from_flask
Get trace_id from flask request headers. :rtype: str :returns: TraceID in HTTP request headers.
logging/google/cloud/logging/handlers/_helpers.py
def get_trace_id_from_flask(): """Get trace_id from flask request headers. :rtype: str :returns: TraceID in HTTP request headers. """ if flask is None or not flask.request: return None header = flask.request.headers.get(_FLASK_TRACE_HEADER) if header is None: return None ...
def get_trace_id_from_flask(): """Get trace_id from flask request headers. :rtype: str :returns: TraceID in HTTP request headers. """ if flask is None or not flask.request: return None header = flask.request.headers.get(_FLASK_TRACE_HEADER) if header is None: return None ...
[ "Get", "trace_id", "from", "flask", "request", "headers", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/_helpers.py#L59-L75
[ "def", "get_trace_id_from_flask", "(", ")", ":", "if", "flask", "is", "None", "or", "not", "flask", ".", "request", ":", "return", "None", "header", "=", "flask", ".", "request", ".", "headers", ".", "get", "(", "_FLASK_TRACE_HEADER", ")", "if", "header", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
get_trace_id_from_webapp2
Get trace_id from webapp2 request headers. :rtype: str :returns: TraceID in HTTP request headers.
logging/google/cloud/logging/handlers/_helpers.py
def get_trace_id_from_webapp2(): """Get trace_id from webapp2 request headers. :rtype: str :returns: TraceID in HTTP request headers. """ if webapp2 is None: return None try: # get_request() succeeds if we're in the middle of a webapp2 # request, or raises an assertion ...
def get_trace_id_from_webapp2(): """Get trace_id from webapp2 request headers. :rtype: str :returns: TraceID in HTTP request headers. """ if webapp2 is None: return None try: # get_request() succeeds if we're in the middle of a webapp2 # request, or raises an assertion ...
[ "Get", "trace_id", "from", "webapp2", "request", "headers", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/_helpers.py#L78-L102
[ "def", "get_trace_id_from_webapp2", "(", ")", ":", "if", "webapp2", "is", "None", ":", "return", "None", "try", ":", "# get_request() succeeds if we're in the middle of a webapp2", "# request, or raises an assertion error otherwise:", "# \"Request global variable is not set\".", "r...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
get_trace_id_from_django
Get trace_id from django request headers. :rtype: str :returns: TraceID in HTTP request headers.
logging/google/cloud/logging/handlers/_helpers.py
def get_trace_id_from_django(): """Get trace_id from django request headers. :rtype: str :returns: TraceID in HTTP request headers. """ request = _get_django_request() if request is None: return None header = request.META.get(_DJANGO_TRACE_HEADER) if header is None: re...
def get_trace_id_from_django(): """Get trace_id from django request headers. :rtype: str :returns: TraceID in HTTP request headers. """ request = _get_django_request() if request is None: return None header = request.META.get(_DJANGO_TRACE_HEADER) if header is None: re...
[ "Get", "trace_id", "from", "django", "request", "headers", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/_helpers.py#L105-L122
[ "def", "get_trace_id_from_django", "(", ")", ":", "request", "=", "_get_django_request", "(", ")", "if", "request", "is", "None", ":", "return", "None", "header", "=", "request", ".", "META", ".", "get", "(", "_DJANGO_TRACE_HEADER", ")", "if", "header", "is"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
get_trace_id
Helper to get trace_id from web application request header. :rtype: str :returns: TraceID in HTTP request headers.
logging/google/cloud/logging/handlers/_helpers.py
def get_trace_id(): """Helper to get trace_id from web application request header. :rtype: str :returns: TraceID in HTTP request headers. """ checkers = ( get_trace_id_from_django, get_trace_id_from_flask, get_trace_id_from_webapp2, ) for checker in checkers: ...
def get_trace_id(): """Helper to get trace_id from web application request header. :rtype: str :returns: TraceID in HTTP request headers. """ checkers = ( get_trace_id_from_django, get_trace_id_from_flask, get_trace_id_from_webapp2, ) for checker in checkers: ...
[ "Helper", "to", "get", "trace_id", "from", "web", "application", "request", "header", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/handlers/_helpers.py#L125-L142
[ "def", "get_trace_id", "(", ")", ":", "checkers", "=", "(", "get_trace_id_from_django", ",", "get_trace_id_from_flask", ",", "get_trace_id_from_webapp2", ",", ")", "for", "checker", "in", "checkers", ":", "trace_id", "=", "checker", "(", ")", "if", "trace_id", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
GroupServiceClient.group_path
Return a fully-qualified group string.
monitoring/google/cloud/monitoring_v3/gapic/group_service_client.py
def group_path(cls, project, group): """Return a fully-qualified group string.""" return google.api_core.path_template.expand( "projects/{project}/groups/{group}", project=project, group=group )
def group_path(cls, project, group): """Return a fully-qualified group string.""" return google.api_core.path_template.expand( "projects/{project}/groups/{group}", project=project, group=group )
[ "Return", "a", "fully", "-", "qualified", "group", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/gapic/group_service_client.py#L101-L105
[ "def", "group_path", "(", "cls", ",", "project", ",", "group", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/groups/{group}\"", ",", "project", "=", "project", ",", "group", "=", "group", ")" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
GroupServiceClient.list_groups
Lists the existing groups. Example: >>> from google.cloud import monitoring_v3 >>> >>> client = monitoring_v3.GroupServiceClient() >>> >>> name = client.project_path('[PROJECT]') >>> >>> # Iterate over all results >...
monitoring/google/cloud/monitoring_v3/gapic/group_service_client.py
def list_groups( self, name, children_of_group=None, ancestors_of_group=None, descendants_of_group=None, page_size=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): "...
def list_groups( self, name, children_of_group=None, ancestors_of_group=None, descendants_of_group=None, page_size=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): "...
[ "Lists", "the", "existing", "groups", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/gapic/group_service_client.py#L206-L338
[ "def", "list_groups", "(", "self", ",", "name", ",", "children_of_group", "=", "None", ",", "ancestors_of_group", "=", "None", ",", "descendants_of_group", "=", "None", ",", "page_size", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TextToSpeechClient.list_voices
Returns a list of ``Voice`` supported for synthesis. Example: >>> from google.cloud import texttospeech_v1beta1 >>> >>> client = texttospeech_v1beta1.TextToSpeechClient() >>> >>> response = client.list_voices() Args: language_code...
texttospeech/google/cloud/texttospeech_v1beta1/gapic/text_to_speech_client.py
def list_voices( self, language_code=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Returns a list of ``Voice`` supported for synthesis. Example: >>> from google....
def list_voices( self, language_code=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Returns a list of ``Voice`` supported for synthesis. Example: >>> from google....
[ "Returns", "a", "list", "of", "Voice", "supported", "for", "synthesis", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/texttospeech/google/cloud/texttospeech_v1beta1/gapic/text_to_speech_client.py#L170-L229
[ "def", "list_voices", "(", "self", ",", "language_code", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFA...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TextToSpeechClient.synthesize_speech
Synthesizes speech synchronously: receive results after all text input has been processed. Example: >>> from google.cloud import texttospeech_v1beta1 >>> >>> client = texttospeech_v1beta1.TextToSpeechClient() >>> >>> # TODO: Initialize `input_...
texttospeech/google/cloud/texttospeech_v1beta1/gapic/text_to_speech_client.py
def synthesize_speech( self, input_, voice, audio_config, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Synthesizes speech synchronously: receive results after all text inp...
def synthesize_speech( self, input_, voice, audio_config, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Synthesizes speech synchronously: receive results after all text inp...
[ "Synthesizes", "speech", "synchronously", ":", "receive", "results", "after", "all", "text", "input", "has", "been", "processed", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/texttospeech/google/cloud/texttospeech_v1beta1/gapic/text_to_speech_client.py#L231-L308
[ "def", "synthesize_speech", "(", "self", ",", "input_", ",", "voice", ",", "audio_config", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
ensure_signed_credentials
Raise AttributeError if the credentials are unsigned. :type credentials: :class:`google.auth.credentials.Signing` :param credentials: The credentials used to create a private key for signing text. :raises: :exc:`AttributeError` if credentials is not an instance of :clas...
storage/google/cloud/storage/_signing.py
def ensure_signed_credentials(credentials): """Raise AttributeError if the credentials are unsigned. :type credentials: :class:`google.auth.credentials.Signing` :param credentials: The credentials used to create a private key for signing text. :raises: :exc:`AttributeError` if ...
def ensure_signed_credentials(credentials): """Raise AttributeError if the credentials are unsigned. :type credentials: :class:`google.auth.credentials.Signing` :param credentials: The credentials used to create a private key for signing text. :raises: :exc:`AttributeError` if ...
[ "Raise", "AttributeError", "if", "the", "credentials", "are", "unsigned", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/_signing.py#L34-L55
[ "def", "ensure_signed_credentials", "(", "credentials", ")", ":", "if", "not", "isinstance", "(", "credentials", ",", "google", ".", "auth", ".", "credentials", ".", "Signing", ")", ":", "auth_uri", "=", "(", "\"https://google-cloud-python.readthedocs.io/en/latest/\""...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
get_signed_query_params_v2
Gets query parameters for creating a signed URL. :type credentials: :class:`google.auth.credentials.Signing` :param credentials: The credentials used to create a private key for signing text. :type expiration: int or long :param expiration: When the signed URL should expire. ...
storage/google/cloud/storage/_signing.py
def get_signed_query_params_v2(credentials, expiration, string_to_sign): """Gets query parameters for creating a signed URL. :type credentials: :class:`google.auth.credentials.Signing` :param credentials: The credentials used to create a private key for signing text. :type expi...
def get_signed_query_params_v2(credentials, expiration, string_to_sign): """Gets query parameters for creating a signed URL. :type credentials: :class:`google.auth.credentials.Signing` :param credentials: The credentials used to create a private key for signing text. :type expi...
[ "Gets", "query", "parameters", "for", "creating", "a", "signed", "URL", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/_signing.py#L58-L86
[ "def", "get_signed_query_params_v2", "(", "credentials", ",", "expiration", ",", "string_to_sign", ")", ":", "ensure_signed_credentials", "(", "credentials", ")", "signature_bytes", "=", "credentials", ".", "sign_bytes", "(", "string_to_sign", ")", "signature", "=", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
get_expiration_seconds_v2
Convert 'expiration' to a number of seconds in the future. :type expiration: Union[Integer, datetime.datetime, datetime.timedelta] :param expiration: Point in time when the signed URL should expire. :raises: :exc:`TypeError` when expiration is not a valid type. :rtype: int :returns: a timestamp a...
storage/google/cloud/storage/_signing.py
def get_expiration_seconds_v2(expiration): """Convert 'expiration' to a number of seconds in the future. :type expiration: Union[Integer, datetime.datetime, datetime.timedelta] :param expiration: Point in time when the signed URL should expire. :raises: :exc:`TypeError` when expiration is not a valid ...
def get_expiration_seconds_v2(expiration): """Convert 'expiration' to a number of seconds in the future. :type expiration: Union[Integer, datetime.datetime, datetime.timedelta] :param expiration: Point in time when the signed URL should expire. :raises: :exc:`TypeError` when expiration is not a valid ...
[ "Convert", "expiration", "to", "a", "number", "of", "seconds", "in", "the", "future", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/_signing.py#L89-L115
[ "def", "get_expiration_seconds_v2", "(", "expiration", ")", ":", "# If it's a timedelta, add it to `now` in UTC.", "if", "isinstance", "(", "expiration", ",", "datetime", ".", "timedelta", ")", ":", "now", "=", "NOW", "(", ")", ".", "replace", "(", "tzinfo", "=", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
get_expiration_seconds_v4
Convert 'expiration' to a number of seconds offset from the current time. :type expiration: Union[Integer, datetime.datetime, datetime.timedelta] :param expiration: Point in time when the signed URL should expire. :raises: :exc:`TypeError` when expiration is not a valid type. :raises: :exc:`ValueError...
storage/google/cloud/storage/_signing.py
def get_expiration_seconds_v4(expiration): """Convert 'expiration' to a number of seconds offset from the current time. :type expiration: Union[Integer, datetime.datetime, datetime.timedelta] :param expiration: Point in time when the signed URL should expire. :raises: :exc:`TypeError` when expiration ...
def get_expiration_seconds_v4(expiration): """Convert 'expiration' to a number of seconds offset from the current time. :type expiration: Union[Integer, datetime.datetime, datetime.timedelta] :param expiration: Point in time when the signed URL should expire. :raises: :exc:`TypeError` when expiration ...
[ "Convert", "expiration", "to", "a", "number", "of", "seconds", "offset", "from", "the", "current", "time", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/_signing.py#L121-L160
[ "def", "get_expiration_seconds_v4", "(", "expiration", ")", ":", "if", "not", "isinstance", "(", "expiration", ",", "_EXPIRATION_TYPES", ")", ":", "raise", "TypeError", "(", "\"Expected an integer timestamp, datetime, or \"", "\"timedelta. Got %s\"", "%", "type", "(", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
get_canonical_headers
Canonicalize headers for signing. See: https://cloud.google.com/storage/docs/access-control/signed-urls#about-canonical-extension-headers :type headers: Union[dict|List(Tuple(str,str))] :param headers: (Optional) Additional HTTP headers to be included as part of the signed URLs. See: ...
storage/google/cloud/storage/_signing.py
def get_canonical_headers(headers): """Canonicalize headers for signing. See: https://cloud.google.com/storage/docs/access-control/signed-urls#about-canonical-extension-headers :type headers: Union[dict|List(Tuple(str,str))] :param headers: (Optional) Additional HTTP headers to be included...
def get_canonical_headers(headers): """Canonicalize headers for signing. See: https://cloud.google.com/storage/docs/access-control/signed-urls#about-canonical-extension-headers :type headers: Union[dict|List(Tuple(str,str))] :param headers: (Optional) Additional HTTP headers to be included...
[ "Canonicalize", "headers", "for", "signing", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/_signing.py#L163-L197
[ "def", "get_canonical_headers", "(", "headers", ")", ":", "if", "headers", "is", "None", ":", "headers", "=", "[", "]", "elif", "isinstance", "(", "headers", ",", "dict", ")", ":", "headers", "=", "list", "(", "headers", ".", "items", "(", ")", ")", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
canonicalize
Canonicalize method, resource :type method: str :param method: The HTTP verb that will be used when requesting the URL. Defaults to ``'GET'``. If method is ``'RESUMABLE'`` then the signature will additionally contain the `x-goog-resumable` header, and th...
storage/google/cloud/storage/_signing.py
def canonicalize(method, resource, query_parameters, headers): """Canonicalize method, resource :type method: str :param method: The HTTP verb that will be used when requesting the URL. Defaults to ``'GET'``. If method is ``'RESUMABLE'`` then the signature will additio...
def canonicalize(method, resource, query_parameters, headers): """Canonicalize method, resource :type method: str :param method: The HTTP verb that will be used when requesting the URL. Defaults to ``'GET'``. If method is ``'RESUMABLE'`` then the signature will additio...
[ "Canonicalize", "method", "resource" ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/_signing.py#L205-L252
[ "def", "canonicalize", "(", "method", ",", "resource", ",", "query_parameters", ",", "headers", ")", ":", "headers", ",", "_", "=", "get_canonical_headers", "(", "headers", ")", "if", "method", "==", "\"RESUMABLE\"", ":", "method", "=", "\"POST\"", "headers", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
generate_signed_url_v2
Generate a V2 signed URL to provide query-string auth'n to a resource. .. note:: Assumes ``credentials`` implements the :class:`google.auth.credentials.Signing` interface. Also assumes ``credentials`` has a ``service_account_email`` property which identifies the credentials. ....
storage/google/cloud/storage/_signing.py
def generate_signed_url_v2( credentials, resource, expiration, api_access_endpoint="", method="GET", content_md5=None, content_type=None, response_type=None, response_disposition=None, generation=None, headers=None, query_parameters=None, ): """Generate a V2 signed UR...
def generate_signed_url_v2( credentials, resource, expiration, api_access_endpoint="", method="GET", content_md5=None, content_type=None, response_type=None, response_disposition=None, generation=None, headers=None, query_parameters=None, ): """Generate a V2 signed UR...
[ "Generate", "a", "V2", "signed", "URL", "to", "provide", "query", "-", "string", "auth", "n", "to", "a", "resource", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/_signing.py#L255-L392
[ "def", "generate_signed_url_v2", "(", "credentials", ",", "resource", ",", "expiration", ",", "api_access_endpoint", "=", "\"\"", ",", "method", "=", "\"GET\"", ",", "content_md5", "=", "None", ",", "content_type", "=", "None", ",", "response_type", "=", "None",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
generate_signed_url_v4
Generate a V4 signed URL to provide query-string auth'n to a resource. .. note:: Assumes ``credentials`` implements the :class:`google.auth.credentials.Signing` interface. Also assumes ``credentials`` has a ``service_account_email`` property which identifies the credentials. ....
storage/google/cloud/storage/_signing.py
def generate_signed_url_v4( credentials, resource, expiration, api_access_endpoint=DEFAULT_ENDPOINT, method="GET", content_md5=None, content_type=None, response_type=None, response_disposition=None, generation=None, headers=None, query_parameters=None, _request_timest...
def generate_signed_url_v4( credentials, resource, expiration, api_access_endpoint=DEFAULT_ENDPOINT, method="GET", content_md5=None, content_type=None, response_type=None, response_disposition=None, generation=None, headers=None, query_parameters=None, _request_timest...
[ "Generate", "a", "V4", "signed", "URL", "to", "provide", "query", "-", "string", "auth", "n", "to", "a", "resource", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/_signing.py#L399-L591
[ "def", "generate_signed_url_v4", "(", "credentials", ",", "resource", ",", "expiration", ",", "api_access_endpoint", "=", "DEFAULT_ENDPOINT", ",", "method", "=", "\"GET\"", ",", "content_md5", "=", "None", ",", "content_type", "=", "None", ",", "response_type", "=...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TranslationServiceClient.glossary_path
Return a fully-qualified glossary string.
translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py
def glossary_path(cls, project, location, glossary): """Return a fully-qualified glossary string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/glossaries/{glossary}", project=project, location=location, glossary=...
def glossary_path(cls, project, location, glossary): """Return a fully-qualified glossary string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/glossaries/{glossary}", project=project, location=location, glossary=...
[ "Return", "a", "fully", "-", "qualified", "glossary", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py#L88-L95
[ "def", "glossary_path", "(", "cls", ",", "project", ",", "location", ",", "glossary", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/locations/{location}/glossaries/{glossary}\"", ",", "project", "=", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TranslationServiceClient.translate_text
Translates input text and returns translated text. Example: >>> from google.cloud import translate_v3beta1 >>> >>> client = translate_v3beta1.TranslationServiceClient() >>> >>> # TODO: Initialize `contents`: >>> contents = [] >...
translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py
def translate_text( self, contents, target_language_code, mime_type=None, source_language_code=None, parent=None, model=None, glossary_config=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAU...
def translate_text( self, contents, target_language_code, mime_type=None, source_language_code=None, parent=None, model=None, glossary_config=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAU...
[ "Translates", "input", "text", "and", "returns", "translated", "text", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py#L196-L317
[ "def", "translate_text", "(", "self", ",", "contents", ",", "target_language_code", ",", "mime_type", "=", "None", ",", "source_language_code", "=", "None", ",", "parent", "=", "None", ",", "model", "=", "None", ",", "glossary_config", "=", "None", ",", "ret...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TranslationServiceClient.detect_language
Detects the language of text within a request. Example: >>> from google.cloud import translate_v3beta1 >>> >>> client = translate_v3beta1.TranslationServiceClient() >>> >>> response = client.detect_language() Args: parent (str): O...
translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py
def detect_language( self, parent=None, model=None, content=None, mime_type=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Detects the language of text within ...
def detect_language( self, parent=None, model=None, content=None, mime_type=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Detects the language of text within ...
[ "Detects", "the", "language", "of", "text", "within", "a", "request", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py#L319-L404
[ "def", "detect_language", "(", "self", ",", "parent", "=", "None", ",", "model", "=", "None", ",", "content", "=", "None", ",", "mime_type", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TranslationServiceClient.get_supported_languages
Returns a list of supported languages for translation. Example: >>> from google.cloud import translate_v3beta1 >>> >>> client = translate_v3beta1.TranslationServiceClient() >>> >>> response = client.get_supported_languages() Args: ...
translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py
def get_supported_languages( self, parent=None, display_language_code=None, model=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Returns a list of supported languages ...
def get_supported_languages( self, parent=None, display_language_code=None, model=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Returns a list of supported languages ...
[ "Returns", "a", "list", "of", "supported", "languages", "for", "translation", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py#L406-L492
[ "def", "get_supported_languages", "(", "self", ",", "parent", "=", "None", ",", "display_language_code", "=", "None", ",", "model", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TranslationServiceClient.batch_translate_text
Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. Thi...
translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py
def batch_translate_text( self, source_language_code, target_language_codes, input_configs, output_config, parent=None, models=None, glossaries=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEF...
def batch_translate_text( self, source_language_code, target_language_codes, input_configs, output_config, parent=None, models=None, glossaries=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEF...
[ "Translates", "a", "large", "volume", "of", "text", "in", "asynchronous", "batch", "mode", ".", "This", "function", "provides", "real", "-", "time", "output", "as", "the", "inputs", "are", "being", "processed", ".", "If", "caller", "cancels", "a", "request",...
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py#L494-L644
[ "def", "batch_translate_text", "(", "self", ",", "source_language_code", ",", "target_language_codes", ",", "input_configs", ",", "output_config", ",", "parent", "=", "None", ",", "models", "=", "None", ",", "glossaries", "=", "None", ",", "retry", "=", "google"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TranslationServiceClient.create_glossary
Creates a glossary and returns the long-running operation. Returns NOT\_FOUND, if the project doesn't exist. Example: >>> from google.cloud import translate_v3beta1 >>> >>> client = translate_v3beta1.TranslationServiceClient() >>> >>> parent =...
translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py
def create_glossary( self, parent, glossary, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a glossary and returns the long-running operation. Returns NOT\_FOUND, if...
def create_glossary( self, parent, glossary, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a glossary and returns the long-running operation. Returns NOT\_FOUND, if...
[ "Creates", "a", "glossary", "and", "returns", "the", "long", "-", "running", "operation", ".", "Returns", "NOT", "\\", "_FOUND", "if", "the", "project", "doesn", "t", "exist", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py#L646-L739
[ "def", "create_glossary", "(", "self", ",", "parent", ",", "glossary", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEF...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
TranslationServiceClient.delete_glossary
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT\_FOUND, if the glossary doesn't exist. Example: >>> from google.cloud import translate_v3beta1 >>> >>> client = translate_v3beta1.TranslationServiceClient() ...
translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py
def delete_glossary( self, name, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT\_...
def delete_glossary( self, name, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT\_...
[ "Deletes", "a", "glossary", "or", "cancels", "glossary", "construction", "if", "the", "glossary", "isn", "t", "created", "yet", ".", "Returns", "NOT", "\\", "_FOUND", "if", "the", "glossary", "doesn", "t", "exist", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py#L916-L999
[ "def", "delete_glossary", "(", "self", ",", "name", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "metada...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_extract_header
Return a copy of time_series with the points removed.
monitoring/google/cloud/monitoring_v3/_dataframe.py
def _extract_header(time_series): """Return a copy of time_series with the points removed.""" return TimeSeries( metric=time_series.metric, resource=time_series.resource, metric_kind=time_series.metric_kind, value_type=time_series.value_type, )
def _extract_header(time_series): """Return a copy of time_series with the points removed.""" return TimeSeries( metric=time_series.metric, resource=time_series.resource, metric_kind=time_series.metric_kind, value_type=time_series.value_type, )
[ "Return", "a", "copy", "of", "time_series", "with", "the", "points", "removed", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/_dataframe.py#L29-L36
[ "def", "_extract_header", "(", "time_series", ")", ":", "return", "TimeSeries", "(", "metric", "=", "time_series", ".", "metric", ",", "resource", "=", "time_series", ".", "resource", ",", "metric_kind", "=", "time_series", ".", "metric_kind", ",", "value_type",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_extract_labels
Build the combined resource and metric labels, with resource_type.
monitoring/google/cloud/monitoring_v3/_dataframe.py
def _extract_labels(time_series): """Build the combined resource and metric labels, with resource_type.""" labels = {"resource_type": time_series.resource.type} labels.update(time_series.resource.labels) labels.update(time_series.metric.labels) return labels
def _extract_labels(time_series): """Build the combined resource and metric labels, with resource_type.""" labels = {"resource_type": time_series.resource.type} labels.update(time_series.resource.labels) labels.update(time_series.metric.labels) return labels
[ "Build", "the", "combined", "resource", "and", "metric", "labels", "with", "resource_type", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/_dataframe.py#L39-L44
[ "def", "_extract_labels", "(", "time_series", ")", ":", "labels", "=", "{", "\"resource_type\"", ":", "time_series", ".", "resource", ".", "type", "}", "labels", ".", "update", "(", "time_series", ".", "resource", ".", "labels", ")", "labels", ".", "update",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_build_dataframe
Build a :mod:`pandas` dataframe out of time series. :type time_series_iterable: iterable over :class:`~google.cloud.monitoring_v3.types.TimeSeries` :param time_series_iterable: An iterable (e.g., a query object) yielding time series. :type label: str :param label: (Optional) Th...
monitoring/google/cloud/monitoring_v3/_dataframe.py
def _build_dataframe(time_series_iterable, label=None, labels=None): # pragma: NO COVER """Build a :mod:`pandas` dataframe out of time series. :type time_series_iterable: iterable over :class:`~google.cloud.monitoring_v3.types.TimeSeries` :param time_series_iterable: An iterable (e.g., a q...
def _build_dataframe(time_series_iterable, label=None, labels=None): # pragma: NO COVER """Build a :mod:`pandas` dataframe out of time series. :type time_series_iterable: iterable over :class:`~google.cloud.monitoring_v3.types.TimeSeries` :param time_series_iterable: An iterable (e.g., a q...
[ "Build", "a", ":", "mod", ":", "pandas", "dataframe", "out", "of", "time", "series", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/_dataframe.py#L53-L140
[ "def", "_build_dataframe", "(", "time_series_iterable", ",", "label", "=", "None", ",", "labels", "=", "None", ")", ":", "# pragma: NO COVER", "if", "pandas", "is", "None", ":", "raise", "RuntimeError", "(", "\"This method requires `pandas` to be installed.\"", ")", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
_sorted_resource_labels
Sort label names, putting well-known resource labels first.
monitoring/google/cloud/monitoring_v3/_dataframe.py
def _sorted_resource_labels(labels): """Sort label names, putting well-known resource labels first.""" head = [label for label in TOP_RESOURCE_LABELS if label in labels] tail = sorted(label for label in labels if label not in TOP_RESOURCE_LABELS) return head + tail
def _sorted_resource_labels(labels): """Sort label names, putting well-known resource labels first.""" head = [label for label in TOP_RESOURCE_LABELS if label in labels] tail = sorted(label for label in labels if label not in TOP_RESOURCE_LABELS) return head + tail
[ "Sort", "label", "names", "putting", "well", "-", "known", "resource", "labels", "first", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/monitoring/google/cloud/monitoring_v3/_dataframe.py#L143-L147
[ "def", "_sorted_resource_labels", "(", "labels", ")", ":", "head", "=", "[", "label", "for", "label", "in", "TOP_RESOURCE_LABELS", "if", "label", "in", "labels", "]", "tail", "=", "sorted", "(", "label", "for", "label", "in", "labels", "if", "label", "not"...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
start_daemon_thread
Starts a thread and marks it as a daemon thread.
api_core/google/api_core/future/_helpers.py
def start_daemon_thread(*args, **kwargs): """Starts a thread and marks it as a daemon thread.""" thread = threading.Thread(*args, **kwargs) thread.daemon = True thread.start() return thread
def start_daemon_thread(*args, **kwargs): """Starts a thread and marks it as a daemon thread.""" thread = threading.Thread(*args, **kwargs) thread.daemon = True thread.start() return thread
[ "Starts", "a", "thread", "and", "marks", "it", "as", "a", "daemon", "thread", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/_helpers.py#L24-L29
[ "def", "start_daemon_thread", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "thread", "=", "threading", ".", "Thread", "(", "*", "args", ",", "*", "*", "kwargs", ")", "thread", ".", "daemon", "=", "True", "thread", ".", "start", "(", ")", "r...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
safe_invoke_callback
Invoke a callback, swallowing and logging any exceptions.
api_core/google/api_core/future/_helpers.py
def safe_invoke_callback(callback, *args, **kwargs): """Invoke a callback, swallowing and logging any exceptions.""" # pylint: disable=bare-except # We intentionally want to swallow all exceptions. try: return callback(*args, **kwargs) except Exception: _LOGGER.exception("Error while...
def safe_invoke_callback(callback, *args, **kwargs): """Invoke a callback, swallowing and logging any exceptions.""" # pylint: disable=bare-except # We intentionally want to swallow all exceptions. try: return callback(*args, **kwargs) except Exception: _LOGGER.exception("Error while...
[ "Invoke", "a", "callback", "swallowing", "and", "logging", "any", "exceptions", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/_helpers.py#L32-L39
[ "def", "safe_invoke_callback", "(", "callback", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=bare-except", "# We intentionally want to swallow all exceptions.", "try", ":", "return", "callback", "(", "*", "args", ",", "*", "*", "kwargs", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.new_project
Create a project bound to the current client. Use :meth:`Project.reload() \ <google.cloud.resource_manager.project.Project.reload>` to retrieve project metadata after creating a :class:`~google.cloud.resource_manager.project.Project` instance. .. note: This does no...
resource_manager/google/cloud/resource_manager/client.py
def new_project(self, project_id, name=None, labels=None): """Create a project bound to the current client. Use :meth:`Project.reload() \ <google.cloud.resource_manager.project.Project.reload>` to retrieve project metadata after creating a :class:`~google.cloud.resource_manager....
def new_project(self, project_id, name=None, labels=None): """Create a project bound to the current client. Use :meth:`Project.reload() \ <google.cloud.resource_manager.project.Project.reload>` to retrieve project metadata after creating a :class:`~google.cloud.resource_manager....
[ "Create", "a", "project", "bound", "to", "the", "current", "client", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/resource_manager/google/cloud/resource_manager/client.py#L61-L87
[ "def", "new_project", "(", "self", ",", "project_id", ",", "name", "=", "None", ",", "labels", "=", "None", ")", ":", "return", "Project", "(", "project_id", "=", "project_id", ",", "client", "=", "self", ",", "name", "=", "name", ",", "labels", "=", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.fetch_project
Fetch an existing project and it's relevant metadata by ID. .. note:: If the project does not exist, this will raise a :class:`NotFound <google.cloud.exceptions.NotFound>` error. :type project_id: str :param project_id: The ID for this project. :rtype: :class:...
resource_manager/google/cloud/resource_manager/client.py
def fetch_project(self, project_id): """Fetch an existing project and it's relevant metadata by ID. .. note:: If the project does not exist, this will raise a :class:`NotFound <google.cloud.exceptions.NotFound>` error. :type project_id: str :param project_id: T...
def fetch_project(self, project_id): """Fetch an existing project and it's relevant metadata by ID. .. note:: If the project does not exist, this will raise a :class:`NotFound <google.cloud.exceptions.NotFound>` error. :type project_id: str :param project_id: T...
[ "Fetch", "an", "existing", "project", "and", "it", "s", "relevant", "metadata", "by", "ID", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/resource_manager/google/cloud/resource_manager/client.py#L89-L106
[ "def", "fetch_project", "(", "self", ",", "project_id", ")", ":", "project", "=", "self", ".", "new_project", "(", "project_id", ")", "project", ".", "reload", "(", ")", "return", "project" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
Client.list_projects
List the projects visible to this client. Example:: >>> from google.cloud import resource_manager >>> client = resource_manager.Client() >>> for project in client.list_projects(): ... print(project.project_id) List all projects with label ``'environ...
resource_manager/google/cloud/resource_manager/client.py
def list_projects(self, filter_params=None, page_size=None): """List the projects visible to this client. Example:: >>> from google.cloud import resource_manager >>> client = resource_manager.Client() >>> for project in client.list_projects(): ... pr...
def list_projects(self, filter_params=None, page_size=None): """List the projects visible to this client. Example:: >>> from google.cloud import resource_manager >>> client = resource_manager.Client() >>> for project in client.list_projects(): ... pr...
[ "List", "the", "projects", "visible", "to", "this", "client", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/resource_manager/google/cloud/resource_manager/client.py#L108-L177
[ "def", "list_projects", "(", "self", ",", "filter_params", "=", "None", ",", "page_size", "=", "None", ")", ":", "extra_params", "=", "{", "}", "if", "page_size", "is", "not", "None", ":", "extra_params", "[", "\"pageSize\"", "]", "=", "page_size", "if", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
SpannerClient.session_path
Return a fully-qualified session string.
spanner/google/cloud/spanner_v1/gapic/spanner_client.py
def session_path(cls, project, instance, database, session): """Return a fully-qualified session string.""" return google.api_core.path_template.expand( "projects/{project}/instances/{instance}/databases/{database}/sessions/{session}", project=project, instance=instan...
def session_path(cls, project, instance, database, session): """Return a fully-qualified session string.""" return google.api_core.path_template.expand( "projects/{project}/instances/{instance}/databases/{database}/sessions/{session}", project=project, instance=instan...
[ "Return", "a", "fully", "-", "qualified", "session", "string", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/gapic/spanner_client.py#L94-L102
[ "def", "session_path", "(", "cls", ",", "project", ",", "instance", ",", "database", ",", "session", ")", ":", "return", "google", ".", "api_core", ".", "path_template", ".", "expand", "(", "\"projects/{project}/instances/{instance}/databases/{database}/sessions/{sessio...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
SpannerClient.create_session
Creates a new session. A session can be used to perform transactions that read and/or modify data in a Cloud Spanner database. Sessions are meant to be reused for many consecutive transactions. Sessions can only execute one transaction at a time. To execute multiple concurrent read-writ...
spanner/google/cloud/spanner_v1/gapic/spanner_client.py
def create_session( self, database, session=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a new session. A session can be used to perform transactions that re...
def create_session( self, database, session=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a new session. A session can be used to perform transactions that re...
[ "Creates", "a", "new", "session", ".", "A", "session", "can", "be", "used", "to", "perform", "transactions", "that", "read", "and", "/", "or", "modify", "data", "in", "a", "Cloud", "Spanner", "database", ".", "Sessions", "are", "meant", "to", "be", "reus...
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/gapic/spanner_client.py#L203-L291
[ "def", "create_session", "(", "self", ",", "database", ",", "session", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "metho...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
SpannerClient.execute_streaming_sql
Like ``ExecuteSql``, except returns the result set as a stream. Unlike ``ExecuteSql``, there is no limit on the size of the returned result set. However, no individual row in the result set can exceed 100 MiB, and no column value can exceed 10 MiB. Example: >>> from google.c...
spanner/google/cloud/spanner_v1/gapic/spanner_client.py
def execute_streaming_sql( self, session, sql, transaction=None, params=None, param_types=None, resume_token=None, query_mode=None, partition_token=None, seqno=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=goo...
def execute_streaming_sql( self, session, sql, transaction=None, params=None, param_types=None, resume_token=None, query_mode=None, partition_token=None, seqno=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=goo...
[ "Like", "ExecuteSql", "except", "returns", "the", "result", "set", "as", "a", "stream", ".", "Unlike", "ExecuteSql", "there", "is", "no", "limit", "on", "the", "size", "of", "the", "returned", "result", "set", ".", "However", "no", "individual", "row", "in...
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/gapic/spanner_client.py#L712-L872
[ "def", "execute_streaming_sql", "(", "self", ",", "session", ",", "sql", ",", "transaction", "=", "None", ",", "params", "=", "None", ",", "param_types", "=", "None", ",", "resume_token", "=", "None", ",", "query_mode", "=", "None", ",", "partition_token", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
SpannerClient.execute_batch_dml
Executes a batch of SQL DML statements. This method allows many statements to be run with lower latency than submitting them sequentially with ``ExecuteSql``. Statements are executed in order, sequentially. ``ExecuteBatchDmlResponse`` will contain a ``ResultSet`` for each DML st...
spanner/google/cloud/spanner_v1/gapic/spanner_client.py
def execute_batch_dml( self, session, transaction, statements, seqno, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Executes a batch of SQL DML statements. This met...
def execute_batch_dml( self, session, transaction, statements, seqno, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Executes a batch of SQL DML statements. This met...
[ "Executes", "a", "batch", "of", "SQL", "DML", "statements", ".", "This", "method", "allows", "many", "statements", "to", "be", "run", "with", "lower", "latency", "than", "submitting", "them", "sequentially", "with", "ExecuteSql", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/gapic/spanner_client.py#L874-L990
[ "def", "execute_batch_dml", "(", "self", ",", "session", ",", "transaction", ",", "statements", ",", "seqno", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
SpannerClient.read
Reads rows from the database using key lookups and scans, as a simple key/value style alternative to ``ExecuteSql``. This method cannot be used to return a result set larger than 10 MiB; if the read matches more data than that, the read fails with a ``FAILED_PRECONDITION`` error. Reads ...
spanner/google/cloud/spanner_v1/gapic/spanner_client.py
def read( self, session, table, columns, key_set, transaction=None, index=None, limit=None, resume_token=None, partition_token=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFA...
def read( self, session, table, columns, key_set, transaction=None, index=None, limit=None, resume_token=None, partition_token=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFA...
[ "Reads", "rows", "from", "the", "database", "using", "key", "lookups", "and", "scans", "as", "a", "simple", "key", "/", "value", "style", "alternative", "to", "ExecuteSql", ".", "This", "method", "cannot", "be", "used", "to", "return", "a", "result", "set"...
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/gapic/spanner_client.py#L992-L1132
[ "def", "read", "(", "self", ",", "session", ",", "table", ",", "columns", ",", "key_set", ",", "transaction", "=", "None", ",", "index", "=", "None", ",", "limit", "=", "None", ",", "resume_token", "=", "None", ",", "partition_token", "=", "None", ",",...
85e80125a59cb10f8cb105f25ecc099e4b940b50
train
SpannerClient.commit
Commits a transaction. The request includes the mutations to be applied to rows in the database. ``Commit`` might return an ``ABORTED`` error. This can occur at any time; commonly, the cause is conflicts with concurrent transactions. However, it can also happen for a variety of other re...
spanner/google/cloud/spanner_v1/gapic/spanner_client.py
def commit( self, session, mutations, transaction_id=None, single_use_transaction=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Commits a transaction. The req...
def commit( self, session, mutations, transaction_id=None, single_use_transaction=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Commits a transaction. The req...
[ "Commits", "a", "transaction", ".", "The", "request", "includes", "the", "mutations", "to", "be", "applied", "to", "rows", "in", "the", "database", "." ]
googleapis/google-cloud-python
python
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/gapic/spanner_client.py#L1352-L1460
[ "def", "commit", "(", "self", ",", "session", ",", "mutations", ",", "transaction_id", "=", "None", ",", "single_use_transaction", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=...
85e80125a59cb10f8cb105f25ecc099e4b940b50