feat: (WIP) base-shoppinglist infra (#911)

* feat:  base-shoppinglist infra (WIP)

* add type checker

* implement controllers

* apply router fixes

* add checked section hide/animation

* add label support

* formatting

* fix overflow images

* add experimental banner

* fix #912 word break issue

* remove any type errors

* bump dependencies

* remove templates

* fix build errors

* bump node version

* fix template literal
This commit is contained in:
Hayden
2022-01-08 22:24:34 -09:00
committed by GitHub
parent 86c99b10a2
commit 6db1357064
66 changed files with 3455 additions and 1311 deletions

View File

@@ -1,4 +1,4 @@
from typing import Generic, TypeVar
from typing import TypeVar
from pydantic import BaseModel
@@ -6,7 +6,7 @@ T = TypeVar("T", bound=BaseModel)
U = TypeVar("U", bound=BaseModel)
def mapper(source: U, dest: T, **kwargs) -> Generic[T]:
def mapper(source: U, dest: T, **_) -> T:
"""
Map a source model to a destination model. Only top-level fields are mapped.
"""
@@ -16,3 +16,9 @@ def mapper(source: U, dest: T, **kwargs) -> Generic[T]:
setattr(dest, field, getattr(source, field))
return dest
def cast(source: U, dest: T, **kwargs) -> T:
create_data = {field: getattr(source, field) for field in source.__fields__ if field in dest.__fields__}
create_data.update(kwargs or {})
return dest(**create_data)