cwl_utils.expression_refactor
=============================

.. py:module:: cwl_utils.expression_refactor

.. autoapi-nested-parse::

   CWL Expression refactoring tool for CWL.



Attributes
----------

.. autoapisummary::

   cwl_utils.expression_refactor.defaultStreamHandler
   cwl_utils.expression_refactor.save_type


Classes
-------

.. autoapisummary::

   cwl_utils.expression_refactor.saveCWL


Functions
---------

.. autoapisummary::

   cwl_utils.expression_refactor.arg_parser
   cwl_utils.expression_refactor.parse_args
   cwl_utils.expression_refactor.add_input_to_process
   cwl_utils.expression_refactor.cltool_inputs_to_etool_inputs
   cwl_utils.expression_refactor.empty_inputs
   cwl_utils.expression_refactor.etool_to_cltool
   cwl_utils.expression_refactor.find_expressionLib
   cwl_utils.expression_refactor.generate_etool_from_expr2
   cwl_utils.expression_refactor.get_command_input_parameter
   cwl_utils.expression_refactor.get_command_line_binding
   cwl_utils.expression_refactor.get_inline_javascript_requirement
   cwl_utils.expression_refactor.get_input_for_id
   cwl_utils.expression_refactor.load_step
   cwl_utils.expression_refactor.process_CommandLineTool_output
   cwl_utils.expression_refactor.remove_JSReq
   cwl_utils.expression_refactor.main
   cwl_utils.expression_refactor.run
   cwl_utils.expression_refactor.refactor


Module Contents
---------------

.. py:data:: defaultStreamHandler

.. py:data:: save_type

.. py:class:: saveCWL

   Bases: :py:obj:`Protocol`

   .. autoapi-inheritance-diagram:: cwl_utils.expression_refactor.saveCWL
      :parts: 1


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


   .. py:method:: __call__(val, top = True, base_url = '', relative_uris = True)

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



.. py:function:: arg_parser()

   Build the argument parser.


.. py:function:: parse_args(args)

   Parse the command line options.


.. py:function:: add_input_to_process(process, cwlVersion, name, inptype, loadingOptions)

.. py:function:: cltool_inputs_to_etool_inputs(tool, cwlVersion)

.. py:function:: empty_inputs(process_or_step, cwlVersion, parent = None)

.. py:function:: etool_to_cltool(etool, cwlVersion, expressionLib = None)

.. py:function:: 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)


.. py:function:: 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.


.. py:function:: get_command_input_parameter(cwlVersion: Literal['v1.0'], id_: str, type_: Any) -> cwl_utils.parser.cwl_v1_0.CommandInputParameter
                 get_command_input_parameter(cwlVersion: Literal['v1.1'], id_: str, type_: Any) -> cwl_utils.parser.cwl_v1_1.CommandInputParameter
                 get_command_input_parameter(cwlVersion: Literal['v1.2'], id_: str, type_: Any) -> cwl_utils.parser.cwl_v1_2.CommandInputParameter

.. py:function:: get_command_line_binding(cwlVersion: Literal['v1.0'], valueFrom: str | None = ..., loadContents: bool | None = ...) -> cwl_utils.parser.cwl_v1_0.CommandLineBinding
                 get_command_line_binding(cwlVersion: Literal['v1.1'], valueFrom: str | None = ..., loadContents: bool | None = ...) -> cwl_utils.parser.cwl_v1_1.CommandLineBinding
                 get_command_line_binding(cwlVersion: Literal['v1.2'], valueFrom: str | None = ..., loadContents: bool | None = ...) -> cwl_utils.parser.cwl_v1_2.CommandLineBinding

.. py:function:: 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
                 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
                 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

.. py:function:: get_input_for_id(name, tool)

   Determine the CommandInputParameter for the given input name.


.. py:function:: load_step(step, replace_etool, skip_command_line1, skip_command_line2)

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


.. py:function:: process_CommandLineTool_output(ctool, cwlVersion, outp_id)

.. py:function:: remove_JSReq(process, skip_command_line1)

   Since the InlineJavascriptRequirement is longer needed, remove it.


.. py:function:: main()

   Console entry point.


.. py:function:: run(args)

   Collect the arguments and run.


.. py:function:: refactor(args)

   Primary processing loop.


