repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
SwissDataScienceCenter/renku-python | renku/cli/remove.py | remove | def remove(ctx, client, sources):
"""Remove files and check repository for potential problems."""
from renku.api._git import _expand_directories
def fmt_path(path):
"""Format path as relative to the client path."""
return str(Path(path).absolute().relative_to(client.path))
files = {
... | python | def remove(ctx, client, sources):
"""Remove files and check repository for potential problems."""
from renku.api._git import _expand_directories
def fmt_path(path):
"""Format path as relative to the client path."""
return str(Path(path).absolute().relative_to(client.path))
files = {
... | [
"def",
"remove",
"(",
"ctx",
",",
"client",
",",
"sources",
")",
":",
"from",
"renku",
".",
"api",
".",
"_git",
"import",
"_expand_directories",
"def",
"fmt_path",
"(",
"path",
")",
":",
"\"\"\"Format path as relative to the client path.\"\"\"",
"return",
"str",
... | Remove files and check repository for potential problems. | [
"Remove",
"files",
"and",
"check",
"repository",
"for",
"potential",
"problems",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/remove.py#L39-L90 |
SwissDataScienceCenter/renku-python | brew.py | find_release | def find_release(package, releases, dependencies=None):
"""Return the best release."""
dependencies = dependencies if dependencies is not None else {}
for release in releases:
url = release['url']
old_priority = dependencies.get(package, {}).get('priority', 0)
for suffix, priority i... | python | def find_release(package, releases, dependencies=None):
"""Return the best release."""
dependencies = dependencies if dependencies is not None else {}
for release in releases:
url = release['url']
old_priority = dependencies.get(package, {}).get('priority', 0)
for suffix, priority i... | [
"def",
"find_release",
"(",
"package",
",",
"releases",
",",
"dependencies",
"=",
"None",
")",
":",
"dependencies",
"=",
"dependencies",
"if",
"dependencies",
"is",
"not",
"None",
"else",
"{",
"}",
"for",
"release",
"in",
"releases",
":",
"url",
"=",
"rele... | Return the best release. | [
"Return",
"the",
"best",
"release",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/brew.py#L83-L101 |
SwissDataScienceCenter/renku-python | renku/cli/_graph.py | _safe_path | def _safe_path(filepath, can_be_cwl=False):
"""Check if the path should be used in output."""
# Should not be in ignore paths.
if filepath in {'.gitignore', '.gitattributes'}:
return False
# Ignore everything in .renku ...
if filepath.startswith('.renku'):
# ... unless it can be a C... | python | def _safe_path(filepath, can_be_cwl=False):
"""Check if the path should be used in output."""
# Should not be in ignore paths.
if filepath in {'.gitignore', '.gitattributes'}:
return False
# Ignore everything in .renku ...
if filepath.startswith('.renku'):
# ... unless it can be a C... | [
"def",
"_safe_path",
"(",
"filepath",
",",
"can_be_cwl",
"=",
"False",
")",
":",
"# Should not be in ignore paths.",
"if",
"filepath",
"in",
"{",
"'.gitignore'",
",",
"'.gitattributes'",
"}",
":",
"return",
"False",
"# Ignore everything in .renku ...",
"if",
"filepath... | Check if the path should be used in output. | [
"Check",
"if",
"the",
"path",
"should",
"be",
"used",
"in",
"output",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_graph.py#L62-L75 |
SwissDataScienceCenter/renku-python | renku/cli/_format/datasets.py | tabular | def tabular(client, datasets):
"""Format datasets with a tabular output."""
from renku.models._tabulate import tabulate
click.echo(
tabulate(
datasets,
headers=OrderedDict((
('short_id', 'id'),
('name', None),
('created', None)... | python | def tabular(client, datasets):
"""Format datasets with a tabular output."""
from renku.models._tabulate import tabulate
click.echo(
tabulate(
datasets,
headers=OrderedDict((
('short_id', 'id'),
('name', None),
('created', None)... | [
"def",
"tabular",
"(",
"client",
",",
"datasets",
")",
":",
"from",
"renku",
".",
"models",
".",
"_tabulate",
"import",
"tabulate",
"click",
".",
"echo",
"(",
"tabulate",
"(",
"datasets",
",",
"headers",
"=",
"OrderedDict",
"(",
"(",
"(",
"'short_id'",
"... | Format datasets with a tabular output. | [
"Format",
"datasets",
"with",
"a",
"tabular",
"output",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_format/datasets.py#L26-L40 |
SwissDataScienceCenter/renku-python | renku/cli/_format/datasets.py | jsonld | def jsonld(client, datasets):
"""Format datasets as JSON-LD."""
from renku.models._json import dumps
from renku.models._jsonld import asjsonld
data = [
asjsonld(
dataset,
basedir=os.path.relpath(
'.', start=str(dataset.__reference__.parent)
)
... | python | def jsonld(client, datasets):
"""Format datasets as JSON-LD."""
from renku.models._json import dumps
from renku.models._jsonld import asjsonld
data = [
asjsonld(
dataset,
basedir=os.path.relpath(
'.', start=str(dataset.__reference__.parent)
)
... | [
"def",
"jsonld",
"(",
"client",
",",
"datasets",
")",
":",
"from",
"renku",
".",
"models",
".",
"_json",
"import",
"dumps",
"from",
"renku",
".",
"models",
".",
"_jsonld",
"import",
"asjsonld",
"data",
"=",
"[",
"asjsonld",
"(",
"dataset",
",",
"basedir"... | Format datasets as JSON-LD. | [
"Format",
"datasets",
"as",
"JSON",
"-",
"LD",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_format/datasets.py#L43-L56 |
SwissDataScienceCenter/renku-python | renku/cli/_ascii.py | _format_sha1 | def _format_sha1(graph, node):
"""Return formatted text with the submodule information."""
try:
submodules = node.submodules
if submodules:
submodule = ':'.join(submodules)
return click.style(submodule, fg='green') + '@' + click.style(
node.commit.hexsha[... | python | def _format_sha1(graph, node):
"""Return formatted text with the submodule information."""
try:
submodules = node.submodules
if submodules:
submodule = ':'.join(submodules)
return click.style(submodule, fg='green') + '@' + click.style(
node.commit.hexsha[... | [
"def",
"_format_sha1",
"(",
"graph",
",",
"node",
")",
":",
"try",
":",
"submodules",
"=",
"node",
".",
"submodules",
"if",
"submodules",
":",
"submodule",
"=",
"':'",
".",
"join",
"(",
"submodules",
")",
"return",
"click",
".",
"style",
"(",
"submodule"... | Return formatted text with the submodule information. | [
"Return",
"formatted",
"text",
"with",
"the",
"submodule",
"information",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_ascii.py#L34-L46 |
SwissDataScienceCenter/renku-python | renku/models/cwl/command_line_tool.py | convert_arguments | def convert_arguments(value):
"""Convert arguments from various input formats."""
if isinstance(value, (list, tuple)):
return [
CommandLineBinding(**item) if isinstance(item, dict) else item
for item in value
]
return shlex.split(value) | python | def convert_arguments(value):
"""Convert arguments from various input formats."""
if isinstance(value, (list, tuple)):
return [
CommandLineBinding(**item) if isinstance(item, dict) else item
for item in value
]
return shlex.split(value) | [
"def",
"convert_arguments",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"[",
"CommandLineBinding",
"(",
"*",
"*",
"item",
")",
"if",
"isinstance",
"(",
"item",
",",
"dict",
")",
"... | Convert arguments from various input formats. | [
"Convert",
"arguments",
"from",
"various",
"input",
"formats",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/cwl/command_line_tool.py#L40-L47 |
SwissDataScienceCenter/renku-python | renku/cli/__init__.py | cli | def cli(ctx, path, renku_home, use_external_storage):
"""Check common Renku commands used in various situations."""
ctx.obj = LocalClient(
path=path,
renku_home=renku_home,
use_external_storage=use_external_storage,
) | python | def cli(ctx, path, renku_home, use_external_storage):
"""Check common Renku commands used in various situations."""
ctx.obj = LocalClient(
path=path,
renku_home=renku_home,
use_external_storage=use_external_storage,
) | [
"def",
"cli",
"(",
"ctx",
",",
"path",
",",
"renku_home",
",",
"use_external_storage",
")",
":",
"ctx",
".",
"obj",
"=",
"LocalClient",
"(",
"path",
"=",
"path",
",",
"renku_home",
"=",
"renku_home",
",",
"use_external_storage",
"=",
"use_external_storage",
... | Check common Renku commands used in various situations. | [
"Check",
"common",
"Renku",
"commands",
"used",
"in",
"various",
"situations",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/__init__.py#L188-L194 |
SwissDataScienceCenter/renku-python | renku/cli/update.py | update | def update(client, revision, no_output, siblings, paths):
"""Update existing files by rerunning their outdated workflow."""
graph = Graph(client)
outputs = graph.build(revision=revision, can_be_cwl=no_output, paths=paths)
outputs = {node for node in outputs if graph.need_update(node)}
if not output... | python | def update(client, revision, no_output, siblings, paths):
"""Update existing files by rerunning their outdated workflow."""
graph = Graph(client)
outputs = graph.build(revision=revision, can_be_cwl=no_output, paths=paths)
outputs = {node for node in outputs if graph.need_update(node)}
if not output... | [
"def",
"update",
"(",
"client",
",",
"revision",
",",
"no_output",
",",
"siblings",
",",
"paths",
")",
":",
"graph",
"=",
"Graph",
"(",
"client",
")",
"outputs",
"=",
"graph",
".",
"build",
"(",
"revision",
"=",
"revision",
",",
"can_be_cwl",
"=",
"no_... | Update existing files by rerunning their outdated workflow. | [
"Update",
"existing",
"files",
"by",
"rerunning",
"their",
"outdated",
"workflow",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/update.py#L143-L190 |
SwissDataScienceCenter/renku-python | renku/cli/_config.py | config_path | def config_path(path=None, final=False):
"""Return config path."""
if final and path:
return path
if path is None:
path = default_config_dir()
try:
os.makedirs(path)
except OSError as e: # pragma: no cover
if e.errno != errno.EEXIST:
raise
return os.... | python | def config_path(path=None, final=False):
"""Return config path."""
if final and path:
return path
if path is None:
path = default_config_dir()
try:
os.makedirs(path)
except OSError as e: # pragma: no cover
if e.errno != errno.EEXIST:
raise
return os.... | [
"def",
"config_path",
"(",
"path",
"=",
"None",
",",
"final",
"=",
"False",
")",
":",
"if",
"final",
"and",
"path",
":",
"return",
"path",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"default_config_dir",
"(",
")",
"try",
":",
"os",
".",
"makedirs"... | Return config path. | [
"Return",
"config",
"path",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_config.py#L48-L60 |
SwissDataScienceCenter/renku-python | renku/cli/_config.py | read_config | def read_config(path=None, final=False):
"""Read Renku configuration."""
try:
with open(config_path(path, final=final), 'r') as configfile:
return yaml.safe_load(configfile) or {}
except FileNotFoundError:
return {} | python | def read_config(path=None, final=False):
"""Read Renku configuration."""
try:
with open(config_path(path, final=final), 'r') as configfile:
return yaml.safe_load(configfile) or {}
except FileNotFoundError:
return {} | [
"def",
"read_config",
"(",
"path",
"=",
"None",
",",
"final",
"=",
"False",
")",
":",
"try",
":",
"with",
"open",
"(",
"config_path",
"(",
"path",
",",
"final",
"=",
"final",
")",
",",
"'r'",
")",
"as",
"configfile",
":",
"return",
"yaml",
".",
"sa... | Read Renku configuration. | [
"Read",
"Renku",
"configuration",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_config.py#L63-L69 |
SwissDataScienceCenter/renku-python | renku/cli/_config.py | write_config | def write_config(config, path, final=False):
"""Write Renku configuration."""
with open(config_path(path, final=final), 'w+') as configfile:
yaml.dump(config, configfile, default_flow_style=False) | python | def write_config(config, path, final=False):
"""Write Renku configuration."""
with open(config_path(path, final=final), 'w+') as configfile:
yaml.dump(config, configfile, default_flow_style=False) | [
"def",
"write_config",
"(",
"config",
",",
"path",
",",
"final",
"=",
"False",
")",
":",
"with",
"open",
"(",
"config_path",
"(",
"path",
",",
"final",
"=",
"final",
")",
",",
"'w+'",
")",
"as",
"configfile",
":",
"yaml",
".",
"dump",
"(",
"config",
... | Write Renku configuration. | [
"Write",
"Renku",
"configuration",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_config.py#L72-L75 |
SwissDataScienceCenter/renku-python | renku/cli/_config.py | config_load | def config_load(ctx, param, value):
"""Print application config path."""
if ctx.obj is None:
ctx.obj = {}
ctx.obj['config_path'] = value
ctx.obj['config'] = read_config(value)
return value | python | def config_load(ctx, param, value):
"""Print application config path."""
if ctx.obj is None:
ctx.obj = {}
ctx.obj['config_path'] = value
ctx.obj['config'] = read_config(value)
return value | [
"def",
"config_load",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"if",
"ctx",
".",
"obj",
"is",
"None",
":",
"ctx",
".",
"obj",
"=",
"{",
"}",
"ctx",
".",
"obj",
"[",
"'config_path'",
"]",
"=",
"value",
"ctx",
".",
"obj",
"[",
"'config'",
... | Print application config path. | [
"Print",
"application",
"config",
"path",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_config.py#L78-L85 |
SwissDataScienceCenter/renku-python | renku/cli/_config.py | with_config | def with_config(f):
"""Add config to function."""
# keep it.
@click.pass_context
def new_func(ctx, *args, **kwargs):
# Invoked with custom config:
if 'config' in kwargs:
return ctx.invoke(f, *args, **kwargs)
if ctx.obj is None:
ctx.obj = {}
conf... | python | def with_config(f):
"""Add config to function."""
# keep it.
@click.pass_context
def new_func(ctx, *args, **kwargs):
# Invoked with custom config:
if 'config' in kwargs:
return ctx.invoke(f, *args, **kwargs)
if ctx.obj is None:
ctx.obj = {}
conf... | [
"def",
"with_config",
"(",
"f",
")",
":",
"# keep it.",
"@",
"click",
".",
"pass_context",
"def",
"new_func",
"(",
"ctx",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Invoked with custom config:",
"if",
"'config'",
"in",
"kwargs",
":",
"return",... | Add config to function. | [
"Add",
"config",
"to",
"function",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_config.py#L88-L120 |
SwissDataScienceCenter/renku-python | renku/cli/_config.py | print_app_config_path | def print_app_config_path(ctx, param, value):
"""Print application config path."""
if not value or ctx.resilient_parsing:
return
click.echo(config_path(os.environ.get('RENKU_CONFIG')))
ctx.exit() | python | def print_app_config_path(ctx, param, value):
"""Print application config path."""
if not value or ctx.resilient_parsing:
return
click.echo(config_path(os.environ.get('RENKU_CONFIG')))
ctx.exit() | [
"def",
"print_app_config_path",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"if",
"not",
"value",
"or",
"ctx",
".",
"resilient_parsing",
":",
"return",
"click",
".",
"echo",
"(",
"config_path",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'RENKU_CO... | Print application config path. | [
"Print",
"application",
"config",
"path",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_config.py#L123-L128 |
SwissDataScienceCenter/renku-python | renku/cli/_config.py | create_project_config_path | def create_project_config_path(
path, mode=0o777, parents=False, exist_ok=False
):
"""Create new project configuration folder."""
# FIXME check default directory mode
project_path = Path(path).absolute().joinpath(RENKU_HOME)
project_path.mkdir(mode=mode, parents=parents, exist_ok=exist_ok)
retur... | python | def create_project_config_path(
path, mode=0o777, parents=False, exist_ok=False
):
"""Create new project configuration folder."""
# FIXME check default directory mode
project_path = Path(path).absolute().joinpath(RENKU_HOME)
project_path.mkdir(mode=mode, parents=parents, exist_ok=exist_ok)
retur... | [
"def",
"create_project_config_path",
"(",
"path",
",",
"mode",
"=",
"0o777",
",",
"parents",
"=",
"False",
",",
"exist_ok",
"=",
"False",
")",
":",
"# FIXME check default directory mode",
"project_path",
"=",
"Path",
"(",
"path",
")",
".",
"absolute",
"(",
")"... | Create new project configuration folder. | [
"Create",
"new",
"project",
"configuration",
"folder",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_config.py#L131-L138 |
SwissDataScienceCenter/renku-python | renku/cli/_config.py | get_project_config_path | def get_project_config_path(path=None):
"""Return project configuration folder if exist."""
project_path = Path(path or '.').absolute().joinpath(RENKU_HOME)
if project_path.exists() and project_path.is_dir():
return str(project_path) | python | def get_project_config_path(path=None):
"""Return project configuration folder if exist."""
project_path = Path(path or '.').absolute().joinpath(RENKU_HOME)
if project_path.exists() and project_path.is_dir():
return str(project_path) | [
"def",
"get_project_config_path",
"(",
"path",
"=",
"None",
")",
":",
"project_path",
"=",
"Path",
"(",
"path",
"or",
"'.'",
")",
".",
"absolute",
"(",
")",
".",
"joinpath",
"(",
"RENKU_HOME",
")",
"if",
"project_path",
".",
"exists",
"(",
")",
"and",
... | Return project configuration folder if exist. | [
"Return",
"project",
"configuration",
"folder",
"if",
"exist",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_config.py#L141-L145 |
SwissDataScienceCenter/renku-python | renku/cli/_config.py | find_project_config_path | def find_project_config_path(path=None):
"""Find project config path."""
path = Path(path) if path else Path.cwd()
abspath = path.absolute()
project_path = get_project_config_path(abspath)
if project_path:
return project_path
for parent in abspath.parents:
project_path = get_pr... | python | def find_project_config_path(path=None):
"""Find project config path."""
path = Path(path) if path else Path.cwd()
abspath = path.absolute()
project_path = get_project_config_path(abspath)
if project_path:
return project_path
for parent in abspath.parents:
project_path = get_pr... | [
"def",
"find_project_config_path",
"(",
"path",
"=",
"None",
")",
":",
"path",
"=",
"Path",
"(",
"path",
")",
"if",
"path",
"else",
"Path",
".",
"cwd",
"(",
")",
"abspath",
"=",
"path",
".",
"absolute",
"(",
")",
"project_path",
"=",
"get_project_config_... | Find project config path. | [
"Find",
"project",
"config",
"path",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_config.py#L148-L160 |
SwissDataScienceCenter/renku-python | renku/models/provenance/activities.py | _nodes | def _nodes(output, parent=None):
"""Yield nodes from entities."""
# NOTE refactor so all outputs behave the same
entity = getattr(output, 'entity', output)
if isinstance(entity, Collection):
for member in entity.members:
if parent is not None:
member = attr.evolve(me... | python | def _nodes(output, parent=None):
"""Yield nodes from entities."""
# NOTE refactor so all outputs behave the same
entity = getattr(output, 'entity', output)
if isinstance(entity, Collection):
for member in entity.members:
if parent is not None:
member = attr.evolve(me... | [
"def",
"_nodes",
"(",
"output",
",",
"parent",
"=",
"None",
")",
":",
"# NOTE refactor so all outputs behave the same",
"entity",
"=",
"getattr",
"(",
"output",
",",
"'entity'",
",",
"output",
")",
"if",
"isinstance",
"(",
"entity",
",",
"Collection",
")",
":"... | Yield nodes from entities. | [
"Yield",
"nodes",
"from",
"entities",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/provenance/activities.py#L35-L47 |
SwissDataScienceCenter/renku-python | renku/models/cwl/_ascwl.py | mapped | def mapped(cls, key='id', **kwargs):
"""Create list of instances from a mapping."""
kwargs.setdefault('metadata', {})
kwargs['metadata']['jsonldPredicate'] = {'mapSubject': key}
kwargs.setdefault('default', attr.Factory(list))
def converter(value):
"""Convert mapping to a list of instances.... | python | def mapped(cls, key='id', **kwargs):
"""Create list of instances from a mapping."""
kwargs.setdefault('metadata', {})
kwargs['metadata']['jsonldPredicate'] = {'mapSubject': key}
kwargs.setdefault('default', attr.Factory(list))
def converter(value):
"""Convert mapping to a list of instances.... | [
"def",
"mapped",
"(",
"cls",
",",
"key",
"=",
"'id'",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'metadata'",
",",
"{",
"}",
")",
"kwargs",
"[",
"'metadata'",
"]",
"[",
"'jsonldPredicate'",
"]",
"=",
"{",
"'mapSubject'",
":... | Create list of instances from a mapping. | [
"Create",
"list",
"of",
"instances",
"from",
"a",
"mapping",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/cwl/_ascwl.py#L74-L108 |
SwissDataScienceCenter/renku-python | renku/models/cwl/_ascwl.py | ascwl | def ascwl(
inst,
recurse=True,
filter=None,
dict_factory=dict,
retain_collection_types=False,
basedir=None,
):
"""Return the ``attrs`` attribute values of *inst* as a dict.
Support ``jsonldPredicate`` in a field metadata for generating
mappings from lists.
Adapted from ``attr._... | python | def ascwl(
inst,
recurse=True,
filter=None,
dict_factory=dict,
retain_collection_types=False,
basedir=None,
):
"""Return the ``attrs`` attribute values of *inst* as a dict.
Support ``jsonldPredicate`` in a field metadata for generating
mappings from lists.
Adapted from ``attr._... | [
"def",
"ascwl",
"(",
"inst",
",",
"recurse",
"=",
"True",
",",
"filter",
"=",
"None",
",",
"dict_factory",
"=",
"dict",
",",
"retain_collection_types",
"=",
"False",
",",
"basedir",
"=",
"None",
",",
")",
":",
"attrs",
"=",
"fields",
"(",
"inst",
".",
... | Return the ``attrs`` attribute values of *inst* as a dict.
Support ``jsonldPredicate`` in a field metadata for generating
mappings from lists.
Adapted from ``attr._funcs``. | [
"Return",
"the",
"attrs",
"attribute",
"values",
"of",
"*",
"inst",
"*",
"as",
"a",
"dict",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/cwl/_ascwl.py#L111-L197 |
SwissDataScienceCenter/renku-python | renku/models/cwl/_ascwl.py | CWLClass.from_cwl | def from_cwl(cls, data, __reference__=None):
"""Return an instance from CWL data."""
class_name = data.get('class', None)
cls = cls.registry.get(class_name, cls)
if __reference__:
with with_reference(__reference__):
self = cls(
**{k: v
... | python | def from_cwl(cls, data, __reference__=None):
"""Return an instance from CWL data."""
class_name = data.get('class', None)
cls = cls.registry.get(class_name, cls)
if __reference__:
with with_reference(__reference__):
self = cls(
**{k: v
... | [
"def",
"from_cwl",
"(",
"cls",
",",
"data",
",",
"__reference__",
"=",
"None",
")",
":",
"class_name",
"=",
"data",
".",
"get",
"(",
"'class'",
",",
"None",
")",
"cls",
"=",
"cls",
".",
"registry",
".",
"get",
"(",
"class_name",
",",
"cls",
")",
"i... | Return an instance from CWL data. | [
"Return",
"an",
"instance",
"from",
"CWL",
"data",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/cwl/_ascwl.py#L48-L61 |
SwissDataScienceCenter/renku-python | renku/models/cwl/_ascwl.py | CWLClass.from_yaml | def from_yaml(cls, path):
"""Return an instance from a YAML file."""
import yaml
with path.open(mode='r') as fp:
self = cls.from_cwl(yaml.safe_load(fp), __reference__=path)
return self | python | def from_yaml(cls, path):
"""Return an instance from a YAML file."""
import yaml
with path.open(mode='r') as fp:
self = cls.from_cwl(yaml.safe_load(fp), __reference__=path)
return self | [
"def",
"from_yaml",
"(",
"cls",
",",
"path",
")",
":",
"import",
"yaml",
"with",
"path",
".",
"open",
"(",
"mode",
"=",
"'r'",
")",
"as",
"fp",
":",
"self",
"=",
"cls",
".",
"from_cwl",
"(",
"yaml",
".",
"safe_load",
"(",
"fp",
")",
",",
"__refer... | Return an instance from a YAML file. | [
"Return",
"an",
"instance",
"from",
"a",
"YAML",
"file",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/cwl/_ascwl.py#L64-L71 |
SwissDataScienceCenter/renku-python | renku/cli/runner.py | template | def template(client, force):
"""Render templated configuration files."""
import pkg_resources
# create the templated files
for tpl_file in CI_TEMPLATES:
tpl_path = client.path / tpl_file
with pkg_resources.resource_stream(__name__, tpl_file) as tpl:
content = tpl.read()
... | python | def template(client, force):
"""Render templated configuration files."""
import pkg_resources
# create the templated files
for tpl_file in CI_TEMPLATES:
tpl_path = client.path / tpl_file
with pkg_resources.resource_stream(__name__, tpl_file) as tpl:
content = tpl.read()
... | [
"def",
"template",
"(",
"client",
",",
"force",
")",
":",
"import",
"pkg_resources",
"# create the templated files",
"for",
"tpl_file",
"in",
"CI_TEMPLATES",
":",
"tpl_path",
"=",
"client",
".",
"path",
"/",
"tpl_file",
"with",
"pkg_resources",
".",
"resource_stre... | Render templated configuration files. | [
"Render",
"templated",
"configuration",
"files",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/runner.py#L44-L63 |
SwissDataScienceCenter/renku-python | renku/cli/runner.py | rerun | def rerun(client, run, job):
"""Re-run existing workflow or tool using CWL runner."""
from renku.models.provenance import ProcessRun
activity = client.process_commmit()
if not isinstance(activity, ProcessRun):
click.secho('No tool was found.', fg='red', file=sys.stderr)
return
try:... | python | def rerun(client, run, job):
"""Re-run existing workflow or tool using CWL runner."""
from renku.models.provenance import ProcessRun
activity = client.process_commmit()
if not isinstance(activity, ProcessRun):
click.secho('No tool was found.', fg='red', file=sys.stderr)
return
try:... | [
"def",
"rerun",
"(",
"client",
",",
"run",
",",
"job",
")",
":",
"from",
"renku",
".",
"models",
".",
"provenance",
"import",
"ProcessRun",
"activity",
"=",
"client",
".",
"process_commmit",
"(",
")",
"if",
"not",
"isinstance",
"(",
"activity",
",",
"Pro... | Re-run existing workflow or tool using CWL runner. | [
"Re",
"-",
"run",
"existing",
"workflow",
"or",
"tool",
"using",
"CWL",
"runner",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/runner.py#L77-L101 |
SwissDataScienceCenter/renku-python | renku/cli/rerun.py | _format_default | def _format_default(client, value):
"""Format default values."""
if isinstance(value, File):
return os.path.relpath(
str((client.workflow_path / value.path).resolve())
)
return value | python | def _format_default(client, value):
"""Format default values."""
if isinstance(value, File):
return os.path.relpath(
str((client.workflow_path / value.path).resolve())
)
return value | [
"def",
"_format_default",
"(",
"client",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"File",
")",
":",
"return",
"os",
".",
"path",
".",
"relpath",
"(",
"str",
"(",
"(",
"client",
".",
"workflow_path",
"/",
"value",
".",
"path",
")... | Format default values. | [
"Format",
"default",
"values",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/rerun.py#L59-L65 |
SwissDataScienceCenter/renku-python | renku/cli/rerun.py | show_inputs | def show_inputs(client, workflow):
"""Show workflow inputs and exit."""
for input_ in workflow.inputs:
click.echo(
'{id}: {default}'.format(
id=input_.id,
default=_format_default(client, input_.default),
)
)
sys.exit(0) | python | def show_inputs(client, workflow):
"""Show workflow inputs and exit."""
for input_ in workflow.inputs:
click.echo(
'{id}: {default}'.format(
id=input_.id,
default=_format_default(client, input_.default),
)
)
sys.exit(0) | [
"def",
"show_inputs",
"(",
"client",
",",
"workflow",
")",
":",
"for",
"input_",
"in",
"workflow",
".",
"inputs",
":",
"click",
".",
"echo",
"(",
"'{id}: {default}'",
".",
"format",
"(",
"id",
"=",
"input_",
".",
"id",
",",
"default",
"=",
"_format_defau... | Show workflow inputs and exit. | [
"Show",
"workflow",
"inputs",
"and",
"exit",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/rerun.py#L68-L77 |
SwissDataScienceCenter/renku-python | renku/cli/rerun.py | edit_inputs | def edit_inputs(client, workflow):
"""Edit workflow inputs."""
types = {
'int': int,
'string': str,
'File': lambda x: File(path=Path(x).resolve()),
}
for input_ in workflow.inputs:
convert = types.get(input_.type, str)
input_.default = convert(
click.p... | python | def edit_inputs(client, workflow):
"""Edit workflow inputs."""
types = {
'int': int,
'string': str,
'File': lambda x: File(path=Path(x).resolve()),
}
for input_ in workflow.inputs:
convert = types.get(input_.type, str)
input_.default = convert(
click.p... | [
"def",
"edit_inputs",
"(",
"client",
",",
"workflow",
")",
":",
"types",
"=",
"{",
"'int'",
":",
"int",
",",
"'string'",
":",
"str",
",",
"'File'",
":",
"lambda",
"x",
":",
"File",
"(",
"path",
"=",
"Path",
"(",
"x",
")",
".",
"resolve",
"(",
")"... | Edit workflow inputs. | [
"Edit",
"workflow",
"inputs",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/rerun.py#L80-L95 |
SwissDataScienceCenter/renku-python | renku/cli/rerun.py | rerun | def rerun(client, revision, roots, siblings, inputs, paths):
"""Recreate files generated by a sequence of ``run`` commands."""
graph = Graph(client)
outputs = graph.build(paths=paths, revision=revision)
# Check or extend siblings of outputs.
outputs = siblings(graph, outputs)
output_paths = {no... | python | def rerun(client, revision, roots, siblings, inputs, paths):
"""Recreate files generated by a sequence of ``run`` commands."""
graph = Graph(client)
outputs = graph.build(paths=paths, revision=revision)
# Check or extend siblings of outputs.
outputs = siblings(graph, outputs)
output_paths = {no... | [
"def",
"rerun",
"(",
"client",
",",
"revision",
",",
"roots",
",",
"siblings",
",",
"inputs",
",",
"paths",
")",
":",
"graph",
"=",
"Graph",
"(",
"client",
")",
"outputs",
"=",
"graph",
".",
"build",
"(",
"paths",
"=",
"paths",
",",
"revision",
"=",
... | Recreate files generated by a sequence of ``run`` commands. | [
"Recreate",
"files",
"generated",
"by",
"a",
"sequence",
"of",
"run",
"commands",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/rerun.py#L134-L187 |
SwissDataScienceCenter/renku-python | renku/cli/migrate.py | datasets | def datasets(ctx, client):
"""Migrate dataset metadata."""
from renku.models._jsonld import asjsonld
from renku.models.datasets import Dataset
from renku.models.refs import LinkReference
from ._checks.location_datasets import _dataset_metadata_pre_0_3_4
for old_path in _dataset_metadata_pre_0_... | python | def datasets(ctx, client):
"""Migrate dataset metadata."""
from renku.models._jsonld import asjsonld
from renku.models.datasets import Dataset
from renku.models.refs import LinkReference
from ._checks.location_datasets import _dataset_metadata_pre_0_3_4
for old_path in _dataset_metadata_pre_0_... | [
"def",
"datasets",
"(",
"ctx",
",",
"client",
")",
":",
"from",
"renku",
".",
"models",
".",
"_jsonld",
"import",
"asjsonld",
"from",
"renku",
".",
"models",
".",
"datasets",
"import",
"Dataset",
"from",
"renku",
".",
"models",
".",
"refs",
"import",
"Li... | Migrate dataset metadata. | [
"Migrate",
"dataset",
"metadata",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/migrate.py#L45-L75 |
SwissDataScienceCenter/renku-python | renku/cli/pull.py | path | def path(ctx, paths):
"""DEPRECATED: use 'renku storage pull'."""
click.secho('Use "renku storage pull" instead.', fg='red', err=True)
ctx.exit(2) | python | def path(ctx, paths):
"""DEPRECATED: use 'renku storage pull'."""
click.secho('Use "renku storage pull" instead.', fg='red', err=True)
ctx.exit(2) | [
"def",
"path",
"(",
"ctx",
",",
"paths",
")",
":",
"click",
".",
"secho",
"(",
"'Use \"renku storage pull\" instead.'",
",",
"fg",
"=",
"'red'",
",",
"err",
"=",
"True",
")",
"ctx",
".",
"exit",
"(",
"2",
")"
] | DEPRECATED: use 'renku storage pull'. | [
"DEPRECATED",
":",
"use",
"renku",
"storage",
"pull",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/pull.py#L36-L39 |
SwissDataScienceCenter/renku-python | renku/cli/_docker.py | detect_registry_url | def detect_registry_url(client, auto_login=True):
"""Return a URL of the Docker registry."""
repo = client.repo
config = repo.config_reader()
# Find registry URL in .git/config
remote_url = None
try:
registry_url = config.get_value('renku', 'registry', None)
except NoSectionError:
... | python | def detect_registry_url(client, auto_login=True):
"""Return a URL of the Docker registry."""
repo = client.repo
config = repo.config_reader()
# Find registry URL in .git/config
remote_url = None
try:
registry_url = config.get_value('renku', 'registry', None)
except NoSectionError:
... | [
"def",
"detect_registry_url",
"(",
"client",
",",
"auto_login",
"=",
"True",
")",
":",
"repo",
"=",
"client",
".",
"repo",
"config",
"=",
"repo",
".",
"config_reader",
"(",
")",
"# Find registry URL in .git/config",
"remote_url",
"=",
"None",
"try",
":",
"regi... | Return a URL of the Docker registry. | [
"Return",
"a",
"URL",
"of",
"the",
"Docker",
"registry",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_docker.py#L29-L91 |
SwissDataScienceCenter/renku-python | renku/models/_json.py | JSONEncoder.default | def default(self, obj):
"""Encode more types."""
if isinstance(obj, UUID):
return obj.hex
elif isinstance(obj, datetime.datetime):
return obj.isoformat()
return super().default(obj) | python | def default(self, obj):
"""Encode more types."""
if isinstance(obj, UUID):
return obj.hex
elif isinstance(obj, datetime.datetime):
return obj.isoformat()
return super().default(obj) | [
"def",
"default",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"UUID",
")",
":",
"return",
"obj",
".",
"hex",
"elif",
"isinstance",
"(",
"obj",
",",
"datetime",
".",
"datetime",
")",
":",
"return",
"obj",
".",
"isoformat",
... | Encode more types. | [
"Encode",
"more",
"types",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_json.py#L29-L36 |
SwissDataScienceCenter/renku-python | renku/cli/run.py | run | def run(client, outputs, no_output, success_codes, isolation, command_line):
"""Tracking work on a specific problem."""
working_dir = client.repo.working_dir
mapped_std = _mapped_std_streams(client.candidate_paths)
factory = CommandLineToolFactory(
command_line=command_line,
directory=os... | python | def run(client, outputs, no_output, success_codes, isolation, command_line):
"""Tracking work on a specific problem."""
working_dir = client.repo.working_dir
mapped_std = _mapped_std_streams(client.candidate_paths)
factory = CommandLineToolFactory(
command_line=command_line,
directory=os... | [
"def",
"run",
"(",
"client",
",",
"outputs",
",",
"no_output",
",",
"success_codes",
",",
"isolation",
",",
"command_line",
")",
":",
"working_dir",
"=",
"client",
".",
"repo",
".",
"working_dir",
"mapped_std",
"=",
"_mapped_std_streams",
"(",
"client",
".",
... | Tracking work on a specific problem. | [
"Tracking",
"work",
"on",
"a",
"specific",
"problem",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/run.py#L164-L206 |
SwissDataScienceCenter/renku-python | renku/cli/log.py | log | def log(client, revision, format, no_output, paths):
"""Show logs for a file."""
graph = Graph(client)
if not paths:
start, is_range, stop = revision.partition('..')
if not is_range:
stop = start
elif not stop:
stop = 'HEAD'
commit = client.repo.rev_p... | python | def log(client, revision, format, no_output, paths):
"""Show logs for a file."""
graph = Graph(client)
if not paths:
start, is_range, stop = revision.partition('..')
if not is_range:
stop = start
elif not stop:
stop = 'HEAD'
commit = client.repo.rev_p... | [
"def",
"log",
"(",
"client",
",",
"revision",
",",
"format",
",",
"no_output",
",",
"paths",
")",
":",
"graph",
"=",
"Graph",
"(",
"client",
")",
"if",
"not",
"paths",
":",
"start",
",",
"is_range",
",",
"stop",
"=",
"revision",
".",
"partition",
"("... | Show logs for a file. | [
"Show",
"logs",
"for",
"a",
"file",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/log.py#L91-L111 |
SwissDataScienceCenter/renku-python | renku/cli/status.py | status | def status(ctx, client, revision, no_output, path):
"""Show a status of the repository."""
graph = Graph(client)
# TODO filter only paths = {graph.normalize_path(p) for p in path}
status = graph.build_status(revision=revision, can_be_cwl=no_output)
click.echo('On branch {0}'.format(client.repo.acti... | python | def status(ctx, client, revision, no_output, path):
"""Show a status of the repository."""
graph = Graph(client)
# TODO filter only paths = {graph.normalize_path(p) for p in path}
status = graph.build_status(revision=revision, can_be_cwl=no_output)
click.echo('On branch {0}'.format(client.repo.acti... | [
"def",
"status",
"(",
"ctx",
",",
"client",
",",
"revision",
",",
"no_output",
",",
"path",
")",
":",
"graph",
"=",
"Graph",
"(",
"client",
")",
"# TODO filter only paths = {graph.normalize_path(p) for p in path}",
"status",
"=",
"graph",
".",
"build_status",
"(",... | Show a status of the repository. | [
"Show",
"a",
"status",
"of",
"the",
"repository",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/status.py#L59-L140 |
SwissDataScienceCenter/renku-python | renku/cli/init.py | validate_name | def validate_name(ctx, param, value):
"""Validate a project name."""
if not value:
value = os.path.basename(ctx.params['directory'].rstrip(os.path.sep))
return value | python | def validate_name(ctx, param, value):
"""Validate a project name."""
if not value:
value = os.path.basename(ctx.params['directory'].rstrip(os.path.sep))
return value | [
"def",
"validate_name",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"if",
"not",
"value",
":",
"value",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"ctx",
".",
"params",
"[",
"'directory'",
"]",
".",
"rstrip",
"(",
"os",
".",
"path",
".",
... | Validate a project name. | [
"Validate",
"a",
"project",
"name",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/init.py#L80-L84 |
SwissDataScienceCenter/renku-python | renku/cli/init.py | store_directory | def store_directory(ctx, param, value):
"""Store directory as a new Git home."""
Path(value).mkdir(parents=True, exist_ok=True)
set_git_home(value)
return value | python | def store_directory(ctx, param, value):
"""Store directory as a new Git home."""
Path(value).mkdir(parents=True, exist_ok=True)
set_git_home(value)
return value | [
"def",
"store_directory",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"Path",
"(",
"value",
")",
".",
"mkdir",
"(",
"parents",
"=",
"True",
",",
"exist_ok",
"=",
"True",
")",
"set_git_home",
"(",
"value",
")",
"return",
"value"
] | Store directory as a new Git home. | [
"Store",
"directory",
"as",
"a",
"new",
"Git",
"home",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/init.py#L87-L91 |
SwissDataScienceCenter/renku-python | renku/cli/init.py | init | def init(ctx, client, directory, name, force, use_external_storage):
"""Initialize a project."""
if not client.use_external_storage:
use_external_storage = False
ctx.obj = client = attr.evolve(
client,
path=directory,
use_external_storage=use_external_storage,
)
msg... | python | def init(ctx, client, directory, name, force, use_external_storage):
"""Initialize a project."""
if not client.use_external_storage:
use_external_storage = False
ctx.obj = client = attr.evolve(
client,
path=directory,
use_external_storage=use_external_storage,
)
msg... | [
"def",
"init",
"(",
"ctx",
",",
"client",
",",
"directory",
",",
"name",
",",
"force",
",",
"use_external_storage",
")",
":",
"if",
"not",
"client",
".",
"use_external_storage",
":",
"use_external_storage",
"=",
"False",
"ctx",
".",
"obj",
"=",
"client",
"... | Initialize a project. | [
"Initialize",
"a",
"project",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/init.py#L106-L166 |
SwissDataScienceCenter/renku-python | renku/cli/_checks/files_in_datasets.py | check_missing_files | def check_missing_files(client):
"""Find missing files listed in datasets."""
missing = defaultdict(list)
for path, dataset in client.datasets.items():
for file in dataset.files:
filepath = (path.parent / file)
if not filepath.exists():
missing[str(
... | python | def check_missing_files(client):
"""Find missing files listed in datasets."""
missing = defaultdict(list)
for path, dataset in client.datasets.items():
for file in dataset.files:
filepath = (path.parent / file)
if not filepath.exists():
missing[str(
... | [
"def",
"check_missing_files",
"(",
"client",
")",
":",
"missing",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"path",
",",
"dataset",
"in",
"client",
".",
"datasets",
".",
"items",
"(",
")",
":",
"for",
"file",
"in",
"dataset",
".",
"files",
":",
"fil... | Find missing files listed in datasets. | [
"Find",
"missing",
"files",
"listed",
"in",
"datasets",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_checks/files_in_datasets.py#L28-L56 |
SwissDataScienceCenter/renku-python | renku/errors.py | APIError.from_http_exception | def from_http_exception(cls, e):
"""Create ``APIError`` from ``requests.exception.HTTPError``."""
assert isinstance(e, requests.exceptions.HTTPError)
response = e.response
try:
message = response.json()['message']
except (KeyError, ValueError):
message = r... | python | def from_http_exception(cls, e):
"""Create ``APIError`` from ``requests.exception.HTTPError``."""
assert isinstance(e, requests.exceptions.HTTPError)
response = e.response
try:
message = response.json()['message']
except (KeyError, ValueError):
message = r... | [
"def",
"from_http_exception",
"(",
"cls",
",",
"e",
")",
":",
"assert",
"isinstance",
"(",
"e",
",",
"requests",
".",
"exceptions",
".",
"HTTPError",
")",
"response",
"=",
"e",
".",
"response",
"try",
":",
"message",
"=",
"response",
".",
"json",
"(",
... | Create ``APIError`` from ``requests.exception.HTTPError``. | [
"Create",
"APIError",
"from",
"requests",
".",
"exception",
".",
"HTTPError",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/errors.py#L38-L47 |
SwissDataScienceCenter/renku-python | renku/errors.py | UnexpectedStatusCode.return_or_raise | def return_or_raise(cls, response, expected_status_code):
"""Check for ``expected_status_code``."""
try:
if response.status_code in expected_status_code:
return response
except TypeError:
if response.status_code == expected_status_code:
ret... | python | def return_or_raise(cls, response, expected_status_code):
"""Check for ``expected_status_code``."""
try:
if response.status_code in expected_status_code:
return response
except TypeError:
if response.status_code == expected_status_code:
ret... | [
"def",
"return_or_raise",
"(",
"cls",
",",
"response",
",",
"expected_status_code",
")",
":",
"try",
":",
"if",
"response",
".",
"status_code",
"in",
"expected_status_code",
":",
"return",
"response",
"except",
"TypeError",
":",
"if",
"response",
".",
"status_co... | Check for ``expected_status_code``. | [
"Check",
"for",
"expected_status_code",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/errors.py#L61-L70 |
SwissDataScienceCenter/renku-python | renku/cli/_checks/references.py | check_missing_references | def check_missing_references(client):
"""Find missing references."""
from renku.models.refs import LinkReference
missing = [
ref for ref in LinkReference.iter_items(client)
if not ref.reference.exists()
]
if not missing:
return True
click.secho(
WARNING + 'Ther... | python | def check_missing_references(client):
"""Find missing references."""
from renku.models.refs import LinkReference
missing = [
ref for ref in LinkReference.iter_items(client)
if not ref.reference.exists()
]
if not missing:
return True
click.secho(
WARNING + 'Ther... | [
"def",
"check_missing_references",
"(",
"client",
")",
":",
"from",
"renku",
".",
"models",
".",
"refs",
"import",
"LinkReference",
"missing",
"=",
"[",
"ref",
"for",
"ref",
"in",
"LinkReference",
".",
"iter_items",
"(",
"client",
")",
"if",
"not",
"ref",
... | Find missing references. | [
"Find",
"missing",
"references",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_checks/references.py#L25-L44 |
SwissDataScienceCenter/renku-python | renku/cli/_git.py | get_git_home | def get_git_home(path='.'):
"""Get Git path from the current context."""
ctx = click.get_current_context(silent=True)
if ctx and GIT_KEY in ctx.meta:
return ctx.meta[GIT_KEY]
from git import Repo
return Repo(path, search_parent_directories=True).working_dir | python | def get_git_home(path='.'):
"""Get Git path from the current context."""
ctx = click.get_current_context(silent=True)
if ctx and GIT_KEY in ctx.meta:
return ctx.meta[GIT_KEY]
from git import Repo
return Repo(path, search_parent_directories=True).working_dir | [
"def",
"get_git_home",
"(",
"path",
"=",
"'.'",
")",
":",
"ctx",
"=",
"click",
".",
"get_current_context",
"(",
"silent",
"=",
"True",
")",
"if",
"ctx",
"and",
"GIT_KEY",
"in",
"ctx",
".",
"meta",
":",
"return",
"ctx",
".",
"meta",
"[",
"GIT_KEY",
"]... | Get Git path from the current context. | [
"Get",
"Git",
"path",
"from",
"the",
"current",
"context",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_git.py#L32-L39 |
SwissDataScienceCenter/renku-python | renku/cli/_git.py | get_git_isolation | def get_git_isolation():
"""Get Git isolation from the current context."""
ctx = click.get_current_context(silent=True)
if ctx and GIT_ISOLATION in ctx.meta:
return ctx.meta[GIT_ISOLATION] | python | def get_git_isolation():
"""Get Git isolation from the current context."""
ctx = click.get_current_context(silent=True)
if ctx and GIT_ISOLATION in ctx.meta:
return ctx.meta[GIT_ISOLATION] | [
"def",
"get_git_isolation",
"(",
")",
":",
"ctx",
"=",
"click",
".",
"get_current_context",
"(",
"silent",
"=",
"True",
")",
"if",
"ctx",
"and",
"GIT_ISOLATION",
"in",
"ctx",
".",
"meta",
":",
"return",
"ctx",
".",
"meta",
"[",
"GIT_ISOLATION",
"]"
] | Get Git isolation from the current context. | [
"Get",
"Git",
"isolation",
"from",
"the",
"current",
"context",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_git.py#L48-L52 |
SwissDataScienceCenter/renku-python | renku/cli/_git.py | _safe_issue_checkout | def _safe_issue_checkout(repo, issue=None):
"""Safely checkout branch for the issue."""
branch_name = str(issue) if issue else 'master'
if branch_name not in repo.heads:
branch = repo.create_head(branch_name)
else:
branch = repo.heads[branch_name]
branch.checkout() | python | def _safe_issue_checkout(repo, issue=None):
"""Safely checkout branch for the issue."""
branch_name = str(issue) if issue else 'master'
if branch_name not in repo.heads:
branch = repo.create_head(branch_name)
else:
branch = repo.heads[branch_name]
branch.checkout() | [
"def",
"_safe_issue_checkout",
"(",
"repo",
",",
"issue",
"=",
"None",
")",
":",
"branch_name",
"=",
"str",
"(",
"issue",
")",
"if",
"issue",
"else",
"'master'",
"if",
"branch_name",
"not",
"in",
"repo",
".",
"heads",
":",
"branch",
"=",
"repo",
".",
"... | Safely checkout branch for the issue. | [
"Safely",
"checkout",
"branch",
"for",
"the",
"issue",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_git.py#L55-L62 |
SwissDataScienceCenter/renku-python | renku/models/_jsonld.py | attrs | def attrs(
maybe_cls=None, type=None, context=None, translate=None, **attrs_kwargs
):
"""Wrap an attr enabled class."""
if isinstance(type, (list, tuple, set)):
types = list(type)
else:
types = [type] if type is not None else []
context = context or {}
translate = translate or {}... | python | def attrs(
maybe_cls=None, type=None, context=None, translate=None, **attrs_kwargs
):
"""Wrap an attr enabled class."""
if isinstance(type, (list, tuple, set)):
types = list(type)
else:
types = [type] if type is not None else []
context = context or {}
translate = translate or {}... | [
"def",
"attrs",
"(",
"maybe_cls",
"=",
"None",
",",
"type",
"=",
"None",
",",
"context",
"=",
"None",
",",
"translate",
"=",
"None",
",",
"*",
"*",
"attrs_kwargs",
")",
":",
"if",
"isinstance",
"(",
"type",
",",
"(",
"list",
",",
"tuple",
",",
"set... | Wrap an attr enabled class. | [
"Wrap",
"an",
"attr",
"enabled",
"class",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_jsonld.py#L50-L155 |
SwissDataScienceCenter/renku-python | renku/models/_jsonld.py | attrib | def attrib(context=None, **kwargs):
"""Create a new attribute with context."""
kwargs.setdefault('metadata', {})
kwargs['metadata'][KEY] = context
return attr.ib(**kwargs) | python | def attrib(context=None, **kwargs):
"""Create a new attribute with context."""
kwargs.setdefault('metadata', {})
kwargs['metadata'][KEY] = context
return attr.ib(**kwargs) | [
"def",
"attrib",
"(",
"context",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'metadata'",
",",
"{",
"}",
")",
"kwargs",
"[",
"'metadata'",
"]",
"[",
"KEY",
"]",
"=",
"context",
"return",
"attr",
".",
"ib",
"("... | Create a new attribute with context. | [
"Create",
"a",
"new",
"attribute",
"with",
"context",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_jsonld.py#L158-L162 |
SwissDataScienceCenter/renku-python | renku/models/_jsonld.py | _container_attrib_builder | def _container_attrib_builder(name, container, mapper):
"""Builder for container attributes."""
context = {'@container': '@{0}'.format(name)}
def _attrib(type, **kwargs):
"""Define a container attribute."""
kwargs.setdefault('metadata', {})
kwargs['metadata'][KEY_CLS] = type
... | python | def _container_attrib_builder(name, container, mapper):
"""Builder for container attributes."""
context = {'@container': '@{0}'.format(name)}
def _attrib(type, **kwargs):
"""Define a container attribute."""
kwargs.setdefault('metadata', {})
kwargs['metadata'][KEY_CLS] = type
... | [
"def",
"_container_attrib_builder",
"(",
"name",
",",
"container",
",",
"mapper",
")",
":",
"context",
"=",
"{",
"'@container'",
":",
"'@{0}'",
".",
"format",
"(",
"name",
")",
"}",
"def",
"_attrib",
"(",
"type",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\... | Builder for container attributes. | [
"Builder",
"for",
"container",
"attributes",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_jsonld.py#L177-L200 |
SwissDataScienceCenter/renku-python | renku/models/_jsonld.py | asjsonld | def asjsonld(
inst,
recurse=True,
filter=None,
dict_factory=dict,
retain_collection_types=False,
export_context=True,
basedir=None,
):
"""Dump a JSON-LD class to the JSON with generated ``@context`` field."""
jsonld_fields = inst.__class__._jsonld_fields
attrs = tuple(
fi... | python | def asjsonld(
inst,
recurse=True,
filter=None,
dict_factory=dict,
retain_collection_types=False,
export_context=True,
basedir=None,
):
"""Dump a JSON-LD class to the JSON with generated ``@context`` field."""
jsonld_fields = inst.__class__._jsonld_fields
attrs = tuple(
fi... | [
"def",
"asjsonld",
"(",
"inst",
",",
"recurse",
"=",
"True",
",",
"filter",
"=",
"None",
",",
"dict_factory",
"=",
"dict",
",",
"retain_collection_types",
"=",
"False",
",",
"export_context",
"=",
"True",
",",
"basedir",
"=",
"None",
",",
")",
":",
"json... | Dump a JSON-LD class to the JSON with generated ``@context`` field. | [
"Dump",
"a",
"JSON",
"-",
"LD",
"class",
"to",
"the",
"JSON",
"with",
"generated"
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_jsonld.py#L211-L295 |
SwissDataScienceCenter/renku-python | renku/models/_jsonld.py | JSONLDMixin.from_jsonld | def from_jsonld(cls, data, __reference__=None, __source__=None):
"""Instantiate a JSON-LD class from data."""
if isinstance(data, cls):
return data
if not isinstance(data, dict):
raise ValueError(data)
if '@type' in data:
type_ = tuple(sorted(data['@... | python | def from_jsonld(cls, data, __reference__=None, __source__=None):
"""Instantiate a JSON-LD class from data."""
if isinstance(data, cls):
return data
if not isinstance(data, dict):
raise ValueError(data)
if '@type' in data:
type_ = tuple(sorted(data['@... | [
"def",
"from_jsonld",
"(",
"cls",
",",
"data",
",",
"__reference__",
"=",
"None",
",",
"__source__",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"cls",
")",
":",
"return",
"data",
"if",
"not",
"isinstance",
"(",
"data",
",",
"dict",
... | Instantiate a JSON-LD class from data. | [
"Instantiate",
"a",
"JSON",
"-",
"LD",
"class",
"from",
"data",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_jsonld.py#L304-L353 |
SwissDataScienceCenter/renku-python | renku/models/_jsonld.py | JSONLDMixin.from_yaml | def from_yaml(cls, path):
"""Return an instance from a YAML file."""
import yaml
with path.open(mode='r') as fp:
source = yaml.safe_load(fp) or {}
self = cls.from_jsonld(
source,
__reference__=path,
__source__=deepcopy(sour... | python | def from_yaml(cls, path):
"""Return an instance from a YAML file."""
import yaml
with path.open(mode='r') as fp:
source = yaml.safe_load(fp) or {}
self = cls.from_jsonld(
source,
__reference__=path,
__source__=deepcopy(sour... | [
"def",
"from_yaml",
"(",
"cls",
",",
"path",
")",
":",
"import",
"yaml",
"with",
"path",
".",
"open",
"(",
"mode",
"=",
"'r'",
")",
"as",
"fp",
":",
"source",
"=",
"yaml",
".",
"safe_load",
"(",
"fp",
")",
"or",
"{",
"}",
"self",
"=",
"cls",
".... | Return an instance from a YAML file. | [
"Return",
"an",
"instance",
"from",
"a",
"YAML",
"file",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_jsonld.py#L356-L368 |
SwissDataScienceCenter/renku-python | renku/models/_jsonld.py | JSONLDMixin.asjsonld | def asjsonld(self):
"""Create JSON-LD with the original source data."""
source = {}
if self.__source__:
source.update(self.__source__)
source.update(asjsonld(self))
return source | python | def asjsonld(self):
"""Create JSON-LD with the original source data."""
source = {}
if self.__source__:
source.update(self.__source__)
source.update(asjsonld(self))
return source | [
"def",
"asjsonld",
"(",
"self",
")",
":",
"source",
"=",
"{",
"}",
"if",
"self",
".",
"__source__",
":",
"source",
".",
"update",
"(",
"self",
".",
"__source__",
")",
"source",
".",
"update",
"(",
"asjsonld",
"(",
"self",
")",
")",
"return",
"source"... | Create JSON-LD with the original source data. | [
"Create",
"JSON",
"-",
"LD",
"with",
"the",
"original",
"source",
"data",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_jsonld.py#L370-L376 |
SwissDataScienceCenter/renku-python | renku/models/_jsonld.py | JSONLDMixin.to_yaml | def to_yaml(self):
"""Store an instance to the referenced YAML file."""
import yaml
with self.__reference__.open('w') as fp:
yaml.dump(self.asjsonld(), fp, default_flow_style=False) | python | def to_yaml(self):
"""Store an instance to the referenced YAML file."""
import yaml
with self.__reference__.open('w') as fp:
yaml.dump(self.asjsonld(), fp, default_flow_style=False) | [
"def",
"to_yaml",
"(",
"self",
")",
":",
"import",
"yaml",
"with",
"self",
".",
"__reference__",
".",
"open",
"(",
"'w'",
")",
"as",
"fp",
":",
"yaml",
".",
"dump",
"(",
"self",
".",
"asjsonld",
"(",
")",
",",
"fp",
",",
"default_flow_style",
"=",
... | Store an instance to the referenced YAML file. | [
"Store",
"an",
"instance",
"to",
"the",
"referenced",
"YAML",
"file",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_jsonld.py#L378-L383 |
stephenmcd/django-email-extras | email_extras/utils.py | addresses_for_key | def addresses_for_key(gpg, key):
"""
Takes a key and extracts the email addresses for it.
"""
fingerprint = key["fingerprint"]
addresses = []
for key in gpg.list_keys():
if key["fingerprint"] == fingerprint:
addresses.extend([address.split("<")[-1].strip(">")
... | python | def addresses_for_key(gpg, key):
"""
Takes a key and extracts the email addresses for it.
"""
fingerprint = key["fingerprint"]
addresses = []
for key in gpg.list_keys():
if key["fingerprint"] == fingerprint:
addresses.extend([address.split("<")[-1].strip(">")
... | [
"def",
"addresses_for_key",
"(",
"gpg",
",",
"key",
")",
":",
"fingerprint",
"=",
"key",
"[",
"\"fingerprint\"",
"]",
"addresses",
"=",
"[",
"]",
"for",
"key",
"in",
"gpg",
".",
"list_keys",
"(",
")",
":",
"if",
"key",
"[",
"\"fingerprint\"",
"]",
"=="... | Takes a key and extracts the email addresses for it. | [
"Takes",
"a",
"key",
"and",
"extracts",
"the",
"email",
"addresses",
"for",
"it",
"."
] | train | https://github.com/stephenmcd/django-email-extras/blob/8399792998cee84810be2b315dd9b51b200f9218/email_extras/utils.py#L22-L32 |
stephenmcd/django-email-extras | email_extras/utils.py | send_mail | def send_mail(subject, body_text, addr_from, recipient_list,
fail_silently=False, auth_user=None, auth_password=None,
attachments=None, body_html=None, html_message=None,
connection=None, headers=None):
"""
Sends a multipart email containing text and html versions ... | python | def send_mail(subject, body_text, addr_from, recipient_list,
fail_silently=False, auth_user=None, auth_password=None,
attachments=None, body_html=None, html_message=None,
connection=None, headers=None):
"""
Sends a multipart email containing text and html versions ... | [
"def",
"send_mail",
"(",
"subject",
",",
"body_text",
",",
"addr_from",
",",
"recipient_list",
",",
"fail_silently",
"=",
"False",
",",
"auth_user",
"=",
"None",
",",
"auth_password",
"=",
"None",
",",
"attachments",
"=",
"None",
",",
"body_html",
"=",
"None... | Sends a multipart email containing text and html versions which
are encrypted for each recipient that has a valid gpg key
installed. | [
"Sends",
"a",
"multipart",
"email",
"containing",
"text",
"and",
"html",
"versions",
"which",
"are",
"encrypted",
"for",
"each",
"recipient",
"that",
"has",
"a",
"valid",
"gpg",
"key",
"installed",
"."
] | train | https://github.com/stephenmcd/django-email-extras/blob/8399792998cee84810be2b315dd9b51b200f9218/email_extras/utils.py#L35-L127 |
stephenmcd/django-email-extras | email_extras/utils.py | send_mail_template | def send_mail_template(subject, template, addr_from, recipient_list,
fail_silently=False, attachments=None, context=None,
connection=None, headers=None):
"""
Send email rendering text and html versions for the specified
template name using the context dicti... | python | def send_mail_template(subject, template, addr_from, recipient_list,
fail_silently=False, attachments=None, context=None,
connection=None, headers=None):
"""
Send email rendering text and html versions for the specified
template name using the context dicti... | [
"def",
"send_mail_template",
"(",
"subject",
",",
"template",
",",
"addr_from",
",",
"recipient_list",
",",
"fail_silently",
"=",
"False",
",",
"attachments",
"=",
"None",
",",
"context",
"=",
"None",
",",
"connection",
"=",
"None",
",",
"headers",
"=",
"Non... | Send email rendering text and html versions for the specified
template name using the context dictionary passed in. | [
"Send",
"email",
"rendering",
"text",
"and",
"html",
"versions",
"for",
"the",
"specified",
"template",
"name",
"using",
"the",
"context",
"dictionary",
"passed",
"in",
"."
] | train | https://github.com/stephenmcd/django-email-extras/blob/8399792998cee84810be2b315dd9b51b200f9218/email_extras/utils.py#L130-L149 |
SwissDataScienceCenter/renku-python | renku/models/_sort.py | topological | def topological(nodes):
"""Return nodes in a topological order."""
order, enter, state = deque(), set(nodes), {}
def dfs(node):
"""Visit nodes in depth-first order."""
state[node] = GRAY
for parent in nodes.get(node, ()):
color = state.get(parent, None)
if co... | python | def topological(nodes):
"""Return nodes in a topological order."""
order, enter, state = deque(), set(nodes), {}
def dfs(node):
"""Visit nodes in depth-first order."""
state[node] = GRAY
for parent in nodes.get(node, ()):
color = state.get(parent, None)
if co... | [
"def",
"topological",
"(",
"nodes",
")",
":",
"order",
",",
"enter",
",",
"state",
"=",
"deque",
"(",
")",
",",
"set",
"(",
"nodes",
")",
",",
"{",
"}",
"def",
"dfs",
"(",
"node",
")",
":",
"\"\"\"Visit nodes in depth-first order.\"\"\"",
"state",
"[",
... | Return nodes in a topological order. | [
"Return",
"nodes",
"in",
"a",
"topological",
"order",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_sort.py#L25-L46 |
SwissDataScienceCenter/renku-python | renku/cli/move.py | move | def move(ctx, client, sources, destination):
"""Move files and check repository for potential problems."""
from renku.api._git import _expand_directories
dst = Path(destination)
def fmt_path(path):
"""Format path as relative to the client path."""
return str(Path(path).absolute().relat... | python | def move(ctx, client, sources, destination):
"""Move files and check repository for potential problems."""
from renku.api._git import _expand_directories
dst = Path(destination)
def fmt_path(path):
"""Format path as relative to the client path."""
return str(Path(path).absolute().relat... | [
"def",
"move",
"(",
"ctx",
",",
"client",
",",
"sources",
",",
"destination",
")",
":",
"from",
"renku",
".",
"api",
".",
"_git",
"import",
"_expand_directories",
"dst",
"=",
"Path",
"(",
"destination",
")",
"def",
"fmt_path",
"(",
"path",
")",
":",
"\... | Move files and check repository for potential problems. | [
"Move",
"files",
"and",
"check",
"repository",
"for",
"potential",
"problems",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/move.py#L42-L132 |
SwissDataScienceCenter/renku-python | renku/cli/_checks/location_datasets.py | check_dataset_metadata | def check_dataset_metadata(client):
"""Check location of dataset metadata."""
# Find pre 0.3.4 metadata files.
old_metadata = list(_dataset_metadata_pre_0_3_4(client))
if not old_metadata:
return True
click.secho(
WARNING + 'There are metadata files in the old location.'
'\... | python | def check_dataset_metadata(client):
"""Check location of dataset metadata."""
# Find pre 0.3.4 metadata files.
old_metadata = list(_dataset_metadata_pre_0_3_4(client))
if not old_metadata:
return True
click.secho(
WARNING + 'There are metadata files in the old location.'
'\... | [
"def",
"check_dataset_metadata",
"(",
"client",
")",
":",
"# Find pre 0.3.4 metadata files.",
"old_metadata",
"=",
"list",
"(",
"_dataset_metadata_pre_0_3_4",
"(",
"client",
")",
")",
"if",
"not",
"old_metadata",
":",
"return",
"True",
"click",
".",
"secho",
"(",
... | Check location of dataset metadata. | [
"Check",
"location",
"of",
"dataset",
"metadata",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_checks/location_datasets.py#L30-L46 |
SwissDataScienceCenter/renku-python | renku/cli/show.py | siblings | def siblings(client, revision, paths):
"""Show siblings for given paths."""
graph = Graph(client)
nodes = graph.build(paths=paths, revision=revision)
siblings_ = set(nodes)
for node in nodes:
siblings_ |= graph.siblings(node)
paths = {node.path for node in siblings_}
for path in pat... | python | def siblings(client, revision, paths):
"""Show siblings for given paths."""
graph = Graph(client)
nodes = graph.build(paths=paths, revision=revision)
siblings_ = set(nodes)
for node in nodes:
siblings_ |= graph.siblings(node)
paths = {node.path for node in siblings_}
for path in pat... | [
"def",
"siblings",
"(",
"client",
",",
"revision",
",",
"paths",
")",
":",
"graph",
"=",
"Graph",
"(",
"client",
")",
"nodes",
"=",
"graph",
".",
"build",
"(",
"paths",
"=",
"paths",
",",
"revision",
"=",
"revision",
")",
"siblings_",
"=",
"set",
"("... | Show siblings for given paths. | [
"Show",
"siblings",
"for",
"given",
"paths",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/show.py#L90-L100 |
SwissDataScienceCenter/renku-python | renku/cli/show.py | inputs | def inputs(ctx, client, revision, paths):
r"""Show inputs files in the repository.
<PATHS> Files to show. If no files are given all input files are shown.
"""
from renku.models.provenance import ProcessRun
graph = Graph(client)
paths = set(paths)
nodes = graph.build(revision=revision)
... | python | def inputs(ctx, client, revision, paths):
r"""Show inputs files in the repository.
<PATHS> Files to show. If no files are given all input files are shown.
"""
from renku.models.provenance import ProcessRun
graph = Graph(client)
paths = set(paths)
nodes = graph.build(revision=revision)
... | [
"def",
"inputs",
"(",
"ctx",
",",
"client",
",",
"revision",
",",
"paths",
")",
":",
"from",
"renku",
".",
"models",
".",
"provenance",
"import",
"ProcessRun",
"graph",
"=",
"Graph",
"(",
"client",
")",
"paths",
"=",
"set",
"(",
"paths",
")",
"nodes",
... | r"""Show inputs files in the repository.
<PATHS> Files to show. If no files are given all input files are shown. | [
"r",
"Show",
"inputs",
"files",
"in",
"the",
"repository",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/show.py#L112-L144 |
SwissDataScienceCenter/renku-python | renku/cli/show.py | outputs | def outputs(ctx, client, revision, paths):
r"""Show output files in the repository.
<PATHS> Files to show. If no files are given all output files are shown.
"""
graph = Graph(client)
filter = graph.build(paths=paths, revision=revision)
output_paths = graph.output_paths
click.echo('\n'.j... | python | def outputs(ctx, client, revision, paths):
r"""Show output files in the repository.
<PATHS> Files to show. If no files are given all output files are shown.
"""
graph = Graph(client)
filter = graph.build(paths=paths, revision=revision)
output_paths = graph.output_paths
click.echo('\n'.j... | [
"def",
"outputs",
"(",
"ctx",
",",
"client",
",",
"revision",
",",
"paths",
")",
":",
"graph",
"=",
"Graph",
"(",
"client",
")",
"filter",
"=",
"graph",
".",
"build",
"(",
"paths",
"=",
"paths",
",",
"revision",
"=",
"revision",
")",
"output_paths",
... | r"""Show output files in the repository.
<PATHS> Files to show. If no files are given all output files are shown. | [
"r",
"Show",
"output",
"files",
"in",
"the",
"repository",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/show.py#L156-L177 |
SwissDataScienceCenter/renku-python | renku/cli/show.py | _context_names | def _context_names():
"""Return list of valid context names."""
import inspect
from renku.models import provenance
from renku.models._jsonld import JSONLDMixin
for name in dir(provenance):
cls = getattr(provenance, name)
if inspect.isclass(cls) and issubclass(cls, JSONLDMixin):
... | python | def _context_names():
"""Return list of valid context names."""
import inspect
from renku.models import provenance
from renku.models._jsonld import JSONLDMixin
for name in dir(provenance):
cls = getattr(provenance, name)
if inspect.isclass(cls) and issubclass(cls, JSONLDMixin):
... | [
"def",
"_context_names",
"(",
")",
":",
"import",
"inspect",
"from",
"renku",
".",
"models",
"import",
"provenance",
"from",
"renku",
".",
"models",
".",
"_jsonld",
"import",
"JSONLDMixin",
"for",
"name",
"in",
"dir",
"(",
"provenance",
")",
":",
"cls",
"=... | Return list of valid context names. | [
"Return",
"list",
"of",
"valid",
"context",
"names",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/show.py#L180-L190 |
SwissDataScienceCenter/renku-python | renku/cli/show.py | print_context_names | def print_context_names(ctx, param, value):
"""Print all possible types."""
if not value or ctx.resilient_parsing:
return
click.echo('\n'.join(_context_names()))
ctx.exit() | python | def print_context_names(ctx, param, value):
"""Print all possible types."""
if not value or ctx.resilient_parsing:
return
click.echo('\n'.join(_context_names()))
ctx.exit() | [
"def",
"print_context_names",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"if",
"not",
"value",
"or",
"ctx",
".",
"resilient_parsing",
":",
"return",
"click",
".",
"echo",
"(",
"'\\n'",
".",
"join",
"(",
"_context_names",
"(",
")",
")",
")",
"ctx... | Print all possible types. | [
"Print",
"all",
"possible",
"types",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/show.py#L193-L198 |
SwissDataScienceCenter/renku-python | renku/cli/show.py | _context_json | def _context_json(name):
"""Return JSON-LD string for given context name."""
from renku.models import provenance
cls = getattr(provenance, name)
return {
'@context': cls._jsonld_context,
'@type': cls._jsonld_type,
} | python | def _context_json(name):
"""Return JSON-LD string for given context name."""
from renku.models import provenance
cls = getattr(provenance, name)
return {
'@context': cls._jsonld_context,
'@type': cls._jsonld_type,
} | [
"def",
"_context_json",
"(",
"name",
")",
":",
"from",
"renku",
".",
"models",
"import",
"provenance",
"cls",
"=",
"getattr",
"(",
"provenance",
",",
"name",
")",
"return",
"{",
"'@context'",
":",
"cls",
".",
"_jsonld_context",
",",
"'@type'",
":",
"cls",
... | Return JSON-LD string for given context name. | [
"Return",
"JSON",
"-",
"LD",
"string",
"for",
"given",
"context",
"name",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/show.py#L201-L209 |
SwissDataScienceCenter/renku-python | renku/cli/show.py | context | def context(names):
"""Show JSON-LD context for repository objects."""
import json
contexts = [_context_json(name) for name in set(names)]
if contexts:
click.echo(
json.dumps(
contexts[0] if len(contexts) == 1 else contexts,
indent=2,
)
... | python | def context(names):
"""Show JSON-LD context for repository objects."""
import json
contexts = [_context_json(name) for name in set(names)]
if contexts:
click.echo(
json.dumps(
contexts[0] if len(contexts) == 1 else contexts,
indent=2,
)
... | [
"def",
"context",
"(",
"names",
")",
":",
"import",
"json",
"contexts",
"=",
"[",
"_context_json",
"(",
"name",
")",
"for",
"name",
"in",
"set",
"(",
"names",
")",
"]",
"if",
"contexts",
":",
"click",
".",
"echo",
"(",
"json",
".",
"dumps",
"(",
"c... | Show JSON-LD context for repository objects. | [
"Show",
"JSON",
"-",
"LD",
"context",
"for",
"repository",
"objects",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/show.py#L226-L237 |
SwissDataScienceCenter/renku-python | renku/cli/workflow.py | workflow | def workflow(ctx, client):
"""List or manage workflows with subcommands."""
if ctx.invoked_subcommand is None:
from renku.models.refs import LinkReference
names = defaultdict(list)
for ref in LinkReference.iter_items(client, common_path='workflows'):
names[ref.reference.name... | python | def workflow(ctx, client):
"""List or manage workflows with subcommands."""
if ctx.invoked_subcommand is None:
from renku.models.refs import LinkReference
names = defaultdict(list)
for ref in LinkReference.iter_items(client, common_path='workflows'):
names[ref.reference.name... | [
"def",
"workflow",
"(",
"ctx",
",",
"client",
")",
":",
"if",
"ctx",
".",
"invoked_subcommand",
"is",
"None",
":",
"from",
"renku",
".",
"models",
".",
"refs",
"import",
"LinkReference",
"names",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"ref",
"in",
... | List or manage workflows with subcommands. | [
"List",
"or",
"manage",
"workflows",
"with",
"subcommands",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/workflow.py#L59-L77 |
SwissDataScienceCenter/renku-python | renku/cli/workflow.py | validate_path | def validate_path(ctx, param, value):
"""Detect a workflow path if it is not passed."""
client = ctx.obj
if value is None:
from renku.models.provenance import ProcessRun
activity = client.process_commit()
if not isinstance(activity, ProcessRun):
raise click.BadParameter... | python | def validate_path(ctx, param, value):
"""Detect a workflow path if it is not passed."""
client = ctx.obj
if value is None:
from renku.models.provenance import ProcessRun
activity = client.process_commit()
if not isinstance(activity, ProcessRun):
raise click.BadParameter... | [
"def",
"validate_path",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"client",
"=",
"ctx",
".",
"obj",
"if",
"value",
"is",
"None",
":",
"from",
"renku",
".",
"models",
".",
"provenance",
"import",
"ProcessRun",
"activity",
"=",
"client",
".",
"pr... | Detect a workflow path if it is not passed. | [
"Detect",
"a",
"workflow",
"path",
"if",
"it",
"is",
"not",
"passed",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/workflow.py#L80-L93 |
SwissDataScienceCenter/renku-python | renku/cli/workflow.py | set_name | def set_name(client, name, path, force):
"""Sets the <name> for remote <path>."""
from renku.models.refs import LinkReference
LinkReference.create(client=client, name=_ref(name),
force=force).set_reference(path) | python | def set_name(client, name, path, force):
"""Sets the <name> for remote <path>."""
from renku.models.refs import LinkReference
LinkReference.create(client=client, name=_ref(name),
force=force).set_reference(path) | [
"def",
"set_name",
"(",
"client",
",",
"name",
",",
"path",
",",
"force",
")",
":",
"from",
"renku",
".",
"models",
".",
"refs",
"import",
"LinkReference",
"LinkReference",
".",
"create",
"(",
"client",
"=",
"client",
",",
"name",
"=",
"_ref",
"(",
"na... | Sets the <name> for remote <path>. | [
"Sets",
"the",
"<name",
">",
"for",
"remote",
"<path",
">",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/workflow.py#L108-L112 |
SwissDataScienceCenter/renku-python | renku/cli/workflow.py | rename | def rename(client, old, new, force):
"""Rename the workflow named <old> to <new>."""
from renku.models.refs import LinkReference
LinkReference(client=client, name=_ref(old)).rename(_ref(new), force=force) | python | def rename(client, old, new, force):
"""Rename the workflow named <old> to <new>."""
from renku.models.refs import LinkReference
LinkReference(client=client, name=_ref(old)).rename(_ref(new), force=force) | [
"def",
"rename",
"(",
"client",
",",
"old",
",",
"new",
",",
"force",
")",
":",
"from",
"renku",
".",
"models",
".",
"refs",
"import",
"LinkReference",
"LinkReference",
"(",
"client",
"=",
"client",
",",
"name",
"=",
"_ref",
"(",
"old",
")",
")",
"."... | Rename the workflow named <old> to <new>. | [
"Rename",
"the",
"workflow",
"named",
"<old",
">",
"to",
"<new",
">",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/workflow.py#L120-L123 |
SwissDataScienceCenter/renku-python | renku/cli/workflow.py | remove | def remove(client, name):
"""Remove the remote named <name>."""
from renku.models.refs import LinkReference
LinkReference(client=client, name=_ref(name)).delete() | python | def remove(client, name):
"""Remove the remote named <name>."""
from renku.models.refs import LinkReference
LinkReference(client=client, name=_ref(name)).delete() | [
"def",
"remove",
"(",
"client",
",",
"name",
")",
":",
"from",
"renku",
".",
"models",
".",
"refs",
"import",
"LinkReference",
"LinkReference",
"(",
"client",
"=",
"client",
",",
"name",
"=",
"_ref",
"(",
"name",
")",
")",
".",
"delete",
"(",
")"
] | Remove the remote named <name>. | [
"Remove",
"the",
"remote",
"named",
"<name",
">",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/workflow.py#L129-L132 |
SwissDataScienceCenter/renku-python | renku/cli/workflow.py | create | def create(client, output_file, revision, paths):
"""Create a workflow description for a file."""
graph = Graph(client)
outputs = graph.build(paths=paths, revision=revision)
output_file.write(
yaml.dump(
ascwl(
graph.ascwl(outputs=outputs),
filter=lam... | python | def create(client, output_file, revision, paths):
"""Create a workflow description for a file."""
graph = Graph(client)
outputs = graph.build(paths=paths, revision=revision)
output_file.write(
yaml.dump(
ascwl(
graph.ascwl(outputs=outputs),
filter=lam... | [
"def",
"create",
"(",
"client",
",",
"output_file",
",",
"revision",
",",
"paths",
")",
":",
"graph",
"=",
"Graph",
"(",
"client",
")",
"outputs",
"=",
"graph",
".",
"build",
"(",
"paths",
"=",
"paths",
",",
"revision",
"=",
"revision",
")",
"output_fi... | Create a workflow description for a file. | [
"Create",
"a",
"workflow",
"description",
"for",
"a",
"file",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/workflow.py#L147-L162 |
SwissDataScienceCenter/renku-python | renku/cli/endpoint.py | endpoint | def endpoint(ctx, config, verbose):
"""Manage set of platform API endpoints."""
if ctx.invoked_subcommand is None:
# TODO default_endpoint = config.get('core', {}).get('default')
for endpoint, values in config.get('endpoints', {}).items():
# TODO is_default = default_endpoint == endp... | python | def endpoint(ctx, config, verbose):
"""Manage set of platform API endpoints."""
if ctx.invoked_subcommand is None:
# TODO default_endpoint = config.get('core', {}).get('default')
for endpoint, values in config.get('endpoints', {}).items():
# TODO is_default = default_endpoint == endp... | [
"def",
"endpoint",
"(",
"ctx",
",",
"config",
",",
"verbose",
")",
":",
"if",
"ctx",
".",
"invoked_subcommand",
"is",
"None",
":",
"# TODO default_endpoint = config.get('core', {}).get('default')",
"for",
"endpoint",
",",
"values",
"in",
"config",
".",
"get",
"(",... | Manage set of platform API endpoints. | [
"Manage",
"set",
"of",
"platform",
"API",
"endpoints",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/endpoint.py#L30-L43 |
SwissDataScienceCenter/renku-python | renku/_contexts.py | _wrap_path_or_stream | def _wrap_path_or_stream(method, mode): # noqa: D202
"""Open path with context or close stream at the end."""
def decorator(path_or_stream):
"""Open the path if needed."""
if isinstance(path_or_stream, (str, Path)):
return method(Path(path_or_stream).open(mode))
return meth... | python | def _wrap_path_or_stream(method, mode): # noqa: D202
"""Open path with context or close stream at the end."""
def decorator(path_or_stream):
"""Open the path if needed."""
if isinstance(path_or_stream, (str, Path)):
return method(Path(path_or_stream).open(mode))
return meth... | [
"def",
"_wrap_path_or_stream",
"(",
"method",
",",
"mode",
")",
":",
"# noqa: D202",
"def",
"decorator",
"(",
"path_or_stream",
")",
":",
"\"\"\"Open the path if needed.\"\"\"",
"if",
"isinstance",
"(",
"path_or_stream",
",",
"(",
"str",
",",
"Path",
")",
")",
"... | Open path with context or close stream at the end. | [
"Open",
"path",
"with",
"context",
"or",
"close",
"stream",
"at",
"the",
"end",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/_contexts.py#L60-L69 |
SwissDataScienceCenter/renku-python | renku/cli/doctor.py | doctor | def doctor(ctx, client):
"""Check your system and repository for potential problems."""
click.secho('\n'.join(textwrap.wrap(DOCTOR_INFO)) + '\n', bold=True)
from . import _checks
is_ok = True
for attr in _checks.__all__:
is_ok &= getattr(_checks, attr)(client)
if is_ok:
click.... | python | def doctor(ctx, client):
"""Check your system and repository for potential problems."""
click.secho('\n'.join(textwrap.wrap(DOCTOR_INFO)) + '\n', bold=True)
from . import _checks
is_ok = True
for attr in _checks.__all__:
is_ok &= getattr(_checks, attr)(client)
if is_ok:
click.... | [
"def",
"doctor",
"(",
"ctx",
",",
"client",
")",
":",
"click",
".",
"secho",
"(",
"'\\n'",
".",
"join",
"(",
"textwrap",
".",
"wrap",
"(",
"DOCTOR_INFO",
")",
")",
"+",
"'\\n'",
",",
"bold",
"=",
"True",
")",
"from",
".",
"import",
"_checks",
"is_o... | Check your system and repository for potential problems. | [
"Check",
"your",
"system",
"and",
"repository",
"for",
"potential",
"problems",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/doctor.py#L36-L49 |
SwissDataScienceCenter/renku-python | renku/models/projects.py | ProjectCollection.create | def create(self, name=None, **kwargs):
"""Create a new project.
:param name: The name of the project.
:returns: An instance of the newly create project.
:rtype: renku.models.projects.Project
"""
data = self._client.api.create_project({'name': name})
return self.M... | python | def create(self, name=None, **kwargs):
"""Create a new project.
:param name: The name of the project.
:returns: An instance of the newly create project.
:rtype: renku.models.projects.Project
"""
data = self._client.api.create_project({'name': name})
return self.M... | [
"def",
"create",
"(",
"self",
",",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"_client",
".",
"api",
".",
"create_project",
"(",
"{",
"'name'",
":",
"name",
"}",
")",
"return",
"self",
".",
"Meta",
".",
"mod... | Create a new project.
:param name: The name of the project.
:returns: An instance of the newly create project.
:rtype: renku.models.projects.Project | [
"Create",
"a",
"new",
"project",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/projects.py#L74-L82 |
stephenmcd/django-email-extras | email_extras/forms.py | KeyForm.clean_key | def clean_key(self):
"""
Validate the key contains an email address.
"""
key = self.cleaned_data["key"]
gpg = GPG(gnupghome=GNUPG_HOME)
result = gpg.import_keys(key)
if result.count == 0:
raise forms.ValidationError(_("Invalid Key"))
return key | python | def clean_key(self):
"""
Validate the key contains an email address.
"""
key = self.cleaned_data["key"]
gpg = GPG(gnupghome=GNUPG_HOME)
result = gpg.import_keys(key)
if result.count == 0:
raise forms.ValidationError(_("Invalid Key"))
return key | [
"def",
"clean_key",
"(",
"self",
")",
":",
"key",
"=",
"self",
".",
"cleaned_data",
"[",
"\"key\"",
"]",
"gpg",
"=",
"GPG",
"(",
"gnupghome",
"=",
"GNUPG_HOME",
")",
"result",
"=",
"gpg",
".",
"import_keys",
"(",
"key",
")",
"if",
"result",
".",
"cou... | Validate the key contains an email address. | [
"Validate",
"the",
"key",
"contains",
"an",
"email",
"address",
"."
] | train | https://github.com/stephenmcd/django-email-extras/blob/8399792998cee84810be2b315dd9b51b200f9218/email_extras/forms.py#L13-L22 |
SwissDataScienceCenter/renku-python | renku/models/_datastructures.py | DirectoryTree.from_list | def from_list(cls, values):
"""Construct a tree from a list with paths."""
self = cls()
for value in values:
self.add(value)
return self | python | def from_list(cls, values):
"""Construct a tree from a list with paths."""
self = cls()
for value in values:
self.add(value)
return self | [
"def",
"from_list",
"(",
"cls",
",",
"values",
")",
":",
"self",
"=",
"cls",
"(",
")",
"for",
"value",
"in",
"values",
":",
"self",
".",
"add",
"(",
"value",
")",
"return",
"self"
] | Construct a tree from a list with paths. | [
"Construct",
"a",
"tree",
"from",
"a",
"list",
"with",
"paths",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_datastructures.py#L198-L203 |
SwissDataScienceCenter/renku-python | renku/models/_datastructures.py | DirectoryTree.get | def get(self, value, default=None):
"""Return a subtree if exists."""
path = value if isinstance(value, Path) else Path(str(value))
subtree = self
for part in path.parts:
try:
subtree = subtree[part]
except KeyError:
return default
... | python | def get(self, value, default=None):
"""Return a subtree if exists."""
path = value if isinstance(value, Path) else Path(str(value))
subtree = self
for part in path.parts:
try:
subtree = subtree[part]
except KeyError:
return default
... | [
"def",
"get",
"(",
"self",
",",
"value",
",",
"default",
"=",
"None",
")",
":",
"path",
"=",
"value",
"if",
"isinstance",
"(",
"value",
",",
"Path",
")",
"else",
"Path",
"(",
"str",
"(",
"value",
")",
")",
"subtree",
"=",
"self",
"for",
"part",
"... | Return a subtree if exists. | [
"Return",
"a",
"subtree",
"if",
"exists",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_datastructures.py#L205-L214 |
SwissDataScienceCenter/renku-python | renku/models/_datastructures.py | DirectoryTree.add | def add(self, value):
"""Create a safe directory from a value."""
path = value if isinstance(value, Path) else Path(str(value))
if path and path != path.parent:
destination = self
for part in path.parts:
destination = destination.setdefault(part, Directory... | python | def add(self, value):
"""Create a safe directory from a value."""
path = value if isinstance(value, Path) else Path(str(value))
if path and path != path.parent:
destination = self
for part in path.parts:
destination = destination.setdefault(part, Directory... | [
"def",
"add",
"(",
"self",
",",
"value",
")",
":",
"path",
"=",
"value",
"if",
"isinstance",
"(",
"value",
",",
"Path",
")",
"else",
"Path",
"(",
"str",
"(",
"value",
")",
")",
"if",
"path",
"and",
"path",
"!=",
"path",
".",
"parent",
":",
"desti... | Create a safe directory from a value. | [
"Create",
"a",
"safe",
"directory",
"from",
"a",
"value",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/models/_datastructures.py#L216-L222 |
SwissDataScienceCenter/renku-python | renku/cli/_options.py | default_endpoint_from_config | def default_endpoint_from_config(config, option=None):
"""Return a default endpoint."""
default_endpoint = config.get('core', {}).get('default')
project_endpoint = config.get('project',
{}).get('core',
{}).get('default', default_end... | python | def default_endpoint_from_config(config, option=None):
"""Return a default endpoint."""
default_endpoint = config.get('core', {}).get('default')
project_endpoint = config.get('project',
{}).get('core',
{}).get('default', default_end... | [
"def",
"default_endpoint_from_config",
"(",
"config",
",",
"option",
"=",
"None",
")",
":",
"default_endpoint",
"=",
"config",
".",
"get",
"(",
"'core'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'default'",
")",
"project_endpoint",
"=",
"config",
".",
"get",
... | Return a default endpoint. | [
"Return",
"a",
"default",
"endpoint",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_options.py#L37-L48 |
SwissDataScienceCenter/renku-python | renku/cli/_options.py | password_prompt | def password_prompt(ctx, param, value):
"""Prompt for password if ``--password-stdin`` is not used."""
if ctx.resilient_parsing:
return
if not value:
if 'password_stdin' in ctx.params:
with click.open_file('-') as fp:
value = fp.read().strip('\n')
else:
... | python | def password_prompt(ctx, param, value):
"""Prompt for password if ``--password-stdin`` is not used."""
if ctx.resilient_parsing:
return
if not value:
if 'password_stdin' in ctx.params:
with click.open_file('-') as fp:
value = fp.read().strip('\n')
else:
... | [
"def",
"password_prompt",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"if",
"ctx",
".",
"resilient_parsing",
":",
"return",
"if",
"not",
"value",
":",
"if",
"'password_stdin'",
"in",
"ctx",
".",
"params",
":",
"with",
"click",
".",
"open_file",
"("... | Prompt for password if ``--password-stdin`` is not used. | [
"Prompt",
"for",
"password",
"if",
"--",
"password",
"-",
"stdin",
"is",
"not",
"used",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_options.py#L51-L64 |
SwissDataScienceCenter/renku-python | renku/cli/_options.py | install_completion | def install_completion(ctx, attr, value): # pragma: no cover
"""Install completion for the current shell."""
import click_completion.core
if not value or ctx.resilient_parsing:
return value
shell, path = click_completion.core.install()
click.secho(
'{0} completion installed in {1}... | python | def install_completion(ctx, attr, value): # pragma: no cover
"""Install completion for the current shell."""
import click_completion.core
if not value or ctx.resilient_parsing:
return value
shell, path = click_completion.core.install()
click.secho(
'{0} completion installed in {1}... | [
"def",
"install_completion",
"(",
"ctx",
",",
"attr",
",",
"value",
")",
":",
"# pragma: no cover",
"import",
"click_completion",
".",
"core",
"if",
"not",
"value",
"or",
"ctx",
".",
"resilient_parsing",
":",
"return",
"value",
"shell",
",",
"path",
"=",
"cl... | Install completion for the current shell. | [
"Install",
"completion",
"for",
"the",
"current",
"shell",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_options.py#L67-L78 |
SwissDataScienceCenter/renku-python | renku/cli/_options.py | default_endpoint | def default_endpoint(ctx, param, value):
"""Return default endpoint if specified."""
if ctx.resilient_parsing:
return
config = ctx.obj['config']
endpoint = default_endpoint_from_config(config, option=value)
if endpoint is None:
raise click.UsageError('No default endpoint found.')
... | python | def default_endpoint(ctx, param, value):
"""Return default endpoint if specified."""
if ctx.resilient_parsing:
return
config = ctx.obj['config']
endpoint = default_endpoint_from_config(config, option=value)
if endpoint is None:
raise click.UsageError('No default endpoint found.')
... | [
"def",
"default_endpoint",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"if",
"ctx",
".",
"resilient_parsing",
":",
"return",
"config",
"=",
"ctx",
".",
"obj",
"[",
"'config'",
"]",
"endpoint",
"=",
"default_endpoint_from_config",
"(",
"config",
",",
... | Return default endpoint if specified. | [
"Return",
"default",
"endpoint",
"if",
"specified",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_options.py#L81-L92 |
SwissDataScienceCenter/renku-python | renku/cli/_options.py | validate_endpoint | def validate_endpoint(ctx, param, value):
"""Validate endpoint."""
try:
config = ctx.obj['config']
except Exception:
return
endpoint = default_endpoint(ctx, param, value)
if endpoint not in config.get('endpoints', {}):
raise click.UsageError('Unknown endpoint: {0}'.format(e... | python | def validate_endpoint(ctx, param, value):
"""Validate endpoint."""
try:
config = ctx.obj['config']
except Exception:
return
endpoint = default_endpoint(ctx, param, value)
if endpoint not in config.get('endpoints', {}):
raise click.UsageError('Unknown endpoint: {0}'.format(e... | [
"def",
"validate_endpoint",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"try",
":",
"config",
"=",
"ctx",
".",
"obj",
"[",
"'config'",
"]",
"except",
"Exception",
":",
"return",
"endpoint",
"=",
"default_endpoint",
"(",
"ctx",
",",
"param",
",",
... | Validate endpoint. | [
"Validate",
"endpoint",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_options.py#L95-L107 |
SwissDataScienceCenter/renku-python | renku/cli/_options.py | check_siblings | def check_siblings(graph, outputs):
"""Check that all outputs have their siblings listed."""
siblings = set()
for node in outputs:
siblings |= graph.siblings(node)
siblings = {node.path for node in siblings}
missing = siblings - {node.path for node in outputs}
if missing:
msg =... | python | def check_siblings(graph, outputs):
"""Check that all outputs have their siblings listed."""
siblings = set()
for node in outputs:
siblings |= graph.siblings(node)
siblings = {node.path for node in siblings}
missing = siblings - {node.path for node in outputs}
if missing:
msg =... | [
"def",
"check_siblings",
"(",
"graph",
",",
"outputs",
")",
":",
"siblings",
"=",
"set",
"(",
")",
"for",
"node",
"in",
"outputs",
":",
"siblings",
"|=",
"graph",
".",
"siblings",
"(",
"node",
")",
"siblings",
"=",
"{",
"node",
".",
"path",
"for",
"n... | Check that all outputs have their siblings listed. | [
"Check",
"that",
"all",
"outputs",
"have",
"their",
"siblings",
"listed",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_options.py#L131-L152 |
SwissDataScienceCenter/renku-python | renku/cli/_options.py | with_siblings | def with_siblings(graph, outputs):
"""Include all missing siblings."""
siblings = set()
for node in outputs:
siblings |= graph.siblings(node)
return siblings | python | def with_siblings(graph, outputs):
"""Include all missing siblings."""
siblings = set()
for node in outputs:
siblings |= graph.siblings(node)
return siblings | [
"def",
"with_siblings",
"(",
"graph",
",",
"outputs",
")",
":",
"siblings",
"=",
"set",
"(",
")",
"for",
"node",
"in",
"outputs",
":",
"siblings",
"|=",
"graph",
".",
"siblings",
"(",
"node",
")",
"return",
"siblings"
] | Include all missing siblings. | [
"Include",
"all",
"missing",
"siblings",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_options.py#L155-L160 |
SwissDataScienceCenter/renku-python | renku/cli/_echo.py | echo_via_pager | def echo_via_pager(*args, **kwargs):
"""Display pager only if it does not fit in one terminal screen.
NOTE: The feature is available only on ``less``-based pager.
"""
try:
restore = 'LESS' not in os.environ
os.environ.setdefault('LESS', '-iXFR')
click.echo_via_pager(*args, **kwa... | python | def echo_via_pager(*args, **kwargs):
"""Display pager only if it does not fit in one terminal screen.
NOTE: The feature is available only on ``less``-based pager.
"""
try:
restore = 'LESS' not in os.environ
os.environ.setdefault('LESS', '-iXFR')
click.echo_via_pager(*args, **kwa... | [
"def",
"echo_via_pager",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"restore",
"=",
"'LESS'",
"not",
"in",
"os",
".",
"environ",
"os",
".",
"environ",
".",
"setdefault",
"(",
"'LESS'",
",",
"'-iXFR'",
")",
"click",
".",
"echo_vi... | Display pager only if it does not fit in one terminal screen.
NOTE: The feature is available only on ``less``-based pager. | [
"Display",
"pager",
"only",
"if",
"it",
"does",
"not",
"fit",
"in",
"one",
"terminal",
"screen",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_echo.py#L28-L39 |
SwissDataScienceCenter/renku-python | renku/cli/_group.py | OptionalGroup.parse_args | def parse_args(self, ctx, args):
"""Check if the first argument is an existing command."""
if args and args[0] in self.commands:
args.insert(0, '')
super(OptionalGroup, self).parse_args(ctx, args) | python | def parse_args(self, ctx, args):
"""Check if the first argument is an existing command."""
if args and args[0] in self.commands:
args.insert(0, '')
super(OptionalGroup, self).parse_args(ctx, args) | [
"def",
"parse_args",
"(",
"self",
",",
"ctx",
",",
"args",
")",
":",
"if",
"args",
"and",
"args",
"[",
"0",
"]",
"in",
"self",
".",
"commands",
":",
"args",
".",
"insert",
"(",
"0",
",",
"''",
")",
"super",
"(",
"OptionalGroup",
",",
"self",
")",... | Check if the first argument is an existing command. | [
"Check",
"if",
"the",
"first",
"argument",
"is",
"an",
"existing",
"command",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_group.py#L26-L30 |
SwissDataScienceCenter/renku-python | renku/cli/_cwl.py | execute | def execute(client, output_file, output_paths=None):
"""Run the generated workflow using cwltool library."""
output_paths = output_paths or set()
import cwltool.factory
from cwltool import workflow
from cwltool.context import LoadingContext, RuntimeContext
from cwltool.utils import visit_class
... | python | def execute(client, output_file, output_paths=None):
"""Run the generated workflow using cwltool library."""
output_paths = output_paths or set()
import cwltool.factory
from cwltool import workflow
from cwltool.context import LoadingContext, RuntimeContext
from cwltool.utils import visit_class
... | [
"def",
"execute",
"(",
"client",
",",
"output_file",
",",
"output_paths",
"=",
"None",
")",
":",
"output_paths",
"=",
"output_paths",
"or",
"set",
"(",
")",
"import",
"cwltool",
".",
"factory",
"from",
"cwltool",
"import",
"workflow",
"from",
"cwltool",
".",... | Run the generated workflow using cwltool library. | [
"Run",
"the",
"generated",
"workflow",
"using",
"cwltool",
"library",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_cwl.py#L29-L113 |
SwissDataScienceCenter/renku-python | renku/cli/image.py | pull | def pull(client, revision, auto_login):
"""Pull an existing image from the project registry."""
registry_url = detect_registry_url(client, auto_login=auto_login)
repo = client.repo
sha = repo.rev_parse(revision).hexsha
short_sha = repo.git.rev_parse(sha, short=7)
image = '{registry}:{short_sha... | python | def pull(client, revision, auto_login):
"""Pull an existing image from the project registry."""
registry_url = detect_registry_url(client, auto_login=auto_login)
repo = client.repo
sha = repo.rev_parse(revision).hexsha
short_sha = repo.git.rev_parse(sha, short=7)
image = '{registry}:{short_sha... | [
"def",
"pull",
"(",
"client",
",",
"revision",
",",
"auto_login",
")",
":",
"registry_url",
"=",
"detect_registry_url",
"(",
"client",
",",
"auto_login",
"=",
"auto_login",
")",
"repo",
"=",
"client",
".",
"repo",
"sha",
"=",
"repo",
".",
"rev_parse",
"(",... | Pull an existing image from the project registry. | [
"Pull",
"an",
"existing",
"image",
"from",
"the",
"project",
"registry",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/image.py#L90-L108 |
SwissDataScienceCenter/renku-python | renku/cli/_format/dataset_files.py | tabular | def tabular(client, records):
"""Format dataset files with a tabular output.
:param client: LocalClient instance.
:param records: Filtered collection.
"""
from renku.models._tabulate import tabulate
echo_via_pager(
tabulate(
records,
headers=OrderedDict((
... | python | def tabular(client, records):
"""Format dataset files with a tabular output.
:param client: LocalClient instance.
:param records: Filtered collection.
"""
from renku.models._tabulate import tabulate
echo_via_pager(
tabulate(
records,
headers=OrderedDict((
... | [
"def",
"tabular",
"(",
"client",
",",
"records",
")",
":",
"from",
"renku",
".",
"models",
".",
"_tabulate",
"import",
"tabulate",
"echo_via_pager",
"(",
"tabulate",
"(",
"records",
",",
"headers",
"=",
"OrderedDict",
"(",
"(",
"(",
"'added'",
",",
"None",... | Format dataset files with a tabular output.
:param client: LocalClient instance.
:param records: Filtered collection. | [
"Format",
"dataset",
"files",
"with",
"a",
"tabular",
"output",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_format/dataset_files.py#L25-L43 |
SwissDataScienceCenter/renku-python | renku/cli/_format/dataset_files.py | jsonld | def jsonld(client, records):
"""Format dataset files as JSON-LD.
:param client: LocalClient instance.
:param records: Filtered collection.
"""
from renku.models._json import dumps
from renku.models._jsonld import asjsonld
data = [asjsonld(record) for record in records]
echo_via_pager(d... | python | def jsonld(client, records):
"""Format dataset files as JSON-LD.
:param client: LocalClient instance.
:param records: Filtered collection.
"""
from renku.models._json import dumps
from renku.models._jsonld import asjsonld
data = [asjsonld(record) for record in records]
echo_via_pager(d... | [
"def",
"jsonld",
"(",
"client",
",",
"records",
")",
":",
"from",
"renku",
".",
"models",
".",
"_json",
"import",
"dumps",
"from",
"renku",
".",
"models",
".",
"_jsonld",
"import",
"asjsonld",
"data",
"=",
"[",
"asjsonld",
"(",
"record",
")",
"for",
"r... | Format dataset files as JSON-LD.
:param client: LocalClient instance.
:param records: Filtered collection. | [
"Format",
"dataset",
"files",
"as",
"JSON",
"-",
"LD",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_format/dataset_files.py#L46-L56 |
SwissDataScienceCenter/renku-python | renku/cli/_exc.py | IssueFromTraceback.main | def main(self, *args, **kwargs):
"""Catch all exceptions."""
try:
result = super().main(*args, **kwargs)
return result
except Exception:
if HAS_SENTRY:
self._handle_sentry()
if not (sys.stdin.isatty() and sys.stdout.isatty()):
... | python | def main(self, *args, **kwargs):
"""Catch all exceptions."""
try:
result = super().main(*args, **kwargs)
return result
except Exception:
if HAS_SENTRY:
self._handle_sentry()
if not (sys.stdin.isatty() and sys.stdout.isatty()):
... | [
"def",
"main",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"result",
"=",
"super",
"(",
")",
".",
"main",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"result",
"except",
"Exception",
":",
"if",
"H... | Catch all exceptions. | [
"Catch",
"all",
"exceptions",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_exc.py#L97-L109 |
SwissDataScienceCenter/renku-python | renku/cli/_exc.py | IssueFromTraceback._handle_sentry | def _handle_sentry(self):
"""Handle exceptions using Sentry."""
from sentry_sdk import capture_exception, configure_scope
from sentry_sdk.utils import capture_internal_exceptions
with configure_scope() as scope:
with capture_internal_exceptions():
from git im... | python | def _handle_sentry(self):
"""Handle exceptions using Sentry."""
from sentry_sdk import capture_exception, configure_scope
from sentry_sdk.utils import capture_internal_exceptions
with configure_scope() as scope:
with capture_internal_exceptions():
from git im... | [
"def",
"_handle_sentry",
"(",
"self",
")",
":",
"from",
"sentry_sdk",
"import",
"capture_exception",
",",
"configure_scope",
"from",
"sentry_sdk",
".",
"utils",
"import",
"capture_internal_exceptions",
"with",
"configure_scope",
"(",
")",
"as",
"scope",
":",
"with",... | Handle exceptions using Sentry. | [
"Handle",
"exceptions",
"using",
"Sentry",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_exc.py#L111-L131 |
SwissDataScienceCenter/renku-python | renku/cli/_exc.py | IssueFromTraceback._handle_github | def _handle_github(self):
"""Handle exception and submit it as GitHub issue."""
value = click.prompt(
_BUG + click.style(
'1. Open an issue by typing "open";\n',
fg='green',
) + click.style(
'2. Print human-readable information by t... | python | def _handle_github(self):
"""Handle exception and submit it as GitHub issue."""
value = click.prompt(
_BUG + click.style(
'1. Open an issue by typing "open";\n',
fg='green',
) + click.style(
'2. Print human-readable information by t... | [
"def",
"_handle_github",
"(",
"self",
")",
":",
"value",
"=",
"click",
".",
"prompt",
"(",
"_BUG",
"+",
"click",
".",
"style",
"(",
"'1. Open an issue by typing \"open\";\\n'",
",",
"fg",
"=",
"'green'",
",",
")",
"+",
"click",
".",
"style",
"(",
"'2. Prin... | Handle exception and submit it as GitHub issue. | [
"Handle",
"exception",
"and",
"submit",
"it",
"as",
"GitHub",
"issue",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_exc.py#L133-L155 |
SwissDataScienceCenter/renku-python | renku/cli/_exc.py | IssueFromTraceback._format_issue_body | def _format_issue_body(self, limit=-5):
"""Return formatted body."""
from renku import __version__
re_paths = r'(' + r'|'.join([path or os.getcwd()
for path in sys.path]) + r')'
tb = re.sub(re_paths, '[...]', traceback.format_exc(limit=limit))
... | python | def _format_issue_body(self, limit=-5):
"""Return formatted body."""
from renku import __version__
re_paths = r'(' + r'|'.join([path or os.getcwd()
for path in sys.path]) + r')'
tb = re.sub(re_paths, '[...]', traceback.format_exc(limit=limit))
... | [
"def",
"_format_issue_body",
"(",
"self",
",",
"limit",
"=",
"-",
"5",
")",
":",
"from",
"renku",
"import",
"__version__",
"re_paths",
"=",
"r'('",
"+",
"r'|'",
".",
"join",
"(",
"[",
"path",
"or",
"os",
".",
"getcwd",
"(",
")",
"for",
"path",
"in",
... | Return formatted body. | [
"Return",
"formatted",
"body",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_exc.py#L164-L181 |
SwissDataScienceCenter/renku-python | renku/cli/_exc.py | IssueFromTraceback._format_issue_url | def _format_issue_url(self):
"""Format full issue URL."""
query = urlencode({
'title': self._format_issue_title(),
'body': self._format_issue_body(),
})
return self.REPO_URL + self.ISSUE_SUFFIX + '?' + query | python | def _format_issue_url(self):
"""Format full issue URL."""
query = urlencode({
'title': self._format_issue_title(),
'body': self._format_issue_body(),
})
return self.REPO_URL + self.ISSUE_SUFFIX + '?' + query | [
"def",
"_format_issue_url",
"(",
"self",
")",
":",
"query",
"=",
"urlencode",
"(",
"{",
"'title'",
":",
"self",
".",
"_format_issue_title",
"(",
")",
",",
"'body'",
":",
"self",
".",
"_format_issue_body",
"(",
")",
",",
"}",
")",
"return",
"self",
".",
... | Format full issue URL. | [
"Format",
"full",
"issue",
"URL",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_exc.py#L183-L189 |
SwissDataScienceCenter/renku-python | renku/cli/_exc.py | IssueFromTraceback._process_open | def _process_open(self):
"""Open link in a browser."""
click.launch(self._format_issue_url())
if not click.confirm('Did it work?', default=True):
click.echo()
self._process_print()
click.secho(
'\nOpen the line manually and copy the text above\... | python | def _process_open(self):
"""Open link in a browser."""
click.launch(self._format_issue_url())
if not click.confirm('Did it work?', default=True):
click.echo()
self._process_print()
click.secho(
'\nOpen the line manually and copy the text above\... | [
"def",
"_process_open",
"(",
"self",
")",
":",
"click",
".",
"launch",
"(",
"self",
".",
"_format_issue_url",
"(",
")",
")",
"if",
"not",
"click",
".",
"confirm",
"(",
"'Did it work?'",
",",
"default",
"=",
"True",
")",
":",
"click",
".",
"echo",
"(",
... | Open link in a browser. | [
"Open",
"link",
"in",
"a",
"browser",
"."
] | train | https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_exc.py#L191-L203 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.