Arg

Arg

class Arg[source]

Bases: object

Base class for all kinds of arguments

Attributes

Note: attributes inherited from parent classes are not shown here, if any

help

Help for the argument

short_flag_name

Short option name, used in command line parsing, prefixed by a single hyphen

long_flag_name

Long option name used in command line argument parsing

Methods

all_flags

Returns a sequence of all forms of command line flags

argparse_argument_kwargs

Returns the keyword arguments for use with argparse.ArgumentParser.add_argument

update_dict_

Returns updated values for this argument, used during App construction

update_processor

Updates a config processor with the processing required by this argument

updated

Returns a copy of this argument with some data updated from its declaration context

List of members of Arg

help: Optional[str]

Help for the argument

short_flag_name: Optional[str]

Short option name, used in command line parsing, prefixed by a single hyphen

long_flag_name: Optional[Union[str, configpile.enums.Derived]]

Long option name used in command line argument parsing

It is in general lowercase, prefixed with -- and words are separated by hyphens.,

If set to

all_flags()[source]

Returns a sequence of all forms of command line flags

Return type

Sequence[str]

update_dict_(name, help, env_prefix)[source]

Returns updated values for this argument, used during App construction

Parameters
  • name (str) – Argument field name

  • help (Optional[str]) – Argument docstring which describes the argument role

  • env_prefix (Optional[str]) – Uppercase prefix for all environment variables

Returns:

Return type

Mapping[str, Any]

updated(name, help, env_prefix)[source]

Returns a copy of this argument with some data updated from its declaration context

Parameters
  • self (TypeVar(_Arg, bound= Arg)) –

  • name (str) – Identifier name

  • help (str) – Help string (derived from autodoc syntax)

  • env_prefix (Optional[str]) – Environment prefix

Return type

TypeVar(_Arg, bound= Arg)

Returns

Updated argument

update_processor(pf)[source]

Updates a config processor with the processing required by this argument

Parameters

pf (ProcessorFactory[TypeVar(_Config, bound= Config)]) – Processor factory

Return type

None

argparse_argument_kwargs()[source]

Returns the keyword arguments for use with argparse.ArgumentParser.add_argument

Return type

Mapping[str, Any]

Returns

Keyword arguments mapping

__init__(help, short_flag_name, long_flag_name)