Skip to content

subcommand

[ allennlp.commands.subcommand ]


Base class for subcommands under allennlp.run.

T#

T = TypeVar("T", bound="Subcommand")

Subcommand Objects#

class Subcommand(Registrable)

An abstract class representing subcommands for allennlp.run. If you wanted to (for example) create your own custom special-evaluate command to use like

allennlp special-evaluate ...

you would create a Subcommand subclass and then pass it as an override to main.

reverse_registry#

reverse_registry = {}

add_subparser#

 | def add_subparser(
 |     self,
 |     parser: argparse._SubParsersAction
 | ) -> argparse.ArgumentParser

register#

 | @classmethod
 | @overrides
 | def register(
 |     cls: Type[T],
 |     name: str,
 |     constructor: Optional[str] = None,
 |     exist_ok: bool = False
 | ) -> Callable[[Type[T]], Type[T]]

name#

 | @property
 | def name(self) -> str