import codecs import sys from optik import OptionParser parser = OptionParser() parser.add_option("-i", "--input-file", dest="filename", help="wordlist FILE to parse and evaluate, use - to read form stdin", metavar="FILE") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=0, help="print python dictionaries and frequency percentages") parser.add_option("-l", "--locale", dest="inputlocale", default=locale.getdefaultlocale(), help="locale to use for selection of valid characters, default is the current locale", metavar="LOCALE") (options, args) = parser.parse_args() if options.filename is None: parser.print_help() sys.exit() if options.filename == "-": options.filename = '/dev/stdin' input = open(options.filename, 'r') freq = {} locale.setlocale(locale.LC_ALL, options.inputlocale) line = input.readline() total = 0 #while line != "": # count, word = string.split(line, maxsplit=1) # for c in word: # if c in string.letters + "-'": # total += int(count) # if freq.has_key(c):
parser.add_option("--pointing", "-p", action="store", default=None, dest="pointing", help="CFEPS POINTING to retrieve, (eg: 03BQ02)") (opt, file_ids) = parser.parse_args() import os, shutil import MOPdbaccess, MOPfits mysql = MOPdbaccess.connect('cfeps', 'cfhls', dbSystem='MYSQL') if not opt.triple and not opt.block: parser.print_help() sys.exit("\n\n You must specify either a triple or block\n") cfeps = mysql.cursor() if not opt.triple: sql = """SELECT DISTINCT(t.id) FROM triples t JOIN checkup d ON t.id=d.triple JOIN bucket.association a ON t.pointing=a.pointing JOIN bucket.pointings p ON t.pointing=p.id JOIN bucket.blocks b ON a.expnum=b.expnum WHERE b.qname LIKE '%s'""" % (opt.block, ) if opt.pointing: sql += """ AND p.name LIKE '%s'""" % (opt.pointing, ) print sql cfeps.execute(sql)