Skip to content

Add attrs validation to head, body, tail args on Parser #98

@bskinn

Description

@bskinn

No real validation currently for head or tail.

The requirement for body being present currently relies on a ~hacky call to .pattern(), ultimately hitting this error.

Far better to just validate all three more consistently. An attrs validator won't work, because they could be instances of Parser, and that will be challenging to put into the main class body. Probably better to use instanceof(..., self.__class__) inside __attrs_post_init__.

head and tail could be None, str, Parser, or Iterable(? Collection? Sequence? Also, how to ensure str contents? Don't bother checking contents?); body is the same, save None is not allowed.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions