Options

Option

class CommonOption(name)

Bases: object

Useful for giving a type to arguments when str just won’t cut it.

Parameters:

name (str) – The name of the option. It is also considered as the value of the option.

property name

The name and string value of the option.

Returns:

The name of the option.

Return type:

str

Has Option

class HasCommonOptions(options)

Bases: object

An inheritable class that provides a dictionary of custom options.

Parameters:

options (Dict[CommonOption, Any]) – The options contained within the class.

get_option(option, default_value=None)

Retrieve the value of an option.

Parameters:
  • option (CommonOption) – The option to retrieve.

  • default_value (Any) – A default value to return when an option does not exist. Default is None.

Returns:

An option or the default value if not found.

Return type:

Any

property options

Retrieve all options.

Returns:

A dictionary of options.

Return type:

Dict[str, Any]

remove_option(option)

Remove an option.

Parameters:

option (CommonOption) – The option to delete.

set_option(option, value)

Set an option to have the specified value.

Parameters:
  • option (CommonOption) – The option to set the value of.

  • value (Any) – The value to set an option to.