Exemplo n.º 1
0
def main():
    CONF.register_cli_opt(filename_opt)
    CONF(sys.argv[1:], project='fuzzy-happiness')

    if not CONF.filename:
        print 'Please specify a filename to process'
        return 1

    print 'Processing %s' % CONF.filename
    if not os.path.exists(CONF.filename):
        print 'Input file %s does not exist!' % CONF.filename
        return 1
    if not os.path.isfile(CONF.filename):
        print 'Input %s is not a file!' % CONF.filename
        return 1

    # Load attributes from models.py
    anon_fields = attributes.load_configuration()

    dp = DumpProcessor(CONF.filename,
                       '/tmp/nova_user_001.sql.post',
                       anon_fields)
    dp.read_sql_dump()

    return 0
Exemplo n.º 2
0
def main():
    CONF.register_cli_opt(filename_opt)
    CONF(sys.argv[1:], project="fuzzy-happiness")

    if not CONF.filename:
        print "Please specify a filename to process"
        return 1

    print "Processing '%s'" % CONF.filename
    if not os.path.exists(CONF.filename):
        print "Input file %s does not exist!" % CONF.filename
        return 1
    if not os.path.isfile(CONF.filename):
        print "Input %s is not a file!" % CONF.filename
        return 1

    # Load attributes from models.py
    anon_fields = attributes.load_configuration()
    fuzz = Fuzzer(anon_fields)

    with open(CONF.filename, "r") as r:
        output_filename = CONF.filename + ".output"
        with open(output_filename, "w") as w:
            for line in r:
                processed = fuzz.process_line(line)
                if CONF.debug:
                    print ">>> %s" % line.rstrip()
                    print "<<< %s" % processed.rstrip()
                w.write(processed)
            print "Wrote '%s'" % output_filename

    if CONF.debug:
        fuzz.dump_stats(CONF.filename)

    return 0
def main():
    # Import the database to modify
    #os.system('mysql -u root nova_fuzzy < nova.sql')

    # Set up the session
    engine = create_engine('mysql://*****:*****@localhost/nova_fuzzy',
                           echo=True)

    # Grab the randomisation commands
    config = attributes.load_configuration()

    # Perform fuzzification and save back to database
    fuzzify(engine, config)
Exemplo n.º 4
0
def main():
    logging.basicConfig()
    logging.getLogger('sqlalchemy.engine').setLevel(logging.WARN)

    # Import the database to modify
    #os.system('mysql -u root nova_fuzzy < nova.sql')

    # Set up the session
    engine = create_engine('mysql://*****:*****@localhost/nova_user_001')

    # Grab the randomisation commands
    config = attributes.load_configuration()

    # Perform fuzzification and save back to database
    fuzzify(engine, config)