From 235856347f8e614dbd4414f6d3e41cfefc568606 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Fri, 26 Dec 2025 14:24:52 +0000 Subject: [PATCH 1/3] Add pyrefly and pyrefly-docs configuration --- .pre-commit-config.yaml | 20 ++++++++++++++++++++ pyproject.toml | 1 + 2 files changed, 21 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 869dd167..90934191 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,6 +40,8 @@ ci: - vulture - vulture-docs - yamlfix + - pyrefly + - pyrefly-docs default_install_hook_types: [pre-commit, pre-push, commit-msg] @@ -376,3 +378,21 @@ repos: types_or: [rst] additional_dependencies: [uv==0.9.5] stages: [pre-commit] + + - id: pyrefly + name: pyrefly + stages: [pre-push] + entry: uv run --extra=dev pyrefly check + language: python + types_or: [python, toml] + pass_filenames: false + additional_dependencies: [uv==0.9.5] + + - id: pyrefly-docs + name: pyrefly-docs + stages: [pre-push] + entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python + --command="pyrefly check" + language: python + types_or: [markdown, rst] + additional_dependencies: [uv==0.9.5] diff --git a/pyproject.toml b/pyproject.toml index 53fa894f..62a8733d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,7 @@ optional-dependencies.dev = [ "pylint[spelling]==4.0.4", "pylint-per-file-ignores==3.2.0", "pyproject-fmt==2.11.1", + "pyrefly==0.46.1", "pyright==1.1.407", "pyroma==5.0.1", "pytest==9.0.2", From 47c76bda6095117739fb2eef4277c22f4b4828b8 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Fri, 26 Dec 2025 15:17:08 +0000 Subject: [PATCH 2/3] Fix pyrefly --- src/vws/vws.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/vws/vws.py b/src/vws/vws.py index 5dd7503d..bb05233c 100644 --- a/src/vws/vws.py +++ b/src/vws/vws.py @@ -352,10 +352,10 @@ def get_target_record(self, target_id: str) -> TargetStatusAndRecord: target_record_dict = dict(result_data["target_record"]) target_record = TargetRecord( target_id=target_record_dict["target_id"], - active_flag=target_record_dict["active_flag"], + active_flag=bool(target_record_dict["active_flag"]), name=target_record_dict["name"], - width=target_record_dict["width"], - tracking_rating=target_record_dict["tracking_rating"], + width=float(target_record_dict["width"]), + tracking_rating=int(target_record_dict["tracking_rating"]), reco_rating=target_record_dict["reco_rating"], ) return TargetStatusAndRecord( @@ -485,11 +485,11 @@ def get_target_summary_report(self, target_id: str) -> TargetSummaryReport: database_name=result_data["database_name"], target_name=result_data["target_name"], upload_date=date.fromisoformat(result_data["upload_date"]), - active_flag=result_data["active_flag"], - tracking_rating=result_data["tracking_rating"], - total_recos=result_data["total_recos"], - current_month_recos=result_data["current_month_recos"], - previous_month_recos=result_data["previous_month_recos"], + active_flag=bool(result_data["active_flag"]), + tracking_rating=int(result_data["tracking_rating"]), + total_recos=int(result_data["total_recos"]), + current_month_recos=int(result_data["current_month_recos"]), + previous_month_recos=int(result_data["previous_month_recos"]), ) def get_database_summary_report(self) -> DatabaseSummaryReport: @@ -524,18 +524,18 @@ def get_database_summary_report(self) -> DatabaseSummaryReport: response_data = dict(json.loads(s=response.text)) return DatabaseSummaryReport( - active_images=response_data["active_images"], - current_month_recos=response_data["current_month_recos"], - failed_images=response_data["failed_images"], - inactive_images=response_data["inactive_images"], - name=response_data["name"], - previous_month_recos=response_data["previous_month_recos"], - processing_images=response_data["processing_images"], - reco_threshold=response_data["reco_threshold"], - request_quota=response_data["request_quota"], - request_usage=response_data["request_usage"], - target_quota=response_data["target_quota"], - total_recos=response_data["total_recos"], + active_images=int(response_data["active_images"]), + current_month_recos=int(response_data["current_month_recos"]), + failed_images=int(response_data["failed_images"]), + inactive_images=int(response_data["inactive_images"]), + name=str(response_data["name"]), + previous_month_recos=int(response_data["previous_month_recos"]), + processing_images=int(response_data["processing_images"]), + reco_threshold=int(response_data["reco_threshold"]), + request_quota=int(response_data["request_quota"]), + request_usage=int(response_data["request_usage"]), + target_quota=int(response_data["target_quota"]), + total_recos=int(response_data["total_recos"]), ) def delete_target(self, target_id: str) -> None: From 495f0048c6d5e923f001d43b729a79fca5937b37 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Fri, 26 Dec 2025 15:21:38 +0000 Subject: [PATCH 3/3] Fix mypy --- src/vws/vws.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vws/vws.py b/src/vws/vws.py index bb05233c..8def19ed 100644 --- a/src/vws/vws.py +++ b/src/vws/vws.py @@ -528,7 +528,7 @@ def get_database_summary_report(self) -> DatabaseSummaryReport: current_month_recos=int(response_data["current_month_recos"]), failed_images=int(response_data["failed_images"]), inactive_images=int(response_data["inactive_images"]), - name=str(response_data["name"]), + name=str(object=response_data["name"]), previous_month_recos=int(response_data["previous_month_recos"]), processing_images=int(response_data["processing_images"]), reco_threshold=int(response_data["reco_threshold"]),