Merge pull request #673 from neitrinoweb/type-hints-qt-module

Add type hints to clayout.py
This commit is contained in:
Damien Elmes 2020-06-29 15:39:13 +10:00 committed by GitHub
commit 7838702a10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,7 @@ Thomas Brownback <https://github.com/brownbat/>
Andrew Gaul <andrew@gaul.org> Andrew Gaul <andrew@gaul.org>
kenden kenden
Nickolay Yudin <kelciour@gmail.com> Nickolay Yudin <kelciour@gmail.com>
neitrinoweb <github.com/neitrinoweb/>
******************** ********************
The text of the 3 clause BSD license follows: The text of the 3 clause BSD license follows:

View File

@ -4,7 +4,7 @@
import copy import copy
import json import json
import re import re
from typing import List, Optional from typing import Any, Dict, List, Optional
import aqt import aqt
from anki.cards import Card from anki.cards import Card
@ -87,7 +87,7 @@ class CardLayout(QDialog):
self.ignore_change_signals = False self.ignore_change_signals = False
self.update_current_ordinal_and_redraw(self.ord) self.update_current_ordinal_and_redraw(self.ord)
def update_current_ordinal_and_redraw(self, idx): def update_current_ordinal_and_redraw(self, idx: int) -> None:
if self.ignore_change_signals: if self.ignore_change_signals:
return return
self.ord = idx self.ord = idx
@ -136,7 +136,7 @@ class CardLayout(QDialog):
self._fieldsOnTemplate(tmpl["afmt"]), self._fieldsOnTemplate(tmpl["afmt"]),
) )
def _fieldsOnTemplate(self, fmt): def _fieldsOnTemplate(self, fmt: str) -> str:
matches = re.findall("{{[^#/}]+?}}", fmt) matches = re.findall("{{[^#/}]+?}}", fmt)
chars_allowed = 30 chars_allowed = 30
field_names: List[str] = [] field_names: List[str] = []