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_documentation_string
stringlengths
1
47.2k
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 = { ...
Remove files and check repository for potential problems.
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...
Return the best release.
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...
Check if the path should be used in output.
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)...
Format datasets with a tabular output.
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) ) ...
Format datasets as JSON-LD.
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[...
Return formatted text with the submodule information.
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)
Convert arguments from various input formats.
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, )
Check common Renku commands used in various situations.
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...
Update existing files by rerunning their outdated workflow.
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....
Return config path.
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 {}
Read Renku configuration.
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)
Write Renku configuration.
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
Print application config path.
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...
Add config to function.
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()
Print application config path.
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...
Create new project configuration folder.
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)
Return project configuration folder if exist.
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...
Find project config path.
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...
Yield nodes from entities.
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....
Create list of instances from a mapping.
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._...
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``.
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 ...
Return an instance from CWL data.
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
Return an instance from a YAML file.
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() ...
Render templated configuration files.
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:...
Re-run existing workflow or tool using CWL runner.
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
Format default values.
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)
Show workflow inputs and exit.
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...
Edit workflow inputs.
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...
Recreate files generated by a sequence of ``run`` commands.
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_...
Migrate dataset metadata.
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)
DEPRECATED: use 'renku storage pull'.
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: ...
Return a URL of the Docker registry.
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)
Encode more types.
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...
Tracking work on a specific problem.
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...
Show logs for a file.
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...
Show a status of the repository.
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
Validate a project name.
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
Store directory as a new Git home.
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...
Initialize a project.
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( ...
Find missing files listed in datasets.
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...
Create ``APIError`` from ``requests.exception.HTTPError``.
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...
Check for ``expected_status_code``.
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...
Find missing references.
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
Get Git path from the current context.
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]
Get Git isolation from the current context.
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()
Safely checkout branch for the issue.
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 {}...
Wrap an attr enabled class.
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)
Create a new attribute with context.
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 ...
Builder for container attributes.
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...
Dump a JSON-LD class to the JSON with generated ``@context`` field.
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['@...
Instantiate a JSON-LD class from data.
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...
Return an instance from a YAML file.
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
Create JSON-LD with the original source data.
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)
Store an instance to the referenced YAML file.
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(">") ...
Takes a key and extracts the email addresses for it.
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 ...
Sends a multipart email containing text and html versions which are encrypted for each recipient that has a valid gpg key installed.
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...
Send email rendering text and html versions for the specified template name using the context dictionary passed in.
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...
Return nodes in a topological order.
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...
Move files and check repository for potential problems.
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.' '\...
Check location of dataset metadata.
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...
Show siblings for given paths.
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) ...
r"""Show inputs files in the repository. <PATHS> Files to show. If no files are given all input files are shown.
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...
r"""Show output files in the repository. <PATHS> Files to show. If no files are given all output files are shown.
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): ...
Return list of valid context names.
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()
Print all possible types.
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, }
Return JSON-LD string for given context name.
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, ) ...
Show JSON-LD context for repository objects.
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...
List or manage workflows with subcommands.
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...
Detect a workflow path if it is not passed.
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)
Sets the <name> for remote <path>.
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)
Rename the workflow named <old> to <new>.
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()
Remove the remote named <name>.
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...
Create a workflow description for a file.
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...
Manage set of platform API endpoints.
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...
Open path with context or close stream at the end.
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....
Check your system and repository for potential problems.
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...
Create a new project. :param name: The name of the project. :returns: An instance of the newly create project. :rtype: renku.models.projects.Project
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
Validate the key contains an email address.
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
Construct a tree from a list with paths.
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 ...
Return a subtree if exists.
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...
Create a safe directory from a value.
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...
Return a default endpoint.
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: ...
Prompt for password if ``--password-stdin`` is not used.
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}...
Install completion for the current shell.
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.') ...
Return default endpoint if specified.
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...
Validate endpoint.
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 =...
Check that all outputs have their siblings listed.
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
Include all missing siblings.
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...
Display pager only if it does not fit in one terminal screen. NOTE: The feature is available only on ``less``-based pager.
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)
Check if the first argument is an existing command.
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 ...
Run the generated workflow using cwltool library.
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...
Pull an existing image from the project registry.
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(( ...
Format dataset files with a tabular output. :param client: LocalClient instance. :param records: Filtered collection.
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...
Format dataset files as JSON-LD. :param client: LocalClient instance. :param records: Filtered collection.
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()): ...
Catch all exceptions.
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...
Handle exceptions using Sentry.
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...
Handle exception and submit it as GitHub issue.
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)) ...
Return formatted body.
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
Format full issue URL.
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\...
Open link in a browser.
https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/_exc.py#L191-L203