Skip to content

Commit 99c696a

Browse files
committed
Fix type checking CI issues
1 parent 696f99c commit 99c696a

4 files changed

Lines changed: 12 additions & 11 deletions

File tree

pylustrator/change_tracker.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
import re
2323
import sys
2424
import traceback
25-
from typing import IO, Optional, Dict, Tuple, Callable, cast
25+
from typing import IO, Optional, Dict, Tuple, Callable
2626
from packaging import version
2727

2828
import numpy as np
29-
import matplotlib
3029
import matplotlib as mpl
3130
import matplotlib.pyplot as plt
3231
from matplotlib import _pylab_helpers

pylustrator/components/plot_layout.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import numpy as np
3-
from typing import TYPE_CHECKING
3+
from typing import TYPE_CHECKING, Optional
44

55
if TYPE_CHECKING:
66
from PyQt5 import QtCore, QtGui, QtWidgets
@@ -57,7 +57,9 @@ def __init__(self, *args):
5757
super().__init__(*args)
5858
self.setMouseTracking(True)
5959

60-
def event(self, e: QtCore.QEvent):
60+
def event(self, e: Optional["QtCore.QEvent"]) -> bool: # ty:ignore[invalid-method-override]
61+
if e is None:
62+
return super().event(e)
6163
if (
6264
e.type() == QtCore.QEvent.Type.KeyPress
6365
or e.type() == QtCore.QEvent.Type.KeyRelease

pylustrator/components/qitem_properties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# along with Pylustrator. If not, see <http://www.gnu.org/licenses/>
2121

2222
import os
23-
from typing import TYPE_CHECKING, Any, List, Optional, Tuple, cast, Literal
23+
from typing import TYPE_CHECKING, Any, List, Tuple, cast, Literal
2424
import numpy as np
2525
from packaging import version
2626

pylustrator/exception_swallower.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __getattr__(self, item):
3333
def __call__(self, *args, **kwargs):
3434
return Dummy()
3535

36-
def __getitem__(self, item):
36+
def __getitem__(self, item):
3737
return Dummy()
3838

3939

@@ -43,33 +43,33 @@ class SaveList(list):
4343
def __init__(self, target):
4444
list.__init__(self, target)
4545

46-
def __getitem__(self, item):
46+
def __getitem__(self, item): # ty:ignore[invalid-method-override]
4747
try:
4848
return list.__getitem__(self, item)
4949
except IndexError:
5050
return Dummy()
5151

5252

53-
class SaveDict(dict):
53+
class SaveDict(dict):
5454
"""a dictionary that returns dummy objects when an invalid item is requested"""
5555

5656
def __init__(self, target):
5757
dict.__init__(self, target)
5858

59-
def __getitem__(self, item):
59+
def __getitem__(self, item):
6060
try:
6161
return dict.__getitem__(self, item)
6262
except KeyError:
6363
return Dummy()
6464

6565

66-
class SaveTuple(tuple):
66+
class SaveTuple(tuple):
6767
"""a tuple that returns dummy objects when an invalid item is requested"""
6868

6969
def __init__(self, target):
7070
tuple.__init__(self, target) # ty:ignore[too-many-positional-arguments]
7171

72-
def __getitem__(self, item):
72+
def __getitem__(self, item): # ty:ignore[invalid-method-override]
7373
try:
7474
return tuple.__getitem__(self, item)
7575
except IndexError:

0 commit comments

Comments
 (0)