cwltool.command_line_tool
=========================

.. py:module:: cwltool.command_line_tool

.. autoapi-nested-parse::

   Implementation of CommandLineTool.



Attributes
----------

.. autoapisummary::

   cwltool.command_line_tool.OutputPortsType


Exceptions
----------

.. autoapisummary::

   cwltool.command_line_tool.ParameterOutputWorkflowException


Classes
-------

.. autoapisummary::

   cwltool.command_line_tool.PathCheckingMode
   cwltool.command_line_tool.ExpressionJob
   cwltool.command_line_tool.ExpressionTool
   cwltool.command_line_tool.AbstractOperation
   cwltool.command_line_tool.CallbackJob
   cwltool.command_line_tool.CommandLineTool


Functions
---------

.. autoapisummary::

   cwltool.command_line_tool.remove_path
   cwltool.command_line_tool.revmap_file
   cwltool.command_line_tool.check_adjust
   cwltool.command_line_tool.check_valid_locations


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

.. py:class:: PathCheckingMode

   Bases: :py:obj:`enum.Enum`

   .. autoapi-inheritance-diagram:: cwltool.command_line_tool.PathCheckingMode
      :parts: 1


   What characters are allowed in path names.

   We have the strict (default) mode and the relaxed mode.


   .. py:attribute:: STRICT

      Accepts names that contain one or more of the following:

      .. list-table::

         * - ``\w``
           - unicode word characters

             this includes most characters that can be part of a word in any
             language, as well as numbers and the underscore
         * - ``.``
           - a literal period
         * - ``+``
           - a literal plus sign
         * - ``,``
           - a literal comma
         * - ``-``
           - a literal minus sign
         * - ``:``
           - a literal colon
         * - ``@``
           - a literal at-symbol
         * - ``]``
           - a literal end-square-bracket
         * - ``^``
           - a literal caret symbol
         * - ``\u2600-\u26FF``
           - matches a single character in the range between ☀ (index 9728) and ⛿ (index 9983)
         * - ``\U0001f600-\U0001f64f``
           - matches a single character in the range between 😀 (index 128512) and 🙏 (index 128591)

      Note: the following characters are intentionally not included:

      1. reserved words in POSIX: ``!``, :code:`{`, ``}``

      2. POSIX metacharacters listed in the CWL standard as okay to reject: ``|``,
         ``&``, ``;``, ``<``, ``>``, ``(``, ``)``, ``$``, `````, ``"``, ``'``,
         :kbd:`<space>`, :kbd:`<tab>`, :kbd:`<newline>`.

         (In accordance with https://www.commonwl.org/v1.0/CommandLineTool.html#File under "path" )

      3. POSIX path separator: ``\``

         (also listed at https://www.commonwl.org/v1.0/CommandLineTool.html#File under "path")

      4. Additional POSIX metacharacters: ``*``, ``?``, ``[``, ``#``, ``˜``,
         ``=``, ``%``.

      TODO: switch to https://pypi.org/project/regex/ and use
      ``\p{Extended_Pictographic}`` instead of the manual emoji ranges



   .. py:attribute:: RELAXED

      Accept anything.



.. py:class:: ExpressionJob(builder, script, output_callback, requirements, hints, outdir = None, tmpdir = None)

   Job for :py:class:`ExpressionTool`.


   .. py:attribute:: builder


   .. py:attribute:: requirements


   .. py:attribute:: hints


   .. py:attribute:: output_callback


   .. py:attribute:: outdir
      :value: None



   .. py:attribute:: tmpdir
      :value: None



   .. py:attribute:: script


   .. py:method:: run(runtimeContext, tmpdir_lock = None)


.. py:class:: ExpressionTool(toolpath_object, loadingContext)

   Bases: :py:obj:`cwltool.process.Process`

   .. autoapi-inheritance-diagram:: cwltool.command_line_tool.ExpressionTool
      :parts: 1


   Abstract CWL Process.


   .. py:method:: job(job_order, output_callbacks, runtimeContext)


.. py:class:: AbstractOperation(toolpath_object, loadingContext)

   Bases: :py:obj:`cwltool.process.Process`

   .. autoapi-inheritance-diagram:: cwltool.command_line_tool.AbstractOperation
      :parts: 1


   Abstract CWL Process.


   .. py:method:: job(job_order, output_callbacks, runtimeContext)


.. py:function:: remove_path(f)

   Remove any 'path' property, if present.


.. py:function:: revmap_file(builder, outdir, f)

   Remap a file from internal path to external path.

   For Docker, this maps from the path inside tho container to the path
   outside the container. Recognizes files in the pathmapper or remaps
   internal output directories to the external directory.


.. py:class:: CallbackJob(job, output_callback, cachebuilder, jobcache)

   Callback Job class, used by :py:func:`CommandLineTool.job`.


   .. py:attribute:: job


   .. py:attribute:: output_callback


   .. py:attribute:: cachebuilder


   .. py:attribute:: outdir


   .. py:method:: run(runtimeContext, tmpdir_lock = None)


.. py:function:: check_adjust(accept_re, builder, file_o)

   Map files to assigned path inside a container.

   We need to also explicitly walk over input, as implicit reassignment
   doesn't reach everything in builder.bindings


.. py:function:: check_valid_locations(fs_access, ob)

.. py:data:: OutputPortsType

.. py:exception:: ParameterOutputWorkflowException(msg, port, **kwargs)

   Bases: :py:obj:`cwltool.errors.WorkflowException`

   .. autoapi-inheritance-diagram:: cwltool.command_line_tool.ParameterOutputWorkflowException
      :parts: 1


   Common base class for all non-exit exceptions.


.. py:class:: CommandLineTool(toolpath_object, loadingContext)

   Bases: :py:obj:`cwltool.process.Process`

   .. autoapi-inheritance-diagram:: cwltool.command_line_tool.CommandLineTool
      :parts: 1


   Abstract CWL Process.


   .. py:attribute:: path_check_mode
      :type:  PathCheckingMode


   .. py:method:: make_job_runner(runtimeContext)

      Return the correct CommandLineJob class given the container settings.



   .. py:method:: make_path_mapper(reffiles, stagedir, runtimeContext, separateDirs)
      :staticmethod:



   .. py:method:: updatePathmap(outdir, pathmap, fn)

      Update a PathMapper with a CWL File or Directory object.



   .. py:method:: job(job_order, output_callbacks, runtimeContext)


   .. py:method:: collect_output_ports(ports, builder, outdir, rcode, compute_checksum = True, jobname = '', readers = None)


   .. py:method:: collect_output(schema, builder, outdir, fs_access, compute_checksum = True)


