Skip to content

Commit ef09525

Browse files
committed
Replace docformatter with pydocstringformatter
- Replace docformatter==1.7.7 with pydocstringformatter==0.7.3 - Replace [tool.docformatter] with [tool.pydocstringformatter] config - Update ruff ignore comments (D200 -> D205/D212) - Don't use linewrap-full-docstring to avoid breaking URLs (DanielNoord/pydocstringformatter#540)
1 parent f7e2a60 commit ef09525

File tree

81 files changed

+710
-1193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+710
-1193
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ci:
2929
- ruff-check-fix-docs
3030
- ruff-format-fix
3131
- ruff-format-fix-docs
32-
- docformatter
32+
- pydocstringformatter
3333
- shellcheck
3434
- shellcheck-docs
3535
- shfmt
@@ -119,9 +119,9 @@ repos:
119119
additional_dependencies: [uv==0.9.5]
120120
stages: [pre-commit]
121121

122-
- id: docformatter
123-
name: docformatter
124-
entry: uv run --extra=dev -m docformatter --in-place
122+
- id: pydocstringformatter
123+
name: pydocstringformatter
124+
entry: uv run --extra=dev pydocstringformatter
125125
language: python
126126
types_or: [python]
127127
additional_dependencies: [uv==0.9.5]

pyproject.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ optional-dependencies.dev = [
5757
"dirty-equals==0.11",
5858
"doc8==1.1.1",
5959
"doccmd==2026.1.25",
60-
"docformatter==1.7.7",
6160
"docker==7.1.0",
6261
"enum-tools[sphinx]==0.13.0",
6362
"freezegun==1.5.5",
@@ -66,6 +65,7 @@ optional-dependencies.dev = [
6665
"mypy[faster-cache]==1.19.1",
6766
"mypy-strict-kwargs==2026.1.12",
6867
"prek==0.3.0",
68+
"pydocstringformatter==0.7.3",
6969
"pydocstyle==6.3",
7070
"pylint[spelling]==4.0.4",
7171
"pylint-per-file-ignores==3.2.0",
@@ -152,8 +152,8 @@ lint.select = [
152152
lint.ignore = [
153153
# Ruff warns that this conflicts with the formatter.
154154
"COM812",
155-
# Allow our chosen docstring line-style - no one-line summary.
156-
"D200",
155+
# Allow our chosen docstring line-style - pydocstringformatter handles formatting
156+
# but doesn't enforce D205 (blank line after summary) or D212 (summary on first line).
157157
"D205",
158158
"D212",
159159
"D415",
@@ -298,9 +298,6 @@ spelling-private-dict-file = 'spelling_private_dict.txt'
298298
# --spelling-private-dict-file option instead of raising a message.
299299
spelling-store-unknown-words = 'no'
300300

301-
[tool.docformatter]
302-
make-summary-multi-line = true
303-
304301
[tool.check-manifest]
305302

306303
ignore = [
@@ -403,6 +400,12 @@ enableTypeIgnoreComments = false
403400
reportUnnecessaryTypeIgnoreComment = true
404401
typeCheckingMode = "strict"
405402

403+
[tool.pydocstringformatter]
404+
write = true
405+
split-summary-body = false
406+
max-line-length = 75
407+
linewrap-full-docstring = true
408+
406409
[tool.interrogate]
407410
fail-under = 100
408411
omit-covered-files = true

src/mock_vws/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Tools for using a fake implementation of Vuforia.
3-
"""
1+
"""Tools for using a fake implementation of Vuforia."""
42

53
from mock_vws._requests_mock_server.decorators import (
64
MissingSchemeError,

src/mock_vws/_base64_decoding.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Helpers for handling Base64 like Vuforia does.
3-
"""
1+
"""Helpers for handling Base64 like Vuforia does."""
42

53
import base64
64
import binascii

src/mock_vws/_constants.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Constants used to make the VWS mock.
3-
"""
1+
"""Constants used to make the VWS mock."""
42

53
from enum import Enum, unique
64

src/mock_vws/_database_matchers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Helpers for getting databases which match keys given in requests.
3-
"""
1+
"""Helpers for getting databases which match keys given in requests."""
42

53
from collections.abc import Iterable, Mapping
64

@@ -19,7 +17,8 @@ def get_database_matching_client_keys(
1917
request_path: str,
2018
databases: Iterable[VuforiaDatabase],
2119
) -> VuforiaDatabase:
22-
"""Return the first of the given databases which is being accessed by the
20+
"""Return the first of the given databases which is being accessed by
21+
the
2322
given client request.
2423
2524
Args:
@@ -67,7 +66,8 @@ def get_database_matching_server_keys(
6766
request_path: str,
6867
databases: Iterable[VuforiaDatabase],
6968
) -> VuforiaDatabase:
70-
"""Return the first of the given databases which is being accessed by the
69+
"""Return the first of the given databases which is being accessed by
70+
the
7171
given server request.
7272
7373
Args:
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
"""
2-
Flask server for the mock Vuforia web service.
3-
"""
1+
"""Flask server for the mock Vuforia web service."""

src/mock_vws/_flask_server/healthcheck.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Health check for the Flask server.
3-
"""
1+
"""Health check for the Flask server."""
42

53
import http.client
64
import socket
@@ -12,9 +10,7 @@
1210

1311
@beartype
1412
def flask_app_healthy(port: int) -> bool:
15-
"""
16-
Check if the Flask app is healthy.
17-
"""
13+
"""Check if the Flask app is healthy."""
1814
conn = http.client.HTTPConnection(host="localhost", port=port)
1915
try:
2016
conn.request(method="GET", url="/some-random-endpoint")

src/mock_vws/_flask_server/target_manager.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Storage layer for the mock Vuforia Flask application.
3-
"""
1+
"""Storage layer for the mock Vuforia Flask application."""
42

53
import base64
64
import copy
@@ -32,18 +30,14 @@
3230

3331
@beartype
3432
class _TargetRaterChoice(StrEnum):
35-
"""
36-
Target rater choices.
37-
"""
33+
"""Target rater choices."""
3834

3935
BRISQUE = auto()
4036
PERFECT = auto()
4137
RANDOM = auto()
4238

4339
def to_target_rater(self) -> TargetTrackingRater:
44-
"""
45-
Get the target rater.
46-
"""
40+
"""Get the target rater."""
4741
match self:
4842
case self.BRISQUE:
4943
return BrisqueTargetTrackingRater()
@@ -57,9 +51,7 @@ def to_target_rater(self) -> TargetTrackingRater:
5751

5852
@beartype
5953
class TargetManagerSettings(BaseSettings):
60-
"""
61-
Settings for the Target Manager Flask app.
62-
"""
54+
"""Settings for the Target Manager Flask app."""
6355

6456
target_manager_host: str = ""
6557
target_rater: _TargetRaterChoice = _TargetRaterChoice.BRISQUE
@@ -91,9 +83,7 @@ def delete_database(database_name: str) -> Response:
9183
@TARGET_MANAGER_FLASK_APP.route(rule="/databases", methods=[HTTPMethod.GET])
9284
@beartype
9385
def get_databases() -> Response:
94-
"""
95-
Return a list of all databases.
96-
"""
86+
"""Return a list of all databases."""
9787
databases = [database.to_dict() for database in TARGET_MANAGER.databases]
9888
return Response(
9989
response=json.dumps(obj=databases),
@@ -200,9 +190,7 @@ def create_database() -> Response:
200190
)
201191
@beartype
202192
def create_target(database_name: str) -> Response:
203-
"""
204-
Create a new target in a given database.
205-
"""
193+
"""Create a new target in a given database."""
206194
(database,) = (
207195
database
208196
for database in TARGET_MANAGER.databases
@@ -238,9 +226,7 @@ def create_target(database_name: str) -> Response:
238226
)
239227
@beartype
240228
def delete_target(database_name: str, target_id: str) -> Response:
241-
"""
242-
Delete a target.
243-
"""
229+
"""Delete a target."""
244230
(database,) = (
245231
database
246232
for database in TARGET_MANAGER.databases
@@ -266,9 +252,7 @@ def delete_target(database_name: str, target_id: str) -> Response:
266252
methods=[HTTPMethod.PUT],
267253
)
268254
def update_target(database_name: str, target_id: str) -> Response:
269-
"""
270-
Update a target.
271-
"""
255+
"""Update a target."""
272256
(database,) = (
273257
database
274258
for database in TARGET_MANAGER.databases

src/mock_vws/_flask_server/vwq.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,13 @@
3333

3434
@beartype
3535
class _ImageMatcherChoice(StrEnum):
36-
"""
37-
Image matcher choices.
38-
"""
36+
"""Image matcher choices."""
3937

4038
EXACT = auto()
4139
STRUCTURAL_SIMILARITY = auto()
4240

4341
def to_image_matcher(self) -> ImageMatcher:
44-
"""
45-
Get the image matcher.
46-
"""
42+
"""Get the image matcher."""
4743
match self:
4844
case self.EXACT:
4945
return ExactMatcher()
@@ -55,9 +51,7 @@ def to_image_matcher(self) -> ImageMatcher:
5551

5652
@beartype
5753
class VWQSettings(BaseSettings):
58-
"""
59-
Settings for the VWQ Flask app.
60-
"""
54+
"""Settings for the VWQ Flask app."""
6155

6256
vwq_host: str = ""
6357
target_manager_base_url: str
@@ -68,9 +62,7 @@ class VWQSettings(BaseSettings):
6862

6963
@beartype
7064
def get_all_databases() -> set[VuforiaDatabase]:
71-
"""
72-
Get all database objects from the target manager back-end.
73-
"""
65+
"""Get all database objects from the target manager back-end."""
7466
settings = VWQSettings.model_validate(obj={})
7567
response = requests.get(
7668
url=f"{settings.target_manager_base_url}/databases",
@@ -111,9 +103,7 @@ def set_terminate_wsgi_input() -> None:
111103

112104
@CLOUDRECO_FLASK_APP.errorhandler(code_or_exception=ValidatorError)
113105
def handle_exceptions(exc: ValidatorError) -> Response:
114-
"""
115-
Return the error response associated with the given exception.
116-
"""
106+
"""Return the error response associated with the given exception."""
117107
response = Response(
118108
status=exc.status_code.value,
119109
response=exc.response_text,
@@ -127,9 +117,7 @@ def handle_exceptions(exc: ValidatorError) -> Response:
127117

128118
@CLOUDRECO_FLASK_APP.route(rule="/v1/query", methods=[HTTPMethod.POST])
129119
def query() -> Response:
130-
"""
131-
Perform an image recognition query.
132-
"""
120+
"""Perform an image recognition query."""
133121
settings = VWQSettings.model_validate(obj={})
134122
query_match_checker = settings.query_image_matcher.to_image_matcher()
135123

0 commit comments

Comments
 (0)