From 0e2a673a33eb59d11757d06df6f9fa50bb081c59 Mon Sep 17 00:00:00 2001 From: Jan Domanski Date: Sat, 7 Sep 2024 11:06:37 +0200 Subject: [PATCH 1/2] feat: add py.typed --- setup.py | 2 ++ src/qreader/py.typed | 0 2 files changed, 2 insertions(+) create mode 100644 src/qreader/py.typed diff --git a/setup.py b/setup.py index 9f3b8be..1abb5c8 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,8 @@ package_dir={"": "src"}, # expose qreader.py as the unique module py_modules=["qreader"], + # include py.typed file in the distribution + package_data={"qreader": ["src/qreader/py.typed"]}, url="https://github.com/Eric-Canas/qreader", license="MIT", author="Eric Canas", diff --git a/src/qreader/py.typed b/src/qreader/py.typed new file mode 100644 index 0000000..e69de29 From c9d92e6bd247f799421258f56417c1f36de39214 Mon Sep 17 00:00:00 2001 From: Jan Domanski Date: Sat, 7 Sep 2024 11:17:26 +0200 Subject: [PATCH 2/2] fix mypy linting problem --- src/qreader/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qreader/__init__.py b/src/qreader/__init__.py index cafa3eb..a9af241 100644 --- a/src/qreader/__init__.py +++ b/src/qreader/__init__.py @@ -196,9 +196,12 @@ def decode( def detect_and_decode( self, image: np.ndarray, return_detections: bool = False, is_bgr: bool = False - ) -> typing.Tuple[ + ) -> typing.Union[ + typing.Tuple[ + typing.Tuple[str | None, ...], + tuple[dict[str, np.ndarray | float | tuple[float | int, float | int]]] | None, + ], typing.Tuple[str | None, ...], - tuple[dict[str, np.ndarray | float | tuple[float | int, float | int]]] | None, ]: """ This method will decode the **QR** codes in the given image and return the decoded strings