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


Python utils.out函数代码示例

本文整理汇总了Python中utils.out函数的典型用法代码示例。如果您正苦于以下问题:Python out函数的具体用法?Python out怎么用?Python out使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: initiate_round

	def initiate_round(self, dealer_seat):
		for player in self.players:
			player.draw_hand(self.deck)
			player.in_hand = True
			player.curr_bet = 0
			player.all_in = False
			player.has_acted = False
			player.sidepot = None
		
		self.pot = self.big_blind + self.small_blind
		self.bet = self.big_blind
		
		self.small_blind_seat = self.get_next_seat(dealer_seat)	
		self.players[self.small_blind_seat].chips -= self.small_blind
		self.players[self.small_blind_seat].curr_bet = self.small_blind
		utils.out('%s(%d) posts small blind of %d.' % (
			self.players[self.small_blind_seat].name,
			self.players[self.small_blind_seat].chips, self.small_blind),
			self.debug_level)

		big_blind_seat = self.get_next_seat(self.small_blind_seat)
		self.players[big_blind_seat].chips -= self.big_blind
		self.players[big_blind_seat].curr_bet = self.big_blind
		utils.out('%s(%d) posts big blind of %d.' % (
			self.players[big_blind_seat].name, self.players[big_blind_seat].chips, self.big_blind),
			self.debug_level)
开发者ID:dschwarz26,项目名称:PokerBot,代码行数:26,代码来源:deal.py

示例2: set_player_ranks

	def set_player_ranks(self):
		for player in self.players:
			if player.in_hand:
				player.rank = hand_rank.get_rank(
					player.hand.read_as_list() + self.communal_cards)
				utils.out('%s(%s) has %s' % (player.name,
					player.hand.read_out(), player.rank._to_string()), self.debug_level)
开发者ID:dschwarz26,项目名称:PokerBot,代码行数:7,代码来源:deal.py

示例3: __init__

	def __init__(self):
		progDir = os.path.dirname(sys.argv[0])
		(self.args, files) = self.parseArgs(sys.argv[1:])
		out.level = self.args.verbosity
		out(out.DEBUG, 'Parsed arguments: %s', self.args)
		self.config = CONFIG
		gui.init(self.config, files)
开发者ID:ze-phyr-us,项目名称:galene,代码行数:7,代码来源:galene.py

示例4: update_player_with_bet

	def update_player_with_bet(self, player, bet_size):
		self.bet = bet_size
		player.curr_bet += self.bet
		player.chips -= self.bet
		self.pot += self.bet
		utils.out("%s(%d) bets %d. Pot is %d" % (
		player.name, player.chips, self.bet, self.pot), self.debug_level)
开发者ID:dschwarz26,项目名称:PokerBot,代码行数:7,代码来源:deal.py

示例5: print_output

def print_output(name, src, toStdErr):
    try:
        while not finished and src is not None:
            out(toStdErr, src.readline())
            flush(toStdErr)
        src.close()
    except:
        pass
开发者ID:TeraprocSoftware,项目名称:jaguar,代码行数:8,代码来源:service.py

示例6: delete

 def delete(self, dryrun=True):
     if dryrun:
         out(u"dry run: delete %s" % self.filepath)
     else:
         path = self.filepath.encode("utf-8")
         try:
             self.ftp.delete(path)
         except Exception, err:
             out(u"Error deleting %s: %s" % (repr(path), err))
开发者ID:alexandraferguson,项目名称:python-code-snippets,代码行数:9,代码来源:ftp_base.py

示例7: update_player_with_raise

	def update_player_with_raise(self, player, raise_increase):
		amount_to_call = self.bet - player.curr_bet
		player.chips -= amount_to_call + raise_increase
		self.bet += raise_increase
		player.curr_bet = self.bet
		self.pot += amount_to_call + raise_increase
		self.curr_raise += raise_increase
		utils.out("%s(%d) raises to %d. Pot is %d" % (
			player.name, player.chips, self.bet, self.pot), self.debug_level)
开发者ID:dschwarz26,项目名称:PokerBot,代码行数:9,代码来源:deal.py

示例8: main

def main(ENTITY_TYPE):

    entity_type_table = ENTITY_TYPE.replace('-', '_')
    url_relationship_table = 'l_%s_url' % entity_type_table if ENTITY_TYPE != 'work' else 'l_url_%s' % entity_type_table
    main_entity_entity_point = "entity0" if ENTITY_TYPE != 'work' else "entity1"
    url_entity_point = "entity1" if ENTITY_TYPE != 'work' else "entity0"

    query = """
    WITH
        entities_wo_wikidata AS (
            SELECT DISTINCT e.id AS entity_id, e.gid AS entity_gid, u.url AS wp_url, substring(u.url from '//(([a-z]|-)+)\\.') as wp_lang
            FROM """ + entity_type_table + """ e
                JOIN """ + url_relationship_table + """ l ON l.""" + main_entity_entity_point + """ = e.id AND l.link IN (SELECT id FROM link WHERE link_type = """ + str(WIKIPEDIA_RELATIONSHIP_TYPES[ENTITY_TYPE]) + """)
                JOIN url u ON u.id = l.""" + url_entity_point + """ AND u.url LIKE 'http://%%.wikipedia.org/wiki/%%'
            WHERE 
                /* No existing WikiData relationship for this entity */
                NOT EXISTS (SELECT 1 FROM """ + url_relationship_table + """ ol WHERE ol.""" + main_entity_entity_point + """ = e.id AND ol.link IN (SELECT id FROM link WHERE link_type = """ + str(WIKIDATA_RELATIONSHIP_TYPES[ENTITY_TYPE]) + """))
                /* WP link should only be linked to this entity */
                AND NOT EXISTS (SELECT 1 FROM """ + url_relationship_table + """ ol WHERE ol.""" + url_entity_point + """ = u.id AND ol.""" + main_entity_entity_point + """ <> e.id)
                AND l.edits_pending = 0
        )
    SELECT e.id, e.gid, e.name, ewf.wp_url, b.processed
    FROM entities_wo_wikidata ewf
    JOIN """ + entity_type_table + """ e ON ewf.entity_id = e.id
    LEFT JOIN bot_wp_wikidata_links b ON e.gid = b.gid AND b.lang = ewf.wp_lang
    ORDER BY b.processed NULLS FIRST, e.id
    LIMIT 500
    """

    seen = set()
    matched = set()
    for entity in db.execute(query):
        if entity['gid'] in matched:
            continue

        colored_out(bcolors.OKBLUE, 'Looking up entity "%s" http://musicbrainz.org/%s/%s' % (entity['name'], ENTITY_TYPE, entity['gid']))
        out(' * wiki:', entity['wp_url'])

        page = WikiPage.fetch(entity['wp_url'], False)
        if page.wikidata_id:
            wikidata_url = 'http://www.wikidata.org/wiki/%s' % page.wikidata_id.upper()
            edit_note = 'From %s' % (entity['wp_url'],)
            colored_out(bcolors.OKGREEN, ' * found WikiData identifier:', wikidata_url)
            time.sleep(1)
            out(' * edit note:', edit_note.replace('\n', ' '))
            mb.add_url(ENTITY_TYPE.replace('-', '_'), entity['gid'], str(WIKIDATA_RELATIONSHIP_TYPES[ENTITY_TYPE]), wikidata_url, edit_note, True)
            matched.add(entity['gid'])

        if entity['processed'] is None and entity['gid'] not in seen:
            db.execute("INSERT INTO bot_wp_wikidata_links (gid, lang) VALUES (%s, %s)", (entity['gid'], page.lang))
        else:
            db.execute("UPDATE bot_wp_wikidata_links SET processed = now() WHERE (gid, lang) = (%s, %s)", (entity['gid'], page.lang))
        seen.add(entity['gid'])
    stats['seen'][ENTITY_TYPE] = len(seen)
    stats['matched'][ENTITY_TYPE] = len(matched)
开发者ID:tommycrock,项目名称:musicbrainz-bot,代码行数:55,代码来源:wp_wikidata_links.py

示例9: amazon_lookup_asin

def amazon_lookup_asin(url):
    params = {"ResponseGroup": "ItemAttributes,Medium,Images", "IdType": "ASIN"}
    loc = amazon_url_loc(url)
    asin = amazon_url_asin(url)
    if loc not in amazon_api:
        amazon_api[loc] = amazonproduct.API(locale=loc)
    try:
        root = amazon_api[loc].item_lookup(asin, **params)
    except amazonproduct.errors.InvalidParameterValue, e:
        out(e)
        return None
开发者ID:weisslj,项目名称:musicbrainz-bot,代码行数:11,代码来源:asin_links_remove.py

示例10: get_sidepot

	def get_sidepot(self, player):
		bets_this_round = sum(player.curr_bet for player in self.players)
		pot_before_bet = self.pot - bets_this_round
		sidepot = pot_before_bet + player.curr_bet
		for other in self.players:
			#To do: players cannot have the same name
			if other.name != player.name:
				if other.curr_bet < player.curr_bet:
					sidepot += other.curr_bet
				else:
					sidepot += player.curr_bet
		utils.out('%s has a sidepot of %d' % (player.name, sidepot), self.debug_level)
		return sidepot
开发者ID:dschwarz26,项目名称:PokerBot,代码行数:13,代码来源:deal.py

示例11: play_round

	def play_round(self):
		#Preflop
		for player in self.players:
			utils.out("%s is dealt %s" % (player.name, player.hand.read_out()), self.debug_level)
                seat_to_act = self.get_next_seat(self.small_blind_seat, num_seats=2)
		if self.play_all_actions(seat_to_act):
			return                
		self.clean_up_betting_round()
		
		#Flop
		self.communal_cards += self.deck.draw(num_cards=3)
		utils.out("Flop: %s %s %s" % (self.communal_cards[0].read_out(), self.communal_cards[1].read_out(),
			self.communal_cards[2].read_out()), self.debug_level)
		if self.play_all_actions(self.small_blind_seat):
			return
		self.clean_up_betting_round()
		
		#Turn
		self.communal_cards += self.deck.draw()
		utils.out("Turn: %s" % self.communal_cards[3].read_out(), self.debug_level)
		if self.play_all_actions(self.small_blind_seat):
			return
		self.clean_up_betting_round()

		#River
		self.communal_cards += self.deck.draw()
		utils.out("River: %s" % self.communal_cards[4].read_out(), self.debug_level)
		if self.play_all_actions(self.small_blind_seat):
			return
		self.set_player_ranks()
		self.clean_up(players_by_rank = self.get_players_by_rank())
开发者ID:dschwarz26,项目名称:PokerBot,代码行数:31,代码来源:deal.py

示例12: pay_winnings

	def pay_winnings(self, winnings, winners):
		for i, winner in enumerate(winners):
			#Pay remainder to the first winner
			if i == 0:
				remainder = winnings % len(winners)
				winner.chips += remainder
				self.pot -= remainder
				utils.out('%s(%d) wins remainder of %d' % (winner.name, winner.chips,
					remainder), self.debug_level)

			winner.chips += winnings / len(winners)
			utils.out('%s(%d) wins %d chips with %s' % (winner.name, winner.chips,
				winnings, winner.hand.read_out()), self.debug_level)
			self.pot -= winnings / len(winners)
		return winners
开发者ID:dschwarz26,项目名称:PokerBot,代码行数:15,代码来源:deal.py

示例13: update_player_with_call

	def update_player_with_call(self, player):
		#Note: call_amount is 0 in the case that the big blind calls preflop.
		amount_to_call = self.bet - player.curr_bet
		#Check if player is all-in
		if amount_to_call > player.chips:
			player.curr_bet += player.chips
			self.pot += player.chips
			utils.out('%s(0) calls for %d and is all in. Pot is %d' % (
				player.name, player.chips, self.pot), self.debug_level)
			player.chips = 0
		else:
			player.curr_bet = self.bet
			player.chips -= amount_to_call
			self.pot += amount_to_call
			utils.out("%s(%d) calls for %d. Pot is %d" % (
				player.name, player.chips, amount_to_call, self.pot), self.debug_level)
开发者ID:dschwarz26,项目名称:PokerBot,代码行数:16,代码来源:deal.py

示例14: __init__

	def __init__(self, players, small_blind=1, big_blind=2, dealer_seat=0, debug_level=0):
		self.debug_level = debug_level	
		self.players = players
		self.deck = Deck()
		self.small_blind = small_blind
		self.big_blind = big_blind
		self.pot = 0
		self.curr_raise = 0
		self.num_players_in_hand = len(self.players)
		self.num_active_players_in_hand = self.num_players_in_hand
		self.communal_cards = []
		
		self.initiate_round(dealer_seat)
		
		utils.out('---------------------------------------', self.debug_level)
		utils.out('%s(%d) is dealer.' % (self.players[dealer_seat].name, self.players[dealer_seat].chips),
			self.debug_level)
开发者ID:dschwarz26,项目名称:PokerBot,代码行数:17,代码来源:deal.py

示例15: main

def main():
    seen = set()
    matched = set()
    for artist in db.execute(query):
        if artist['gid'] in matched:
            continue

        colored_out(bcolors.OKBLUE, 'Looking up artist "%s" http://musicbrainz.org/artist/%s' % (artist['name'], artist['gid']))
        out(' * wiki:', artist['wp_url'])

        page = WikiPage.fetch(artist['wp_url'], False)
        identifiers = determine_authority_identifiers(page)
        if 'VIAF' in identifiers:
            if not isinstance(identifiers['VIAF'], basestring):
                colored_out(bcolors.FAIL, ' * multiple VIAF found: %s' % ', '.join(identifiers['VIAF']))
            elif identifiers['VIAF'] == '' or identifiers['VIAF'] is None:
                colored_out(bcolors.FAIL, ' * invalid empty VIAF found')
            else:
                viaf_url = 'http://viaf.org/viaf/%s' % identifiers['VIAF']
                edit_note = 'From %s' % (artist['wp_url'],)
                colored_out(bcolors.OKGREEN, ' * found VIAF:', viaf_url)
                # Check if this VIAF has not been deleted
                skip = False
                try:
                    resp, content = httplib2.Http().request(viaf_url)
                except socket.error:
                    colored_out(bcolors.FAIL, ' * timeout!')
                    skip = True
                deleted_message = 'abandonedViafRecord'
                if skip == False and (resp.status == '404' or deleted_message in content):
                    colored_out(bcolors.FAIL, ' * deleted VIAF!')
                    skip = True
                if skip == False:
                    time.sleep(3)
                    out(' * edit note:', edit_note.replace('\n', ' '))
                    mb.add_url('artist', artist['gid'], str(VIAF_RELATIONSHIP_TYPES['artist']), viaf_url, edit_note)
                    matched.add(artist['gid'])

        if artist['processed'] is None and artist['gid'] not in seen:
            db.execute("INSERT INTO bot_wp_artist_viaf (gid, lang) VALUES (%s, %s)", (artist['gid'], page.lang))
        else:
            db.execute("UPDATE bot_wp_artist_viaf SET processed = now() WHERE (gid, lang) = (%s, %s)", (artist['gid'], page.lang))
        seen.add(artist['gid'])
开发者ID:legoktm,项目名称:musicbrainz-bot,代码行数:43,代码来源:wp_artist_viaf.py


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