almanac.arguments

class ArgumentBase(param: inspect.Parameter, *, name: Optional[str] = None, description: Optional[str] = None, completers: Optional[Union[prompt_toolkit.completion.base.Completer, Iterable[prompt_toolkit.completion.base.Completer]]] = None, hidden: bool = False)[source]

Bases: abc.ABC

An abstract class for encapsulating a command argument.

This abstract base class is extended into two variants:

It is unlikely that you should need to manually instantiate instances of these classes, as they are mainly used internally for the argument-generating decorators accessible via Application.

property annotation

The annotated type of this parameter.

abstract property completers

The registered completers for this argument.

property default_value

The default value of this argument (if it has one).

property description

A description of what this argument does.

property display_name

The name used to specify this argument from the interactive shell.

property has_default_value

Whether this argument has a default value.

property hidden

Whether this argument should be hidden in the interactive prompt.

property is_kw_only

Whether this argument is a keyword-only argument.

property is_pos_only

Whether this argument is a positional-only argument.

property is_var_kw

Whether this argument is a **kwargs variant.

property is_var_pos

Whether this argument is an *args variant.

property param

The internal inspect.Parameter wrapped by this class.

property real_name

The name of this argument within the actual command coroutine.

class FrozenArgument(param: inspect.Parameter, *, name: Optional[str] = None, description: Optional[str] = None, completers: Optional[Union[prompt_toolkit.completion.base.Completer, Iterable[prompt_toolkit.completion.base.Completer]]] = None, hidden: bool = False)[source]

Bases: almanac.arguments.argument_base.ArgumentBase

An encapsulation of an argument which can no longer be mutated.

Setters for the various fields that can be mutated MutableCommand will raise FrozenAccessError.

abbreviated_description

A shortened version of this arguments description.

property completers

The registered completers for this argument.

class MutableArgument(param: inspect.Parameter, *, name: Optional[str] = None, description: Optional[str] = None, completers: Optional[Union[prompt_toolkit.completion.base.Completer, Iterable[prompt_toolkit.completion.base.Completer]]] = None, hidden: bool = False)[source]

Bases: almanac.arguments.argument_base.ArgumentBase

An encapsulation of an argument which can be mutated.

property completers

The registered completers for this argument.

freeze()almanac.arguments.frozen_argument.FrozenArgument[source]