Skip to content

Commit

Permalink
Fix typings
Browse files Browse the repository at this point in the history
  • Loading branch information
frankie567 committed Nov 14, 2022
1 parent c4f8fd1 commit c60eb6f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions backend/fief/dependencies/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ async def read_token(
return user

async def write_token(self, user: User) -> str:
... # pragma: no cover
raise NotImplementedError()

async def destroy_token(self, token: str, user: User) -> None:
... # pragma: no cover
raise NotImplementedError()


async def get_jwt_access_token_strategy(
Expand Down
8 changes: 5 additions & 3 deletions backend/fief/locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def get_babel_middleware_kwargs() -> Mapping[str, Any]:
return dict(locales_dirs=[LOCALE_DIRECTORY, wtforms.i18n.messages_path()])


def get_translations(domain: str = None, locale: Locale = None) -> support.Translations:
def get_translations(
domain: str | None = None, locale: Locale | None = None
) -> support.Translations:
"""
Load and cache translations.
Expand Down Expand Up @@ -45,10 +47,10 @@ def get_translations(domain: str = None, locale: Locale = None) -> support.Trans
return BABEL.translations[(domain, locale.language)]


def gettext(string: str, domain: str = None, **variables):
def gettext(string: str, domain: str | None = None, **variables):
t = get_translations(domain)
return t.ugettext(string) % variables


def gettext_lazy(string: str, domain: str = None, **variables):
def gettext_lazy(string: str, domain: str | None = None, **variables):
return support.LazyProxy(gettext, string, domain, **variables)
6 changes: 3 additions & 3 deletions backend/fief/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import uuid
from asyncio import AbstractEventLoop
from datetime import timezone
from typing import TYPE_CHECKING, AsyncContextManager, Callable, Dict, Literal, Optional
from typing import TYPE_CHECKING, AsyncContextManager, Callable, Literal, Optional

from loguru import logger
from pydantic import UUID4
Expand Down Expand Up @@ -92,8 +92,8 @@ def __init__(
self.get_workspace_session = get_workspace_session

async def __call__(self, message):
record: Dict = message.record
extra: Dict = record["extra"]
record = message.record
extra = record["extra"]
workspace_id = extra.get("workspace_id")

if workspace_id is None:
Expand Down
4 changes: 2 additions & 2 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ lint = [
"isort ./fief",
"isort ./tests",
"black . ",
"ruff -f .",
"ruff --fix .",
"mypy fief/",
"tryceratops fief/",
]
Expand Down Expand Up @@ -174,7 +174,7 @@ dependencies = [
"furl ==2.1.3",
"greenlet ==1.1.3",
"gunicorn ==20.1.0",
"httpx-oauth ==0.10.1",
"httpx-oauth ==0.10.2",
"Jinja2 ==3.1.2",
"jwcrypto ==1.4.2",
"loguru ==0.6.0",
Expand Down

0 comments on commit c60eb6f

Please sign in to comment.