Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def howdoitommy(query):
n = 1
while True:
if n > 10:
return "sorry, I cannot answer that"
args = {
"query": query.split(" "),
"num_answers": 1,
"pos": n,
"all": False,
"color": False,
}
answer = howdoi(args)
if len(answer) < 50 or len(answer) > 600:
n += 1
continue
else:
return answer
def get_answer(self, command, query):
question = query[len(command):].strip()
result = howdoi(dict(
query=question,
num_answers=1,
pos=1,
all=command[-1] == '!',
color=False
))
_answer = self.line_wrap(result, HowdoiHandler.MAX_LINE_LENGTH)
answer = "Answer to '%s':\n```\n%s\n```" % (question, _answer)
return answer