Skip to content

Commit bc64ab7

Browse files
committed
Correct abstraction Setup
1 parent 318bab4 commit bc64ab7

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

qrcode/image/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
DrawerAliases = dict[str, tuple[type[QRModuleDrawer], dict[str, Any]]]
1313

1414

15-
class BaseImage:
15+
class BaseImage(abc.ABC):
1616
"""
1717
Base QRCode image output class.
1818
"""

qrcode/image/styledpil.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
from typing import overload
4+
35
import qrcode.image.base
46
from PIL import Image
57
from qrcode.image.styles.colormasks import QRColorMask, SolidFillColorMask
@@ -69,6 +71,12 @@ def __init__(self, *args, **kwargs):
6971

7072
super().__init__(*args, **kwargs)
7173

74+
@overload
75+
def drawrect(self, row, col):
76+
"""
77+
Not used.
78+
"""
79+
7280
def new_image(self, **kwargs):
7381
mode = (
7482
"RGBA"

qrcode/image/svg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ def __init__(self, *args, **kwargs):
2828
# Save the unit size, for example the default box_size of 10 is '1mm'.
2929
self.unit_size = self.units(self.box_size)
3030

31+
@overload
32+
def drawrect(self, row, col):
33+
"""
34+
Not used.
35+
"""
36+
3137
@overload
3238
def units(self, pixels: Union[int, Decimal], text: Literal[False]) -> Decimal: ...
3339

qrcode/tests/test_qrcode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def test_qrcode_factory():
131131
class MockFactory(BaseImage):
132132
drawrect = mock.Mock()
133133
new_image = mock.Mock()
134+
save = mock.Mock()
134135

135136
qr = qrcode.QRCode(image_factory=MockFactory)
136137
qr.add_data(UNICODE_TEXT)

0 commit comments

Comments
 (0)