예제 #1
0
def run(f):
    count_line, count_failed = 0, 0
    for line in f:
        if not line:
            continue
        try:
            count_line += 1
            data = parser.parse(line)
            data = [v for k,v in data]
        except apachelog.ApacheLogParserError:
            #logging.exception('pipeline parse')
            count_failed += 1
            continue

        for p in pipes():
            try:
                p.process(data)
            except:
                logging.exception('pipeline process')

    for p in pipes():
        for k, d in p.result():
            core.update(d)
            #logging.debug('pipe run %s: %r', k, d)
    logging.debug('pipe process %d line, %d failed', count_line, count_failed)
예제 #2
0
파일: pages.py 프로젝트: sdgdsffdsfff/sloth
def push():
    if request.method == 'POST':
        d = {}
        if 'json' in request.form:
            j = request.form['json'].encode('utf-8')
            d = json.loads(j)

        #for k, v in d.iteritems():
        if d:
            core.update(d)
    else:
        pass
    return render_template('post.html')
예제 #3
0
파일: pages.py 프로젝트: sdgdsffdsfff/sloth
def push():
    if request.method == 'POST':
        d = {}
        if 'json' in request.form:
            j = request.form['json'].encode('utf-8')
            d = json.loads(j)

        #for k, v in d.iteritems():
        if d:
            core.update(d)
    else:
        pass
    return render_template('post.html')
예제 #4
0
파일: stream.py 프로젝트: ljxia/shiftserver
def update(data):
    """
    Update a stream.
    Parameters:
        data - a dictionary of fields to update. This dictionary should contain
            an _id field as well as a _rev field.
    """
    return core.update(data)
예제 #5
0
파일: user.py 프로젝트: ljxia/shiftserver
def update(data):
    """
    Update a user document.
    Parameters:
        data - a dictionary containing the fields to update. Should not
            attempt to update _id, _rev, type, joined, lastSeen.
    """
    data["modified"] = utils.utctime()
    return core.update(data)
예제 #6
0
def application():
    # pre-conditions
    config.init()  # initialize internal config for the app
    time = 0  # define stopwatch for the process

    # process for t times
    print('=> START: Running simulation for waterbirds ABM')
    habitats, agents = initialize()
    observe(habitats, agents, time)

    for time in range(1, constants.PROCESSING_TIME):
        agents = update(habitats, agents, time)
        observe(habitats, agents, time)
    print('=> END: Running simulation for waterbirds ABM')
예제 #7
0
 def update_subscription(self, customer_id, service_id, status):
     session = Session(engine)
     filters = {'customer_id': customer_id, 'service_id': service_id}
     update = {'status': status}
     try:
         status = core.update(session, Subscription, filters, update)
         status['customer'] = self.clean_records(
             core.get(session, Customer, {'customer_id': customer_id}))[0]
         status['service'] = self.clean_records(
             core.get(session, Service, {'service_id': service_id}))[0]
         session.close()
         return status
     except Exception as e:
         return {'status': 'failure'}
예제 #8
0
     else:
         bullet = None
 bullets = new_bullets
 new_boulders = []
 for bder in boulders:
     if bder.hp <= -1000:
         pass
     elif (bder.hp <= 0):
         bder = None
         sounds['buff'].play()
         sounds['destroy'].play()
         score += 100
     else :
         new_boulders.append(bder)
 boulders = new_boulders
 core.update(dt,boulders,sounds['explosion'])
 if core.hp <= 0 or player.died:
     score_text = 'last score : ' + str(score)
     gameover_text = "Game Over"
     game_state = GAME_STATES['Menu']
     pygame.mixer.music.stop()
     print('done')
     continue
 if(shooting):
     if player.can_shoot():
         bullets.append(player.shoot(scroll,display,sounds['shoot']))
 if move > 0:
     player.translate([player.speed*dt*1.5,0])
 elif move < 0:
     player.translate([-player.speed*dt,0])
 player.update(dt,sounds['jump'],boulders)
예제 #9
0
 def update_agent_validation(self, email):
     session = Session(engine)
     filters = {'email': email}
     update = {'validated': 1}
     status = core.update(session, Agent, filters, update)
     session.close()
예제 #10
0
파일: druscan.py 프로젝트: JulienD/DruScan
from core  import signal_handler
from core  import update
from core  import search
from core  import detect_version
from core	 import search_users
from core  import search_urls
from ops 	 import opsx


try:
	
	signal.signal(signal.SIGINT, signal_handler)
	o = opsx()

	if o.update_modules:
		update("modules", o.limit)
		message("Update modules. Done.",core.M_UPDATE, "OK")
		exit
	elif o.update_themes:
		update("themes", o.limit)
		message("Update themes. Done." ,core.M_UPDATE,"OK")
		exit
	
	
	
	if o.url != None:
		
		site_version = detect_version(o.url)
		message("Posible version " + str(site_version),core.M_VERSION, "WARNING")
		message("\t" + o.url + "/CHANGELOG.txt",core.M_FILE, "WARNING")