ecap5_treq.req module

class ecap5_treq.req.Req(id: str, description: str, options: dict[str, list[str]], status: ReqStatus = 'UNCOVERED', result: int = 0)

Bases: object

A Req represents a requirement

to_str() str

Convert the req to a string

Returns:

a string representing the req

Return type:

str

class ecap5_treq.req.ReqStatus

Bases: object

A ReqStatus details the traceability status of requirements

COVERED = 'COVERED'
UNCOVERED = 'UNCOVERED'
UNTRACEABLE = 'UNTRACEABLE'
ecap5_treq.req.import_reqs(path: str, spec_format: SpecFormat) list[Req]

Imports reqs from the specification source files

Parameters:
  • path (str) – path to the root of the specification source files

  • spec_format (SpecFormat) – language format of the specification

Returns:

a list of checks from the specification source files

Return type:

list[Req]

ecap5_treq.req.rst_import_reqs(path: str) list[Req]

Imports reqs from the specification rst source files

Parameters:

path (str) – path to the root of the specification source files

Returns:

a list of checks from the specification source files

Return type:

list[Req]

ecap5_treq.req.rst_process_desc(cur: int, lines: list[str]) tuple[int, str]

Processes the description

Parameters:
  • cur (int) – pointer to the content’s current line being processed

  • lines (list[str]) – list of lines to process

Returns:

a tuple with both the incremented cur and the processed description

Return type:

tuple[int, str]

ecap5_treq.req.rst_process_id(cur: int, lines: list[str]) tuple[int, str]

Processes the requirement id from the requirement directive line

Parameters:
  • cur (int) – pointer to the content’s current line being processed

  • lines (list[str]) – list of lines to process

Returns:

a tuple with both the incremented cur and the processed id

Return type:

tuple[int, str]

ecap5_treq.req.rst_process_options(cur: int, lines: list[str]) tuple[int, dict[str, list[str]]]

Processes the options if any

Parameters:
  • cur (int) – pointer to the content’s current line being processed

  • lines (list[str]) – list of lines to process

Returns:

a tuple with both the incremented cur and the processed options

Return type:

tuple[int, dict[str, list[str]]]

ecap5_treq.req.rst_skip_empty_lines(cur: int, lines: list[str]) int

Advances the cursor to the next non-empty line

Parameters:
  • cur (int) – pointer to the content’s current line being processed

  • lines (list[str]) – list of lines to process

Returns:

the incremented cursor

Return type:

tuple[int, str]

ecap5_treq.req.tex_import_reqs(path: str) list[Req]

Imports reqs from the specification latex source files

Parameters:

path (str) – path to the root of the specification source files

Returns:

a list of checks from the specification source files

Return type:

list[Req]

ecap5_treq.req.tex_process_keyword(cur: int, content: str) int

Increments cur to point to the char following the next curly bracket in latex content

Parameters:
  • cur (int) – pointer to a char in content

  • content (str) – content string

Returns:

the incremented cur pointing to the char following the next curly bracket in content

Return type:

int

ecap5_treq.req.tex_process_matching_token(cur: int, content: str, opening_token: str, closing_token: str) tuple[int, str]

Recovers a string containined in matching tokens provided as parameters for latex specification

Parameters:
  • cur (int) – pointer to the starting char in content

  • content (str) – content string

  • opening_token (str) – opening token used for the token matching

  • closing_token (str) – closing token used for the token matching

Returns:

a tuple containing both an incremented cur pointing to the next char fater the closing token and the recovered string

Return type:

tuple[int, str]

ecap5_treq.req.tex_process_options(options: str) dict[str, list[str]]

Converts the latex options string to a dictionary

Parameters:

options (str) – the options string

Returns:

a dictionary containing the options

Return type:

dict[str, list[str]]