e3.testsuite.optfileparser
==========================

.. py:module:: e3.testsuite.optfileparser

.. autoapi-nested-parse::

   test.opt files processing.

   This package provides a single class called OptFileParse which process the
   test.opt files. These files are used mainly to tweak tests depending on the
   context.



Attributes
----------

.. autoapisummary::

   e3.testsuite.optfileparser.OPTLINE_REGEXPS
   e3.testsuite.optfileparser.TAGS
   e3.testsuite.optfileparser.ARG
   e3.testsuite.optfileparser.OVERIDABLE
   e3.testsuite.optfileparser.logger


Exceptions
----------

.. autoapisummary::

   e3.testsuite.optfileparser.BadFormattingError


Classes
-------

.. autoapisummary::

   e3.testsuite.optfileparser.OptFileParse


Functions
---------

.. autoapisummary::

   e3.testsuite.optfileparser.main


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

.. py:data:: OPTLINE_REGEXPS

.. py:exception:: BadFormattingError

   Bases: :py:obj:`Exception`


   Raised when an input line is not correctly formatted.


.. py:data:: TAGS
   :type:  Literal[0]
   :value: 0


.. py:data:: ARG
   :type:  Literal[1]
   :value: 1


.. py:data:: OVERIDABLE
   :type:  Literal[2]
   :value: 2


.. py:data:: logger

.. py:class:: OptFileParse(system_tags: Union[str, List[str]], filename: Union[str, List[str]])

   test.opt parser.

   ATTRIBUTES
     system_tags: the list of tags applied to the test.opt
     is_dead: True if the test should be considered DEAD, False otherwise


   .. py:attribute:: is_dead
      :value: False



   .. py:attribute:: __note
      :type:  Optional[Tuple[List[str], str, bool]]
      :value: None



   .. py:attribute:: __enable_note
      :value: False



   .. py:attribute:: __matches
      :type:  Dict[str, Tuple[List[str], str, bool]]


   .. py:method:: get_value(cmd: str, default_value: Optional[str] = None) -> Optional[str]

      Query on the parsing result.

      :param cmd: The command on which we do the query ex: dead, cmd, out...
      :param default_value: Value returned by default.

      :return: A string or default value (None by default).

      by default the query will return ``default_value`` if there is no
      entry for the selected command.



   .. py:method:: get_values(default_values: Dict[str, Optional[str]]) -> Dict[str, Optional[str]]

      Query on the parsing result.

      :param default_values: A dictionary for which keys are the commands on
          which we do the query and the associated default values.

      :return: A dictionary containing the resulting value for each command.

      Doing ``get_values({"CMD": "test.cmd", "OUT": "test.out"})`` is
      equivalent to do::

          get_value("CMD", "test.cmd")
          get_value("OUT", "test.out")



   .. py:method:: get_note(sep: Optional[str] = None) -> Union[str, List[str]]

      Get the note.

      :param sep: string used to join the activating tags. Default is ",".
          If "" is specified then a list is returned.

      :return: a string (list of tags responsible for the activation of the
          test) is sep is not "" or a list.

      If there is no note then "" or [] is returned depending on the sep
      value



   .. py:method:: __process_opt_line(line: str) -> None

      process one line of a test.opt type file.

      :raise BadFormattingError: in case the line cannot be parsed

      The format of each line is the following::

          tag1,tag2,tag3,...,tagN [COMMAND [PARAMETERS]]

      if no COMMAND is given then we assume that the command is 'DEAD false'



   .. py:method:: __is_overidable(cmd: str) -> bool


   .. py:method:: __is_all(tag_list: List[str]) -> bool
      :classmethod:



   .. py:method:: __is_dead_cmd(cmd: str) -> bool


   .. py:method:: __match(tag_list: List[str]) -> bool

      Match tags against the system tags.

      True if all non-negated tags and none of the negated tags in the given
      list are present in system tags.



   .. py:method:: __parse_file(filename: Union[str, List[str]]) -> None


   .. py:method:: __str__() -> str


.. py:function:: main(argv: Optional[List[str]] = None) -> None

