From 04cdcb0feb369ac4c60e10ccdc139c57e8b52e62 Mon Sep 17 00:00:00 2001 From: Zearin Date: Fri, 7 Oct 2011 10:34:23 -0400 Subject: Removed leftovers from installing with pip. Oops! I noticed there was a bunch of extra crap left over from when I installed this module onto my own system. I thought it wouldn't have modified itself at the time (just the Python module library on my system), but I was wrong. Begone, useless cruft! --- doxygen/html/namespacecmd2.html | 771 ---------------------------------------- 1 file changed, 771 deletions(-) delete mode 100644 doxygen/html/namespacecmd2.html (limited to 'doxygen/html/namespacecmd2.html') diff --git a/doxygen/html/namespacecmd2.html b/doxygen/html/namespacecmd2.html deleted file mode 100644 index 7e27756..0000000 --- a/doxygen/html/namespacecmd2.html +++ /dev/null @@ -1,771 +0,0 @@ - - - - -Cmd2: cmd2 Namespace Reference - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - -
-
Cmd2 - -
- -
-
- - - - - -
-
- -
-
-
- -
-
- -
-
cmd2 Namespace Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Classes

class  Borg
class  Cmd
class  Cmd2TestCase
class  EmbeddedConsoleExit
class  EmptyStatement
class  History
class  HistoryItem
class  NotSettableError
class  OptionParser
class  OutputTrap
class  ParsedString
class  PasteBufferError
class  Statekeeper
class  StubbornDict

-Functions

def _attr_get_
def cast
def get_paste_buffer
def get_paste_buffer
def ljust
def options
def remaining_args
def replace_with_file_contents
def stubbornDict
def write_to_paste_buffer

-Variables

string __version__ = '0.6.4'
 can_clip = False
list options_defined = []
string pastebufferr
string teststring = 'Testing for presence of xclip.'
 write_to_paste_buffer = get_paste_buffer
tuple xclipproc = subprocess.Popen('xclip -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
-

Detailed Description

-
Variant on standard library's cmd with extra features.
-
-To use, simply import cmd2.Cmd instead of cmd.Cmd; use precisely as though you
-were using the standard library's cmd, while enjoying the extra features.
-
-Searchable command history (commands: "hi", "li", "run")
-Load commands from file, save to file, edit commands in file
-Multi-line commands
-Case-insensitive commands
-Special-character shortcut commands (beyond cmd's "@" and "!")
-Settable environment parameters
-Optional _onchange_{paramname} called when environment parameter changes
-Parsing commands with `optparse` options (flags)
-Redirection to file with >, >>; input from file with <
-Easy transcript-based testing of applications (see example/example.py)
-Bash-style ``select`` available
-
-Note that redirection with > and | will only work if `self.stdout.write()`
-is used in place of `print`.  The standard library's `cmd` module is 
-written to use `self.stdout.write()`, 
-
-- Catherine Devlin, Jan 03 2008 - catherinedevlin.blogspot.com
-
-mercurial repository at http://www.assembla.com/wiki/show/python-cmd2
-

Function Documentation

- -
-
- - - - - - - - - - - - - - - - - - -
def cmd2::_attr_get_ ( obj,
 attr 
) [private]
-
-
-
Returns an attribute's value, or None (no error) if undefined.
-   Analagous to .get() for dictionaries.  Useful when checking for
-   value of options that may not have been defined on a given
-   method.
-

Definition at line 98 of file cmd2.py.

-
00098 
-00099 def _attr_get_(obj, attr):
-00100     '''Returns an attribute's value, or None (no error) if undefined.
-00101        Analagous to .get() for dictionaries.  Useful when checking for
-00102        value of options that may not have been defined on a given
-00103        method.'''
-00104     try:
-00105         return getattr(obj, attr)
-00106     except AttributeError:
-00107         return None
-00108     
-00109 optparse.Values.get = _attr_get_
-    
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - -
def cmd2::cast ( current,
 new 
)
-
-
-
Tries to force a new value into the same type as the current.
-

Definition at line 1412 of file cmd2.py.

- -

Referenced by cmd2::Cmd::do_set().

-
01412 
-01413 def cast(current, new):
-01414     """Tries to force a new value into the same type as the current."""
-01415     typ = type(current)
-01416     if typ == bool:
-01417         try:
-01418             return bool(int(new))
-01419         except (ValueError, TypeError):
-01420             pass
-01421         try:
-01422             new = new.lower()    
-01423         except:
-01424             pass
-01425         if (new=='on') or (new[0] in ('y','t')):
-01426             return True
-01427         if (new=='off') or (new[0] in ('n','f')):
-01428             return False
-01429     else:
-01430         try:
-01431             return typ(new)
-01432         except:
-01433             pass
-01434     print ("Problem setting parameter (now %s) to %s; incorrect type?" % (current, new))
-01435     return current
-        
-
-
-
- -
-
- - - - - - - -
def cmd2::get_paste_buffer ()
-
-
- -

Definition at line 184 of file cmd2.py.

- -

Referenced by get_paste_buffer(), cmd2::Cmd::redirect_output(), and replace_with_file_contents().

-
00184 
-00185         def get_paste_buffer():
-00186             win32clipboard.OpenClipboard(0)
-00187             try:
-00188                 result = win32clipboard.GetClipboardData()
-00189             except TypeError:
-00190                 result = ''  #non-text
-00191             win32clipboard.CloseClipboard()
-            return result            
-
-
-
- -
-
- - - - - - - - -
def cmd2::get_paste_buffer ( args)
-
-
- -

Definition at line 198 of file cmd2.py.

- -

References get_paste_buffer().

-
00198 
-00199         def get_paste_buffer(*args):
-            raise OSError, pastebufferr % ('pywin32', 'Download from http://sourceforge.net/projects/pywin32/')
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
def cmd2::ljust ( x,
 width,
 fillchar = ' ' 
)
-
-
- -

Definition at line 352 of file cmd2.py.

- -

Referenced by cmd2::Cmd::do_show().

-
00352 
-00353 def ljust(x, width, fillchar=' '):
-00354     'analogous to str.ljust, but works for lists'
-00355     if hasattr(x, 'ljust'):
-00356         return x.ljust(width, fillchar)
-00357     else:
-00358         if len(x) < width:
-00359             x = (x + [fillchar] * width)[:width]
-00360         return x
-    
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - -
def cmd2::options ( option_list,
 arg_desc = "arg" 
)
-
-
-
Used as a decorator and passed a list of optparse-style options,
-   alters a cmd2 method to populate its ``opts`` argument from its
-   raw text argument.
-
-   Example: transform
-   def do_something(self, arg):
-
-   into
-   @options([make_option('-q', '--quick', action="store_true",
-             help="Makes things fast")],
-             "source dest")
-   def do_something(self, arg, opts):
-       if opts.quick:
-           self.fast_button = True
-   
-

Definition at line 112 of file cmd2.py.

- -

References remaining_args().

- -

Referenced by cmd2::Cmd::do_py(), pirate8::Pirate::do_sing(), and cmd2::Cmd::select().

-
00112 
-00113 def options(option_list, arg_desc="arg"):
-00114     '''Used as a decorator and passed a list of optparse-style options,
-00115        alters a cmd2 method to populate its ``opts`` argument from its
-00116        raw text argument.
-00117 
-00118        Example: transform
-00119        def do_something(self, arg):
-00120 
-00121        into
-00122        @options([make_option('-q', '--quick', action="store_true",
-00123                  help="Makes things fast")],
-00124                  "source dest")
-00125        def do_something(self, arg, opts):
-00126            if opts.quick:
-00127                self.fast_button = True
-00128        '''
-00129     if not isinstance(option_list, list):
-00130         option_list = [option_list]
-00131     for opt in option_list:
-00132         options_defined.append(pyparsing.Literal(opt.get_opt_string()))
-00133     def option_setup(func):
-00134         optionParser = OptionParser()
-00135         for opt in option_list:
-00136             optionParser.add_option(opt)
-00137         optionParser.set_usage("%s [options] %s" % (func.__name__[3:], arg_desc))
-00138         optionParser._func = func
-00139         def new_func(instance, arg):
-00140             try:
-00141                 opts, newArgList = optionParser.parse_args(arg.split())
-00142                 # Must find the remaining args in the original argument list, but 
-00143                 # mustn't include the command itself
-00144                 #if hasattr(arg, 'parsed') and newArgList[0] == arg.parsed.command:
-00145                 #    newArgList = newArgList[1:]
-00146                 newArgs = remaining_args(arg, newArgList)
-00147                 if isinstance(arg, ParsedString):
-00148                     arg = arg.with_args_replaced(newArgs)
-00149                 else:
-00150                     arg = newArgs
-00151             except optparse.OptParseError, e:
-00152                 print (e)
-00153                 optionParser.print_help()
-00154                 return
-00155             if hasattr(opts, '_exit'):
-00156                 return None
-00157             result = func(instance, arg, opts)                            
-00158             return result        
-00159         new_func.__doc__ = '%s\n%s' % (func.__doc__, optionParser.format_help())
-00160         return new_func
-00161     return option_setup
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - -
def cmd2::remaining_args ( oldArgs,
 newArgList 
)
-
-
-
-Preserves the spacing originally in the argument after
-the removal of options.
-
->>> remaining_args('-f bar   bar   cow', ['bar', 'cow'])
-'bar   cow'
-
-

Definition at line 86 of file cmd2.py.

- -

Referenced by options().

-
00086 
-00087 def remaining_args(oldArgs, newArgList):
-00088     '''
-00089     Preserves the spacing originally in the argument after
-00090     the removal of options.
-00091     
-00092     >>> remaining_args('-f bar   bar   cow', ['bar', 'cow'])
-00093     'bar   cow'
-00094     '''
-00095     pattern = '\s+'.join(re.escape(a) for a in newArgList) + '\s*$'
-00096     matchObj = re.search(pattern, oldArgs)
-00097     return oldArgs[matchObj.start():]
-   
-
-
-
- -
-
- - - - - - - - -
def cmd2::replace_with_file_contents ( fname)
-
-
- -

Definition at line 336 of file cmd2.py.

- -

References get_paste_buffer().

-
00336 
-00337 def replace_with_file_contents(fname):
-00338     if fname:
-00339         try:
-00340             result = open(os.path.expanduser(fname[0])).read()
-00341         except IOError:
-00342             result = '< %s' % fname[0]  # wasn't a file after all
-00343     else:
-00344         result = get_paste_buffer()
-00345     return result      
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - -
def cmd2::stubbornDict ( arg,
 kwarg 
)
-
-
-
->>> sorted(stubbornDict('cow a bovine\\nhorse an equine').items())
-[('cow', 'a bovine'), ('horse', 'an equine')]
->>> sorted(stubbornDict(['badger', 'porcupine a poky creature']).items())
-[('badger', ''), ('porcupine', 'a poky creature')]
->>> sorted(stubbornDict(turtle='has shell', frog='jumpy').items())
-[('frog', 'jumpy'), ('turtle', 'has shell')]
-
-

Definition at line 321 of file cmd2.py.

- -

Referenced by cmd2::StubbornDict::__add__(), and cmd2::StubbornDict::__radd__().

-
00321 
-00322 def stubbornDict(*arg, **kwarg):
-00323     '''
-00324     >>> sorted(stubbornDict('cow a bovine\\nhorse an equine').items())
-00325     [('cow', 'a bovine'), ('horse', 'an equine')]
-00326     >>> sorted(stubbornDict(['badger', 'porcupine a poky creature']).items())
-00327     [('badger', ''), ('porcupine', 'a poky creature')]
-00328     >>> sorted(stubbornDict(turtle='has shell', frog='jumpy').items())
-00329     [('frog', 'jumpy'), ('turtle', 'has shell')]
-00330     '''
-00331     result = {}
-00332     for a in arg:
-00333         result.update(StubbornDict.to_dict(a))
-00334     result.update(kwarg)                      
-00335     return StubbornDict(result)
-        
-
-
-
- -
-
- - - - - - - - -
def cmd2::write_to_paste_buffer ( txt)
-
-
- -

Definition at line 192 of file cmd2.py.

- -

References write_to_paste_buffer.

-
00192 
-00193         def write_to_paste_buffer(txt):
-00194             win32clipboard.OpenClipboard(0)
-00195             win32clipboard.EmptyClipboard()
-00196             win32clipboard.SetClipboardText(txt)
-            win32clipboard.CloseClipboard()        
-
-
-
-

Variable Documentation

- -
-
- - - - -
string cmd2::__version__ = '0.6.4'
-
-
- -

Definition at line 45 of file cmd2.py.

- -
-
- -
-
- - - - -
cmd2::can_clip = False
-
-
- -

Definition at line 202 of file cmd2.py.

- -
-
- -
-
- - - - -
list cmd2::options_defined = []
-
-
- -

Definition at line 110 of file cmd2.py.

- -
-
- -
-
- - - - -
string cmd2::pastebufferr
-
-
-Initial value:
00001 """Redirecting to or from paste buffer requires %s
-00002 to be installed on operating system.
-00003 %s"""
-
-

Definition at line 177 of file cmd2.py.

- -
-
- -
-
- - - - -
string cmd2::teststring = 'Testing for presence of xclip.'
-
-
- -

Definition at line 227 of file cmd2.py.

- -
-
- -
-
- - - - -
def cmd2::write_to_paste_buffer = get_paste_buffer
-
-
- -

Definition at line 200 of file cmd2.py.

- -

Referenced by cmd2::Cmd::restore_output(), and write_to_paste_buffer().

- -
-
- -
-
- - - - -
tuple cmd2::xclipproc = subprocess.Popen('xclip -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
-
-
- -

Definition at line 228 of file cmd2.py.

- -
-
-
-
- - - - - -- cgit v1.2.1