mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-01-28 03:23:11 -05:00
chores: updates-and-linters (#1868)
* switch to ruff * add ruff * run ruff --fix * update ruff * resolve ruff errors * drop isort from CI * fix decorator order
This commit is contained in:
@@ -2,7 +2,6 @@ import shutil
|
||||
import tempfile
|
||||
from collections.abc import AsyncGenerator, Callable, Generator
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from uuid import uuid4
|
||||
|
||||
from fastapi import Depends, HTTPException, status
|
||||
@@ -116,7 +115,7 @@ def validate_long_live_token(session: Session, client_token: str, user_id: str)
|
||||
raise HTTPException(status.HTTP_401_UNAUTHORIZED) from e
|
||||
|
||||
|
||||
def validate_file_token(token: Optional[str] = None) -> Path:
|
||||
def validate_file_token(token: str | None = None) -> Path:
|
||||
"""
|
||||
Args:
|
||||
token (Optional[str], optional): _description_. Defaults to None.
|
||||
@@ -143,7 +142,7 @@ def validate_file_token(token: Optional[str] = None) -> Path:
|
||||
return file_path
|
||||
|
||||
|
||||
def validate_recipe_token(token: Optional[str] = None) -> str:
|
||||
def validate_recipe_token(token: str | None = None) -> str:
|
||||
"""
|
||||
Args:
|
||||
token (Optional[str], optional): _description_. Defaults to None.
|
||||
|
||||
@@ -7,7 +7,7 @@ from mealie.core.config import determine_data_dir
|
||||
|
||||
DATA_DIR = determine_data_dir()
|
||||
|
||||
from .config import get_app_settings
|
||||
from .config import get_app_settings # noqa E402
|
||||
|
||||
LOGGER_FILE = DATA_DIR.joinpath("mealie.log")
|
||||
DATE_FORMAT = "%d-%b-%y %H:%M:%S"
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
from abc import ABC, abstractproperty
|
||||
from abc import ABC, abstractmethod
|
||||
from pathlib import Path
|
||||
|
||||
from pydantic import BaseModel, BaseSettings, PostgresDsn
|
||||
|
||||
|
||||
class AbstractDBProvider(ABC):
|
||||
@abstractproperty
|
||||
@property
|
||||
@abstractmethod
|
||||
def db_url(self) -> str:
|
||||
pass
|
||||
...
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def db_url_public(self) -> str:
|
||||
pass
|
||||
...
|
||||
|
||||
|
||||
class SQLiteProvider(AbstractDBProvider, BaseModel):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import secrets
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseSettings, NoneStr
|
||||
|
||||
@@ -54,7 +53,7 @@ class AppSettings(BaseSettings):
|
||||
# Database Configuration
|
||||
|
||||
DB_ENGINE: str = "sqlite" # Options: 'sqlite', 'postgres'
|
||||
DB_PROVIDER: Optional[AbstractDBProvider] = None
|
||||
DB_PROVIDER: AbstractDBProvider | None = None
|
||||
|
||||
@property
|
||||
def DB_URL(self) -> str | None:
|
||||
@@ -71,13 +70,13 @@ class AppSettings(BaseSettings):
|
||||
# ===============================================
|
||||
# Email Configuration
|
||||
|
||||
SMTP_HOST: Optional[str]
|
||||
SMTP_PORT: Optional[str] = "587"
|
||||
SMTP_FROM_NAME: Optional[str] = "Mealie"
|
||||
SMTP_FROM_EMAIL: Optional[str]
|
||||
SMTP_USER: Optional[str]
|
||||
SMTP_PASSWORD: Optional[str]
|
||||
SMTP_AUTH_STRATEGY: Optional[str] = "TLS" # Options: 'TLS', 'SSL', 'NONE'
|
||||
SMTP_HOST: str | None
|
||||
SMTP_PORT: str | None = "587"
|
||||
SMTP_FROM_NAME: str | None = "Mealie"
|
||||
SMTP_FROM_EMAIL: str | None
|
||||
SMTP_USER: str | None
|
||||
SMTP_PASSWORD: str | None
|
||||
SMTP_AUTH_STRATEGY: str | None = "TLS" # Options: 'TLS', 'SSL', 'NONE'
|
||||
|
||||
@property
|
||||
def SMTP_ENABLE(self) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user