Skip to content

Commit 464b398

Browse files
committed
Add docformatter pre-commit
1 parent 7ba119c commit 464b398

File tree

15 files changed

+68
-61
lines changed

15 files changed

+68
-61
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ repos:
5959
files: spelling_private_dict\.txt$
6060
- id: trailing-whitespace
6161
- repo: https://github.com/pre-commit/pygrep-hooks
62-
rev: v1.10.0 # Use the ref you want to point at
62+
rev: v1.10.0
6363
hooks:
6464
- id: rst-directive-colons
6565
- id: rst-inline-touching-normal
@@ -84,6 +84,13 @@ repos:
8484
types_or: [yaml]
8585
additional_dependencies: ["uv"]
8686

87+
- id: docformatter
88+
name: docformatter
89+
entry: uv run --extra=dev -m docformatter
90+
language: python
91+
types_or: [python]
92+
additional_dependencies: ["uv"]
93+
8794
- id: shellcheck
8895
name: shellcheck
8996
entry: uv run --extra=dev shellcheck --shell=bash --exclude=SC1017

conftest.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
"""Setup for Sybil."""
1+
"""
2+
Setup for Sybil.
3+
"""
24

35
import io
46
import uuid
@@ -31,8 +33,8 @@ def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
3133
def fixture_make_image_file(
3234
high_quality_image: io.BytesIO,
3335
) -> Generator[None]:
34-
"""
35-
Make an image file available in the test directory.
36+
"""Make an image file available in the test directory.
37+
3638
The path of this file matches the path in the documentation.
3739
"""
3840
new_image = Path("high_quality_image.jpg")
@@ -46,8 +48,7 @@ def fixture_make_image_file(
4648
def fixture_mock_vws(
4749
monkeypatch: pytest.MonkeyPatch,
4850
) -> Generator[None]:
49-
"""
50-
Yield a mock VWS.
51+
"""Yield a mock VWS.
5152
5253
The keys used here match the keys in the documentation.
5354
"""

docs/source/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
"""Documentation."""
1+
"""
2+
Documentation.
3+
"""

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ optional-dependencies.dev = [
4444
"deptry==0.20.0",
4545
"doc8==1.1.2",
4646
"doccmd==2024.10.8.12",
47+
"docformatter==1.7.5",
4748
"freezegun==1.5.1",
4849
"furo==2024.8.6",
4950
"interrogate==1.7.0",
@@ -258,6 +259,9 @@ spelling-private-dict-file = 'spelling_private_dict.txt'
258259
# --spelling-private-dict-file option instead of raising a message.
259260
spelling-store-unknown-words = 'no'
260261

262+
[tool.docformatter]
263+
make-summary-multi-line = true
264+
261265
[tool.check-manifest]
262266

263267
ignore = [

src/vws/exceptions/base_exceptions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ def response(self) -> Response:
3232

3333
@beartype
3434
class VWSError(Exception):
35-
"""
36-
Base class for Vuforia Web Services errors.
35+
"""Base class for Vuforia Web Services errors.
3736
3837
These errors are defined at
3938
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#result-codes.

src/vws/exceptions/custom_exceptions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
@beartype
1313
class OopsAnErrorOccurredPossiblyBadNameError(Exception):
14-
"""
15-
Exception raised when VWS returns an HTML page which says "Oops, an error
16-
occurred".
14+
"""Exception raised when VWS returns an HTML page which says "Oops, an
15+
error occurred".
1716
18-
This has been seen to happen when the given name includes a bad character.
17+
This has been seen to happen when the given name includes a bad
18+
character.
1919
"""
2020

2121
def __init__(self, response: Response) -> None:

src/vws/exceptions/vws_exceptions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def target_id(self) -> str:
3333
@beartype
3434
class FailError(VWSError):
3535
"""
36-
Exception raised when Vuforia returns a response with a result code
37-
'Fail'.
36+
Exception raised when Vuforia returns a response with a result code 'Fail'.
3837
"""
3938

4039

src/vws/query.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434

3535
@beartype
3636
def _get_image_data(image: _ImageType) -> bytes:
37-
"""Get the data of an image file."""
37+
"""
38+
Get the data of an image file.
39+
"""
3840
original_tell = image.tell()
3941
image.seek(0)
4042
image_data = image.read()
@@ -72,8 +74,7 @@ def query(
7274
CloudRecoIncludeTargetData.TOP
7375
),
7476
) -> list[QueryResult]:
75-
"""
76-
Use the Vuforia Web Query API to make an Image Recognition Query.
77+
"""Use the Vuforia Web Query API to make an Image Recognition Query.
7778
7879
See
7980
https://developer.vuforia.com/library/web-api/vuforia-query-web-api

src/vws/reports.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
@beartype
1313
@dataclass(frozen=True)
1414
class DatabaseSummaryReport:
15-
"""
16-
A database summary report.
15+
"""A database summary report.
1716
1817
See
1918
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#summary-report.
@@ -49,8 +48,7 @@ class TargetStatuses(Enum):
4948
@beartype
5049
@dataclass(frozen=True)
5150
class TargetSummaryReport:
52-
"""
53-
A target summary report.
51+
"""A target summary report.
5452
5553
See
5654
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#summary-report.
@@ -70,8 +68,7 @@ class TargetSummaryReport:
7068
@beartype(conf=BeartypeConf(is_pep484_tower=True))
7169
@dataclass(frozen=True)
7270
class TargetRecord:
73-
"""
74-
A target record.
71+
"""A target record.
7572
7673
See
7774
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#target-record.
@@ -100,8 +97,7 @@ class TargetData:
10097
@beartype
10198
@dataclass(frozen=True)
10299
class QueryResult:
103-
"""
104-
One query match result.
100+
"""One query match result.
105101
106102
See
107103
https://developer.vuforia.com/library/web-api/vuforia-query-web-api.
@@ -114,8 +110,7 @@ class QueryResult:
114110
@beartype
115111
@dataclass(frozen=True)
116112
class TargetStatusAndRecord:
117-
"""
118-
The target status and a target record.
113+
"""The target status and a target record.
119114
120115
See
121116
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#target-record.

src/vws/types.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
"""Responses for requests to VWS and VWQ."""
1+
"""
2+
Responses for requests to VWS and VWQ.
3+
"""
24

35
from dataclasses import dataclass
46

0 commit comments

Comments
 (0)