Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ci:
- ruff-check-fix-docs
- ruff-format-fix
- ruff-format-fix-docs
- docformatter
- pydocstringformatter
- shellcheck
- shellcheck-docs
- shfmt
Expand Down Expand Up @@ -119,9 +119,9 @@ repos:
additional_dependencies: [uv==0.9.5]
stages: [pre-commit]

- id: docformatter
name: docformatter
entry: uv run --extra=dev -m docformatter --in-place
- id: pydocstringformatter
name: pydocstringformatter
entry: uv run --extra=dev pydocstringformatter
language: python
types_or: [python]
additional_dependencies: [uv==0.9.5]
Expand Down
4 changes: 1 addition & 3 deletions admin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
"""
Admin tools.
"""
"""Admin tools."""
4 changes: 1 addition & 3 deletions admin/create_secrets_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@


def main() -> None:
"""
Create secrets files.
"""
"""Create secrets files."""
email_address = os.environ["VWS_EMAIL_ADDRESS"]
password = os.environ["VWS_PASSWORD"]
new_secrets_dir = Path(os.environ["NEW_SECRETS_DIR"]).expanduser()
Expand Down
4 changes: 1 addition & 3 deletions ci/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
"""
CI helpers.
"""
"""CI helpers."""
15 changes: 5 additions & 10 deletions ci/test_custom_linters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Custom lint tests.
"""
"""Custom lint tests."""

from pathlib import Path
from typing import TYPE_CHECKING
Expand All @@ -15,9 +13,7 @@

@beartype
def _ci_patterns(*, repository_root: Path) -> set[str]:
"""
Return the CI patterns given in the CI configuration file.
"""
"""Return the CI patterns given in the CI configuration file."""
ci_file = repository_root / ".github" / "workflows" / "test.yml"
github_workflow_config = yaml.safe_load(stream=ci_file.read_text())
matrix = github_workflow_config["jobs"]["ci-tests"]["strategy"]["matrix"]
Expand All @@ -33,9 +29,7 @@ def _tests_from_pattern(
ci_pattern: str,
capsys: pytest.CaptureFixture[str],
) -> set[str]:
"""
From a CI pattern, get all tests ``pytest`` would collect.
"""
"""From a CI pattern, get all tests ``pytest`` would collect."""
# Clear the captured output.
capsys.readouterr()
tests: Iterable[str] = set()
Expand All @@ -59,7 +53,8 @@ def _tests_from_pattern(

def test_ci_patterns_valid(request: pytest.FixtureRequest) -> None:
"""
All of the CI patterns in the CI configuration match at least one test in
All of the CI patterns in the CI configuration match at least one
test in
the test suite.
"""
ci_patterns = _ci_patterns(repository_root=request.config.rootpath)
Expand Down
8 changes: 2 additions & 6 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Setup for Sybil.
"""
"""Setup for Sybil."""

from doctest import ELLIPSIS

Expand All @@ -17,9 +15,7 @@

@beartype
def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
"""
Apply the beartype decorator to all collected test functions.
"""
"""Apply the beartype decorator to all collected test functions."""
for item in items:
if isinstance(item, pytest.Function):
item.obj = beartype(obj=item.obj)
Expand Down
4 changes: 1 addition & 3 deletions docs/source/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
"""
Documentation.
"""
"""Documentation."""
4 changes: 1 addition & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python3
"""
Configuration for Sphinx.
"""
"""Configuration for Sphinx."""

import importlib.metadata
from pathlib import Path
Expand Down
23 changes: 17 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ optional-dependencies.dev = [
"dirty-equals==0.11",
"doc8==1.1.1",
"doccmd==2026.1.25",
"docformatter==1.7.7",
"docker==7.1.0",
"enum-tools[sphinx]==0.13.0",
"freezegun==1.5.5",
Expand All @@ -66,6 +65,7 @@ optional-dependencies.dev = [
"mypy[faster-cache]==1.19.1",
"mypy-strict-kwargs==2026.1.12",
"prek==0.3.0",
"pydocstringformatter==0.7.3",
"pydocstyle==6.3",
"pylint[spelling]==4.0.4",
"pylint-per-file-ignores==3.2.0",
Expand Down Expand Up @@ -152,8 +152,8 @@ lint.select = [
lint.ignore = [
# Ruff warns that this conflicts with the formatter.
"COM812",
# Allow our chosen docstring line-style - no one-line summary.
"D200",
# Allow our chosen docstring line-style - pydocstringformatter handles formatting
# but doesn't enforce D205 (blank line after summary) or D212 (summary on first line).
"D205",
"D212",
"D415",
Expand All @@ -169,6 +169,14 @@ lint.per-file-ignores."ci/test_custom_linters.py" = [
"S101",
]

lint.per-file-ignores."doccmd_*.py" = [
# Allow our chosen docstring line-style - pydocstringformatter handles
# formatting but docstrings in docs may not match this style.
"D200",
# Allow asserts in docs.
"S101",
]

lint.per-file-ignores."tests/**" = [
# Allow asserts in tests.
"S101",
Expand Down Expand Up @@ -298,9 +306,6 @@ spelling-private-dict-file = 'spelling_private_dict.txt'
# --spelling-private-dict-file option instead of raising a message.
spelling-store-unknown-words = 'no'

[tool.docformatter]
make-summary-multi-line = true

[tool.check-manifest]

ignore = [
Expand Down Expand Up @@ -403,6 +408,12 @@ enableTypeIgnoreComments = false
reportUnnecessaryTypeIgnoreComment = true
typeCheckingMode = "strict"

[tool.pydocstringformatter]
write = true
split-summary-body = false
max-line-length = 75
linewrap-full-docstring = true

[tool.interrogate]
fail-under = 100
omit-covered-files = true
Expand Down
4 changes: 1 addition & 3 deletions src/mock_vws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Tools for using a fake implementation of Vuforia.
"""
"""Tools for using a fake implementation of Vuforia."""

from mock_vws._requests_mock_server.decorators import (
MissingSchemeError,
Expand Down
4 changes: 1 addition & 3 deletions src/mock_vws/_base64_decoding.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Helpers for handling Base64 like Vuforia does.
"""
"""Helpers for handling Base64 like Vuforia does."""

import base64
import binascii
Expand Down
4 changes: 1 addition & 3 deletions src/mock_vws/_constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Constants used to make the VWS mock.
"""
"""Constants used to make the VWS mock."""

from enum import Enum, unique

Expand Down
10 changes: 5 additions & 5 deletions src/mock_vws/_database_matchers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Helpers for getting databases which match keys given in requests.
"""
"""Helpers for getting databases which match keys given in requests."""

from collections.abc import Iterable, Mapping

Expand All @@ -19,7 +17,8 @@ def get_database_matching_client_keys(
request_path: str,
databases: Iterable[VuforiaDatabase],
) -> VuforiaDatabase:
"""Return the first of the given databases which is being accessed by the
"""Return the first of the given databases which is being accessed by
the
given client request.

Args:
Expand Down Expand Up @@ -67,7 +66,8 @@ def get_database_matching_server_keys(
request_path: str,
databases: Iterable[VuforiaDatabase],
) -> VuforiaDatabase:
"""Return the first of the given databases which is being accessed by the
"""Return the first of the given databases which is being accessed by
the
given server request.

Args:
Expand Down
4 changes: 1 addition & 3 deletions src/mock_vws/_flask_server/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
"""
Flask server for the mock Vuforia web service.
"""
"""Flask server for the mock Vuforia web service."""
8 changes: 2 additions & 6 deletions src/mock_vws/_flask_server/healthcheck.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Health check for the Flask server.
"""
"""Health check for the Flask server."""

import http.client
import socket
Expand All @@ -12,9 +10,7 @@

@beartype
def flask_app_healthy(port: int) -> bool:
"""
Check if the Flask app is healthy.
"""
"""Check if the Flask app is healthy."""
conn = http.client.HTTPConnection(host="localhost", port=port)
try:
conn.request(method="GET", url="/some-random-endpoint")
Expand Down
32 changes: 8 additions & 24 deletions src/mock_vws/_flask_server/target_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Storage layer for the mock Vuforia Flask application.
"""
"""Storage layer for the mock Vuforia Flask application."""

import base64
import copy
Expand Down Expand Up @@ -32,19 +30,15 @@

@beartype
class _TargetRaterChoice(StrEnum):
"""
Target rater choices.
"""
"""Target rater choices."""

BRISQUE = auto()
PERFECT = auto()
RANDOM = auto()

def to_target_rater(self) -> TargetTrackingRater:
"""
Get the target rater.
"""
"""Get the target rater."""
match self:

Check warning on line 41 in src/mock_vws/_flask_server/target_manager.py

View workflow job for this annotation

GitHub Actions / build (3.13, ubuntu-latest)

Pyrefly non-exhaustive-match

Match on `Self@_TargetRaterChoice` is not exhaustive

Check warning on line 41 in src/mock_vws/_flask_server/target_manager.py

View workflow job for this annotation

GitHub Actions / build (3.13, windows-latest)

Pyrefly non-exhaustive-match

Match on `Self@_TargetRaterChoice` is not exhaustive
case self.BRISQUE:
return BrisqueTargetTrackingRater()
case self.PERFECT:
Expand All @@ -57,9 +51,7 @@

@beartype
class TargetManagerSettings(BaseSettings):
"""
Settings for the Target Manager Flask app.
"""
"""Settings for the Target Manager Flask app."""

target_manager_host: str = ""
target_rater: _TargetRaterChoice = _TargetRaterChoice.BRISQUE
Expand Down Expand Up @@ -91,9 +83,7 @@
@TARGET_MANAGER_FLASK_APP.route(rule="/databases", methods=[HTTPMethod.GET])
@beartype
def get_databases() -> Response:
"""
Return a list of all databases.
"""
"""Return a list of all databases."""
databases = [database.to_dict() for database in TARGET_MANAGER.databases]
return Response(
response=json.dumps(obj=databases),
Expand Down Expand Up @@ -200,9 +190,7 @@
)
@beartype
def create_target(database_name: str) -> Response:
"""
Create a new target in a given database.
"""
"""Create a new target in a given database."""
(database,) = (
database
for database in TARGET_MANAGER.databases
Expand Down Expand Up @@ -238,9 +226,7 @@
)
@beartype
def delete_target(database_name: str, target_id: str) -> Response:
"""
Delete a target.
"""
"""Delete a target."""
(database,) = (
database
for database in TARGET_MANAGER.databases
Expand All @@ -266,9 +252,7 @@
methods=[HTTPMethod.PUT],
)
def update_target(database_name: str, target_id: str) -> Response:
"""
Update a target.
"""
"""Update a target."""
(database,) = (
database
for database in TARGET_MANAGER.databases
Expand Down
Loading