From 4f67c6f48b7a63219756dd33bb3b6c20c330127c Mon Sep 17 00:00:00 2001 From: bnewbold Date: Tue, 15 May 2012 16:43:36 -0400 Subject: trurl backup --- .pinerc | 2 ++ code/templates/script.py | 82 +++++++++++++++++------------------------------- 2 files changed, 30 insertions(+), 54 deletions(-) diff --git a/.pinerc b/.pinerc index 48fc7e4..2d6ddd1 100644 --- a/.pinerc +++ b/.pinerc @@ -446,7 +446,9 @@ patterns-roles= # Patterns and their actions are stored here. patterns-filters2=LIT:pattern="/NICK=arm-notebooks/FROM=arm-netbook-request@lists.phcomp.co.uk/FLDTYPE=SPEC/FOLDER=INBOX/STATD=NO" action="/FILTER=1/FOLDER={mail.robocracy.org\/ssl\/user=bnewbold\/novalidate-cert}INBOX.lists/NOKILL=1", + LIT:pattern="/NICK=fnf-builders/ARBReply-To=builders@freenetworkfoundation.org/FLDTYPE=SPEC/FOLDER=INBOX" action="/FILTER=1/FOLDER=lists/NOKILL=1", LIT:pattern="/NICK=lispnyc/TO=lisp@lispnyc.org/FLDTYPE=SPEC/FOLDER=INBOX" action="/FILTER=1/FOLDER={mail.robocracy.org\/ssl\/user=bnewbold\/novalidate-cert}INBOX.lists/NOKILL=1", + LIT:pattern="/NICK=itp-phy-comp/ARBReply-To=phys-comp@lists.nyu.edu/FLDTYPE=SPEC/FOLDER=INBOX" action="/FILTER=1/FOLDER=lists/NOKILL=1", LIT:pattern="/NICK=nycresistor/FROM=nycresistormicrocontrollers@googlegroups.com/FLDTYPE=SPEC/FOLDER=INBOX" action="/FILTER=1/FOLDER={mail.robocracy.org\/ssl\/user=bnewbold\/novalidate-cert}INBOX.lists/NOKILL=1", LIT:pattern="/NICK=freedombox/FROM=freedombox-discuss-request@lists.alioth.debian.org/FLDTYPE=SPEC/FOLDER=INBOX" action="/FILTER=1/FOLDER={mail.robocracy.org\/ssl\/user=bnewbold\/novalidate-cert}INBOX.lists/NOKILL=1" diff --git a/code/templates/script.py b/code/templates/script.py index dccf20e..467a1ce 100755 --- a/code/templates/script.py +++ b/code/templates/script.py @@ -1,67 +1,41 @@ #!/usr/bin/env python -""" -SYNOPSIS - TODO helloworld [-h,--help] [-v,--verbose] [--version] +import sys +import optparse +import logging -DESCRIPTION +log = logging.getLogger(__name__) - TODO This describes how to use this script. This docstring - will be printed by the script if there is an error or - if the user requests help (-h or --help). -EXAMPLES +def run(): + log.info('This is an INFO level message.') + log.debug('This is a DEBUG level message.') + log.warn('This is a WARN level message.') - TODO: Show some examples of how to use this script. +def main(): -EXIT STATUS + global log + parser = optparse.OptionParser(usage= + "usage: %prog [options]\n" + "%prog --help for more info." + ) + parser.add_option("-v", "--verbose", + default=False, + help="Show more debugging statements", + action="store_true") - TODO: List exit codes + (options, args) = parser.parse_args() -AUTHOR + if len(args) != 0: + parser.error("Incorrect number of arguments") - TODO: Name + log = logging.getLogger() + if options.verbose: + log.setLevel(logging.DEBUG) + else: + log.setLevel(logging.INFO) -LICENSE - - This script is in the public domain, free from copyrights or restrictions. - -VERSION - - $Id$ -""" - -import sys, os, traceback, optparse -import time -import re -#from pexpect import run, spawn - -def main (): - - global options, args - # TODO: Do something more interesting here... - print 'Hello world!' + run() if __name__ == '__main__': - try: - start_time = time.time() - parser = optparse.OptionParser(formatter=optparse.TitledHelpFormatter(), usage=globals()['__doc__'], version='$Id$') - parser.add_option ('-v', '--verbose', action='store_true', default=False, help='verbose output') - (options, args) = parser.parse_args() - #if len(args) < 1: - # parser.error ('missing argument') - if options.verbose: print time.asctime() - main() - if options.verbose: print time.asctime() - if options.verbose: print 'TOTAL TIME IN MINUTES:', - if options.verbose: print (time.time() - start_time) / 60.0 - sys.exit(0) - except KeyboardInterrupt, e: # Ctrl-C - raise e - except SystemExit, e: # sys.exit() - raise e - except Exception, e: - print 'ERROR, UNEXPECTED EXCEPTION' - print str(e) - traceback.print_exc() - os._exit(1) + main() -- cgit v1.2.3