Skip to content

Fix Python 3.8 import failure from built-in generic type hints in core.py - #167

Closed
robmarkcole with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-failing-github-actions-job-tests
Closed

robmarkcole with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-failing-github-actions-job-tests

Conversation

Copilot AI commented Oct 7, 2026 •

Copy link
Copy Markdown

The "Tests" job runs on Python 3.8 and failed while loading tests/conftest.py. Importing detective/core.py raised TypeError: 'type' object is not subscriptable, because it used PEP 585 built-in generics (tuple[...], dict[...]), which Python 3.8 doesn't support.

  • Type hints in detective/core.py
    • _normalise_sensor_ids and _sensor_filter now annotate with typing.Tuple and typing.Dict instead of tuple[...] and dict[...].
    • The _normalise_sensor_ids parameter changes from Tuple[str] to Tuple[str, ...]. Tuple[str] means a 1-tuple, but the function takes any number of sensors, so this is a typing correction only.
# before
def _normalise_sensor_ids(sensors: Tuple[str]) -> tuple[str, ...]:
def _sensor_filter(sensors: tuple[str, ...]) -> tuple[str, dict[str, str]]:

# after
def _normalise_sensor_ids(sensors: Tuple[str, ...]) -> Tuple[str, ...]:
def _sensor_filter(sensors: Tuple[str, ...]) -> Tuple[str, Dict[str, str]]:

Annotation-only change, with no runtime behaviour difference. I could not run the test suite in my environment, so the fix is unconfirmed until CI runs.

Co-authored-by: robmarkcole <11855322+robmarkcole@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix the failing GitHub Actions job "Tests" Fix Python 3.8 import failure from built-in generic type hints in core.py Oct 7, 2026
Copilot AI requested a review from robmarkcole October 7, 2026 10:25
@robmarkcole robmarkcole closed this Oct 7, 2026
@robmarkcole
robmarkcole deleted the copilot/fix-failing-github-actions-job-tests branch October 7, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants