sumolib.options | index /home/delphi/gcc/sumo/tools/sumolib/options.py

`# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2012-2022 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0/
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the Eclipse
# Public License 2.0 are satisfied: GNU General Public License, version 2
# or later which is available at
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later`

Modules
`` |  |
argparse xml.sax.handler io | optparse os re | xml.sax.saxutils subprocess sys |

Classes
`` |  | argparse.Action(argparse._AttributeHolder) SplitAction argparse.ArgumentParser(argparse._AttributeHolder, argparse._ActionsContainer) ArgumentParser builtins.tuple(builtins.object) Option xml.sax.handler.ContentHandler(builtins.object) ConfigurationReader OptionReader
class ArgumentParser(argparse.ArgumentParser)
`` | `ArgumentParser(allowed_programs=[], *args, **kwargs) Drop-in replacement for argparse.ArgumentParser that adds support for sumo-style config files. Inspired by https://github.com/bw2/ConfigArgParse`
| Method resolution order: ArgumentParser argparse.ArgumentParser argparse._AttributeHolder argparse._ActionsContainer builtins.object Methods defined here: __init__(self, allowed_programs=[], *args, **kwargs) `Initialize self. See help(type(self)) for accurate signature.` add_argument(self, *args, **kwargs) `add_argument(dest, ..., name=value, ...) add_argument(option_string, option_string, ..., name=value, ...)` add_option(self, *args, **kwargs) `alias for compatibility with OptionParser` parse_args(self, args=None, namespace=None) parse_known_args(self, args=None, namespace=None) write_config_file(self, namespace, exit=True, toString=False) write_config_to_file(self, out, namespace, print_template) Methods inherited from argparse.ArgumentParser: add_subparsers(self, **kwargs) `# ================================== # Optional/Positional adding methods # ==================================` convert_arg_line_to_args(self, arg_line) error(self, message) `error(message: string) Prints a usage message incorporating the message to stderr and exits. If you override this in a subclass, it should not return -- it should either exit or raise an exception.` exit(self, status=0, message=None) `# =============== # Exiting methods # ===============` format_help(self) format_usage(self) `# ======================= # Help-formatting methods # =======================` parse_intermixed_args(self, args=None, namespace=None) parse_known_intermixed_args(self, args=None, namespace=None) print_help(self, file=None) print_usage(self, file=None) `# ===================== # Help-printing methods # =====================` Methods inherited from argparse._AttributeHolder: __repr__(self) `Return repr(self).` Data descriptors inherited from argparse._AttributeHolder: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Methods inherited from argparse._ActionsContainer: add_argument_group(self, *args, **kwargs) add_mutually_exclusive_group(self, **kwargs) get_default(self, dest) register(self, registry_name, value, object) `# ==================== # Registration methods # ====================` set_defaults(self, **kwargs) `# ================================== # Namespace default accessor methods # ==================================`
class ConfigurationReader(xml.sax.handler.ContentHandler)
`` | `ConfigurationReader(optParse, groups, configoptions) Reads a configuration template, storing the options in an OptionParser`
| Method resolution order: ConfigurationReader xml.sax.handler.ContentHandler builtins.object Methods defined here: __init__(self, optParse, groups, configoptions) `Initialize self. See help(type(self)) for accurate signature.` endElement(self, name) `Signals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.` startElement(self, name, attrs) `Signals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.` Methods inherited from xml.sax.handler.ContentHandler: characters(self, content) `Receive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.` endDocument(self) `Receive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.` endElementNS(self, name, qname) `Signals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.` endPrefixMapping(self, prefix) `End the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.` ignorableWhitespace(self, whitespace) `Receive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.` processingInstruction(self, target, data) `Receive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.` setDocumentLocator(self, locator) `Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.` skippedEntity(self, name) `Receive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.` startDocument(self) `Receive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).` startElementNS(self, name, qname, attrs) `Signals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.` startPrefixMapping(self, prefix, uri) `Begin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.` Data descriptors inherited from xml.sax.handler.ContentHandler: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class Option(builtins.tuple)
`` | `Option(name, value, type, help) Option(name, value, type, help)`
| Method resolution order: Option builtins.tuple builtins.object Methods defined here: __getnewargs__(self) `Return self as a plain tuple. Used by copy and pickle.` __repr__(self) `Return a nicely formatted representation string` _asdict(self) `Return a new dict which maps field names to their values.` _replace(self, /, **kwds) `Return a new Option object replacing specified fields with new values` Class methods defined here: _make(iterable) from builtins.type `Make a new Option object from a sequence or iterable` Static methods defined here: __new__(_cls, name, value, type, help) `Create new instance of Option(name, value, type, help)` Data descriptors defined here: name `Alias for field number 0` value `Alias for field number 1` type `Alias for field number 2` help `Alias for field number 3` Data and other attributes defined here: _field_defaults = {} _fields = ('name', 'value', 'type', 'help') _fields_defaults = {} Methods inherited from builtins.tuple: __add__(self, value, /) `Return self+value.` __contains__(self, key, /) `Return key in self.` __eq__(self, value, /) `Return self==value.` __ge__(self, value, /) `Return self>=value.` __getattribute__(self, name, /) `Return getattr(self, name).` __getitem__(self, key, /) `Return self[key].` __gt__(self, value, /) `Return self>value.` __hash__(self, /) `Return hash(self).` __iter__(self, /) `Implement iter(self).` __le__(self, value, /) `Return self<=value.` __len__(self, /) `Return len(self).` __lt__(self, value, /) `Return self<value.` __mul__(self, value, /) `Return self*value.` __ne__(self, value, /) `Return self!=value.` __rmul__(self, value, /) `Return value*self.` count(self, value, /) `Return number of occurrences of value.` index(self, value, start=0, stop=9223372036854775807, /) `Return first index of value. Raises ValueError if the value is not present.`
class OptionReader(xml.sax.handler.ContentHandler)
`` | `Reads an option file`
| Method resolution order: OptionReader xml.sax.handler.ContentHandler builtins.object Methods defined here: __init__(self) `Initialize self. See help(type(self)) for accurate signature.` startElement(self, name, attrs) `Signals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.` Methods inherited from xml.sax.handler.ContentHandler: characters(self, content) `Receive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.` endDocument(self) `Receive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.` endElement(self, name) `Signals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.` endElementNS(self, name, qname) `Signals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.` endPrefixMapping(self, prefix) `End the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.` ignorableWhitespace(self, whitespace) `Receive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.` processingInstruction(self, target, data) `Receive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.` setDocumentLocator(self, locator) `Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.` skippedEntity(self, name) `Receive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.` startDocument(self) `Receive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).` startElementNS(self, name, qname, attrs) `Signals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.` startPrefixMapping(self, prefix, uri) `Begin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.` Data descriptors inherited from xml.sax.handler.ContentHandler: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class SplitAction(argparse.Action)
`` | `SplitAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None) Information about how to convert command line strings to Python objects. Action objects are used by an ArgumentParser to represent the information needed to parse a single argument from one or more strings from the command line. The keyword arguments to the Action constructor are also all attributes of Action instances. Keyword Arguments: - option_strings -- A list of command-line option strings which should be associated with this action. - dest -- The name of the attribute to hold the created object(s) - nargs -- The number of command-line arguments that should be consumed. By default, one argument will be consumed and a single value will be produced. Other values include: - N (an integer) consumes N arguments (and produces a list) - '?' consumes zero or one arguments - '*' consumes zero or more arguments (and produces a list) - '+' consumes one or more arguments (and produces a list) Note that the difference between the default and nargs=1 is that with the default, a single value will be produced, while with nargs=1, a list containing a single value will be produced. - const -- The value to be produced if the option is specified and the option uses an action that takes no values. - default -- The value to be produced if the option is not specified. - type -- A callable that accepts a single string argument, and returns the converted value. The standard Python types str, int, float, and complex are useful examples of such callables. If None, str is used. - choices -- A container of values that should be allowed. If not None, after a command-line argument has been converted to the appropriate type, an exception will be raised if it is not a member of this collection. - required -- True if the action must always be specified at the command line. This is only meaningful for optional command-line arguments. - help -- The help string describing the argument. - metavar -- The name to be used for the option's argument with the help string. If None, the 'dest' value will be used as the name.`
| Method resolution order: SplitAction argparse.Action argparse._AttributeHolder builtins.object Methods defined here: __call__(self, parser, args, values, option_string=None) `Call self as a function.` Methods inherited from argparse.Action: __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None) `Initialize self. See help(type(self)) for accurate signature.` Methods inherited from argparse._AttributeHolder: __repr__(self) `Return repr(self).` Data descriptors inherited from argparse._AttributeHolder: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`

Functions
`` |  | assign_prefixed_options(args, allowed_programs) get_long_option_names(application) get_prefixed_options(options) pullOptions(executable, optParse, groups=None, configoptions=None) readOptions(filename) xmlescape(value)

Data
`` |  | absolute_import = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0), 262144) print_function = _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 1048576)