pyTooling.CLIAbstraction.ValuedTupleFlag

Valued tuple-flag arguments represent a name and a value as a 2-tuple.

See also

  • For flags with a value.
    ValuedFlag

  • For flags that have an optional value.
    NamedOptionalValuedFlag

Classes

  • ShortTupleFlag: Represents a ValuedTupleArgument with a single dash in front of the switch name.

  • LongTupleFlag: Represents a ValuedTupleArgument with a double dash in front of the switch name.

  • WindowsTupleFlag: Represents a ValuedTupleArgument with a single slash in front of the switch name.


Classes

class pyTooling.CLIAbstraction.ValuedTupleFlag.ShortTupleFlag(value)[source]

Represents a ValuedTupleArgument with a single dash in front of the switch name.

Example:

  • -file file1.txt

Inheritance

Inheritance diagram of ShortTupleFlag

Parameters:
classmethod __init_subclass__(*args, pattern='-{0}', **kwargs)[source]

This method is called when a class is derived.

Parameters:
  • args (Any) – Any positional arguments.

  • name – Name of the argument.

  • pattern (str) – This pattern is used to format an argument.

  • kwargs (Any) – Any keyword argument.

static __new__(cls, *args, **kwargs)[source]
Parameters:
AsArgument()

Convert this argument instance to a sequence of string representations with proper escaping using the matching pattern based on the internal name and value.

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument as tuple of strings.

Raises:

ValueError – If internal name is None.

property Name: str

Get the internal name.

Returns:

Internal name.

property Value: ValueT

Get the internal value.

Returns:

Internal value.

__class_getitem__()

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo[T]: ….

__init__(value)
Parameters:

value (ValueT)

Return type:

None

__repr__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Comma separated sequence of arguments formatted and each enclosed in double quotes.

__str__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Space separated sequence of arguments formatted and each enclosed in double quotes.

class pyTooling.CLIAbstraction.ValuedTupleFlag.LongTupleFlag(value)[source]

Represents a ValuedTupleArgument with a double dash in front of the switch name.

Example:

  • --file file1.txt

Inheritance

Inheritance diagram of LongTupleFlag

Parameters:
classmethod __init_subclass__(*args, pattern='--{0}', **kwargs)[source]

This method is called when a class is derived.

Parameters:
  • args (Any) – Any positional arguments.

  • name – Name of the argument.

  • pattern (str) – This pattern is used to format an argument.

  • kwargs (Any) – Any keyword argument.

static __new__(cls, *args, **kwargs)[source]
Parameters:
AsArgument()

Convert this argument instance to a sequence of string representations with proper escaping using the matching pattern based on the internal name and value.

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument as tuple of strings.

Raises:

ValueError – If internal name is None.

property Name: str

Get the internal name.

Returns:

Internal name.

property Value: ValueT

Get the internal value.

Returns:

Internal value.

__class_getitem__()

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo[T]: ….

__init__(value)
Parameters:

value (ValueT)

Return type:

None

__repr__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Comma separated sequence of arguments formatted and each enclosed in double quotes.

__str__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Space separated sequence of arguments formatted and each enclosed in double quotes.

class pyTooling.CLIAbstraction.ValuedTupleFlag.WindowsTupleFlag(value)[source]

Represents a ValuedTupleArgument with a single slash in front of the switch name.

Example:

  • /file file1.txt

Inheritance

Inheritance diagram of WindowsTupleFlag

Parameters:
classmethod __init_subclass__(*args, pattern='/{0}', **kwargs)[source]

This method is called when a class is derived.

Parameters:
  • args (Any) – Any positional arguments.

  • name – Name of the argument.

  • pattern (str) – This pattern is used to format an argument.

  • kwargs (Any) – Any keyword argument.

static __new__(cls, *args, **kwargs)[source]
Parameters:
AsArgument()

Convert this argument instance to a sequence of string representations with proper escaping using the matching pattern based on the internal name and value.

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument as tuple of strings.

Raises:

ValueError – If internal name is None.

property Name: str

Get the internal name.

Returns:

Internal name.

property Value: ValueT

Get the internal value.

Returns:

Internal value.

__class_getitem__()

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo[T]: ….

__init__(value)
Parameters:

value (ValueT)

Return type:

None

__repr__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Comma separated sequence of arguments formatted and each enclosed in double quotes.

__str__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Space separated sequence of arguments formatted and each enclosed in double quotes.