fix: Upgrade Black (#3057)

* bump black

* bump black on precommit

* run black

* fix backend test runner
This commit is contained in:
Michael Genson
2024-01-27 15:11:54 -06:00
committed by GitHub
parent 0800a8d00a
commit a5ef18669b
45 changed files with 81 additions and 73 deletions

View File

@@ -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:

View File

@@ -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:

View File

@@ -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):

View File

@@ -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: ...

View File

@@ -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 *

View File

@@ -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:

View File

@@ -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: ...

View File

@@ -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

View File

@@ -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):

View File

@@ -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):

View File

@@ -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
]

View File

@@ -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:

View File

@@ -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

View File

@@ -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:

View File

@@ -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]: