RawData

class ase2sprkkr.common.grammar_types.data.RawData(prefix=None, postfix=None, format='', after_format=None, default_value=None, condition=None, after_convert=None, description='', *, lines=None, indented=False, line_length=None, ends_with=None, ends_with_str=None, include_ends_with=False)[source]

Match anything up to the end of the file or to the given delimiter

Class hierarchy

Inheritance diagram of ase2sprkkr.common.grammar_types.data.RawData


Constructor

Parameters:
  • prefix (str | None)

  • postfix (str | None)

  • format (str)

  • after_format (str | None)

  • default_value (Any)

  • condition (Callable[[Any], bool | str] | None)

  • after_convert (Callable[[Any], Any] | None)

  • ends_with (str | re.Pattern)

__init__(prefix=None, postfix=None, format='', after_format=None, default_value=None, condition=None, after_convert=None, description='', *, lines=None, indented=False, line_length=None, ends_with=None, ends_with_str=None, include_ends_with=False)[source]
Parameters:
  • lines – Number of lines to read. A string denotes the exact path of an option containing the count. A callable derives the count from the options named by its parameters; DependentValue supports explicit paths such as ..N.

  • indented –

    If there are <n> spaces before data, pass n to this arg.

    If the file has the following structure:

    .......................................
         ....rest of the splitted line.....
         ....rest of the splitted line.
    ....... The second line................
         ..... the rest of the ............
         ............ second line ...
    ............
    

    Pass a tuple with two integers into this argument. The first number of tuple is the max. number of characters on a line, longer lines will be splitted. The second number is the number of spaces placed on the begining of the new lines created by splitting the old.

  • prefix (str | None)

  • postfix (str | None)

  • format (str)

  • after_format (str | None)

  • default_value (Any)

  • condition (Callable[[Any], bool | str] | None)

  • after_convert (Callable[[Any], Any] | None)

  • ends_with (str | re.Pattern)

line_length

Wrap the lines longer than a given number

ends_with

The data ends with a given string.

ends_with_str

If ends_with is regex, print this on end of the data

include_ends_with

Include the ending delimiter to the data.

**kwargs

Any other arguments are passed to the GrammarType constructor

_n_lines_grammar(lines)[source]

return a grammar for n lines of text

_grammar(param_name=False)[source]
_string(val)[source]
added_to_container(container)[source]
_set_number_of_lines(lines)[source]
copy()[source]
convert(val)[source]