PyFoam.Basics.FoamOptionParser module

Parse options for the PyFoam-Scripts

class PyFoam.Basics.FoamOptionParser.FoamHelpFormatter(indent_increment=0, max_help_position=24, width=None, short_first=0)[source]

Bases: optparse.TitledHelpFormatter

For description and epilog preserve double newlines as one newline

format_description(description)[source]
format_epilog(epilog)[source]
class PyFoam.Basics.FoamOptionParser.FoamOptionParser(args=None, usage=None, version=None, description=None, epilog=None, examples=None, interspersed=False)[source]

Bases: optparse.OptionParser

Wrapper to the usual OptionParser to honor the conventions of OpenFOAM-utilities

Options that are not used by the script are passed to the OpenFOAM-application

casePath()[source]

Returns the path to the case (if applicable)

getApplication()[source]

Return the OpenFOAM-Application to be run

getArgs()[source]

Return the arguments left after parsing

getOptions()[source]

Return the options

parse(nr=None, exactNr=True)[source]

parse the options :param nr: minimum number of arguments that are to be passed to the application 3 is default for pre-1.5 versions of OpenFOAM

processKeywordArguments(kw)[source]
restoreEnvironment()[source]

Restore the environment to its old glory… if it was changed

class PyFoam.Basics.FoamOptionParser.Subcommand(name, parser=None, help='', aliases=(), nr=None, exactNr=None)[source]

Bases: object

A subcommand of a root command-line application that may be invoked by a SubcommandOptionParser. Taken from https://gist.github.com/sampsyo/462717

class PyFoam.Basics.FoamOptionParser.SubcommandFoamOptionParser(args=None, usage=None, version=None, epilog=None, examples=None, description=None, subcommands=[])[source]

Bases: PyFoam.Basics.FoamOptionParser.FoamOptionParser

Subclass of the regular option parser that allows setting subcommands Inspired by https://gist.github.com/sampsyo/462717

addSubcommand(cmd, usage=None)[source]
format_help(formatter=None)[source]

Taken from https://gist.github.com/sampsyo/462717

getArgs()[source]

Return the arguments left after parsing

parse(nr=None, exactNr=None)[source]

Do the parsing of a subcommand