Skip to content

Commit b166c40

Browse files
fix: silence the three remaining pyright errors
cast() the single-task lookup in the test (tasks() returns a dict for a uuid), add a targeted pyright ignore for the py2app options stub limitation, and run pyright via pipenv so it resolves project imports.
1 parent 926ca5a commit b166c40

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ code-lint: code-style ## Lint the code
9595

9696
code-check-types: ## Check the code types
9797
@echo Pyright...
98-
@if type pyright >/dev/null 2>&1 ; then PYRIGHT_PYTHON_FORCE_VERSION=latest pyright *.py $(SRC_CORE) $(SRC_TEST) ; \
99-
else echo "SKIPPED. Run 'npm install -f pyright' first." >&2 ; fi
98+
@if type $(PIPENV) >/dev/null 2>&1 ; then PYRIGHT_PYTHON_FORCE_VERSION=latest $(PIPENV) run pyright *.py $(SRC_CORE) $(SRC_TEST) ; \
99+
else echo "SKIPPED. Run '$(PIP) install pyright' or 'npm install -f pyright' first." >&2 ; fi
100100
@echo MyPy...
101101
@if type mypy >/dev/null 2>&1 ; then mypy --check-untyped-defs --no-error-summary --ignore-missing-imports *.py $(SRC_CORE) $(SRC_TEST) ; \
102102
else echo "SKIPPED. Run '$(PIP) install mypy' first." >&2 ; fi

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ def package_files(directory):
2323
app=[""],
2424
packages=find_packages(),
2525
data_files=package_files(""),
26-
options={"py2app": {"argv_emulation": False}},
26+
options={"py2app": {"argv_emulation": False}}, # pyright: ignore[reportArgumentType]
2727
setup_requires=["py2app"],
2828
)

‎tests/test_things.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import tracemalloc
99
import unittest
1010
import unittest.mock
11+
from typing import cast
1112

1213
import things
1314
import things.database
@@ -453,7 +454,7 @@ def test_thingsdate(self):
453454
self.assertEqual("AND stopDate IS NULL", sqlfilter)
454455

455456
def test_thingstime(self):
456-
test_task = things.tasks("7F4vqUNiTvGKaCUfv5pqYG")
457+
test_task = cast(dict, things.tasks("7F4vqUNiTvGKaCUfv5pqYG"))
457458
self.assertEqual(test_task.get("reminder_time"), "12:34")
458459

459460

0 commit comments

Comments
 (0)