fluidasserts.helper.lang module

This module has helper functions for code analysis modules.

fluidasserts.helper.lang.generic_method(path, gmmr, func, msgs, excl=None, spec=None, reverse=False)

Check grammar in a destination and propagate results upwards.

Return type

tuple

fluidasserts.helper.lang.parse(grammar, path, lang_spec, exclude=None)

Return a tuple with the results of parsing path with grammar.

the left element contains the matched results, the right element contains the results that didn’t match.

Parameters
  • grammar (pyparsing.ParserElement) – Grammar to be searched for in path.

  • path (str) – Path to the destination file.

  • lang_spec (dict) – Contains language-specific syntax elements, such as acceptable file extensions and comment delimiters.

Return type

typing.Tuple[typing.List[fluidasserts.Unit], typing.List[fluidasserts.Unit]]

fluidasserts.helper.lang.parse_single(grammar, path)

Return a tuple with the results of parsing path with grammar.

the left element contains the matched results, the right element contains the results that didn’t match.

Parameters
  • grammar (pyparsing.ParserElement) – Grammar to be searched for in path.

  • path (str) – Path to the destination file.

Return type

typing.Tuple[typing.List[fluidasserts.Unit], typing.List[fluidasserts.Unit]]