Merge pull request #382 from agentydragon/whitespace

Whitespace reformat to force 80-character line limit
This commit is contained in:
Damien Elmes 2019-12-23 09:35:56 +10:00 committed by GitHub
commit 29179771b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -575,8 +575,7 @@ where c.nid = n.id and c.id in %s group by nid""" % ids2str(cids)):
where = "" where = ""
else: else:
raise Exception() raise Exception()
return [self._renderQA(row) return [self._renderQA(*row) for row in self._qaData(where)]
for row in self._qaData(where)]
def _renderQA(self, data: QAData, qfmt: None = None, afmt: None = None) -> Dict: def _renderQA(self, data: QAData, qfmt: None = None, afmt: None = None) -> Dict:
"Returns hash of id, question, answer." "Returns hash of id, question, answer."
@ -605,13 +604,14 @@ where c.nid = n.id and c.id in %s group by nid""" % ids2str(cids)):
afmt = afmt or template['afmt'] afmt = afmt or template['afmt']
for (type, format) in (("q", qfmt), ("a", afmt)): for (type, format) in (("q", qfmt), ("a", afmt)):
if type == "q": if type == "q":
format = re.sub("{{(?!type:)(.*?)cloze:", r"{{\1cq-%d:" % (data[4]+1), format) format = re.sub("{{(?!type:)(.*?)cloze:",
format = format.replace("<%cloze:", "<%%cq:%d:" % ( r"{{\1cq-%d:" % (data[4]+1), format)
data[4]+1)) format = format.replace("<%cloze:", "<%%cq:%d:" % (data[4]+1))
else: else:
format = re.sub("{{(.*?)cloze:", r"{{\1ca-%d:" % (data[4]+1), format) format = re.sub(
format = format.replace("<%cloze:", "<%%ca:%d:" % ( "{{(.*?)cloze:", r"{{\1ca-%d:" % (data[4]+1), format)
data[4]+1)) format = format.replace(
"<%cloze:", "<%%ca:%d:" % (data[4]+1))
fields['FrontSide'] = stripSounds(d['q']) fields['FrontSide'] = stripSounds(d['q'])
fields = runFilter("mungeFields", fields, model, data, self) fields = runFilter("mungeFields", fields, model, data, self)
html = anki.template.render(format, fields) html = anki.template.render(format, fields)