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


Python Query.run方法代码示例

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


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

示例1: random_tweet

# 需要导入模块: from query import Query [as 别名]
# 或者: from query.Query import run [as 别名]
def random_tweet():
    tweet = TwitterAPI.get_random_tweet()
    tweet_id = tweet['id']

    # Store the random tweet
    with open('tweets/%d.json' % tweet_id, 'w') as f:
        f.write(json.dumps(tweet))

    # Get our additional information
    query = Query(tweet['text'] + " " + tweet['user']['name'])
    query.run()
    article = query.get_result_article()
    article_file_name = query.get_result_filename()

    # Replace all the links in the article
    if article is not None:
        article = article.replace('/wiki/', 'https://en.wikipedia.org/wiki/')

    if article is not None:
        markup = TwitterAPI.get_tweet_markup(tweet_id)
        parameters = {
            'article_html': article,
            'article_filename': article_file_name,
            'tweet_html': markup,
            'ratings': [1, 2, 3, 4, 5],
            'tweet_id': tweet_id,
        }
        return render_template('tweet.html', **parameters)
    else:
        # We need to find another tweet
        return random_tweet()
开发者ID:maddieclayton,项目名称:COS435-project,代码行数:33,代码来源:server.py

示例2: calculValue

# 需要导入模块: from query import Query [as 别名]
# 或者: from query.Query import run [as 别名]
	def calculValue( self, varMap ):
		undetermined = "!?[A-Z][|^]"
		composite = "!?[A-Z]\+"

		if ( re.search(undetermined, self.right) != None ):
			return ( -1 )

		query = Query( self.solution )
		result = query.run(varMap)
		if ( re.search(composite, self.right) != None and result != 1 ):
			return ( -1 )
		elif (self.right.find( "!" + self.var ) != -1 and result != -1):
			return ( 0 if result == 1 else 1 )
		return (result)
开发者ID:jflorimo,项目名称:exp_syst,代码行数:16,代码来源:var_solution.py

示例3: Query

# 需要导入模块: from query import Query [as 别名]
# 或者: from query.Query import run [as 别名]
C.setValue(0)

varMap = {
			"A" : A,
			"B" : B,
			"C" : C
		}

query = "(A+B)|(B+C)"
test = Query(query)
print(query)
tmp = query
for (name, value) in varMap.items():
	tmp = str.replace(tmp, name, str(value.getValue()))
print(tmp)
result = test.run(varMap)
print("result brut = " + str(result))

def interpretResult( right, search, result ):
	undetermined = "!?[A-Z][|^]"
	composite = "!?[A-Z]\+"
	if ( re.search(undetermined, right) != None ):
		return ( -1 )
	elif ( re.search(composite, right) != None and result != 1 ):
		return ( -1 )
	elif (right.find( "!" + search ) != -1 and result != -1):
		return ( 0 if result == 1 else 1 )
	return (result)


right = "!X + Y"
开发者ID:jflorimo,项目名称:exp_syst,代码行数:33,代码来源:test.py

示例4: query

# 需要导入模块: from query import Query [as 别名]
# 或者: from query.Query import run [as 别名]
 def query(self):
     query = Query(self.nodeId,self.network)
     cost, associatedData = query.run() #Get all data
     return cost
开发者ID:rohitvarkey,项目名称:DCSPaperSim,代码行数:6,代码来源:user.py


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