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>
kenden
Nickolay Yudin <kelciour@gmail.com>
neitrinoweb <github.com/neitrinoweb/>
********************
The text of the 3 clause BSD license follows:

View File

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