From 3bdc9e52ec4d9d4133f9e4f5694f910f976e7dde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2026 06:16:36 +0000 Subject: [PATCH 1/2] chore(deps-dev): Bump ruff from 0.16.10 to 0.17.0 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.16.10 to 0.17.0. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.16.10...0.17.0) --- updated-dependencies: - dependency-name: ruff dependency-version: 0.17.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 627d29142..2f10362ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,7 +73,7 @@ dev = [ "pytest-beartype==0.3.0", "pytest-cov==7.1.0", "pyyaml==6.0.3", - "ruff==0.16.10", + "ruff==0.17.0", # We add shellcheck-py not only for shell scripts and shell code blocks, # but also because having it installed means that ``actionlint-py`` will # use it to lint shell commands in GitHub workflow files. From a253a379659c8d20d6ccb7705bf5dddb91c62b68 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sat, 17 Oct 2026 10:03:05 +0100 Subject: [PATCH 2/2] Use the datetime alias required by Ruff 0.17 --- docs/source/index.rst | 4 ++-- src/vws/reports.py | 28 ++++++++++++++-------------- tests/async_vws/test_reports.py | 14 +++++++------- tests/conftest.py | 6 +++--- tests/test_query.py | 6 +++--- tests/vws/test_configuration.py | 6 +++--- tests/vws/test_reports.py | 16 ++++++++-------- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index ebe92c10e..c5047a0ef 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -77,7 +77,7 @@ The report is generated in the background, and the URL it is served from expires """Get the number of recognitions of each target this month.""" import calendar - import datetime + import datetime as dt import os from vws import VWS @@ -92,7 +92,7 @@ The report is generated in the background, and the URL it is served from expires database_id=database_id, ) - now = datetime.datetime.now(tz=datetime.UTC) + now = dt.datetime.now(tz=dt.UTC) report_request = vws_client.request_database_reco_counts_report( year=now.year, diff --git a/src/vws/reports.py b/src/vws/reports.py index a99d933ff..de79f0588 100644 --- a/src/vws/reports.py +++ b/src/vws/reports.py @@ -1,7 +1,7 @@ """Classes for representing Vuforia reports.""" import csv -import datetime +import datetime as dt import io from collections.abc import Mapping, Sequence from dataclasses import dataclass @@ -118,7 +118,7 @@ class TargetSummaryReport: status: TargetStatuses database_name: str target_name: str - upload_date: datetime.date + upload_date: dt.date active_flag: bool tracking_rating: int total_recos: int @@ -136,7 +136,7 @@ def from_response_dict( ), database_name=_checked(response_dict["database_name"], str), target_name=_checked(response_dict["target_name"], str), - upload_date=datetime.date.fromisoformat( + upload_date=dt.date.fromisoformat( _checked(response_dict["upload_date"], str) ), active_flag=bool(response_dict["active_flag"]), @@ -175,7 +175,7 @@ class TargetData: name: str application_metadata: str | None - target_timestamp: datetime.datetime + target_timestamp: dt.datetime @beartype @@ -201,9 +201,9 @@ def from_response_dict( target_data_dict = _checked( response_dict["target_data"], dict[str, JSONValue] ) - target_timestamp = datetime.datetime.fromtimestamp( + target_timestamp = dt.datetime.fromtimestamp( timestamp=_number(target_data_dict["target_timestamp"]), - tz=datetime.UTC, + tz=dt.UTC, ) target_data = TargetData( name=_checked(target_data_dict["name"], str), @@ -337,14 +337,14 @@ class ModelTargetDatasetStatusReport: status: ModelTargetDatasetStatuses dataset_uuid: str - created_at: datetime.datetime - eta: datetime.datetime | None + created_at: dt.datetime + eta: dt.datetime | None """When Vuforia expects to finish generating the dataset. This is given only while the dataset is processing. """ - completed_at: datetime.datetime | None + completed_at: dt.datetime | None """When Vuforia finished generating the dataset. This is given only once the dataset is no longer processing. @@ -397,15 +397,15 @@ def from_response_dict( ], ) - eta: datetime.datetime | None = None + eta: dt.datetime | None = None if "eta" in response_dict: - eta = datetime.datetime.fromisoformat( + eta = dt.datetime.fromisoformat( _checked(response_dict["eta"], str), ) - completed_at: datetime.datetime | None = None + completed_at: dt.datetime | None = None if "completedAt" in response_dict: - completed_at = datetime.datetime.fromisoformat( + completed_at = dt.datetime.fromisoformat( _checked(response_dict["completedAt"], str), ) @@ -414,7 +414,7 @@ def from_response_dict( value=_checked(response_dict["status"], str), ), dataset_uuid=_checked(response_dict["uuid"], str), - created_at=datetime.datetime.fromisoformat( + created_at=dt.datetime.fromisoformat( _checked(response_dict["createdAt"], str), ), eta=eta, diff --git a/tests/async_vws/test_reports.py b/tests/async_vws/test_reports.py index ca3e2edd2..5d189966e 100644 --- a/tests/async_vws/test_reports.py +++ b/tests/async_vws/test_reports.py @@ -3,7 +3,7 @@ from __future__ import annotations import calendar -import datetime +import datetime as dt import time import uuid from http import HTTPStatus @@ -120,14 +120,14 @@ async def test_get_target( async def test_reco_counts_report( *, async_vws_client: AsyncVWS, - current_month: datetime.date, + current_month: dt.date, report_period: Literal["current", "previous"], ) -> None: """A report can be requested, waited for and downloaded.""" report_month = ( current_month if report_period == "current" - else current_month - datetime.timedelta(days=1) + else current_month - dt.timedelta(days=1) ) client = async_vws_client report_request = await client.request_database_reco_counts_report( @@ -147,7 +147,7 @@ async def test_reco_counts_report( @pytest.mark.asyncio -async def test_not_ready(*, current_month: datetime.date) -> None: +async def test_not_ready(*, current_month: dt.date) -> None: """Downloading a report before Vuforia has generated it raises an error. """ @@ -175,7 +175,7 @@ async def test_not_ready(*, current_month: datetime.date) -> None: @pytest.mark.asyncio -async def test_wait_timeout(*, current_month: datetime.date) -> None: +async def test_wait_timeout(*, current_month: dt.date) -> None: """Waiting for a report which is not generated in time raises an error. """ @@ -241,7 +241,7 @@ async def test_month_not_accepted( @pytest.mark.asyncio async def test_database_id_does_not_match_keys( *, - current_month: datetime.date, + current_month: dt.date, ) -> None: """A database ID which does not match the given keys is rejected. @@ -284,7 +284,7 @@ async def test_download_error() -> None: @pytest.mark.asyncio -async def test_no_database_id(*, current_month: datetime.date) -> None: +async def test_no_database_id(*, current_month: dt.date) -> None: """A client which was given no database ID cannot request a report. """ diff --git a/tests/conftest.py b/tests/conftest.py index 119dbf98c..cb7a259b8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,7 +2,7 @@ from __future__ import annotations -import datetime +import datetime as dt import io from collections.abc import AsyncGenerator, Generator from contextlib import ExitStack @@ -197,9 +197,9 @@ def fixture_model_target_model() -> ModelTargetModel: @pytest.fixture(name="current_month") -def fixture_current_month() -> datetime.date: +def fixture_current_month() -> dt.date: """The current month, as the first day of that month.""" - now = datetime.datetime.now(tz=datetime.UTC) + now = dt.datetime.now(tz=dt.UTC) return now.date().replace(day=1) diff --git a/tests/test_query.py b/tests/test_query.py index a154cc425..9c6b93137 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -2,7 +2,7 @@ from __future__ import annotations -import datetime +import datetime as dt import json import secrets import uuid @@ -190,7 +190,7 @@ def test_default_timeout( response_delay_seconds=response_delay_seconds, sleep_fn=lambda seconds: ( frozen_datetime.tick( - delta=datetime.timedelta(seconds=seconds), + delta=dt.timedelta(seconds=seconds), ), None, )[1], @@ -248,7 +248,7 @@ def test_custom_timeout( response_delay_seconds=response_delay_seconds, sleep_fn=lambda seconds: ( frozen_datetime.tick( - delta=datetime.timedelta(seconds=seconds), + delta=dt.timedelta(seconds=seconds), ), None, )[1], diff --git a/tests/vws/test_configuration.py b/tests/vws/test_configuration.py index d9e4094fe..dcf282975 100644 --- a/tests/vws/test_configuration.py +++ b/tests/vws/test_configuration.py @@ -2,7 +2,7 @@ from __future__ import annotations -import datetime +import datetime as dt from typing import TYPE_CHECKING, BinaryIO, Literal import pytest @@ -45,7 +45,7 @@ def test_default_timeout( response_delay_seconds=response_delay_seconds, sleep_fn=lambda seconds: ( frozen_datetime.tick( - delta=datetime.timedelta(seconds=seconds), + delta=dt.timedelta(seconds=seconds), ), None, )[1], @@ -114,7 +114,7 @@ def test_custom_timeout( response_delay_seconds=response_delay_seconds, sleep_fn=lambda seconds: ( frozen_datetime.tick( - delta=datetime.timedelta(seconds=seconds), + delta=dt.timedelta(seconds=seconds), ), None, )[1], diff --git a/tests/vws/test_reports.py b/tests/vws/test_reports.py index 8f2ad0368..2f87588e0 100644 --- a/tests/vws/test_reports.py +++ b/tests/vws/test_reports.py @@ -3,7 +3,7 @@ from __future__ import annotations import calendar -import datetime +import datetime as dt import time import uuid from http import HTTPStatus @@ -103,7 +103,7 @@ def test_get_target_summary_report( status=TargetStatuses.SUCCESS, database_name=report.database_name, target_name=target_name, - upload_date=datetime.date(year=2018, month=4, day=25), + upload_date=dt.date(year=2018, month=4, day=25), active_flag=True, tracking_rating=report.tracking_rating, total_recos=0, @@ -167,14 +167,14 @@ def test_get_target(vws_client: VWS) -> None: def test_reco_counts_report( *, vws_client: VWS, - current_month: datetime.date, + current_month: dt.date, report_period: Literal["current", "previous"], ) -> None: """A report can be requested, waited for and downloaded.""" report_month = ( current_month if report_period == "current" - else current_month - datetime.timedelta(days=1) + else current_month - dt.timedelta(days=1) ) report_request = vws_client.request_database_reco_counts_report( year=report_month.year, @@ -192,7 +192,7 @@ def test_reco_counts_report( assert report.raw_csv.startswith(b"target_id,reco_count") -def test_not_ready(*, current_month: datetime.date) -> None: +def test_not_ready(*, current_month: dt.date) -> None: """Downloading a report before Vuforia has generated it raises an error. """ @@ -219,7 +219,7 @@ def test_not_ready(*, current_month: datetime.date) -> None: assert exc.value.response.status_code == HTTPStatus.NOT_FOUND -def test_wait_timeout(*, current_month: datetime.date) -> None: +def test_wait_timeout(*, current_month: dt.date) -> None: """Waiting for a report which is not generated in time raises an error. """ @@ -283,7 +283,7 @@ def test_month_not_accepted( def test_database_id_does_not_match_keys( *, - current_month: datetime.date, + current_month: dt.date, ) -> None: """A database ID which does not match the given keys is rejected. @@ -326,7 +326,7 @@ def test_download_error() -> None: assert exc.value.response.status_code == HTTPStatus.FORBIDDEN -def test_no_database_id(*, current_month: datetime.date) -> None: +def test_no_database_id(*, current_month: dt.date) -> None: """A client which was given no database ID cannot request a report. """