Skip to content

Commit daa89a2

Browse files
Merge pull request #2768 from VWS-Python/add-pyrefly
Add pyrefly and pyrefly-docs configuration
2 parents 0285925 + 495f004 commit daa89a2

File tree

3 files changed

+41
-20
lines changed

3 files changed

+41
-20
lines changed

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ ci:
4040
- vulture
4141
- vulture-docs
4242
- yamlfix
43+
- pyrefly
44+
- pyrefly-docs
4345

4446
default_install_hook_types: [pre-commit, pre-push, commit-msg]
4547

@@ -376,3 +378,21 @@ repos:
376378
types_or: [rst]
377379
additional_dependencies: [uv==0.9.5]
378380
stages: [pre-commit]
381+
382+
- id: pyrefly
383+
name: pyrefly
384+
stages: [pre-push]
385+
entry: uv run --extra=dev pyrefly check
386+
language: python
387+
types_or: [python, toml]
388+
pass_filenames: false
389+
additional_dependencies: [uv==0.9.5]
390+
391+
- id: pyrefly-docs
392+
name: pyrefly-docs
393+
stages: [pre-push]
394+
entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
395+
--command="pyrefly check"
396+
language: python
397+
types_or: [markdown, rst]
398+
additional_dependencies: [uv==0.9.5]

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ optional-dependencies.dev = [
5454
"pylint[spelling]==4.0.4",
5555
"pylint-per-file-ignores==3.2.0",
5656
"pyproject-fmt==2.11.1",
57+
"pyrefly==0.46.1",
5758
"pyright==1.1.407",
5859
"pyroma==5.0.1",
5960
"pytest==9.0.2",

src/vws/vws.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ def get_target_record(self, target_id: str) -> TargetStatusAndRecord:
352352
target_record_dict = dict(result_data["target_record"])
353353
target_record = TargetRecord(
354354
target_id=target_record_dict["target_id"],
355-
active_flag=target_record_dict["active_flag"],
355+
active_flag=bool(target_record_dict["active_flag"]),
356356
name=target_record_dict["name"],
357-
width=target_record_dict["width"],
358-
tracking_rating=target_record_dict["tracking_rating"],
357+
width=float(target_record_dict["width"]),
358+
tracking_rating=int(target_record_dict["tracking_rating"]),
359359
reco_rating=target_record_dict["reco_rating"],
360360
)
361361
return TargetStatusAndRecord(
@@ -485,11 +485,11 @@ def get_target_summary_report(self, target_id: str) -> TargetSummaryReport:
485485
database_name=result_data["database_name"],
486486
target_name=result_data["target_name"],
487487
upload_date=date.fromisoformat(result_data["upload_date"]),
488-
active_flag=result_data["active_flag"],
489-
tracking_rating=result_data["tracking_rating"],
490-
total_recos=result_data["total_recos"],
491-
current_month_recos=result_data["current_month_recos"],
492-
previous_month_recos=result_data["previous_month_recos"],
488+
active_flag=bool(result_data["active_flag"]),
489+
tracking_rating=int(result_data["tracking_rating"]),
490+
total_recos=int(result_data["total_recos"]),
491+
current_month_recos=int(result_data["current_month_recos"]),
492+
previous_month_recos=int(result_data["previous_month_recos"]),
493493
)
494494

495495
def get_database_summary_report(self) -> DatabaseSummaryReport:
@@ -524,18 +524,18 @@ def get_database_summary_report(self) -> DatabaseSummaryReport:
524524

525525
response_data = dict(json.loads(s=response.text))
526526
return DatabaseSummaryReport(
527-
active_images=response_data["active_images"],
528-
current_month_recos=response_data["current_month_recos"],
529-
failed_images=response_data["failed_images"],
530-
inactive_images=response_data["inactive_images"],
531-
name=response_data["name"],
532-
previous_month_recos=response_data["previous_month_recos"],
533-
processing_images=response_data["processing_images"],
534-
reco_threshold=response_data["reco_threshold"],
535-
request_quota=response_data["request_quota"],
536-
request_usage=response_data["request_usage"],
537-
target_quota=response_data["target_quota"],
538-
total_recos=response_data["total_recos"],
527+
active_images=int(response_data["active_images"]),
528+
current_month_recos=int(response_data["current_month_recos"]),
529+
failed_images=int(response_data["failed_images"]),
530+
inactive_images=int(response_data["inactive_images"]),
531+
name=str(object=response_data["name"]),
532+
previous_month_recos=int(response_data["previous_month_recos"]),
533+
processing_images=int(response_data["processing_images"]),
534+
reco_threshold=int(response_data["reco_threshold"]),
535+
request_quota=int(response_data["request_quota"]),
536+
request_usage=int(response_data["request_usage"]),
537+
target_quota=int(response_data["target_quota"]),
538+
total_recos=int(response_data["total_recos"]),
539539
)
540540

541541
def delete_target(self, target_id: str) -> None:

0 commit comments

Comments
 (0)