From 8c3a9f78c417ce56d42816e6c7f45dad2363b1a5 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Wed, 5 Aug 2026 18:18:37 +0100 Subject: [PATCH 1/4] Add no-defaults linting --- .pre-commit-config.yaml | 6 +++++ pyproject.toml | 5 ++++ .../request_rate_validators.py | 2 +- src/mock_vws/decorators.py | 26 +++++++++---------- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 443cad330..20d3b01c6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -427,3 +427,9 @@ repos: types: [hcl] additional_dependencies: [github.com/hashicorp/hcl/v2/cmd/hclfmt@v2.24.0] stages: [pre-commit] + + - repo: https://github.com/adamtheturtle/no-defaults + rev: v1.0.0 + hooks: + - id: no-defaults + stages: [pre-commit] diff --git a/pyproject.toml b/pyproject.toml index 9fca132ed..8f3f27b14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -194,6 +194,7 @@ lint.per-file-ignores."tests/**" = [ lint.unfixable = [ "ERA001", ] +lint.external = [ "NOD" ] lint.flake8-tidy-imports.banned-api."typing.cast".msg = "typing.cast is banned: use explicit type narrowing or a typed variable instead." lint.pydocstyle.convention = "google" @@ -525,3 +526,7 @@ ignore_path = [ [tool.yamlfix] section_whitelines = 1 whitelines = 1 + +[tool.no_defaults] +private_only = true +per_file_enforcement."tests/**" = "all" diff --git a/src/mock_vws/_services_validators/request_rate_validators.py b/src/mock_vws/_services_validators/request_rate_validators.py index ffa86297e..c243039fc 100644 --- a/src/mock_vws/_services_validators/request_rate_validators.py +++ b/src/mock_vws/_services_validators/request_rate_validators.py @@ -25,7 +25,7 @@ class RequestRateLimiter: def __init__( self, *, - time_function: Callable[[], float] = time.monotonic, + time_function: Callable[[], float] = time.monotonic, # noqa: NOD001 ) -> None: """Initialize an empty rate limiter.""" self._request_times: dict[str, deque[float]] = {} diff --git a/src/mock_vws/decorators.py b/src/mock_vws/decorators.py index e4a82d0b6..e64c72165 100644 --- a/src/mock_vws/decorators.py +++ b/src/mock_vws/decorators.py @@ -58,23 +58,23 @@ class MockVWS(ContextDecorator): def __init__( self, *, - base_vws_url: str = "https://vws.vuforia.com", - base_vwq_url: str = "https://cloudreco.vuforia.com", - cloud_query_failure_response: CloudQueryFailureResponse | None = None, - duplicate_match_checker: ImageMatcher = _STRUCTURAL_SIMILARITY_MATCHER, - query_match_checker: ImageMatcher = _STRUCTURAL_SIMILARITY_MATCHER, - processing_time_seconds: float = 2.0, + base_vws_url: str = "https://vws.vuforia.com", # noqa: NOD001 + base_vwq_url: str = "https://cloudreco.vuforia.com", # noqa: NOD001 + cloud_query_failure_response: CloudQueryFailureResponse | None = None, # noqa: NOD001 + duplicate_match_checker: ImageMatcher = _STRUCTURAL_SIMILARITY_MATCHER, # noqa: NOD001 + query_match_checker: ImageMatcher = _STRUCTURAL_SIMILARITY_MATCHER, # noqa: NOD001 + processing_time_seconds: float = 2.0, # noqa: NOD001 model_target_generation_failure: ( ModelTargetGenerationFailure | None - ) = None, + ) = None, # noqa: NOD001 model_target_generation_warning: ( ModelTargetGenerationWarning | None - ) = None, - target_tracking_rater: TargetTrackingRater = _BRISQUE_TRACKING_RATER, - real_http: bool = False, - response_delay_seconds: float = 0.0, - sleep_fn: Callable[[float], None] = time.sleep, - vumark_generation_failure: VuMarkGenerationFailure | None = None, + ) = None, # noqa: NOD001 + target_tracking_rater: TargetTrackingRater = _BRISQUE_TRACKING_RATER, # noqa: NOD001 + real_http: bool = False, # noqa: NOD001 + response_delay_seconds: float = 0.0, # noqa: NOD001 + sleep_fn: Callable[[float], None] = time.sleep, # noqa: NOD001 + vumark_generation_failure: VuMarkGenerationFailure | None = None, # noqa: NOD001 ) -> None: """Route requests to Vuforia's Web Service APIs to fakes of those APIs. From b4b0e9ca99dc561a888d1b46aa71ee5ac8f5a46f Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Wed, 5 Aug 2026 18:38:47 +0100 Subject: [PATCH 2/4] Retry pre-commit.ci From 97ac8aaebc70104420e26ab50c8577387363351a Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Wed, 5 Aug 2026 23:14:40 +0100 Subject: [PATCH 3/4] Bump no-defaults to v1.0.1 Picks up the fix for annotated locals in dataclass methods being misreported as fields (adamtheturtle/no-defaults#6). Co-Authored-By: Claude Opus 5 (1M context) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20d3b01c6..9df66a2f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -429,7 +429,7 @@ repos: stages: [pre-commit] - repo: https://github.com/adamtheturtle/no-defaults - rev: v1.0.0 + rev: v1.0.1 hooks: - id: no-defaults stages: [pre-commit] From ece7cd74bc5f1c00b3ef37f6f0243837f5a3352e Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Thu, 6 Aug 2026 05:31:41 +0100 Subject: [PATCH 4/4] Run no-defaults as a local uv hook Run no-defaults as a local uv hook instead of the upstream pre-commit hook, matching the other locally-defined hooks. The pin moves to the dev extra in pyproject.toml, and the hook joins the pre-commit.ci skip list alongside the other hooks that need project dependencies. Co-Authored-By: Claude Opus 5 (1M context) --- .pre-commit-config.yaml | 16 ++++++++++------ pyproject.toml | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9df66a2f0..06a49c640 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -307,6 +307,16 @@ repos: stages: [pre-commit] require_serial: true + - id: no-defaults + name: no-defaults + entry: uv run --extra=dev no-defaults + language: python + types_or: [python] + additional_dependencies: + - *uv_version + stages: [pre-commit] + require_serial: true + - id: doc8 name: doc8 entry: uv run --extra=dev -m doc8 @@ -427,9 +437,3 @@ repos: types: [hcl] additional_dependencies: [github.com/hashicorp/hcl/v2/cmd/hclfmt@v2.24.0] stages: [pre-commit] - - - repo: https://github.com/adamtheturtle/no-defaults - rev: v1.0.1 - hooks: - - id: no-defaults - stages: [pre-commit] diff --git a/pyproject.toml b/pyproject.toml index 8f3f27b14..72494639c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,6 +64,7 @@ optional-dependencies.dev = [ "interrogate==1.7.0", "mypy[faster-cache]==2.3.0", "mypy-strict-kwargs==2026.7.19.1", + "no-defaults==1.0.1", "prek==0.4.11", "pydocstringformatter==1.0.0", "pydocstyle==6.3",