當前位置: 首頁>>代碼示例>>Python>>正文


Python Users.get_user方法代碼示例

本文整理匯總了Python中users.Users.get_user方法的典型用法代碼示例。如果您正苦於以下問題:Python Users.get_user方法的具體用法?Python Users.get_user怎麽用?Python Users.get_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在users.Users的用法示例。


在下文中一共展示了Users.get_user方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_all_username_and_score

# 需要導入模塊: from users import Users [as 別名]
# 或者: from users.Users import get_user [as 別名]
    def get_all_username_and_score(start_datetime, end_datetime, count=20):
        result = list()

        usernames = Games.get_all_username(start_datetime, end_datetime)
        for username in usernames:
            temp = dict()
            temp["username"] = username["username"][:3] + "****" + username["username"][7:]
            u = Users.get_user(username["username"])
            if u is not None:
                temp["user_id"] = u.id
            else:
                temp["user_id"] = 0
            temp["score"] = Games.get_max_score(username["username"], start_datetime, end_datetime)
            result.append(temp)

        result = Operations.sort_list_with_dict(result, "score", True)

        # before = 0
        ranking = 1
        index = 1
        for r in result:
            if index > count:
                break
            # if r["score"] == before:
            #     r["ranking"] = ranking
            #     reward_node_info = GameDayRewards.get_some_node_info(ranking)
            #     if reward_node_info:
            #         r["reward"] = reward_node_info.get("text")
            #     else:
            #         r["reward"] = 0
            #     index += 1
            #     continue
            # else:
            #     before = r["score"]
            ranking = index
            r["ranking"] = ranking
            reward_node_info = GameDayRewards.get_some_node_info(ranking)
            if reward_node_info:
                r["reward"] = reward_node_info.get("text")
            else:
                r["reward"] = 0

            index += 1

        return result
開發者ID:appleface2050,項目名稱:WorkCode_Bakup,代碼行數:47,代碼來源:games.py

示例2: view_user

# 需要導入模塊: from users import Users [as 別名]
# 或者: from users.Users import get_user [as 別名]
def view_user(id=None):
    u = Users()
    name, last_name, user_login = list(u.get_user(id))[0]
    return render_template("index.html", name=name, last_name=last_name,
                           user_login=user_login)
開發者ID:QuazyThain,項目名稱:Flask_html_db,代碼行數:7,代碼來源:flask_framework.py


注:本文中的users.Users.get_user方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。