本文整理汇总了Python中user_portrait.global_utils.R_RECOMMENTATION.hgetall方法的典型用法代码示例。如果您正苦于以下问题:Python R_RECOMMENTATION.hgetall方法的具体用法?Python R_RECOMMENTATION.hgetall怎么用?Python R_RECOMMENTATION.hgetall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user_portrait.global_utils.R_RECOMMENTATION
的用法示例。
在下文中一共展示了R_RECOMMENTATION.hgetall方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_in_history
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def show_in_history(date):
results = []
hash_name = 'recomment_'+str(date)
r_results = r.hgetall(hash_name)
if r_results:
results = get_user_detail(date, r_results, 'show_in_history')
return results
示例2: show_in_history
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def show_in_history(date, user_type):
results = []
#hash_name = 'recomment_'+str(date)
identify_in_hashname = "identify_in_" + str(date)
r_results = r.hgetall(identify_in_hashname)
if r_results:
results = get_user_detail(date, r_results, 'show_in_history', user_type)
return results
示例3: get_attr
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def get_attr(date):
results = {}
overview_result = r.hgetall(hash_name)
for item in overview_result:
value = overview_result[item]
if isinstance(value, str):
value = json.loads(value)
results[item] = value
return results
示例4: identify_compute
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def identify_compute(data):
results = False
compute_status = 1
hash_name = 'compute'
uid2compute = r.hgetall(hash_name)
for item in data:
uid = item[1]
result = r.hget(hash_name, uid)
in_date = json.loads(result)[0]
r.hset(hash_name, uid, json.dumps([in_date, compute_status]))
return True
示例5: get_attr
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def get_attr(date):
results = {}
overview_result = r.hgetall(hash_name)
#print 'overview_result:', overview_result
for item in overview_result:
value = overview_result[item]
if isinstance(value, str):
value = json.loads(value)
'''
if item in rank_field:
value = value[:5]
'''
results[item] = value
#print 'overview result:', results
return results
示例6: recommentation_in
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def recommentation_in(input_ts):
date = ts2datetime(input_ts)
recomment_results = []
# read from redis
results = []
hash_name = 'recomment_'+str(date)
results = r.hgetall(hash_name)
if not results:
return results
# search from user_profile to rich the show information
for item in results:
status = results[item]
if status=='0':
recomment_results.append(item)
if recomment_results:
results = get_user_detail(date, recomment_results, 'show_in')
else:
results = []
return results
示例7: recommentation_in
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def recommentation_in(input_ts, recomment_type):
date = ts2datetime(input_ts)
recomment_results = []
# read from redis
results = []
hash_name = 'recomment_'+str(date) + "_" + recomment_type
identify_in_hashname = "identify_in_" + str(date)
results = r.hgetall(hash_name)
if not results:
return []
# search from user_profile to rich the show information
recommend_list = set(r.hkeys(hash_name))
identify_in_list = set(r.hkeys("compute"))
recomment_results = list(recommend_list - identify_in_list)
if recomment_results:
results = get_user_detail(date, recomment_results, 'show_in', recomment_type)
else:
results = []
return results
示例8: admin_recommentation_in
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def admin_recommentation_in(input_ts):
date = ts2datetime(input_ts)
recomment_results = []
identify_in_hashname = "identify_in_" + str(date)
# read from redis
results = []
hashname_submit = "submit_recomment_" + date
results = r.hgetall(hashname_submit)
if not results:
return []
# search from user_profile to rich the show information
submit_set = set(r.hkeys(hashname_submit))
idntify_in_set = set(r.hkeys("compute")) # 已入库用户名单
recomment_results = list(submit_set - idntify_in_set) #过滤一下
if recomment_results:
results = get_user_detail(date, recomment_results, 'show_in', "sensitive", "admin")
sorted_results = sorted(results, key=lambda x:x[-1], reverse=True)
results = sorted_results
else:
results = []
return results
示例9: show_compute
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def show_compute(date):
results = []
hash_name = 'compute'
r_results = r.hgetall(hash_name)
input_data = {}
#search user profile to inrich information
if r_results and date!='all':
for user in r_results:
item = r_results[user]
in_date = json.loads(item)[0]
if in_date == date:
input_data[user] = item
if input_data:
results = get_user_detail(date, input_data, 'show_compute')
else:
results = []
return results
elif r_results and date=='all':
results = get_user_detail(date, r_results, 'show_compute')
return results
else:
return results
示例10: get_online_pattern
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def get_online_pattern():
overview_result = r.hgetall(hash_name)
online_pattern = json.loads(overview_result['online_pattern_top'])
return online_pattern
示例11: get_geo_top
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def get_geo_top():
overview_result = r.hgetall(hash_name)
geo_top = json.loads(overview_result['activity_geo_top'])
return geo_top
示例12: get_hashtag_top
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def get_hashtag_top():
overview_result = r.hgetall(hash_name)
hashtag_top = json.loads(overview_result['hashtag_top'])
return hashtag_top
示例13: get_importance_top
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def get_importance_top():
overview_result = r.hgetall(hash_name)
importance_top = json.loads(overview_result['top_importance'])
return importance_top
示例14: get_activeness_top
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def get_activeness_top():
overview_result = r.hgetall(hash_name)
activeness_top = json.loads(overview_result['top_activeness'])
return activeness_top
示例15: get_comment_top
# 需要导入模块: from user_portrait.global_utils import R_RECOMMENTATION [as 别名]
# 或者: from user_portrait.global_utils.R_RECOMMENTATION import hgetall [as 别名]
def get_comment_top():
overview_result = r.hgetall(hash_name)
comment_top = json.loads(overview_result['top_comment_user'])
return comment_top