mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-01-30 04:23:12 -05:00
fix: Upgrade Black (#3057)
* bump black * bump black on precommit * run black * fix backend test runner
This commit is contained in:
@@ -7,11 +7,9 @@ from mealie.core.config import get_app_settings
|
||||
|
||||
|
||||
class Hasher(Protocol):
|
||||
def hash(self, password: str) -> str:
|
||||
...
|
||||
def hash(self, password: str) -> str: ...
|
||||
|
||||
def verify(self, password: str, hashed: str) -> bool:
|
||||
...
|
||||
def verify(self, password: str, hashed: str) -> bool: ...
|
||||
|
||||
|
||||
class FakeHasher:
|
||||
|
||||
@@ -18,8 +18,7 @@ ALGORITHM = "HS256"
|
||||
logger = root_logger.get_logger("security")
|
||||
|
||||
|
||||
class UserLockedOut(Exception):
|
||||
...
|
||||
class UserLockedOut(Exception): ...
|
||||
|
||||
|
||||
def create_access_token(data: dict, expires_delta: timedelta | None = None) -> str:
|
||||
|
||||
@@ -7,13 +7,11 @@ from pydantic import BaseModel, BaseSettings, PostgresDsn
|
||||
class AbstractDBProvider(ABC):
|
||||
@property
|
||||
@abstractmethod
|
||||
def db_url(self) -> str:
|
||||
...
|
||||
def db_url(self) -> str: ...
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def db_url_public(self) -> str:
|
||||
...
|
||||
def db_url_public(self) -> str: ...
|
||||
|
||||
|
||||
class SQLiteProvider(AbstractDBProvider, BaseModel):
|
||||
|
||||
@@ -31,5 +31,4 @@ class GroupWebhooksModel(SqlAlchemyBase, BaseMixins):
|
||||
time: Mapped[str | None] = mapped_column(String, default="00:00")
|
||||
|
||||
@auto_init()
|
||||
def __init__(self, **_) -> None:
|
||||
...
|
||||
def __init__(self, **_) -> None: ...
|
||||
|
||||
@@ -3,5 +3,4 @@ The img package is a collection of utilities for working with images. While it o
|
||||
within the img package should not be tightly coupled to Mealie.
|
||||
"""
|
||||
|
||||
|
||||
from .minify import *
|
||||
|
||||
@@ -46,8 +46,7 @@ class ABCMinifier(ABC):
|
||||
)
|
||||
|
||||
@abstractmethod
|
||||
def minify(self, image: Path, force=True):
|
||||
...
|
||||
def minify(self, image: Path, force=True): ...
|
||||
|
||||
def purge(self, image: Path):
|
||||
if not self._purge:
|
||||
|
||||
@@ -25,5 +25,4 @@ class AbstractSeeder(ABC):
|
||||
self.resources = Path(__file__).parent / "resources"
|
||||
|
||||
@abstractmethod
|
||||
def seed(self, locale: str | None = None) -> None:
|
||||
...
|
||||
def seed(self, locale: str | None = None) -> None: ...
|
||||
|
||||
@@ -3,6 +3,7 @@ This file contains code taken from fastapi-utils project. The code is licensed u
|
||||
|
||||
See their repository for details -> https://github.com/dmontagu/fastapi-utils
|
||||
"""
|
||||
|
||||
import inspect
|
||||
from collections.abc import Callable
|
||||
from typing import Any, TypeVar, cast, get_type_hints
|
||||
|
||||
@@ -9,8 +9,7 @@ from mealie.services.backups_v2.alchemy_exporter import AlchemyExporter
|
||||
from mealie.services.backups_v2.backup_file import BackupFile
|
||||
|
||||
|
||||
class BackupSchemaMismatch(Exception):
|
||||
...
|
||||
class BackupSchemaMismatch(Exception): ...
|
||||
|
||||
|
||||
class BackupV2(BaseService):
|
||||
|
||||
@@ -73,8 +73,7 @@ class Message:
|
||||
|
||||
class ABCEmailSender(ABC):
|
||||
@abstractmethod
|
||||
def send(self, email_to: str, subject: str, html: str) -> bool:
|
||||
...
|
||||
def send(self, email_to: str, subject: str, html: str) -> bool: ...
|
||||
|
||||
|
||||
class DefaultEmailSender(ABCEmailSender, BaseService):
|
||||
|
||||
@@ -100,9 +100,12 @@ class AppriseEventListener(EventListenerBase):
|
||||
|
||||
return [
|
||||
# We use query params to add custom key: value pairs to the Apprise payload by prepending the key with ":".
|
||||
AppriseEventListener.merge_query_parameters(url, {f":{k}": v for k, v in params.items()})
|
||||
# only certain endpoints support the custom key: value pairs, so we only apply them to those endpoints
|
||||
if AppriseEventListener.is_custom_url(url) else url
|
||||
(
|
||||
AppriseEventListener.merge_query_parameters(url, {f":{k}": v for k, v in params.items()})
|
||||
# only certain endpoints support the custom key: value pairs, so we only apply them to those endpoints
|
||||
if AppriseEventListener.is_custom_url(url)
|
||||
else url
|
||||
)
|
||||
for url in urls
|
||||
]
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@ from mealie.services.event_bus_service.event_types import Event
|
||||
|
||||
|
||||
class PublisherLike(Protocol):
|
||||
def publish(self, event: Event, notification_urls: list[str]):
|
||||
...
|
||||
def publish(self, event: Event, notification_urls: list[str]): ...
|
||||
|
||||
|
||||
class ApprisePublisher:
|
||||
|
||||
@@ -37,12 +37,10 @@ class ABCExporter(BaseService):
|
||||
super().__init__()
|
||||
|
||||
@abstractproperty
|
||||
def destination_dir(self) -> str:
|
||||
...
|
||||
def destination_dir(self) -> str: ...
|
||||
|
||||
@abstractmethod
|
||||
def items(self) -> Iterator[ExportedItem]:
|
||||
...
|
||||
def items(self) -> Iterator[ExportedItem]: ...
|
||||
|
||||
def _post_export_hook(self, _: BaseModel) -> None:
|
||||
pass
|
||||
|
||||
@@ -106,12 +106,10 @@ class ABCIngredientParser(ABC):
|
||||
return 70
|
||||
|
||||
@abstractmethod
|
||||
def parse_one(self, ingredient_string: str) -> ParsedIngredient:
|
||||
...
|
||||
def parse_one(self, ingredient_string: str) -> ParsedIngredient: ...
|
||||
|
||||
@abstractmethod
|
||||
def parse(self, ingredients: list[str]) -> list[ParsedIngredient]:
|
||||
...
|
||||
def parse(self, ingredients: list[str]) -> list[ParsedIngredient]: ...
|
||||
|
||||
@classmethod
|
||||
def find_match(cls, match_value: str, *, store_map: dict[str, T], fuzzy_match_threshold: int = 0) -> T | None:
|
||||
|
||||
@@ -82,8 +82,7 @@ class ABCScraperStrategy(ABC):
|
||||
self.url = url
|
||||
|
||||
@abstractmethod
|
||||
async def get_html(self, url: str) -> str:
|
||||
...
|
||||
async def get_html(self, url: str) -> str: ...
|
||||
|
||||
@abstractmethod
|
||||
async def parse(self) -> tuple[Recipe, ScrapedExtras] | tuple[None, None]:
|
||||
|
||||
Reference in New Issue
Block a user