pytis
index
/home/ut3hax/bin/pytis.py

# ##############################################################################
# The contents of this file are subject to the PyTis Public License Version    #
# 1.0 (the "License"); you may not use this file except in compliance with     #
# the License. You may obtain a copy of the License at                         #
#                                                                              #
#     http://www.PyTis.com/License/                                            #
#                                                                              #
#     Copyright (c) 2009 Josh Lee                                              #
#                                                                              #
# Software distributed under the License is distributed on an "AS IS" basis,   #
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License     #
# for the specific language governing rights and limitations under the         #
# License.                                                                     #
#                                                                              #
# @auto-generated by the PyTis Copyright Tool on 08:15 11 Nov, 2009            #
############################################################################## #

 
Modules
       
cStringIO
logging
optparse
os
pydoc
sys

 
Classes
       
exceptions.Exception
EmptyString
IdiotError
NoFiles
QuitNow
exceptions.UserWarning(exceptions.Warning)
DuplicateCopyright
FileNotFound
EmptyTemplate
logging.Logger(logging.Filterer)
MyLogger
optparse.OptionParser(optparse.OptionContainer)
MyParse

 
class DuplicateCopyright(exceptions.UserWarning)
    
Method resolution order:
DuplicateCopyright
exceptions.UserWarning
exceptions.Warning
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class EmptyString(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class EmptyTemplate(FileNotFound)
    
Method resolution order:
EmptyTemplate
FileNotFound
exceptions.UserWarning
exceptions.Warning
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class FileNotFound(exceptions.UserWarning)
    
Method resolution order:
FileNotFound
exceptions.UserWarning
exceptions.Warning
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class IdiotError(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class MyLogger(logging.Logger)
    
Method resolution order:
MyLogger
logging.Logger
logging.Filterer

Methods defined here:
setopts(self, opts)

Data and other attributes defined here:
opt_debug = False
opt_verbose = False

Methods inherited from logging.Logger:
__init__(self, name, level=0)
Initialize the logger with a name and an optional level.
addHandler(self, hdlr)
Add the specified handler to this logger.
callHandlers(self, record)
Pass a record to all relevant handlers.
 
Loop through all handlers for this logger and its parents in the
logger hierarchy. If no handler was found, output a one-off error
message to sys.stderr. Stop searching up the hierarchy whenever a
logger with the "propagate" attribute set to zero is found - that
will be the last logger whose handlers are called.
critical(self, msg, *args, **kwargs)
Log 'msg % args' with severity 'CRITICAL'.
 
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
 
logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
debug(self, msg, *args, **kwargs)
Log 'msg % args' with severity 'DEBUG'.
 
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
 
logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
error(self, msg, *args, **kwargs)
Log 'msg % args' with severity 'ERROR'.
 
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
 
logger.error("Houston, we have a %s", "major problem", exc_info=1)
exception(self, msg, *args)
Convenience method for logging an ERROR with exception information.
fatal = critical(self, msg, *args, **kwargs)
Log 'msg % args' with severity 'CRITICAL'.
 
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
 
logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
findCaller(self)
Find the stack frame of the caller so that we can note the source
file name, line number and function name.
getEffectiveLevel(self)
Get the effective level for this logger.
 
Loop through this logger and its parents in the logger hierarchy,
looking for a non-zero logging level. Return the first one found.
handle(self, record)
Call the handlers for the specified record.
 
This method is used for unpickled records received from a socket, as
well as those created locally. Logger-level filtering is applied.
info(self, msg, *args, **kwargs)
Log 'msg % args' with severity 'INFO'.
 
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
 
logger.info("Houston, we have a %s", "interesting problem", exc_info=1)
isEnabledFor(self, level)
Is this logger enabled for level 'level'?
log(self, level, msg, *args, **kwargs)
Log 'msg % args' with the integer severity 'level'.
 
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
 
logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
makeRecord(self, name, level, fn, lno, msg, args, exc_info)
A factory method which can be overridden in subclasses to create
specialized LogRecords.
removeHandler(self, hdlr)
Remove the specified handler from this logger.
setLevel(self, level)
Set the logging level of this logger.
warn = warning(self, msg, *args, **kwargs)
Log 'msg % args' with severity 'WARNING'.
 
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
 
logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)
warning(self, msg, *args, **kwargs)
Log 'msg % args' with severity 'WARNING'.
 
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
 
logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)

Data and other attributes inherited from logging.Logger:
manager = <logging.Manager instance>
root = <logging.RootLogger instance>

Methods inherited from logging.Filterer:
addFilter(self, filter)
Add the specified filter to this handler.
filter(self, record)
Determine if a record is loggable by consulting all the filters.
 
The default is to allow the record to be logged; any filter can veto
this and the record is then dropped. Returns a zero value if a record
is to be dropped, else non-zero.
removeFilter(self, filter)
Remove the specified filter from this handler.

 
class MyParse(optparse.OptionParser)
    
Method resolution order:
MyParse
optparse.OptionParser
optparse.OptionContainer

Methods defined here:
print_help(self, errors=None)
NAME
SYNOPSIS
DESCRIPTION
OPTIONS
COMMANDS
ENVIRONMENT
SEE ALSO
AUTHOR
HISTORY
VERSION
print_out(self, txt)

Data and other attributes defined here:
extra_txt = None

Methods inherited from optparse.OptionParser:
__init__(self, usage=None, option_list=None, option_class=<class optparse.Option>, version=None, conflict_handler='error', description=None, formatter=None, add_help_option=True, prog=None)
add_option_group(self, *args, **kwargs)
check_values(self, values, args)
check_values(values : Values, args : [string])
-> (values : Values, args : [string])
 
Check that the supplied option values and leftover arguments are
valid.  Returns the option values and leftover arguments
(possibly adjusted, possibly completely new -- whatever you
like).  Default implementation just returns the passed-in
values; subclasses may override as desired.
disable_interspersed_args(self)
enable_interspersed_args(self)
error(self, msg)
error(msg : string)
 
Print a usage message incorporating 'msg' to stderr and exit.
If you override this in a subclass, it should not return -- it
should either exit or raise an exception.
exit(self, status=0, msg=None)
expand_prog_name(self, s)
format_help(self, formatter=None)
format_option_help(self, formatter=None)
get_default_values(self)
get_description(self)
get_option_group(self, opt_str)
get_prog_name(self)
get_usage(self)
get_version(self)
parse_args(self, args=None, values=None)
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 an Values instance (with all
your option values) and 'args' is the list of arguments left
over after parsing options.
print_usage(self, file=None)
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.
print_version(self, file=None)
print_version(file : file = stdout)
 
Print the version message for this program (self.version) to
'file' (default stdout).  As with print_usage(), any occurence
of "%prog" in self.version is replaced by the current program's
name.  Does nothing if self.version is empty or undefined.
set_default(self, dest, value)
set_defaults(self, **kwargs)
set_process_default_values(self, process)
set_usage(self, usage)

Data and other attributes inherited from optparse.OptionParser:
standard_option_list = []

Methods inherited from optparse.OptionContainer:
add_option(self, *args, **kwargs)
add_option(Option)
add_option(opt_str, ..., kwarg=val, ...)
add_options(self, option_list)
format_description(self, formatter)
get_option(self, opt_str)
has_option(self, opt_str)
remove_option(self, opt_str)
set_conflict_handler(self, handler)
set_description(self, description)

 
class NoFiles(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class QuitNow(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
Functions
       
dirTest(d)
fileTest(f)
filesFromArgs(opts, args)
XXX:TODO unix only, need to make this so it would work on windows.
XXX:TODO this thing needs sserious work, with recursive an no . in filenames
import glob
homedir()
Get Home directory path in Python for Windows and Linux
set_logging(opts, name, __logdir__='/home/ut3hax/logs')
version(v)

 
Data
        __author__ = 'Josh Lee'
__configdir__ = '/home/ut3hax/etc'
__copyright__ = 'PyTis'
__created__ = '06:14pm 09 Sep, 2009'
__logdir__ = '/home/ut3hax/logs'

 
Author
        Josh Lee