当前位置: 首页>>代码示例>>Python>>正文


Python Score.get_score方法代码示例

本文整理汇总了Python中score.Score.get_score方法的典型用法代码示例。如果您正苦于以下问题:Python Score.get_score方法的具体用法?Python Score.get_score怎么用?Python Score.get_score使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在score.Score的用法示例。


在下文中一共展示了Score.get_score方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: score_me

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import get_score [as 别名]
	def score_me(self, iowait_threshold=20):
		old_score = Score.get_score()
		iowait_pct = self.iowait/(self.uptime+0.0) * 100
		idle_pct = self.idle/(self.uptime+0.0) * 100
		busy_pct = (self.user+self.nice+self.system)/(self.uptime+0.0) * 100

		if iowait_pct >= busy_pct:
			Score.update_score(20)

		elif busy_pct >= idle_pct:
			Score.update_score(10)

		if iowait_pct >= (iowait_threshold/100.0) * self.uptime:
			Score.update_score(10)

		self.score_deducted = old_score - Score.get_score()
开发者ID:soumyadipdm,项目名称:Themis,代码行数:18,代码来源:checkio.py

示例2: score_me

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import get_score [as 别名]
	def score_me(self, mem_threshold=70.0, swap_threshold=20.0):

		old_score = Score.get_score()
		
		mem_pct = self.MemUsed/(self.MemTotal+0.0) * 100
		if 90 > mem_pct >= mem_threshold:
			Score.update_score(10)
		elif mem_pct >= 90:
			Score.update_score(15)
		else:
			Score.update_score(5)

		swap_pct = self.SwapUsed/(self.SwapTotal+0.0) * 100

		if 50 > swap_pct >= swap_threshold:
			Score.update_score(10)
		elif swap_pct >= 50:
			Score.update_score(15)
		elif 0 < swap_pct <= 10:
			Score.update_score(5)
		

		self.score_deducted = old_score - Score.get_score()
开发者ID:soumyadipdm,项目名称:Themis,代码行数:25,代码来源:checkmem.py

示例3: __repr__

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import get_score [as 别名]
	def __repr__(self):
		return "User: %d\nNice: %d\nSystem: %d\nIdle: %d\nIowait: %d\nUptime %f\nSystemScore: %d\nDeducted: %d\n" % (self.user, self.nice, self.system, self.idle, self.iowait, self.uptime, Score.get_score(), self.score_deducted)
开发者ID:soumyadipdm,项目名称:Themis,代码行数:4,代码来源:checkio.py

示例4: __init__

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import get_score [as 别名]

#.........这里部分代码省略.........
                            point = (x, self.water.get_water_level(x))
                            self.particles.add_water_particle(point)
    
                for powerup in self.powerups:
                    powerup.update()
                    if powerup.picked:
                        self.powerups.remove(powerup)
                        self.powerup_sprites.remove(powerup)

                if not self.gameover:
                    self.check_collisions()

                if self.health.hearts_left == 0 and not self.player.dying:
                    self.player.die()

                if self.player.dying and not self.player.dead:
                    if Variables.particles:
                        self.particles.add_explosion_particle((self.player.rect.centerx, self.player.rect.centery))
                        self.particles.add_debris_particle((self.player.rect.centerx, self.player.rect.centery))

                if self.player.dead:
                    #self.done = True
                    self.set_gameover()

                if self.damage_count > 0:
                    self.damage_count -= 1
                self.lastshot += 1
                self.t += 1

            self.draw()

            self.handle_events()

        return self.score.get_score()

    def damage_player(self):
        self.health.damage()
        for i in xrange(10):
            particle_point = self.player.get_point((rr() * 26.0, rr() * 10.0))
            particle_point[0] += self.player.rect.centerx
            particle_point[1] += self.player.rect.centery
            self.particles.add_debris_particle(particle_point)
        self.player.blinks+=12


    def set_gameover(self, message = "Game Over"):
        self.gameover = True
        images = []
        height = 0
        width = 0
        for text in message.split("\n"):
            images.append(util.bigfont.render(text, Variables.alpha, (0,0,0)))
            height += images[-1].get_height()
            if images[-1].get_width() > width:
                width = images[-1].get_width()
        self.gameover_image = pygame.Surface((width, height), SRCALPHA, 32)
        self.gameover_image.fill((0,0,0,0))
        for i in xrange(len(images)):
            rect = images[i].get_rect()
            rect.top = i * images[i].get_height()
            rect.centerx = width / 2
            self.gameover_image.blit(images[i], rect)

        self.gameover_rect = self.gameover_image.get_rect()
        self.gameover_rect.center = self.screen.get_rect().center
开发者ID:italomaia,项目名称:turtle-linux,代码行数:69,代码来源:game.py

示例5: __init__

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import get_score [as 别名]

#.........这里部分代码省略.........
    
                for powerup in self.powerups:
                    powerup.update()
                    if powerup.picked:
                        self.powerups.remove(powerup)
                        self.powerup_sprites.remove(powerup)

                if not self.gameover:
                    self.check_collisions()

                if self.health.hearts_left == 0 and not self.player.dying:
                    self.player.die()

                if self.player.dying and not self.player.dead:
                    if not self.noparticles:
                        for i in range(BLOOD_3):
                            self.particles.add_explosion_particle((self.player.rect.centerx, self.player.rect.centery))
                            self.particles.add_debris_particle((self.player.rect.centerx, self.player.rect.centery))

                if self.player.dead:
                    #self.done = True
                    self.set_gameover()

                if self.damage_count > 0:
                    self.damage_count -= 1
                self.lastshot += 1
                self.t += 1

            self.draw()

            self.handle_events()


        return self.score.get_score()

    def set_gameover(self, message = "Game Over"):
        self.gameover = True
        images = []
        font = util.load_font("Cosmetica", 40) #pygame.font.Font(pygame.font.get_default_font(), 36)
        height = 0
        width = 0
        for text in message.split("\n"):
            images.append(font.render(text, True, (0,0,0)))
            height += images[-1].get_height()
            if images[-1].get_width() > width:
                width = images[-1].get_width()
        self.gameover_image = pygame.Surface((width, height), SRCALPHA, 32)
        self.gameover_image.fill((0,0,0,0))
        for i in range(len(images)):
            rect = images[i].get_rect()
            rect.top = i * images[i].get_height()
            rect.centerx = width / 2
            self.gameover_image.blit(images[i], rect)

        self.gameover_rect = self.gameover_image.get_rect()
        self.gameover_rect.center = self.screen.get_rect().center
    
    def translate_mouse_event(self, event):
     if event.type in (MOUSEBUTTONDOWN, ):
       if event.pos[0] > SCREEN_WIDTH - 32 and event.pos[1] < 32:
          key = K_p
       else:
          rx = event.pos[0] / float(SCREEN_WIDTH)
          ry = event.pos[1] / float(SCREEN_HEIGHT)
          if rx < 0.0:
             key = K_LEFT
开发者ID:zielmicha,项目名称:funnyboat-android,代码行数:70,代码来源:game.py

示例6: __repr__

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import get_score [as 别名]
	def __repr__(self):
		return "MemTotal: %d\nMemUsed: %d\nBufferCached: %d\nSwapTotal: %d\nSwapUsed: %d\nSystemScore: %d\nDeducted: %d" % (self.MemTotal, self.MemUsed, self.BufferCached, self.SwapTotal, self.SwapUsed, Score.get_score(), self.score_deducted)
开发者ID:soumyadipdm,项目名称:Themis,代码行数:4,代码来源:checkmem.py

示例7: nice_printing_pair

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import get_score [as 别名]
        for m in message_list:
            fp.write(np_msg(sc, m))

def nice_printing_pair(sc, samples, pairs, fn_out):
    with open(fn_out, 'w') as fp:
        for (i,j) in pairs:
            fp.write(">>>>>>\n")
            fp.write(np_msg(sc, samples[i]))
            fp.write("======\n")
            fp.write(np_msg(sc, samples[j]))
            fp.write("<<<<<<\n")

if __name__ == '__main__':
    from score import Score
    sc = Score()
    data = load_pickle('testing_samples.pickle')
    samples = data['samples']
    order = data['order']
    ranked = sorted(samples.values(), key = lambda m: sc.get_score(m), reverse = True)
    #ranked = sorted(samples.values(), key = lambda m: random.random(), reverse = True)
    #ranked = sorted(samples.values(), key = lambda m: m.parsed.time, reverse = True)
    ranking = [m.msg_id for m in ranked]
    ret = evaluate_kendall(ranking, order)
    print ret
    nice_printing(sc, ranked, 'np-msg-all')

    # Printing out all disc pairs is too slow. 
    # Deprecated. 
    # Or, one can sample them before printing. 
    #nice_printing_pair(sc, samples, get_disc_pair(ranking, order), 'np-msg-disc')
开发者ID:Kelvin-Zhong,项目名称:sns-router,代码行数:32,代码来源:evaluation.py


注:本文中的score.Score.get_score方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。