class documentation

class OptionParser(optparse.OptionParser, docutils.SettingsSpec):

View In Hierarchy

Parser for command-line and library use. The settings_spec specification here and in other Docutils components are merged to build the set of command-line options and runtime settings for this process.

Common settings (defined below) and component-specific settings must not conflict. Short options are reserved for common settings, and components are restrict to using long options.

Method __init__ components is a list of Docutils components each containing a .settings_spec attribute. defaults is a mapping of setting default overrides.
Method check​_args Undocumented
Method check​_values Store positional arguments as runtime settings.
Method get​_config​_file​_settings Returns a dictionary containing appropriate config file settings.
Method get​_default​_values Needed to get custom Values instances.
Method get​_option​_by​_dest Get an option by its dest.
Method get​_standard​_config​_files Return list of config files, from environment or standard.
Method get​_standard​_config​_settings Undocumented
Method populate​_from​_components No summary
Method set​_defaults​_from​_dict Undocumented
Class Variable booleans Lookup table for boolean configuration file settings.
Class Variable config​_section The name of the config file section specific to this component (lowercase, no brackets). Override in subclasses.
Class Variable default​_error​_encoding Undocumented
Class Variable default​_error​_encoding​_error​_handler Undocumented
Class Variable settings​_defaults Defaults for settings that don't have command-line option equivalents.
Class Variable settings​_spec Runtime settings and command-line options common to all Docutils front ends. Setting specs specific to individual Docutils components are also used (see populate_from_components()).
Class Variable standard​_config​_files Docutils configuration files, using ConfigParser syntax. Filenames will be tilde-expanded later. Later files override earlier ones.
Class Variable threshold​_choices Possible inputs for for --report and --halt threshold values.
Class Variable thresholds Lookup table for --report and --halt threshold values.
Class Variable version​_template Default version message.
Instance Variable components Undocumented
Instance Variable config​_files List of paths of applied configuration files.
Instance Variable lists Set of list-type settings.
Instance Variable relative​_path​_settings Settings containing filesystem paths. Override in subclasses. Settings listed here are to be interpreted relative to the current working directory.
Instance Variable version Undocumented

Inherited from SettingsSpec:

Class Variable config​_section​_dependencies No summary
Class Variable settings​_default​_overrides A dictionary of auxiliary defaults, to override defaults for settings defined in other components. Override in subclasses.
def __init__(self, components=(), defaults=None, read_config_files=None, *args, **kwargs):
components is a list of Docutils components each containing a .settings_spec attribute. defaults is a mapping of setting default overrides.
def check_args(self, args):

Undocumented

def check_values(self, values, args):
Store positional arguments as runtime settings.
def get_config_file_settings(self, config_file):
Returns a dictionary containing appropriate config file settings.
def get_default_values(self):
Needed to get custom Values instances.
def get_option_by_dest(self, dest):

Get an option by its dest.

If you're supplying a dest which is shared by several options, it is undefined which option of those is returned.

A KeyError is raised if there is no option with the supplied dest.

def get_standard_config_files(self):
Return list of config files, from environment or standard.
def get_standard_config_settings(self):

Undocumented

def populate_from_components(self, components):
For each component, first populate from the SettingsSpec.settings_spec structure, then from the SettingsSpec.settings_defaults dictionary. After all components have been processed, check for and populate from each component's SettingsSpec.settings_default_overrides dictionary.
def set_defaults_from_dict(self, defaults):

Undocumented

booleans: dict[str, bool] =
Lookup table for boolean configuration file settings.
config_section: str =
The name of the config file section specific to this component (lowercase, no brackets). Override in subclasses.
default_error_encoding =

Undocumented

default_error_encoding_error_handler: str =

Undocumented

settings_defaults: dict =
Defaults for settings that don't have command-line option equivalents.
settings_spec =
Runtime settings and command-line options common to all Docutils front ends. Setting specs specific to individual Docutils components are also used (see populate_from_components()).
standard_config_files: list[str] =
Docutils configuration files, using ConfigParser syntax. Filenames will be tilde-expanded later. Later files override earlier ones.
threshold_choices =
Possible inputs for for --report and --halt threshold values.
thresholds: dict[str, int] =
Lookup table for --report and --halt threshold values.
version_template =
Default version message.
components =

Undocumented

config_files: list =
List of paths of applied configuration files.
lists: dict =
Set of list-type settings.
relative_path_settings =
Settings containing filesystem paths. Override in subclasses. Settings listed here are to be interpreted relative to the current working directory.
version =

Undocumented