本文整理汇总了Python中user.User.create_or_update方法的典型用法代码示例。如果您正苦于以下问题:Python User.create_or_update方法的具体用法?Python User.create_or_update怎么用?Python User.create_or_update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.create_or_update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create_or_update [as 别名]
def __init__(self, file_name):
DataFile.__init__(self, file_name)
result_file_info = self._get_file_info()
self.topic = Topic.create_or_update(result_file_info['topic_id'])
self.user = User.create_or_update(result_file_info['user_id'])
self.query = Query.create_or_update(result_file_info['query_id'], topic=self.topic, user=self.user)
self.__parse()
示例2: __parse
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create_or_update [as 别名]
def __parse( self ):
with open( self.file_name, 'r' ) as result_file:
result_reader = csv.DictReader( result_file, delimiter=',')
for row in result_reader:
topic = Topic.create_or_update( row['topic'] )
user = User.create_or_update( row['userid'] )
condition = Condition.create_or_update( row['condition'] )
autocomplete = row['autocomplete_used'] == 1
query = Query.create_or_update( row['queryid'], topic = topic, user = user, condition = condition, autocomplete = autocomplete, query_text = row['terms'], precision = self.__build_precision_dict( row ) )
示例3: __init__
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create_or_update [as 别名]
def __init__(self, file_name):
DataFile.__init__(self, file_name)
result_file_info = self._get_file_info()
self.topic = Topic.create_or_update( result_file_info['topic_id'] )
self.user = User.create_or_update( result_file_info['user_id'] )
self.condition = Condition.create_or_update( result_file_info['condition'] )
self.__create_or_update_session()
self.query = Query.create_or_update( result_file_info['query_id'], topic = self.topic, user = self.user, session = self.session )
self.actions = self.__parse()
self.topic.add_actions( self.actions )
self.user.add_actions( self.actions )
self.query.add_actions( self.actions )
self.session.add_actions( self.actions )
self.session.add_query( self.query )