Flake8-comprehensions (C4) --fix go brrr

This commit is contained in:
L. Kärkkäinen
2023-10-25 02:28:52 +01:00
parent 9adb6e8ec0
commit 65ba1942cc
81 changed files with 696 additions and 793 deletions

View File

@@ -2,7 +2,6 @@ from __future__ import annotations
from dataclasses import dataclass, field
from pathlib import Path
from typing import Type
from frontmatter import parse
@@ -15,7 +14,7 @@ from .docobject import organize_docobjects
_PAGE_CACHE: dict[
str, dict[str, tuple[Page | None, Page | None, Page | None]]
] = {}
_LAYOUTS_CACHE: dict[str, Type[BaseLayout]] = {
_LAYOUTS_CACHE: dict[str, type[BaseLayout]] = {
"home": HomeLayout,
"main": MainLayout,
}
@@ -43,7 +42,7 @@ class Page:
DEFAULT_LANGUAGE = _DEFAULT
def get_layout(self) -> Type[BaseLayout]:
def get_layout(self) -> type[BaseLayout]:
return _LAYOUTS_CACHE[self.meta.layout]
@property

View File

@@ -1,7 +1,6 @@
from __future__ import annotations
from contextlib import contextmanager
from typing import Type
from html5tagger import HTML, Builder # type: ignore
from sanic import Request
@@ -38,7 +37,7 @@ class PageRenderer(BaseRenderer):
@contextmanager
def _base(self, request: Request, builder: Builder, page: Page | None):
layout_type: Type[BaseLayout] = (
layout_type: type[BaseLayout] = (
page.get_layout() if page else BaseLayout
)
layout = layout_type(builder)