id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
28,000
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/table.py
_item_to_row
def _item_to_row(iterator, resource): """Convert a JSON row to the native object. .. note:: This assumes that the ``schema`` attribute has been added to the iterator after being created, which should be done by the caller. :type iterator: :class:`~google.api_core.page_iterator.Ite...
python
def _item_to_row(iterator, resource): """Convert a JSON row to the native object. .. note:: This assumes that the ``schema`` attribute has been added to the iterator after being created, which should be done by the caller. :type iterator: :class:`~google.api_core.page_iterator.Ite...
[ "def", "_item_to_row", "(", "iterator", ",", "resource", ")", ":", "return", "Row", "(", "_helpers", ".", "_row_tuple_from_json", "(", "resource", ",", "iterator", ".", "schema", ")", ",", "iterator", ".", "_field_to_index", ",", ")" ]
Convert a JSON row to the native object. .. note:: This assumes that the ``schema`` attribute has been added to the iterator after being created, which should be done by the caller. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that...
[ "Convert", "a", "JSON", "row", "to", "the", "native", "object", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L1882-L1903
28,001
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/table.py
_table_arg_to_table_ref
def _table_arg_to_table_ref(value, default_project=None): """Helper to convert a string or Table to TableReference. This function keeps TableReference and other kinds of objects unchanged. """ if isinstance(value, six.string_types): value = TableReference.from_string(value, default_project=defa...
python
def _table_arg_to_table_ref(value, default_project=None): """Helper to convert a string or Table to TableReference. This function keeps TableReference and other kinds of objects unchanged. """ if isinstance(value, six.string_types): value = TableReference.from_string(value, default_project=defa...
[ "def", "_table_arg_to_table_ref", "(", "value", ",", "default_project", "=", "None", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "value", "=", "TableReference", ".", "from_string", "(", "value", ",", "default_project"...
Helper to convert a string or Table to TableReference. This function keeps TableReference and other kinds of objects unchanged.
[ "Helper", "to", "convert", "a", "string", "or", "Table", "to", "TableReference", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L1928-L1937
28,002
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/table.py
_table_arg_to_table
def _table_arg_to_table(value, default_project=None): """Helper to convert a string or TableReference to a Table. This function keeps Table and other kinds of objects unchanged. """ if isinstance(value, six.string_types): value = TableReference.from_string(value, default_project=default_project...
python
def _table_arg_to_table(value, default_project=None): """Helper to convert a string or TableReference to a Table. This function keeps Table and other kinds of objects unchanged. """ if isinstance(value, six.string_types): value = TableReference.from_string(value, default_project=default_project...
[ "def", "_table_arg_to_table", "(", "value", ",", "default_project", "=", "None", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "value", "=", "TableReference", ".", "from_string", "(", "value", ",", "default_project", ...
Helper to convert a string or TableReference to a Table. This function keeps Table and other kinds of objects unchanged.
[ "Helper", "to", "convert", "a", "string", "or", "TableReference", "to", "a", "Table", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L1940-L1954
28,003
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/table.py
TableReference.from_string
def from_string(cls, table_id, default_project=None): """Construct a table reference from table ID string. Args: table_id (str): A table ID in standard SQL format. If ``default_project`` is not specified, this must included a project ID, dataset ...
python
def from_string(cls, table_id, default_project=None): """Construct a table reference from table ID string. Args: table_id (str): A table ID in standard SQL format. If ``default_project`` is not specified, this must included a project ID, dataset ...
[ "def", "from_string", "(", "cls", ",", "table_id", ",", "default_project", "=", "None", ")", ":", "from", "google", ".", "cloud", ".", "bigquery", ".", "dataset", "import", "DatasetReference", "(", "output_project_id", ",", "output_dataset_id", ",", "output_tabl...
Construct a table reference from table ID string. Args: table_id (str): A table ID in standard SQL format. If ``default_project`` is not specified, this must included a project ID, dataset ID, and table ID, each separated by ``.``. default...
[ "Construct", "a", "table", "reference", "from", "table", "ID", "string", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L224-L260
28,004
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/table.py
TableReference.to_bqstorage
def to_bqstorage(self): """Construct a BigQuery Storage API representation of this table. Install the ``google-cloud-bigquery-storage`` package to use this feature. If the ``table_id`` contains a partition identifier (e.g. ``my_table$201812``) or a snapshot identifier (e.g. ...
python
def to_bqstorage(self): """Construct a BigQuery Storage API representation of this table. Install the ``google-cloud-bigquery-storage`` package to use this feature. If the ``table_id`` contains a partition identifier (e.g. ``my_table$201812``) or a snapshot identifier (e.g. ...
[ "def", "to_bqstorage", "(", "self", ")", ":", "if", "bigquery_storage_v1beta1", "is", "None", ":", "raise", "ValueError", "(", "_NO_BQSTORAGE_ERROR", ")", "table_ref", "=", "bigquery_storage_v1beta1", ".", "types", ".", "TableReference", "(", ")", "table_ref", "."...
Construct a BigQuery Storage API representation of this table. Install the ``google-cloud-bigquery-storage`` package to use this feature. If the ``table_id`` contains a partition identifier (e.g. ``my_table$201812``) or a snapshot identifier (e.g. ``mytable@1234567890``), it is...
[ "Construct", "a", "BigQuery", "Storage", "API", "representation", "of", "this", "table", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L293-L332
28,005
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/table.py
Row.get
def get(self, key, default=None): """Return a value for key, with a default value if it does not exist. Args: key (str): The key of the column to access default (object): The default value to use if the key does not exist. (Defaults to :data:`None...
python
def get(self, key, default=None): """Return a value for key, with a default value if it does not exist. Args: key (str): The key of the column to access default (object): The default value to use if the key does not exist. (Defaults to :data:`None...
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "index", "=", "self", ".", "_xxx_field_to_index", ".", "get", "(", "key", ")", "if", "index", "is", "None", ":", "return", "default", "return", "self", ".", "_xxx_values", ...
Return a value for key, with a default value if it does not exist. Args: key (str): The key of the column to access default (object): The default value to use if the key does not exist. (Defaults to :data:`None`.) Returns: object: ...
[ "Return", "a", "value", "for", "key", "with", "a", "default", "value", "if", "it", "does", "not", "exist", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L1213-L1248
28,006
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/table.py
RowIterator._get_progress_bar
def _get_progress_bar(self, progress_bar_type): """Construct a tqdm progress bar object, if tqdm is installed.""" if tqdm is None: if progress_bar_type is not None: warnings.warn(_NO_TQDM_ERROR, UserWarning, stacklevel=3) return None description = "Downlo...
python
def _get_progress_bar(self, progress_bar_type): """Construct a tqdm progress bar object, if tqdm is installed.""" if tqdm is None: if progress_bar_type is not None: warnings.warn(_NO_TQDM_ERROR, UserWarning, stacklevel=3) return None description = "Downlo...
[ "def", "_get_progress_bar", "(", "self", ",", "progress_bar_type", ")", ":", "if", "tqdm", "is", "None", ":", "if", "progress_bar_type", "is", "not", "None", ":", "warnings", ".", "warn", "(", "_NO_TQDM_ERROR", ",", "UserWarning", ",", "stacklevel", "=", "3"...
Construct a tqdm progress bar object, if tqdm is installed.
[ "Construct", "a", "tqdm", "progress", "bar", "object", "if", "tqdm", "is", "installed", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L1582-L1606
28,007
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/table.py
RowIterator.to_dataframe
def to_dataframe(self, bqstorage_client=None, dtypes=None, progress_bar_type=None): """Create a pandas DataFrame by loading all pages of a query. Args: bqstorage_client ( \ google.cloud.bigquery_storage_v1beta1.BigQueryStorageClient \ ): **Beta Fe...
python
def to_dataframe(self, bqstorage_client=None, dtypes=None, progress_bar_type=None): """Create a pandas DataFrame by loading all pages of a query. Args: bqstorage_client ( \ google.cloud.bigquery_storage_v1beta1.BigQueryStorageClient \ ): **Beta Fe...
[ "def", "to_dataframe", "(", "self", ",", "bqstorage_client", "=", "None", ",", "dtypes", "=", "None", ",", "progress_bar_type", "=", "None", ")", ":", "if", "pandas", "is", "None", ":", "raise", "ValueError", "(", "_NO_PANDAS_ERROR", ")", "if", "dtypes", "...
Create a pandas DataFrame by loading all pages of a query. Args: bqstorage_client ( \ google.cloud.bigquery_storage_v1beta1.BigQueryStorageClient \ ): **Beta Feature** Optional. A BigQuery Storage API client. If supplied, use the faster Bi...
[ "Create", "a", "pandas", "DataFrame", "by", "loading", "all", "pages", "of", "a", "query", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L1608-L1695
28,008
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/table.py
_EmptyRowIterator.to_dataframe
def to_dataframe(self, bqstorage_client=None, dtypes=None, progress_bar_type=None): """Create an empty dataframe. Args: bqstorage_client (Any): Ignored. Added for compatibility with RowIterator. dtypes (Any): Ignored. Added for compatibility with ...
python
def to_dataframe(self, bqstorage_client=None, dtypes=None, progress_bar_type=None): """Create an empty dataframe. Args: bqstorage_client (Any): Ignored. Added for compatibility with RowIterator. dtypes (Any): Ignored. Added for compatibility with ...
[ "def", "to_dataframe", "(", "self", ",", "bqstorage_client", "=", "None", ",", "dtypes", "=", "None", ",", "progress_bar_type", "=", "None", ")", ":", "if", "pandas", "is", "None", ":", "raise", "ValueError", "(", "_NO_PANDAS_ERROR", ")", "return", "pandas",...
Create an empty dataframe. Args: bqstorage_client (Any): Ignored. Added for compatibility with RowIterator. dtypes (Any): Ignored. Added for compatibility with RowIterator. progress_bar_type (Any): Ignored. Added for compatibil...
[ "Create", "an", "empty", "dataframe", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L1710-L1727
28,009
googleapis/google-cloud-python
storage/google/cloud/storage/batch.py
Batch._prepare_batch_request
def _prepare_batch_request(self): """Prepares headers and body for a batch request. :rtype: tuple (dict, str) :returns: The pair of headers and body of the batch request to be sent. :raises: :class:`ValueError` if no requests have been deferred. """ if len(self._requests...
python
def _prepare_batch_request(self): """Prepares headers and body for a batch request. :rtype: tuple (dict, str) :returns: The pair of headers and body of the batch request to be sent. :raises: :class:`ValueError` if no requests have been deferred. """ if len(self._requests...
[ "def", "_prepare_batch_request", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_requests", ")", "==", "0", ":", "raise", "ValueError", "(", "\"No deferred requests\"", ")", "multi", "=", "MIMEMultipart", "(", ")", "for", "method", ",", "uri", ",",...
Prepares headers and body for a batch request. :rtype: tuple (dict, str) :returns: The pair of headers and body of the batch request to be sent. :raises: :class:`ValueError` if no requests have been deferred.
[ "Prepares", "headers", "and", "body", "for", "a", "batch", "request", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/batch.py#L191-L218
28,010
googleapis/google-cloud-python
storage/google/cloud/storage/batch.py
Batch._finish_futures
def _finish_futures(self, responses): """Apply all the batch responses to the futures created. :type responses: list of (headers, payload) tuples. :param responses: List of headers and payloads from each response in the batch. :raises: :class:`ValueError` if n...
python
def _finish_futures(self, responses): """Apply all the batch responses to the futures created. :type responses: list of (headers, payload) tuples. :param responses: List of headers and payloads from each response in the batch. :raises: :class:`ValueError` if n...
[ "def", "_finish_futures", "(", "self", ",", "responses", ")", ":", "# If a bad status occurs, we track it, but don't raise an exception", "# until all futures have been populated.", "exception_args", "=", "None", "if", "len", "(", "self", ".", "_target_objects", ")", "!=", ...
Apply all the batch responses to the futures created. :type responses: list of (headers, payload) tuples. :param responses: List of headers and payloads from each response in the batch. :raises: :class:`ValueError` if no requests have been deferred.
[ "Apply", "all", "the", "batch", "responses", "to", "the", "futures", "created", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/batch.py#L220-L246
28,011
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/snapshot.py
_SnapshotBase.read
def read(self, table, columns, keyset, index="", limit=0, partition=None): """Perform a ``StreamingRead`` API request for rows in a table. :type table: str :param table: name of the table from which to fetch data :type columns: list of str :param columns: names of columns to be...
python
def read(self, table, columns, keyset, index="", limit=0, partition=None): """Perform a ``StreamingRead`` API request for rows in a table. :type table: str :param table: name of the table from which to fetch data :type columns: list of str :param columns: names of columns to be...
[ "def", "read", "(", "self", ",", "table", ",", "columns", ",", "keyset", ",", "index", "=", "\"\"", ",", "limit", "=", "0", ",", "partition", "=", "None", ")", ":", "if", "self", ".", "_read_request_count", ">", "0", ":", "if", "not", "self", ".", ...
Perform a ``StreamingRead`` API request for rows in a table. :type table: str :param table: name of the table from which to fetch data :type columns: list of str :param columns: names of columns to be retrieved :type keyset: :class:`~google.cloud.spanner_v1.keyset.KeySet` ...
[ "Perform", "a", "StreamingRead", "API", "request", "for", "rows", "in", "a", "table", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/snapshot.py#L89-L152
28,012
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/snapshot.py
_SnapshotBase.execute_sql
def execute_sql( self, sql, params=None, param_types=None, query_mode=None, partition=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, ): """Perform an ``ExecuteStreamingSql`` API request. ...
python
def execute_sql( self, sql, params=None, param_types=None, query_mode=None, partition=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, ): """Perform an ``ExecuteStreamingSql`` API request. ...
[ "def", "execute_sql", "(", "self", ",", "sql", ",", "params", "=", "None", ",", "param_types", "=", "None", ",", "query_mode", "=", "None", ",", "partition", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", "."...
Perform an ``ExecuteStreamingSql`` API request. :type sql: str :param sql: SQL query statement :type params: dict, {str -> column value} :param params: values for parameter replacement. Keys must match the names used in ``sql``. :type param_types: dict[...
[ "Perform", "an", "ExecuteStreamingSql", "API", "request", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/snapshot.py#L154-L237
28,013
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/snapshot.py
_SnapshotBase.partition_read
def partition_read( self, table, columns, keyset, index="", partition_size_bytes=None, max_partitions=None, ): """Perform a ``ParitionRead`` API request for rows in a table. :type table: str :param table: name of the table from which t...
python
def partition_read( self, table, columns, keyset, index="", partition_size_bytes=None, max_partitions=None, ): """Perform a ``ParitionRead`` API request for rows in a table. :type table: str :param table: name of the table from which t...
[ "def", "partition_read", "(", "self", ",", "table", ",", "columns", ",", "keyset", ",", "index", "=", "\"\"", ",", "partition_size_bytes", "=", "None", ",", "max_partitions", "=", "None", ",", ")", ":", "if", "not", "self", ".", "_multi_use", ":", "raise...
Perform a ``ParitionRead`` API request for rows in a table. :type table: str :param table: name of the table from which to fetch data :type columns: list of str :param columns: names of columns to be retrieved :type keyset: :class:`~google.cloud.spanner_v1.keyset.KeySet` ...
[ "Perform", "a", "ParitionRead", "API", "request", "for", "rows", "in", "a", "table", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/snapshot.py#L239-L306
28,014
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/snapshot.py
_SnapshotBase.partition_query
def partition_query( self, sql, params=None, param_types=None, partition_size_bytes=None, max_partitions=None, ): """Perform a ``ParitionQuery`` API request. :type sql: str :param sql: SQL query statement :type params: dict, {str -> c...
python
def partition_query( self, sql, params=None, param_types=None, partition_size_bytes=None, max_partitions=None, ): """Perform a ``ParitionQuery`` API request. :type sql: str :param sql: SQL query statement :type params: dict, {str -> c...
[ "def", "partition_query", "(", "self", ",", "sql", ",", "params", "=", "None", ",", "param_types", "=", "None", ",", "partition_size_bytes", "=", "None", ",", "max_partitions", "=", "None", ",", ")", ":", "if", "not", "self", ".", "_multi_use", ":", "rai...
Perform a ``ParitionQuery`` API request. :type sql: str :param sql: SQL query statement :type params: dict, {str -> column value} :param params: values for parameter replacement. Keys must match the names used in ``sql``. :type param_types: dict[str -> ...
[ "Perform", "a", "ParitionQuery", "API", "request", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/snapshot.py#L308-L381
28,015
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/snapshot.py
Snapshot.begin
def begin(self): """Begin a read-only transaction on the database. :rtype: bytes :returns: the ID for the newly-begun transaction. :raises ValueError: if the transaction is already begun, committed, or rolled back. """ if not self._multi_use: rai...
python
def begin(self): """Begin a read-only transaction on the database. :rtype: bytes :returns: the ID for the newly-begun transaction. :raises ValueError: if the transaction is already begun, committed, or rolled back. """ if not self._multi_use: rai...
[ "def", "begin", "(", "self", ")", ":", "if", "not", "self", ".", "_multi_use", ":", "raise", "ValueError", "(", "\"Cannot call 'begin' on single-use snapshots\"", ")", "if", "self", ".", "_transaction_id", "is", "not", "None", ":", "raise", "ValueError", "(", ...
Begin a read-only transaction on the database. :rtype: bytes :returns: the ID for the newly-begun transaction. :raises ValueError: if the transaction is already begun, committed, or rolled back.
[ "Begin", "a", "read", "-", "only", "transaction", "on", "the", "database", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/snapshot.py#L479-L505
28,016
googleapis/google-cloud-python
api_core/google/api_core/gapic_v1/client_info.py
ClientInfo.to_user_agent
def to_user_agent(self): """Returns the user-agent string for this client info.""" # Note: the order here is important as the internal metrics system # expects these items to be in specific locations. ua = "" if self.user_agent is not None: ua += "{user_agent} " ...
python
def to_user_agent(self): """Returns the user-agent string for this client info.""" # Note: the order here is important as the internal metrics system # expects these items to be in specific locations. ua = "" if self.user_agent is not None: ua += "{user_agent} " ...
[ "def", "to_user_agent", "(", "self", ")", ":", "# Note: the order here is important as the internal metrics system", "# expects these items to be in specific locations.", "ua", "=", "\"\"", "if", "self", ".", "user_agent", "is", "not", "None", ":", "ua", "+=", "\"{user_agen...
Returns the user-agent string for this client info.
[ "Returns", "the", "user", "-", "agent", "string", "for", "this", "client", "info", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/gapic_v1/client_info.py#L75-L98
28,017
googleapis/google-cloud-python
trace/google/cloud/trace/v1/_gapic.py
make_trace_api
def make_trace_api(client): """ Create an instance of the gapic Trace API. Args: client (~google.cloud.trace.client.Client): The client that holds configuration details. Returns: A :class:`~google.cloud.trace._gapic._TraceAPI` instance with the proper configurations...
python
def make_trace_api(client): """ Create an instance of the gapic Trace API. Args: client (~google.cloud.trace.client.Client): The client that holds configuration details. Returns: A :class:`~google.cloud.trace._gapic._TraceAPI` instance with the proper configurations...
[ "def", "make_trace_api", "(", "client", ")", ":", "generated", "=", "trace_service_client", ".", "TraceServiceClient", "(", "credentials", "=", "client", ".", "_credentials", ",", "client_info", "=", "_CLIENT_INFO", ")", "return", "_TraceAPI", "(", "generated", ",...
Create an instance of the gapic Trace API. Args: client (~google.cloud.trace.client.Client): The client that holds configuration details. Returns: A :class:`~google.cloud.trace._gapic._TraceAPI` instance with the proper configurations.
[ "Create", "an", "instance", "of", "the", "gapic", "Trace", "API", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/trace/google/cloud/trace/v1/_gapic.py#L168-L183
28,018
googleapis/google-cloud-python
storage/google/cloud/storage/client.py
_item_to_bucket
def _item_to_bucket(iterator, item): """Convert a JSON bucket to the native object. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that has retrieved the item. :type item: dict :param item: An item to be converted to a bucket. :rtype: :class:`.B...
python
def _item_to_bucket(iterator, item): """Convert a JSON bucket to the native object. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that has retrieved the item. :type item: dict :param item: An item to be converted to a bucket. :rtype: :class:`.B...
[ "def", "_item_to_bucket", "(", "iterator", ",", "item", ")", ":", "name", "=", "item", ".", "get", "(", "\"name\"", ")", "bucket", "=", "Bucket", "(", "iterator", ".", "client", ",", "name", ")", "bucket", ".", "_set_properties", "(", "item", ")", "ret...
Convert a JSON bucket to the native object. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that has retrieved the item. :type item: dict :param item: An item to be converted to a bucket. :rtype: :class:`.Bucket` :returns: The next bucket in the ...
[ "Convert", "a", "JSON", "bucket", "to", "the", "native", "object", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/client.py#L374-L389
28,019
googleapis/google-cloud-python
storage/google/cloud/storage/client.py
Client.get_service_account_email
def get_service_account_email(self, project=None): """Get the email address of the project's GCS service account :type project: str :param project: (Optional) Project ID to use for retreiving GCS service account email address. Defaults to the client's project. ...
python
def get_service_account_email(self, project=None): """Get the email address of the project's GCS service account :type project: str :param project: (Optional) Project ID to use for retreiving GCS service account email address. Defaults to the client's project. ...
[ "def", "get_service_account_email", "(", "self", ",", "project", "=", "None", ")", ":", "if", "project", "is", "None", ":", "project", "=", "self", ".", "project", "path", "=", "\"/projects/%s/serviceAccount\"", "%", "(", "project", ",", ")", "api_response", ...
Get the email address of the project's GCS service account :type project: str :param project: (Optional) Project ID to use for retreiving GCS service account email address. Defaults to the client's project. :rtype: str :returns: service account email address
[ "Get", "the", "email", "address", "of", "the", "project", "s", "GCS", "service", "account" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/client.py#L157-L172
28,020
googleapis/google-cloud-python
storage/google/cloud/storage/client.py
Client.bucket
def bucket(self, bucket_name, user_project=None): """Factory constructor for bucket object. .. note:: This will not make an HTTP request; it simply instantiates a bucket object owned by this client. :type bucket_name: str :param bucket_name: The name of the bucket t...
python
def bucket(self, bucket_name, user_project=None): """Factory constructor for bucket object. .. note:: This will not make an HTTP request; it simply instantiates a bucket object owned by this client. :type bucket_name: str :param bucket_name: The name of the bucket t...
[ "def", "bucket", "(", "self", ",", "bucket_name", ",", "user_project", "=", "None", ")", ":", "return", "Bucket", "(", "client", "=", "self", ",", "name", "=", "bucket_name", ",", "user_project", "=", "user_project", ")" ]
Factory constructor for bucket object. .. note:: This will not make an HTTP request; it simply instantiates a bucket object owned by this client. :type bucket_name: str :param bucket_name: The name of the bucket to be instantiated. :type user_project: str :...
[ "Factory", "constructor", "for", "bucket", "object", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/client.py#L174-L191
28,021
googleapis/google-cloud-python
storage/google/cloud/storage/client.py
Client.get_bucket
def get_bucket(self, bucket_name): """Get a bucket by name. If the bucket isn't found, this will raise a :class:`google.cloud.exceptions.NotFound`. For example: .. literalinclude:: snippets.py :start-after: [START get_bucket] :end-before: [END get_bucke...
python
def get_bucket(self, bucket_name): """Get a bucket by name. If the bucket isn't found, this will raise a :class:`google.cloud.exceptions.NotFound`. For example: .. literalinclude:: snippets.py :start-after: [START get_bucket] :end-before: [END get_bucke...
[ "def", "get_bucket", "(", "self", ",", "bucket_name", ")", ":", "bucket", "=", "Bucket", "(", "self", ",", "name", "=", "bucket_name", ")", "bucket", ".", "reload", "(", "client", "=", "self", ")", "return", "bucket" ]
Get a bucket by name. If the bucket isn't found, this will raise a :class:`google.cloud.exceptions.NotFound`. For example: .. literalinclude:: snippets.py :start-after: [START get_bucket] :end-before: [END get_bucket] This implements "storage.buckets.g...
[ "Get", "a", "bucket", "by", "name", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/client.py#L205-L228
28,022
googleapis/google-cloud-python
storage/google/cloud/storage/client.py
Client.list_buckets
def list_buckets( self, max_results=None, page_token=None, prefix=None, projection="noAcl", fields=None, project=None, ): """Get all buckets in the project associated to the client. This will not populate the list of blobs available in each ...
python
def list_buckets( self, max_results=None, page_token=None, prefix=None, projection="noAcl", fields=None, project=None, ): """Get all buckets in the project associated to the client. This will not populate the list of blobs available in each ...
[ "def", "list_buckets", "(", "self", ",", "max_results", "=", "None", ",", "page_token", "=", "None", ",", "prefix", "=", "None", ",", "projection", "=", "\"noAcl\"", ",", "fields", "=", "None", ",", "project", "=", "None", ",", ")", ":", "if", "project...
Get all buckets in the project associated to the client. This will not populate the list of blobs available in each bucket. .. literalinclude:: snippets.py :start-after: [START list_buckets] :end-before: [END list_buckets] This implements "storage.buckets.list"...
[ "Get", "all", "buckets", "in", "the", "project", "associated", "to", "the", "client", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/client.py#L290-L371
28,023
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
_make_job_id
def _make_job_id(job_id, prefix=None): """Construct an ID for a new job. :type job_id: str or ``NoneType`` :param job_id: the user-provided job ID :type prefix: str or ``NoneType`` :param prefix: (Optional) the user-provided prefix for a job ID :rtype: str :returns: A job ID """ i...
python
def _make_job_id(job_id, prefix=None): """Construct an ID for a new job. :type job_id: str or ``NoneType`` :param job_id: the user-provided job ID :type prefix: str or ``NoneType`` :param prefix: (Optional) the user-provided prefix for a job ID :rtype: str :returns: A job ID """ i...
[ "def", "_make_job_id", "(", "job_id", ",", "prefix", "=", "None", ")", ":", "if", "job_id", "is", "not", "None", ":", "return", "job_id", "elif", "prefix", "is", "not", "None", ":", "return", "str", "(", "prefix", ")", "+", "str", "(", "uuid", ".", ...
Construct an ID for a new job. :type job_id: str or ``NoneType`` :param job_id: the user-provided job ID :type prefix: str or ``NoneType`` :param prefix: (Optional) the user-provided prefix for a job ID :rtype: str :returns: A job ID
[ "Construct", "an", "ID", "for", "a", "new", "job", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L2059-L2076
28,024
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
_check_mode
def _check_mode(stream): """Check that a stream was opened in read-binary mode. :type stream: IO[bytes] :param stream: A bytes IO object open for reading. :raises: :exc:`ValueError` if the ``stream.mode`` is a valid attribute and is not among ``rb``, ``r+b`` or ``rb+``. """ mode =...
python
def _check_mode(stream): """Check that a stream was opened in read-binary mode. :type stream: IO[bytes] :param stream: A bytes IO object open for reading. :raises: :exc:`ValueError` if the ``stream.mode`` is a valid attribute and is not among ``rb``, ``r+b`` or ``rb+``. """ mode =...
[ "def", "_check_mode", "(", "stream", ")", ":", "mode", "=", "getattr", "(", "stream", ",", "\"mode\"", ",", "None", ")", "if", "isinstance", "(", "stream", ",", "gzip", ".", "GzipFile", ")", ":", "if", "mode", "!=", "gzip", ".", "READ", ":", "raise",...
Check that a stream was opened in read-binary mode. :type stream: IO[bytes] :param stream: A bytes IO object open for reading. :raises: :exc:`ValueError` if the ``stream.mode`` is a valid attribute and is not among ``rb``, ``r+b`` or ``rb+``.
[ "Check", "that", "a", "stream", "was", "opened", "in", "read", "-", "binary", "mode", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L2079-L2101
28,025
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.get_service_account_email
def get_service_account_email(self, project=None): """Get the email address of the project's BigQuery service account Note: This is the service account that BigQuery uses to manage tables encrypted by a key in KMS. Args: project (str, optional): ...
python
def get_service_account_email(self, project=None): """Get the email address of the project's BigQuery service account Note: This is the service account that BigQuery uses to manage tables encrypted by a key in KMS. Args: project (str, optional): ...
[ "def", "get_service_account_email", "(", "self", ",", "project", "=", "None", ")", ":", "if", "project", "is", "None", ":", "project", "=", "self", ".", "project", "path", "=", "\"/projects/%s/serviceAccount\"", "%", "(", "project", ",", ")", "api_response", ...
Get the email address of the project's BigQuery service account Note: This is the service account that BigQuery uses to manage tables encrypted by a key in KMS. Args: project (str, optional): Project ID to use for retreiving service account email. ...
[ "Get", "the", "email", "address", "of", "the", "project", "s", "BigQuery", "service", "account" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L164-L191
28,026
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.list_projects
def list_projects(self, max_results=None, page_token=None, retry=DEFAULT_RETRY): """List projects for the project associated with this client. See https://cloud.google.com/bigquery/docs/reference/rest/v2/projects/list :type max_results: int :param max_results: (Optional) maximu...
python
def list_projects(self, max_results=None, page_token=None, retry=DEFAULT_RETRY): """List projects for the project associated with this client. See https://cloud.google.com/bigquery/docs/reference/rest/v2/projects/list :type max_results: int :param max_results: (Optional) maximu...
[ "def", "list_projects", "(", "self", ",", "max_results", "=", "None", ",", "page_token", "=", "None", ",", "retry", "=", "DEFAULT_RETRY", ")", ":", "return", "page_iterator", ".", "HTTPIterator", "(", "client", "=", "self", ",", "api_request", "=", "functool...
List projects for the project associated with this client. See https://cloud.google.com/bigquery/docs/reference/rest/v2/projects/list :type max_results: int :param max_results: (Optional) maximum number of projects to return, If not passed, defaults to a val...
[ "List", "projects", "for", "the", "project", "associated", "with", "this", "client", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L193-L227
28,027
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.list_datasets
def list_datasets( self, project=None, include_all=False, filter=None, max_results=None, page_token=None, retry=DEFAULT_RETRY, ): """List datasets for the project associated with this client. See https://cloud.google.com/bigquery/docs/...
python
def list_datasets( self, project=None, include_all=False, filter=None, max_results=None, page_token=None, retry=DEFAULT_RETRY, ): """List datasets for the project associated with this client. See https://cloud.google.com/bigquery/docs/...
[ "def", "list_datasets", "(", "self", ",", "project", "=", "None", ",", "include_all", "=", "False", ",", "filter", "=", "None", ",", "max_results", "=", "None", ",", "page_token", "=", "None", ",", "retry", "=", "DEFAULT_RETRY", ",", ")", ":", "extra_par...
List datasets for the project associated with this client. See https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/list Args: project (str): Optional. Project ID to use for retreiving datasets. Defaults to the client's project. ...
[ "List", "datasets", "for", "the", "project", "associated", "with", "this", "client", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L229-L291
28,028
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.dataset
def dataset(self, dataset_id, project=None): """Construct a reference to a dataset. :type dataset_id: str :param dataset_id: ID of the dataset. :type project: str :param project: (Optional) project ID for the dataset (defaults to the project of the clien...
python
def dataset(self, dataset_id, project=None): """Construct a reference to a dataset. :type dataset_id: str :param dataset_id: ID of the dataset. :type project: str :param project: (Optional) project ID for the dataset (defaults to the project of the clien...
[ "def", "dataset", "(", "self", ",", "dataset_id", ",", "project", "=", "None", ")", ":", "if", "project", "is", "None", ":", "project", "=", "self", ".", "project", "return", "DatasetReference", "(", "project", ",", "dataset_id", ")" ]
Construct a reference to a dataset. :type dataset_id: str :param dataset_id: ID of the dataset. :type project: str :param project: (Optional) project ID for the dataset (defaults to the project of the client). :rtype: :class:`google.cloud.bigquery.datas...
[ "Construct", "a", "reference", "to", "a", "dataset", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L293-L309
28,029
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.get_dataset
def get_dataset(self, dataset_ref, retry=DEFAULT_RETRY): """Fetch the dataset referenced by ``dataset_ref`` Args: dataset_ref (Union[ \ :class:`~google.cloud.bigquery.dataset.DatasetReference`, \ str, \ ]): A reference to the datas...
python
def get_dataset(self, dataset_ref, retry=DEFAULT_RETRY): """Fetch the dataset referenced by ``dataset_ref`` Args: dataset_ref (Union[ \ :class:`~google.cloud.bigquery.dataset.DatasetReference`, \ str, \ ]): A reference to the datas...
[ "def", "get_dataset", "(", "self", ",", "dataset_ref", ",", "retry", "=", "DEFAULT_RETRY", ")", ":", "if", "isinstance", "(", "dataset_ref", ",", "str", ")", ":", "dataset_ref", "=", "DatasetReference", ".", "from_string", "(", "dataset_ref", ",", "default_pro...
Fetch the dataset referenced by ``dataset_ref`` Args: dataset_ref (Union[ \ :class:`~google.cloud.bigquery.dataset.DatasetReference`, \ str, \ ]): A reference to the dataset to fetch from the BigQuery API. If a string is pa...
[ "Fetch", "the", "dataset", "referenced", "by", "dataset_ref" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L409-L434
28,030
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.get_table
def get_table(self, table, retry=DEFAULT_RETRY): """Fetch the table referenced by ``table``. Args: table (Union[ \ :class:`~google.cloud.bigquery.table.Table`, \ :class:`~google.cloud.bigquery.table.TableReference`, \ str, \ ]): ...
python
def get_table(self, table, retry=DEFAULT_RETRY): """Fetch the table referenced by ``table``. Args: table (Union[ \ :class:`~google.cloud.bigquery.table.Table`, \ :class:`~google.cloud.bigquery.table.TableReference`, \ str, \ ]): ...
[ "def", "get_table", "(", "self", ",", "table", ",", "retry", "=", "DEFAULT_RETRY", ")", ":", "table_ref", "=", "_table_arg_to_table_ref", "(", "table", ",", "default_project", "=", "self", ".", "project", ")", "api_response", "=", "self", ".", "_call_api", "...
Fetch the table referenced by ``table``. Args: table (Union[ \ :class:`~google.cloud.bigquery.table.Table`, \ :class:`~google.cloud.bigquery.table.TableReference`, \ str, \ ]): A reference to the table to fetch from the Big...
[ "Fetch", "the", "table", "referenced", "by", "table", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L463-L485
28,031
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.update_dataset
def update_dataset(self, dataset, fields, retry=DEFAULT_RETRY): """Change some fields of a dataset. Use ``fields`` to specify which fields to update. At least one field must be provided. If a field is listed in ``fields`` and is ``None`` in ``dataset``, it will be deleted. If `...
python
def update_dataset(self, dataset, fields, retry=DEFAULT_RETRY): """Change some fields of a dataset. Use ``fields`` to specify which fields to update. At least one field must be provided. If a field is listed in ``fields`` and is ``None`` in ``dataset``, it will be deleted. If `...
[ "def", "update_dataset", "(", "self", ",", "dataset", ",", "fields", ",", "retry", "=", "DEFAULT_RETRY", ")", ":", "partial", "=", "dataset", ".", "_build_resource", "(", "fields", ")", "if", "dataset", ".", "etag", "is", "not", "None", ":", "headers", "...
Change some fields of a dataset. Use ``fields`` to specify which fields to update. At least one field must be provided. If a field is listed in ``fields`` and is ``None`` in ``dataset``, it will be deleted. If ``dataset.etag`` is not ``None``, the update will only succeed if th...
[ "Change", "some", "fields", "of", "a", "dataset", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L487-L521
28,032
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.update_table
def update_table(self, table, fields, retry=DEFAULT_RETRY): """Change some fields of a table. Use ``fields`` to specify which fields to update. At least one field must be provided. If a field is listed in ``fields`` and is ``None`` in ``table``, it will be deleted. If ``table.e...
python
def update_table(self, table, fields, retry=DEFAULT_RETRY): """Change some fields of a table. Use ``fields`` to specify which fields to update. At least one field must be provided. If a field is listed in ``fields`` and is ``None`` in ``table``, it will be deleted. If ``table.e...
[ "def", "update_table", "(", "self", ",", "table", ",", "fields", ",", "retry", "=", "DEFAULT_RETRY", ")", ":", "partial", "=", "table", ".", "_build_resource", "(", "fields", ")", "if", "table", ".", "etag", "is", "not", "None", ":", "headers", "=", "{...
Change some fields of a table. Use ``fields`` to specify which fields to update. At least one field must be provided. If a field is listed in ``fields`` and is ``None`` in ``table``, it will be deleted. If ``table.etag`` is not ``None``, the update will only succeed if the tabl...
[ "Change", "some", "fields", "of", "a", "table", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L558-L591
28,033
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client._get_query_results
def _get_query_results( self, job_id, retry, project=None, timeout_ms=None, location=None ): """Get the query results object for a query job. Arguments: job_id (str): Name of the query job. retry (google.api_core.retry.Retry): (Optional) How to retry ...
python
def _get_query_results( self, job_id, retry, project=None, timeout_ms=None, location=None ): """Get the query results object for a query job. Arguments: job_id (str): Name of the query job. retry (google.api_core.retry.Retry): (Optional) How to retry ...
[ "def", "_get_query_results", "(", "self", ",", "job_id", ",", "retry", ",", "project", "=", "None", ",", "timeout_ms", "=", "None", ",", "location", "=", "None", ")", ":", "extra_params", "=", "{", "\"maxResults\"", ":", "0", "}", "if", "project", "is", ...
Get the query results object for a query job. Arguments: job_id (str): Name of the query job. retry (google.api_core.retry.Retry): (Optional) How to retry the RPC. project (str): (Optional) project ID for the query job (defaults to the ...
[ "Get", "the", "query", "results", "object", "for", "a", "query", "job", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L823-L867
28,034
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.job_from_resource
def job_from_resource(self, resource): """Detect correct job type from resource and instantiate. :type resource: dict :param resource: one job resource from API response :rtype: One of: :class:`google.cloud.bigquery.job.LoadJob`, :class:`google.cloud.big...
python
def job_from_resource(self, resource): """Detect correct job type from resource and instantiate. :type resource: dict :param resource: one job resource from API response :rtype: One of: :class:`google.cloud.bigquery.job.LoadJob`, :class:`google.cloud.big...
[ "def", "job_from_resource", "(", "self", ",", "resource", ")", ":", "config", "=", "resource", ".", "get", "(", "\"configuration\"", ",", "{", "}", ")", "if", "\"load\"", "in", "config", ":", "return", "job", ".", "LoadJob", ".", "from_api_repr", "(", "r...
Detect correct job type from resource and instantiate. :type resource: dict :param resource: one job resource from API response :rtype: One of: :class:`google.cloud.bigquery.job.LoadJob`, :class:`google.cloud.bigquery.job.CopyJob`, :class:`google...
[ "Detect", "correct", "job", "type", "from", "resource", "and", "instantiate", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L869-L891
28,035
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.cancel_job
def cancel_job(self, job_id, project=None, location=None, retry=DEFAULT_RETRY): """Attempt to cancel a job from a job ID. See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/cancel Arguments: job_id (str): Unique job identifier. Keyword Arguments: ...
python
def cancel_job(self, job_id, project=None, location=None, retry=DEFAULT_RETRY): """Attempt to cancel a job from a job ID. See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/cancel Arguments: job_id (str): Unique job identifier. Keyword Arguments: ...
[ "def", "cancel_job", "(", "self", ",", "job_id", ",", "project", "=", "None", ",", "location", "=", "None", ",", "retry", "=", "DEFAULT_RETRY", ")", ":", "extra_params", "=", "{", "\"projection\"", ":", "\"full\"", "}", "if", "project", "is", "None", ":"...
Attempt to cancel a job from a job ID. See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/cancel Arguments: job_id (str): Unique job identifier. Keyword Arguments: project (str): (Optional) ID of the project which owns the job (de...
[ "Attempt", "to", "cancel", "a", "job", "from", "a", "job", "ID", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L936-L977
28,036
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.list_jobs
def list_jobs( self, project=None, max_results=None, page_token=None, all_users=None, state_filter=None, retry=DEFAULT_RETRY, min_creation_time=None, max_creation_time=None, ): """List jobs for the project associated with this client. ...
python
def list_jobs( self, project=None, max_results=None, page_token=None, all_users=None, state_filter=None, retry=DEFAULT_RETRY, min_creation_time=None, max_creation_time=None, ): """List jobs for the project associated with this client. ...
[ "def", "list_jobs", "(", "self", ",", "project", "=", "None", ",", "max_results", "=", "None", ",", "page_token", "=", "None", ",", "all_users", "=", "None", ",", "state_filter", "=", "None", ",", "retry", "=", "DEFAULT_RETRY", ",", "min_creation_time", "=...
List jobs for the project associated with this client. See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/list Args: project (str, optional): Project ID to use for retreiving datasets. Defaults to the client's project. max_...
[ "List", "jobs", "for", "the", "project", "associated", "with", "this", "client", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L979-L1060
28,037
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.load_table_from_uri
def load_table_from_uri( self, source_uris, destination, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None, retry=DEFAULT_RETRY, ): """Starts a job for loading data into a table from CloudStorage. Se...
python
def load_table_from_uri( self, source_uris, destination, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None, retry=DEFAULT_RETRY, ): """Starts a job for loading data into a table from CloudStorage. Se...
[ "def", "load_table_from_uri", "(", "self", ",", "source_uris", ",", "destination", ",", "job_id", "=", "None", ",", "job_id_prefix", "=", "None", ",", "location", "=", "None", ",", "project", "=", "None", ",", "job_config", "=", "None", ",", "retry", "=", ...
Starts a job for loading data into a table from CloudStorage. See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.load Arguments: source_uris (Union[str, Sequence[str]]): URIs of data files to be loaded; in format ``gs://<...
[ "Starts", "a", "job", "for", "loading", "data", "into", "a", "table", "from", "CloudStorage", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1062-L1129
28,038
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.load_table_from_file
def load_table_from_file( self, file_obj, destination, rewind=False, size=None, num_retries=_DEFAULT_NUM_RETRIES, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None, ): """Upload the contents o...
python
def load_table_from_file( self, file_obj, destination, rewind=False, size=None, num_retries=_DEFAULT_NUM_RETRIES, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None, ): """Upload the contents o...
[ "def", "load_table_from_file", "(", "self", ",", "file_obj", ",", "destination", ",", "rewind", "=", "False", ",", "size", "=", "None", ",", "num_retries", "=", "_DEFAULT_NUM_RETRIES", ",", "job_id", "=", "None", ",", "job_id_prefix", "=", "None", ",", "loca...
Upload the contents of this table from a file-like object. Similar to :meth:`load_table_from_uri`, this method creates, starts and returns a :class:`~google.cloud.bigquery.job.LoadJob`. Arguments: file_obj (file): A file handle opened in binary mode for reading. destina...
[ "Upload", "the", "contents", "of", "this", "table", "from", "a", "file", "-", "like", "object", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1131-L1223
28,039
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.load_table_from_dataframe
def load_table_from_dataframe( self, dataframe, destination, num_retries=_DEFAULT_NUM_RETRIES, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None, ): """Upload the contents of a table from a pandas DataFrame. ...
python
def load_table_from_dataframe( self, dataframe, destination, num_retries=_DEFAULT_NUM_RETRIES, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None, ): """Upload the contents of a table from a pandas DataFrame. ...
[ "def", "load_table_from_dataframe", "(", "self", ",", "dataframe", ",", "destination", ",", "num_retries", "=", "_DEFAULT_NUM_RETRIES", ",", "job_id", "=", "None", ",", "job_id_prefix", "=", "None", ",", "location", "=", "None", ",", "project", "=", "None", ",...
Upload the contents of a table from a pandas DataFrame. Similar to :meth:`load_table_from_uri`, this method creates, starts and returns a :class:`~google.cloud.bigquery.job.LoadJob`. Arguments: dataframe (pandas.DataFrame): A :class:`~pandas.DataFrame` containing th...
[ "Upload", "the", "contents", "of", "a", "table", "from", "a", "pandas", "DataFrame", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1225-L1309
28,040
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.copy_table
def copy_table( self, sources, destination, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None, retry=DEFAULT_RETRY, ): """Copy one or more tables to another table. See https://cloud.google.co...
python
def copy_table( self, sources, destination, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None, retry=DEFAULT_RETRY, ): """Copy one or more tables to another table. See https://cloud.google.co...
[ "def", "copy_table", "(", "self", ",", "sources", ",", "destination", ",", "job_id", "=", "None", ",", "job_id_prefix", "=", "None", ",", "location", "=", "None", ",", "project", "=", "None", ",", "job_config", "=", "None", ",", "retry", "=", "DEFAULT_RE...
Copy one or more tables to another table. See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.copy Arguments: sources (Union[ \ :class:`~google.cloud.bigquery.table.Table`, \ :class:`~google.cloud.bigquery.table.TableRefer...
[ "Copy", "one", "or", "more", "tables", "to", "another", "table", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1420-L1509
28,041
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.extract_table
def extract_table( self, source, destination_uris, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None, retry=DEFAULT_RETRY, ): """Start a job to extract a table into Cloud Storage files. See h...
python
def extract_table( self, source, destination_uris, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None, retry=DEFAULT_RETRY, ): """Start a job to extract a table into Cloud Storage files. See h...
[ "def", "extract_table", "(", "self", ",", "source", ",", "destination_uris", ",", "job_id", "=", "None", ",", "job_id_prefix", "=", "None", ",", "location", "=", "None", ",", "project", "=", "None", ",", "job_config", "=", "None", ",", "retry", "=", "DEF...
Start a job to extract a table into Cloud Storage files. See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.extract Arguments: source (Union[ \ :class:`google.cloud.bigquery.table.Table`, \ :class:`google.cloud.bigquery.t...
[ "Start", "a", "job", "to", "extract", "a", "table", "into", "Cloud", "Storage", "files", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1511-L1581
28,042
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.query
def query( self, query, job_config=None, job_id=None, job_id_prefix=None, location=None, project=None, retry=DEFAULT_RETRY, ): """Run a SQL query. See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration....
python
def query( self, query, job_config=None, job_id=None, job_id_prefix=None, location=None, project=None, retry=DEFAULT_RETRY, ): """Run a SQL query. See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration....
[ "def", "query", "(", "self", ",", "query", ",", "job_config", "=", "None", ",", "job_id", "=", "None", ",", "job_id_prefix", "=", "None", ",", "location", "=", "None", ",", "project", "=", "None", ",", "retry", "=", "DEFAULT_RETRY", ",", ")", ":", "j...
Run a SQL query. See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query Arguments: query (str): SQL query to be executed. Defaults to the standard SQL dialect. Use the ``job_config`` parameter to change dialects. ...
[ "Run", "a", "SQL", "query", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1583-L1650
28,043
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.insert_rows
def insert_rows(self, table, rows, selected_fields=None, **kwargs): """Insert rows into a table via the streaming API. See https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll Args: table (Union[ \ :class:`~google.cloud.bigquery.table...
python
def insert_rows(self, table, rows, selected_fields=None, **kwargs): """Insert rows into a table via the streaming API. See https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll Args: table (Union[ \ :class:`~google.cloud.bigquery.table...
[ "def", "insert_rows", "(", "self", ",", "table", ",", "rows", ",", "selected_fields", "=", "None", ",", "*", "*", "kwargs", ")", ":", "table", "=", "_table_arg_to_table", "(", "table", ",", "default_project", "=", "self", ".", "project", ")", "if", "not"...
Insert rows into a table via the streaming API. See https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll Args: table (Union[ \ :class:`~google.cloud.bigquery.table.Table`, \ :class:`~google.cloud.bigquery.table.TableReference`...
[ "Insert", "rows", "into", "a", "table", "via", "the", "streaming", "API", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1652-L1714
28,044
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.insert_rows_json
def insert_rows_json( self, table, json_rows, row_ids=None, skip_invalid_rows=None, ignore_unknown_values=None, template_suffix=None, retry=DEFAULT_RETRY, ): """Insert rows into a table without applying local type conversions. See ...
python
def insert_rows_json( self, table, json_rows, row_ids=None, skip_invalid_rows=None, ignore_unknown_values=None, template_suffix=None, retry=DEFAULT_RETRY, ): """Insert rows into a table without applying local type conversions. See ...
[ "def", "insert_rows_json", "(", "self", ",", "table", ",", "json_rows", ",", "row_ids", "=", "None", ",", "skip_invalid_rows", "=", "None", ",", "ignore_unknown_values", "=", "None", ",", "template_suffix", "=", "None", ",", "retry", "=", "DEFAULT_RETRY", ",",...
Insert rows into a table without applying local type conversions. See https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll table (Union[ \ :class:`~google.cloud.bigquery.table.Table` \ :class:`~google.cloud.bigquery.table.TableReference`, \ ...
[ "Insert", "rows", "into", "a", "table", "without", "applying", "local", "type", "conversions", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1716-L1798
28,045
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.list_partitions
def list_partitions(self, table, retry=DEFAULT_RETRY): """List the partitions in a table. Arguments: table (Union[ \ :class:`~google.cloud.bigquery.table.Table`, \ :class:`~google.cloud.bigquery.table.TableReference`, \ str, \ ]): ...
python
def list_partitions(self, table, retry=DEFAULT_RETRY): """List the partitions in a table. Arguments: table (Union[ \ :class:`~google.cloud.bigquery.table.Table`, \ :class:`~google.cloud.bigquery.table.TableReference`, \ str, \ ]): ...
[ "def", "list_partitions", "(", "self", ",", "table", ",", "retry", "=", "DEFAULT_RETRY", ")", ":", "table", "=", "_table_arg_to_table_ref", "(", "table", ",", "default_project", "=", "self", ".", "project", ")", "meta_table", "=", "self", ".", "get_table", "...
List the partitions in a table. Arguments: table (Union[ \ :class:`~google.cloud.bigquery.table.Table`, \ :class:`~google.cloud.bigquery.table.TableReference`, \ str, \ ]): The table or reference from which to get partition...
[ "List", "the", "partitions", "in", "a", "table", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1800-L1829
28,046
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.list_rows
def list_rows( self, table, selected_fields=None, max_results=None, page_token=None, start_index=None, page_size=None, retry=DEFAULT_RETRY, ): """List the rows of the table. See https://cloud.google.com/bigquery/docs/reference/...
python
def list_rows( self, table, selected_fields=None, max_results=None, page_token=None, start_index=None, page_size=None, retry=DEFAULT_RETRY, ): """List the rows of the table. See https://cloud.google.com/bigquery/docs/reference/...
[ "def", "list_rows", "(", "self", ",", "table", ",", "selected_fields", "=", "None", ",", "max_results", "=", "None", ",", "page_token", "=", "None", ",", "start_index", "=", "None", ",", "page_size", "=", "None", ",", "retry", "=", "DEFAULT_RETRY", ",", ...
List the rows of the table. See https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/list .. note:: This method assumes that the provided schema is up-to-date with the schema as defined on the back-end: if the two schemas are not identical, the v...
[ "List", "the", "rows", "of", "the", "table", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1831-L1933
28,047
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client._schema_from_json_file_object
def _schema_from_json_file_object(self, file_obj): """Helper function for schema_from_json that takes a file object that describes a table schema. Returns: List of schema field objects. """ json_data = json.load(file_obj) return [SchemaField.from_api_repr(field...
python
def _schema_from_json_file_object(self, file_obj): """Helper function for schema_from_json that takes a file object that describes a table schema. Returns: List of schema field objects. """ json_data = json.load(file_obj) return [SchemaField.from_api_repr(field...
[ "def", "_schema_from_json_file_object", "(", "self", ",", "file_obj", ")", ":", "json_data", "=", "json", ".", "load", "(", "file_obj", ")", "return", "[", "SchemaField", ".", "from_api_repr", "(", "field", ")", "for", "field", "in", "json_data", "]" ]
Helper function for schema_from_json that takes a file object that describes a table schema. Returns: List of schema field objects.
[ "Helper", "function", "for", "schema_from_json", "that", "takes", "a", "file", "object", "that", "describes", "a", "table", "schema", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1935-L1943
28,048
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client._schema_to_json_file_object
def _schema_to_json_file_object(self, schema_list, file_obj): """Helper function for schema_to_json that takes a schema list and file object and writes the schema list to the file object with json.dump """ json.dump(schema_list, file_obj, indent=2, sort_keys=True)
python
def _schema_to_json_file_object(self, schema_list, file_obj): """Helper function for schema_to_json that takes a schema list and file object and writes the schema list to the file object with json.dump """ json.dump(schema_list, file_obj, indent=2, sort_keys=True)
[ "def", "_schema_to_json_file_object", "(", "self", ",", "schema_list", ",", "file_obj", ")", ":", "json", ".", "dump", "(", "schema_list", ",", "file_obj", ",", "indent", "=", "2", ",", "sort_keys", "=", "True", ")" ]
Helper function for schema_to_json that takes a schema list and file object and writes the schema list to the file object with json.dump
[ "Helper", "function", "for", "schema_to_json", "that", "takes", "a", "schema", "list", "and", "file", "object", "and", "writes", "the", "schema", "list", "to", "the", "file", "object", "with", "json", ".", "dump" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1945-L1949
28,049
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.schema_from_json
def schema_from_json(self, file_or_path): """Takes a file object or file path that contains json that describes a table schema. Returns: List of schema field objects. """ if isinstance(file_or_path, io.IOBase): return self._schema_from_json_file_object(fi...
python
def schema_from_json(self, file_or_path): """Takes a file object or file path that contains json that describes a table schema. Returns: List of schema field objects. """ if isinstance(file_or_path, io.IOBase): return self._schema_from_json_file_object(fi...
[ "def", "schema_from_json", "(", "self", ",", "file_or_path", ")", ":", "if", "isinstance", "(", "file_or_path", ",", "io", ".", "IOBase", ")", ":", "return", "self", ".", "_schema_from_json_file_object", "(", "file_or_path", ")", "with", "open", "(", "file_or_...
Takes a file object or file path that contains json that describes a table schema. Returns: List of schema field objects.
[ "Takes", "a", "file", "object", "or", "file", "path", "that", "contains", "json", "that", "describes", "a", "table", "schema", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1951-L1962
28,050
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
Client.schema_to_json
def schema_to_json(self, schema_list, destination): """Takes a list of schema field objects. Serializes the list of schema field objects as json to a file. Destination is a file path or a file object. """ json_schema_list = [f.to_api_repr() for f in schema_list] if isi...
python
def schema_to_json(self, schema_list, destination): """Takes a list of schema field objects. Serializes the list of schema field objects as json to a file. Destination is a file path or a file object. """ json_schema_list = [f.to_api_repr() for f in schema_list] if isi...
[ "def", "schema_to_json", "(", "self", ",", "schema_list", ",", "destination", ")", ":", "json_schema_list", "=", "[", "f", ".", "to_api_repr", "(", ")", "for", "f", "in", "schema_list", "]", "if", "isinstance", "(", "destination", ",", "io", ".", "IOBase",...
Takes a list of schema field objects. Serializes the list of schema field objects as json to a file. Destination is a file path or a file object.
[ "Takes", "a", "list", "of", "schema", "field", "objects", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1964-L1977
28,051
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/instance.py
Instance._update_from_pb
def _update_from_pb(self, instance_pb): """Refresh self from the server-provided protobuf. Helper for :meth:`from_pb` and :meth:`reload`. """ if not instance_pb.display_name: # Simple field (string) raise ValueError("Instance protobuf does not contain display_name") ...
python
def _update_from_pb(self, instance_pb): """Refresh self from the server-provided protobuf. Helper for :meth:`from_pb` and :meth:`reload`. """ if not instance_pb.display_name: # Simple field (string) raise ValueError("Instance protobuf does not contain display_name") ...
[ "def", "_update_from_pb", "(", "self", ",", "instance_pb", ")", ":", "if", "not", "instance_pb", ".", "display_name", ":", "# Simple field (string)", "raise", "ValueError", "(", "\"Instance protobuf does not contain display_name\"", ")", "self", ".", "display_name", "="...
Refresh self from the server-provided protobuf. Helper for :meth:`from_pb` and :meth:`reload`.
[ "Refresh", "self", "from", "the", "server", "-", "provided", "protobuf", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L86-L95
28,052
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/instance.py
Instance.from_pb
def from_pb(cls, instance_pb, client): """Creates an instance from a protobuf. :type instance_pb: :class:`google.spanner.v2.spanner_instance_admin_pb2.Instance` :param instance_pb: A instance protobuf object. :type client: :class:`~google.cloud.spanner_v1.client.Client` ...
python
def from_pb(cls, instance_pb, client): """Creates an instance from a protobuf. :type instance_pb: :class:`google.spanner.v2.spanner_instance_admin_pb2.Instance` :param instance_pb: A instance protobuf object. :type client: :class:`~google.cloud.spanner_v1.client.Client` ...
[ "def", "from_pb", "(", "cls", ",", "instance_pb", ",", "client", ")", ":", "match", "=", "_INSTANCE_NAME_RE", ".", "match", "(", "instance_pb", ".", "name", ")", "if", "match", "is", "None", ":", "raise", "ValueError", "(", "\"Instance protobuf name was not in...
Creates an instance from a protobuf. :type instance_pb: :class:`google.spanner.v2.spanner_instance_admin_pb2.Instance` :param instance_pb: A instance protobuf object. :type client: :class:`~google.cloud.spanner_v1.client.Client` :param client: The client that owns the insta...
[ "Creates", "an", "instance", "from", "a", "protobuf", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L98-L130
28,053
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/instance.py
Instance.copy
def copy(self): """Make a copy of this instance. Copies the local data stored as simple types and copies the client attached to this instance. :rtype: :class:`~google.cloud.spanner_v1.instance.Instance` :returns: A copy of the current instance. """ new_client = ...
python
def copy(self): """Make a copy of this instance. Copies the local data stored as simple types and copies the client attached to this instance. :rtype: :class:`~google.cloud.spanner_v1.instance.Instance` :returns: A copy of the current instance. """ new_client = ...
[ "def", "copy", "(", "self", ")", ":", "new_client", "=", "self", ".", "_client", ".", "copy", "(", ")", "return", "self", ".", "__class__", "(", "self", ".", "instance_id", ",", "new_client", ",", "self", ".", "configuration_name", ",", "node_count", "="...
Make a copy of this instance. Copies the local data stored as simple types and copies the client attached to this instance. :rtype: :class:`~google.cloud.spanner_v1.instance.Instance` :returns: A copy of the current instance.
[ "Make", "a", "copy", "of", "this", "instance", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L164-L180
28,054
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/instance.py
Instance.exists
def exists(self): """Test whether this instance exists. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig :rtype: bool :returns: True if the instance exists, else false ""...
python
def exists(self): """Test whether this instance exists. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig :rtype: bool :returns: True if the instance exists, else false ""...
[ "def", "exists", "(", "self", ")", ":", "api", "=", "self", ".", "_client", ".", "instance_admin_api", "metadata", "=", "_metadata_with_prefix", "(", "self", ".", "name", ")", "try", ":", "api", ".", "get_instance", "(", "self", ".", "name", ",", "metada...
Test whether this instance exists. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig :rtype: bool :returns: True if the instance exists, else false
[ "Test", "whether", "this", "instance", "exists", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L223-L240
28,055
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/instance.py
Instance.update
def update(self): """Update this instance. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance .. note:: Updates the ``display_name`` and ``node_count``. To change those ...
python
def update(self): """Update this instance. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance .. note:: Updates the ``display_name`` and ``node_count``. To change those ...
[ "def", "update", "(", "self", ")", ":", "api", "=", "self", ".", "_client", ".", "instance_admin_api", "instance_pb", "=", "admin_v1_pb2", ".", "Instance", "(", "name", "=", "self", ".", "name", ",", "config", "=", "self", ".", "configuration_name", ",", ...
Update this instance. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance .. note:: Updates the ``display_name`` and ``node_count``. To change those values before updating, set ...
[ "Update", "this", "instance", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L257-L293
28,056
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/instance.py
Instance.delete
def delete(self): """Mark an instance and all of its databases for permanent deletion. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance Immediately upon completion of the request: ...
python
def delete(self): """Mark an instance and all of its databases for permanent deletion. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance Immediately upon completion of the request: ...
[ "def", "delete", "(", "self", ")", ":", "api", "=", "self", ".", "_client", ".", "instance_admin_api", "metadata", "=", "_metadata_with_prefix", "(", "self", ".", "name", ")", "api", ".", "delete_instance", "(", "self", ".", "name", ",", "metadata", "=", ...
Mark an instance and all of its databases for permanent deletion. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance Immediately upon completion of the request: * Billing will cease for all ...
[ "Mark", "an", "instance", "and", "all", "of", "its", "databases", "for", "permanent", "deletion", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L295-L313
28,057
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/instance.py
Instance.database
def database(self, database_id, ddl_statements=(), pool=None): """Factory to create a database within this instance. :type database_id: str :param database_id: The ID of the instance. :type ddl_statements: list of string :param ddl_statements: (Optional) DDL statements, excludi...
python
def database(self, database_id, ddl_statements=(), pool=None): """Factory to create a database within this instance. :type database_id: str :param database_id: The ID of the instance. :type ddl_statements: list of string :param ddl_statements: (Optional) DDL statements, excludi...
[ "def", "database", "(", "self", ",", "database_id", ",", "ddl_statements", "=", "(", ")", ",", "pool", "=", "None", ")", ":", "return", "Database", "(", "database_id", ",", "self", ",", "ddl_statements", "=", "ddl_statements", ",", "pool", "=", "pool", "...
Factory to create a database within this instance. :type database_id: str :param database_id: The ID of the instance. :type ddl_statements: list of string :param ddl_statements: (Optional) DDL statements, excluding the 'CREATE DATABSE' statement. ...
[ "Factory", "to", "create", "a", "database", "within", "this", "instance", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L315-L332
28,058
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/instance.py
Instance.list_databases
def list_databases(self, page_size=None, page_token=None): """List databases for the instance. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases :type page_size: int :param page_size:...
python
def list_databases(self, page_size=None, page_token=None): """List databases for the instance. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases :type page_size: int :param page_size:...
[ "def", "list_databases", "(", "self", ",", "page_size", "=", "None", ",", "page_token", "=", "None", ")", ":", "metadata", "=", "_metadata_with_prefix", "(", "self", ".", "name", ")", "page_iter", "=", "self", ".", "_client", ".", "database_admin_api", ".", ...
List databases for the instance. See https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases :type page_size: int :param page_size: Optional. The maximum number of databases in each page of...
[ "List", "databases", "for", "the", "instance", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L334-L365
28,059
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/instance.py
Instance._item_to_database
def _item_to_database(self, iterator, database_pb): """Convert a database protobuf to the native object. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that is currently in use. :type database_pb: :class:`~google.spanner.admin.database.v1...
python
def _item_to_database(self, iterator, database_pb): """Convert a database protobuf to the native object. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that is currently in use. :type database_pb: :class:`~google.spanner.admin.database.v1...
[ "def", "_item_to_database", "(", "self", ",", "iterator", ",", "database_pb", ")", ":", "return", "Database", ".", "from_pb", "(", "database_pb", ",", "self", ",", "pool", "=", "BurstyPool", "(", ")", ")" ]
Convert a database protobuf to the native object. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that is currently in use. :type database_pb: :class:`~google.spanner.admin.database.v1.Database` :param database_pb: A database returned from...
[ "Convert", "a", "database", "protobuf", "to", "the", "native", "object", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L367-L379
28,060
googleapis/google-cloud-python
api_core/google/api_core/future/polling.py
PollingFuture._blocking_poll
def _blocking_poll(self, timeout=None): """Poll and wait for the Future to be resolved. Args: timeout (int): How long (in seconds) to wait for the operation to complete. If None, wait indefinitely. """ if self._result_set: return ...
python
def _blocking_poll(self, timeout=None): """Poll and wait for the Future to be resolved. Args: timeout (int): How long (in seconds) to wait for the operation to complete. If None, wait indefinitely. """ if self._result_set: return ...
[ "def", "_blocking_poll", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "self", ".", "_result_set", ":", "return", "retry_", "=", "self", ".", "_retry", ".", "with_deadline", "(", "timeout", ")", "try", ":", "retry_", "(", "self", ".", "_don...
Poll and wait for the Future to be resolved. Args: timeout (int): How long (in seconds) to wait for the operation to complete. If None, wait indefinitely.
[ "Poll", "and", "wait", "for", "the", "Future", "to", "be", "resolved", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L87-L105
28,061
googleapis/google-cloud-python
api_core/google/api_core/future/polling.py
PollingFuture.result
def result(self, timeout=None): """Get the result of the operation, blocking if necessary. Args: timeout (int): How long (in seconds) to wait for the operation to complete. If None, wait indefinitely. Returns: google.protobuf.Message: The...
python
def result(self, timeout=None): """Get the result of the operation, blocking if necessary. Args: timeout (int): How long (in seconds) to wait for the operation to complete. If None, wait indefinitely. Returns: google.protobuf.Message: The...
[ "def", "result", "(", "self", ",", "timeout", "=", "None", ")", ":", "self", ".", "_blocking_poll", "(", "timeout", "=", "timeout", ")", "if", "self", ".", "_exception", "is", "not", "None", ":", "# pylint: disable=raising-bad-type", "# Pylint doesn't recognize ...
Get the result of the operation, blocking if necessary. Args: timeout (int): How long (in seconds) to wait for the operation to complete. If None, wait indefinitely. Returns: google.protobuf.Message: The Operation's result. Raises: ...
[ "Get", "the", "result", "of", "the", "operation", "blocking", "if", "necessary", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L107-L129
28,062
googleapis/google-cloud-python
api_core/google/api_core/future/polling.py
PollingFuture.add_done_callback
def add_done_callback(self, fn): """Add a callback to be executed when the operation is complete. If the operation is not already complete, this will start a helper thread to poll for the status of the operation in the background. Args: fn (Callable[Future]): The callback t...
python
def add_done_callback(self, fn): """Add a callback to be executed when the operation is complete. If the operation is not already complete, this will start a helper thread to poll for the status of the operation in the background. Args: fn (Callable[Future]): The callback t...
[ "def", "add_done_callback", "(", "self", ",", "fn", ")", ":", "if", "self", ".", "_result_set", ":", "_helpers", ".", "safe_invoke_callback", "(", "fn", ",", "self", ")", "return", "self", ".", "_done_callbacks", ".", "append", "(", "fn", ")", "if", "sel...
Add a callback to be executed when the operation is complete. If the operation is not already complete, this will start a helper thread to poll for the status of the operation in the background. Args: fn (Callable[Future]): The callback to execute when the operation ...
[ "Add", "a", "callback", "to", "be", "executed", "when", "the", "operation", "is", "complete", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L145-L166
28,063
googleapis/google-cloud-python
api_core/google/api_core/future/polling.py
PollingFuture._invoke_callbacks
def _invoke_callbacks(self, *args, **kwargs): """Invoke all done callbacks.""" for callback in self._done_callbacks: _helpers.safe_invoke_callback(callback, *args, **kwargs)
python
def _invoke_callbacks(self, *args, **kwargs): """Invoke all done callbacks.""" for callback in self._done_callbacks: _helpers.safe_invoke_callback(callback, *args, **kwargs)
[ "def", "_invoke_callbacks", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "callback", "in", "self", ".", "_done_callbacks", ":", "_helpers", ".", "safe_invoke_callback", "(", "callback", ",", "*", "args", ",", "*", "*", "kwargs...
Invoke all done callbacks.
[ "Invoke", "all", "done", "callbacks", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L168-L171
28,064
googleapis/google-cloud-python
api_core/google/api_core/future/polling.py
PollingFuture.set_result
def set_result(self, result): """Set the Future's result.""" self._result = result self._result_set = True self._invoke_callbacks(self)
python
def set_result(self, result): """Set the Future's result.""" self._result = result self._result_set = True self._invoke_callbacks(self)
[ "def", "set_result", "(", "self", ",", "result", ")", ":", "self", ".", "_result", "=", "result", "self", ".", "_result_set", "=", "True", "self", ".", "_invoke_callbacks", "(", "self", ")" ]
Set the Future's result.
[ "Set", "the", "Future", "s", "result", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L173-L177
28,065
googleapis/google-cloud-python
api_core/google/api_core/future/polling.py
PollingFuture.set_exception
def set_exception(self, exception): """Set the Future's exception.""" self._exception = exception self._result_set = True self._invoke_callbacks(self)
python
def set_exception(self, exception): """Set the Future's exception.""" self._exception = exception self._result_set = True self._invoke_callbacks(self)
[ "def", "set_exception", "(", "self", ",", "exception", ")", ":", "self", ".", "_exception", "=", "exception", "self", ".", "_result_set", "=", "True", "self", ".", "_invoke_callbacks", "(", "self", ")" ]
Set the Future's exception.
[ "Set", "the", "Future", "s", "exception", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L179-L183
28,066
googleapis/google-cloud-python
logging/docs/snippets.py
instantiate_client
def instantiate_client(_unused_client, _unused_to_delete): """Instantiate client.""" # [START client_create_default] from google.cloud import logging client = logging.Client() # [END client_create_default] credentials = object() # [START client_create_explicit] from google.cloud impor...
python
def instantiate_client(_unused_client, _unused_to_delete): """Instantiate client.""" # [START client_create_default] from google.cloud import logging client = logging.Client() # [END client_create_default] credentials = object() # [START client_create_explicit] from google.cloud impor...
[ "def", "instantiate_client", "(", "_unused_client", ",", "_unused_to_delete", ")", ":", "# [START client_create_default]", "from", "google", ".", "cloud", "import", "logging", "client", "=", "logging", ".", "Client", "(", ")", "# [END client_create_default]", "credentia...
Instantiate client.
[ "Instantiate", "client", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L47-L60
28,067
googleapis/google-cloud-python
logging/docs/snippets.py
client_list_entries
def client_list_entries(client, to_delete): # pylint: disable=unused-argument """List entries via client.""" # [START client_list_entries_default] for entry in client.list_entries(): # API call(s) do_something_with(entry) # [END client_list_entries_default] # [START client_list_entries_f...
python
def client_list_entries(client, to_delete): # pylint: disable=unused-argument """List entries via client.""" # [START client_list_entries_default] for entry in client.list_entries(): # API call(s) do_something_with(entry) # [END client_list_entries_default] # [START client_list_entries_f...
[ "def", "client_list_entries", "(", "client", ",", "to_delete", ")", ":", "# pylint: disable=unused-argument", "# [START client_list_entries_default]", "for", "entry", "in", "client", ".", "list_entries", "(", ")", ":", "# API call(s)", "do_something_with", "(", "entry", ...
List entries via client.
[ "List", "entries", "via", "client", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L68-L99
28,068
googleapis/google-cloud-python
logging/docs/snippets.py
client_list_entries_multi_project
def client_list_entries_multi_project( client, to_delete ): # pylint: disable=unused-argument """List entries via client across multiple projects.""" # [START client_list_entries_multi_project] PROJECT_IDS = ["one-project", "another-project"] for entry in client.list_entries(project_ids=PROJECT_ID...
python
def client_list_entries_multi_project( client, to_delete ): # pylint: disable=unused-argument """List entries via client across multiple projects.""" # [START client_list_entries_multi_project] PROJECT_IDS = ["one-project", "another-project"] for entry in client.list_entries(project_ids=PROJECT_ID...
[ "def", "client_list_entries_multi_project", "(", "client", ",", "to_delete", ")", ":", "# pylint: disable=unused-argument", "# [START client_list_entries_multi_project]", "PROJECT_IDS", "=", "[", "\"one-project\"", ",", "\"another-project\"", "]", "for", "entry", "in", "clien...
List entries via client across multiple projects.
[ "List", "entries", "via", "client", "across", "multiple", "projects", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L104-L112
28,069
googleapis/google-cloud-python
logging/docs/snippets.py
logger_usage
def logger_usage(client, to_delete): """Logger usage.""" LOG_NAME = "logger_usage_%d" % (_millis()) # [START logger_create] logger = client.logger(LOG_NAME) # [END logger_create] to_delete.append(logger) # [START logger_log_text] logger.log_text("A simple entry") # API call # [END...
python
def logger_usage(client, to_delete): """Logger usage.""" LOG_NAME = "logger_usage_%d" % (_millis()) # [START logger_create] logger = client.logger(LOG_NAME) # [END logger_create] to_delete.append(logger) # [START logger_log_text] logger.log_text("A simple entry") # API call # [END...
[ "def", "logger_usage", "(", "client", ",", "to_delete", ")", ":", "LOG_NAME", "=", "\"logger_usage_%d\"", "%", "(", "_millis", "(", ")", ")", "# [START logger_create]", "logger", "=", "client", ".", "logger", "(", "LOG_NAME", ")", "# [END logger_create]", "to_de...
Logger usage.
[ "Logger", "usage", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L117-L165
28,070
googleapis/google-cloud-python
logging/docs/snippets.py
metric_crud
def metric_crud(client, to_delete): """Metric CRUD.""" METRIC_NAME = "robots-%d" % (_millis(),) DESCRIPTION = "Robots all up in your server" FILTER = "logName:apache-access AND textPayload:robot" UPDATED_FILTER = "textPayload:robot" UPDATED_DESCRIPTION = "Danger, Will Robinson!" # [START cl...
python
def metric_crud(client, to_delete): """Metric CRUD.""" METRIC_NAME = "robots-%d" % (_millis(),) DESCRIPTION = "Robots all up in your server" FILTER = "logName:apache-access AND textPayload:robot" UPDATED_FILTER = "textPayload:robot" UPDATED_DESCRIPTION = "Danger, Will Robinson!" # [START cl...
[ "def", "metric_crud", "(", "client", ",", "to_delete", ")", ":", "METRIC_NAME", "=", "\"robots-%d\"", "%", "(", "_millis", "(", ")", ",", ")", "DESCRIPTION", "=", "\"Robots all up in your server\"", "FILTER", "=", "\"logName:apache-access AND textPayload:robot\"", "UP...
Metric CRUD.
[ "Metric", "CRUD", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L169-L212
28,071
googleapis/google-cloud-python
logging/docs/snippets.py
sink_storage
def sink_storage(client, to_delete): """Sink log entries to storage.""" bucket = _sink_storage_setup(client) to_delete.append(bucket) SINK_NAME = "robots-storage-%d" % (_millis(),) FILTER = "textPayload:robot" # [START sink_storage_create] DESTINATION = "storage.googleapis.com/%s" % (bucket...
python
def sink_storage(client, to_delete): """Sink log entries to storage.""" bucket = _sink_storage_setup(client) to_delete.append(bucket) SINK_NAME = "robots-storage-%d" % (_millis(),) FILTER = "textPayload:robot" # [START sink_storage_create] DESTINATION = "storage.googleapis.com/%s" % (bucket...
[ "def", "sink_storage", "(", "client", ",", "to_delete", ")", ":", "bucket", "=", "_sink_storage_setup", "(", "client", ")", "to_delete", ".", "append", "(", "bucket", ")", "SINK_NAME", "=", "\"robots-storage-%d\"", "%", "(", "_millis", "(", ")", ",", ")", ...
Sink log entries to storage.
[ "Sink", "log", "entries", "to", "storage", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L235-L249
28,072
googleapis/google-cloud-python
logging/docs/snippets.py
sink_bigquery
def sink_bigquery(client, to_delete): """Sink log entries to bigquery.""" dataset = _sink_bigquery_setup(client) to_delete.append(dataset) SINK_NAME = "robots-bigquery-%d" % (_millis(),) FILTER = "textPayload:robot" # [START sink_bigquery_create] DESTINATION = "bigquery.googleapis.com%s" % ...
python
def sink_bigquery(client, to_delete): """Sink log entries to bigquery.""" dataset = _sink_bigquery_setup(client) to_delete.append(dataset) SINK_NAME = "robots-bigquery-%d" % (_millis(),) FILTER = "textPayload:robot" # [START sink_bigquery_create] DESTINATION = "bigquery.googleapis.com%s" % ...
[ "def", "sink_bigquery", "(", "client", ",", "to_delete", ")", ":", "dataset", "=", "_sink_bigquery_setup", "(", "client", ")", "to_delete", ".", "append", "(", "dataset", ")", "SINK_NAME", "=", "\"robots-bigquery-%d\"", "%", "(", "_millis", "(", ")", ",", ")...
Sink log entries to bigquery.
[ "Sink", "log", "entries", "to", "bigquery", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L274-L288
28,073
googleapis/google-cloud-python
logging/docs/snippets.py
sink_pubsub
def sink_pubsub(client, to_delete): """Sink log entries to pubsub.""" topic = _sink_pubsub_setup(client) to_delete.append(topic) SINK_NAME = "robots-pubsub-%d" % (_millis(),) FILTER = "logName:apache-access AND textPayload:robot" UPDATED_FILTER = "textPayload:robot" # [START sink_pubsub_cre...
python
def sink_pubsub(client, to_delete): """Sink log entries to pubsub.""" topic = _sink_pubsub_setup(client) to_delete.append(topic) SINK_NAME = "robots-pubsub-%d" % (_millis(),) FILTER = "logName:apache-access AND textPayload:robot" UPDATED_FILTER = "textPayload:robot" # [START sink_pubsub_cre...
[ "def", "sink_pubsub", "(", "client", ",", "to_delete", ")", ":", "topic", "=", "_sink_pubsub_setup", "(", "client", ")", "to_delete", ".", "append", "(", "topic", ")", "SINK_NAME", "=", "\"robots-pubsub-%d\"", "%", "(", "_millis", "(", ")", ",", ")", "FILT...
Sink log entries to pubsub.
[ "Sink", "log", "entries", "to", "pubsub", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/docs/snippets.py#L309-L348
28,074
googleapis/google-cloud-python
core/google/cloud/obsolete.py
complain
def complain(distribution_name): """Issue a warning if `distribution_name` is installed. In a future release, this method will be updated to raise ImportError rather than just send a warning. Args: distribution_name (str): The name of the obsolete distribution. """ try: pkg_res...
python
def complain(distribution_name): """Issue a warning if `distribution_name` is installed. In a future release, this method will be updated to raise ImportError rather than just send a warning. Args: distribution_name (str): The name of the obsolete distribution. """ try: pkg_res...
[ "def", "complain", "(", "distribution_name", ")", ":", "try", ":", "pkg_resources", ".", "get_distribution", "(", "distribution_name", ")", "warnings", ".", "warn", "(", "\"The {pkg} distribution is now obsolete. \"", "\"Please `pip uninstall {pkg}`. \"", "\"In the future, th...
Issue a warning if `distribution_name` is installed. In a future release, this method will be updated to raise ImportError rather than just send a warning. Args: distribution_name (str): The name of the obsolete distribution.
[ "Issue", "a", "warning", "if", "distribution_name", "is", "installed", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/obsolete.py#L22-L42
28,075
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
_get_encryption_headers
def _get_encryption_headers(key, source=False): """Builds customer encryption key headers :type key: bytes :param key: 32 byte key to build request key and hash. :type source: bool :param source: If true, return headers for the "source" blob; otherwise, return headers for the "d...
python
def _get_encryption_headers(key, source=False): """Builds customer encryption key headers :type key: bytes :param key: 32 byte key to build request key and hash. :type source: bool :param source: If true, return headers for the "source" blob; otherwise, return headers for the "d...
[ "def", "_get_encryption_headers", "(", "key", ",", "source", "=", "False", ")", ":", "if", "key", "is", "None", ":", "return", "{", "}", "key", "=", "_to_bytes", "(", "key", ")", "key_hash", "=", "hashlib", ".", "sha256", "(", "key", ")", ".", "diges...
Builds customer encryption key headers :type key: bytes :param key: 32 byte key to build request key and hash. :type source: bool :param source: If true, return headers for the "source" blob; otherwise, return headers for the "destination" blob. :rtype: dict :returns: dict ...
[ "Builds", "customer", "encryption", "key", "headers" ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1953-L1983
28,076
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
_raise_from_invalid_response
def _raise_from_invalid_response(error): """Re-wrap and raise an ``InvalidResponse`` exception. :type error: :exc:`google.resumable_media.InvalidResponse` :param error: A caught exception from the ``google-resumable-media`` library. :raises: :class:`~google.cloud.exceptions.GoogleClo...
python
def _raise_from_invalid_response(error): """Re-wrap and raise an ``InvalidResponse`` exception. :type error: :exc:`google.resumable_media.InvalidResponse` :param error: A caught exception from the ``google-resumable-media`` library. :raises: :class:`~google.cloud.exceptions.GoogleClo...
[ "def", "_raise_from_invalid_response", "(", "error", ")", ":", "response", "=", "error", ".", "response", "error_message", "=", "str", "(", "error", ")", "message", "=", "u\"{method} {url}: {error}\"", ".", "format", "(", "method", "=", "response", ".", "request...
Re-wrap and raise an ``InvalidResponse`` exception. :type error: :exc:`google.resumable_media.InvalidResponse` :param error: A caught exception from the ``google-resumable-media`` library. :raises: :class:`~google.cloud.exceptions.GoogleCloudError` corresponding to the faile...
[ "Re", "-", "wrap", "and", "raise", "an", "InvalidResponse", "exception", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L2017-L2034
28,077
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
_add_query_parameters
def _add_query_parameters(base_url, name_value_pairs): """Add one query parameter to a base URL. :type base_url: string :param base_url: Base URL (may already contain query parameters) :type name_value_pairs: list of (string, string) tuples. :param name_value_pairs: Names and values of the query p...
python
def _add_query_parameters(base_url, name_value_pairs): """Add one query parameter to a base URL. :type base_url: string :param base_url: Base URL (may already contain query parameters) :type name_value_pairs: list of (string, string) tuples. :param name_value_pairs: Names and values of the query p...
[ "def", "_add_query_parameters", "(", "base_url", ",", "name_value_pairs", ")", ":", "if", "len", "(", "name_value_pairs", ")", "==", "0", ":", "return", "base_url", "scheme", ",", "netloc", ",", "path", ",", "query", ",", "frag", "=", "urlsplit", "(", "bas...
Add one query parameter to a base URL. :type base_url: string :param base_url: Base URL (may already contain query parameters) :type name_value_pairs: list of (string, string) tuples. :param name_value_pairs: Names and values of the query parameters to add :rtype: string :returns: URL with ad...
[ "Add", "one", "query", "parameter", "to", "a", "base", "URL", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L2037-L2055
28,078
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.chunk_size
def chunk_size(self, value): """Set the blob's default chunk size. :type value: int :param value: (Optional) The current blob's chunk size, if it is set. :raises: :class:`ValueError` if ``value`` is not ``None`` and is not a multiple of 256 KB. """ if v...
python
def chunk_size(self, value): """Set the blob's default chunk size. :type value: int :param value: (Optional) The current blob's chunk size, if it is set. :raises: :class:`ValueError` if ``value`` is not ``None`` and is not a multiple of 256 KB. """ if v...
[ "def", "chunk_size", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", "and", "value", ">", "0", "and", "value", "%", "self", ".", "_CHUNK_SIZE_MULTIPLE", "!=", "0", ":", "raise", "ValueError", "(", "\"Chunk size must be a multiple of ...
Set the blob's default chunk size. :type value: int :param value: (Optional) The current blob's chunk size, if it is set. :raises: :class:`ValueError` if ``value`` is not ``None`` and is not a multiple of 256 KB.
[ "Set", "the", "blob", "s", "default", "chunk", "size", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L200-L213
28,079
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.path
def path(self): """Getter property for the URL path to this Blob. :rtype: str :returns: The URL path to this Blob. """ if not self.name: raise ValueError("Cannot determine path without a blob name.") return self.path_helper(self.bucket.path, self.name)
python
def path(self): """Getter property for the URL path to this Blob. :rtype: str :returns: The URL path to this Blob. """ if not self.name: raise ValueError("Cannot determine path without a blob name.") return self.path_helper(self.bucket.path, self.name)
[ "def", "path", "(", "self", ")", ":", "if", "not", "self", ".", "name", ":", "raise", "ValueError", "(", "\"Cannot determine path without a blob name.\"", ")", "return", "self", ".", "path_helper", "(", "self", ".", "bucket", ".", "path", ",", "self", ".", ...
Getter property for the URL path to this Blob. :rtype: str :returns: The URL path to this Blob.
[ "Getter", "property", "for", "the", "URL", "path", "to", "this", "Blob", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L244-L253
28,080
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob._query_params
def _query_params(self): """Default query parameters.""" params = {} if self.generation is not None: params["generation"] = self.generation if self.user_project is not None: params["userProject"] = self.user_project return params
python
def _query_params(self): """Default query parameters.""" params = {} if self.generation is not None: params["generation"] = self.generation if self.user_project is not None: params["userProject"] = self.user_project return params
[ "def", "_query_params", "(", "self", ")", ":", "params", "=", "{", "}", "if", "self", ".", "generation", "is", "not", "None", ":", "params", "[", "\"generation\"", "]", "=", "self", ".", "generation", "if", "self", ".", "user_project", "is", "not", "No...
Default query parameters.
[ "Default", "query", "parameters", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L279-L286
28,081
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.public_url
def public_url(self): """The public URL for this blob. Use :meth:`make_public` to enable anonymous access via the returned URL. :rtype: `string` :returns: The public URL for this blob. """ return "{storage_base_url}/{bucket_name}/{quoted_name}".format( ...
python
def public_url(self): """The public URL for this blob. Use :meth:`make_public` to enable anonymous access via the returned URL. :rtype: `string` :returns: The public URL for this blob. """ return "{storage_base_url}/{bucket_name}/{quoted_name}".format( ...
[ "def", "public_url", "(", "self", ")", ":", "return", "\"{storage_base_url}/{bucket_name}/{quoted_name}\"", ".", "format", "(", "storage_base_url", "=", "_API_ACCESS_ENDPOINT", ",", "bucket_name", "=", "self", ".", "bucket", ".", "name", ",", "quoted_name", "=", "qu...
The public URL for this blob. Use :meth:`make_public` to enable anonymous access via the returned URL. :rtype: `string` :returns: The public URL for this blob.
[ "The", "public", "URL", "for", "this", "blob", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L289-L302
28,082
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.generate_signed_url
def generate_signed_url( self, expiration=None, api_access_endpoint=_API_ACCESS_ENDPOINT, method="GET", content_md5=None, content_type=None, response_disposition=None, response_type=None, generation=None, headers=None, query_paramet...
python
def generate_signed_url( self, expiration=None, api_access_endpoint=_API_ACCESS_ENDPOINT, method="GET", content_md5=None, content_type=None, response_disposition=None, response_type=None, generation=None, headers=None, query_paramet...
[ "def", "generate_signed_url", "(", "self", ",", "expiration", "=", "None", ",", "api_access_endpoint", "=", "_API_ACCESS_ENDPOINT", ",", "method", "=", "\"GET\"", ",", "content_md5", "=", "None", ",", "content_type", "=", "None", ",", "response_disposition", "=", ...
Generates a signed URL for this blob. .. note:: If you are on Google Compute Engine, you can't generate a signed URL using GCE service account. Follow `Issue 50`_ for updates on this. If you'd like to be able to generate a signed URL from GCE, you can use a stan...
[ "Generates", "a", "signed", "URL", "for", "this", "blob", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L304-L445
28,083
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.exists
def exists(self, client=None): """Determines whether or not this blob exists. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Opt...
python
def exists(self, client=None): """Determines whether or not this blob exists. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Opt...
[ "def", "exists", "(", "self", ",", "client", "=", "None", ")", ":", "client", "=", "self", ".", "_require_client", "(", "client", ")", "# We only need the status code (200 or not) so we seek to", "# minimize the returned payload.", "query_params", "=", "self", ".", "_...
Determines whether or not this blob exists. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, ...
[ "Determines", "whether", "or", "not", "this", "blob", "exists", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L447-L481
28,084
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.delete
def delete(self, client=None): """Deletes a blob from Cloud Storage. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. Th...
python
def delete(self, client=None): """Deletes a blob from Cloud Storage. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. Th...
[ "def", "delete", "(", "self", ",", "client", "=", "None", ")", ":", "return", "self", ".", "bucket", ".", "delete_blob", "(", "self", ".", "name", ",", "client", "=", "client", ",", "generation", "=", "self", ".", "generation", ")" ]
Deletes a blob from Cloud Storage. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls bac...
[ "Deletes", "a", "blob", "from", "Cloud", "Storage", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L483-L502
28,085
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob._get_download_url
def _get_download_url(self): """Get the download URL for the current blob. If the ``media_link`` has been loaded, it will be used, otherwise the URL will be constructed from the current blob's path (and possibly generation) to avoid a round trip. :rtype: str :returns: T...
python
def _get_download_url(self): """Get the download URL for the current blob. If the ``media_link`` has been loaded, it will be used, otherwise the URL will be constructed from the current blob's path (and possibly generation) to avoid a round trip. :rtype: str :returns: T...
[ "def", "_get_download_url", "(", "self", ")", ":", "name_value_pairs", "=", "[", "]", "if", "self", ".", "media_link", "is", "None", ":", "base_url", "=", "_DOWNLOAD_URL_TEMPLATE", ".", "format", "(", "path", "=", "self", ".", "path", ")", "if", "self", ...
Get the download URL for the current blob. If the ``media_link`` has been loaded, it will be used, otherwise the URL will be constructed from the current blob's path (and possibly generation) to avoid a round trip. :rtype: str :returns: The download URL for the current blob.
[ "Get", "the", "download", "URL", "for", "the", "current", "blob", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L519-L540
28,086
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob._do_download
def _do_download( self, transport, file_obj, download_url, headers, start=None, end=None ): """Perform a download without any error handling. This is intended to be called by :meth:`download_to_file` so it can be wrapped with error handling / remapping. :type transport: ...
python
def _do_download( self, transport, file_obj, download_url, headers, start=None, end=None ): """Perform a download without any error handling. This is intended to be called by :meth:`download_to_file` so it can be wrapped with error handling / remapping. :type transport: ...
[ "def", "_do_download", "(", "self", ",", "transport", ",", "file_obj", ",", "download_url", ",", "headers", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "if", "self", ".", "chunk_size", "is", "None", ":", "download", "=", "Download", "...
Perform a download without any error handling. This is intended to be called by :meth:`download_to_file` so it can be wrapped with error handling / remapping. :type transport: :class:`~google.auth.transport.requests.AuthorizedSession` :param transport: The transport (with c...
[ "Perform", "a", "download", "without", "any", "error", "handling", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L542-L586
28,087
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.download_to_file
def download_to_file(self, file_obj, client=None, start=None, end=None): """Download the contents of this blob into a file-like object. .. note:: If the server-set property, :attr:`media_link`, is not yet initialized, makes an additional API request to load it. Downloadi...
python
def download_to_file(self, file_obj, client=None, start=None, end=None): """Download the contents of this blob into a file-like object. .. note:: If the server-set property, :attr:`media_link`, is not yet initialized, makes an additional API request to load it. Downloadi...
[ "def", "download_to_file", "(", "self", ",", "file_obj", ",", "client", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "download_url", "=", "self", ".", "_get_download_url", "(", ")", "headers", "=", "_get_encryption_headers", "...
Download the contents of this blob into a file-like object. .. note:: If the server-set property, :attr:`media_link`, is not yet initialized, makes an additional API request to load it. Downloading a file that has been encrypted with a `customer-supplied`_ encryption key...
[ "Download", "the", "contents", "of", "this", "blob", "into", "a", "file", "-", "like", "object", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L588-L638
28,088
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.download_to_filename
def download_to_filename(self, filename, client=None, start=None, end=None): """Download the contents of this blob into a named file. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type filename: str :param filename: A filename to be passe...
python
def download_to_filename(self, filename, client=None, start=None, end=None): """Download the contents of this blob into a named file. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type filename: str :param filename: A filename to be passe...
[ "def", "download_to_filename", "(", "self", ",", "filename", ",", "client", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "try", ":", "with", "open", "(", "filename", ",", "\"wb\"", ")", "as", "file_obj", ":", "self", "."...
Download the contents of this blob into a named file. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type filename: str :param filename: A filename to be passed to ``open``. :type client: :class:`~google.cloud.storage.client.Client` or ...
[ "Download", "the", "contents", "of", "this", "blob", "into", "a", "named", "file", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L640-L673
28,089
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.download_as_string
def download_as_string(self, client=None, start=None, end=None): """Download the contents of this blob as a string. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type client: :class:`~google.cloud.storage.client.Client` or `...
python
def download_as_string(self, client=None, start=None, end=None): """Download the contents of this blob as a string. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type client: :class:`~google.cloud.storage.client.Client` or `...
[ "def", "download_as_string", "(", "self", ",", "client", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "string_buffer", "=", "BytesIO", "(", ")", "self", ".", "download_to_file", "(", "string_buffer", ",", "client", "=", "cli...
Download the contents of this blob as a string. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not pass...
[ "Download", "the", "contents", "of", "this", "blob", "as", "a", "string", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L675-L698
28,090
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob._get_content_type
def _get_content_type(self, content_type, filename=None): """Determine the content type from the current object. The return value will be determined in order of precedence: - The value passed in to this method (if not :data:`None`) - The value stored on the current blob - The d...
python
def _get_content_type(self, content_type, filename=None): """Determine the content type from the current object. The return value will be determined in order of precedence: - The value passed in to this method (if not :data:`None`) - The value stored on the current blob - The d...
[ "def", "_get_content_type", "(", "self", ",", "content_type", ",", "filename", "=", "None", ")", ":", "if", "content_type", "is", "None", ":", "content_type", "=", "self", ".", "content_type", "if", "content_type", "is", "None", "and", "filename", "is", "not...
Determine the content type from the current object. The return value will be determined in order of precedence: - The value passed in to this method (if not :data:`None`) - The value stored on the current blob - The default value ('application/octet-stream') :type content_type...
[ "Determine", "the", "content", "type", "from", "the", "current", "object", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L700-L728
28,091
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob._get_upload_arguments
def _get_upload_arguments(self, content_type): """Get required arguments for performing an upload. The content type returned will be determined in order of precedence: - The value passed in to this method (if not :data:`None`) - The value stored on the current blob - The defaul...
python
def _get_upload_arguments(self, content_type): """Get required arguments for performing an upload. The content type returned will be determined in order of precedence: - The value passed in to this method (if not :data:`None`) - The value stored on the current blob - The defaul...
[ "def", "_get_upload_arguments", "(", "self", ",", "content_type", ")", ":", "headers", "=", "_get_encryption_headers", "(", "self", ".", "_encryption_key", ")", "object_metadata", "=", "self", ".", "_get_writable_metadata", "(", ")", "content_type", "=", "self", "...
Get required arguments for performing an upload. The content type returned will be determined in order of precedence: - The value passed in to this method (if not :data:`None`) - The value stored on the current blob - The default value ('application/octet-stream') :type conten...
[ "Get", "required", "arguments", "for", "performing", "an", "upload", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L761-L783
28,092
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob._do_upload
def _do_upload( self, client, stream, content_type, size, num_retries, predefined_acl ): """Determine an upload strategy and then perform the upload. If the size of the data to be uploaded exceeds 5 MB a resumable media request will be used, otherwise the content and the metadata wi...
python
def _do_upload( self, client, stream, content_type, size, num_retries, predefined_acl ): """Determine an upload strategy and then perform the upload. If the size of the data to be uploaded exceeds 5 MB a resumable media request will be used, otherwise the content and the metadata wi...
[ "def", "_do_upload", "(", "self", ",", "client", ",", "stream", ",", "content_type", ",", "size", ",", "num_retries", ",", "predefined_acl", ")", ":", "if", "size", "is", "not", "None", "and", "size", "<=", "_MAX_MULTIPART_SIZE", ":", "response", "=", "sel...
Determine an upload strategy and then perform the upload. If the size of the data to be uploaded exceeds 5 MB a resumable media request will be used, otherwise the content and the metadata will be uploaded in a single multipart upload request. The content type of the upload will be det...
[ "Determine", "an", "upload", "strategy", "and", "then", "perform", "the", "upload", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1018-L1070
28,093
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.upload_from_file
def upload_from_file( self, file_obj, rewind=False, size=None, content_type=None, num_retries=None, client=None, predefined_acl=None, ): """Upload the contents of this blob from a file-like object. The content type of the upload will b...
python
def upload_from_file( self, file_obj, rewind=False, size=None, content_type=None, num_retries=None, client=None, predefined_acl=None, ): """Upload the contents of this blob from a file-like object. The content type of the upload will b...
[ "def", "upload_from_file", "(", "self", ",", "file_obj", ",", "rewind", "=", "False", ",", "size", "=", "None", ",", "content_type", "=", "None", ",", "num_retries", "=", "None", ",", "client", "=", "None", ",", "predefined_acl", "=", "None", ",", ")", ...
Upload the contents of this blob from a file-like object. The content type of the upload will be determined in order of precedence: - The value passed in to this method (if not :data:`None`) - The value stored on the current blob - The default value ('application/octet-stream')...
[ "Upload", "the", "contents", "of", "this", "blob", "from", "a", "file", "-", "like", "object", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1072-L1161
28,094
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.upload_from_filename
def upload_from_filename( self, filename, content_type=None, client=None, predefined_acl=None ): """Upload this blob's contents from the content of a named file. The content type of the upload will be determined in order of precedence: - The value passed in to this method (...
python
def upload_from_filename( self, filename, content_type=None, client=None, predefined_acl=None ): """Upload this blob's contents from the content of a named file. The content type of the upload will be determined in order of precedence: - The value passed in to this method (...
[ "def", "upload_from_filename", "(", "self", ",", "filename", ",", "content_type", "=", "None", ",", "client", "=", "None", ",", "predefined_acl", "=", "None", ")", ":", "content_type", "=", "self", ".", "_get_content_type", "(", "content_type", ",", "filename"...
Upload this blob's contents from the content of a named file. The content type of the upload will be determined in order of precedence: - The value passed in to this method (if not :data:`None`) - The value stored on the current blob - The value given by ``mimetypes.guess_type`...
[ "Upload", "this", "blob", "s", "contents", "from", "the", "content", "of", "a", "named", "file", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1163-L1213
28,095
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.upload_from_string
def upload_from_string( self, data, content_type="text/plain", client=None, predefined_acl=None ): """Upload contents of this blob from the provided string. .. note:: The effect of uploading to an existing blob depends on the "versioning" and "lifecycle" policies defin...
python
def upload_from_string( self, data, content_type="text/plain", client=None, predefined_acl=None ): """Upload contents of this blob from the provided string. .. note:: The effect of uploading to an existing blob depends on the "versioning" and "lifecycle" policies defin...
[ "def", "upload_from_string", "(", "self", ",", "data", ",", "content_type", "=", "\"text/plain\"", ",", "client", "=", "None", ",", "predefined_acl", "=", "None", ")", ":", "data", "=", "_to_bytes", "(", "data", ",", "encoding", "=", "\"utf-8\"", ")", "str...
Upload contents of this blob from the provided string. .. note:: The effect of uploading to an existing blob depends on the "versioning" and "lifecycle" policies defined on the blob's bucket. In the absence of those policies, upload will overwrite any existing conte...
[ "Upload", "contents", "of", "this", "blob", "from", "the", "provided", "string", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1215-L1258
28,096
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.create_resumable_upload_session
def create_resumable_upload_session( self, content_type=None, size=None, origin=None, client=None ): """Create a resumable upload session. Resumable upload sessions allow you to start an upload session from one client and complete the session in another. This method is called ...
python
def create_resumable_upload_session( self, content_type=None, size=None, origin=None, client=None ): """Create a resumable upload session. Resumable upload sessions allow you to start an upload session from one client and complete the session in another. This method is called ...
[ "def", "create_resumable_upload_session", "(", "self", ",", "content_type", "=", "None", ",", "size", "=", "None", ",", "origin", "=", "None", ",", "client", "=", "None", ")", ":", "extra_headers", "=", "{", "}", "if", "origin", "is", "not", "None", ":",...
Create a resumable upload session. Resumable upload sessions allow you to start an upload session from one client and complete the session in another. This method is called by the initiator to set the metadata and limits. The initiator then passes the session URL to the client that will...
[ "Create", "a", "resumable", "upload", "session", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1260-L1351
28,097
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.make_public
def make_public(self, client=None): """Update blob's ACL, granting read access to anonymous users. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back to th...
python
def make_public(self, client=None): """Update blob's ACL, granting read access to anonymous users. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back to th...
[ "def", "make_public", "(", "self", ",", "client", "=", "None", ")", ":", "self", ".", "acl", ".", "all", "(", ")", ".", "grant_read", "(", ")", "self", ".", "acl", ".", "save", "(", "client", "=", "client", ")" ]
Update blob's ACL, granting read access to anonymous users. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back to the ``client`` stored on the blob's bucket.
[ "Update", "blob", "s", "ACL", "granting", "read", "access", "to", "anonymous", "users", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1474-L1483
28,098
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.make_private
def make_private(self, client=None): """Update blob's ACL, revoking read access for anonymous users. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back to ...
python
def make_private(self, client=None): """Update blob's ACL, revoking read access for anonymous users. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back to ...
[ "def", "make_private", "(", "self", ",", "client", "=", "None", ")", ":", "self", ".", "acl", ".", "all", "(", ")", ".", "revoke_read", "(", ")", "self", ".", "acl", ".", "save", "(", "client", "=", "client", ")" ]
Update blob's ACL, revoking read access for anonymous users. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back to the ``client`` stored on the blob's bucket.
[ "Update", "blob", "s", "ACL", "revoking", "read", "access", "for", "anonymous", "users", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1485-L1494
28,099
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
Blob.compose
def compose(self, sources, client=None): """Concatenate source blobs into this one. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type sources: list of :class:`Blob` :param sources: blobs whose contents will be composed into this blob. ...
python
def compose(self, sources, client=None): """Concatenate source blobs into this one. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type sources: list of :class:`Blob` :param sources: blobs whose contents will be composed into this blob. ...
[ "def", "compose", "(", "self", ",", "sources", ",", "client", "=", "None", ")", ":", "client", "=", "self", ".", "_require_client", "(", "client", ")", "query_params", "=", "{", "}", "if", "self", ".", "user_project", "is", "not", "None", ":", "query_p...
Concatenate source blobs into this one. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type sources: list of :class:`Blob` :param sources: blobs whose contents will be composed into this blob. :type client: :class:`~google.cloud.storage.c...
[ "Concatenate", "source", "blobs", "into", "this", "one", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L1496-L1527