cwl_utils.expression_refactor

CWL Expression refactoring tool for CWL.

Attributes

defaultStreamHandler

save_type

Classes

saveCWL

Shortcut type for CWL v1.x parse.save().

Functions

arg_parser()

Build the argument parser.

parse_args(args)

Parse the command line options.

add_input_to_process(process, cwlVersion, name, ...)

cltool_inputs_to_etool_inputs(tool, cwlVersion)

empty_inputs(process_or_step, cwlVersion[, parent])

etool_to_cltool(etool, cwlVersion[, expressionLib])

find_expressionLib(processes)

Return the expressionLib from the highest priority InlineJavascriptRequirement.

generate_etool_from_expr2(expr, cwlVersion, target, inputs)

Generate an ExpressionTool to achieve the same result as the given expression.

get_command_input_parameter(…)

get_command_line_binding(…)

get_inline_javascript_requirement(…)

get_input_for_id(name, tool)

Determine the CommandInputParameter for the given input name.

load_step(step, replace_etool, skip_command_line1, ...)

If the step's Process is not inline, load and process it.

process_CommandLineTool_output(ctool, cwlVersion, outp_id)

remove_JSReq(process, skip_command_line1)

Since the InlineJavascriptRequirement is longer needed, remove it.

main()

Console entry point.

run(args)

Collect the arguments and run.

refactor(args)

Primary processing loop.

Module Contents

cwl_utils.expression_refactor.defaultStreamHandler
cwl_utils.expression_refactor.save_type
class cwl_utils.expression_refactor.saveCWL

Bases: Protocol

Inheritance diagram of cwl_utils.expression_refactor.saveCWL

Shortcut type for CWL v1.x parse.save().

__call__(val, top=True, base_url='', relative_uris=True)

Must use this instead of a Callable due to the keyword args.

Parameters:
  • val (Any)

  • top (bool)

  • base_url (str)

  • relative_uris (bool)

Return type:

save_type

cwl_utils.expression_refactor.arg_parser()

Build the argument parser.

Return type:

argparse.ArgumentParser

cwl_utils.expression_refactor.parse_args(args)

Parse the command line options.

Parameters:

args (list[str])

Return type:

argparse.Namespace

cwl_utils.expression_refactor.add_input_to_process(process, cwlVersion, name, inptype, loadingOptions)
Parameters:
Return type:

None

cwl_utils.expression_refactor.cltool_inputs_to_etool_inputs(tool, cwlVersion)
Parameters:
Return type:

collections.abc.Sequence[cwl_utils.parser.WorkflowInputParameter]

cwl_utils.expression_refactor.empty_inputs(process_or_step, cwlVersion, parent=None)
Parameters:
Return type:

dict[str, Any]

cwl_utils.expression_refactor.etool_to_cltool(etool, cwlVersion, expressionLib=None)
Parameters:
Return type:

cwl_utils.parser.CommandLineTool

cwl_utils.expression_refactor.find_expressionLib(processes)

Return the expressionLib from the highest priority InlineJavascriptRequirement.

processes: should be in order of least important to most important (Workflow, WorkflowStep, … CommandLineTool/ExpressionTool)

Parameters:

processes (collections.abc.Sequence[cwl_utils.parser.Process | cwl_utils.parser.WorkflowStep])

Return type:

list[str] | None

cwl_utils.expression_refactor.generate_etool_from_expr2(expr, cwlVersion, target, inputs, self_name=None, process=None, extra_processes=None)

Generate an ExpressionTool to achieve the same result as the given expression.

Parameters:
Return type:

cwl_utils.parser.ExpressionTool

cwl_utils.expression_refactor.get_command_input_parameter(cwlVersion: Literal['v1.0'], id_: str, type_: Any) → cwl_utils.parser.cwl_v1_0.CommandInputParameter
cwl_utils.expression_refactor.get_command_input_parameter(cwlVersion: Literal['v1.1'], id_: str, type_: Any) → cwl_utils.parser.cwl_v1_1.CommandInputParameter
cwl_utils.expression_refactor.get_command_input_parameter(cwlVersion: Literal['v1.2'], id_: str, type_: Any) → cwl_utils.parser.cwl_v1_2.CommandInputParameter
cwl_utils.expression_refactor.get_command_line_binding(cwlVersion: Literal['v1.0'], valueFrom: str | None = ..., loadContents: bool | None = ...) → cwl_utils.parser.cwl_v1_0.CommandLineBinding
cwl_utils.expression_refactor.get_command_line_binding(cwlVersion: Literal['v1.1'], valueFrom: str | None = ..., loadContents: bool | None = ...) → cwl_utils.parser.cwl_v1_1.CommandLineBinding
cwl_utils.expression_refactor.get_command_line_binding(cwlVersion: Literal['v1.2'], valueFrom: str | None = ..., loadContents: bool | None = ...) → cwl_utils.parser.cwl_v1_2.CommandLineBinding
cwl_utils.expression_refactor.get_inline_javascript_requirement(etool: cwl_utils.parser.ExpressionTool, cwlVersion: Literal['v1.0'], expression_lib: list[str] | None) → cwl_utils.parser.cwl_v1_0.InlineJavascriptRequirement
cwl_utils.expression_refactor.get_inline_javascript_requirement(etool: cwl_utils.parser.ExpressionTool, cwlVersion: Literal['v1.1'], expression_lib: list[str] | None) → cwl_utils.parser.cwl_v1_1.InlineJavascriptRequirement
cwl_utils.expression_refactor.get_inline_javascript_requirement(etool: cwl_utils.parser.ExpressionTool, cwlVersion: Literal['v1.2'], expression_lib: list[str] | None) → cwl_utils.parser.cwl_v1_2.InlineJavascriptRequirement
cwl_utils.expression_refactor.get_input_for_id(name, tool)

Determine the CommandInputParameter for the given input name.

Parameters:
Return type:

cwl_utils.parser.CommandInputParameter | cwl_utils.parser.WorkflowInputParameter | cwl_utils.parser.OperationInputParameter | None

cwl_utils.expression_refactor.load_step(step, replace_etool, skip_command_line1, skip_command_line2)

If the step’s Process is not inline, load and process it.

Parameters:
Return type:

bool

cwl_utils.expression_refactor.process_CommandLineTool_output(ctool, cwlVersion, outp_id)
Parameters:
Return type:

None

cwl_utils.expression_refactor.remove_JSReq(process, skip_command_line1)

Since the InlineJavascriptRequirement is longer needed, remove it.

Parameters:
Return type:

None

cwl_utils.expression_refactor.main()

Console entry point.

Return type:

None

cwl_utils.expression_refactor.run(args)

Collect the arguments and run.

Parameters:

args (list[str])

Return type:

int

cwl_utils.expression_refactor.refactor(args)

Primary processing loop.

Parameters:

args (argparse.Namespace)

Return type:

int