pyTooling.CLIAbstraction.OptionalValuedFlag

Todo

Write module documentation.

Classes


Classes

class pyTooling.CLIAbstraction.OptionalValuedFlag.OptionalValuedFlag(value=None)[source]

Class and base-class for all OptionalValuedFlag classes, which represents a flag argument with data.

An optional valued flag is a flag name followed by a value. The default delimiter sign is equal (=). Name and value are passed as one argument to the executable even if the delimiter sign is a whitespace character. If the value is None, no delimiter sign and value is passed.

Example: width=100

Inheritance

Inheritance diagram of OptionalValuedFlag

Parameters:
classmethod __init_subclass__(*args, pattern='{0}', patternWithValue='{0}={1}', **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.

  • patternWithValue (str)

static __new__(cls, *args, **kwargs)[source]
Parameters:
__init__(value=None)[source]
Parameters:

value (str | None)

Return type:

None

property Value: str | None

Get the internal value.

Returns:

Internal value.

AsArgument()[source]

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

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument.

Raises:

ValueError – If internal name is None.

__str__()[source]

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

__repr__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

property Name: str

Get the internal name.

Returns:

Internal name.

__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]: ….

class pyTooling.CLIAbstraction.OptionalValuedFlag.ShortOptionalValuedFlag(value=None)[source]

Represents a OptionalValuedFlag with a single dash.

Example: -optimizer=on

Inheritance

Inheritance diagram of ShortOptionalValuedFlag

Parameters:
classmethod __init_subclass__(*args, pattern='-{0}', patternWithValue='-{0}={1}', **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.

  • patternWithValue (str)

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

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

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument.

Raises:

ValueError – If internal name is None.

property Name: str

Get the internal name.

Returns:

Internal name.

property Value: str | None

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=None)
Parameters:

value (str | None)

Return type:

None

__repr__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

__str__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

class pyTooling.CLIAbstraction.OptionalValuedFlag.LongOptionalValuedFlag(value=None)[source]

Represents a OptionalValuedFlag with a double dash.

Example: --optimizer=on

Inheritance

Inheritance diagram of LongOptionalValuedFlag

Parameters:
classmethod __init_subclass__(*args, pattern='--{0}', patternWithValue='--{0}={1}', **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.

  • patternWithValue (str)

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

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

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument.

Raises:

ValueError – If internal name is None.

property Name: str

Get the internal name.

Returns:

Internal name.

property Value: str | None

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=None)
Parameters:

value (str | None)

Return type:

None

__repr__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

__str__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

class pyTooling.CLIAbstraction.OptionalValuedFlag.WindowsOptionalValuedFlag(value=None)[source]

Represents a OptionalValuedFlag with a single slash.

Example: /optimizer:on

Inheritance

Inheritance diagram of WindowsOptionalValuedFlag

Parameters:
classmethod __init_subclass__(*args, pattern='/{0}', patternWithValue='/{0}:{1}', **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.

  • patternWithValue (str)

AsArgument()

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

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument.

Raises:

ValueError – If internal name is None.

property Name: str

Get the internal name.

Returns:

Internal name.

property Value: str | None

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=None)
Parameters:

value (str | None)

Return type:

None

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

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

__str__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.