id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
224,500 | IDSIA/sacred | sacred/dependencies.py | convert_path_to_module_parts | def convert_path_to_module_parts(path):
"""Convert path to a python file into list of module names."""
module_parts = splitall(path)
if module_parts[-1] in ['__init__.py', '__init__.pyc']:
# remove trailing __init__.py
module_parts = module_parts[:-1]
else:
# remove file extensio... | python | def convert_path_to_module_parts(path):
"""Convert path to a python file into list of module names."""
module_parts = splitall(path)
if module_parts[-1] in ['__init__.py', '__init__.pyc']:
# remove trailing __init__.py
module_parts = module_parts[:-1]
else:
# remove file extensio... | [
"def",
"convert_path_to_module_parts",
"(",
"path",
")",
":",
"module_parts",
"=",
"splitall",
"(",
"path",
")",
"if",
"module_parts",
"[",
"-",
"1",
"]",
"in",
"[",
"'__init__.py'",
",",
"'__init__.pyc'",
"]",
":",
"# remove trailing __init__.py",
"module_parts",... | Convert path to a python file into list of module names. | [
"Convert",
"path",
"to",
"a",
"python",
"file",
"into",
"list",
"of",
"module",
"names",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/dependencies.py#L299-L308 |
224,501 | IDSIA/sacred | sacred/dependencies.py | is_local_source | def is_local_source(filename, modname, experiment_path):
"""Check if a module comes from the given experiment path.
Check if a module, given by name and filename, is from (a subdirectory of )
the given experiment path.
This is used to determine if the module is a local source file, or rather
a pack... | python | def is_local_source(filename, modname, experiment_path):
"""Check if a module comes from the given experiment path.
Check if a module, given by name and filename, is from (a subdirectory of )
the given experiment path.
This is used to determine if the module is a local source file, or rather
a pack... | [
"def",
"is_local_source",
"(",
"filename",
",",
"modname",
",",
"experiment_path",
")",
":",
"if",
"not",
"is_subdir",
"(",
"filename",
",",
"experiment_path",
")",
":",
"return",
"False",
"rel_path",
"=",
"os",
".",
"path",
".",
"relpath",
"(",
"filename",
... | Check if a module comes from the given experiment path.
Check if a module, given by name and filename, is from (a subdirectory of )
the given experiment path.
This is used to determine if the module is a local source file, or rather
a package dependency.
Parameters
----------
filename: str... | [
"Check",
"if",
"a",
"module",
"comes",
"from",
"the",
"given",
"experiment",
"path",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/dependencies.py#L311-L347 |
224,502 | IDSIA/sacred | sacred/dependencies.py | gather_sources_and_dependencies | def gather_sources_and_dependencies(globs, base_dir=None):
"""Scan the given globals for modules and return them as dependencies."""
experiment_path, main = get_main_file(globs)
base_dir = base_dir or experiment_path
gather_sources = source_discovery_strategies[SETTINGS['DISCOVER_SOURCES']]
sourc... | python | def gather_sources_and_dependencies(globs, base_dir=None):
"""Scan the given globals for modules and return them as dependencies."""
experiment_path, main = get_main_file(globs)
base_dir = base_dir or experiment_path
gather_sources = source_discovery_strategies[SETTINGS['DISCOVER_SOURCES']]
sourc... | [
"def",
"gather_sources_and_dependencies",
"(",
"globs",
",",
"base_dir",
"=",
"None",
")",
":",
"experiment_path",
",",
"main",
"=",
"get_main_file",
"(",
"globs",
")",
"base_dir",
"=",
"base_dir",
"or",
"experiment_path",
"gather_sources",
"=",
"source_discovery_st... | Scan the given globals for modules and return them as dependencies. | [
"Scan",
"the",
"given",
"globals",
"for",
"modules",
"and",
"return",
"them",
"as",
"dependencies",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/dependencies.py#L481-L501 |
224,503 | IDSIA/sacred | sacred/config/utils.py | assert_is_valid_key | def assert_is_valid_key(key):
"""
Raise KeyError if a given config key violates any requirements.
The requirements are the following and can be individually deactivated
in ``sacred.SETTINGS.CONFIG_KEYS``:
* ENFORCE_MONGO_COMPATIBLE (default: True):
make sure the keys don't contain a '.' o... | python | def assert_is_valid_key(key):
"""
Raise KeyError if a given config key violates any requirements.
The requirements are the following and can be individually deactivated
in ``sacred.SETTINGS.CONFIG_KEYS``:
* ENFORCE_MONGO_COMPATIBLE (default: True):
make sure the keys don't contain a '.' o... | [
"def",
"assert_is_valid_key",
"(",
"key",
")",
":",
"if",
"SETTINGS",
".",
"CONFIG",
".",
"ENFORCE_KEYS_MONGO_COMPATIBLE",
"and",
"(",
"isinstance",
"(",
"key",
",",
"basestring",
")",
"and",
"(",
"'.'",
"in",
"key",
"or",
"key",
"[",
"0",
"]",
"==",
"'$... | Raise KeyError if a given config key violates any requirements.
The requirements are the following and can be individually deactivated
in ``sacred.SETTINGS.CONFIG_KEYS``:
* ENFORCE_MONGO_COMPATIBLE (default: True):
make sure the keys don't contain a '.' or start with a '$'
* ENFORCE_JSONPIC... | [
"Raise",
"KeyError",
"if",
"a",
"given",
"config",
"key",
"violates",
"any",
"requirements",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/config/utils.py#L13-L65 |
224,504 | IDSIA/sacred | sacred/observers/slack.py | SlackObserver.from_config | def from_config(cls, filename):
"""
Create a SlackObserver from a given configuration file.
The file can be in any format supported by Sacred
(.json, .pickle, [.yaml]).
It has to specify a ``webhook_url`` and can optionally set
``bot_name``, ``icon``, ``completed_text``,... | python | def from_config(cls, filename):
"""
Create a SlackObserver from a given configuration file.
The file can be in any format supported by Sacred
(.json, .pickle, [.yaml]).
It has to specify a ``webhook_url`` and can optionally set
``bot_name``, ``icon``, ``completed_text``,... | [
"def",
"from_config",
"(",
"cls",
",",
"filename",
")",
":",
"d",
"=",
"load_config_file",
"(",
"filename",
")",
"obs",
"=",
"None",
"if",
"'webhook_url'",
"in",
"d",
":",
"obs",
"=",
"cls",
"(",
"d",
"[",
"'webhook_url'",
"]",
")",
"else",
":",
"rai... | Create a SlackObserver from a given configuration file.
The file can be in any format supported by Sacred
(.json, .pickle, [.yaml]).
It has to specify a ``webhook_url`` and can optionally set
``bot_name``, ``icon``, ``completed_text``, ``interrupted_text``, and
``failed_text``. | [
"Create",
"a",
"SlackObserver",
"from",
"a",
"given",
"configuration",
"file",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/observers/slack.py#L44-L65 |
224,505 | IDSIA/sacred | sacred/host_info.py | get_host_info | def get_host_info():
"""Collect some information about the machine this experiment runs on.
Returns
-------
dict
A dictionary with information about the CPU, the OS and the
Python version of this machine.
"""
host_info = {}
for k, v in host_info_gatherers.items():
t... | python | def get_host_info():
"""Collect some information about the machine this experiment runs on.
Returns
-------
dict
A dictionary with information about the CPU, the OS and the
Python version of this machine.
"""
host_info = {}
for k, v in host_info_gatherers.items():
t... | [
"def",
"get_host_info",
"(",
")",
":",
"host_info",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"host_info_gatherers",
".",
"items",
"(",
")",
":",
"try",
":",
"host_info",
"[",
"k",
"]",
"=",
"v",
"(",
")",
"except",
"IgnoreHostInfo",
":",
"pass",
... | Collect some information about the machine this experiment runs on.
Returns
-------
dict
A dictionary with information about the CPU, the OS and the
Python version of this machine. | [
"Collect",
"some",
"information",
"about",
"the",
"machine",
"this",
"experiment",
"runs",
"on",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/host_info.py#L27-L43 |
224,506 | IDSIA/sacred | sacred/host_info.py | host_info_getter | def host_info_getter(func, name=None):
"""
The decorated function is added to the process of collecting the host_info.
This just adds the decorated function to the global
``sacred.host_info.host_info_gatherers`` dictionary.
The functions from that dictionary are used when collecting the host info
... | python | def host_info_getter(func, name=None):
"""
The decorated function is added to the process of collecting the host_info.
This just adds the decorated function to the global
``sacred.host_info.host_info_gatherers`` dictionary.
The functions from that dictionary are used when collecting the host info
... | [
"def",
"host_info_getter",
"(",
"func",
",",
"name",
"=",
"None",
")",
":",
"name",
"=",
"name",
"or",
"func",
".",
"__name__",
"host_info_gatherers",
"[",
"name",
"]",
"=",
"func",
"return",
"func"
] | The decorated function is added to the process of collecting the host_info.
This just adds the decorated function to the global
``sacred.host_info.host_info_gatherers`` dictionary.
The functions from that dictionary are used when collecting the host info
using :py:func:`~sacred.host_info.get_host_info`... | [
"The",
"decorated",
"function",
"is",
"added",
"to",
"the",
"process",
"of",
"collecting",
"the",
"host_info",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/host_info.py#L47-L72 |
224,507 | IDSIA/sacred | sacred/metrics_logger.py | linearize_metrics | def linearize_metrics(logged_metrics):
"""
Group metrics by name.
Takes a list of individual measurements, possibly belonging
to different metrics and groups them by name.
:param logged_metrics: A list of ScalarMetricLogEntries
:return: Measured values grouped by the metric name:
{"metric_... | python | def linearize_metrics(logged_metrics):
"""
Group metrics by name.
Takes a list of individual measurements, possibly belonging
to different metrics and groups them by name.
:param logged_metrics: A list of ScalarMetricLogEntries
:return: Measured values grouped by the metric name:
{"metric_... | [
"def",
"linearize_metrics",
"(",
"logged_metrics",
")",
":",
"metrics_by_name",
"=",
"{",
"}",
"for",
"metric_entry",
"in",
"logged_metrics",
":",
"if",
"metric_entry",
".",
"name",
"not",
"in",
"metrics_by_name",
":",
"metrics_by_name",
"[",
"metric_entry",
".",
... | Group metrics by name.
Takes a list of individual measurements, possibly belonging
to different metrics and groups them by name.
:param logged_metrics: A list of ScalarMetricLogEntries
:return: Measured values grouped by the metric name:
{"metric_name1": {"steps": [0,1,2], "values": [4, 5, 6],
... | [
"Group",
"metrics",
"by",
"name",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/metrics_logger.py#L85-L113 |
224,508 | IDSIA/sacred | sacred/metrics_logger.py | MetricsLogger.get_last_metrics | def get_last_metrics(self):
"""Read all measurement events since last call of the method.
:return List[ScalarMetricLogEntry]
"""
read_up_to = self._logged_metrics.qsize()
messages = []
for i in range(read_up_to):
try:
messages.append(self._log... | python | def get_last_metrics(self):
"""Read all measurement events since last call of the method.
:return List[ScalarMetricLogEntry]
"""
read_up_to = self._logged_metrics.qsize()
messages = []
for i in range(read_up_to):
try:
messages.append(self._log... | [
"def",
"get_last_metrics",
"(",
"self",
")",
":",
"read_up_to",
"=",
"self",
".",
"_logged_metrics",
".",
"qsize",
"(",
")",
"messages",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"read_up_to",
")",
":",
"try",
":",
"messages",
".",
"append",
"(",
... | Read all measurement events since last call of the method.
:return List[ScalarMetricLogEntry] | [
"Read",
"all",
"measurement",
"events",
"since",
"last",
"call",
"of",
"the",
"method",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/metrics_logger.py#L57-L69 |
224,509 | IDSIA/sacred | sacred/commandline_options.py | gather_command_line_options | def gather_command_line_options(filter_disabled=None):
"""Get a sorted list of all CommandLineOption subclasses."""
if filter_disabled is None:
filter_disabled = not SETTINGS.COMMAND_LINE.SHOW_DISABLED_OPTIONS
options = [opt for opt in get_inheritors(CommandLineOption)
if not filter_d... | python | def gather_command_line_options(filter_disabled=None):
"""Get a sorted list of all CommandLineOption subclasses."""
if filter_disabled is None:
filter_disabled = not SETTINGS.COMMAND_LINE.SHOW_DISABLED_OPTIONS
options = [opt for opt in get_inheritors(CommandLineOption)
if not filter_d... | [
"def",
"gather_command_line_options",
"(",
"filter_disabled",
"=",
"None",
")",
":",
"if",
"filter_disabled",
"is",
"None",
":",
"filter_disabled",
"=",
"not",
"SETTINGS",
".",
"COMMAND_LINE",
".",
"SHOW_DISABLED_OPTIONS",
"options",
"=",
"[",
"opt",
"for",
"opt",... | Get a sorted list of all CommandLineOption subclasses. | [
"Get",
"a",
"sorted",
"list",
"of",
"all",
"CommandLineOption",
"subclasses",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/commandline_options.py#L159-L165 |
224,510 | IDSIA/sacred | sacred/commandline_options.py | LoglevelOption.apply | def apply(cls, args, run):
"""Adjust the loglevel of the root-logger of this run."""
# TODO: sacred.initialize.create_run already takes care of this
try:
lvl = int(args)
except ValueError:
lvl = args
run.root_logger.setLevel(lvl) | python | def apply(cls, args, run):
"""Adjust the loglevel of the root-logger of this run."""
# TODO: sacred.initialize.create_run already takes care of this
try:
lvl = int(args)
except ValueError:
lvl = args
run.root_logger.setLevel(lvl) | [
"def",
"apply",
"(",
"cls",
",",
"args",
",",
"run",
")",
":",
"# TODO: sacred.initialize.create_run already takes care of this",
"try",
":",
"lvl",
"=",
"int",
"(",
"args",
")",
"except",
"ValueError",
":",
"lvl",
"=",
"args",
"run",
".",
"root_logger",
".",
... | Adjust the loglevel of the root-logger of this run. | [
"Adjust",
"the",
"loglevel",
"of",
"the",
"root",
"-",
"logger",
"of",
"this",
"run",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/commandline_options.py#L203-L211 |
224,511 | IDSIA/sacred | sacred/commandline_options.py | PriorityOption.apply | def apply(cls, args, run):
"""Add priority info for this run."""
try:
priority = float(args)
except ValueError:
raise ValueError("The PRIORITY argument must be a number! "
"(but was '{}')".format(args))
run.meta_info['priority'] = prio... | python | def apply(cls, args, run):
"""Add priority info for this run."""
try:
priority = float(args)
except ValueError:
raise ValueError("The PRIORITY argument must be a number! "
"(but was '{}')".format(args))
run.meta_info['priority'] = prio... | [
"def",
"apply",
"(",
"cls",
",",
"args",
",",
"run",
")",
":",
"try",
":",
"priority",
"=",
"float",
"(",
"args",
")",
"except",
"ValueError",
":",
"raise",
"ValueError",
"(",
"\"The PRIORITY argument must be a number! \"",
"\"(but was '{}')\"",
".",
"format",
... | Add priority info for this run. | [
"Add",
"priority",
"info",
"for",
"this",
"run",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/commandline_options.py#L273-L280 |
224,512 | IDSIA/sacred | sacred/ingredient.py | Ingredient.capture | def capture(self, function=None, prefix=None):
"""
Decorator to turn a function into a captured function.
The missing arguments of captured functions are automatically filled
from the configuration if possible.
See :ref:`captured_functions` for more information.
If a ``... | python | def capture(self, function=None, prefix=None):
"""
Decorator to turn a function into a captured function.
The missing arguments of captured functions are automatically filled
from the configuration if possible.
See :ref:`captured_functions` for more information.
If a ``... | [
"def",
"capture",
"(",
"self",
",",
"function",
"=",
"None",
",",
"prefix",
"=",
"None",
")",
":",
"if",
"function",
"in",
"self",
".",
"captured_functions",
":",
"return",
"function",
"captured_function",
"=",
"create_captured_function",
"(",
"function",
",",... | Decorator to turn a function into a captured function.
The missing arguments of captured functions are automatically filled
from the configuration if possible.
See :ref:`captured_functions` for more information.
If a ``prefix`` is specified, the search for suitable
entries is p... | [
"Decorator",
"to",
"turn",
"a",
"function",
"into",
"a",
"captured",
"function",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L80-L95 |
224,513 | IDSIA/sacred | sacred/ingredient.py | Ingredient.pre_run_hook | def pre_run_hook(self, func, prefix=None):
"""
Decorator to add a pre-run hook to this ingredient.
Pre-run hooks are captured functions that are run, just before the
main function is executed.
"""
cf = self.capture(func, prefix=prefix)
self.pre_run_hooks.append(c... | python | def pre_run_hook(self, func, prefix=None):
"""
Decorator to add a pre-run hook to this ingredient.
Pre-run hooks are captured functions that are run, just before the
main function is executed.
"""
cf = self.capture(func, prefix=prefix)
self.pre_run_hooks.append(c... | [
"def",
"pre_run_hook",
"(",
"self",
",",
"func",
",",
"prefix",
"=",
"None",
")",
":",
"cf",
"=",
"self",
".",
"capture",
"(",
"func",
",",
"prefix",
"=",
"prefix",
")",
"self",
".",
"pre_run_hooks",
".",
"append",
"(",
"cf",
")",
"return",
"cf"
] | Decorator to add a pre-run hook to this ingredient.
Pre-run hooks are captured functions that are run, just before the
main function is executed. | [
"Decorator",
"to",
"add",
"a",
"pre",
"-",
"run",
"hook",
"to",
"this",
"ingredient",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L98-L107 |
224,514 | IDSIA/sacred | sacred/ingredient.py | Ingredient.post_run_hook | def post_run_hook(self, func, prefix=None):
"""
Decorator to add a post-run hook to this ingredient.
Post-run hooks are captured functions that are run, just after the
main function is executed.
"""
cf = self.capture(func, prefix=prefix)
self.post_run_hooks.appen... | python | def post_run_hook(self, func, prefix=None):
"""
Decorator to add a post-run hook to this ingredient.
Post-run hooks are captured functions that are run, just after the
main function is executed.
"""
cf = self.capture(func, prefix=prefix)
self.post_run_hooks.appen... | [
"def",
"post_run_hook",
"(",
"self",
",",
"func",
",",
"prefix",
"=",
"None",
")",
":",
"cf",
"=",
"self",
".",
"capture",
"(",
"func",
",",
"prefix",
"=",
"prefix",
")",
"self",
".",
"post_run_hooks",
".",
"append",
"(",
"cf",
")",
"return",
"cf"
] | Decorator to add a post-run hook to this ingredient.
Post-run hooks are captured functions that are run, just after the
main function is executed. | [
"Decorator",
"to",
"add",
"a",
"post",
"-",
"run",
"hook",
"to",
"this",
"ingredient",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L110-L119 |
224,515 | IDSIA/sacred | sacred/ingredient.py | Ingredient.command | def command(self, function=None, prefix=None, unobserved=False):
"""
Decorator to define a new command for this Ingredient or Experiment.
The name of the command will be the name of the function. It can be
called from the command-line or by using the run_command function.
Comma... | python | def command(self, function=None, prefix=None, unobserved=False):
"""
Decorator to define a new command for this Ingredient or Experiment.
The name of the command will be the name of the function. It can be
called from the command-line or by using the run_command function.
Comma... | [
"def",
"command",
"(",
"self",
",",
"function",
"=",
"None",
",",
"prefix",
"=",
"None",
",",
"unobserved",
"=",
"False",
")",
":",
"captured_f",
"=",
"self",
".",
"capture",
"(",
"function",
",",
"prefix",
"=",
"prefix",
")",
"captured_f",
".",
"unobs... | Decorator to define a new command for this Ingredient or Experiment.
The name of the command will be the name of the function. It can be
called from the command-line or by using the run_command function.
Commands are automatically also captured functions.
The command can be given a pr... | [
"Decorator",
"to",
"define",
"a",
"new",
"command",
"for",
"this",
"Ingredient",
"or",
"Experiment",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L122-L140 |
224,516 | IDSIA/sacred | sacred/ingredient.py | Ingredient.config | def config(self, function):
"""
Decorator to add a function to the configuration of the Experiment.
The decorated function is turned into a
:class:`~sacred.config_scope.ConfigScope` and added to the
Ingredient/Experiment.
When the experiment is run, this function will a... | python | def config(self, function):
"""
Decorator to add a function to the configuration of the Experiment.
The decorated function is turned into a
:class:`~sacred.config_scope.ConfigScope` and added to the
Ingredient/Experiment.
When the experiment is run, this function will a... | [
"def",
"config",
"(",
"self",
",",
"function",
")",
":",
"self",
".",
"configurations",
".",
"append",
"(",
"ConfigScope",
"(",
"function",
")",
")",
"return",
"self",
".",
"configurations",
"[",
"-",
"1",
"]"
] | Decorator to add a function to the configuration of the Experiment.
The decorated function is turned into a
:class:`~sacred.config_scope.ConfigScope` and added to the
Ingredient/Experiment.
When the experiment is run, this function will also be executed and
all json-serializabl... | [
"Decorator",
"to",
"add",
"a",
"function",
"to",
"the",
"configuration",
"of",
"the",
"Experiment",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L142-L155 |
224,517 | IDSIA/sacred | sacred/ingredient.py | Ingredient.named_config | def named_config(self, func):
"""
Decorator to turn a function into a named configuration.
See :ref:`named_configurations`.
"""
config_scope = ConfigScope(func)
self._add_named_config(func.__name__, config_scope)
return config_scope | python | def named_config(self, func):
"""
Decorator to turn a function into a named configuration.
See :ref:`named_configurations`.
"""
config_scope = ConfigScope(func)
self._add_named_config(func.__name__, config_scope)
return config_scope | [
"def",
"named_config",
"(",
"self",
",",
"func",
")",
":",
"config_scope",
"=",
"ConfigScope",
"(",
"func",
")",
"self",
".",
"_add_named_config",
"(",
"func",
".",
"__name__",
",",
"config_scope",
")",
"return",
"config_scope"
] | Decorator to turn a function into a named configuration.
See :ref:`named_configurations`. | [
"Decorator",
"to",
"turn",
"a",
"function",
"into",
"a",
"named",
"configuration",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L157-L165 |
224,518 | IDSIA/sacred | sacred/ingredient.py | Ingredient.config_hook | def config_hook(self, func):
"""
Decorator to add a config hook to this ingredient.
Config hooks need to be a function that takes 3 parameters and returns
a dictionary:
(config, command_name, logger) --> dict
Config hooks are run after the configuration of this Ingredie... | python | def config_hook(self, func):
"""
Decorator to add a config hook to this ingredient.
Config hooks need to be a function that takes 3 parameters and returns
a dictionary:
(config, command_name, logger) --> dict
Config hooks are run after the configuration of this Ingredie... | [
"def",
"config_hook",
"(",
"self",
",",
"func",
")",
":",
"argspec",
"=",
"inspect",
".",
"getargspec",
"(",
"func",
")",
"args",
"=",
"[",
"'config'",
",",
"'command_name'",
",",
"'logger'",
"]",
"if",
"not",
"(",
"argspec",
".",
"args",
"==",
"args",... | Decorator to add a config hook to this ingredient.
Config hooks need to be a function that takes 3 parameters and returns
a dictionary:
(config, command_name, logger) --> dict
Config hooks are run after the configuration of this Ingredient, but
before any further ingredient-con... | [
"Decorator",
"to",
"add",
"a",
"config",
"hook",
"to",
"this",
"ingredient",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L167-L189 |
224,519 | IDSIA/sacred | sacred/ingredient.py | Ingredient.add_package_dependency | def add_package_dependency(self, package_name, version):
"""
Add a package to the list of dependencies.
:param package_name: The name of the package dependency
:type package_name: str
:param version: The (minimum) version of the package
:type version: str
"""
... | python | def add_package_dependency(self, package_name, version):
"""
Add a package to the list of dependencies.
:param package_name: The name of the package dependency
:type package_name: str
:param version: The (minimum) version of the package
:type version: str
"""
... | [
"def",
"add_package_dependency",
"(",
"self",
",",
"package_name",
",",
"version",
")",
":",
"if",
"not",
"PEP440_VERSION_PATTERN",
".",
"match",
"(",
"version",
")",
":",
"raise",
"ValueError",
"(",
"'Invalid Version: \"{}\"'",
".",
"format",
"(",
"version",
")... | Add a package to the list of dependencies.
:param package_name: The name of the package dependency
:type package_name: str
:param version: The (minimum) version of the package
:type version: str | [
"Add",
"a",
"package",
"to",
"the",
"list",
"of",
"dependencies",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L272-L283 |
224,520 | IDSIA/sacred | sacred/ingredient.py | Ingredient._gather | def _gather(self, func):
"""
Function needed and used by gathering functions through the decorator
`gather_from_ingredients` in `Ingredient`. Don't use this function by
itself outside of the decorator!
By overwriting this function you can filter what is visible when
gath... | python | def _gather(self, func):
"""
Function needed and used by gathering functions through the decorator
`gather_from_ingredients` in `Ingredient`. Don't use this function by
itself outside of the decorator!
By overwriting this function you can filter what is visible when
gath... | [
"def",
"_gather",
"(",
"self",
",",
"func",
")",
":",
"for",
"ingredient",
",",
"_",
"in",
"self",
".",
"traverse_ingredients",
"(",
")",
":",
"for",
"item",
"in",
"func",
"(",
"ingredient",
")",
":",
"yield",
"item"
] | Function needed and used by gathering functions through the decorator
`gather_from_ingredients` in `Ingredient`. Don't use this function by
itself outside of the decorator!
By overwriting this function you can filter what is visible when
gathering something (e.g. commands). See `Experim... | [
"Function",
"needed",
"and",
"used",
"by",
"gathering",
"functions",
"through",
"the",
"decorator",
"gather_from_ingredients",
"in",
"Ingredient",
".",
"Don",
"t",
"use",
"this",
"function",
"by",
"itself",
"outside",
"of",
"the",
"decorator!"
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L285-L297 |
224,521 | IDSIA/sacred | sacred/ingredient.py | Ingredient.gather_commands | def gather_commands(self, ingredient):
"""Collect all commands from this ingredient and its sub-ingredients.
Yields
------
cmd_name: str
The full (dotted) name of the command.
cmd: function
The corresponding captured function.
"""
for comm... | python | def gather_commands(self, ingredient):
"""Collect all commands from this ingredient and its sub-ingredients.
Yields
------
cmd_name: str
The full (dotted) name of the command.
cmd: function
The corresponding captured function.
"""
for comm... | [
"def",
"gather_commands",
"(",
"self",
",",
"ingredient",
")",
":",
"for",
"command_name",
",",
"command",
"in",
"ingredient",
".",
"commands",
".",
"items",
"(",
")",
":",
"yield",
"join_paths",
"(",
"ingredient",
".",
"path",
",",
"command_name",
")",
",... | Collect all commands from this ingredient and its sub-ingredients.
Yields
------
cmd_name: str
The full (dotted) name of the command.
cmd: function
The corresponding captured function. | [
"Collect",
"all",
"commands",
"from",
"this",
"ingredient",
"and",
"its",
"sub",
"-",
"ingredients",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L300-L311 |
224,522 | IDSIA/sacred | sacred/ingredient.py | Ingredient.gather_named_configs | def gather_named_configs(self, ingredient):
"""Collect all named configs from this ingredient and its
sub-ingredients.
Yields
------
config_name: str
The full (dotted) name of the named config.
config: ConfigScope or ConfigDict or basestring
The c... | python | def gather_named_configs(self, ingredient):
"""Collect all named configs from this ingredient and its
sub-ingredients.
Yields
------
config_name: str
The full (dotted) name of the named config.
config: ConfigScope or ConfigDict or basestring
The c... | [
"def",
"gather_named_configs",
"(",
"self",
",",
"ingredient",
")",
":",
"for",
"config_name",
",",
"config",
"in",
"ingredient",
".",
"named_configs",
".",
"items",
"(",
")",
":",
"yield",
"join_paths",
"(",
"ingredient",
".",
"path",
",",
"config_name",
")... | Collect all named configs from this ingredient and its
sub-ingredients.
Yields
------
config_name: str
The full (dotted) name of the named config.
config: ConfigScope or ConfigDict or basestring
The corresponding named config. | [
"Collect",
"all",
"named",
"configs",
"from",
"this",
"ingredient",
"and",
"its",
"sub",
"-",
"ingredients",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L314-L326 |
224,523 | IDSIA/sacred | sacred/ingredient.py | Ingredient.get_experiment_info | def get_experiment_info(self):
"""Get a dictionary with information about this experiment.
Contains:
* *name*: the name
* *sources*: a list of sources (filename, md5)
* *dependencies*: a list of package dependencies (name, version)
:return: experiment information
... | python | def get_experiment_info(self):
"""Get a dictionary with information about this experiment.
Contains:
* *name*: the name
* *sources*: a list of sources (filename, md5)
* *dependencies*: a list of package dependencies (name, version)
:return: experiment information
... | [
"def",
"get_experiment_info",
"(",
"self",
")",
":",
"dependencies",
"=",
"set",
"(",
")",
"sources",
"=",
"set",
"(",
")",
"for",
"ing",
",",
"_",
"in",
"self",
".",
"traverse_ingredients",
"(",
")",
":",
"dependencies",
"|=",
"ing",
".",
"dependencies"... | Get a dictionary with information about this experiment.
Contains:
* *name*: the name
* *sources*: a list of sources (filename, md5)
* *dependencies*: a list of package dependencies (name, version)
:return: experiment information
:rtype: dict | [
"Get",
"a",
"dictionary",
"with",
"information",
"about",
"this",
"experiment",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L328-L362 |
224,524 | IDSIA/sacred | sacred/ingredient.py | Ingredient.traverse_ingredients | def traverse_ingredients(self):
"""Recursively traverse this ingredient and its sub-ingredients.
Yields
------
ingredient: sacred.Ingredient
The ingredient as traversed in preorder.
depth: int
The depth of the ingredient starting from 0.
Raises
... | python | def traverse_ingredients(self):
"""Recursively traverse this ingredient and its sub-ingredients.
Yields
------
ingredient: sacred.Ingredient
The ingredient as traversed in preorder.
depth: int
The depth of the ingredient starting from 0.
Raises
... | [
"def",
"traverse_ingredients",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_traversing",
":",
"raise",
"CircularDependencyError",
"(",
"ingredients",
"=",
"[",
"self",
"]",
")",
"else",
":",
"self",
".",
"_is_traversing",
"=",
"True",
"yield",
"self",
",",... | Recursively traverse this ingredient and its sub-ingredients.
Yields
------
ingredient: sacred.Ingredient
The ingredient as traversed in preorder.
depth: int
The depth of the ingredient starting from 0.
Raises
------
CircularDependencyErr... | [
"Recursively",
"traverse",
"this",
"ingredient",
"and",
"its",
"sub",
"-",
"ingredients",
"."
] | 72633776bed9b5bddf93ae7d215188e61970973a | https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L364-L388 |
224,525 | simonw/datasette | datasette/utils.py | path_from_row_pks | def path_from_row_pks(row, pks, use_rowid, quote=True):
""" Generate an optionally URL-quoted unique identifier
for a row from its primary keys."""
if use_rowid:
bits = [row['rowid']]
else:
bits = [
row[pk]["value"] if isinstance(row[pk], dict) else row[pk]
fo... | python | def path_from_row_pks(row, pks, use_rowid, quote=True):
""" Generate an optionally URL-quoted unique identifier
for a row from its primary keys."""
if use_rowid:
bits = [row['rowid']]
else:
bits = [
row[pk]["value"] if isinstance(row[pk], dict) else row[pk]
fo... | [
"def",
"path_from_row_pks",
"(",
"row",
",",
"pks",
",",
"use_rowid",
",",
"quote",
"=",
"True",
")",
":",
"if",
"use_rowid",
":",
"bits",
"=",
"[",
"row",
"[",
"'rowid'",
"]",
"]",
"else",
":",
"bits",
"=",
"[",
"row",
"[",
"pk",
"]",
"[",
"\"va... | Generate an optionally URL-quoted unique identifier
for a row from its primary keys. | [
"Generate",
"an",
"optionally",
"URL",
"-",
"quoted",
"unique",
"identifier",
"for",
"a",
"row",
"from",
"its",
"primary",
"keys",
"."
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/utils.py#L75-L90 |
224,526 | simonw/datasette | datasette/utils.py | detect_primary_keys | def detect_primary_keys(conn, table):
" Figure out primary keys for a table. "
table_info_rows = [
row
for row in conn.execute(
'PRAGMA table_info("{}")'.format(table)
).fetchall()
if row[-1]
]
table_info_rows.sort(key=lambda row: row[-1])
return [str(r[1]... | python | def detect_primary_keys(conn, table):
" Figure out primary keys for a table. "
table_info_rows = [
row
for row in conn.execute(
'PRAGMA table_info("{}")'.format(table)
).fetchall()
if row[-1]
]
table_info_rows.sort(key=lambda row: row[-1])
return [str(r[1]... | [
"def",
"detect_primary_keys",
"(",
"conn",
",",
"table",
")",
":",
"table_info_rows",
"=",
"[",
"row",
"for",
"row",
"in",
"conn",
".",
"execute",
"(",
"'PRAGMA table_info(\"{}\")'",
".",
"format",
"(",
"table",
")",
")",
".",
"fetchall",
"(",
")",
"if",
... | Figure out primary keys for a table. | [
"Figure",
"out",
"primary",
"keys",
"for",
"a",
"table",
"."
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/utils.py#L478-L488 |
224,527 | simonw/datasette | datasette/utils.py | detect_fts | def detect_fts(conn, table):
"Detect if table has a corresponding FTS virtual table and return it"
rows = conn.execute(detect_fts_sql(table)).fetchall()
if len(rows) == 0:
return None
else:
return rows[0][0] | python | def detect_fts(conn, table):
"Detect if table has a corresponding FTS virtual table and return it"
rows = conn.execute(detect_fts_sql(table)).fetchall()
if len(rows) == 0:
return None
else:
return rows[0][0] | [
"def",
"detect_fts",
"(",
"conn",
",",
"table",
")",
":",
"rows",
"=",
"conn",
".",
"execute",
"(",
"detect_fts_sql",
"(",
"table",
")",
")",
".",
"fetchall",
"(",
")",
"if",
"len",
"(",
"rows",
")",
"==",
"0",
":",
"return",
"None",
"else",
":",
... | Detect if table has a corresponding FTS virtual table and return it | [
"Detect",
"if",
"table",
"has",
"a",
"corresponding",
"FTS",
"virtual",
"table",
"and",
"return",
"it"
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/utils.py#L545-L551 |
224,528 | simonw/datasette | datasette/app.py | Datasette.metadata | def metadata(self, key=None, database=None, table=None, fallback=True):
"""
Looks up metadata, cascading backwards from specified level.
Returns None if metadata value is not found.
"""
assert not (database is None and table is not None), \
"Cannot call metadata() wit... | python | def metadata(self, key=None, database=None, table=None, fallback=True):
"""
Looks up metadata, cascading backwards from specified level.
Returns None if metadata value is not found.
"""
assert not (database is None and table is not None), \
"Cannot call metadata() wit... | [
"def",
"metadata",
"(",
"self",
",",
"key",
"=",
"None",
",",
"database",
"=",
"None",
",",
"table",
"=",
"None",
",",
"fallback",
"=",
"True",
")",
":",
"assert",
"not",
"(",
"database",
"is",
"None",
"and",
"table",
"is",
"not",
"None",
")",
",",... | Looks up metadata, cascading backwards from specified level.
Returns None if metadata value is not found. | [
"Looks",
"up",
"metadata",
"cascading",
"backwards",
"from",
"specified",
"level",
".",
"Returns",
"None",
"if",
"metadata",
"value",
"is",
"not",
"found",
"."
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/app.py#L239-L269 |
224,529 | simonw/datasette | datasette/app.py | Datasette.inspect | def inspect(self):
" Inspect the database and return a dictionary of table metadata "
if self._inspect:
return self._inspect
self._inspect = {}
for filename in self.files:
if filename is MEMORY:
self._inspect[":memory:"] = {
"h... | python | def inspect(self):
" Inspect the database and return a dictionary of table metadata "
if self._inspect:
return self._inspect
self._inspect = {}
for filename in self.files:
if filename is MEMORY:
self._inspect[":memory:"] = {
"h... | [
"def",
"inspect",
"(",
"self",
")",
":",
"if",
"self",
".",
"_inspect",
":",
"return",
"self",
".",
"_inspect",
"self",
".",
"_inspect",
"=",
"{",
"}",
"for",
"filename",
"in",
"self",
".",
"files",
":",
"if",
"filename",
"is",
"MEMORY",
":",
"self",... | Inspect the database and return a dictionary of table metadata | [
"Inspect",
"the",
"database",
"and",
"return",
"a",
"dictionary",
"of",
"table",
"metadata"
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/app.py#L414-L455 |
224,530 | simonw/datasette | datasette/app.py | Datasette.table_metadata | def table_metadata(self, database, table):
"Fetch table-specific metadata."
return (self.metadata("databases") or {}).get(database, {}).get(
"tables", {}
).get(
table, {}
) | python | def table_metadata(self, database, table):
"Fetch table-specific metadata."
return (self.metadata("databases") or {}).get(database, {}).get(
"tables", {}
).get(
table, {}
) | [
"def",
"table_metadata",
"(",
"self",
",",
"database",
",",
"table",
")",
":",
"return",
"(",
"self",
".",
"metadata",
"(",
"\"databases\"",
")",
"or",
"{",
"}",
")",
".",
"get",
"(",
"database",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"tables\"",
"... | Fetch table-specific metadata. | [
"Fetch",
"table",
"-",
"specific",
"metadata",
"."
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/app.py#L521-L527 |
224,531 | simonw/datasette | datasette/app.py | Datasette.execute | async def execute(
self,
db_name,
sql,
params=None,
truncate=False,
custom_time_limit=None,
page_size=None,
):
"""Executes sql against db_name in a thread"""
page_size = page_size or self.page_size
def sql_operation_in_thread(conn):
... | python | async def execute(
self,
db_name,
sql,
params=None,
truncate=False,
custom_time_limit=None,
page_size=None,
):
"""Executes sql against db_name in a thread"""
page_size = page_size or self.page_size
def sql_operation_in_thread(conn):
... | [
"async",
"def",
"execute",
"(",
"self",
",",
"db_name",
",",
"sql",
",",
"params",
"=",
"None",
",",
"truncate",
"=",
"False",
",",
"custom_time_limit",
"=",
"None",
",",
"page_size",
"=",
"None",
",",
")",
":",
"page_size",
"=",
"page_size",
"or",
"se... | Executes sql against db_name in a thread | [
"Executes",
"sql",
"against",
"db_name",
"in",
"a",
"thread"
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/app.py#L580-L631 |
224,532 | simonw/datasette | datasette/inspect.py | inspect_hash | def inspect_hash(path):
" Calculate the hash of a database, efficiently. "
m = hashlib.sha256()
with path.open("rb") as fp:
while True:
data = fp.read(HASH_BLOCK_SIZE)
if not data:
break
m.update(data)
return m.hexdigest() | python | def inspect_hash(path):
" Calculate the hash of a database, efficiently. "
m = hashlib.sha256()
with path.open("rb") as fp:
while True:
data = fp.read(HASH_BLOCK_SIZE)
if not data:
break
m.update(data)
return m.hexdigest() | [
"def",
"inspect_hash",
"(",
"path",
")",
":",
"m",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"with",
"path",
".",
"open",
"(",
"\"rb\"",
")",
"as",
"fp",
":",
"while",
"True",
":",
"data",
"=",
"fp",
".",
"read",
"(",
"HASH_BLOCK_SIZE",
")",
"if",
... | Calculate the hash of a database, efficiently. | [
"Calculate",
"the",
"hash",
"of",
"a",
"database",
"efficiently",
"."
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/inspect.py#L17-L27 |
224,533 | simonw/datasette | datasette/inspect.py | inspect_tables | def inspect_tables(conn, database_metadata):
" List tables and their row counts, excluding uninteresting tables. "
tables = {}
table_names = [
r["name"]
for r in conn.execute(
'select * from sqlite_master where type="table"'
)
]
for table in table_names:
... | python | def inspect_tables(conn, database_metadata):
" List tables and their row counts, excluding uninteresting tables. "
tables = {}
table_names = [
r["name"]
for r in conn.execute(
'select * from sqlite_master where type="table"'
)
]
for table in table_names:
... | [
"def",
"inspect_tables",
"(",
"conn",
",",
"database_metadata",
")",
":",
"tables",
"=",
"{",
"}",
"table_names",
"=",
"[",
"r",
"[",
"\"name\"",
"]",
"for",
"r",
"in",
"conn",
".",
"execute",
"(",
"'select * from sqlite_master where type=\"table\"'",
")",
"]"... | List tables and their row counts, excluding uninteresting tables. | [
"List",
"tables",
"and",
"their",
"row",
"counts",
"excluding",
"uninteresting",
"tables",
"."
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/inspect.py#L35-L115 |
224,534 | simonw/datasette | datasette/filters.py | Filters.convert_unit | def convert_unit(self, column, value):
"If the user has provided a unit in the query, convert it into the column unit, if present."
if column not in self.units:
return value
# Try to interpret the value as a unit
value = self.ureg(value)
if isinstance(value, numbers.... | python | def convert_unit(self, column, value):
"If the user has provided a unit in the query, convert it into the column unit, if present."
if column not in self.units:
return value
# Try to interpret the value as a unit
value = self.ureg(value)
if isinstance(value, numbers.... | [
"def",
"convert_unit",
"(",
"self",
",",
"column",
",",
"value",
")",
":",
"if",
"column",
"not",
"in",
"self",
".",
"units",
":",
"return",
"value",
"# Try to interpret the value as a unit",
"value",
"=",
"self",
".",
"ureg",
"(",
"value",
")",
"if",
"isi... | If the user has provided a unit in the query, convert it into the column unit, if present. | [
"If",
"the",
"user",
"has",
"provided",
"a",
"unit",
"in",
"the",
"query",
"convert",
"it",
"into",
"the",
"column",
"unit",
"if",
"present",
"."
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/filters.py#L156-L168 |
224,535 | simonw/datasette | datasette/cli.py | skeleton | def skeleton(files, metadata, sqlite_extensions):
"Generate a skeleton metadata.json file for specified SQLite databases"
if os.path.exists(metadata):
click.secho(
"File {} already exists, will not over-write".format(metadata),
bg="red",
fg="white",
bold=T... | python | def skeleton(files, metadata, sqlite_extensions):
"Generate a skeleton metadata.json file for specified SQLite databases"
if os.path.exists(metadata):
click.secho(
"File {} already exists, will not over-write".format(metadata),
bg="red",
fg="white",
bold=T... | [
"def",
"skeleton",
"(",
"files",
",",
"metadata",
",",
"sqlite_extensions",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"metadata",
")",
":",
"click",
".",
"secho",
"(",
"\"File {} already exists, will not over-write\"",
".",
"format",
"(",
"metadat... | Generate a skeleton metadata.json file for specified SQLite databases | [
"Generate",
"a",
"skeleton",
"metadata",
".",
"json",
"file",
"for",
"specified",
"SQLite",
"databases"
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/cli.py#L107-L159 |
224,536 | simonw/datasette | datasette/cli.py | plugins | def plugins(all, plugins_dir):
"List currently available plugins"
app = Datasette([], plugins_dir=plugins_dir)
click.echo(json.dumps(app.plugins(all), indent=4)) | python | def plugins(all, plugins_dir):
"List currently available plugins"
app = Datasette([], plugins_dir=plugins_dir)
click.echo(json.dumps(app.plugins(all), indent=4)) | [
"def",
"plugins",
"(",
"all",
",",
"plugins_dir",
")",
":",
"app",
"=",
"Datasette",
"(",
"[",
"]",
",",
"plugins_dir",
"=",
"plugins_dir",
")",
"click",
".",
"echo",
"(",
"json",
".",
"dumps",
"(",
"app",
".",
"plugins",
"(",
"all",
")",
",",
"ind... | List currently available plugins | [
"List",
"currently",
"available",
"plugins"
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/cli.py#L169-L172 |
224,537 | simonw/datasette | datasette/cli.py | package | def package(
files,
tag,
metadata,
extra_options,
branch,
template_dir,
plugins_dir,
static,
install,
spatialite,
version_note,
**extra_metadata
):
"Package specified SQLite files into a new datasette Docker container"
if not shutil.which("docker"):
click.... | python | def package(
files,
tag,
metadata,
extra_options,
branch,
template_dir,
plugins_dir,
static,
install,
spatialite,
version_note,
**extra_metadata
):
"Package specified SQLite files into a new datasette Docker container"
if not shutil.which("docker"):
click.... | [
"def",
"package",
"(",
"files",
",",
"tag",
",",
"metadata",
",",
"extra_options",
",",
"branch",
",",
"template_dir",
",",
"plugins_dir",
",",
"static",
",",
"install",
",",
"spatialite",
",",
"version_note",
",",
"*",
"*",
"extra_metadata",
")",
":",
"if... | Package specified SQLite files into a new datasette Docker container | [
"Package",
"specified",
"SQLite",
"files",
"into",
"a",
"new",
"datasette",
"Docker",
"container"
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/cli.py#L222-L265 |
224,538 | simonw/datasette | datasette/cli.py | serve | def serve(
files,
immutable,
host,
port,
debug,
reload,
cors,
sqlite_extensions,
inspect_file,
metadata,
template_dir,
plugins_dir,
static,
memory,
config,
version_note,
help_config,
):
"""Serve up specified SQLite database files with a web UI"""
... | python | def serve(
files,
immutable,
host,
port,
debug,
reload,
cors,
sqlite_extensions,
inspect_file,
metadata,
template_dir,
plugins_dir,
static,
memory,
config,
version_note,
help_config,
):
"""Serve up specified SQLite database files with a web UI"""
... | [
"def",
"serve",
"(",
"files",
",",
"immutable",
",",
"host",
",",
"port",
",",
"debug",
",",
"reload",
",",
"cors",
",",
"sqlite_extensions",
",",
"inspect_file",
",",
"metadata",
",",
"template_dir",
",",
"plugins_dir",
",",
"static",
",",
"memory",
",",
... | Serve up specified SQLite database files with a web UI | [
"Serve",
"up",
"specified",
"SQLite",
"database",
"files",
"with",
"a",
"web",
"UI"
] | 11b352b4d52fd02a422776edebb14f12e4994d3b | https://github.com/simonw/datasette/blob/11b352b4d52fd02a422776edebb14f12e4994d3b/datasette/cli.py#L340-L405 |
224,539 | ResidentMario/missingno | missingno/missingno.py | bar | def bar(df, figsize=(24, 10), fontsize=16, labels=None, log=False, color='dimgray', inline=False,
filter=None, n=0, p=0, sort=None):
"""
A bar chart visualization of the nullity of the given DataFrame.
:param df: The input DataFrame.
:param log: Whether or not to display a logorithmic plot. Def... | python | def bar(df, figsize=(24, 10), fontsize=16, labels=None, log=False, color='dimgray', inline=False,
filter=None, n=0, p=0, sort=None):
"""
A bar chart visualization of the nullity of the given DataFrame.
:param df: The input DataFrame.
:param log: Whether or not to display a logorithmic plot. Def... | [
"def",
"bar",
"(",
"df",
",",
"figsize",
"=",
"(",
"24",
",",
"10",
")",
",",
"fontsize",
"=",
"16",
",",
"labels",
"=",
"None",
",",
"log",
"=",
"False",
",",
"color",
"=",
"'dimgray'",
",",
"inline",
"=",
"False",
",",
"filter",
"=",
"None",
... | A bar chart visualization of the nullity of the given DataFrame.
:param df: The input DataFrame.
:param log: Whether or not to display a logorithmic plot. Defaults to False (linear).
:param filter: The filter to apply to the heatmap. Should be one of "top", "bottom", or None (default).
:param n: The ca... | [
"A",
"bar",
"chart",
"visualization",
"of",
"the",
"nullity",
"of",
"the",
"given",
"DataFrame",
"."
] | 1d67f91fbab0695a919c6bb72c796db57024e0ca | https://github.com/ResidentMario/missingno/blob/1d67f91fbab0695a919c6bb72c796db57024e0ca/missingno/missingno.py#L195-L263 |
224,540 | ResidentMario/missingno | missingno/missingno.py | heatmap | def heatmap(df, inline=False,
filter=None, n=0, p=0, sort=None,
figsize=(20, 12), fontsize=16, labels=True,
cmap='RdBu', vmin=-1, vmax=1, cbar=True
):
"""
Presents a `seaborn` heatmap visualization of nullity correlation in the given DataFrame.
Note that... | python | def heatmap(df, inline=False,
filter=None, n=0, p=0, sort=None,
figsize=(20, 12), fontsize=16, labels=True,
cmap='RdBu', vmin=-1, vmax=1, cbar=True
):
"""
Presents a `seaborn` heatmap visualization of nullity correlation in the given DataFrame.
Note that... | [
"def",
"heatmap",
"(",
"df",
",",
"inline",
"=",
"False",
",",
"filter",
"=",
"None",
",",
"n",
"=",
"0",
",",
"p",
"=",
"0",
",",
"sort",
"=",
"None",
",",
"figsize",
"=",
"(",
"20",
",",
"12",
")",
",",
"fontsize",
"=",
"16",
",",
"labels",... | Presents a `seaborn` heatmap visualization of nullity correlation in the given DataFrame.
Note that this visualization has no special support for large datasets. For those, try the dendrogram instead.
:param df: The DataFrame whose completeness is being heatmapped.
:param filter: The filter to apply t... | [
"Presents",
"a",
"seaborn",
"heatmap",
"visualization",
"of",
"nullity",
"correlation",
"in",
"the",
"given",
"DataFrame",
".",
"Note",
"that",
"this",
"visualization",
"has",
"no",
"special",
"support",
"for",
"large",
"datasets",
".",
"For",
"those",
"try",
... | 1d67f91fbab0695a919c6bb72c796db57024e0ca | https://github.com/ResidentMario/missingno/blob/1d67f91fbab0695a919c6bb72c796db57024e0ca/missingno/missingno.py#L266-L346 |
224,541 | ResidentMario/missingno | missingno/missingno.py | dendrogram | def dendrogram(df, method='average',
filter=None, n=0, p=0, sort=None,
orientation=None, figsize=None,
fontsize=16, inline=False
):
"""
Fits a `scipy` hierarchical clustering algorithm to the given DataFrame's variables and visualizes the results as
... | python | def dendrogram(df, method='average',
filter=None, n=0, p=0, sort=None,
orientation=None, figsize=None,
fontsize=16, inline=False
):
"""
Fits a `scipy` hierarchical clustering algorithm to the given DataFrame's variables and visualizes the results as
... | [
"def",
"dendrogram",
"(",
"df",
",",
"method",
"=",
"'average'",
",",
"filter",
"=",
"None",
",",
"n",
"=",
"0",
",",
"p",
"=",
"0",
",",
"sort",
"=",
"None",
",",
"orientation",
"=",
"None",
",",
"figsize",
"=",
"None",
",",
"fontsize",
"=",
"16... | Fits a `scipy` hierarchical clustering algorithm to the given DataFrame's variables and visualizes the results as
a `scipy` dendrogram.
The default vertical display will fit up to 50 columns. If more than 50 columns are specified and orientation is
left unspecified the dendrogram will automatically swa... | [
"Fits",
"a",
"scipy",
"hierarchical",
"clustering",
"algorithm",
"to",
"the",
"given",
"DataFrame",
"s",
"variables",
"and",
"visualizes",
"the",
"results",
"as",
"a",
"scipy",
"dendrogram",
".",
"The",
"default",
"vertical",
"display",
"will",
"fit",
"up",
"t... | 1d67f91fbab0695a919c6bb72c796db57024e0ca | https://github.com/ResidentMario/missingno/blob/1d67f91fbab0695a919c6bb72c796db57024e0ca/missingno/missingno.py#L349-L434 |
224,542 | ResidentMario/missingno | missingno/utils.py | nullity_sort | def nullity_sort(df, sort=None):
"""
Sorts a DataFrame according to its nullity, in either ascending or descending order.
:param df: The DataFrame object being sorted.
:param sort: The sorting method: either "ascending", "descending", or None (default).
:return: The nullity-sorted DataFrame.
""... | python | def nullity_sort(df, sort=None):
"""
Sorts a DataFrame according to its nullity, in either ascending or descending order.
:param df: The DataFrame object being sorted.
:param sort: The sorting method: either "ascending", "descending", or None (default).
:return: The nullity-sorted DataFrame.
""... | [
"def",
"nullity_sort",
"(",
"df",
",",
"sort",
"=",
"None",
")",
":",
"if",
"sort",
"==",
"'ascending'",
":",
"return",
"df",
".",
"iloc",
"[",
"np",
".",
"argsort",
"(",
"df",
".",
"count",
"(",
"axis",
"=",
"'columns'",
")",
".",
"values",
")",
... | Sorts a DataFrame according to its nullity, in either ascending or descending order.
:param df: The DataFrame object being sorted.
:param sort: The sorting method: either "ascending", "descending", or None (default).
:return: The nullity-sorted DataFrame. | [
"Sorts",
"a",
"DataFrame",
"according",
"to",
"its",
"nullity",
"in",
"either",
"ascending",
"or",
"descending",
"order",
"."
] | 1d67f91fbab0695a919c6bb72c796db57024e0ca | https://github.com/ResidentMario/missingno/blob/1d67f91fbab0695a919c6bb72c796db57024e0ca/missingno/utils.py#L5-L18 |
224,543 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/session_entity_types_client.py | SessionEntityTypesClient.from_service_account_file | def from_service_account_file(cls, filename, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to th... | python | def from_service_account_file(cls, filename, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to th... | [
"def",
"from_service_account_file",
"(",
"cls",
",",
"filename",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"credentials",
"=",
"service_account",
".",
"Credentials",
".",
"from_service_account_file",
"(",
"filename",
")",
"kwargs",
"[",
"'credentials'... | Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the con... | [
"Creates",
"an",
"instance",
"of",
"this",
"client",
"using",
"the",
"provided",
"credentials",
"file",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/session_entity_types_client.py#L75-L91 |
224,544 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/session_entity_types_client.py | SessionEntityTypesClient.session_entity_type_path | def session_entity_type_path(cls, project, session, entity_type):
"""Return a fully-qualified session_entity_type string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}',
project=project,
session=... | python | def session_entity_type_path(cls, project, session, entity_type):
"""Return a fully-qualified session_entity_type string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}',
project=project,
session=... | [
"def",
"session_entity_type_path",
"(",
"cls",
",",
"project",
",",
"session",
",",
"entity_type",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}'",
",",
"p... | Return a fully-qualified session_entity_type string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"session_entity_type",
"string",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/session_entity_types_client.py#L105-L112 |
224,545 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/session_entity_types_client.py | SessionEntityTypesClient.create_session_entity_type | def create_session_entity_type(
self,
parent,
session_entity_type,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Creates a session entity type.
Example:
... | python | def create_session_entity_type(
self,
parent,
session_entity_type,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Creates a session entity type.
Example:
... | [
"def",
"create_session_entity_type",
"(",
"self",
",",
"parent",
",",
"session_entity_type",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"... | Creates a session entity type.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.SessionEntityTypesClient()
>>>
>>> parent = client.session_path('[PROJECT]', '[SESSION]')
>>>
>>> # TODO: Initialize ``session_enti... | [
"Creates",
"a",
"session",
"entity",
"type",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/session_entity_types_client.py#L351-L415 |
224,546 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/session_entity_types_client.py | SessionEntityTypesClient.update_session_entity_type | def update_session_entity_type(
self,
session_entity_type,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Updates the specified session entity ty... | python | def update_session_entity_type(
self,
session_entity_type,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Updates the specified session entity ty... | [
"def",
"update_session_entity_type",
"(",
"self",
",",
"session_entity_type",
",",
"update_mask",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
... | Updates the specified session entity type.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.SessionEntityTypesClient()
>>>
>>> # TODO: Initialize ``session_entity_type``:
>>> session_entity_type = {}
>>>
... | [
"Updates",
"the",
"specified",
"session",
"entity",
"type",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/session_entity_types_client.py#L417-L482 |
224,547 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/session_entity_types_client.py | SessionEntityTypesClient.delete_session_entity_type | def delete_session_entity_type(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Deletes the specified session entity type.
Example:
>>> import ... | python | def delete_session_entity_type(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Deletes the specified session entity type.
Example:
>>> import ... | [
"def",
"delete_session_entity_type",
"(",
"self",
",",
"name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
","... | Deletes the specified session entity type.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.SessionEntityTypesClient()
>>>
>>> name = client.session_entity_type_path('[PROJECT]', '[SESSION]', '[ENTITY_TYPE]')
>>>
... | [
"Deletes",
"the",
"specified",
"session",
"entity",
"type",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/session_entity_types_client.py#L484-L537 |
224,548 | googleapis/dialogflow-python-client-v2 | samples/knowledge_base_management.py | list_knowledge_bases | def list_knowledge_bases(project_id):
"""Lists the Knowledge bases belonging to a project.
Args:
project_id: The GCP project linked with the agent."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow.KnowledgeBasesClient()
project_path = client.project_path(project_id)
print... | python | def list_knowledge_bases(project_id):
"""Lists the Knowledge bases belonging to a project.
Args:
project_id: The GCP project linked with the agent."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow.KnowledgeBasesClient()
project_path = client.project_path(project_id)
print... | [
"def",
"list_knowledge_bases",
"(",
"project_id",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"client",
"=",
"dialogflow",
".",
"KnowledgeBasesClient",
"(",
")",
"project_path",
"=",
"client",
".",
"project_path",
"(",
"project_id",
")",
"print",
... | Lists the Knowledge bases belonging to a project.
Args:
project_id: The GCP project linked with the agent. | [
"Lists",
"the",
"Knowledge",
"bases",
"belonging",
"to",
"a",
"project",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/knowledge_base_management.py#L35-L47 |
224,549 | googleapis/dialogflow-python-client-v2 | samples/knowledge_base_management.py | create_knowledge_base | def create_knowledge_base(project_id, display_name):
"""Creates a Knowledge base.
Args:
project_id: The GCP project linked with the agent.
display_name: The display name of the Knowledge base."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow.KnowledgeBasesClient()
proj... | python | def create_knowledge_base(project_id, display_name):
"""Creates a Knowledge base.
Args:
project_id: The GCP project linked with the agent.
display_name: The display name of the Knowledge base."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow.KnowledgeBasesClient()
proj... | [
"def",
"create_knowledge_base",
"(",
"project_id",
",",
"display_name",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"client",
"=",
"dialogflow",
".",
"KnowledgeBasesClient",
"(",
")",
"project_path",
"=",
"client",
".",
"project_path",
"(",
"projec... | Creates a Knowledge base.
Args:
project_id: The GCP project linked with the agent.
display_name: The display name of the Knowledge base. | [
"Creates",
"a",
"Knowledge",
"base",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/knowledge_base_management.py#L52-L69 |
224,550 | googleapis/dialogflow-python-client-v2 | samples/knowledge_base_management.py | get_knowledge_base | def get_knowledge_base(project_id, knowledge_base_id):
"""Gets a specific Knowledge base.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow.KnowledgeBasesClient()
knowl... | python | def get_knowledge_base(project_id, knowledge_base_id):
"""Gets a specific Knowledge base.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow.KnowledgeBasesClient()
knowl... | [
"def",
"get_knowledge_base",
"(",
"project_id",
",",
"knowledge_base_id",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"client",
"=",
"dialogflow",
".",
"KnowledgeBasesClient",
"(",
")",
"knowledge_base_path",
"=",
"client",
".",
"knowledge_base_path",
... | Gets a specific Knowledge base.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base. | [
"Gets",
"a",
"specific",
"Knowledge",
"base",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/knowledge_base_management.py#L74-L89 |
224,551 | googleapis/dialogflow-python-client-v2 | samples/knowledge_base_management.py | delete_knowledge_base | def delete_knowledge_base(project_id, knowledge_base_id):
"""Deletes a specific Knowledge base.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow.KnowledgeBasesClient()
... | python | def delete_knowledge_base(project_id, knowledge_base_id):
"""Deletes a specific Knowledge base.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow.KnowledgeBasesClient()
... | [
"def",
"delete_knowledge_base",
"(",
"project_id",
",",
"knowledge_base_id",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"client",
"=",
"dialogflow",
".",
"KnowledgeBasesClient",
"(",
")",
"knowledge_base_path",
"=",
"client",
".",
"knowledge_base_path... | Deletes a specific Knowledge base.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base. | [
"Deletes",
"a",
"specific",
"Knowledge",
"base",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/knowledge_base_management.py#L94-L107 |
224,552 | googleapis/dialogflow-python-client-v2 | samples/detect_intent_with_texttospeech_response.py | detect_intent_with_texttospeech_response | def detect_intent_with_texttospeech_response(project_id, session_id, texts,
language_code):
"""Returns the result of detect intent with texts as inputs and includes
the response in an audio format.
Using the same `session_id` between requests allows continuation... | python | def detect_intent_with_texttospeech_response(project_id, session_id, texts,
language_code):
"""Returns the result of detect intent with texts as inputs and includes
the response in an audio format.
Using the same `session_id` between requests allows continuation... | [
"def",
"detect_intent_with_texttospeech_response",
"(",
"project_id",
",",
"session_id",
",",
"texts",
",",
"language_code",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"session_client",
"=",
"dialogflow",
".",
"SessionsClient",
"(",
")",
"session_path... | Returns the result of detect intent with texts as inputs and includes
the response in an audio format.
Using the same `session_id` between requests allows continuation
of the conversaion. | [
"Returns",
"the",
"result",
"of",
"detect",
"intent",
"with",
"texts",
"as",
"inputs",
"and",
"includes",
"the",
"response",
"in",
"an",
"audio",
"format",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/detect_intent_with_texttospeech_response.py#L30-L68 |
224,553 | googleapis/dialogflow-python-client-v2 | samples/detect_intent_with_model_selection.py | detect_intent_with_model_selection | def detect_intent_with_model_selection(project_id, session_id, audio_file_path,
language_code):
"""Returns the result of detect intent with model selection on an audio file
as input
Using the same `session_id` between requests allows continuation
of the conversaio... | python | def detect_intent_with_model_selection(project_id, session_id, audio_file_path,
language_code):
"""Returns the result of detect intent with model selection on an audio file
as input
Using the same `session_id` between requests allows continuation
of the conversaio... | [
"def",
"detect_intent_with_model_selection",
"(",
"project_id",
",",
"session_id",
",",
"audio_file_path",
",",
"language_code",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"session_client",
"=",
"dialogflow",
".",
"SessionsClient",
"(",
")",
"# Note: ... | Returns the result of detect intent with model selection on an audio file
as input
Using the same `session_id` between requests allows continuation
of the conversaion. | [
"Returns",
"the",
"result",
"of",
"detect",
"intent",
"with",
"model",
"selection",
"on",
"an",
"audio",
"file",
"as",
"input"
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/detect_intent_with_model_selection.py#L30-L70 |
224,554 | googleapis/dialogflow-python-client-v2 | dialogflow_v2beta1/gapic/knowledge_bases_client.py | KnowledgeBasesClient.knowledge_base_path | def knowledge_base_path(cls, project, knowledge_base):
"""Return a fully-qualified knowledge_base string."""
return google.api_core.path_template.expand(
'projects/{project}/knowledgeBases/{knowledge_base}',
project=project,
knowledge_base=knowledge_base,
) | python | def knowledge_base_path(cls, project, knowledge_base):
"""Return a fully-qualified knowledge_base string."""
return google.api_core.path_template.expand(
'projects/{project}/knowledgeBases/{knowledge_base}',
project=project,
knowledge_base=knowledge_base,
) | [
"def",
"knowledge_base_path",
"(",
"cls",
",",
"project",
",",
"knowledge_base",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"'projects/{project}/knowledgeBases/{knowledge_base}'",
",",
"project",
"=",
"project",
",",
"kn... | Return a fully-qualified knowledge_base string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"knowledge_base",
"string",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2beta1/gapic/knowledge_bases_client.py#L97-L103 |
224,555 | googleapis/dialogflow-python-client-v2 | dialogflow_v2beta1/gapic/knowledge_bases_client.py | KnowledgeBasesClient.get_knowledge_base | def get_knowledge_base(self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Retrieves the specified knowledge base.
... | python | def get_knowledge_base(self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Retrieves the specified knowledge base.
... | [
"def",
"get_knowledge_base",
"(",
"self",
",",
"name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"met... | Retrieves the specified knowledge base.
Example:
>>> import dialogflow_v2beta1
>>>
>>> client = dialogflow_v2beta1.KnowledgeBasesClient()
>>>
>>> name = client.knowledge_base_path('[PROJECT]', '[KNOWLEDGE_BASE]')
>>>
>>> respon... | [
"Retrieves",
"the",
"specified",
"knowledge",
"base",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2beta1/gapic/knowledge_bases_client.py#L283-L336 |
224,556 | googleapis/dialogflow-python-client-v2 | dialogflow_v2beta1/gapic/knowledge_bases_client.py | KnowledgeBasesClient.create_knowledge_base | def create_knowledge_base(self,
parent,
knowledge_base,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
... | python | def create_knowledge_base(self,
parent,
knowledge_base,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
... | [
"def",
"create_knowledge_base",
"(",
"self",
",",
"parent",
",",
"knowledge_base",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
... | Creates a knowledge base.
Example:
>>> import dialogflow_v2beta1
>>>
>>> client = dialogflow_v2beta1.KnowledgeBasesClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # TODO: Initialize ``knowledge_base``:
... | [
"Creates",
"a",
"knowledge",
"base",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2beta1/gapic/knowledge_bases_client.py#L338-L401 |
224,557 | googleapis/dialogflow-python-client-v2 | dialogflow_v2beta1/gapic/session_entity_types_client.py | SessionEntityTypesClient.environment_session_path | def environment_session_path(cls, project, environment, user, session):
"""Return a fully-qualified environment_session string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}',
project=project,
... | python | def environment_session_path(cls, project, environment, user, session):
"""Return a fully-qualified environment_session string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}',
project=project,
... | [
"def",
"environment_session_path",
"(",
"cls",
",",
"project",
",",
"environment",
",",
"user",
",",
"session",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"'projects/{project}/agent/environments/{environment}/users/{user}/se... | Return a fully-qualified environment_session string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"environment_session",
"string",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2beta1/gapic/session_entity_types_client.py#L109-L117 |
224,558 | googleapis/dialogflow-python-client-v2 | dialogflow_v2beta1/gapic/session_entity_types_client.py | SessionEntityTypesClient.environment_session_entity_type_path | def environment_session_entity_type_path(cls, project, environment, user,
session, entity_type):
"""Return a fully-qualified environment_session_entity_type string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/environm... | python | def environment_session_entity_type_path(cls, project, environment, user,
session, entity_type):
"""Return a fully-qualified environment_session_entity_type string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/environm... | [
"def",
"environment_session_entity_type_path",
"(",
"cls",
",",
"project",
",",
"environment",
",",
"user",
",",
"session",
",",
"entity_type",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"'projects/{project}/agent/enviro... | Return a fully-qualified environment_session_entity_type string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"environment_session_entity_type",
"string",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2beta1/gapic/session_entity_types_client.py#L130-L140 |
224,559 | googleapis/dialogflow-python-client-v2 | dialogflow_v2beta1/gapic/documents_client.py | DocumentsClient.document_path | def document_path(cls, project, knowledge_base, document):
"""Return a fully-qualified document string."""
return google.api_core.path_template.expand(
'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}',
project=project,
knowledge_base=knowledge... | python | def document_path(cls, project, knowledge_base, document):
"""Return a fully-qualified document string."""
return google.api_core.path_template.expand(
'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}',
project=project,
knowledge_base=knowledge... | [
"def",
"document_path",
"(",
"cls",
",",
"project",
",",
"knowledge_base",
",",
"document",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}'",
",",
"projec... | Return a fully-qualified document string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"document",
"string",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2beta1/gapic/documents_client.py#L90-L97 |
224,560 | googleapis/dialogflow-python-client-v2 | dialogflow_v2beta1/gapic/documents_client.py | DocumentsClient.list_documents | def list_documents(self,
parent,
page_size=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Returns the list of all ... | python | def list_documents(self,
parent,
page_size=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Returns the list of all ... | [
"def",
"list_documents",
"(",
"self",
",",
"parent",
",",
"page_size",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"metho... | Returns the list of all documents of the knowledge base.
Example:
>>> import dialogflow_v2beta1
>>>
>>> client = dialogflow_v2beta1.DocumentsClient()
>>>
>>> parent = client.knowledge_base_path('[PROJECT]', '[KNOWLEDGE_BASE]')
>>>
... | [
"Returns",
"the",
"list",
"of",
"all",
"documents",
"of",
"the",
"knowledge",
"base",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2beta1/gapic/documents_client.py#L187-L274 |
224,561 | googleapis/dialogflow-python-client-v2 | dialogflow_v2beta1/gapic/documents_client.py | DocumentsClient.delete_document | def delete_document(self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Deletes the specified document.
Operation <response... | python | def delete_document(self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Deletes the specified document.
Operation <response... | [
"def",
"delete_document",
"(",
"self",
",",
"name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"metada... | Deletes the specified document.
Operation <response: ``google.protobuf.Empty``,
metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Example:
>>> import dialogflow_v2beta1
>>>
>>> client = dialogflow_v2beta1.Doc... | [
"Deletes",
"the",
"specified",
"document",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2beta1/gapic/documents_client.py#L413-L484 |
224,562 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/contexts_client.py | ContextsClient.context_path | def context_path(cls, project, session, context):
"""Return a fully-qualified context string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/sessions/{session}/contexts/{context}',
project=project,
session=session,
context=contex... | python | def context_path(cls, project, session, context):
"""Return a fully-qualified context string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/sessions/{session}/contexts/{context}',
project=project,
session=session,
context=contex... | [
"def",
"context_path",
"(",
"cls",
",",
"project",
",",
"session",
",",
"context",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"'projects/{project}/agent/sessions/{session}/contexts/{context}'",
",",
"project",
"=",
"proj... | Return a fully-qualified context string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"context",
"string",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/contexts_client.py#L104-L111 |
224,563 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/contexts_client.py | ContextsClient.get_context | def get_context(self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Retrieves the specified context.
Example:
>>> import dialog... | python | def get_context(self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Retrieves the specified context.
Example:
>>> import dialog... | [
"def",
"get_context",
"(",
"self",
",",
"name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"metadata",... | Retrieves the specified context.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.ContextsClient()
>>>
>>> name = client.context_path('[PROJECT]', '[SESSION]', '[CONTEXT]')
>>>
>>> response = client.get_context(... | [
"Retrieves",
"the",
"specified",
"context",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/contexts_client.py#L290-L341 |
224,564 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/contexts_client.py | ContextsClient.update_context | def update_context(self,
context,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Updates the specified... | python | def update_context(self,
context,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Updates the specified... | [
"def",
"update_context",
"(",
"self",
",",
"context",
",",
"update_mask",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"me... | Updates the specified context.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.ContextsClient()
>>>
>>> # TODO: Initialize ``context``:
>>> context = {}
>>>
>>> response = client.update_context(cont... | [
"Updates",
"the",
"specified",
"context",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/contexts_client.py#L407-L468 |
224,565 | googleapis/dialogflow-python-client-v2 | samples/session_entity_type_management.py | create_session_entity_type | def create_session_entity_type(project_id, session_id, entity_values,
entity_type_display_name, entity_override_mode):
"""Create a session entity type with the given display name."""
import dialogflow_v2 as dialogflow
session_entity_types_client = dialogflow.SessionEntityTypes... | python | def create_session_entity_type(project_id, session_id, entity_values,
entity_type_display_name, entity_override_mode):
"""Create a session entity type with the given display name."""
import dialogflow_v2 as dialogflow
session_entity_types_client = dialogflow.SessionEntityTypes... | [
"def",
"create_session_entity_type",
"(",
"project_id",
",",
"session_id",
",",
"entity_values",
",",
"entity_type_display_name",
",",
"entity_override_mode",
")",
":",
"import",
"dialogflow_v2",
"as",
"dialogflow",
"session_entity_types_client",
"=",
"dialogflow",
".",
"... | Create a session entity type with the given display name. | [
"Create",
"a",
"session",
"entity",
"type",
"with",
"the",
"given",
"display",
"name",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/session_entity_type_management.py#L54-L78 |
224,566 | googleapis/dialogflow-python-client-v2 | samples/session_entity_type_management.py | delete_session_entity_type | def delete_session_entity_type(project_id, session_id,
entity_type_display_name):
"""Delete session entity type with the given entity type display name."""
import dialogflow_v2 as dialogflow
session_entity_types_client = dialogflow.SessionEntityTypesClient()
session_entit... | python | def delete_session_entity_type(project_id, session_id,
entity_type_display_name):
"""Delete session entity type with the given entity type display name."""
import dialogflow_v2 as dialogflow
session_entity_types_client = dialogflow.SessionEntityTypesClient()
session_entit... | [
"def",
"delete_session_entity_type",
"(",
"project_id",
",",
"session_id",
",",
"entity_type_display_name",
")",
":",
"import",
"dialogflow_v2",
"as",
"dialogflow",
"session_entity_types_client",
"=",
"dialogflow",
".",
"SessionEntityTypesClient",
"(",
")",
"session_entity_... | Delete session entity type with the given entity type display name. | [
"Delete",
"session",
"entity",
"type",
"with",
"the",
"given",
"entity",
"type",
"display",
"name",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/session_entity_type_management.py#L83-L94 |
224,567 | googleapis/dialogflow-python-client-v2 | samples/entity_type_management.py | create_entity_type | def create_entity_type(project_id, display_name, kind):
"""Create an entity type with the given display name."""
import dialogflow_v2 as dialogflow
entity_types_client = dialogflow.EntityTypesClient()
parent = entity_types_client.project_agent_path(project_id)
entity_type = dialogflow.types.EntityT... | python | def create_entity_type(project_id, display_name, kind):
"""Create an entity type with the given display name."""
import dialogflow_v2 as dialogflow
entity_types_client = dialogflow.EntityTypesClient()
parent = entity_types_client.project_agent_path(project_id)
entity_type = dialogflow.types.EntityT... | [
"def",
"create_entity_type",
"(",
"project_id",
",",
"display_name",
",",
"kind",
")",
":",
"import",
"dialogflow_v2",
"as",
"dialogflow",
"entity_types_client",
"=",
"dialogflow",
".",
"EntityTypesClient",
"(",
")",
"parent",
"=",
"entity_types_client",
".",
"proje... | Create an entity type with the given display name. | [
"Create",
"an",
"entity",
"type",
"with",
"the",
"given",
"display",
"name",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/entity_type_management.py#L45-L56 |
224,568 | googleapis/dialogflow-python-client-v2 | samples/entity_type_management.py | delete_entity_type | def delete_entity_type(project_id, entity_type_id):
"""Delete entity type with the given entity type name."""
import dialogflow_v2 as dialogflow
entity_types_client = dialogflow.EntityTypesClient()
entity_type_path = entity_types_client.entity_type_path(
project_id, entity_type_id)
entity_... | python | def delete_entity_type(project_id, entity_type_id):
"""Delete entity type with the given entity type name."""
import dialogflow_v2 as dialogflow
entity_types_client = dialogflow.EntityTypesClient()
entity_type_path = entity_types_client.entity_type_path(
project_id, entity_type_id)
entity_... | [
"def",
"delete_entity_type",
"(",
"project_id",
",",
"entity_type_id",
")",
":",
"import",
"dialogflow_v2",
"as",
"dialogflow",
"entity_types_client",
"=",
"dialogflow",
".",
"EntityTypesClient",
"(",
")",
"entity_type_path",
"=",
"entity_types_client",
".",
"entity_typ... | Delete entity type with the given entity type name. | [
"Delete",
"entity",
"type",
"with",
"the",
"given",
"entity",
"type",
"name",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/entity_type_management.py#L61-L69 |
224,569 | googleapis/dialogflow-python-client-v2 | samples/detect_intent_texts.py | detect_intent_texts | def detect_intent_texts(project_id, session_id, texts, language_code):
"""Returns the result of detect intent with texts as inputs.
Using the same `session_id` between requests allows continuation
of the conversation."""
import dialogflow_v2 as dialogflow
session_client = dialogflow.SessionsClient... | python | def detect_intent_texts(project_id, session_id, texts, language_code):
"""Returns the result of detect intent with texts as inputs.
Using the same `session_id` between requests allows continuation
of the conversation."""
import dialogflow_v2 as dialogflow
session_client = dialogflow.SessionsClient... | [
"def",
"detect_intent_texts",
"(",
"project_id",
",",
"session_id",
",",
"texts",
",",
"language_code",
")",
":",
"import",
"dialogflow_v2",
"as",
"dialogflow",
"session_client",
"=",
"dialogflow",
".",
"SessionsClient",
"(",
")",
"session",
"=",
"session_client",
... | Returns the result of detect intent with texts as inputs.
Using the same `session_id` between requests allows continuation
of the conversation. | [
"Returns",
"the",
"result",
"of",
"detect",
"intent",
"with",
"texts",
"as",
"inputs",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/detect_intent_texts.py#L34-L61 |
224,570 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/entity_types_client.py | EntityTypesClient.entity_type_path | def entity_type_path(cls, project, entity_type):
"""Return a fully-qualified entity_type string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/entityTypes/{entity_type}',
project=project,
entity_type=entity_type,
) | python | def entity_type_path(cls, project, entity_type):
"""Return a fully-qualified entity_type string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/entityTypes/{entity_type}',
project=project,
entity_type=entity_type,
) | [
"def",
"entity_type_path",
"(",
"cls",
",",
"project",
",",
"entity_type",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"'projects/{project}/agent/entityTypes/{entity_type}'",
",",
"project",
"=",
"project",
",",
"entity_t... | Return a fully-qualified entity_type string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"entity_type",
"string",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/entity_types_client.py#L118-L124 |
224,571 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/entity_types_client.py | EntityTypesClient.get_entity_type | def get_entity_type(self,
name,
language_code=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Retrieves the sp... | python | def get_entity_type(self,
name,
language_code=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Retrieves the sp... | [
"def",
"get_entity_type",
"(",
"self",
",",
"name",
",",
"language_code",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"me... | Retrieves the specified entity type.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> name = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]')
>>>
>>> response = client.get_entity... | [
"Retrieves",
"the",
"specified",
"entity",
"type",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/entity_types_client.py#L311-L372 |
224,572 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/entity_types_client.py | EntityTypesClient.create_entity_type | def create_entity_type(self,
parent,
entity_type,
language_code=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
... | python | def create_entity_type(self,
parent,
entity_type,
language_code=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
... | [
"def",
"create_entity_type",
"(",
"self",
",",
"parent",
",",
"entity_type",
",",
"language_code",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".... | Creates an entity type in the specified agent.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> # TODO: Initialize ``entity_typ... | [
"Creates",
"an",
"entity",
"type",
"in",
"the",
"specified",
"agent",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/entity_types_client.py#L374-L444 |
224,573 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/entity_types_client.py | EntityTypesClient.update_entity_type | def update_entity_type(self,
entity_type,
language_code=None,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
... | python | def update_entity_type(self,
entity_type,
language_code=None,
update_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
... | [
"def",
"update_entity_type",
"(",
"self",
",",
"entity_type",
",",
"language_code",
"=",
"None",
",",
"update_mask",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
"... | Updates the specified entity type.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> # TODO: Initialize ``entity_type``:
>>> entity_type = {}
>>>
>>> response = client.upda... | [
"Updates",
"the",
"specified",
"entity",
"type",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/entity_types_client.py#L446-L516 |
224,574 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/entity_types_client.py | EntityTypesClient.batch_delete_entities | def batch_delete_entities(self,
parent,
entity_values,
language_code=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,... | python | def batch_delete_entities(self,
parent,
entity_values,
language_code=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,... | [
"def",
"batch_delete_entities",
"(",
"self",
",",
"parent",
",",
"entity_values",
",",
"language_code",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",... | Deletes entities in the specified entity type.
Operation <response: ``google.protobuf.Empty``,
metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
... | [
"Deletes",
"entities",
"in",
"the",
"specified",
"entity",
"type",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/entity_types_client.py#L945-L1033 |
224,575 | googleapis/dialogflow-python-client-v2 | samples/detect_intent_knowledge.py | detect_intent_knowledge | def detect_intent_knowledge(project_id, session_id, language_code,
knowledge_base_id, texts):
"""Returns the result of detect intent with querying Knowledge Connector.
Args:
project_id: The GCP project linked with the agent you are going to query.
session_id: Id of the sessi... | python | def detect_intent_knowledge(project_id, session_id, language_code,
knowledge_base_id, texts):
"""Returns the result of detect intent with querying Knowledge Connector.
Args:
project_id: The GCP project linked with the agent you are going to query.
session_id: Id of the sessi... | [
"def",
"detect_intent_knowledge",
"(",
"project_id",
",",
"session_id",
",",
"language_code",
",",
"knowledge_base_id",
",",
"texts",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"session_client",
"=",
"dialogflow",
".",
"SessionsClient",
"(",
")",
... | Returns the result of detect intent with querying Knowledge Connector.
Args:
project_id: The GCP project linked with the agent you are going to query.
session_id: Id of the session, using the same `session_id` between requests
allows continuation of the conversation.
language_code: Langua... | [
"Returns",
"the",
"result",
"of",
"detect",
"intent",
"with",
"querying",
"Knowledge",
"Connector",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/detect_intent_knowledge.py#L31-L78 |
224,576 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/intents_client.py | IntentsClient.intent_path | def intent_path(cls, project, intent):
"""Return a fully-qualified intent string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/intents/{intent}',
project=project,
intent=intent,
) | python | def intent_path(cls, project, intent):
"""Return a fully-qualified intent string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/intents/{intent}',
project=project,
intent=intent,
) | [
"def",
"intent_path",
"(",
"cls",
",",
"project",
",",
"intent",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"'projects/{project}/agent/intents/{intent}'",
",",
"project",
"=",
"project",
",",
"intent",
"=",
"intent",... | Return a fully-qualified intent string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"intent",
"string",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/intents_client.py#L125-L131 |
224,577 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/intents_client.py | IntentsClient.agent_path | def agent_path(cls, project, agent):
"""Return a fully-qualified agent string."""
return google.api_core.path_template.expand(
'projects/{project}/agents/{agent}',
project=project,
agent=agent,
) | python | def agent_path(cls, project, agent):
"""Return a fully-qualified agent string."""
return google.api_core.path_template.expand(
'projects/{project}/agents/{agent}',
project=project,
agent=agent,
) | [
"def",
"agent_path",
"(",
"cls",
",",
"project",
",",
"agent",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"'projects/{project}/agents/{agent}'",
",",
"project",
"=",
"project",
",",
"agent",
"=",
"agent",
",",
")... | Return a fully-qualified agent string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"agent",
"string",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/intents_client.py#L134-L140 |
224,578 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/intents_client.py | IntentsClient.get_intent | def get_intent(self,
name,
language_code=None,
intent_view=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Retrieves... | python | def get_intent(self,
name,
language_code=None,
intent_view=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Retrieves... | [
"def",
"get_intent",
"(",
"self",
",",
"name",
",",
"language_code",
"=",
"None",
",",
"intent_view",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core... | Retrieves the specified intent.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> name = client.intent_path('[PROJECT]', '[INTENT]')
>>>
>>> response = client.get_intent(name)
Arg... | [
"Retrieves",
"the",
"specified",
"intent",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/intents_client.py#L328-L391 |
224,579 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/intents_client.py | IntentsClient.create_intent | def create_intent(self,
parent,
intent,
language_code=None,
intent_view=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
... | python | def create_intent(self,
parent,
intent,
language_code=None,
intent_view=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
... | [
"def",
"create_intent",
"(",
"self",
",",
"parent",
",",
"intent",
",",
"language_code",
"=",
"None",
",",
"intent_view",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"goo... | Creates an intent in the specified agent.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> # TODO: Initialize ``intent``:
... | [
"Creates",
"an",
"intent",
"in",
"the",
"specified",
"agent",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/intents_client.py#L393-L465 |
224,580 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/intents_client.py | IntentsClient.update_intent | def update_intent(self,
intent,
language_code,
update_mask=None,
intent_view=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
... | python | def update_intent(self,
intent,
language_code,
update_mask=None,
intent_view=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
... | [
"def",
"update_intent",
"(",
"self",
",",
"intent",
",",
"language_code",
",",
"update_mask",
"=",
"None",
",",
"intent_view",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
... | Updates the specified intent.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> # TODO: Initialize ``intent``:
>>> intent = {}
>>>
>>> # TODO: Initialize ``language_code``:
... | [
"Updates",
"the",
"specified",
"intent",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/intents_client.py#L467-L542 |
224,581 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/intents_client.py | IntentsClient.delete_intent | def delete_intent(self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Deletes the specified intent.
Example:
>>> import... | python | def delete_intent(self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Deletes the specified intent.
Example:
>>> import... | [
"def",
"delete_intent",
"(",
"self",
",",
"name",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"metadata... | Deletes the specified intent.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> name = client.intent_path('[PROJECT]', '[INTENT]')
>>>
>>> client.delete_intent(name)
Args:
... | [
"Deletes",
"the",
"specified",
"intent",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/intents_client.py#L544-L593 |
224,582 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/intents_client.py | IntentsClient.batch_delete_intents | def batch_delete_intents(self,
parent,
intents,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
... | python | def batch_delete_intents(self,
parent,
intents,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
... | [
"def",
"batch_delete_intents",
"(",
"self",
",",
"parent",
",",
"intents",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
... | Deletes intents in the specified agent.
Operation <response: ``google.protobuf.Empty``>
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
... | [
"Deletes",
"intents",
"in",
"the",
"specified",
"agent",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/intents_client.py#L704-L785 |
224,583 | googleapis/dialogflow-python-client-v2 | dialogflow_v2beta1/gapic/contexts_client.py | ContextsClient.environment_context_path | def environment_context_path(cls, project, environment, user, session,
context):
"""Return a fully-qualified environment_context string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/environments/{environment}/users/{user}/sessions... | python | def environment_context_path(cls, project, environment, user, session,
context):
"""Return a fully-qualified environment_context string."""
return google.api_core.path_template.expand(
'projects/{project}/agent/environments/{environment}/users/{user}/sessions... | [
"def",
"environment_context_path",
"(",
"cls",
",",
"project",
",",
"environment",
",",
"user",
",",
"session",
",",
"context",
")",
":",
"return",
"google",
".",
"api_core",
".",
"path_template",
".",
"expand",
"(",
"'projects/{project}/agent/environments/{environm... | Return a fully-qualified environment_context string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"environment_context",
"string",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2beta1/gapic/contexts_client.py#L125-L135 |
224,584 | googleapis/dialogflow-python-client-v2 | samples/detect_intent_with_sentiment_analysis.py | detect_intent_with_sentiment_analysis | def detect_intent_with_sentiment_analysis(project_id, session_id, texts,
language_code):
"""Returns the result of detect intent with texts as inputs and analyzes the
sentiment of the query text.
Using the same `session_id` between requests allows continuation
o... | python | def detect_intent_with_sentiment_analysis(project_id, session_id, texts,
language_code):
"""Returns the result of detect intent with texts as inputs and analyzes the
sentiment of the query text.
Using the same `session_id` between requests allows continuation
o... | [
"def",
"detect_intent_with_sentiment_analysis",
"(",
"project_id",
",",
"session_id",
",",
"texts",
",",
"language_code",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"session_client",
"=",
"dialogflow",
".",
"SessionsClient",
"(",
")",
"session_path",
... | Returns the result of detect intent with texts as inputs and analyzes the
sentiment of the query text.
Using the same `session_id` between requests allows continuation
of the conversaion. | [
"Returns",
"the",
"result",
"of",
"detect",
"intent",
"with",
"texts",
"as",
"inputs",
"and",
"analyzes",
"the",
"sentiment",
"of",
"the",
"query",
"text",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/detect_intent_with_sentiment_analysis.py#L31-L75 |
224,585 | googleapis/dialogflow-python-client-v2 | dialogflow_v2beta1/gapic/sessions_client.py | SessionsClient.detect_intent | def detect_intent(self,
session,
query_input,
query_params=None,
output_audio_config=None,
input_audio=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=go... | python | def detect_intent(self,
session,
query_input,
query_params=None,
output_audio_config=None,
input_audio=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=go... | [
"def",
"detect_intent",
"(",
"self",
",",
"session",
",",
"query_input",
",",
"query_params",
"=",
"None",
",",
"output_audio_config",
"=",
"None",
",",
"input_audio",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",... | Processes a natural language query and returns structured, actionable data
as a result. This method is not idempotent, because it may cause contexts
and session entity types to be updated, which in turn might affect
results of future queries.
Example:
>>> import dialogflow_v... | [
"Processes",
"a",
"natural",
"language",
"query",
"and",
"returns",
"structured",
"actionable",
"data",
"as",
"a",
"result",
".",
"This",
"method",
"is",
"not",
"idempotent",
"because",
"it",
"may",
"cause",
"contexts",
"and",
"session",
"entity",
"types",
"to... | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2beta1/gapic/sessions_client.py#L201-L299 |
224,586 | googleapis/dialogflow-python-client-v2 | samples/detect_intent_stream.py | detect_intent_stream | def detect_intent_stream(project_id, session_id, audio_file_path,
language_code):
"""Returns the result of detect intent with streaming audio as input.
Using the same `session_id` between requests allows continuation
of the conversaion."""
import dialogflow_v2 as dialogflow
... | python | def detect_intent_stream(project_id, session_id, audio_file_path,
language_code):
"""Returns the result of detect intent with streaming audio as input.
Using the same `session_id` between requests allows continuation
of the conversaion."""
import dialogflow_v2 as dialogflow
... | [
"def",
"detect_intent_stream",
"(",
"project_id",
",",
"session_id",
",",
"audio_file_path",
",",
"language_code",
")",
":",
"import",
"dialogflow_v2",
"as",
"dialogflow",
"session_client",
"=",
"dialogflow",
".",
"SessionsClient",
"(",
")",
"# Note: hard coding audio_e... | Returns the result of detect intent with streaming audio as input.
Using the same `session_id` between requests allows continuation
of the conversaion. | [
"Returns",
"the",
"result",
"of",
"detect",
"intent",
"with",
"streaming",
"audio",
"as",
"input",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/detect_intent_stream.py#L33-L90 |
224,587 | googleapis/dialogflow-python-client-v2 | samples/intent_management.py | create_intent | def create_intent(project_id, display_name, training_phrases_parts,
message_texts):
"""Create an intent of the given intent type."""
import dialogflow_v2 as dialogflow
intents_client = dialogflow.IntentsClient()
parent = intents_client.project_agent_path(project_id)
training_phras... | python | def create_intent(project_id, display_name, training_phrases_parts,
message_texts):
"""Create an intent of the given intent type."""
import dialogflow_v2 as dialogflow
intents_client = dialogflow.IntentsClient()
parent = intents_client.project_agent_path(project_id)
training_phras... | [
"def",
"create_intent",
"(",
"project_id",
",",
"display_name",
",",
"training_phrases_parts",
",",
"message_texts",
")",
":",
"import",
"dialogflow_v2",
"as",
"dialogflow",
"intents_client",
"=",
"dialogflow",
".",
"IntentsClient",
"(",
")",
"parent",
"=",
"intents... | Create an intent of the given intent type. | [
"Create",
"an",
"intent",
"of",
"the",
"given",
"intent",
"type",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/intent_management.py#L63-L88 |
224,588 | googleapis/dialogflow-python-client-v2 | samples/intent_management.py | delete_intent | def delete_intent(project_id, intent_id):
"""Delete intent with the given intent type and intent value."""
import dialogflow_v2 as dialogflow
intents_client = dialogflow.IntentsClient()
intent_path = intents_client.intent_path(project_id, intent_id)
intents_client.delete_intent(intent_path) | python | def delete_intent(project_id, intent_id):
"""Delete intent with the given intent type and intent value."""
import dialogflow_v2 as dialogflow
intents_client = dialogflow.IntentsClient()
intent_path = intents_client.intent_path(project_id, intent_id)
intents_client.delete_intent(intent_path) | [
"def",
"delete_intent",
"(",
"project_id",
",",
"intent_id",
")",
":",
"import",
"dialogflow_v2",
"as",
"dialogflow",
"intents_client",
"=",
"dialogflow",
".",
"IntentsClient",
"(",
")",
"intent_path",
"=",
"intents_client",
".",
"intent_path",
"(",
"project_id",
... | Delete intent with the given intent type and intent value. | [
"Delete",
"intent",
"with",
"the",
"given",
"intent",
"type",
"and",
"intent",
"value",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/intent_management.py#L93-L100 |
224,589 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/agents_client.py | AgentsClient.get_agent | def get_agent(self,
parent,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Retrieves the specified agent.
Example:
>>> import dialogflow_v2
... | python | def get_agent(self,
parent,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Retrieves the specified agent.
Example:
>>> import dialogflow_v2
... | [
"def",
"get_agent",
"(",
"self",
",",
"parent",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"metadata",... | Retrieves the specified agent.
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.AgentsClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> response = client.get_agent(parent)
Args:
... | [
"Retrieves",
"the",
"specified",
"agent",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/agents_client.py#L197-L248 |
224,590 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/agents_client.py | AgentsClient.train_agent | def train_agent(self,
parent,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Trains the specified agent.
Operation <response: ``google.protobuf.Em... | python | def train_agent(self,
parent,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Trains the specified agent.
Operation <response: ``google.protobuf.Em... | [
"def",
"train_agent",
"(",
"self",
",",
"parent",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"metadata... | Trains the specified agent.
Operation <response: ``google.protobuf.Empty``,
metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.AgentsClient()
>>>
>>> parent = c... | [
"Trains",
"the",
"specified",
"agent",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/agents_client.py#L345-L414 |
224,591 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/agents_client.py | AgentsClient.export_agent | def export_agent(self,
parent,
agent_uri=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Exports the specified agent to a ZIP... | python | def export_agent(self,
parent,
agent_uri=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Exports the specified agent to a ZIP... | [
"def",
"export_agent",
"(",
"self",
",",
"parent",
",",
"agent_uri",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method"... | Exports the specified agent to a ZIP file.
Operation <response: ``ExportAgentResponse``,
metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example:
>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.AgentsClient()
>>>
>... | [
"Exports",
"the",
"specified",
"agent",
"to",
"a",
"ZIP",
"file",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/agents_client.py#L416-L493 |
224,592 | googleapis/dialogflow-python-client-v2 | dialogflow_v2/gapic/agents_client.py | AgentsClient.import_agent | def import_agent(self,
parent,
agent_uri=None,
agent_content=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
... | python | def import_agent(self,
parent,
agent_uri=None,
agent_content=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
... | [
"def",
"import_agent",
"(",
"self",
",",
"parent",
",",
"agent_uri",
"=",
"None",
",",
"agent_content",
"=",
"None",
",",
"retry",
"=",
"google",
".",
"api_core",
".",
"gapic_v1",
".",
"method",
".",
"DEFAULT",
",",
"timeout",
"=",
"google",
".",
"api_co... | Imports the specified agent from a ZIP file.
Uploads new intents and entity types without deleting the existing ones.
Intents and entity types with the same name are replaced with the new
versions from ImportAgentRequest.
Operation <response: ``google.protobuf.Empty``,
metadata... | [
"Imports",
"the",
"specified",
"agent",
"from",
"a",
"ZIP",
"file",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/agents_client.py#L495-L600 |
224,593 | googleapis/dialogflow-python-client-v2 | samples/document_management.py | list_documents | def list_documents(project_id, knowledge_base_id):
"""Lists the Documents belonging to a Knowledge base.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow.DocumentsClient()... | python | def list_documents(project_id, knowledge_base_id):
"""Lists the Documents belonging to a Knowledge base.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow.DocumentsClient()... | [
"def",
"list_documents",
"(",
"project_id",
",",
"knowledge_base_id",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"client",
"=",
"dialogflow",
".",
"DocumentsClient",
"(",
")",
"knowledge_base_path",
"=",
"client",
".",
"knowledge_base_path",
"(",
... | Lists the Documents belonging to a Knowledge base.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base. | [
"Lists",
"the",
"Documents",
"belonging",
"to",
"a",
"Knowledge",
"base",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/document_management.py#L43-L62 |
224,594 | googleapis/dialogflow-python-client-v2 | samples/document_management.py | create_document | def create_document(project_id, knowledge_base_id, display_name, mime_type,
knowledge_type, content_uri):
"""Creates a Document.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base.
display_name: The display name of th... | python | def create_document(project_id, knowledge_base_id, display_name, mime_type,
knowledge_type, content_uri):
"""Creates a Document.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base.
display_name: The display name of th... | [
"def",
"create_document",
"(",
"project_id",
",",
"knowledge_base_id",
",",
"display_name",
",",
"mime_type",
",",
"knowledge_type",
",",
"content_uri",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"client",
"=",
"dialogflow",
".",
"DocumentsClient",
... | Creates a Document.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base.
display_name: The display name of the Document.
mime_type: The mime_type of the Document. e.g. text/csv, text/html,
text/plain, text/pdf etc.
... | [
"Creates",
"a",
"Document",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/document_management.py#L67-L103 |
224,595 | googleapis/dialogflow-python-client-v2 | samples/document_management.py | get_document | def get_document(project_id, knowledge_base_id, document_id):
"""Gets a Document.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base.
document_id: Id of the Document."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow... | python | def get_document(project_id, knowledge_base_id, document_id):
"""Gets a Document.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base.
document_id: Id of the Document."""
import dialogflow_v2beta1 as dialogflow
client = dialogflow... | [
"def",
"get_document",
"(",
"project_id",
",",
"knowledge_base_id",
",",
"document_id",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"client",
"=",
"dialogflow",
".",
"DocumentsClient",
"(",
")",
"document_path",
"=",
"client",
".",
"document_path",... | Gets a Document.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base.
document_id: Id of the Document. | [
"Gets",
"a",
"Document",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/document_management.py#L108-L128 |
224,596 | googleapis/dialogflow-python-client-v2 | samples/document_management.py | delete_document | def delete_document(project_id, knowledge_base_id, document_id):
"""Deletes a Document.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base.
document_id: Id of the Document."""
import dialogflow_v2beta1 as dialogflow
client = dial... | python | def delete_document(project_id, knowledge_base_id, document_id):
"""Deletes a Document.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base.
document_id: Id of the Document."""
import dialogflow_v2beta1 as dialogflow
client = dial... | [
"def",
"delete_document",
"(",
"project_id",
",",
"knowledge_base_id",
",",
"document_id",
")",
":",
"import",
"dialogflow_v2beta1",
"as",
"dialogflow",
"client",
"=",
"dialogflow",
".",
"DocumentsClient",
"(",
")",
"document_path",
"=",
"client",
".",
"document_pat... | Deletes a Document.
Args:
project_id: The GCP project linked with the agent.
knowledge_base_id: Id of the Knowledge base.
document_id: Id of the Document. | [
"Deletes",
"a",
"Document",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/document_management.py#L133-L148 |
224,597 | googleapis/dialogflow-python-client-v2 | samples/entity_management.py | create_entity | def create_entity(project_id, entity_type_id, entity_value, synonyms):
"""Create an entity of the given entity type."""
import dialogflow_v2 as dialogflow
entity_types_client = dialogflow.EntityTypesClient()
# Note: synonyms must be exactly [entity_value] if the
# entity_type's kind is KIND_LIST
... | python | def create_entity(project_id, entity_type_id, entity_value, synonyms):
"""Create an entity of the given entity type."""
import dialogflow_v2 as dialogflow
entity_types_client = dialogflow.EntityTypesClient()
# Note: synonyms must be exactly [entity_value] if the
# entity_type's kind is KIND_LIST
... | [
"def",
"create_entity",
"(",
"project_id",
",",
"entity_type_id",
",",
"entity_value",
",",
"synonyms",
")",
":",
"import",
"dialogflow_v2",
"as",
"dialogflow",
"entity_types_client",
"=",
"dialogflow",
".",
"EntityTypesClient",
"(",
")",
"# Note: synonyms must be exact... | Create an entity of the given entity type. | [
"Create",
"an",
"entity",
"of",
"the",
"given",
"entity",
"type",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/entity_management.py#L49-L68 |
224,598 | googleapis/dialogflow-python-client-v2 | samples/entity_management.py | delete_entity | def delete_entity(project_id, entity_type_id, entity_value):
"""Delete entity with the given entity type and entity value."""
import dialogflow_v2 as dialogflow
entity_types_client = dialogflow.EntityTypesClient()
entity_type_path = entity_types_client.entity_type_path(
project_id, entity_type_... | python | def delete_entity(project_id, entity_type_id, entity_value):
"""Delete entity with the given entity type and entity value."""
import dialogflow_v2 as dialogflow
entity_types_client = dialogflow.EntityTypesClient()
entity_type_path = entity_types_client.entity_type_path(
project_id, entity_type_... | [
"def",
"delete_entity",
"(",
"project_id",
",",
"entity_type_id",
",",
"entity_value",
")",
":",
"import",
"dialogflow_v2",
"as",
"dialogflow",
"entity_types_client",
"=",
"dialogflow",
".",
"EntityTypesClient",
"(",
")",
"entity_type_path",
"=",
"entity_types_client",
... | Delete entity with the given entity type and entity value. | [
"Delete",
"entity",
"with",
"the",
"given",
"entity",
"type",
"and",
"entity",
"value",
"."
] | 8c9c8709222efe427b76c9c8fcc04a0c4a0760b5 | https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/entity_management.py#L73-L82 |
224,599 | lucasb-eyer/pydensecrf | pydensecrf/utils.py | softmax_to_unary | def softmax_to_unary(sm, GT_PROB=1):
"""Deprecated, use `unary_from_softmax` instead."""
warning("pydensecrf.softmax_to_unary is deprecated, use unary_from_softmax instead.")
scale = None if GT_PROB == 1 else GT_PROB
return unary_from_softmax(sm, scale, clip=None) | python | def softmax_to_unary(sm, GT_PROB=1):
"""Deprecated, use `unary_from_softmax` instead."""
warning("pydensecrf.softmax_to_unary is deprecated, use unary_from_softmax instead.")
scale = None if GT_PROB == 1 else GT_PROB
return unary_from_softmax(sm, scale, clip=None) | [
"def",
"softmax_to_unary",
"(",
"sm",
",",
"GT_PROB",
"=",
"1",
")",
":",
"warning",
"(",
"\"pydensecrf.softmax_to_unary is deprecated, use unary_from_softmax instead.\"",
")",
"scale",
"=",
"None",
"if",
"GT_PROB",
"==",
"1",
"else",
"GT_PROB",
"return",
"unary_from_... | Deprecated, use `unary_from_softmax` instead. | [
"Deprecated",
"use",
"unary_from_softmax",
"instead",
"."
] | 4d5343c398d75d7ebae34f51a47769084ba3a613 | https://github.com/lucasb-eyer/pydensecrf/blob/4d5343c398d75d7ebae34f51a47769084ba3a613/pydensecrf/utils.py#L82-L86 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.