Skip to content

Commit 1c9d117

Browse files
committed
fix: update type hints and mypy configuration
1 parent dd2c26f commit 1c9d117

9 files changed

Lines changed: 15 additions & 20 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
# E704 Multiple statements on one line (def)
2525
args: ["--extend-ignore", "E203 E501 E704"]
2626
# - repo: https://github.com/pre-commit/mirrors-mypy
27-
# rev: v1.19.0
27+
# rev: v1.19.1
2828
# hooks:
2929
# - id: mypy
30-
# args: [--config-file, pyproject.toml]
30+
# args: ["--config-file", "pyproject.toml"]

asgi_webdav/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def make_auth_challenge_string(self) -> bytes:
262262
return f'Basic realm="{self.realm}"'.encode()
263263

264264
async def get_user_from_cache(self, auth_header_data: bytes) -> DAVUser | None:
265-
return await self._cache.get(auth_header_data)
265+
return await self._cache.get(auth_header_data) # type: ignore
266266

267267
async def update_user_to_cache(
268268
self, auth_header_data: bytes, user: DAVUser

asgi_webdav/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from logging import getLogger
2+
from typing import Any
23

34
import click
45

@@ -8,7 +9,7 @@
89
logger = getLogger(__name__)
910

1011

11-
def convert_click_kwargs_to_aep(kwargs: dict) -> AppEntryParameters:
12+
def convert_click_kwargs_to_aep(kwargs: dict[str, Any]) -> AppEntryParameters:
1213
if kwargs.get("dev"):
1314
dev_mode = DevMode.DEV
1415
elif kwargs.get("litmus"):
@@ -96,7 +97,7 @@ def convert_click_kwargs_to_aep(kwargs: dict) -> AppEntryParameters:
9697
default=False,
9798
help="Enter Litmus(for test) mode, DON'T use it in production!",
9899
)
99-
def main(**kwargs):
100+
def main(**kwargs: dict[str, Any]):
100101
if kwargs["version"]:
101102
from asgi_webdav import __version__
102103

asgi_webdav/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
if sys.version_info >= (3, 11):
1111
import tomllib
1212
else:
13-
import tomli as tomllib
13+
import tomli as tomllib # type: ignore
1414

1515
from dataclass_wizard import EnvWizard, JSONPyWizard
1616

asgi_webdav/provider/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ async def _do_get(
492492
async def do_head(self, request: DAVRequest) -> DAVResponse:
493493
http_status, property_basic_data = await self._do_head(request)
494494
if http_status == 200:
495-
headers = property_basic_data.get_get_head_response_headers()
495+
headers = property_basic_data.get_get_head_response_headers() # type: ignore
496496
if self.support_content_range:
497497
headers.update(
498498
{

asgi_webdav/provider/webhdfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
try:
88
import httpx
9-
from httpx_kerberos import HTTPKerberosAuth
9+
from httpx_kerberos import HTTPKerberosAuth # type: ignore
1010
except ImportError:
1111
httpx = None
1212
HTTPKerberosAuth = None

asgi_webdav/response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
if sys.version_info >= (3, 14):
1111
from compression import zstd
1212
else:
13-
from backports import zstd
13+
from backports import zstd # type: ignore
1414

1515
from asgi_webdav.config import Config, get_config
1616
from asgi_webdav.constants import (

asgi_webdav/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def get_asgi_app(aep: AppEntryParameters, config_obj: dict[str, Any] | None = No
171171

172172

173173
def convert_aep_to_uvicorn_kwargs(aep: AppEntryParameters) -> dict[str, Any]:
174-
kwargs = {
174+
kwargs: dict[str, Any] = {
175175
"host": aep.bind_host,
176176
"port": aep.bind_port,
177177
"use_colors": aep.logging_use_colors,

pyproject.toml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,12 @@ asyncio_mode = "auto"
6969
[tool.isort]
7070
profile = "black"
7171

72-
[tool.pyright]
73-
include = ["asgi_webdav"]
74-
venvPath = "."
75-
venv = "venv"
76-
7772
[tool.mypy]
78-
packages = ["asgi_webdav"]
73+
python_version = "3.10"
74+
files = ["asgi_webdav/"]
7975

80-
# python_version = "3.10"
76+
strict = true
77+
strict_bytes = true
8178

8279
warn_return_any = true
8380
warn_unused_configs = true
84-
85-
strict = true
86-
strict_bytes =true

0 commit comments

Comments
 (0)