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


Python Match.get方法代码示例

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


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

示例1: exists

# 需要导入模块: from models import Match [as 别名]
# 或者: from models.Match import get [as 别名]
 def exists(cls,iid,table):
     if table == "match":
         try:
             Match.get(iid=iid)
         except Match.DoesNotExist:
             return False
     if table == "odd":
         try:
             Odd.get(iid=iid)
         except Odd.DoesNotExist:
             return False
     if table == "cat":
         try:
             OddCategory.get(idd=iid)
         except OddCategory.DoesNotExist:
             return False
     if table == "result":
         try:
             Result.get(iid=iid)
         except Result.DoesNotExist:
             return False
     if table == "user":
         try:
             User.get(iid=iid)
         except User.DoesNotExist:
             return False
     return True
开发者ID:Okiria,项目名称:betting,代码行数:29,代码来源:sync.py

示例2: get_all_matches

# 需要导入模块: from models import Match [as 别名]
# 或者: from models.Match import get [as 别名]
def get_all_matches(account_id):
    """Try to retrieve and add all matches from a player to the database."""
    matches = api.get_match_history(account_id=account_id)["result"]
    while matches["results_remaining"] >= 0 and matches["num_results"] > 1:
        for match in matches["matches"]:
            try:
                Match.get(Match.match_id == match["match_id"])
            except DoesNotExist:
                new_match_task = add_match.delay(match["match_id"])
        matches = api.get_match_history(account_id=account_id, start_at_match_id=match["match_id"])["result"]
开发者ID:Catgroove,项目名称:dotaninja,代码行数:12,代码来源:tasks.py

示例3: check

# 需要导入模块: from models import Match [as 别名]
# 或者: from models.Match import get [as 别名]
 def check(self):
     try:
         match = Match.get(iid=self.matchCode.get_text())
         category = OddCategory.get(name=self.category.get_active_text())
         odd = Odd.get(match=match,category=category,oddCode=self.bet.get_text())
         self.addMatchButton.set_sensitive(False)
         self.reason.set_text("Match Started")
     except Match.DoesNotExist:
         self.addMatchButton.set_sensitive(False)
         self.odd.set_text("")
         self.reason.set_text("Invalid Match")
     except OddCategory.DoesNotExist:
         self.addMatchButton.set_sensitive(False)
         self.odd.set_text("")
         self.reason.set_text("Invalid Category")
     except Odd.DoesNotExist:
         self.addMatchButton.set_sensitive(False)
         self.odd.set_text("")
         self.reason.set_text("Invalid Bet")
     else:
         if match.is_valid():
             self.addMatchButton.set_sensitive(True)
             self.reason.set_text("Available")
             self.odd.set_text(str(odd.odd))
         else:
             self.addMatchButton.set_sensitive(False)
             self.reason.set_text("Match Started")
     if len(self.bets)>0 and self.amountstaked.get_text()!= "":
         self.stakebutton.set_sensitive(True)
     else:
         self.stakebutton.set_sensitive(False)
开发者ID:Okiria,项目名称:betting,代码行数:33,代码来源:bet_interface.py

示例4: check_available

# 需要导入模块: from models import Match [as 别名]
# 或者: from models.Match import get [as 别名]
def check_available(match_id,oddCode,category_name):
    try:
        match = Match.get(iid=match_id)
        category = OddCategory.get(name=category_name)
        odd = Odd.get(match=match,category=category,oddCode=oddCode)
    except peewee.DoesNotExist:
        return None
    else:
        return odd.odd
开发者ID:Okiria,项目名称:betting,代码行数:11,代码来源:api.py

示例5: syncOddTable

# 需要导入模块: from models import Match [as 别名]
# 或者: from models.Match import get [as 别名]
 def syncOddTable(self):
     self.connection.request("GET", "/sync/odd")
     response = self.connection.getresponse()
     data = json.loads(response.read())
     print response.read()
     if not data.has_key('up-to-date'):
         for odd in data['name']:
             try:
                 category = OddCategory.get(iid=int(odd['category']))
                 match = Match.get(iid=int(odd['match']))
                 Odd.create(iid=odd['iid'],odd=unicode(odd['odd']), category=category, oddCode=unicode(odd['oddCode']), match=match)
             except Exception, e:
                 print str(e) + "- Odd"
开发者ID:Okiria,项目名称:betting,代码行数:15,代码来源:sync.py

示例6: on_addMatchButton_clicked

# 需要导入模块: from models import Match [as 别名]
# 或者: from models.Match import get [as 别名]
    def on_addMatchButton_clicked(self,widget,data=None):
        matchId = self.matchCode.get_text()
        oddCode = self.bet.get_text()
        category = self.category.get_active_text()
        try:
            match = Match.get(iid=matchId)
            category = OddCategory.get(name=category)
        except peewee.DoesNotExist:
            self.addMatchButton.set_sensitive(False)
        else:

            try:
                bet = create_bet(match,oddCode,category)
                self.bets.append(bet)
                self.matchCode.set_text("")
                self.bet.set_text("")
                self.category.set_active(0)

            except BetError, e:
                #Todo Catch this error
                self.available.set_text("Unavailable")
开发者ID:Okiria,项目名称:betting,代码行数:23,代码来源:bet_interface.py

示例7: get

# 需要导入模块: from models import Match [as 别名]
# 或者: from models.Match import get [as 别名]
  def get(self):

    # check for a cached version
    #--------------------------------------------------------------------#

    match_key = db.Key(self.request.get("match_key"))
    if self.emit(self.response.out, match_key):
      return

    # not cached or evicted from cache; regenerate
    #--------------------------------------------------------------------#
    match = Match.get(match_key)      
      
    if not match:
      return

    home_record, away_record = match.get_team_records_query().fetch(2)
    match_data = MatchData(match)

    # team_match_table
    #--------------------------------------------------------------------#

    def team_name_getter(record):
      return "<a rel='match_teams' href='%s'>%s</a>" % (
          record.team.get_box_href(), record.team.key().name())

    def race_getter(record):
      return "<img src='%s' />" % record.team.race.get_image_src(thumb=True)

    def glicko_getter(record):
      return "%4.0f" % record.glicko_r

    team_match_table = Table(
        columns = [
          Column(" ",         "Race",             race_getter,
            center=True),
          Column("Team",      "Team name",        team_name_getter),
          Column("Rating",    "Team rating",      glicko_getter),
          Column("TV",        "Team value",       attrgetter("tv_for")),
          Column("TD",        "Touchdowns",       attrgetter("tds_for")),
          Column("P",         "Pass completions", attrgetter("passes_for")),
          Column("YP",        "Yards passing",    attrgetter("pyards_for")),
          Column("R",         "Pass receptions",  attrgetter("rec_for")),
          Column("YR",        "Yards rushing",    attrgetter("ryards_for")),
          Column("K",         "Kills",            attrgetter("kills_for")),
          Column("C",         "Casualties",       attrgetter("cas_for")),
          Column("KO",        "Knock outs",       attrgetter("ko_for")),
          Column("S",         "Stuns",            attrgetter("stun_for")),
          Column("T",         "Tackles",          attrgetter("tckl_for")),
          Column("I",         "Interceptions",    attrgetter("int_for")),
          ],
        query = match.get_team_records_query(),
        cls = "tablesorter team_match_table",
        )

    # player_match_tables
    #--------------------------------------------------------------------#

    def number_getter(record):
      return record.player.number

    def player_name_getter(record):
      return record.player.get_box_anchor("match_players")

    def position_getter(record):
      position = record.player.position
      if position.starplayer:
        return "<b>Star Player</b>"
      else:
        return position.key().name()

    player_records = match.get_player_records_query().filter("played =", 1)
    team_player_records = {}
    for record in player_records:
      team_player_records.setdefault(
          record.team_record.team.key().name(), []).append(record)

    player_match_tables = []
    for team_name, record_set in team_player_records.items():
      table = Table(
          columns = [
            Column("#",         "Player number",         number_getter,
              center=True),
            Column("Player",    "Player name",           player_name_getter),
            Column("Position",  "Player position",       position_getter),
            Column("TD",        "Touchdowns",            attrgetter("tds_for")),
            Column("MVP",       "Most Valuable Player Awards", attrgetter("mvps")),
            Column("P",         "Pass completions",      attrgetter("passes_for")),
            Column("YP",        "Yards passing",         attrgetter("pyards_for")),
            Column("R",         "Pass receptions",       attrgetter("rec_for")),
            Column("YR",        "Yards rushing",         attrgetter("ryards_for")),
            Column("K+",        "Kills for",             attrgetter("kills_for")),
            Column("C+",        "Casualties for",        attrgetter("cas_for")),
            Column("KO+",       "Knock outs for",        attrgetter("ko_for")),
            Column("S+",        "Stuns for",             attrgetter("stun_for")),
            Column("T+",        "Tackles for",           attrgetter("tckl_for")),
            Column("I+",        "Interceptions for",     attrgetter("int_for")),
            Column("K-",        "Kills against",         attrgetter("kills_against")),
            Column("C-",        "Casualties against",    attrgetter("cas_against")),
            Column("KO-",       "Knock outs against",    attrgetter("ko_against")),
#.........这里部分代码省略.........
开发者ID:midnjerry,项目名称:bb-oftl-hrd,代码行数:103,代码来源:match_box.py


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