Skip to content

Commit

Permalink
Upgrade syntax after dropping Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
br3ndonland committed Oct 5, 2024
1 parent ee33487 commit 699c59d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
7 changes: 1 addition & 6 deletions inboard/app/main_fastapi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import sys
from typing import Optional
from typing import Annotated, Optional

from fastapi import Depends, FastAPI, status
from fastapi.middleware import Middleware
Expand All @@ -9,11 +9,6 @@

from inboard.app.utilities_fastapi import basic_auth as fastapi_basic_auth

if sys.version_info < (3, 9): # pragma: no cover
from typing_extensions import Annotated
else: # pragma: no cover
from typing import Annotated

BasicAuth = Annotated[str, Depends(fastapi_basic_auth)]
origin_regex = r"^(https?:\/\/)(localhost|([\w\.]+\.)?br3ndon.land)(:[0-9]+)?$"
server = (
Expand Down
7 changes: 1 addition & 6 deletions inboard/app/utilities_fastapi.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import os
import secrets
import sys
from typing import Annotated

from fastapi import Depends, HTTPException, status
from fastapi.security import HTTPBasic, HTTPBasicCredentials

if sys.version_info < (3, 9): # pragma: no cover
from typing_extensions import Annotated
else: # pragma: no cover
from typing import Annotated

HTTPBasicCredentialsDependency = Annotated[HTTPBasicCredentials, Depends(HTTPBasic())]


Expand Down
7 changes: 4 additions & 3 deletions inboard/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
if TYPE_CHECKING:
import sys
from asyncio import Protocol
from collections.abc import Sequence
from os import PathLike
from typing import Any, Literal, Sequence, Type
from typing import Any, Literal

if sys.version_info < (3, 11):
from typing_extensions import Required
Expand Down Expand Up @@ -106,8 +107,8 @@ class UvicornOptions(TypedDict, total=False):
uds: str | None
fd: int | None
loop: LoopSetupType
http: Type[Protocol] | HTTPProtocolType
ws: Type[Protocol] | WSProtocolType
http: type[Protocol] | HTTPProtocolType
ws: type[Protocol] | WSProtocolType
ws_max_queue: int
ws_max_size: int
ws_ping_interval: float | None
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ src = ["inboard", "tests"]
docstring-code-format = true

[tool.ruff.lint]
extend-select = ["I"]
extend-select = ["I", "UP"]

[tool.ruff.lint.isort]
known-first-party = ["inboard", "tests"]

0 comments on commit 699c59d

Please sign in to comment.