Skip to content

Commit

Permalink
Update depencancies, typing changes, move coverage config
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCat467 committed Nov 6, 2023
1 parent a39fb7a commit a633765
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
rev: v0.1.4
hooks:
- id: ruff
types: [file]
Expand Down
16 changes: 12 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Operating System :: OS Independent",
"Typing :: Typed",
Expand Down Expand Up @@ -69,7 +70,6 @@ warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true


[tool.ruff.isort]
combine-as-imports = true

Expand All @@ -93,14 +93,13 @@ ignore = [
"D213", # conflicts with docstrings
## "E203", # conflicts with black
"E402", # module level import not at top of file
"E501", # conflicts with black
## "E501", # conflicts with black
"S101", # use of assert for tests and type narrowing
"D203",
"D401", # Imparative mood docstrings
]

fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
unfixable = ["D203"]
unfixable = []#"D203"]

[tool.ruff.per-file-ignores]
"src/sanescansrv/htmlgen.py" = [
Expand All @@ -109,6 +108,15 @@ unfixable = ["D203"]
"tests/*" = [
"D100", # no module docstring
"D103", # no docstrings
"E501", # line too long
]

[tool.coverage.run]
branch = true
source = ["src"]
omit = [
"__init__.py",
"generate_pages.py",
]

[tool.tox]
Expand Down
5 changes: 2 additions & 3 deletions src/sanescansrv/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,13 @@ async def send_error(
)


async def get_exception_page(code: int, name: str, desc: str) -> Response:
async def get_exception_page(code: int, name: str, desc: str) -> tuple[AsyncIterator[str], int]:
"""Return Response for exception."""
resp_body = await send_error(
page_title=f"{code} {name}",
error_body=desc,
)
# Response body can be AsyncIterator, type var is not correct
return Response(resp_body, status=code) # type: ignore[type-var]
return (resp_body, code)


def pretty_exception_name(exc: BaseException) -> str:
Expand Down
3 changes: 3 additions & 0 deletions tests/test_htmlgen.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""Test html generation."""


from __future__ import annotations

import pytest
Expand Down

0 comments on commit a633765

Please sign in to comment.