partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | SpannerClient.partition_query | Creates a set of partition tokens that can be used to execute a query
operation in parallel. Each of the returned partition tokens can be used
by ``ExecuteStreamingSql`` to specify a subset of the query result to
read. The same session and read-only transaction must be used by the
Partit... | spanner/google/cloud/spanner_v1/gapic/spanner_client.py | def partition_query(
self,
session,
sql,
transaction=None,
params=None,
param_types=None,
partition_options=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
... | def partition_query(
self,
session,
sql,
transaction=None,
params=None,
param_types=None,
partition_options=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
... | [
"Creates",
"a",
"set",
"of",
"partition",
"tokens",
"that",
"can",
"be",
"used",
"to",
"execute",
"a",
"query",
"operation",
"in",
"parallel",
".",
"Each",
"of",
"the",
"returned",
"partition",
"tokens",
"can",
"be",
"used",
"by",
"ExecuteStreamingSql",
"to"... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/gapic/spanner_client.py#L1541-L1679 | [
"def",
"partition_query",
"(",
"self",
",",
"session",
",",
"sql",
",",
"transaction",
"=",
"None",
",",
"params",
"=",
"None",
",",
"param_types",
"=",
"None",
",",
"partition_options",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"ga... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | SpannerClient.partition_read | Creates a set of partition tokens that can be used to execute a read
operation in parallel. Each of the returned partition tokens can be used
by ``StreamingRead`` to specify a subset of the read result to read. The
same session and read-only transaction must be used by the
PartitionReadR... | spanner/google/cloud/spanner_v1/gapic/spanner_client.py | def partition_read(
self,
session,
table,
key_set,
transaction=None,
index=None,
columns=None,
partition_options=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
... | def partition_read(
self,
session,
table,
key_set,
transaction=None,
index=None,
columns=None,
partition_options=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
... | [
"Creates",
"a",
"set",
"of",
"partition",
"tokens",
"that",
"can",
"be",
"used",
"to",
"execute",
"a",
"read",
"operation",
"in",
"parallel",
".",
"Each",
"of",
"the",
"returned",
"partition",
"tokens",
"can",
"be",
"used",
"by",
"StreamingRead",
"to",
"sp... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/gapic/spanner_client.py#L1681-L1806 | [
"def",
"partition_read",
"(",
"self",
",",
"session",
",",
"table",
",",
"key_set",
",",
"transaction",
"=",
"None",
",",
"index",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"partition_options",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_cor... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | EventServiceClient.create_client_event | Report events issued when end user interacts with customer's application
that uses Cloud Talent Solution. You may inspect the created events in
`self service
tools <https://console.cloud.google.com/talent-solution/overview>`__.
`Learn
more <https://cloud.google.com/talent-solutio... | talent/google/cloud/talent_v4beta1/gapic/event_service_client.py | def create_client_event(
self,
parent,
client_event,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Report events issued when end user interacts with customer's application
... | def create_client_event(
self,
parent,
client_event,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Report events issued when end user interacts with customer's application
... | [
"Report",
"events",
"issued",
"when",
"end",
"user",
"interacts",
"with",
"customer",
"s",
"application",
"that",
"uses",
"Cloud",
"Talent",
"Solution",
".",
"You",
"may",
"inspect",
"the",
"created",
"events",
"in",
"self",
"service",
"tools",
"<https",
":",
... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/talent/google/cloud/talent_v4beta1/gapic/event_service_client.py#L182-L255 | [
"def",
"create_client_event",
"(",
"self",
",",
"parent",
",",
"client_event",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
"."... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | make_datastore_api | Create an instance of the GAPIC Datastore API.
:type client: :class:`~google.cloud.datastore.client.Client`
:param client: The client that holds configuration details.
:rtype: :class:`.datastore.v1.datastore_client.DatastoreClient`
:returns: A datastore API instance with the proper credentials. | datastore/google/cloud/datastore/_gapic.py | def make_datastore_api(client):
"""Create an instance of the GAPIC Datastore API.
:type client: :class:`~google.cloud.datastore.client.Client`
:param client: The client that holds configuration details.
:rtype: :class:`.datastore.v1.datastore_client.DatastoreClient`
:returns: A datastore API insta... | def make_datastore_api(client):
"""Create an instance of the GAPIC Datastore API.
:type client: :class:`~google.cloud.datastore.client.Client`
:param client: The client that holds configuration details.
:rtype: :class:`.datastore.v1.datastore_client.DatastoreClient`
:returns: A datastore API insta... | [
"Create",
"an",
"instance",
"of",
"the",
"GAPIC",
"Datastore",
"API",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/_gapic.py#L28-L49 | [
"def",
"make_datastore_api",
"(",
"client",
")",
":",
"parse_result",
"=",
"six",
".",
"moves",
".",
"urllib_parse",
".",
"urlparse",
"(",
"client",
".",
"_base_url",
")",
"host",
"=",
"parse_result",
".",
"netloc",
"if",
"parse_result",
".",
"scheme",
"==",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | default | Default unit test session.
This is intended to be run **without** an interpreter set, so
that the current ``python`` (on the ``PATH``) or the version of
Python corresponding to the ``nox`` binary the ``PATH`` can
run the tests. | bigquery/noxfile.py | def default(session):
"""Default unit test session.
This is intended to be run **without** an interpreter set, so
that the current ``python`` (on the ``PATH``) or the version of
Python corresponding to the ``nox`` binary the ``PATH`` can
run the tests.
"""
# Install all test dependencies, t... | def default(session):
"""Default unit test session.
This is intended to be run **without** an interpreter set, so
that the current ``python`` (on the ``PATH``) or the version of
Python corresponding to the ``nox`` binary the ``PATH`` can
run the tests.
"""
# Install all test dependencies, t... | [
"Default",
"unit",
"test",
"session",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/noxfile.py#L28-L63 | [
"def",
"default",
"(",
"session",
")",
":",
"# Install all test dependencies, then install local packages in-place.",
"session",
".",
"install",
"(",
"\"mock\"",
",",
"\"pytest\"",
",",
"\"pytest-cov\"",
")",
"for",
"local_dep",
"in",
"LOCAL_DEPS",
":",
"session",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | snippets | Run the snippets test suite. | bigquery/noxfile.py | def snippets(session):
"""Run the snippets test suite."""
# Sanity check: Only run snippets tests if the environment variable is set.
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
session.skip("Credentials must be set via environment variable.")
# Install all test dependencies, ... | def snippets(session):
"""Run the snippets test suite."""
# Sanity check: Only run snippets tests if the environment variable is set.
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
session.skip("Credentials must be set via environment variable.")
# Install all test dependencies, ... | [
"Run",
"the",
"snippets",
"test",
"suite",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/noxfile.py#L104-L121 | [
"def",
"snippets",
"(",
"session",
")",
":",
"# Sanity check: Only run snippets tests if the environment variable is set.",
"if",
"not",
"os",
".",
"environ",
".",
"get",
"(",
"\"GOOGLE_APPLICATION_CREDENTIALS\"",
",",
"\"\"",
")",
":",
"session",
".",
"skip",
"(",
"\... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | lint | Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues. | bigquery/noxfile.py | def lint(session):
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install("black", "flake8", *LOCAL_DEPS)
session.install(".")
session.run("flake8", os.path.join("google", "cloud", "bigquery"))
session.run("... | def lint(session):
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install("black", "flake8", *LOCAL_DEPS)
session.install(".")
session.run("flake8", os.path.join("google", "cloud", "bigquery"))
session.run("... | [
"Run",
"linters",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/noxfile.py#L137-L149 | [
"def",
"lint",
"(",
"session",
")",
":",
"session",
".",
"install",
"(",
"\"black\"",
",",
"\"flake8\"",
",",
"*",
"LOCAL_DEPS",
")",
"session",
".",
"install",
"(",
"\".\"",
")",
"session",
".",
"run",
"(",
"\"flake8\"",
",",
"os",
".",
"path",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _indent | Indent some text.
Note that this is present as ``textwrap.indent``, but not in Python 2.
Args:
lines (str): The newline delimited string to be indented.
prefix (Optional[str]): The prefix to indent each line with. Default
to two spaces.
Returns:
str: The newly indented... | pubsub/google/cloud/pubsub_v1/subscriber/message.py | def _indent(lines, prefix=" "):
"""Indent some text.
Note that this is present as ``textwrap.indent``, but not in Python 2.
Args:
lines (str): The newline delimited string to be indented.
prefix (Optional[str]): The prefix to indent each line with. Default
to two spaces.
... | def _indent(lines, prefix=" "):
"""Indent some text.
Note that this is present as ``textwrap.indent``, but not in Python 2.
Args:
lines (str): The newline delimited string to be indented.
prefix (Optional[str]): The prefix to indent each line with. Default
to two spaces.
... | [
"Indent",
"some",
"text",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/message.py#L33-L49 | [
"def",
"_indent",
"(",
"lines",
",",
"prefix",
"=",
"\" \"",
")",
":",
"indented",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
".",
"split",
"(",
"\"\\n\"",
")",
":",
"indented",
".",
"append",
"(",
"prefix",
"+",
"line",
")",
"return",
"\"\\n\"",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Message.publish_time | Return the time that the message was originally published.
Returns:
datetime: The date and time that the message was published. | pubsub/google/cloud/pubsub_v1/subscriber/message.py | def publish_time(self):
"""Return the time that the message was originally published.
Returns:
datetime: The date and time that the message was published.
"""
timestamp = self._message.publish_time
delta = datetime.timedelta(
seconds=timestamp.seconds, mi... | def publish_time(self):
"""Return the time that the message was originally published.
Returns:
datetime: The date and time that the message was published.
"""
timestamp = self._message.publish_time
delta = datetime.timedelta(
seconds=timestamp.seconds, mi... | [
"Return",
"the",
"time",
"that",
"the",
"message",
"was",
"originally",
"published",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/message.py#L147-L157 | [
"def",
"publish_time",
"(",
"self",
")",
":",
"timestamp",
"=",
"self",
".",
"_message",
".",
"publish_time",
"delta",
"=",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"timestamp",
".",
"seconds",
",",
"microseconds",
"=",
"timestamp",
".",
"nanos",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Message.ack | Acknowledge the given message.
Acknowledging a message in Pub/Sub means that you are done
with it, and it will not be delivered to this subscription again.
You should avoid acknowledging messages until you have
*finished* processing them, so that in the event of a failure,
you r... | pubsub/google/cloud/pubsub_v1/subscriber/message.py | def ack(self):
"""Acknowledge the given message.
Acknowledging a message in Pub/Sub means that you are done
with it, and it will not be delivered to this subscription again.
You should avoid acknowledging messages until you have
*finished* processing them, so that in the event o... | def ack(self):
"""Acknowledge the given message.
Acknowledging a message in Pub/Sub means that you are done
with it, and it will not be delivered to this subscription again.
You should avoid acknowledging messages until you have
*finished* processing them, so that in the event o... | [
"Acknowledge",
"the",
"given",
"message",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/message.py#L169-L188 | [
"def",
"ack",
"(",
"self",
")",
":",
"time_to_ack",
"=",
"math",
".",
"ceil",
"(",
"time",
".",
"time",
"(",
")",
"-",
"self",
".",
"_received_timestamp",
")",
"self",
".",
"_request_queue",
".",
"put",
"(",
"requests",
".",
"AckRequest",
"(",
"ack_id"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Message.drop | Release the message from lease management.
This informs the policy to no longer hold on to the lease for this
message. Pub/Sub will re-deliver the message if it is not acknowledged
before the existing lease expires.
.. warning::
For most use cases, the only reason to drop a... | pubsub/google/cloud/pubsub_v1/subscriber/message.py | def drop(self):
"""Release the message from lease management.
This informs the policy to no longer hold on to the lease for this
message. Pub/Sub will re-deliver the message if it is not acknowledged
before the existing lease expires.
.. warning::
For most use cases... | def drop(self):
"""Release the message from lease management.
This informs the policy to no longer hold on to the lease for this
message. Pub/Sub will re-deliver the message if it is not acknowledged
before the existing lease expires.
.. warning::
For most use cases... | [
"Release",
"the",
"message",
"from",
"lease",
"management",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/message.py#L190-L205 | [
"def",
"drop",
"(",
"self",
")",
":",
"self",
".",
"_request_queue",
".",
"put",
"(",
"requests",
".",
"DropRequest",
"(",
"ack_id",
"=",
"self",
".",
"_ack_id",
",",
"byte_size",
"=",
"self",
".",
"size",
")",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Message.lease | Inform the policy to lease this message continually.
.. note::
This method is called by the constructor, and you should never
need to call it manually. | pubsub/google/cloud/pubsub_v1/subscriber/message.py | def lease(self):
"""Inform the policy to lease this message continually.
.. note::
This method is called by the constructor, and you should never
need to call it manually.
"""
self._request_queue.put(
requests.LeaseRequest(ack_id=self._ack_id, byte_si... | def lease(self):
"""Inform the policy to lease this message continually.
.. note::
This method is called by the constructor, and you should never
need to call it manually.
"""
self._request_queue.put(
requests.LeaseRequest(ack_id=self._ack_id, byte_si... | [
"Inform",
"the",
"policy",
"to",
"lease",
"this",
"message",
"continually",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/message.py#L207-L216 | [
"def",
"lease",
"(",
"self",
")",
":",
"self",
".",
"_request_queue",
".",
"put",
"(",
"requests",
".",
"LeaseRequest",
"(",
"ack_id",
"=",
"self",
".",
"_ack_id",
",",
"byte_size",
"=",
"self",
".",
"size",
")",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Message.modify_ack_deadline | Resets the deadline for acknowledgement.
New deadline will be the given value of seconds from now.
The default implementation handles this for you; you should not need
to manually deal with setting ack deadlines. The exception case is
if you are implementing your own custom subclass of... | pubsub/google/cloud/pubsub_v1/subscriber/message.py | def modify_ack_deadline(self, seconds):
"""Resets the deadline for acknowledgement.
New deadline will be the given value of seconds from now.
The default implementation handles this for you; you should not need
to manually deal with setting ack deadlines. The exception case is
... | def modify_ack_deadline(self, seconds):
"""Resets the deadline for acknowledgement.
New deadline will be the given value of seconds from now.
The default implementation handles this for you; you should not need
to manually deal with setting ack deadlines. The exception case is
... | [
"Resets",
"the",
"deadline",
"for",
"acknowledgement",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/message.py#L218-L235 | [
"def",
"modify_ack_deadline",
"(",
"self",
",",
"seconds",
")",
":",
"self",
".",
"_request_queue",
".",
"put",
"(",
"requests",
".",
"ModAckRequest",
"(",
"ack_id",
"=",
"self",
".",
"_ack_id",
",",
"seconds",
"=",
"seconds",
")",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Message.nack | Decline to acknowldge the given message.
This will cause the message to be re-delivered to the subscription. | pubsub/google/cloud/pubsub_v1/subscriber/message.py | def nack(self):
"""Decline to acknowldge the given message.
This will cause the message to be re-delivered to the subscription.
"""
self._request_queue.put(
requests.NackRequest(ack_id=self._ack_id, byte_size=self.size)
) | def nack(self):
"""Decline to acknowldge the given message.
This will cause the message to be re-delivered to the subscription.
"""
self._request_queue.put(
requests.NackRequest(ack_id=self._ack_id, byte_size=self.size)
) | [
"Decline",
"to",
"acknowldge",
"the",
"given",
"message",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/pubsub/google/cloud/pubsub_v1/subscriber/message.py#L237-L244 | [
"def",
"nack",
"(",
"self",
")",
":",
"self",
".",
"_request_queue",
".",
"put",
"(",
"requests",
".",
"NackRequest",
"(",
"ack_id",
"=",
"self",
".",
"_ack_id",
",",
"byte_size",
"=",
"self",
".",
"size",
")",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _run_query | Runs a query while printing status updates
Args:
client (google.cloud.bigquery.client.Client):
Client to bundle configuration needed for API requests.
query (str):
SQL query to be executed. Defaults to the standard SQL dialect.
Use the ``job_config`` parameter to... | bigquery/google/cloud/bigquery/magics.py | def _run_query(client, query, job_config=None):
"""Runs a query while printing status updates
Args:
client (google.cloud.bigquery.client.Client):
Client to bundle configuration needed for API requests.
query (str):
SQL query to be executed. Defaults to the standard SQL d... | def _run_query(client, query, job_config=None):
"""Runs a query while printing status updates
Args:
client (google.cloud.bigquery.client.Client):
Client to bundle configuration needed for API requests.
query (str):
SQL query to be executed. Defaults to the standard SQL d... | [
"Runs",
"a",
"query",
"while",
"printing",
"status",
"updates"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/magics.py#L243-L278 | [
"def",
"_run_query",
"(",
"client",
",",
"query",
",",
"job_config",
"=",
"None",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"query_job",
"=",
"client",
".",
"query",
"(",
"query",
",",
"job_config",
"=",
"job_config",
")",
"print",
"(... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _cell_magic | Underlying function for bigquery cell magic
Note:
This function contains the underlying logic for the 'bigquery' cell
magic. This function is not meant to be called directly.
Args:
line (str): "%%bigquery" followed by arguments as required
query (str): SQL query to run
Ret... | bigquery/google/cloud/bigquery/magics.py | def _cell_magic(line, query):
"""Underlying function for bigquery cell magic
Note:
This function contains the underlying logic for the 'bigquery' cell
magic. This function is not meant to be called directly.
Args:
line (str): "%%bigquery" followed by arguments as required
q... | def _cell_magic(line, query):
"""Underlying function for bigquery cell magic
Note:
This function contains the underlying logic for the 'bigquery' cell
magic. This function is not meant to be called directly.
Args:
line (str): "%%bigquery" followed by arguments as required
q... | [
"Underlying",
"function",
"for",
"bigquery",
"cell",
"magic"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/magics.py#L336-L381 | [
"def",
"_cell_magic",
"(",
"line",
",",
"query",
")",
":",
"args",
"=",
"magic_arguments",
".",
"parse_argstring",
"(",
"_cell_magic",
",",
"line",
")",
"params",
"=",
"[",
"]",
"if",
"args",
".",
"params",
"is",
"not",
"None",
":",
"try",
":",
"params... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Context.credentials | google.auth.credentials.Credentials: Credentials to use for queries
performed through IPython magics
Note:
These credentials do not need to be explicitly defined if you are
using Application Default Credentials. If you are not using
Application Default Credentials, m... | bigquery/google/cloud/bigquery/magics.py | def credentials(self):
"""google.auth.credentials.Credentials: Credentials to use for queries
performed through IPython magics
Note:
These credentials do not need to be explicitly defined if you are
using Application Default Credentials. If you are not using
... | def credentials(self):
"""google.auth.credentials.Credentials: Credentials to use for queries
performed through IPython magics
Note:
These credentials do not need to be explicitly defined if you are
using Application Default Credentials. If you are not using
... | [
"google",
".",
"auth",
".",
"credentials",
".",
"Credentials",
":",
"Credentials",
"to",
"use",
"for",
"queries",
"performed",
"through",
"IPython",
"magics"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/magics.py#L165-L193 | [
"def",
"credentials",
"(",
"self",
")",
":",
"if",
"self",
".",
"_credentials",
"is",
"None",
":",
"self",
".",
"_credentials",
",",
"_",
"=",
"google",
".",
"auth",
".",
"default",
"(",
")",
"return",
"self",
".",
"_credentials"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Context.project | str: Default project to use for queries performed through IPython
magics
Note:
The project does not need to be explicitly defined if you have an
environment default project set. If you do not have a default
project set in your environment, manually assign the project... | bigquery/google/cloud/bigquery/magics.py | def project(self):
"""str: Default project to use for queries performed through IPython
magics
Note:
The project does not need to be explicitly defined if you have an
environment default project set. If you do not have a default
project set in your environmen... | def project(self):
"""str: Default project to use for queries performed through IPython
magics
Note:
The project does not need to be explicitly defined if you have an
environment default project set. If you do not have a default
project set in your environmen... | [
"str",
":",
"Default",
"project",
"to",
"use",
"for",
"queries",
"performed",
"through",
"IPython",
"magics"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/magics.py#L200-L218 | [
"def",
"project",
"(",
"self",
")",
":",
"if",
"self",
".",
"_project",
"is",
"None",
":",
"_",
",",
"self",
".",
"_project",
"=",
"google",
".",
"auth",
".",
"default",
"(",
")",
"return",
"self",
".",
"_project"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.database_root_path | Return a fully-qualified database_root string. | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def database_root_path(cls, project, database):
"""Return a fully-qualified database_root string."""
return google.api_core.path_template.expand(
"projects/{project}/databases/{database}",
project=project,
database=database,
) | def database_root_path(cls, project, database):
"""Return a fully-qualified database_root string."""
return google.api_core.path_template.expand(
"projects/{project}/databases/{database}",
project=project,
database=database,
) | [
"Return",
"a",
"fully",
"-",
"qualified",
"database_root",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L99-L105 | [
"def",
"database_root_path",
"(",
"cls",
",",
"project",
",",
"database",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/databases/{database}\"",
",",
"project",
"=",
"project",
",",
"database",
"=",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.document_root_path | Return a fully-qualified document_root string. | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def document_root_path(cls, project, database):
"""Return a fully-qualified document_root string."""
return google.api_core.path_template.expand(
"projects/{project}/databases/{database}/documents",
project=project,
database=database,
) | def document_root_path(cls, project, database):
"""Return a fully-qualified document_root string."""
return google.api_core.path_template.expand(
"projects/{project}/databases/{database}/documents",
project=project,
database=database,
) | [
"Return",
"a",
"fully",
"-",
"qualified",
"document_root",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L108-L114 | [
"def",
"document_root_path",
"(",
"cls",
",",
"project",
",",
"database",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/databases/{database}/documents\"",
",",
"project",
"=",
"project",
",",
"database... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.document_path_path | Return a fully-qualified document_path string. | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def document_path_path(cls, project, database, document_path):
"""Return a fully-qualified document_path string."""
return google.api_core.path_template.expand(
"projects/{project}/databases/{database}/documents/{document_path=**}",
project=project,
database=database,... | def document_path_path(cls, project, database, document_path):
"""Return a fully-qualified document_path string."""
return google.api_core.path_template.expand(
"projects/{project}/databases/{database}/documents/{document_path=**}",
project=project,
database=database,... | [
"Return",
"a",
"fully",
"-",
"qualified",
"document_path",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L117-L124 | [
"def",
"document_path_path",
"(",
"cls",
",",
"project",
",",
"database",
",",
"document_path",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/databases/{database}/documents/{document_path=**}\"",
",",
"pro... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.any_path_path | Return a fully-qualified any_path string. | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def any_path_path(cls, project, database, document, any_path):
"""Return a fully-qualified any_path string."""
return google.api_core.path_template.expand(
"projects/{project}/databases/{database}/documents/{document}/{any_path=**}",
project=project,
database=database... | def any_path_path(cls, project, database, document, any_path):
"""Return a fully-qualified any_path string."""
return google.api_core.path_template.expand(
"projects/{project}/databases/{database}/documents/{document}/{any_path=**}",
project=project,
database=database... | [
"Return",
"a",
"fully",
"-",
"qualified",
"any_path",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L127-L135 | [
"def",
"any_path_path",
"(",
"cls",
",",
"project",
",",
"database",
",",
"document",
",",
"any_path",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/databases/{database}/documents/{document}/{any_path=**}\... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.get_document | Gets a single document.
Example:
>>> from google.cloud import firestore_v1beta1
>>>
>>> client = firestore_v1beta1.FirestoreClient()
>>>
>>> name = client.any_path_path('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]')
>>>
... | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def get_document(
self,
name,
mask=None,
transaction=None,
read_time=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets a single document.
Example:
... | def get_document(
self,
name,
mask=None,
transaction=None,
read_time=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets a single document.
Example:
... | [
"Gets",
"a",
"single",
"document",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L236-L328 | [
"def",
"get_document",
"(",
"self",
",",
"name",
",",
"mask",
"=",
"None",
",",
"transaction",
"=",
"None",
",",
"read_time",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"="... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.list_documents | Lists documents.
Example:
>>> from google.cloud import firestore_v1beta1
>>>
>>> client = firestore_v1beta1.FirestoreClient()
>>>
>>> parent = client.any_path_path('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]')
>>>
>>> ... | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def list_documents(
self,
parent,
collection_id,
page_size=None,
order_by=None,
mask=None,
transaction=None,
read_time=None,
show_missing=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.D... | def list_documents(
self,
parent,
collection_id,
page_size=None,
order_by=None,
mask=None,
transaction=None,
read_time=None,
show_missing=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.D... | [
"Lists",
"documents",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L330-L467 | [
"def",
"list_documents",
"(",
"self",
",",
"parent",
",",
"collection_id",
",",
"page_size",
"=",
"None",
",",
"order_by",
"=",
"None",
",",
"mask",
"=",
"None",
",",
"transaction",
"=",
"None",
",",
"read_time",
"=",
"None",
",",
"show_missing",
"=",
"N... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.create_document | Creates a new document.
Example:
>>> from google.cloud import firestore_v1beta1
>>>
>>> client = firestore_v1beta1.FirestoreClient()
>>>
>>> parent = client.any_path_path('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]')
>>>
... | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def create_document(
self,
parent,
collection_id,
document_id,
document,
mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a new document.
... | def create_document(
self,
parent,
collection_id,
document_id,
document,
mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a new document.
... | [
"Creates",
"a",
"new",
"document",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L469-L560 | [
"def",
"create_document",
"(",
"self",
",",
"parent",
",",
"collection_id",
",",
"document_id",
",",
"document",
",",
"mask",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.update_document | Updates or inserts a document.
Example:
>>> from google.cloud import firestore_v1beta1
>>>
>>> client = firestore_v1beta1.FirestoreClient()
>>>
>>> # TODO: Initialize `document`:
>>> document = {}
>>>
>>> # TODO: In... | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def update_document(
self,
document,
update_mask,
mask=None,
current_document=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates or inserts a document.
... | def update_document(
self,
document,
update_mask,
mask=None,
current_document=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates or inserts a document.
... | [
"Updates",
"or",
"inserts",
"a",
"document",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L562-L667 | [
"def",
"update_document",
"(",
"self",
",",
"document",
",",
"update_mask",
",",
"mask",
"=",
"None",
",",
"current_document",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.delete_document | Deletes a document.
Example:
>>> from google.cloud import firestore_v1beta1
>>>
>>> client = firestore_v1beta1.FirestoreClient()
>>>
>>> name = client.any_path_path('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]')
>>>
>>>... | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def delete_document(
self,
name,
current_document=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes a document.
Example:
>>> from google.cloud import... | def delete_document(
self,
name,
current_document=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes a document.
Example:
>>> from google.cloud import... | [
"Deletes",
"a",
"document",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L669-L742 | [
"def",
"delete_document",
"(",
"self",
",",
"name",
",",
"current_document",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.batch_get_documents | Gets multiple documents.
Documents returned by this method are not guaranteed to be returned in the
same order that they were requested.
Example:
>>> from google.cloud import firestore_v1beta1
>>>
>>> client = firestore_v1beta1.FirestoreClient()
... | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def batch_get_documents(
self,
database,
documents,
mask=None,
transaction=None,
new_transaction=None,
read_time=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
... | def batch_get_documents(
self,
database,
documents,
mask=None,
transaction=None,
new_transaction=None,
read_time=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
... | [
"Gets",
"multiple",
"documents",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L744-L864 | [
"def",
"batch_get_documents",
"(",
"self",
",",
"database",
",",
"documents",
",",
"mask",
"=",
"None",
",",
"transaction",
"=",
"None",
",",
"new_transaction",
"=",
"None",
",",
"read_time",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.begin_transaction | Starts a new transaction.
Example:
>>> from google.cloud import firestore_v1beta1
>>>
>>> client = firestore_v1beta1.FirestoreClient()
>>>
>>> database = client.database_root_path('[PROJECT]', '[DATABASE]')
>>>
>>> response = c... | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def begin_transaction(
self,
database,
options_=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Starts a new transaction.
Example:
>>> from google.cloud im... | def begin_transaction(
self,
database,
options_=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Starts a new transaction.
Example:
>>> from google.cloud im... | [
"Starts",
"a",
"new",
"transaction",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L866-L942 | [
"def",
"begin_transaction",
"(",
"self",
",",
"database",
",",
"options_",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"m... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.run_query | Runs a query.
Example:
>>> from google.cloud import firestore_v1beta1
>>>
>>> client = firestore_v1beta1.FirestoreClient()
>>>
>>> parent = client.any_path_path('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]')
>>>
>>> for... | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def run_query(
self,
parent,
structured_query=None,
transaction=None,
new_transaction=None,
read_time=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Ru... | def run_query(
self,
parent,
structured_query=None,
transaction=None,
new_transaction=None,
read_time=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Ru... | [
"Runs",
"a",
"query",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L1102-L1214 | [
"def",
"run_query",
"(",
"self",
",",
"parent",
",",
"structured_query",
"=",
"None",
",",
"transaction",
"=",
"None",
",",
"new_transaction",
"=",
"None",
",",
"read_time",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreClient.write | Streams batches of document updates and deletes, in order.
EXPERIMENTAL: This method interface might change in the future.
Example:
>>> from google.cloud import firestore_v1beta1
>>>
>>> client = firestore_v1beta1.FirestoreClient()
>>>
>>> da... | firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py | def write(
self,
requests,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Streams batches of document updates and deletes, in order.
EXPERIMENTAL: This method interface might chang... | def write(
self,
requests,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Streams batches of document updates and deletes, in order.
EXPERIMENTAL: This method interface might chang... | [
"Streams",
"batches",
"of",
"document",
"updates",
"and",
"deletes",
"in",
"order",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L1216-L1276 | [
"def",
"write",
"(",
"self",
",",
"requests",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"metadata",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | LoggingServiceV2Client.log_path | Return a fully-qualified log string. | logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py | def log_path(cls, project, log):
"""Return a fully-qualified log string."""
return google.api_core.path_template.expand(
"projects/{project}/logs/{log}", project=project, log=log
) | def log_path(cls, project, log):
"""Return a fully-qualified log string."""
return google.api_core.path_template.expand(
"projects/{project}/logs/{log}", project=project, log=log
) | [
"Return",
"a",
"fully",
"-",
"qualified",
"log",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py#L75-L79 | [
"def",
"log_path",
"(",
"cls",
",",
"project",
",",
"log",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/logs/{log}\"",
",",
"project",
"=",
"project",
",",
"log",
"=",
"log",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | LoggingServiceV2Client.delete_log | Deletes all the log entries in a log.
The log reappears if it receives new entries.
Log entries written shortly before the delete operation might not be
deleted.
Example:
>>> from google.cloud import logging_v2
>>>
>>> client = logging_v2.LoggingServi... | logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py | def delete_log(
self,
log_name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes all the log entries in a log.
The log reappears if it receives new entries.
Log entrie... | def delete_log(
self,
log_name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes all the log entries in a log.
The log reappears if it receives new entries.
Log entrie... | [
"Deletes",
"all",
"the",
"log",
"entries",
"in",
"a",
"log",
".",
"The",
"log",
"reappears",
"if",
"it",
"receives",
"new",
"entries",
".",
"Log",
"entries",
"written",
"shortly",
"before",
"the",
"delete",
"operation",
"might",
"not",
"be",
"deleted",
"."... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py#L187-L266 | [
"def",
"delete_log",
"(",
"self",
",",
"log_name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"metadat... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | LoggingServiceV2Client.write_log_entries | Writes log entries to Logging. This API method is the
only way to send log entries to Logging. This method
is used, directly or indirectly, by the Logging agent
(fluentd) and all logging libraries configured to use Logging.
A single request may contain log entries for a maximum of 1000
... | logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py | def write_log_entries(
self,
entries,
log_name=None,
resource=None,
labels=None,
partial_success=None,
dry_run=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
... | def write_log_entries(
self,
entries,
log_name=None,
resource=None,
labels=None,
partial_success=None,
dry_run=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
... | [
"Writes",
"log",
"entries",
"to",
"Logging",
".",
"This",
"API",
"method",
"is",
"the",
"only",
"way",
"to",
"send",
"log",
"entries",
"to",
"Logging",
".",
"This",
"method",
"is",
"used",
"directly",
"or",
"indirectly",
"by",
"the",
"Logging",
"agent",
... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py#L268-L414 | [
"def",
"write_log_entries",
"(",
"self",
",",
"entries",
",",
"log_name",
"=",
"None",
",",
"resource",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"partial_success",
"=",
"None",
",",
"dry_run",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | LoggingServiceV2Client.list_log_entries | Lists log entries. Use this method to retrieve log entries from Logging.
For ways to export log entries, see `Exporting
Logs <https://cloud.google.com/logging/docs/export>`__.
Example:
>>> from google.cloud import logging_v2
>>>
>>> client = logging_v2.Loggin... | logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py | def list_log_entries(
self,
resource_names,
project_ids=None,
filter_=None,
order_by=None,
page_size=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Lis... | def list_log_entries(
self,
resource_names,
project_ids=None,
filter_=None,
order_by=None,
page_size=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Lis... | [
"Lists",
"log",
"entries",
".",
"Use",
"this",
"method",
"to",
"retrieve",
"log",
"entries",
"from",
"Logging",
".",
"For",
"ways",
"to",
"export",
"log",
"entries",
"see",
"Exporting",
"Logs",
"<https",
":",
"//",
"cloud",
".",
"google",
".",
"com",
"/"... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py#L416-L544 | [
"def",
"list_log_entries",
"(",
"self",
",",
"resource_names",
",",
"project_ids",
"=",
"None",
",",
"filter_",
"=",
"None",
",",
"order_by",
"=",
"None",
",",
"page_size",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _expand_variable_match | Expand a matched variable with its value.
Args:
positional_vars (list): A list of positonal variables. This list will
be modified.
named_vars (dict): A dictionary of named variables.
match (re.Match): A regular expression match.
Returns:
str: The expanded variable t... | api_core/google/api_core/path_template.py | def _expand_variable_match(positional_vars, named_vars, match):
"""Expand a matched variable with its value.
Args:
positional_vars (list): A list of positonal variables. This list will
be modified.
named_vars (dict): A dictionary of named variables.
match (re.Match): A regul... | def _expand_variable_match(positional_vars, named_vars, match):
"""Expand a matched variable with its value.
Args:
positional_vars (list): A list of positonal variables. This list will
be modified.
named_vars (dict): A dictionary of named variables.
match (re.Match): A regul... | [
"Expand",
"a",
"matched",
"variable",
"with",
"its",
"value",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/path_template.py#L65-L101 | [
"def",
"_expand_variable_match",
"(",
"positional_vars",
",",
"named_vars",
",",
"match",
")",
":",
"positional",
"=",
"match",
".",
"group",
"(",
"\"positional\"",
")",
"name",
"=",
"match",
".",
"group",
"(",
"\"name\"",
")",
"if",
"name",
"is",
"not",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | expand | Expand a path template with the given variables.
..code-block:: python
>>> expand('users/*/messages/*', 'me', '123')
users/me/messages/123
>>> expand('/v1/{name=shelves/*/books/*}', name='shelves/1/books/3')
/v1/shelves/1/books/3
Args:
tmpl (str): The path template.
... | api_core/google/api_core/path_template.py | def expand(tmpl, *args, **kwargs):
"""Expand a path template with the given variables.
..code-block:: python
>>> expand('users/*/messages/*', 'me', '123')
users/me/messages/123
>>> expand('/v1/{name=shelves/*/books/*}', name='shelves/1/books/3')
/v1/shelves/1/books/3
Args:... | def expand(tmpl, *args, **kwargs):
"""Expand a path template with the given variables.
..code-block:: python
>>> expand('users/*/messages/*', 'me', '123')
users/me/messages/123
>>> expand('/v1/{name=shelves/*/books/*}', name='shelves/1/books/3')
/v1/shelves/1/books/3
Args:... | [
"Expand",
"a",
"path",
"template",
"with",
"the",
"given",
"variables",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/path_template.py#L104-L128 | [
"def",
"expand",
"(",
"tmpl",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"replacer",
"=",
"functools",
".",
"partial",
"(",
"_expand_variable_match",
",",
"list",
"(",
"args",
")",
",",
"kwargs",
")",
"return",
"_VARIABLE_RE",
".",
"sub",
"("... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _replace_variable_with_pattern | Replace a variable match with a pattern that can be used to validate it.
Args:
match (re.Match): A regular expression match
Returns:
str: A regular expression pattern that can be used to validate the
variable in an expanded path.
Raises:
ValueError: If an unexpected te... | api_core/google/api_core/path_template.py | def _replace_variable_with_pattern(match):
"""Replace a variable match with a pattern that can be used to validate it.
Args:
match (re.Match): A regular expression match
Returns:
str: A regular expression pattern that can be used to validate the
variable in an expanded path.
... | def _replace_variable_with_pattern(match):
"""Replace a variable match with a pattern that can be used to validate it.
Args:
match (re.Match): A regular expression match
Returns:
str: A regular expression pattern that can be used to validate the
variable in an expanded path.
... | [
"Replace",
"a",
"variable",
"match",
"with",
"a",
"pattern",
"that",
"can",
"be",
"used",
"to",
"validate",
"it",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/path_template.py#L131-L159 | [
"def",
"_replace_variable_with_pattern",
"(",
"match",
")",
":",
"positional",
"=",
"match",
".",
"group",
"(",
"\"positional\"",
")",
"name",
"=",
"match",
".",
"group",
"(",
"\"name\"",
")",
"template",
"=",
"match",
".",
"group",
"(",
"\"template\"",
")",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | validate | Validate a path against the path template.
.. code-block:: python
>>> validate('users/*/messages/*', 'users/me/messages/123')
True
>>> validate('users/*/messages/*', 'users/me/drafts/123')
False
>>> validate('/v1/{name=shelves/*/books/*}', /v1/shelves/1/books/3)
Tru... | api_core/google/api_core/path_template.py | def validate(tmpl, path):
"""Validate a path against the path template.
.. code-block:: python
>>> validate('users/*/messages/*', 'users/me/messages/123')
True
>>> validate('users/*/messages/*', 'users/me/drafts/123')
False
>>> validate('/v1/{name=shelves/*/books/*}', /... | def validate(tmpl, path):
"""Validate a path against the path template.
.. code-block:: python
>>> validate('users/*/messages/*', 'users/me/messages/123')
True
>>> validate('users/*/messages/*', 'users/me/drafts/123')
False
>>> validate('/v1/{name=shelves/*/books/*}', /... | [
"Validate",
"a",
"path",
"against",
"the",
"path",
"template",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/path_template.py#L175-L197 | [
"def",
"validate",
"(",
"tmpl",
",",
"path",
")",
":",
"pattern",
"=",
"_generate_pattern_for_template",
"(",
"tmpl",
")",
"+",
"\"$\"",
"return",
"True",
"if",
"re",
".",
"match",
"(",
"pattern",
",",
"path",
")",
"is",
"not",
"None",
"else",
"False"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | default | Default unit test session.
This is intended to be run **without** an interpreter set, so
that the current ``python`` (on the ``PATH``) or the version of
Python corresponding to the ``nox`` binary the ``PATH`` can
run the tests. | storage/noxfile.py | def default(session):
"""Default unit test session.
This is intended to be run **without** an interpreter set, so
that the current ``python`` (on the ``PATH``) or the version of
Python corresponding to the ``nox`` binary the ``PATH`` can
run the tests.
"""
# Install all test dependencies, t... | def default(session):
"""Default unit test session.
This is intended to be run **without** an interpreter set, so
that the current ``python`` (on the ``PATH``) or the version of
Python corresponding to the ``nox`` binary the ``PATH`` can
run the tests.
"""
# Install all test dependencies, t... | [
"Default",
"unit",
"test",
"session",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/noxfile.py#L29-L55 | [
"def",
"default",
"(",
"session",
")",
":",
"# Install all test dependencies, then install local packages in-place.",
"session",
".",
"install",
"(",
"'mock'",
",",
"'pytest'",
",",
"'pytest-cov'",
")",
"for",
"local_dep",
"in",
"LOCAL_DEPS",
":",
"session",
".",
"ins... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | FirestoreGrpcTransport.create_channel | Create and return a gRPC channel object.
Args:
address (str): The host for the channel to use.
credentials (~.Credentials): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If
... | firestore/google/cloud/firestore_v1beta1/gapic/transports/firestore_grpc_transport.py | def create_channel(cls, address="firestore.googleapis.com:443", credentials=None):
"""Create and return a gRPC channel object.
Args:
address (str): The host for the channel to use.
credentials (~.Credentials): The
authorization credentials to attach to requests. ... | def create_channel(cls, address="firestore.googleapis.com:443", credentials=None):
"""Create and return a gRPC channel object.
Args:
address (str): The host for the channel to use.
credentials (~.Credentials): The
authorization credentials to attach to requests. ... | [
"Create",
"and",
"return",
"a",
"gRPC",
"channel",
"object",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/transports/firestore_grpc_transport.py#L72-L88 | [
"def",
"create_channel",
"(",
"cls",
",",
"address",
"=",
"\"firestore.googleapis.com:443\"",
",",
"credentials",
"=",
"None",
")",
":",
"return",
"google",
".",
"api_core",
".",
"grpc_helpers",
".",
"create_channel",
"(",
"address",
",",
"credentials",
"=",
"cr... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | AppProfile.name | AppProfile name used in requests.
.. note::
This property will not change if ``app_profile_id`` does not, but
the return value is not cached.
The AppProfile name is of the form
``"projects/../instances/../app_profile/{app_profile_id}"``
:rtype: str
:re... | bigtable/google/cloud/bigtable/app_profile.py | def name(self):
"""AppProfile name used in requests.
.. note::
This property will not change if ``app_profile_id`` does not, but
the return value is not cached.
The AppProfile name is of the form
``"projects/../instances/../app_profile/{app_profile_id}"``
... | def name(self):
"""AppProfile name used in requests.
.. note::
This property will not change if ``app_profile_id`` does not, but
the return value is not cached.
The AppProfile name is of the form
``"projects/../instances/../app_profile/{app_profile_id}"``
... | [
"AppProfile",
"name",
"used",
"in",
"requests",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/app_profile.py#L85-L103 | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"instance_admin_client",
".",
"app_profile_path",
"(",
"self",
".",
"_instance",
".",
"_client",
".",
"project",
",",
"self",
".",
"_instance",
".",
"instance_id",
",",
"self",
".",
"app_profile_id... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | AppProfile.from_pb | Creates an instance app_profile from a protobuf.
:type app_profile_pb: :class:`instance_pb2.app_profile_pb`
:param app_profile_pb: An instance protobuf object.
:type instance: :class:`google.cloud.bigtable.instance.Instance`
:param instance: The instance that owns the cluster.
... | bigtable/google/cloud/bigtable/app_profile.py | def from_pb(cls, app_profile_pb, instance):
"""Creates an instance app_profile from a protobuf.
:type app_profile_pb: :class:`instance_pb2.app_profile_pb`
:param app_profile_pb: An instance protobuf object.
:type instance: :class:`google.cloud.bigtable.instance.Instance`
:param... | def from_pb(cls, app_profile_pb, instance):
"""Creates an instance app_profile from a protobuf.
:type app_profile_pb: :class:`instance_pb2.app_profile_pb`
:param app_profile_pb: An instance protobuf object.
:type instance: :class:`google.cloud.bigtable.instance.Instance`
:param... | [
"Creates",
"an",
"instance",
"app_profile",
"from",
"a",
"protobuf",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/app_profile.py#L131-L171 | [
"def",
"from_pb",
"(",
"cls",
",",
"app_profile_pb",
",",
"instance",
")",
":",
"match_app_profile_name",
"=",
"_APP_PROFILE_NAME_RE",
".",
"match",
"(",
"app_profile_pb",
".",
"name",
")",
"if",
"match_app_profile_name",
"is",
"None",
":",
"raise",
"ValueError",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | AppProfile._update_from_pb | Refresh self from the server-provided protobuf.
Helper for :meth:`from_pb` and :meth:`reload`. | bigtable/google/cloud/bigtable/app_profile.py | def _update_from_pb(self, app_profile_pb):
"""Refresh self from the server-provided protobuf.
Helper for :meth:`from_pb` and :meth:`reload`.
"""
self.routing_policy_type = None
self.allow_transactional_writes = None
self.cluster_id = None
self.description = app_p... | def _update_from_pb(self, app_profile_pb):
"""Refresh self from the server-provided protobuf.
Helper for :meth:`from_pb` and :meth:`reload`.
"""
self.routing_policy_type = None
self.allow_transactional_writes = None
self.cluster_id = None
self.description = app_p... | [
"Refresh",
"self",
"from",
"the",
"server",
"-",
"provided",
"protobuf",
".",
"Helper",
"for",
":",
"meth",
":",
"from_pb",
"and",
":",
"meth",
":",
"reload",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/app_profile.py#L173-L193 | [
"def",
"_update_from_pb",
"(",
"self",
",",
"app_profile_pb",
")",
":",
"self",
".",
"routing_policy_type",
"=",
"None",
"self",
".",
"allow_transactional_writes",
"=",
"None",
"self",
".",
"cluster_id",
"=",
"None",
"self",
".",
"description",
"=",
"app_profile... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | AppProfile._to_pb | Create an AppProfile proto buff message for API calls
:rtype: :class:`.instance_pb2.AppProfile`
:returns: The converted current object.
:raises: :class:`ValueError <exceptions.ValueError>` if the AppProfile
routing_policy_type is not set | bigtable/google/cloud/bigtable/app_profile.py | def _to_pb(self):
"""Create an AppProfile proto buff message for API calls
:rtype: :class:`.instance_pb2.AppProfile`
:returns: The converted current object.
:raises: :class:`ValueError <exceptions.ValueError>` if the AppProfile
routing_policy_type is not set
"""... | def _to_pb(self):
"""Create an AppProfile proto buff message for API calls
:rtype: :class:`.instance_pb2.AppProfile`
:returns: The converted current object.
:raises: :class:`ValueError <exceptions.ValueError>` if the AppProfile
routing_policy_type is not set
"""... | [
"Create",
"an",
"AppProfile",
"proto",
"buff",
"message",
"for",
"API",
"calls",
":",
"rtype",
":",
":",
"class",
":",
".",
"instance_pb2",
".",
"AppProfile",
":",
"returns",
":",
"The",
"converted",
"current",
"object",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/app_profile.py#L195-L225 | [
"def",
"_to_pb",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"routing_policy_type",
":",
"raise",
"ValueError",
"(",
"\"AppProfile required routing policy.\"",
")",
"single_cluster_routing",
"=",
"None",
"multi_cluster_routing_use_any",
"=",
"None",
"if",
"self",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | AppProfile.reload | Reload the metadata for this cluster | bigtable/google/cloud/bigtable/app_profile.py | def reload(self):
"""Reload the metadata for this cluster"""
app_profile_pb = self.instance_admin_client.get_app_profile(self.name)
# NOTE: _update_from_pb does not check that the project and
# app_profile ID on the response match the request.
self._update_from_pb(app_pro... | def reload(self):
"""Reload the metadata for this cluster"""
app_profile_pb = self.instance_admin_client.get_app_profile(self.name)
# NOTE: _update_from_pb does not check that the project and
# app_profile ID on the response match the request.
self._update_from_pb(app_pro... | [
"Reload",
"the",
"metadata",
"for",
"this",
"cluster"
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/app_profile.py#L227-L234 | [
"def",
"reload",
"(",
"self",
")",
":",
"app_profile_pb",
"=",
"self",
".",
"instance_admin_client",
".",
"get_app_profile",
"(",
"self",
".",
"name",
")",
"# NOTE: _update_from_pb does not check that the project and",
"# app_profile ID on the response match the request."... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | AppProfile.exists | Check whether the AppProfile already exists.
:rtype: bool
:returns: True if the AppProfile exists, else False. | bigtable/google/cloud/bigtable/app_profile.py | def exists(self):
"""Check whether the AppProfile already exists.
:rtype: bool
:returns: True if the AppProfile exists, else False.
"""
try:
self.instance_admin_client.get_app_profile(self.name)
return True
# NOTE: There could be other exceptions ... | def exists(self):
"""Check whether the AppProfile already exists.
:rtype: bool
:returns: True if the AppProfile exists, else False.
"""
try:
self.instance_admin_client.get_app_profile(self.name)
return True
# NOTE: There could be other exceptions ... | [
"Check",
"whether",
"the",
"AppProfile",
"already",
"exists",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/app_profile.py#L236-L247 | [
"def",
"exists",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"instance_admin_client",
".",
"get_app_profile",
"(",
"self",
".",
"name",
")",
"return",
"True",
"# NOTE: There could be other exceptions that are returned to the user.",
"except",
"NotFound",
":",
"ret... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | AppProfile.create | Create this AppProfile.
.. note::
Uses the ``instance`` and ``app_profile_id`` on the current
:class:`AppProfile` in addition to the ``routing_policy_type``,
``description``, ``cluster_id`` and ``allow_transactional_writes``.
To change them before creating, rese... | bigtable/google/cloud/bigtable/app_profile.py | def create(self, ignore_warnings=None):
"""Create this AppProfile.
.. note::
Uses the ``instance`` and ``app_profile_id`` on the current
:class:`AppProfile` in addition to the ``routing_policy_type``,
``description``, ``cluster_id`` and ``allow_transactional_writes`... | def create(self, ignore_warnings=None):
"""Create this AppProfile.
.. note::
Uses the ``instance`` and ``app_profile_id`` on the current
:class:`AppProfile` in addition to the ``routing_policy_type``,
``description``, ``cluster_id`` and ``allow_transactional_writes`... | [
"Create",
"this",
"AppProfile",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/app_profile.py#L249-L283 | [
"def",
"create",
"(",
"self",
",",
"ignore_warnings",
"=",
"None",
")",
":",
"return",
"self",
".",
"from_pb",
"(",
"self",
".",
"instance_admin_client",
".",
"create_app_profile",
"(",
"parent",
"=",
"self",
".",
"_instance",
".",
"name",
",",
"app_profile_... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | AppProfile.update | Update this app_profile.
.. note::
Update any or all of the following values:
``routing_policy_type``
``description``
``cluster_id``
``allow_transactional_writes`` | bigtable/google/cloud/bigtable/app_profile.py | def update(self, ignore_warnings=None):
"""Update this app_profile.
.. note::
Update any or all of the following values:
``routing_policy_type``
``description``
``cluster_id``
``allow_transactional_writes``
"""
update_mask_pb... | def update(self, ignore_warnings=None):
"""Update this app_profile.
.. note::
Update any or all of the following values:
``routing_policy_type``
``description``
``cluster_id``
``allow_transactional_writes``
"""
update_mask_pb... | [
"Update",
"this",
"app_profile",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/app_profile.py#L285-L311 | [
"def",
"update",
"(",
"self",
",",
"ignore_warnings",
"=",
"None",
")",
":",
"update_mask_pb",
"=",
"field_mask_pb2",
".",
"FieldMask",
"(",
")",
"if",
"self",
".",
"description",
"is",
"not",
"None",
":",
"update_mask_pb",
".",
"paths",
".",
"append",
"("... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ConfigServiceV2Client.sink_path | Return a fully-qualified sink string. | logging/google/cloud/logging_v2/gapic/config_service_v2_client.py | def sink_path(cls, project, sink):
"""Return a fully-qualified sink string."""
return google.api_core.path_template.expand(
"projects/{project}/sinks/{sink}", project=project, sink=sink
) | def sink_path(cls, project, sink):
"""Return a fully-qualified sink string."""
return google.api_core.path_template.expand(
"projects/{project}/sinks/{sink}", project=project, sink=sink
) | [
"Return",
"a",
"fully",
"-",
"qualified",
"sink",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/config_service_v2_client.py#L88-L92 | [
"def",
"sink_path",
"(",
"cls",
",",
"project",
",",
"sink",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/sinks/{sink}\"",
",",
"project",
"=",
"project",
",",
"sink",
"=",
"sink",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ConfigServiceV2Client.exclusion_path | Return a fully-qualified exclusion string. | logging/google/cloud/logging_v2/gapic/config_service_v2_client.py | def exclusion_path(cls, project, exclusion):
"""Return a fully-qualified exclusion string."""
return google.api_core.path_template.expand(
"projects/{project}/exclusions/{exclusion}",
project=project,
exclusion=exclusion,
) | def exclusion_path(cls, project, exclusion):
"""Return a fully-qualified exclusion string."""
return google.api_core.path_template.expand(
"projects/{project}/exclusions/{exclusion}",
project=project,
exclusion=exclusion,
) | [
"Return",
"a",
"fully",
"-",
"qualified",
"exclusion",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/config_service_v2_client.py#L95-L101 | [
"def",
"exclusion_path",
"(",
"cls",
",",
"project",
",",
"exclusion",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/exclusions/{exclusion}\"",
",",
"project",
"=",
"project",
",",
"exclusion",
"=",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ConfigServiceV2Client.create_sink | Creates a sink that exports specified log entries to a destination. The
export of newly-ingested log entries begins immediately, unless the
sink's ``writer_identity`` is not permitted to write to the destination.
A sink can export log entries only from the resource owning the sink.
Exam... | logging/google/cloud/logging_v2/gapic/config_service_v2_client.py | def create_sink(
self,
parent,
sink,
unique_writer_identity=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a sink that exports specified log entries to a desti... | def create_sink(
self,
parent,
sink,
unique_writer_identity=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a sink that exports specified log entries to a desti... | [
"Creates",
"a",
"sink",
"that",
"exports",
"specified",
"log",
"entries",
"to",
"a",
"destination",
".",
"The",
"export",
"of",
"newly",
"-",
"ingested",
"log",
"entries",
"begins",
"immediately",
"unless",
"the",
"sink",
"s",
"writer_identity",
"is",
"not",
... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/config_service_v2_client.py#L390-L493 | [
"def",
"create_sink",
"(",
"self",
",",
"parent",
",",
"sink",
",",
"unique_writer_identity",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ConfigServiceV2Client.update_sink | Updates a sink. This method replaces the following fields in the
existing sink with values from the new sink: ``destination``, and
``filter``. The updated sink might also have a new ``writer_identity``;
see the ``unique_writer_identity`` field.
Example:
>>> from google.cloud... | logging/google/cloud/logging_v2/gapic/config_service_v2_client.py | def update_sink(
self,
sink_name,
sink,
unique_writer_identity=None,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates a sink. This method rep... | def update_sink(
self,
sink_name,
sink,
unique_writer_identity=None,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates a sink. This method rep... | [
"Updates",
"a",
"sink",
".",
"This",
"method",
"replaces",
"the",
"following",
"fields",
"in",
"the",
"existing",
"sink",
"with",
"values",
"from",
"the",
"new",
"sink",
":",
"destination",
"and",
"filter",
".",
"The",
"updated",
"sink",
"might",
"also",
"... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/config_service_v2_client.py#L495-L619 | [
"def",
"update_sink",
"(",
"self",
",",
"sink_name",
",",
"sink",
",",
"unique_writer_identity",
"=",
"None",
",",
"update_mask",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"="... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ConfigServiceV2Client.create_exclusion | Creates a new exclusion in a specified parent resource.
Only log entries belonging to that resource can be excluded.
You can have up to 10 exclusions in a resource.
Example:
>>> from google.cloud import logging_v2
>>>
>>> client = logging_v2.ConfigServiceV2Cl... | logging/google/cloud/logging_v2/gapic/config_service_v2_client.py | def create_exclusion(
self,
parent,
exclusion,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a new exclusion in a specified parent resource.
Only log entries belong... | def create_exclusion(
self,
parent,
exclusion,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a new exclusion in a specified parent resource.
Only log entries belong... | [
"Creates",
"a",
"new",
"exclusion",
"in",
"a",
"specified",
"parent",
"resource",
".",
"Only",
"log",
"entries",
"belonging",
"to",
"that",
"resource",
"can",
"be",
"excluded",
".",
"You",
"can",
"have",
"up",
"to",
"10",
"exclusions",
"in",
"a",
"resource... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging_v2/gapic/config_service_v2_client.py#L886-L976 | [
"def",
"create_exclusion",
"(",
"self",
",",
"parent",
",",
"exclusion",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"D... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _make_value_pb | Helper for :func:`_make_list_value_pbs`.
:type value: scalar value
:param value: value to convert
:rtype: :class:`~google.protobuf.struct_pb2.Value`
:returns: value protobufs
:raises ValueError: if value is not of a known scalar type. | spanner/google/cloud/spanner_v1/_helpers.py | def _make_value_pb(value):
"""Helper for :func:`_make_list_value_pbs`.
:type value: scalar value
:param value: value to convert
:rtype: :class:`~google.protobuf.struct_pb2.Value`
:returns: value protobufs
:raises ValueError: if value is not of a known scalar type.
"""
if value is None:... | def _make_value_pb(value):
"""Helper for :func:`_make_list_value_pbs`.
:type value: scalar value
:param value: value to convert
:rtype: :class:`~google.protobuf.struct_pb2.Value`
:returns: value protobufs
:raises ValueError: if value is not of a known scalar type.
"""
if value is None:... | [
"Helper",
"for",
":",
"func",
":",
"_make_list_value_pbs",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/_helpers.py#L51-L91 | [
"def",
"_make_value_pb",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"Value",
"(",
"null_value",
"=",
"\"NULL_VALUE\"",
")",
"if",
"isinstance",
"(",
"value",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"Value",
"("... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _parse_value_pb | Convert a Value protobuf to cell data.
:type value_pb: :class:`~google.protobuf.struct_pb2.Value`
:param value_pb: protobuf to convert
:type field_type: :class:`~google.cloud.spanner_v1.proto.type_pb2.Type`
:param field_type: type code for the value
:rtype: varies on field_type
:returns: valu... | spanner/google/cloud/spanner_v1/_helpers.py | def _parse_value_pb(value_pb, field_type):
"""Convert a Value protobuf to cell data.
:type value_pb: :class:`~google.protobuf.struct_pb2.Value`
:param value_pb: protobuf to convert
:type field_type: :class:`~google.cloud.spanner_v1.proto.type_pb2.Type`
:param field_type: type code for the value
... | def _parse_value_pb(value_pb, field_type):
"""Convert a Value protobuf to cell data.
:type value_pb: :class:`~google.protobuf.struct_pb2.Value`
:param value_pb: protobuf to convert
:type field_type: :class:`~google.cloud.spanner_v1.proto.type_pb2.Type`
:param field_type: type code for the value
... | [
"Convert",
"a",
"Value",
"protobuf",
"to",
"cell",
"data",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/_helpers.py#L122-L167 | [
"def",
"_parse_value_pb",
"(",
"value_pb",
",",
"field_type",
")",
":",
"if",
"value_pb",
".",
"HasField",
"(",
"\"null_value\"",
")",
":",
"return",
"None",
"if",
"field_type",
".",
"code",
"==",
"type_pb2",
".",
"STRING",
":",
"result",
"=",
"value_pb",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _parse_list_value_pbs | Convert a list of ListValue protobufs into a list of list of cell data.
:type rows: list of :class:`~google.protobuf.struct_pb2.ListValue`
:param rows: row data returned from a read/query
:type row_type: :class:`~google.cloud.spanner_v1.proto.type_pb2.StructType`
:param row_type: row schema specificat... | spanner/google/cloud/spanner_v1/_helpers.py | def _parse_list_value_pbs(rows, row_type):
"""Convert a list of ListValue protobufs into a list of list of cell data.
:type rows: list of :class:`~google.protobuf.struct_pb2.ListValue`
:param rows: row data returned from a read/query
:type row_type: :class:`~google.cloud.spanner_v1.proto.type_pb2.Stru... | def _parse_list_value_pbs(rows, row_type):
"""Convert a list of ListValue protobufs into a list of list of cell data.
:type rows: list of :class:`~google.protobuf.struct_pb2.ListValue`
:param rows: row data returned from a read/query
:type row_type: :class:`~google.cloud.spanner_v1.proto.type_pb2.Stru... | [
"Convert",
"a",
"list",
"of",
"ListValue",
"protobufs",
"into",
"a",
"list",
"of",
"list",
"of",
"cell",
"data",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/_helpers.py#L173-L191 | [
"def",
"_parse_list_value_pbs",
"(",
"rows",
",",
"row_type",
")",
":",
"result",
"=",
"[",
"]",
"for",
"row",
"in",
"rows",
":",
"row_data",
"=",
"[",
"]",
"for",
"value_pb",
",",
"field",
"in",
"zip",
"(",
"row",
".",
"values",
",",
"row_type",
"."... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | AssetServiceClient.export_assets | Exports assets with time and resource types to a given Cloud Storage
location. The output format is newline-delimited JSON. This API
implements the ``google.longrunning.Operation`` API allowing you to keep
track of the export.
Example:
>>> from google.cloud import asset_v1
... | asset/google/cloud/asset_v1/gapic/asset_service_client.py | def export_assets(
self,
parent,
output_config,
read_time=None,
asset_types=None,
content_type=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Exports a... | def export_assets(
self,
parent,
output_config,
read_time=None,
asset_types=None,
content_type=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Exports a... | [
"Exports",
"assets",
"with",
"time",
"and",
"resource",
"types",
"to",
"a",
"given",
"Cloud",
"Storage",
"location",
".",
"The",
"output",
"format",
"is",
"newline",
"-",
"delimited",
"JSON",
".",
"This",
"API",
"implements",
"the",
"google",
".",
"longrunni... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/asset/google/cloud/asset_v1/gapic/asset_service_client.py#L179-L288 | [
"def",
"export_assets",
"(",
"self",
",",
"parent",
",",
"output_config",
",",
"read_time",
"=",
"None",
",",
"asset_types",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | AssetServiceClient.batch_get_assets_history | Batch gets the update history of assets that overlap a time window. For
RESOURCE content, this API outputs history with asset in both non-delete
or deleted status. For IAM\_POLICY content, this API outputs history
when the asset and its attached IAM POLICY both exist. This can create
gap... | asset/google/cloud/asset_v1/gapic/asset_service_client.py | def batch_get_assets_history(
self,
parent,
content_type,
read_time_window,
asset_names=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Batch gets the update hi... | def batch_get_assets_history(
self,
parent,
content_type,
read_time_window,
asset_names=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Batch gets the update hi... | [
"Batch",
"gets",
"the",
"update",
"history",
"of",
"assets",
"that",
"overlap",
"a",
"time",
"window",
".",
"For",
"RESOURCE",
"content",
"this",
"API",
"outputs",
"history",
"with",
"asset",
"in",
"both",
"non",
"-",
"delete",
"or",
"deleted",
"status",
"... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/asset/google/cloud/asset_v1/gapic/asset_service_client.py#L290-L387 | [
"def",
"batch_get_assets_history",
"(",
"self",
",",
"parent",
",",
"content_type",
",",
"read_time_window",
",",
"asset_names",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _avro_schema | Extract and parse Avro schema from a read session.
Args:
read_session ( \
~google.cloud.bigquery_storage_v1beta1.types.ReadSession \
):
The read session associated with this read rows stream. This
contains the schema, which is required to parse the data
... | bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py | def _avro_schema(read_session):
"""Extract and parse Avro schema from a read session.
Args:
read_session ( \
~google.cloud.bigquery_storage_v1beta1.types.ReadSession \
):
The read session associated with this read rows stream. This
contains the schema, which ... | def _avro_schema(read_session):
"""Extract and parse Avro schema from a read session.
Args:
read_session ( \
~google.cloud.bigquery_storage_v1beta1.types.ReadSession \
):
The read session associated with this read rows stream. This
contains the schema, which ... | [
"Extract",
"and",
"parse",
"Avro",
"schema",
"from",
"a",
"read",
"session",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L375-L393 | [
"def",
"_avro_schema",
"(",
"read_session",
")",
":",
"json_schema",
"=",
"json",
".",
"loads",
"(",
"read_session",
".",
"avro_schema",
".",
"schema",
")",
"column_names",
"=",
"tuple",
"(",
"(",
"field",
"[",
"\"name\"",
"]",
"for",
"field",
"in",
"json_... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _avro_rows | Parse all rows in a stream block.
Args:
block ( \
~google.cloud.bigquery_storage_v1beta1.types.ReadRowsResponse \
):
A block containing Avro bytes to parse into rows.
avro_schema (fastavro.schema):
A parsed Avro schema, used to deserialized the bytes in t... | bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py | def _avro_rows(block, avro_schema):
"""Parse all rows in a stream block.
Args:
block ( \
~google.cloud.bigquery_storage_v1beta1.types.ReadRowsResponse \
):
A block containing Avro bytes to parse into rows.
avro_schema (fastavro.schema):
A parsed Avro ... | def _avro_rows(block, avro_schema):
"""Parse all rows in a stream block.
Args:
block ( \
~google.cloud.bigquery_storage_v1beta1.types.ReadRowsResponse \
):
A block containing Avro bytes to parse into rows.
avro_schema (fastavro.schema):
A parsed Avro ... | [
"Parse",
"all",
"rows",
"in",
"a",
"stream",
"block",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L396-L421 | [
"def",
"_avro_rows",
"(",
"block",
",",
"avro_schema",
")",
":",
"blockio",
"=",
"six",
".",
"BytesIO",
"(",
"block",
".",
"avro_rows",
".",
"serialized_binary_rows",
")",
"while",
"True",
":",
"# Loop in a while loop because schemaless_reader can only read",
"# a sin... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _copy_stream_position | Copy a StreamPosition.
Args:
position (Union[ \
dict, \
~google.cloud.bigquery_storage_v1beta1.types.StreamPosition \
]):
StreamPostion (or dictionary in StreamPosition format) to copy.
Returns:
~google.cloud.bigquery_storage_v1beta1.types.StreamPosi... | bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py | def _copy_stream_position(position):
"""Copy a StreamPosition.
Args:
position (Union[ \
dict, \
~google.cloud.bigquery_storage_v1beta1.types.StreamPosition \
]):
StreamPostion (or dictionary in StreamPosition format) to copy.
Returns:
~google.clo... | def _copy_stream_position(position):
"""Copy a StreamPosition.
Args:
position (Union[ \
dict, \
~google.cloud.bigquery_storage_v1beta1.types.StreamPosition \
]):
StreamPostion (or dictionary in StreamPosition format) to copy.
Returns:
~google.clo... | [
"Copy",
"a",
"StreamPosition",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L424-L443 | [
"def",
"_copy_stream_position",
"(",
"position",
")",
":",
"if",
"isinstance",
"(",
"position",
",",
"types",
".",
"StreamPosition",
")",
":",
"output",
"=",
"types",
".",
"StreamPosition",
"(",
")",
"output",
".",
"CopyFrom",
"(",
"position",
")",
"return",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ReadRowsStream._reconnect | Reconnect to the ReadRows stream using the most recent offset. | bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py | def _reconnect(self):
"""Reconnect to the ReadRows stream using the most recent offset."""
self._wrapped = self._client.read_rows(
_copy_stream_position(self._position), **self._read_rows_kwargs
) | def _reconnect(self):
"""Reconnect to the ReadRows stream using the most recent offset."""
self._wrapped = self._client.read_rows(
_copy_stream_position(self._position), **self._read_rows_kwargs
) | [
"Reconnect",
"to",
"the",
"ReadRows",
"stream",
"using",
"the",
"most",
"recent",
"offset",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L128-L132 | [
"def",
"_reconnect",
"(",
"self",
")",
":",
"self",
".",
"_wrapped",
"=",
"self",
".",
"_client",
".",
"read_rows",
"(",
"_copy_stream_position",
"(",
"self",
".",
"_position",
")",
",",
"*",
"*",
"self",
".",
"_read_rows_kwargs",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ReadRowsStream.to_dataframe | Create a :class:`pandas.DataFrame` of all rows in the stream.
This method requires the pandas libary to create a data frame and the
fastavro library to parse row blocks.
.. warning::
DATETIME columns are not supported. They are currently parsed as
strings in the fastavr... | bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py | def to_dataframe(self, read_session, dtypes=None):
"""Create a :class:`pandas.DataFrame` of all rows in the stream.
This method requires the pandas libary to create a data frame and the
fastavro library to parse row blocks.
.. warning::
DATETIME columns are not supported. T... | def to_dataframe(self, read_session, dtypes=None):
"""Create a :class:`pandas.DataFrame` of all rows in the stream.
This method requires the pandas libary to create a data frame and the
fastavro library to parse row blocks.
.. warning::
DATETIME columns are not supported. T... | [
"Create",
"a",
":",
"class",
":",
"pandas",
".",
"DataFrame",
"of",
"all",
"rows",
"in",
"the",
"stream",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L161-L195 | [
"def",
"to_dataframe",
"(",
"self",
",",
"read_session",
",",
"dtypes",
"=",
"None",
")",
":",
"if",
"fastavro",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"_FASTAVRO_REQUIRED",
")",
"if",
"pandas",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"_PA... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ReadRowsIterable.pages | A generator of all pages in the stream.
Returns:
types.GeneratorType[google.cloud.bigquery_storage_v1beta1.ReadRowsPage]:
A generator of pages. | bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py | def pages(self):
"""A generator of all pages in the stream.
Returns:
types.GeneratorType[google.cloud.bigquery_storage_v1beta1.ReadRowsPage]:
A generator of pages.
"""
# Each page is an iterator of rows. But also has num_items, remaining,
# and to_dat... | def pages(self):
"""A generator of all pages in the stream.
Returns:
types.GeneratorType[google.cloud.bigquery_storage_v1beta1.ReadRowsPage]:
A generator of pages.
"""
# Each page is an iterator of rows. But also has num_items, remaining,
# and to_dat... | [
"A",
"generator",
"of",
"all",
"pages",
"in",
"the",
"stream",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L226-L238 | [
"def",
"pages",
"(",
"self",
")",
":",
"# Each page is an iterator of rows. But also has num_items, remaining,",
"# and to_dataframe.",
"avro_schema",
",",
"column_names",
"=",
"_avro_schema",
"(",
"self",
".",
"_read_session",
")",
"for",
"block",
"in",
"self",
".",
"_... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ReadRowsIterable.to_dataframe | Create a :class:`pandas.DataFrame` of all rows in the stream.
This method requires the pandas libary to create a data frame and the
fastavro library to parse row blocks.
.. warning::
DATETIME columns are not supported. They are currently parsed as
strings in the fastavr... | bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py | def to_dataframe(self, dtypes=None):
"""Create a :class:`pandas.DataFrame` of all rows in the stream.
This method requires the pandas libary to create a data frame and the
fastavro library to parse row blocks.
.. warning::
DATETIME columns are not supported. They are curren... | def to_dataframe(self, dtypes=None):
"""Create a :class:`pandas.DataFrame` of all rows in the stream.
This method requires the pandas libary to create a data frame and the
fastavro library to parse row blocks.
.. warning::
DATETIME columns are not supported. They are curren... | [
"Create",
"a",
":",
"class",
":",
"pandas",
".",
"DataFrame",
"of",
"all",
"rows",
"in",
"the",
"stream",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L246-L275 | [
"def",
"to_dataframe",
"(",
"self",
",",
"dtypes",
"=",
"None",
")",
":",
"if",
"pandas",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"_PANDAS_REQUIRED",
")",
"frames",
"=",
"[",
"]",
"for",
"page",
"in",
"self",
".",
"pages",
":",
"frames",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ReadRowsPage._parse_block | Parse metadata and rows from the block only once. | bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py | def _parse_block(self):
"""Parse metadata and rows from the block only once."""
if self._iter_rows is not None:
return
rows = _avro_rows(self._block, self._avro_schema)
self._num_items = self._block.avro_rows.row_count
self._remaining = self._block.avro_rows.row_coun... | def _parse_block(self):
"""Parse metadata and rows from the block only once."""
if self._iter_rows is not None:
return
rows = _avro_rows(self._block, self._avro_schema)
self._num_items = self._block.avro_rows.row_count
self._remaining = self._block.avro_rows.row_coun... | [
"Parse",
"metadata",
"and",
"rows",
"from",
"the",
"block",
"only",
"once",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L301-L309 | [
"def",
"_parse_block",
"(",
"self",
")",
":",
"if",
"self",
".",
"_iter_rows",
"is",
"not",
"None",
":",
"return",
"rows",
"=",
"_avro_rows",
"(",
"self",
".",
"_block",
",",
"self",
".",
"_avro_schema",
")",
"self",
".",
"_num_items",
"=",
"self",
"."... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ReadRowsPage.next | Get the next row in the page. | bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py | def next(self):
"""Get the next row in the page."""
self._parse_block()
if self._remaining > 0:
self._remaining -= 1
return six.next(self._iter_rows) | def next(self):
"""Get the next row in the page."""
self._parse_block()
if self._remaining > 0:
self._remaining -= 1
return six.next(self._iter_rows) | [
"Get",
"the",
"next",
"row",
"in",
"the",
"page",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L327-L332 | [
"def",
"next",
"(",
"self",
")",
":",
"self",
".",
"_parse_block",
"(",
")",
"if",
"self",
".",
"_remaining",
">",
"0",
":",
"self",
".",
"_remaining",
"-=",
"1",
"return",
"six",
".",
"next",
"(",
"self",
".",
"_iter_rows",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | ReadRowsPage.to_dataframe | Create a :class:`pandas.DataFrame` of rows in the page.
This method requires the pandas libary to create a data frame and the
fastavro library to parse row blocks.
.. warning::
DATETIME columns are not supported. They are currently parsed as
strings in the fastavro libr... | bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py | def to_dataframe(self, dtypes=None):
"""Create a :class:`pandas.DataFrame` of rows in the page.
This method requires the pandas libary to create a data frame and the
fastavro library to parse row blocks.
.. warning::
DATETIME columns are not supported. They are currently pa... | def to_dataframe(self, dtypes=None):
"""Create a :class:`pandas.DataFrame` of rows in the page.
This method requires the pandas libary to create a data frame and the
fastavro library to parse row blocks.
.. warning::
DATETIME columns are not supported. They are currently pa... | [
"Create",
"a",
":",
"class",
":",
"pandas",
".",
"DataFrame",
"of",
"rows",
"in",
"the",
"page",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py#L337-L372 | [
"def",
"to_dataframe",
"(",
"self",
",",
"dtypes",
"=",
"None",
")",
":",
"if",
"pandas",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"_PANDAS_REQUIRED",
")",
"if",
"dtypes",
"is",
"None",
":",
"dtypes",
"=",
"{",
"}",
"columns",
"=",
"collections",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | InstanceAdminClient.instance_config_path | Return a fully-qualified instance_config string. | spanner/google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py | def instance_config_path(cls, project, instance_config):
"""Return a fully-qualified instance_config string."""
return google.api_core.path_template.expand(
"projects/{project}/instanceConfigs/{instance_config}",
project=project,
instance_config=instance_config,
... | def instance_config_path(cls, project, instance_config):
"""Return a fully-qualified instance_config string."""
return google.api_core.path_template.expand(
"projects/{project}/instanceConfigs/{instance_config}",
project=project,
instance_config=instance_config,
... | [
"Return",
"a",
"fully",
"-",
"qualified",
"instance_config",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py#L110-L116 | [
"def",
"instance_config_path",
"(",
"cls",
",",
"project",
",",
"instance_config",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/instanceConfigs/{instance_config}\"",
",",
"project",
"=",
"project",
",",... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | InstanceAdminClient.create_instance | Creates an instance and begins preparing it to begin serving. The
returned ``long-running operation`` can be used to track the progress of
preparing the new instance. The instance name is assigned by the caller.
If the named instance already exists, ``CreateInstance`` returns
``ALREADY_E... | spanner/google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py | def create_instance(
self,
parent,
instance_id,
instance,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates an instance and begins preparing it to begin serving. The
... | def create_instance(
self,
parent,
instance_id,
instance,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates an instance and begins preparing it to begin serving. The
... | [
"Creates",
"an",
"instance",
"and",
"begins",
"preparing",
"it",
"to",
"begin",
"serving",
".",
"The",
"returned",
"long",
"-",
"running",
"operation",
"can",
"be",
"used",
"to",
"track",
"the",
"progress",
"of",
"preparing",
"the",
"new",
"instance",
".",
... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py#L594-L725 | [
"def",
"create_instance",
"(",
"self",
",",
"parent",
",",
"instance_id",
",",
"instance",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | InstanceAdminClient.update_instance | Updates an instance, and begins allocating or releasing resources as
requested. The returned ``long-running operation`` can be used to track
the progress of updating the instance. If the named instance does not
exist, returns ``NOT_FOUND``.
Immediately upon completion of this request:
... | spanner/google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py | def update_instance(
self,
instance,
field_mask,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates an instance, and begins allocating or releasing resources as
requeste... | def update_instance(
self,
instance,
field_mask,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates an instance, and begins allocating or releasing resources as
requeste... | [
"Updates",
"an",
"instance",
"and",
"begins",
"allocating",
"or",
"releasing",
"resources",
"as",
"requested",
".",
"The",
"returned",
"long",
"-",
"running",
"operation",
"can",
"be",
"used",
"to",
"track",
"the",
"progress",
"of",
"updating",
"the",
"instanc... | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py#L727-L866 | [
"def",
"update_instance",
"(",
"self",
",",
"instance",
",",
"field_mask",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | WebSecurityScannerClient.finding_path | Return a fully-qualified finding string. | websecurityscanner/google/cloud/websecurityscanner_v1alpha/gapic/web_security_scanner_client.py | def finding_path(cls, project, scan_config, scan_run, finding):
"""Return a fully-qualified finding string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}",
project=project,
scan_con... | def finding_path(cls, project, scan_config, scan_run, finding):
"""Return a fully-qualified finding string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}",
project=project,
scan_con... | [
"Return",
"a",
"fully",
"-",
"qualified",
"finding",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/websecurityscanner/google/cloud/websecurityscanner_v1alpha/gapic/web_security_scanner_client.py#L87-L95 | [
"def",
"finding_path",
"(",
"cls",
",",
"project",
",",
"scan_config",
",",
"scan_run",
",",
"finding",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | WebSecurityScannerClient.scan_config_path | Return a fully-qualified scan_config string. | websecurityscanner/google/cloud/websecurityscanner_v1alpha/gapic/web_security_scanner_client.py | def scan_config_path(cls, project, scan_config):
"""Return a fully-qualified scan_config string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}",
project=project,
scan_config=scan_config,
) | def scan_config_path(cls, project, scan_config):
"""Return a fully-qualified scan_config string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}",
project=project,
scan_config=scan_config,
) | [
"Return",
"a",
"fully",
"-",
"qualified",
"scan_config",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/websecurityscanner/google/cloud/websecurityscanner_v1alpha/gapic/web_security_scanner_client.py#L105-L111 | [
"def",
"scan_config_path",
"(",
"cls",
",",
"project",
",",
"scan_config",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/scanConfigs/{scan_config}\"",
",",
"project",
"=",
"project",
",",
"scan_config"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | WebSecurityScannerClient.scan_run_path | Return a fully-qualified scan_run string. | websecurityscanner/google/cloud/websecurityscanner_v1alpha/gapic/web_security_scanner_client.py | def scan_run_path(cls, project, scan_config, scan_run):
"""Return a fully-qualified scan_run string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}",
project=project,
scan_config=scan_config,
... | def scan_run_path(cls, project, scan_config, scan_run):
"""Return a fully-qualified scan_run string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}",
project=project,
scan_config=scan_config,
... | [
"Return",
"a",
"fully",
"-",
"qualified",
"scan_run",
"string",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/websecurityscanner/google/cloud/websecurityscanner_v1alpha/gapic/web_security_scanner_client.py#L114-L121 | [
"def",
"scan_run_path",
"(",
"cls",
",",
"project",
",",
"scan_config",
",",
"scan_run",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"\"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}\"",
",",
"project",
"=... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.instance_admin_api | Helper for session-related API calls. | spanner/google/cloud/spanner_v1/client.py | def instance_admin_api(self):
"""Helper for session-related API calls."""
if self._instance_admin_api is None:
self._instance_admin_api = InstanceAdminClient(
credentials=self.credentials, client_info=_CLIENT_INFO
)
return self._instance_admin_api | def instance_admin_api(self):
"""Helper for session-related API calls."""
if self._instance_admin_api is None:
self._instance_admin_api = InstanceAdminClient(
credentials=self.credentials, client_info=_CLIENT_INFO
)
return self._instance_admin_api | [
"Helper",
"for",
"session",
"-",
"related",
"API",
"calls",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/client.py#L152-L158 | [
"def",
"instance_admin_api",
"(",
"self",
")",
":",
"if",
"self",
".",
"_instance_admin_api",
"is",
"None",
":",
"self",
".",
"_instance_admin_api",
"=",
"InstanceAdminClient",
"(",
"credentials",
"=",
"self",
".",
"credentials",
",",
"client_info",
"=",
"_CLIEN... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.database_admin_api | Helper for session-related API calls. | spanner/google/cloud/spanner_v1/client.py | def database_admin_api(self):
"""Helper for session-related API calls."""
if self._database_admin_api is None:
self._database_admin_api = DatabaseAdminClient(
credentials=self.credentials, client_info=_CLIENT_INFO
)
return self._database_admin_api | def database_admin_api(self):
"""Helper for session-related API calls."""
if self._database_admin_api is None:
self._database_admin_api = DatabaseAdminClient(
credentials=self.credentials, client_info=_CLIENT_INFO
)
return self._database_admin_api | [
"Helper",
"for",
"session",
"-",
"related",
"API",
"calls",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/client.py#L161-L167 | [
"def",
"database_admin_api",
"(",
"self",
")",
":",
"if",
"self",
".",
"_database_admin_api",
"is",
"None",
":",
"self",
".",
"_database_admin_api",
"=",
"DatabaseAdminClient",
"(",
"credentials",
"=",
"self",
".",
"credentials",
",",
"client_info",
"=",
"_CLIEN... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.copy | Make a copy of this client.
Copies the local data stored as simple types but does not copy the
current state of any open connections with the Cloud Bigtable API.
:rtype: :class:`.Client`
:returns: A copy of the current client. | spanner/google/cloud/spanner_v1/client.py | def copy(self):
"""Make a copy of this client.
Copies the local data stored as simple types but does not copy the
current state of any open connections with the Cloud Bigtable API.
:rtype: :class:`.Client`
:returns: A copy of the current client.
"""
return self.... | def copy(self):
"""Make a copy of this client.
Copies the local data stored as simple types but does not copy the
current state of any open connections with the Cloud Bigtable API.
:rtype: :class:`.Client`
:returns: A copy of the current client.
"""
return self.... | [
"Make",
"a",
"copy",
"of",
"this",
"client",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/client.py#L169-L182 | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"project",
"=",
"self",
".",
"project",
",",
"credentials",
"=",
"self",
".",
"_credentials",
",",
"user_agent",
"=",
"self",
".",
"user_agent",
",",
")"
] | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.list_instance_configs | List available instance configurations for the client's project.
.. _RPC docs: https://cloud.google.com/spanner/docs/reference/rpc/\
google.spanner.admin.instance.v1#google.spanner.admin.\
instance.v1.InstanceAdmin.ListInstanceConfigs
See `RPC docs`_.
... | spanner/google/cloud/spanner_v1/client.py | def list_instance_configs(self, page_size=None, page_token=None):
"""List available instance configurations for the client's project.
.. _RPC docs: https://cloud.google.com/spanner/docs/reference/rpc/\
google.spanner.admin.instance.v1#google.spanner.admin.\
i... | def list_instance_configs(self, page_size=None, page_token=None):
"""List available instance configurations for the client's project.
.. _RPC docs: https://cloud.google.com/spanner/docs/reference/rpc/\
google.spanner.admin.instance.v1#google.spanner.admin.\
i... | [
"List",
"available",
"instance",
"configurations",
"for",
"the",
"client",
"s",
"project",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/client.py#L184-L220 | [
"def",
"list_instance_configs",
"(",
"self",
",",
"page_size",
"=",
"None",
",",
"page_token",
"=",
"None",
")",
":",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self",
".",
"project_name",
")",
"path",
"=",
"\"projects/%s\"",
"%",
"(",
"self",
".",
"pro... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.instance | Factory to create a instance associated with this client.
:type instance_id: str
:param instance_id: The ID of the instance.
:type configuration_name: string
:param configuration_name:
(Optional) Name of the instance configuration used to set up the
instance's clu... | spanner/google/cloud/spanner_v1/client.py | def instance(
self,
instance_id,
configuration_name=None,
display_name=None,
node_count=DEFAULT_NODE_COUNT,
):
"""Factory to create a instance associated with this client.
:type instance_id: str
:param instance_id: The ID of the instance.
:ty... | def instance(
self,
instance_id,
configuration_name=None,
display_name=None,
node_count=DEFAULT_NODE_COUNT,
):
"""Factory to create a instance associated with this client.
:type instance_id: str
:param instance_id: The ID of the instance.
:ty... | [
"Factory",
"to",
"create",
"a",
"instance",
"associated",
"with",
"this",
"client",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/client.py#L222-L254 | [
"def",
"instance",
"(",
"self",
",",
"instance_id",
",",
"configuration_name",
"=",
"None",
",",
"display_name",
"=",
"None",
",",
"node_count",
"=",
"DEFAULT_NODE_COUNT",
",",
")",
":",
"return",
"Instance",
"(",
"instance_id",
",",
"self",
",",
"configuratio... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | Client.list_instances | List instances for the client's project.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.InstanceAdmin.ListInstances
:type filter_: string
:param filter_: (Optional) Filter to select instances listed. See
... | spanner/google/cloud/spanner_v1/client.py | def list_instances(self, filter_="", page_size=None, page_token=None):
"""List instances for the client's project.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.InstanceAdmin.ListInstances
:type filter_: string
... | def list_instances(self, filter_="", page_size=None, page_token=None):
"""List instances for the client's project.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.InstanceAdmin.ListInstances
:type filter_: string
... | [
"List",
"instances",
"for",
"the",
"client",
"s",
"project",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/client.py#L256-L292 | [
"def",
"list_instances",
"(",
"self",
",",
"filter_",
"=",
"\"\"",
",",
"page_size",
"=",
"None",
",",
"page_token",
"=",
"None",
")",
":",
"metadata",
"=",
"_metadata_with_prefix",
"(",
"self",
".",
"project_name",
")",
"path",
"=",
"\"projects/%s\"",
"%",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | _should_retry | Predicate for determining when to retry.
We retry if and only if the 'reason' is 'backendError'
or 'rateLimitExceeded'. | bigquery/google/cloud/bigquery/retry.py | def _should_retry(exc):
"""Predicate for determining when to retry.
We retry if and only if the 'reason' is 'backendError'
or 'rateLimitExceeded'.
"""
if not hasattr(exc, "errors"):
return False
if len(exc.errors) == 0:
# Check for unstructured error returns, e.g. from GFE
... | def _should_retry(exc):
"""Predicate for determining when to retry.
We retry if and only if the 'reason' is 'backendError'
or 'rateLimitExceeded'.
"""
if not hasattr(exc, "errors"):
return False
if len(exc.errors) == 0:
# Check for unstructured error returns, e.g. from GFE
... | [
"Predicate",
"for",
"determining",
"when",
"to",
"retry",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/retry.py#L30-L44 | [
"def",
"_should_retry",
"(",
"exc",
")",
":",
"if",
"not",
"hasattr",
"(",
"exc",
",",
"\"errors\"",
")",
":",
"return",
"False",
"if",
"len",
"(",
"exc",
".",
"errors",
")",
"==",
"0",
":",
"# Check for unstructured error returns, e.g. from GFE",
"return",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | default | Default unit test session. | logging/noxfile.py | def default(session, django_dep=('django',)):
"""Default unit test session.
"""
# Install all test dependencies, then install this package in-place.
deps = UNIT_TEST_DEPS
deps += django_dep
session.install(*deps)
for local_dep in LOCAL_DEPS:
session.install('-e', local_dep)
ses... | def default(session, django_dep=('django',)):
"""Default unit test session.
"""
# Install all test dependencies, then install this package in-place.
deps = UNIT_TEST_DEPS
deps += django_dep
session.install(*deps)
for local_dep in LOCAL_DEPS:
session.install('-e', local_dep)
ses... | [
"Default",
"unit",
"test",
"session",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/noxfile.py#L77-L102 | [
"def",
"default",
"(",
"session",
",",
"django_dep",
"=",
"(",
"'django'",
",",
")",
")",
":",
"# Install all test dependencies, then install this package in-place.",
"deps",
"=",
"UNIT_TEST_DEPS",
"deps",
"+=",
"django_dep",
"session",
".",
"install",
"(",
"*",
"de... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | unit | Run the unit test suite. | logging/noxfile.py | def unit(session):
"""Run the unit test suite."""
# Testing multiple version of django
# See https://www.djangoproject.com/download/ for supported version
django_deps_27 = [
('django==1.8.19',),
('django >= 1.11.0, < 2.0.0dev',),
]
if session.virtualenv.interpreter == '2.7':
... | def unit(session):
"""Run the unit test suite."""
# Testing multiple version of django
# See https://www.djangoproject.com/download/ for supported version
django_deps_27 = [
('django==1.8.19',),
('django >= 1.11.0, < 2.0.0dev',),
]
if session.virtualenv.interpreter == '2.7':
... | [
"Run",
"the",
"unit",
"test",
"suite",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/noxfile.py#L106-L119 | [
"def",
"unit",
"(",
"session",
")",
":",
"# Testing multiple version of django",
"# See https://www.djangoproject.com/download/ for supported version",
"django_deps_27",
"=",
"[",
"(",
"'django==1.8.19'",
",",
")",
",",
"(",
"'django >= 1.11.0, < 2.0.0dev'",
",",
")",
",",
... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | system | Run the system test suite. | logging/noxfile.py | def system(session):
"""Run the system test suite."""
# Sanity check: Only run system tests if the environment variable is set.
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
session.skip('Credentials must be set via environment variable.')
# Use pre-release gRPC for system tests... | def system(session):
"""Run the system test suite."""
# Sanity check: Only run system tests if the environment variable is set.
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
session.skip('Credentials must be set via environment variable.')
# Use pre-release gRPC for system tests... | [
"Run",
"the",
"system",
"test",
"suite",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/noxfile.py#L123-L154 | [
"def",
"system",
"(",
"session",
")",
":",
"# Sanity check: Only run system tests if the environment variable is set.",
"if",
"not",
"os",
".",
"environ",
".",
"get",
"(",
"'GOOGLE_APPLICATION_CREDENTIALS'",
",",
"''",
")",
":",
"session",
".",
"skip",
"(",
"'Credenti... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | entry_from_resource | Detect correct entry type from resource and instantiate.
:type resource: dict
:param resource: One entry resource from API response.
:type client: :class:`~google.cloud.logging.client.Client`
:param client: Client that owns the log entry.
:type loggers: dict
:param loggers:
A mapping ... | logging/google/cloud/logging/_helpers.py | def entry_from_resource(resource, client, loggers):
"""Detect correct entry type from resource and instantiate.
:type resource: dict
:param resource: One entry resource from API response.
:type client: :class:`~google.cloud.logging.client.Client`
:param client: Client that owns the log entry.
... | def entry_from_resource(resource, client, loggers):
"""Detect correct entry type from resource and instantiate.
:type resource: dict
:param resource: One entry resource from API response.
:type client: :class:`~google.cloud.logging.client.Client`
:param client: Client that owns the log entry.
... | [
"Detect",
"correct",
"entry",
"type",
"from",
"resource",
"and",
"instantiate",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/_helpers.py#L28-L55 | [
"def",
"entry_from_resource",
"(",
"resource",
",",
"client",
",",
"loggers",
")",
":",
"if",
"\"textPayload\"",
"in",
"resource",
":",
"return",
"TextEntry",
".",
"from_api_repr",
"(",
"resource",
",",
"client",
",",
"loggers",
")",
"if",
"\"jsonPayload\"",
"... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | retrieve_metadata_server | Retrieve the metadata key in the metadata server.
See: https://cloud.google.com/compute/docs/storing-retrieving-metadata
:type metadata_key: str
:param metadata_key: Key of the metadata which will form the url. You can
also supply query parameters after the metadata key.
... | logging/google/cloud/logging/_helpers.py | def retrieve_metadata_server(metadata_key):
"""Retrieve the metadata key in the metadata server.
See: https://cloud.google.com/compute/docs/storing-retrieving-metadata
:type metadata_key: str
:param metadata_key: Key of the metadata which will form the url. You can
also supply... | def retrieve_metadata_server(metadata_key):
"""Retrieve the metadata key in the metadata server.
See: https://cloud.google.com/compute/docs/storing-retrieving-metadata
:type metadata_key: str
:param metadata_key: Key of the metadata which will form the url. You can
also supply... | [
"Retrieve",
"the",
"metadata",
"key",
"in",
"the",
"metadata",
"server",
"."
] | googleapis/google-cloud-python | python | https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/_helpers.py#L58-L84 | [
"def",
"retrieve_metadata_server",
"(",
"metadata_key",
")",
":",
"url",
"=",
"METADATA_URL",
"+",
"metadata_key",
"try",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"headers",
"=",
"METADATA_HEADERS",
")",
"if",
"response",
".",
"status_cod... | 85e80125a59cb10f8cb105f25ecc099e4b940b50 |
train | model_loss | Define loss of TF graph
:param y: correct labels
:param model: output of the model
:param mean: boolean indicating whether should return mean of loss
or vector of losses for each input of the batch
:return: return mean of loss if True, otherwise return vector with per
sample loss | cleverhans/utils_tf.py | def model_loss(y, model, mean=True):
"""
Define loss of TF graph
:param y: correct labels
:param model: output of the model
:param mean: boolean indicating whether should return mean of loss
or vector of losses for each input of the batch
:return: return mean of loss if True, otherwise return... | def model_loss(y, model, mean=True):
"""
Define loss of TF graph
:param y: correct labels
:param model: output of the model
:param mean: boolean indicating whether should return mean of loss
or vector of losses for each input of the batch
:return: return mean of loss if True, otherwise return... | [
"Define",
"loss",
"of",
"TF",
"graph",
":",
"param",
"y",
":",
"correct",
"labels",
":",
"param",
"model",
":",
"output",
"of",
"the",
"model",
":",
"param",
"mean",
":",
"boolean",
"indicating",
"whether",
"should",
"return",
"mean",
"of",
"loss",
"or",... | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L28-L50 | [
"def",
"model_loss",
"(",
"y",
",",
"model",
",",
"mean",
"=",
"True",
")",
":",
"warnings",
".",
"warn",
"(",
"\"This function is deprecated and will be removed on or after\"",
"\" 2019-04-05. Switch to cleverhans.train.train.\"",
")",
"op",
"=",
"model",
".",
"op",
... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | initialize_uninitialized_global_variables | Only initializes the variables of a TensorFlow session that were not
already initialized.
:param sess: the TensorFlow session
:return: | cleverhans/utils_tf.py | def initialize_uninitialized_global_variables(sess):
"""
Only initializes the variables of a TensorFlow session that were not
already initialized.
:param sess: the TensorFlow session
:return:
"""
# List all global variables
global_vars = tf.global_variables()
# Find initialized status for all variabl... | def initialize_uninitialized_global_variables(sess):
"""
Only initializes the variables of a TensorFlow session that were not
already initialized.
:param sess: the TensorFlow session
:return:
"""
# List all global variables
global_vars = tf.global_variables()
# Find initialized status for all variabl... | [
"Only",
"initializes",
"the",
"variables",
"of",
"a",
"TensorFlow",
"session",
"that",
"were",
"not",
"already",
"initialized",
".",
":",
"param",
"sess",
":",
"the",
"TensorFlow",
"session",
":",
"return",
":"
] | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L53-L73 | [
"def",
"initialize_uninitialized_global_variables",
"(",
"sess",
")",
":",
"# List all global variables",
"global_vars",
"=",
"tf",
".",
"global_variables",
"(",
")",
"# Find initialized status for all variables",
"is_var_init",
"=",
"[",
"tf",
".",
"is_variable_initialized",... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | train | Train a TF graph.
This function is deprecated. Prefer cleverhans.train.train when possible.
cleverhans.train.train supports multiple GPUs but this function is still
needed to support legacy models that do not support calling fprop more
than once.
:param sess: TF session to use when training the graph
:para... | cleverhans/utils_tf.py | def train(sess, loss, x, y, X_train, Y_train, save=False,
init_all=False, evaluate=None, feed=None, args=None,
rng=None, var_list=None, fprop_args=None, optimizer=None):
"""
Train a TF graph.
This function is deprecated. Prefer cleverhans.train.train when possible.
cleverhans.train.train sup... | def train(sess, loss, x, y, X_train, Y_train, save=False,
init_all=False, evaluate=None, feed=None, args=None,
rng=None, var_list=None, fprop_args=None, optimizer=None):
"""
Train a TF graph.
This function is deprecated. Prefer cleverhans.train.train when possible.
cleverhans.train.train sup... | [
"Train",
"a",
"TF",
"graph",
".",
"This",
"function",
"is",
"deprecated",
".",
"Prefer",
"cleverhans",
".",
"train",
".",
"train",
"when",
"possible",
".",
"cleverhans",
".",
"train",
".",
"train",
"supports",
"multiple",
"GPUs",
"but",
"this",
"function",
... | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L76-L193 | [
"def",
"train",
"(",
"sess",
",",
"loss",
",",
"x",
",",
"y",
",",
"X_train",
",",
"Y_train",
",",
"save",
"=",
"False",
",",
"init_all",
"=",
"False",
",",
"evaluate",
"=",
"None",
",",
"feed",
"=",
"None",
",",
"args",
"=",
"None",
",",
"rng",
... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | model_eval | Compute the accuracy of a TF model on some data
:param sess: TF session to use
:param x: input placeholder
:param y: output placeholder (for labels)
:param predictions: model output predictions
:param X_test: numpy array with training inputs
:param Y_test: numpy array with training outputs
:param feed: An... | cleverhans/utils_tf.py | def model_eval(sess, x, y, predictions, X_test=None, Y_test=None,
feed=None, args=None):
"""
Compute the accuracy of a TF model on some data
:param sess: TF session to use
:param x: input placeholder
:param y: output placeholder (for labels)
:param predictions: model output predictions
:par... | def model_eval(sess, x, y, predictions, X_test=None, Y_test=None,
feed=None, args=None):
"""
Compute the accuracy of a TF model on some data
:param sess: TF session to use
:param x: input placeholder
:param y: output placeholder (for labels)
:param predictions: model output predictions
:par... | [
"Compute",
"the",
"accuracy",
"of",
"a",
"TF",
"model",
"on",
"some",
"data",
":",
"param",
"sess",
":",
"TF",
"session",
"to",
"use",
":",
"param",
"x",
":",
"input",
"placeholder",
":",
"param",
"y",
":",
"output",
"placeholder",
"(",
"for",
"labels"... | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L196-L269 | [
"def",
"model_eval",
"(",
"sess",
",",
"x",
",",
"y",
",",
"predictions",
",",
"X_test",
"=",
"None",
",",
"Y_test",
"=",
"None",
",",
"feed",
"=",
"None",
",",
"args",
"=",
"None",
")",
":",
"global",
"_model_eval_cache",
"args",
"=",
"_ArgsWrapper",
... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | batch_eval | Wrapper around deprecated function. | cleverhans/utils_tf.py | def batch_eval(*args, **kwargs):
"""
Wrapper around deprecated function.
"""
# Inside function to avoid circular import
from cleverhans.evaluation import batch_eval as new_batch_eval
warnings.warn("batch_eval has moved to cleverhans.evaluation. "
"batch_eval will be removed from utils_tf on ... | def batch_eval(*args, **kwargs):
"""
Wrapper around deprecated function.
"""
# Inside function to avoid circular import
from cleverhans.evaluation import batch_eval as new_batch_eval
warnings.warn("batch_eval has moved to cleverhans.evaluation. "
"batch_eval will be removed from utils_tf on ... | [
"Wrapper",
"around",
"deprecated",
"function",
"."
] | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L292-L301 | [
"def",
"batch_eval",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Inside function to avoid circular import",
"from",
"cleverhans",
".",
"evaluation",
"import",
"batch_eval",
"as",
"new_batch_eval",
"warnings",
".",
"warn",
"(",
"\"batch_eval has moved to cl... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | model_argmax | Helper function that computes the current class prediction
:param sess: TF session
:param x: the input placeholder
:param predictions: the model's symbolic output
:param samples: numpy array with input samples (dims must match x)
:param feed: An optional dictionary that is appended to the feeding
d... | cleverhans/utils_tf.py | def model_argmax(sess, x, predictions, samples, feed=None):
"""
Helper function that computes the current class prediction
:param sess: TF session
:param x: the input placeholder
:param predictions: the model's symbolic output
:param samples: numpy array with input samples (dims must match x)
:param feed:... | def model_argmax(sess, x, predictions, samples, feed=None):
"""
Helper function that computes the current class prediction
:param sess: TF session
:param x: the input placeholder
:param predictions: the model's symbolic output
:param samples: numpy array with input samples (dims must match x)
:param feed:... | [
"Helper",
"function",
"that",
"computes",
"the",
"current",
"class",
"prediction",
":",
"param",
"sess",
":",
"TF",
"session",
":",
"param",
"x",
":",
"the",
"input",
"placeholder",
":",
"param",
"predictions",
":",
"the",
"model",
"s",
"symbolic",
"output",... | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L304-L324 | [
"def",
"model_argmax",
"(",
"sess",
",",
"x",
",",
"predictions",
",",
"samples",
",",
"feed",
"=",
"None",
")",
":",
"feed_dict",
"=",
"{",
"x",
":",
"samples",
"}",
"if",
"feed",
"is",
"not",
"None",
":",
"feed_dict",
".",
"update",
"(",
"feed",
... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | l2_batch_normalize | Helper function to normalize a batch of vectors.
:param x: the input placeholder
:param epsilon: stabilizes division
:return: the batch of l2 normalized vector | cleverhans/utils_tf.py | def l2_batch_normalize(x, epsilon=1e-12, scope=None):
"""
Helper function to normalize a batch of vectors.
:param x: the input placeholder
:param epsilon: stabilizes division
:return: the batch of l2 normalized vector
"""
with tf.name_scope(scope, "l2_batch_normalize") as name_scope:
x_shape = tf.shap... | def l2_batch_normalize(x, epsilon=1e-12, scope=None):
"""
Helper function to normalize a batch of vectors.
:param x: the input placeholder
:param epsilon: stabilizes division
:return: the batch of l2 normalized vector
"""
with tf.name_scope(scope, "l2_batch_normalize") as name_scope:
x_shape = tf.shap... | [
"Helper",
"function",
"to",
"normalize",
"a",
"batch",
"of",
"vectors",
".",
":",
"param",
"x",
":",
"the",
"input",
"placeholder",
":",
"param",
"epsilon",
":",
"stabilizes",
"division",
":",
"return",
":",
"the",
"batch",
"of",
"l2",
"normalized",
"vecto... | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L327-L341 | [
"def",
"l2_batch_normalize",
"(",
"x",
",",
"epsilon",
"=",
"1e-12",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"\"l2_batch_normalize\"",
")",
"as",
"name_scope",
":",
"x_shape",
"=",
"tf",
".",
"shape",
"(",... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | kl_with_logits | Helper function to compute kl-divergence KL(p || q) | cleverhans/utils_tf.py | def kl_with_logits(p_logits, q_logits, scope=None,
loss_collection=tf.GraphKeys.REGULARIZATION_LOSSES):
"""Helper function to compute kl-divergence KL(p || q)
"""
with tf.name_scope(scope, "kl_divergence") as name:
p = tf.nn.softmax(p_logits)
p_log = tf.nn.log_softmax(p_logits)
q_lo... | def kl_with_logits(p_logits, q_logits, scope=None,
loss_collection=tf.GraphKeys.REGULARIZATION_LOSSES):
"""Helper function to compute kl-divergence KL(p || q)
"""
with tf.name_scope(scope, "kl_divergence") as name:
p = tf.nn.softmax(p_logits)
p_log = tf.nn.log_softmax(p_logits)
q_lo... | [
"Helper",
"function",
"to",
"compute",
"kl",
"-",
"divergence",
"KL",
"(",
"p",
"||",
"q",
")"
] | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L344-L355 | [
"def",
"kl_with_logits",
"(",
"p_logits",
",",
"q_logits",
",",
"scope",
"=",
"None",
",",
"loss_collection",
"=",
"tf",
".",
"GraphKeys",
".",
"REGULARIZATION_LOSSES",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"\"kl_divergence\"",
")",
"... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | clip_eta | Helper function to clip the perturbation to epsilon norm ball.
:param eta: A tensor with the current perturbation.
:param ord: Order of the norm (mimics Numpy).
Possible values: np.inf, 1 or 2.
:param eps: Epsilon, bound of the perturbation. | cleverhans/utils_tf.py | def clip_eta(eta, ord, eps):
"""
Helper function to clip the perturbation to epsilon norm ball.
:param eta: A tensor with the current perturbation.
:param ord: Order of the norm (mimics Numpy).
Possible values: np.inf, 1 or 2.
:param eps: Epsilon, bound of the perturbation.
"""
# Clipping p... | def clip_eta(eta, ord, eps):
"""
Helper function to clip the perturbation to epsilon norm ball.
:param eta: A tensor with the current perturbation.
:param ord: Order of the norm (mimics Numpy).
Possible values: np.inf, 1 or 2.
:param eps: Epsilon, bound of the perturbation.
"""
# Clipping p... | [
"Helper",
"function",
"to",
"clip",
"the",
"perturbation",
"to",
"epsilon",
"norm",
"ball",
".",
":",
"param",
"eta",
":",
"A",
"tensor",
"with",
"the",
"current",
"perturbation",
".",
":",
"param",
"ord",
":",
"Order",
"of",
"the",
"norm",
"(",
"mimics"... | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L358-L392 | [
"def",
"clip_eta",
"(",
"eta",
",",
"ord",
",",
"eps",
")",
":",
"# Clipping perturbation eta to self.ord norm ball",
"if",
"ord",
"not",
"in",
"[",
"np",
".",
"inf",
",",
"1",
",",
"2",
"]",
":",
"raise",
"ValueError",
"(",
"'ord must be np.inf, 1, or 2.'",
... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | infer_devices | Returns the list of devices that multi-replica code should use.
:param devices: list of string device names, e.g. ["/GPU:0"]
If the user specifies this, `infer_devices` checks that it is
valid, and then uses this user-specified list.
If the user does not specify this, infer_devices uses:
-... | cleverhans/utils_tf.py | def infer_devices(devices=None):
"""
Returns the list of devices that multi-replica code should use.
:param devices: list of string device names, e.g. ["/GPU:0"]
If the user specifies this, `infer_devices` checks that it is
valid, and then uses this user-specified list.
If the user does not spec... | def infer_devices(devices=None):
"""
Returns the list of devices that multi-replica code should use.
:param devices: list of string device names, e.g. ["/GPU:0"]
If the user specifies this, `infer_devices` checks that it is
valid, and then uses this user-specified list.
If the user does not spec... | [
"Returns",
"the",
"list",
"of",
"devices",
"that",
"multi",
"-",
"replica",
"code",
"should",
"use",
".",
":",
"param",
"devices",
":",
"list",
"of",
"string",
"device",
"names",
"e",
".",
"g",
".",
"[",
"/",
"GPU",
":",
"0",
"]",
"If",
"the",
"use... | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L502-L523 | [
"def",
"infer_devices",
"(",
"devices",
"=",
"None",
")",
":",
"if",
"devices",
"is",
"None",
":",
"devices",
"=",
"get_available_gpus",
"(",
")",
"if",
"len",
"(",
"devices",
")",
"==",
"0",
":",
"warnings",
".",
"warn",
"(",
"\"No GPUS, running on CPU\""... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | get_available_gpus | Returns a list of string names of all available GPUs | cleverhans/utils_tf.py | def get_available_gpus():
"""
Returns a list of string names of all available GPUs
"""
local_device_protos = device_lib.list_local_devices()
return [x.name for x in local_device_protos if x.device_type == 'GPU'] | def get_available_gpus():
"""
Returns a list of string names of all available GPUs
"""
local_device_protos = device_lib.list_local_devices()
return [x.name for x in local_device_protos if x.device_type == 'GPU'] | [
"Returns",
"a",
"list",
"of",
"string",
"names",
"of",
"all",
"available",
"GPUs"
] | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L526-L531 | [
"def",
"get_available_gpus",
"(",
")",
":",
"local_device_protos",
"=",
"device_lib",
".",
"list_local_devices",
"(",
")",
"return",
"[",
"x",
".",
"name",
"for",
"x",
"in",
"local_device_protos",
"if",
"x",
".",
"device_type",
"==",
"'GPU'",
"]"
] | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | clip_by_value | A wrapper for clip_by_value that casts the clipping range if needed. | cleverhans/utils_tf.py | def clip_by_value(t, clip_value_min, clip_value_max, name=None):
"""
A wrapper for clip_by_value that casts the clipping range if needed.
"""
def cast_clip(clip):
"""
Cast clipping range argument if needed.
"""
if t.dtype in (tf.float32, tf.float64):
if hasattr(clip, 'dtype'):
# Co... | def clip_by_value(t, clip_value_min, clip_value_max, name=None):
"""
A wrapper for clip_by_value that casts the clipping range if needed.
"""
def cast_clip(clip):
"""
Cast clipping range argument if needed.
"""
if t.dtype in (tf.float32, tf.float64):
if hasattr(clip, 'dtype'):
# Co... | [
"A",
"wrapper",
"for",
"clip_by_value",
"that",
"casts",
"the",
"clipping",
"range",
"if",
"needed",
"."
] | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L540-L559 | [
"def",
"clip_by_value",
"(",
"t",
",",
"clip_value_min",
",",
"clip_value_max",
",",
"name",
"=",
"None",
")",
":",
"def",
"cast_clip",
"(",
"clip",
")",
":",
"\"\"\"\n Cast clipping range argument if needed.\n \"\"\"",
"if",
"t",
".",
"dtype",
"in",
"(",
... | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
train | mul | A wrapper around tf multiplication that does more automatic casting of
the input. | cleverhans/utils_tf.py | def mul(a, b):
"""
A wrapper around tf multiplication that does more automatic casting of
the input.
"""
def multiply(a, b):
"""Multiplication"""
return a * b
return op_with_scalar_cast(a, b, multiply) | def mul(a, b):
"""
A wrapper around tf multiplication that does more automatic casting of
the input.
"""
def multiply(a, b):
"""Multiplication"""
return a * b
return op_with_scalar_cast(a, b, multiply) | [
"A",
"wrapper",
"around",
"tf",
"multiplication",
"that",
"does",
"more",
"automatic",
"casting",
"of",
"the",
"input",
"."
] | tensorflow/cleverhans | python | https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L561-L569 | [
"def",
"mul",
"(",
"a",
",",
"b",
")",
":",
"def",
"multiply",
"(",
"a",
",",
"b",
")",
":",
"\"\"\"Multiplication\"\"\"",
"return",
"a",
"*",
"b",
"return",
"op_with_scalar_cast",
"(",
"a",
",",
"b",
",",
"multiply",
")"
] | 97488e215760547b81afc53f5e5de8ba7da5bd98 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.