From cfc9da04b613526472e75ae2d3ba3dd1ce458703 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 17 Oct 2016 20:59:51 -0400 Subject: [PATCH] Beta support for configurable dependency resolution & Biocontainers. Consider the included tool ``seqtk_seq.cwl``. It includes the following SoftwareRequirement hint: ``` hints: SoftwareRequirement: packages: - package: seqtk version: - r93 ``` I'm not happy that ``version`` is a list - but I can live with it for now I guess. If cwltool is executed with the hidden ``--beta-conda-dependencies`` flag, this requirement will be processed by galaxy-lib, Conda will be installed, and seqtk will be installed, and a Conda environment including seqtk will be setup for the job. ``` virtualenv .venv . .venv/bin/activate python setup.py install pip install galaxy-lib cwltool --beta-conda-dependencies tests/seqtk_seq.cwl tests/seqtk_seq_job.json ``` Additional flags are available to configure dependency resolution in a more fine grained way - using Conda however has a number of advantages that make it particularily well suited to CWL. Conda packages are distributed as binaries that work across Mac and Linux and work on relatively old version of Linux (great for HPC). Conda also doesn't require root and supports installation of multiple different versions of a package - again these factors make it great for HPC and non-Docker targets. The Biocontainers project (previously Biodocker) dovetails nicely with this. Every version of every Bioconda package has a corresponding best-practice (very lightweight, very small) Docker container on quay.io (assembled by @bgruening and colleagues). There are over 1800 such containers currently. Continuing with the example above, the new ``--beta-use-biocontainers`` flag instructs cwltool to fetch the corresponding Biocontainers container from quay.io automatically or build one to use locally (required for instance for tools with multiple software requirements - fat tools). ``` cwltool --beta-use-biocontainers tests/seqtk_seq.cwl tests/seqtk_seq_job.json ``` These containers contain the same binaries that the package would use locally (outside of Docker). Therefore this technique allows cross platform reproducibility/remixability across CWL, Galaxy, and CLI - both inside and outside of Docker. My sincerest hope is that we move away from CWL-specific Dockerfiles. For less effort, a community bioconda package can be made and the result can be used in many more contexts. The Docker image will then be maintained by the community Biocontainer project. --- cwltool/builder.py | 1 + cwltool/job.py | 11 +- cwltool/main.py | 126 ++++++++++++++++- cwltool/process.py | 12 ++ tests/2.fasta | 11 ++ tests/2.fastq | 12 ++ tests/seqtk_seq.cwl | 24 ++++ tests/seqtk_seq_job.json | 6 + typeshed/2.7/galaxy/__init__.pyi | 13 ++ typeshed/2.7/galaxy/tools/__init__.pyi | 4 + typeshed/2.7/galaxy/tools/deps/__init__.pyi | 32 +++++ typeshed/2.7/galaxy/tools/deps/brew_exts.pyi | 74 ++++++++++ typeshed/2.7/galaxy/tools/deps/commands.pyi | 23 +++ typeshed/2.7/galaxy/tools/deps/conda_util.pyi | 61 ++++++++ .../deps/container_resolvers/__init__.pyi | 15 ++ .../deps/container_resolvers/explicit.pyi | 12 ++ .../tools/deps/container_resolvers/mulled.pyi | 30 ++++ typeshed/2.7/galaxy/tools/deps/containers.pyi | 86 ++++++++++++ .../2.7/galaxy/tools/deps/docker_util.pyi | 41 ++++++ .../2.7/galaxy/tools/deps/requirements.pyi | 35 +++++ .../galaxy/tools/deps/resolvers/__init__.pyi | 40 ++++++ .../2.7/galaxy/tools/deps/resolvers/conda.pyi | 40 ++++++ .../tools/deps/resolvers/galaxy_packages.pyi | 33 +++++ .../tools/deps/resolvers/resolver_mixins.pyi | 18 +++ .../deps/resolvers/tool_shed_packages.pyi | 13 ++ typeshed/2.7/galaxy/util/__init__.pyi | 131 ++++++++++++++++++ typeshed/2.7/galaxy/util/dictifiable.pyi | 8 ++ typeshed/2.7/galaxy/util/inflection.pyi | 46 ++++++ 28 files changed, 954 insertions(+), 4 deletions(-) create mode 100644 tests/2.fasta create mode 100644 tests/2.fastq create mode 100644 tests/seqtk_seq.cwl create mode 100644 tests/seqtk_seq_job.json create mode 100644 typeshed/2.7/galaxy/__init__.pyi create mode 100644 typeshed/2.7/galaxy/tools/__init__.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/__init__.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/brew_exts.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/commands.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/conda_util.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/container_resolvers/__init__.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/container_resolvers/explicit.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/container_resolvers/mulled.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/containers.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/docker_util.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/requirements.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/resolvers/__init__.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/resolvers/conda.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/resolvers/galaxy_packages.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/resolvers/resolver_mixins.pyi create mode 100644 typeshed/2.7/galaxy/tools/deps/resolvers/tool_shed_packages.pyi create mode 100644 typeshed/2.7/galaxy/util/__init__.pyi create mode 100644 typeshed/2.7/galaxy/util/dictifiable.pyi create mode 100644 typeshed/2.7/galaxy/util/inflection.pyi diff --git a/cwltool/builder.py b/cwltool/builder.py index 8ddc7975bc..99f93f2feb 100644 --- a/cwltool/builder.py +++ b/cwltool/builder.py @@ -36,6 +36,7 @@ def __init__(self): # type: () -> None self.stagedir = None # type: Text self.make_fs_access = None # type: Type[StdFsAccess] self.build_job_script = None # type: Callable[[List[str]], Text] + self.find_default_container = None # type: Callable[[], Text] def bind_input(self, schema, datum, lead_pos=[], tail_pos=[]): # type: (Dict[Text, Any], Any, Union[int, List[int]], List[int]) -> List[Dict[Text, Any]] diff --git a/cwltool/job.py b/cwltool/job.py index 3ab479d455..4d1bd55d5c 100644 --- a/cwltool/job.py +++ b/cwltool/job.py @@ -34,6 +34,7 @@ PYTHON_RUN_SCRIPT = """ import json +import os import sys import subprocess @@ -42,6 +43,7 @@ commands = popen_description["commands"] cwd = popen_description["cwd"] env = popen_description["env"] + env["PATH"] = os.environ.get("PATH") stdin_path = popen_description["stdin_path"] stdout_path = popen_description["stdout_path"] stderr_path = popen_description["stderr_path"] @@ -140,9 +142,12 @@ def run(self, dry_run=False, pull_image=True, rm_container=True, if docker_req and kwargs.get("use_container") is not False: env = os.environ img_id = docker.get_from_requirements(docker_req, docker_is_req, pull_image) - elif kwargs.get("default_container", None) is not None: - env = os.environ - img_id = kwargs.get("default_container") + if img_id is None: + find_default_container = self.builder.find_default_container + default_container = find_default_container and find_default_container() + if default_container: + img_id = default_container + env = os.environ if docker_is_req and img_id is None: raise WorkflowException("Docker is required for running this tool.") diff --git a/cwltool/main.py b/cwltool/main.py index 361207fc8f..3bf89ba604 100755 --- a/cwltool/main.py +++ b/cwltool/main.py @@ -12,6 +12,7 @@ import hashlib import pkg_resources # part of setuptools import functools +import string import rdflib from typing import (Union, Any, AnyStr, cast, Callable, Dict, Sequence, Text, @@ -31,6 +32,13 @@ from .builder import adjustFileObjs, adjustDirObjs from .stdfsaccess import StdFsAccess from .pack import pack +from .utils import get_feature +try: + from galaxy.tools.deps.requirements import ToolRequirement + from galaxy.tools import deps +except ImportError: + ToolRequirement = None # type: ignore + deps = None _logger = logging.getLogger("cwltool") @@ -144,6 +152,15 @@ def arg_parser(): # type: () -> argparse.ArgumentParser exgroup.add_argument("--quiet", action="store_true", help="Only print warnings and errors.") exgroup.add_argument("--debug", action="store_true", help="Print even more logging") + # help="Dependency resolver configuration file describing how to adapt 'SoftwareRequirement' packages to current system." + parser.add_argument("--beta-dependency-resolvers-configuration", default=None, help=argparse.SUPPRESS) + # help="Defaut root directory used by dependency resolvers configuration." + parser.add_argument("--beta-dependencies-directory", default=None, help=argparse.SUPPRESS) + # help="Use biocontainers for tools without an explicitly annotated Docker container." + parser.add_argument("--beta-use-biocontainers", default=None, help=argparse.SUPPRESS, action="store_true") + # help="Short cut to use Conda to resolve 'SoftwareRequirement' packages." + parser.add_argument("--beta-conda-dependencies", default=None, help=argparse.SUPPRESS, action="store_true") + parser.add_argument("--tool-help", action="store_true", help="Print command line help for tool") parser.add_argument("--relative-deps", choices=['primary', 'cwd'], @@ -634,8 +651,20 @@ def main(argsl=None, stdout.write(json.dumps(processobj, indent=4)) return 0 + conf_file = getattr(args, "beta_dependency_resolvers_configuration", None) # Text + use_conda_dependencies = getattr(args, "beta_conda_dependencies", None) # Text + + make_tool_kwds = vars(args) + + build_job_script = None # type: Callable[[Any, List[str]], Text] + if conf_file or use_conda_dependencies: + dependencies_configuration = DependenciesConfigruation(args) # type: DependenciesConfigruation + make_tool_kwds["build_job_script"] = dependencies_configuration.build_job_script + + make_tool_kwds["find_default_container"] = functools.partial(find_default_container, args) + tool = make_tool(document_loader, avsc_names, metadata, uri, - makeTool, vars(args)) + makeTool, make_tool_kwds) if args.print_rdf: printrdf(tool, document_loader.ctx, args.rdf_serializer, stdout) @@ -748,5 +777,100 @@ def locToPath(p): _logger.removeHandler(stderr_handler) _logger.addHandler(defaultStreamHandler) + +COMMAND_WITH_DEPENDENCIES_TEMPLATE = string.Template("""#!/bin/bash +$handle_dependencies +python "run_job.py" "job.json" +""") + + +def find_default_container(args, builder): + if args.default_container: + return args.default_container + elif args.beta_use_biocontainers: + try: + from galaxy.tools.deps.containers import ContainerRegistry, AppInfo, ToolInfo, DOCKER_CONTAINER_TYPE + except ImportError: + raise Exception("galaxy-lib not found") + + app_info = AppInfo( + involucro_auto_init=True, + enable_beta_mulled_containers=True, + ) # type: AppInfo + container_registry = ContainerRegistry(app_info) # type: ContainerRegistry + requirements = _get_dependencies(builder) + tool_info = ToolInfo(requirements=requirements) # type: ToolInfo + container_description = container_registry.find_best_container_description([DOCKER_CONTAINER_TYPE], tool_info) + print container_description + if container_description: + return container_description.identifier + + return None + + +class DependenciesConfigruation(object): + + def __init__(self, args): + # type: (argparse.Namespace) -> None + conf_file = getattr(args, "beta_dependency_resolvers_configuration", None) + tool_dependency_dir = getattr(args, "beta_dependencies_directory", None) + conda_dependencies = getattr(args, "beta_conda_dependencies", None) + if conf_file is not None and os.path.exists(conf_file): + self.use_tool_dependencies = True + if not tool_dependency_dir: + tool_dependency_dir = os.path.abspath(os.path.dirname(conf_file)) + self.tool_dependency_dir = tool_dependency_dir + self.dependency_resolvers_config_file = conf_file + elif conda_dependencies: + if not tool_dependency_dir: + tool_dependency_dir = os.path.abspath("./cwltool_deps") + self.tool_dependency_dir = tool_dependency_dir + self.use_tool_dependencies = True + self.dependency_resolvers_config_file = None + else: + self.use_tool_dependencies = False + + @property + def config_dict(self): + return { + 'conda_auto_install': True, + 'conda_auto_init': True, + } + + def build_job_script(self, builder, command): + # type: (Any, List[str]) -> Text + if deps is None: + raise Exception("galaxy-lib not found") + tool_dependency_manager = deps.build_dependency_manager(self) # type: deps.DependencyManager + dependencies = _get_dependencies(builder) + handle_dependencies = "" # str + if dependencies: + handle_dependencies = "\n".join(tool_dependency_manager.dependency_shell_commands(dependencies, job_directory=builder.tmpdir)) + + template_kwds = dict(handle_dependencies=handle_dependencies) # type: Dict[str, str] + job_script = COMMAND_WITH_DEPENDENCIES_TEMPLATE.substitute(template_kwds) + return job_script + + +def _get_dependencies(builder): + # type: (Any) -> List[ToolRequirement] + (software_requirement, _) = get_feature(builder, "SoftwareRequirement") + dependencies = [] # type: List[ToolRequirement] + if software_requirement and software_requirement.get("packages"): + packages = software_requirement.get("packages") + for package in packages: + version = package.get("version", None) + if isinstance(version, list): + if version: + version = version[0] + else: + version = None + dependencies.append(ToolRequirement.from_dict(dict( + name=package["package"].split("#")[-1], + version=version, + type="package", + ))) + return dependencies + if __name__ == "__main__": sys.exit(main(sys.argv[1:])) diff --git a/cwltool/process.py b/cwltool/process.py index b15ff3778b..1541cc7c76 100644 --- a/cwltool/process.py +++ b/cwltool/process.py @@ -502,6 +502,18 @@ def _init_job(self, joborder, **kwargs): builder.resources = self.evalResources(builder, kwargs) + build_job_script = kwargs.get("build_job_script", None) # type: Callable[[Builder, List[str]], Text] + curried_build_job_script = None # type: Callable[[List[str]], Text] + if build_job_script: + curried_build_job_script = lambda commands: build_job_script(builder, commands) + builder.build_job_script = curried_build_job_script + + find_default_container = kwargs.get("find_default_container", None) # type: Callable[[Builder], Text] + curried_find_default_container = None # type: Callable[[], Text] + if find_default_container: + curried_find_default_container = lambda: find_default_container(builder) + builder.find_default_container = curried_find_default_container + return builder def evalResources(self, builder, kwargs): diff --git a/tests/2.fasta b/tests/2.fasta new file mode 100644 index 0000000000..3bfe7d3d3e --- /dev/null +++ b/tests/2.fasta @@ -0,0 +1,11 @@ +>Sequence 561 BP; 135 A; 106 C; 98 G; 222 T; 0 other; +gttcgatgcc taaaatacct tcttttgtcc ctacacagac cacagttttc ctaatggctt +tacaccgact agaaattctt gtgcaagcac taattgaaag cggttggcct agagtgttac +cggtttgtat agctgagcgc gtctcttgcc ctgatcaaag gttcattttc tctactttgg +aagacgttgt ggaagaatac aacaagtacg agtctctccc ccctggtttg ctgattactg +gatacagttg taataccctt cgcaacaccg cgtaactatc tatatgaatt attttccctt +tattatatgt agtaggttcg tctttaatct tcctttagca agtcttttac tgttttcgac +ctcaatgttc atgttcttag gttgttttgg ataatatgcg gtcagtttaa tcttcgttgt +ttcttcttaa aatatttatt catggtttaa tttttggttt gtacttgttc aggggccagt +tcattattta ctctgtttgt atacagcagt tcttttattt ttagtatgat tttaatttaa +aacaattcta atggtcaaaa a \ No newline at end of file diff --git a/tests/2.fastq b/tests/2.fastq new file mode 100644 index 0000000000..436c05ff2c --- /dev/null +++ b/tests/2.fastq @@ -0,0 +1,12 @@ +@EAS54_6_R1_2_1_413_324 +CCCTTCTTGTCTTCAGCGTTTCTCC ++ +;;3;;;;;;;;;;;;7;;;;;;;88 +@EAS54_6_R1_2_1_540_792 +TTGGCAGGCCAAGGCCGATGGATCA ++ +;;;;;;;;;;;7;;;;;-;;;3;83 +@EAS54_6_R1_2_1_443_348 +GTTGCTTCTGGCGTGGGTGGGGGGG ++EAS54_6_R1_2_1_443_348 +;;;;;;;;;;;9;7;;.7;393333 \ No newline at end of file diff --git a/tests/seqtk_seq.cwl b/tests/seqtk_seq.cwl new file mode 100644 index 0000000000..b97d6c25e6 --- /dev/null +++ b/tests/seqtk_seq.cwl @@ -0,0 +1,24 @@ +cwlVersion: v1.0 +class: CommandLineTool +id: "seqtk_seq" +doc: "Convert to FASTA (seqtk)" +inputs: + - id: input1 + type: File + inputBinding: + position: 1 + prefix: "-a" +outputs: + - id: output1 + type: File + outputBinding: + glob: out +baseCommand: ["seqtk", "seq"] +arguments: [] +stdout: out +hints: + SoftwareRequirement: + packages: + - package: seqtk + version: + - r93 diff --git a/tests/seqtk_seq_job.json b/tests/seqtk_seq_job.json new file mode 100644 index 0000000000..79ea46c378 --- /dev/null +++ b/tests/seqtk_seq_job.json @@ -0,0 +1,6 @@ +{ + "input1": { + "class": "File", + "location": "2.fastq" + } +} diff --git a/typeshed/2.7/galaxy/__init__.pyi b/typeshed/2.7/galaxy/__init__.pyi new file mode 100644 index 0000000000..78ce81a705 --- /dev/null +++ b/typeshed/2.7/galaxy/__init__.pyi @@ -0,0 +1,13 @@ +# Stubs for galaxy (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any + +PROJECT_NAME = ... # type: str +PROJECT_OWNER = ... # type: str +PROJECT_USERAME = ... # type: str +PROJECT_URL = ... # type: str +PROJECT_AUTHOR = ... # type: str +PROJECT_EMAIL = ... # type: str +RAW_CONTENT_URL = ... # type: Any diff --git a/typeshed/2.7/galaxy/tools/__init__.pyi b/typeshed/2.7/galaxy/tools/__init__.pyi new file mode 100644 index 0000000000..af68799824 --- /dev/null +++ b/typeshed/2.7/galaxy/tools/__init__.pyi @@ -0,0 +1,4 @@ +# Stubs for galaxy.tools (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + diff --git a/typeshed/2.7/galaxy/tools/deps/__init__.pyi b/typeshed/2.7/galaxy/tools/deps/__init__.pyi new file mode 100644 index 0000000000..b3bd75ccfb --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/__init__.pyi @@ -0,0 +1,32 @@ +# Stubs for galaxy.tools.deps (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional +from .resolvers import NullDependency as NullDependency +from .resolvers.conda import CondaDependencyResolver as CondaDependencyResolver +from .resolvers.galaxy_packages import GalaxyPackageDependencyResolver as GalaxyPackageDependencyResolver +from .resolvers.tool_shed_packages import ToolShedPackageDependencyResolver as ToolShedPackageDependencyResolver + +log = ... # type: Any +EXTRA_CONFIG_KWDS = ... # type: Any +CONFIG_VAL_NOT_FOUND = ... # type: Any + +def build_dependency_manager(config: Any): ... # type: DependencyManager + +class NullDependencyManager: + dependency_resolvers = ... # type: Any + def uses_tool_shed_dependencies(self): ... + def dependency_shell_commands(self, requirements: Any, **kwds) -> List[str]: ... + def find_dep(self, name, version: Optional[Any] = ..., type: str = ..., **kwds): ... + +class DependencyManager: + extra_config = ... # type: Any + default_base_path = ... # type: Any + resolver_classes = ... # type: Any + dependency_resolvers = ... # type: Any + def __init__(self, default_base_path, conf_file: Optional[Any] = ..., **extra_config) -> None: ... + def dependency_shell_commands(self, requirements: Any, **kwds) -> List[str]: ... + def requirements_to_dependencies(self, requirements, **kwds): ... + def uses_tool_shed_dependencies(self): ... + def find_dep(self, name, version: Optional[Any] = ..., type: str = ..., **kwds): ... diff --git a/typeshed/2.7/galaxy/tools/deps/brew_exts.pyi b/typeshed/2.7/galaxy/tools/deps/brew_exts.pyi new file mode 100644 index 0000000000..f2074d55d3 --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/brew_exts.pyi @@ -0,0 +1,74 @@ +# Stubs for galaxy.tools.deps.brew_exts (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional + +WHITESPACE_PATTERN = ... # type: Any +DESCRIPTION = ... # type: str +DEFAULT_HOMEBREW_ROOT = ... # type: str +NO_BREW_ERROR_MESSAGE = ... # type: str +CANNOT_DETERMINE_TAP_ERROR_MESSAGE = ... # type: str +VERBOSE = ... # type: bool +RELAXED = ... # type: bool +BREW_ARGS = ... # type: Any + +class BrewContext: + homebrew_prefix = ... # type: Any + homebrew_cellar = ... # type: Any + def __init__(self, args: Optional[Any] = ...) -> None: ... + +class RecipeContext: + @staticmethod + def from_args(args, brew_context: Optional[Any] = ...): ... + recipe = ... # type: Any + version = ... # type: Any + brew_context = ... # type: Any + def __init__(self, recipe, version, brew_context: Optional[Any] = ...) -> None: ... + @property + def cellar_path(self): ... + @property + def tap_path(self): ... + +def main(): ... + +class CommandLineException(Exception): + command = ... # type: Any + stdout = ... # type: Any + stderr = ... # type: Any + message = ... # type: Any + def __init__(self, command, stdout, stderr) -> None: ... + +def versioned_install(recipe_context, package: Optional[Any] = ..., version: Optional[Any] = ..., installed_deps: Any = ...): ... +def commit_for_version(recipe_context, package, version): ... +def print_versioned_deps(recipe_context, recipe, version): ... +def load_versioned_deps(cellar_path, relaxed: Optional[Any] = ...): ... +def unversioned_install(package): ... +def attempt_unlink_all(package, deps): ... +def attempt_unlink(package): ... +def brew_execute(args, env: Optional[Any] = ...): ... +def build_env_statements_from_recipe_context(recipe_context, **kwds): ... +def build_env_statements(cellar_root, cellar_path, relaxed: Optional[Any] = ..., custom_only: bool = ...): ... +def build_env_actions(deps, cellar_root, cellar_path, relaxed: Optional[Any] = ..., custom_only: bool = ...): ... + +class EnvAction: + variable = ... # type: Any + action = ... # type: Any + value = ... # type: Any + def __init__(self, keg_root, action_description) -> None: ... + @staticmethod + def build_env(env_actions): ... + def modify_environ(self, environ): ... + def to_statements(self): ... + +def brew_head_at_version(recipe_context, package, version): ... +def brew_head_at_commit(commit, tap_path): ... +def git_execute(args): ... +def execute(cmds, env: Optional[Any] = ...): ... +def brew_deps(package): ... +def brew_info(recipe): ... +def extended_brew_info(recipe): ... +def brew_versions_info(package, tap_path): ... +def recipe_cellar_path(cellar_path, recipe, version): ... +def ensure_brew_on_path(args): ... +def which(file): ... diff --git a/typeshed/2.7/galaxy/tools/deps/commands.pyi b/typeshed/2.7/galaxy/tools/deps/commands.pyi new file mode 100644 index 0000000000..aad9cae426 --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/commands.pyi @@ -0,0 +1,23 @@ +# Stubs for galaxy.tools.deps.commands (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional +from galaxy.util import which as which +def shell_quote(args: Any = ...): ... + +def redirecting_io(sys: Any = ...): ... +def redirect_aware_commmunicate(p, sys: Any = ...): ... +def shell(cmds, env: Optional[Any] = ..., **kwds): ... +def shell_process(cmds, env: Optional[Any] = ..., **kwds): ... +def execute(cmds): ... +def argv_to_str(command_argv, quote: bool = ...): ... +def download_command(url, to: Any = ..., quote_url: bool = ...): ... + +class CommandLineException(Exception): + command = ... # type: Any + stdout = ... # type: Any + stderr = ... # type: Any + message = ... # type: Any + def __init__(self, command, stdout, stderr) -> None: ... + diff --git a/typeshed/2.7/galaxy/tools/deps/conda_util.pyi b/typeshed/2.7/galaxy/tools/deps/conda_util.pyi new file mode 100644 index 0000000000..55082a96ac --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/conda_util.pyi @@ -0,0 +1,61 @@ +# Stubs for galaxy.tools.deps.conda_util (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional +import installable +from sys import platform as _platform + +class CondaContext(installable.InstallableContext): + installable_description = ... # type: str + condarc_override = ... # type: Any + conda_exec = ... # type: Any + debug = ... # type: Any + shell_exec = ... # type: Any + conda_prefix = ... # type: Any + ensure_channels = ... # type: Any + ensured_channels = ... # type: bool + def __init__(self, conda_prefix: Optional[Any] = ..., conda_exec: Optional[Any] = ..., shell_exec: Optional[Any] = ..., debug: bool = ..., ensure_channels: str = ..., condarc_override: Optional[Any] = ..., use_path_exec: Any = ...) -> None: ... + def ensure_channels_configured(self): ... + def conda_info(self): ... + def is_conda_installed(self): ... + def can_install_conda(self): ... + def load_condarc(self): ... + def save_condarc(self, conf): ... + @property + def condarc(self): ... + def command(self, operation, args): ... + def exec_command(self, operation, args): ... + def exec_create(self, args): ... + def exec_remove(self, args): ... + def exec_install(self, args): ... + def export_list(self, name, path): ... + def env_path(self, env_name): ... + @property + def envs_path(self): ... + def has_env(self, env_name): ... + @property + def deactivate(self): ... + @property + def activate(self): ... + def is_installed(self): ... + def can_install(self): ... + @property + def parent_path(self): ... + +class CondaTarget: + package = ... # type: Any + version = ... # type: Any + channel = ... # type: Any + def __init__(self, package, version: Optional[Any] = ..., channel: Optional[Any] = ...) -> None: ... + @property + def package_specifier(self): ... + @property + def install_environment(self): ... + def __hash__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + +def install_conda(conda_context: Optional[Any] = ...): ... +def install_conda_target(conda_target, conda_context: Optional[Any] = ...): ... +def requirements_to_conda_targets(requirements, conda_context: Optional[Any] = ...): ... diff --git a/typeshed/2.7/galaxy/tools/deps/container_resolvers/__init__.pyi b/typeshed/2.7/galaxy/tools/deps/container_resolvers/__init__.pyi new file mode 100644 index 0000000000..045ccdb392 --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/container_resolvers/__init__.pyi @@ -0,0 +1,15 @@ +# Stubs for galaxy.tools.deps.container_resolvers (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional +from galaxy.util.dictifiable import Dictifiable + +class ContainerResolver(Dictifiable): + dict_collection_visible_keys = ... # type: Any + __metaclass__ = ... # type: Any + app_info = ... # type: Any + resolver_kwds = ... # type: Any + def __init__(self, app_info: Optional[Any] = ..., **kwds) -> None: ... + def resolve(self, tool_info): ... + def resolver_type(self): ... diff --git a/typeshed/2.7/galaxy/tools/deps/container_resolvers/explicit.pyi b/typeshed/2.7/galaxy/tools/deps/container_resolvers/explicit.pyi new file mode 100644 index 0000000000..511140171a --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/container_resolvers/explicit.pyi @@ -0,0 +1,12 @@ +# Stubs for galaxy.tools.deps.container_resolvers.explicit (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any +from ..container_resolvers import ContainerResolver as ContainerResolver + +log = ... # type: Any + +class ExplicitContainerResolver(ContainerResolver): + resolver_type = ... # type: str + def resolve(self, enabled_container_types, tool_info): ... diff --git a/typeshed/2.7/galaxy/tools/deps/container_resolvers/mulled.pyi b/typeshed/2.7/galaxy/tools/deps/container_resolvers/mulled.pyi new file mode 100644 index 0000000000..0c04bd898c --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/container_resolvers/mulled.pyi @@ -0,0 +1,30 @@ +# Stubs for galaxy.tools.deps.container_resolvers.mulled (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional +from ..container_resolvers import ContainerResolver +from collections import namedtuple + +CachedMulledImageSingleTarget = namedtuple('CachedMulledImageSingleTarget', ['package_name', 'version', 'build', 'image_identifier']) + +CachedMulledImageMultiTarget = namedtuple('CachedMulledImageMultiTarget', ['hash', 'image_identifier']) + +class CachedMulledContainerResolver(ContainerResolver): + resolver_type = ... # type: str + namespace = ... # type: Any + def __init__(self, app_info: Optional[Any] = ..., namespace: Optional[Any] = ...) -> None: ... + def resolve(self, enabled_container_types, tool_info): ... + +class MulledContainerResolver(ContainerResolver): + resolver_type = ... # type: str + namespace = ... # type: Any + def __init__(self, app_info: Optional[Any] = ..., namespace: str = ...) -> None: ... + def resolve(self, enabled_container_types, tool_info): ... + +class BuildMulledContainerResolver(ContainerResolver): + resolver_type = ... # type: str + namespace = ... # type: Any + auto_init = ... # type: Any + def __init__(self, app_info: Optional[Any] = ..., namespace: str = ..., **kwds) -> None: ... + def resolve(self, enabled_container_types, tool_info): ... diff --git a/typeshed/2.7/galaxy/tools/deps/containers.pyi b/typeshed/2.7/galaxy/tools/deps/containers.pyi new file mode 100644 index 0000000000..4eecb54408 --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/containers.pyi @@ -0,0 +1,86 @@ +# Stubs for galaxy.tools.deps.containers (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional +from .container_resolvers.explicit import ExplicitContainerResolver as ExplicitContainerResolver +from .container_resolvers.mulled import BuildMulledContainerResolver as BuildMulledContainerResolver, CachedMulledContainerResolver as CachedMulledContainerResolver, MulledContainerResolver as MulledContainerResolver +from .requirements import ContainerDescription as ContainerDescription +from .requirements import DEFAULT_CONTAINER_RESOLVE_DEPENDENCIES as DEFAULT_CONTAINER_RESOLVE_DEPENDENCIES, DEFAULT_CONTAINER_SHELL as DEFAULT_CONTAINER_SHELL +from ..deps import docker_util as docker_util + +log = ... # type: Any +DOCKER_CONTAINER_TYPE = ... # type: str +DEFAULT_CONTAINER_TYPE = ... # type: Any +ALL_CONTAINER_TYPES = ... # type: Any +LOAD_CACHED_IMAGE_COMMAND_TEMPLATE = ... # type: str + +class ContainerFinder: + app_info = ... # type: Any + container_registry = ... # type: Any + def __init__(self, app_info) -> None: ... + def find_container(self, tool_info, destination_info, job_info): ... + +class NullContainerFinder: + def find_container(self, tool_info, destination_info, job_info): ... + +class ContainerRegistry: + resolver_classes = ... # type: Any + enable_beta_mulled_containers = ... # type: Any + app_info = ... # type: Any + container_resolvers = ... # type: Any + def __init__(self, app_info) -> None: ... + def find_best_container_description(self, enabled_container_types, tool_info): ... + +class AppInfo: + galaxy_root_dir = ... # type: Any + default_file_path = ... # type: Any + outputs_to_working_directory = ... # type: Any + container_image_cache_path = ... # type: Any + library_import_dir = ... # type: Any + enable_beta_mulled_containers = ... # type: Any + containers_resolvers_config_file = ... # type: Any + involucro_path = ... # type: Any + involucro_auto_init = ... # type: Any + def __init__(self, galaxy_root_dir: Optional[Any] = ..., default_file_path: Optional[Any] = ..., outputs_to_working_directory: bool = ..., container_image_cache_path: Optional[Any] = ..., library_import_dir: Optional[Any] = ..., enable_beta_mulled_containers: bool = ..., containers_resolvers_config_file: Optional[Any] = ..., involucro_path: Optional[Any] = ..., involucro_auto_init: bool = ...) -> None: ... + +class ToolInfo: + container_descriptions = ... # type: Any + requirements = ... # type: Any + env_pass_through = ... # type: Any + def __init__(self, container_descriptions: Any = ..., requirements: Any = ...) -> None: ... + +class JobInfo: + working_directory = ... # type: Any + job_directory = ... # type: Any + tool_directory = ... # type: Any + job_directory_type = ... # type: Any + def __init__(self, working_directory, tool_directory, job_directory, job_directory_type) -> None: ... + +class Container: + __metaclass__ = ... # type: Any + container_id = ... # type: Any + app_info = ... # type: Any + tool_info = ... # type: Any + destination_info = ... # type: Any + job_info = ... # type: Any + container_description = ... # type: Any + def __init__(self, container_id, app_info, tool_info, destination_info, job_info, container_description) -> None: ... + @property + def resolve_dependencies(self): ... + @property + def shell(self): ... + def containerize_command(self, command): ... + +class DockerContainer(Container): + def containerize_command(self, command): ... + +def docker_cache_path(cache_directory, container_id): ... + +CONTAINER_CLASSES = ... # type: Any + +class NullContainer: + def __init__(self) -> None: ... + def __nonzero__(self): ... + +NULL_CONTAINER = ... # type: Any diff --git a/typeshed/2.7/galaxy/tools/deps/docker_util.pyi b/typeshed/2.7/galaxy/tools/deps/docker_util.pyi new file mode 100644 index 0000000000..c6ea13d515 --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/docker_util.pyi @@ -0,0 +1,41 @@ +# Stubs for galaxy.tools.deps.docker_util (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional +from .commands import argv_to_str as argv_to_str, shell_quote as shell_quote + +DEFAULT_DOCKER_COMMAND = ... # type: str +DEFAULT_SUDO = ... # type: bool +DEFAULT_SUDO_COMMAND = ... # type: str +DEFAULT_HOST = ... # type: Any +DEFAULT_VOLUME_MOUNT_TYPE = ... # type: str +DEFAULT_WORKING_DIRECTORY = ... # type: Any +DEFAULT_NET = ... # type: Any +DEFAULT_MEMORY = ... # type: Any +DEFAULT_VOLUMES_FROM = ... # type: Any +DEFAULT_AUTO_REMOVE = ... # type: bool +DEFAULT_SET_USER = ... # type: str +DEFAULT_RUN_EXTRA_ARGUMENTS = ... # type: Any + +class DockerVolume: + from_path = ... # type: Any + to_path = ... # type: Any + how = ... # type: Any + def __init__(self, path, to_path: Optional[Any] = ..., how: Any = ...) -> None: ... + @staticmethod + def volumes_from_str(volumes_as_str): ... + @staticmethod + def volume_from_str(as_str): ... + +def kill_command(container, signal: Optional[Any] = ..., **kwds): ... +def logs_command(container, **kwds): ... +def build_command(image, docker_build_path, **kwds): ... +def build_save_image_command(image, destination, **kwds): ... +def build_pull_command(tag, **kwds): ... +def build_docker_cache_command(image, **kwds): ... +def build_docker_images_command(truncate: bool = ..., **kwds): ... +def build_docker_load_command(**kwds): ... +def build_docker_run_command(container_command, image, interactive: bool = ..., terminal: bool = ..., tag: Optional[Any] = ..., volumes: Any = ..., volumes_from: Any = ..., memory: Any = ..., env_directives: Any = ..., working_directory: Any = ..., name: Optional[Any] = ..., net: Any = ..., run_extra_arguments: Any = ..., docker_cmd: Any = ..., sudo: Any = ..., sudo_cmd: Any = ..., auto_rm: Any = ..., set_user: Any = ..., host: Any = ...): ... +def command_list(command, command_args: Any = ..., **kwds): ... +def command_shell(command, command_args: Any = ..., **kwds): ... diff --git a/typeshed/2.7/galaxy/tools/deps/requirements.pyi b/typeshed/2.7/galaxy/tools/deps/requirements.pyi new file mode 100644 index 0000000000..2764d64304 --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/requirements.pyi @@ -0,0 +1,35 @@ +# Stubs for galaxy.tools.deps.requirements (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional + +DEFAULT_REQUIREMENT_TYPE = ... # type: str +DEFAULT_REQUIREMENT_VERSION = ... # type: Any + +class ToolRequirement: + name = ... # type: Any + type = ... # type: Any + version = ... # type: Any + def __init__(self, name: Optional[Any] = ..., type: Optional[Any] = ..., version: Optional[Any] = ...) -> None: ... + def to_dict(self): ... + @staticmethod + def from_dict(dict: Dict[Any, Any]): ... # type: ToolRequirement + +DEFAULT_CONTAINER_TYPE = ... # type: str +DEFAULT_CONTAINER_RESOLVE_DEPENDENCIES = ... # type: bool +DEFAULT_CONTAINER_SHELL = ... # type: str + +class ContainerDescription: + identifier = ... # type: Any + type = ... # type: Any + resolve_dependencies = ... # type: Any + shell = ... # type: Any + def __init__(self, identifier: Optional[Any] = ..., type: Any = ..., resolve_dependencies: Any = ..., shell: Any = ...) -> None: ... + def to_dict(self): ... + @staticmethod + def from_dict(dict): ... + +def parse_requirements_from_dict(root_dict): ... +def parse_requirements_from_xml(xml_root): ... +def container_from_element(container_elem): ... diff --git a/typeshed/2.7/galaxy/tools/deps/resolvers/__init__.pyi b/typeshed/2.7/galaxy/tools/deps/resolvers/__init__.pyi new file mode 100644 index 0000000000..057e51c0f0 --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/resolvers/__init__.pyi @@ -0,0 +1,40 @@ +# Stubs for galaxy.tools.deps.resolvers (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional +from galaxy.util.dictifiable import Dictifiable +from ..requirements import ToolRequirement as ToolRequirement + +class DependencyResolver(Dictifiable): + dict_collection_visible_keys = ... # type: Any + disabled = ... # type: bool + resolves_simple_dependencies = ... # type: bool + __metaclass__ = ... # type: Any + def resolve(self, name, version, type, **kwds): ... + +class ListableDependencyResolver: + __metaclass__ = ... # type: Any + def list_dependencies(self): ... + +class InstallableDependencyResolver: + __metaclass__ = ... # type: Any + def install_dependency(self, name, version, type, **kwds): ... + +class Dependency(Dictifiable): + dict_collection_visible_keys = ... # type: Any + __metaclass__ = ... # type: Any + def shell_commands(self, requirement): ... + def exact(self): ... + @property + def resolver_msg(self): ... + +class NullDependency(Dependency): + dependency_type = ... # type: Any + exact = ... # type: bool + version = ... # type: Any + name = ... # type: Any + def __init__(self, version: Optional[Any] = ..., name: Optional[Any] = ...) -> None: ... + @property + def resolver_msg(self): ... + def shell_commands(self, requirement): ... diff --git a/typeshed/2.7/galaxy/tools/deps/resolvers/conda.pyi b/typeshed/2.7/galaxy/tools/deps/resolvers/conda.pyi new file mode 100644 index 0000000000..8308d36f22 --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/resolvers/conda.pyi @@ -0,0 +1,40 @@ +# Stubs for galaxy.tools.deps.resolvers.conda (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional +from ..resolvers import Dependency, DependencyResolver, InstallableDependencyResolver, ListableDependencyResolver + +class CondaDependencyResolver(DependencyResolver, ListableDependencyResolver, InstallableDependencyResolver): + dict_collection_visible_keys = ... # type: Any + resolver_type = ... # type: str + versionless = ... # type: Any + dependency_manager = ... # type: Any + conda_prefix_parent = ... # type: Any + ensure_channels = ... # type: Any + auto_init = ... # type: Any + conda_context = ... # type: Any + disabled = ... # type: Any + auto_install = ... # type: Any + copy_dependencies = ... # type: Any + verbose_install_check = ... # type: Any + def __init__(self, dependency_manager, **kwds) -> None: ... + def resolve(self, name, version, type, **kwds): ... + def list_dependencies(self): ... + def install_dependency(self, name, version, type, **kwds): ... + @property + def prefix(self): ... + +class CondaDependency(Dependency): + dict_collection_visible_keys = ... # type: Any + dependency_type = ... # type: str + activate = ... # type: Any + environment_path = ... # type: Any + def __init__(self, activate, environment_path, exact, name: Optional[Any] = ..., version: Optional[Any] = ...) -> None: ... + @property + def exact(self): ... + @property + def name(self): ... + @property + def version(self): ... + def shell_commands(self, requirement): ... diff --git a/typeshed/2.7/galaxy/tools/deps/resolvers/galaxy_packages.pyi b/typeshed/2.7/galaxy/tools/deps/resolvers/galaxy_packages.pyi new file mode 100644 index 0000000000..c83a8a7b1f --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/resolvers/galaxy_packages.pyi @@ -0,0 +1,33 @@ +# Stubs for galaxy.tools.deps.resolvers.galaxy_packages (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any +from .resolver_mixins import UsesToolDependencyDirMixin +from ..resolvers import Dependency, DependencyResolver, ListableDependencyResolver + +class GalaxyPackageDependency(Dependency): + dict_collection_visible_keys = ... # type: Any + dependency_type = ... # type: str + script = ... # type: Any + path = ... # type: Any + version = ... # type: Any + name = ... # type: Any + def __init__(self, script, path, version, name, exact: bool = ...) -> None: ... + @property + def exact(self): ... + def shell_commands(self, requirement): ... + +class ToolShedDependency(GalaxyPackageDependency): + dependency_type = ... # type: str + +class BaseGalaxyPackageDependencyResolver(DependencyResolver, UsesToolDependencyDirMixin): + dict_collection_visible_keys = ... # type: Any + dependency_type = ... # type: Any + versionless = ... # type: Any + def __init__(self, dependency_manager, **kwds) -> None: ... + def resolve(self, name, version, type, **kwds): ... + +class GalaxyPackageDependencyResolver(BaseGalaxyPackageDependencyResolver, ListableDependencyResolver): + resolver_type = ... # type: str + def list_dependencies(self): ... diff --git a/typeshed/2.7/galaxy/tools/deps/resolvers/resolver_mixins.pyi b/typeshed/2.7/galaxy/tools/deps/resolvers/resolver_mixins.pyi new file mode 100644 index 0000000000..fddfaec9af --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/resolvers/resolver_mixins.pyi @@ -0,0 +1,18 @@ +# Stubs for galaxy.tools.deps.resolvers.resolver_mixins (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any +from ..brew_exts import build_env_statements as build_env_statements, DEFAULT_HOMEBREW_ROOT as DEFAULT_HOMEBREW_ROOT, recipe_cellar_path as recipe_cellar_path +from ..resolvers import Dependency as Dependency, NullDependency as NullDependency + +class UsesHomebrewMixin: ... +class UsesToolDependencyDirMixin: ... +class UsesInstalledRepositoriesMixin: ... + +class HomebrewDependency(Dependency): + commands = ... # type: Any + def __init__(self, commands, exact: bool = ...) -> None: ... + @property + def exact(self): ... + def shell_commands(self, requirement): ... diff --git a/typeshed/2.7/galaxy/tools/deps/resolvers/tool_shed_packages.pyi b/typeshed/2.7/galaxy/tools/deps/resolvers/tool_shed_packages.pyi new file mode 100644 index 0000000000..36681f6063 --- /dev/null +++ b/typeshed/2.7/galaxy/tools/deps/resolvers/tool_shed_packages.pyi @@ -0,0 +1,13 @@ +# Stubs for galaxy.tools.deps.resolvers.tool_shed_packages (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any +from .galaxy_packages import BaseGalaxyPackageDependencyResolver +from .resolver_mixins import UsesInstalledRepositoriesMixin + +class ToolShedPackageDependencyResolver(BaseGalaxyPackageDependencyResolver, UsesInstalledRepositoriesMixin): + resolver_type = ... # type: str + dependency_type = ... # type: Any + resolves_simple_dependencies = ... # type: bool + def __init__(self, dependency_manager, **kwds) -> None: ... diff --git a/typeshed/2.7/galaxy/util/__init__.pyi b/typeshed/2.7/galaxy/util/__init__.pyi new file mode 100644 index 0000000000..d0c7e7a901 --- /dev/null +++ b/typeshed/2.7/galaxy/util/__init__.pyi @@ -0,0 +1,131 @@ +# Stubs for galaxy.util (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional +import collections +from six.moves.urllib import parse as urlparse +from six.moves.urllib import request as urlrequest +from .inflection import English as English, Inflector as Inflector + +grp = ... # type: Any +docutils_core = ... # type: Any +docutils_html4css1 = ... # type: Any +inflector = ... # type: Any + +list_map = ... # type: Any +log = ... # type: Any +CHUNK_SIZE = ... # type: int +DATABASE_MAX_STRING_SIZE = ... # type: int +DATABASE_MAX_STRING_SIZE_PRETTY = ... # type: str +gzip_magic = ... # type: str +bz2_magic = ... # type: str +DEFAULT_ENCODING = ... # type: Any +NULL_CHAR = ... # type: str +BINARY_CHARS = ... # type: Any +FILENAME_VALID_CHARS = ... # type: str + +def remove_protocol_from_url(url): ... +def is_binary(value, binary_chars: Optional[Any] = ...): ... +def is_uuid(value): ... +def directory_hash_id(id): ... +def get_charset_from_http_headers(headers, default: Optional[Any] = ...): ... +def synchronized(func): ... +def file_iter(fname, sep: Optional[Any] = ...): ... +def file_reader(fp, chunk_size: Any = ...): ... +def unique_id(KEY_SIZE: int = ...): ... +def parse_xml(fname): ... +def parse_xml_string(xml_string): ... +def xml_to_string(elem, pretty: bool = ...): ... +def xml_element_compare(elem1, elem2): ... +def xml_element_list_compare(elem_list1, elem_list2): ... +def xml_element_to_dict(elem): ... +def pretty_print_xml(elem, level: int = ...): ... +def get_file_size(value, default: Optional[Any] = ...): ... +def shrink_stream_by_size(value, size, join_by: str = ..., left_larger: bool = ..., beginning_on_size_error: bool = ..., end_on_size_error: bool = ...): ... +def shrink_string_by_size(value, size, join_by: str = ..., left_larger: bool = ..., beginning_on_size_error: bool = ..., end_on_size_error: bool = ...): ... +def pretty_print_time_interval(time: bool = ..., precise: bool = ...): ... +def pretty_print_json(json_data, is_json_string: bool = ...): ... + +valid_chars = ... # type: Any +mapped_chars = ... # type: Any + +def restore_text(text, character_map: Any = ...): ... +def sanitize_text(text, valid_characters: Any = ..., character_map: Any = ..., invalid_character: str = ...): ... +def sanitize_lists_to_string(values, valid_characters: Any = ..., character_map: Any = ..., invalid_character: str = ...): ... +def sanitize_param(value, valid_characters: Any = ..., character_map: Any = ..., invalid_character: str = ...): ... + +valid_filename_chars = ... # type: Any +invalid_filenames = ... # type: Any + +def sanitize_for_filename(text, default: Optional[Any] = ...): ... +def mask_password_from_url(url): ... +def ready_name_for_url(raw_name): ... +def which(file): ... +def safe_makedirs(path): ... +def in_directory(file, directory, local_path_module: Any = ...): ... +def merge_sorted_iterables(operator, *iterables): ... + +class Params: + NEVER_SANITIZE = ... # type: Any + def __init__(self, params, sanitize: bool = ...) -> None: ... + def flatten(self): ... + def __getattr__(self, name): ... + def get(self, key, default): ... + def __len__(self): ... + def __iter__(self): ... + def update(self, values): ... + +def rst_to_html(s): ... +def xml_text(root, name: Optional[Any] = ...): ... + +truthy = ... # type: Any +falsy = ... # type: Any + +def asbool(obj): ... +def string_as_bool(string): ... +def string_as_bool_or_none(string): ... +def listify(item, do_strip: bool = ...): ... +def commaify(amount): ... +def roundify(amount, sfs: int = ...): ... +def unicodify(value, encoding: Any = ..., error: str = ..., default: Optional[Any] = ...): ... +def smart_str(s, encoding: Any = ..., strings_only: bool = ..., errors: str = ...): ... +def object_to_string(obj): ... +def string_to_object(s): ... + +class ParamsWithSpecs(collections.defaultdict): + specs = ... # type: Any + params = ... # type: Any + def __init__(self, specs: Optional[Any] = ..., params: Optional[Any] = ...) -> None: ... + def __missing__(self, name): ... + def __getattr__(self, name): ... + +def compare_urls(url1, url2, compare_scheme: bool = ..., compare_hostname: bool = ..., compare_path: bool = ...): ... +def read_dbnames(filename): ... +def read_build_sites(filename, check_builds: bool = ...): ... +def relativize_symlinks(path, start: Optional[Any] = ..., followlinks: bool = ...): ... +def stringify_dictionary_keys(in_dict): ... +def recursively_stringify_dictionary_keys(d): ... +def mkstemp_ln(src, prefix: str = ...): ... +def umask_fix_perms(path, umask, unmasked_perms, gid: Optional[Any] = ...): ... +def docstring_trim(docstring): ... +def nice_size(size): ... +def size_to_bytes(size): ... +def send_mail(frm, to, subject, body, config, html: Optional[Any] = ...): ... +def force_symlink(source, link_name): ... +def move_merge(source, target): ... +def safe_str_cmp(a, b): ... + +galaxy_root_path = ... # type: Any + +def galaxy_directory(): ... +def config_directories_from_setting(directories_setting, galaxy_root: Any = ...): ... +def parse_int(value, min_val: Optional[Any] = ..., max_val: Optional[Any] = ..., default: Optional[Any] = ..., allow_none: bool = ...): ... +def parse_non_hex_float(s): ... +def build_url(base_url, port: int = ..., scheme: str = ..., pathspec: Optional[Any] = ..., params: Optional[Any] = ..., doseq: bool = ...): ... +def url_get(base_url, password_mgr: Optional[Any] = ..., pathspec: Optional[Any] = ..., params: Optional[Any] = ...): ... +def safe_relpath(path): ... + +class ExecutionTimer: + begin = ... # type: Any + def __init__(self) -> None: ... diff --git a/typeshed/2.7/galaxy/util/dictifiable.pyi b/typeshed/2.7/galaxy/util/dictifiable.pyi new file mode 100644 index 0000000000..eaec1d90dd --- /dev/null +++ b/typeshed/2.7/galaxy/util/dictifiable.pyi @@ -0,0 +1,8 @@ +# Stubs for galaxy.util.dictifiable (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Optional + +class Dictifiable: + def to_dict(self, view: str = ..., value_mapper: Optional[Any] = ...): ... diff --git a/typeshed/2.7/galaxy/util/inflection.pyi b/typeshed/2.7/galaxy/util/inflection.pyi new file mode 100644 index 0000000000..065a7a3471 --- /dev/null +++ b/typeshed/2.7/galaxy/util/inflection.pyi @@ -0,0 +1,46 @@ +# Stubs for galaxy.util.inflection (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any + +class Base: + def cond_plural(self, number_of_records, word): ... + def titleize(self, word, uppercase: str = ...): ... + def camelize(self, word): ... + def underscore(self, word): ... + def humanize(self, word, uppercase: str = ...): ... + def variablize(self, word): ... + def tableize(self, class_name): ... + def classify(self, table_name): ... + def ordinalize(self, number): ... + def unaccent(self, text): ... + def string_replace(self, word, find, replace): ... + def urlize(self, text): ... + def demodulize(self, module_name): ... + def modulize(self, module_description): ... + def foreignKey(self, class_name, separate_class_name_and_id_with_underscore: int = ...): ... + +class English(Base): + def pluralize(self, word): ... + def singularize(self, word): ... + +class Inflector: + Inflector = ... # type: Any + def __init__(self, Inflector: Any = ...) -> None: ... + def pluralize(self, word): ... + def singularize(self, word): ... + def cond_plural(self, number_of_records, word): ... + def titleize(self, word, uppercase: str = ...): ... + def camelize(self, word): ... + def underscore(self, word): ... + def humanize(self, word, uppercase: str = ...): ... + def variablize(self, word): ... + def tableize(self, class_name): ... + def classify(self, table_name): ... + def ordinalize(self, number): ... + def unaccent(self, text): ... + def urlize(self, text): ... + def demodulize(self, module_name): ... + def modulize(self, module_description): ... + def foreignKey(self, class_name, separate_class_name_and_id_with_underscore: int = ...): ...