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

Class Application

source code

object --+
         |
        Application
Known Subclasses:

Base CSB application class.

Nested Classes
  __metaclass__
Metaclass for defining Abstract Base Classes (ABCs).
Instance Methods
 
__init__(self, args, log=<epydoc.docintrospecter._DevNull instance at 0x7fe118119128>)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
log(self, message, ending='\n')
Write message to the logging stream and flush it.
source code
 
main(self)
The main application hook.
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=False)
Notify the app runner about an application exit.
source code
Class Variables
  __abstractmethods__ = frozenset(['main'])
Properties
  args
The object containing application's arguments, as returned by the command line parser.

Inherited from object: __class__

Method Details

__init__(self, args, log=<epydoc.docintrospecter._DevNull instance at 0x7fe118119128>)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • args (argparse.Namespace) - an object containing the application arguments
Overrides: object.__init__
(inherited documentation)

exit(message, code=0, usage=False)
Static Method

source code 

Notify the app runner about an application exit.

Parameters:
  • message (str) - exit message
  • code (int) - exit code (see ExitCodes for common constants)
  • usage (bool) - advise the client to show the usage line

Note: you re not supposed to use sys.exit() for the same purpose. It is AppRunner's responsibility to handle the real system exit, if the application has been started as an executable. Think about your app being executed by some Python client as a regular Python class, imported from a module -- in that case you only want to ask the client to terminate the app, not to kill the whole interpreter.

log(self, message, ending='\n')

source code 

Write message to the logging stream and flush it.

Parameters:
  • message (str) - message

Property Details

args

The object containing application's arguments, as returned by the command line parser.

Get Method:
unreachable.args(self) - The object containing application's arguments, as returned by the command line parser.
Set Method:
unreachable.args(self, args)