Package csb :: Package apps :: Class AppRunner |
[frames] | no frames]

# Class AppRunner

source code

    object --+
             |
            AppRunner

Known Subclasses:
  - helloworld.AppRunner
  - , precision.AppRunner
  - , embd.AppRunner
  - , hhfrag.AppRunner
  - , bfit.AppRunner
  - , csfrag.AppRunner
  - , buildhmm.AppRunner
  - , hhsearch.AppRunner
  - , promix.AppRunner
  - , bfite.AppRunner

A base abstract class for all application runners. Concrete sub-classes must define their corresponding Application using the self.target property and must customize the Application's command line parser using self.command_line().

Nested Classes
| __metaclass__ Metaclass for defining Abstract Base Classes (ABCs).

Instance Methods
__init__(self, argv=`[``'``(imported)``'``]`) x.__init__(...) initializes x; see help(type(x)) for signature | source code
ArgHandler |
command_line(self) Command line factory: build a command line parser suitable for the application. | source code
Application |
initapp(self, args) Hook method that controls the instantiation of the main app class. | source code
run(self) Get the self.command_line() and run self.target. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Static Methods
exit(message=`'````'`, code=0, usage=`'````'`, ending=`'``\n``'`) Perform system exit. | source code

Class Variables
| __abstractmethods__ = ``frozenset([``'``command_line``'``,` `'``target``'``])``

Properties
| args
| module
| program
type (class reference) | target Reference to the concrete Application class to run.
Inherited from `object`: `__class__`

Method Details

### __init__(self, argv=`[``'``(imported)``'``]`) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Parameters: `argv` (tuple of str) - the list of command line arguments passed to the program. By default this is `sys.argv`. Overrides: object.__init__ (inherited documentation)

### command_line(self) | source code
Command line factory: build a command line parser suitable for the application. This is a hook method that each concrete AppRunner must implement. Returns: ArgHandler a command line parser object which knows how to handle `sys.argv` in the context of the concrete application. See the documentation of ArgHandler for more info on how to define command line arguments.

### exit(message=`'````'`, code=0, usage=`'````'`, ending=`'``\n``'`) Static Method | source code
Perform system exit. If the exit `code` is 0, print all messages to STDOUT, else write to STDERR. Parameters: `message` (str) - message to print `code` (int) - application exit code

### initapp(self, args) | source code
Hook method that controls the instantiation of the main app class. If the application has a custom constructor, you can adjust the app initialization by overriding this method. Parameters: `args` (argparse.Namespace) - an object containing the application arguments Returns: Application the application instance

### run(self) | source code
Get the self.command_line() and run self.target. Ensure clean system exit.

Property Details

### args Get Method: unreachable.args(self)

### module Get Method: unreachable.module(self)

### program Get Method: unreachable.program(self)

### target Reference to the concrete Application class to run. This is an abstract property that couples the current `AppRunner` to its corresponding Application. Get Method: unreachable.target(self) - Reference to the concrete Application class to run. Type: type (class reference)