Skip to content

Commit

Permalink
Remove 3.8 and add 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins committed Dec 31, 2024
1 parent 827b313 commit 0fcab14
Show file tree
Hide file tree
Showing 109 changed files with 861 additions and 1,000 deletions.
8 changes: 3 additions & 5 deletions guide/webapp/display/layouts/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections.abc import Generator
from contextlib import contextmanager
from typing import Generator

from html5tagger import Builder

Expand All @@ -15,12 +15,10 @@ def __init__(self, builder: Builder):
@contextmanager
def __call__(
self, request: Request, full: bool = True
) -> Generator[BaseLayout, None, None]:
) -> Generator[BaseLayout]:
with self.layout(request, full=full):
yield self

@contextmanager
def layout(
self, request: Request, full: bool = True
) -> Generator[None, None, None]:
def layout(self, request: Request, full: bool = True) -> Generator[None]:
yield
6 changes: 2 additions & 4 deletions guide/webapp/display/layouts/home.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections.abc import Generator
from contextlib import contextmanager
from typing import Generator

from html5tagger import Builder, E

Expand All @@ -13,9 +13,7 @@

class HomeLayout(BaseLayout):
@contextmanager
def layout(
self, request: Request, full: bool = True
) -> Generator[None, None, None]:
def layout(self, request: Request, full: bool = True) -> Generator[None]:
self._sponsors()
self._hero(request.ctx.language)
with self.builder.div(class_="home container"):
Expand Down
2 changes: 1 addition & 1 deletion guide/webapp/display/layouts/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Generator
from contextlib import contextmanager
from typing import Generator

from sanic import Request
from webapp.display.layouts.elements.footer import do_footer
Expand Down
5 changes: 2 additions & 3 deletions guide/webapp/display/page/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from dataclasses import dataclass, field
from pathlib import Path
from typing import Type

from frontmatter import parse

Expand All @@ -16,7 +15,7 @@
_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,
}
Expand Down Expand Up @@ -45,7 +44,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
Expand Down
3 changes: 1 addition & 2 deletions guide/webapp/display/page/renderer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

from contextlib import contextmanager
from typing import Type

from html5tagger import HTML, Builder # type: ignore

Expand Down Expand Up @@ -52,7 +51,7 @@ def _body(

@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)
Expand Down
Loading

0 comments on commit 0fcab14

Please sign in to comment.