Lint picking
This commit is contained in:
@@ -7,6 +7,7 @@ from email import policy
|
||||
from email.message import EmailMessage
|
||||
from html.parser import HTMLParser
|
||||
from io import StringIO
|
||||
from typing import Any, List
|
||||
|
||||
import css_inline
|
||||
from PyQt6.QtCore import QResource, QSize, Qt, QUrl, pyqtSlot
|
||||
@@ -21,7 +22,7 @@ from ui.PeopleDialog import Ui_Dialog
|
||||
|
||||
class blockHandler(HTMLParser):
|
||||
text = ""
|
||||
blocks = []
|
||||
blocks: List[str] = []
|
||||
active = 0
|
||||
tags = [
|
||||
"h1",
|
||||
@@ -39,7 +40,7 @@ class blockHandler(HTMLParser):
|
||||
]
|
||||
space = ["b", "i", "em", "st", "span"]
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.reset()
|
||||
self.strict = False
|
||||
@@ -49,7 +50,7 @@ class blockHandler(HTMLParser):
|
||||
self.active = 0
|
||||
return
|
||||
|
||||
def handle_starttag(self, tag, attrs):
|
||||
def handle_starttag(self, tag: str, attrs: Any) -> None:
|
||||
if not tag in self.tags:
|
||||
return
|
||||
self.active += 1
|
||||
@@ -58,7 +59,7 @@ class blockHandler(HTMLParser):
|
||||
self.text += f"<{tag}>"
|
||||
return
|
||||
|
||||
def handle_endtag(self, tag):
|
||||
def handle_endtag(self, tag: str) -> None:
|
||||
if not tag in self.tags:
|
||||
return
|
||||
self.active -= 1
|
||||
@@ -71,21 +72,21 @@ class blockHandler(HTMLParser):
|
||||
self.active = 0
|
||||
return
|
||||
|
||||
def handle_data(self, data):
|
||||
def handle_data(self, data: str) -> None:
|
||||
self.text += data
|
||||
return
|
||||
|
||||
def get_block(self, block):
|
||||
def get_block(self, block: int) -> str:
|
||||
return self.blocks[block]
|
||||
|
||||
|
||||
class MLStripper(HTMLParser):
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.reset()
|
||||
return
|
||||
|
||||
def reset(self):
|
||||
def reset(self) -> None:
|
||||
super().reset()
|
||||
self.strict = False
|
||||
self.convert_charrefs = True
|
||||
@@ -93,13 +94,13 @@ class MLStripper(HTMLParser):
|
||||
self.first = True
|
||||
return
|
||||
|
||||
def handle_data(self, d):
|
||||
def handle_data(self, d: str) -> None:
|
||||
if self.first:
|
||||
self.text.write(d)
|
||||
self.first = False
|
||||
return
|
||||
|
||||
def get_data(self):
|
||||
def get_data(self) -> str:
|
||||
return self.text.getvalue()
|
||||
|
||||
|
||||
@@ -110,7 +111,7 @@ class PersonDialog(QDialog, Ui_Dialog):
|
||||
person_id = 0
|
||||
inliner = css_inline.CSSInliner(keep_style_tags=True, keep_link_tags=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
self.person_id = kwargs.pop("person_id", 0)
|
||||
super(PersonDialog, self).__init__(*args, **kwargs)
|
||||
self.setupUi(self)
|
||||
@@ -128,7 +129,7 @@ class PersonDialog(QDialog, Ui_Dialog):
|
||||
self.bookCombo.setModel(model)
|
||||
self.bookCombo.setModelColumn(1)
|
||||
self.bookCombo.setCurrentIndex(-1)
|
||||
model = QStandardItemModel()
|
||||
model: QStandardItemModel = QStandardItemModel() # type: ignore[no-redef]
|
||||
self.sectionCombo.setPlaceholderText("Select A Section")
|
||||
self.sectionCombo.setModel(model)
|
||||
self.sectionCombo.setEnabled(False)
|
||||
@@ -349,7 +350,7 @@ class PersonDialog(QDialog, Ui_Dialog):
|
||||
return
|
||||
|
||||
@pyqtSlot()
|
||||
def checkLineEdits(self):
|
||||
def checkLineEdits(self) -> None:
|
||||
name = self.nameEdit.text().strip()
|
||||
org = self.orgEdit.text().strip()
|
||||
button = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
|
||||
|
||||
Reference in New Issue
Block a user