schrodinger.utils.singledashoptionparser module¶
SingleDashOptionParser has been deprecated in favor of using the argparse.ArgumentParser directly.
- class schrodinger.utils.singledashoptionparser.SingleDashOption(*args, **kwargs)¶
Bases:
optparse.Option
A class to automatically translate long options with single dashes into double dash long options, but still print out help with the single dash.
- __init__(*args, **kwargs)¶
- process_option_strings(formatted_option_strings)¶
Post-process the provided formatted options string to replace the translated double dash options with their original single dash specifications.
- class schrodinger.utils.singledashoptionparser.DelegatingIndentedHelpFormatter(indent_increment=2, max_help_position=24, width=None, short_first=1)¶
Bases:
optparse.IndentedHelpFormatter
An IndentedHelpFormatter class that allows an Option class to alter its own option string if it has a process_option_strings method.
- format_option_strings(option)¶
Return a formatted option string.
Allow the provided option to alter the string if it has a process_option_strings() method.
- class schrodinger.utils.singledashoptionparser.SingleDashOptionParser(*args, **kwargs)¶
Bases:
optparse.OptionParser
An OptionParser subclass that allows long options with a single dash.
Note that this class can therefore not be used for clustering short options - i.e. “-rf” will be interpreted as a long option “rf”, not the short options “-r” and “-f”.
- __init__(*args, **kwargs)¶
This constructor takes the same options as the standard library’s optparse.OptionParser.
It also takes the keyword argument ‘version_source’, which should be a string containing a CVS Revision string like $Revision: 1.26 $. The ‘version_source’ argument is used to create a standard version string that also notes the Schrodinger python version number, so its use should be preferred to specifying a ‘version’ explicitly.
- parse_args(args=None, values=None, ignore_unknown=False)¶
- parse_args(args[string] = sys.argv[1:],
values : Values = None)
-> (values : Values, args : [string])
Parse the command-line options found in ‘args’ (default: sys.argv[1:]). Any errors result in a call to ‘error()’, which by default prints the usage message to stderr and calls sys.exit() with an error message. On success returns a pair (values, args) where ‘values’ is a Values instance (with all your option values) and ‘args’ is the list of arguments left over after parsing options.
- has_option(option)¶
- get_option(opt_str)¶
Return the Option instance with the option string opt_str, or None if no options have that string.
- remove_option(opt_str)¶
Remove the Option with the option string opt_str.
- print_usage(file: file = stdout)¶
Print the usage message for the current program (self.usage) to ‘file’ (default stdout). Any occurence of the string “%prog” in self.usage is replaced with the name of the current program (basename of sys.argv[0]). Does nothing if self.usage is empty or not defined.
- schrodinger.utils.singledashoptionparser.version_string(version_source='')¶
Form a standard version string from a source string. The source string is searched for an embedded CVS Revision tag. If one is found, that is used as the script version. If no Revision tag is found, only Schrodinger python version information is included.