style: форматирование ruff остальных файлов шаблона и тип уровня в InterceptHandler

Нужно для зелёного make lint (R-8).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Andrey Epifancev 2026-10-04 02:32:49 +04:00
parent 85839a0fbf
commit a24fee09c6
6 changed files with 26 additions and 11 deletions

View File

@ -1,4 +1,5 @@
import uvicorn import uvicorn
from src import app, get_settings from src import app, get_settings
if __name__ == "__main__": if __name__ == "__main__":
@ -9,4 +10,3 @@ if __name__ == "__main__":
port=settings.server.PORT, port=settings.server.PORT,
lifespan="on", lifespan="on",
) )

View File

@ -2,6 +2,6 @@ from .app import app
from .core.config import get_settings from .core.config import get_settings
__all__ = [ __all__ = [
'app', "app",
'get_settings', "get_settings",
] ]

View File

@ -1,5 +1,6 @@
class NotFoundError(Exception): class NotFoundError(Exception):
pass pass
class CouldntCreateError(Exception): class CouldntCreateError(Exception):
pass pass

View File

@ -1,6 +1,7 @@
"""Клиенты инфраструктуры. Каркас: оставлен S3Storage; outbox-паблишер (PollWorker) реализуется в Срезе 0 """Клиенты инфраструктуры. Каркас: оставлен S3Storage; outbox-паблишер (PollWorker) реализуется в Срезе 0
по docs/context/03-architecture.md (референс — reference-old-arm/api/src/core/clients.py). по docs/context/03-architecture.md (референс — reference-old-arm/api/src/core/clients.py).
""" """
from io import BytesIO from io import BytesIO
from miniopy_async import Minio from miniopy_async import Minio
@ -10,11 +11,11 @@ class S3Storage:
def __init__(self, client: Minio, bucket_name: str): def __init__(self, client: Minio, bucket_name: str):
self.client = client self.client = client
self.bucket = bucket_name self.bucket = bucket_name
async def put_object(self, obj_name, file_data): async def put_object(self, obj_name, file_data):
try: try:
stream = BytesIO(file_data) stream = BytesIO(file_data)
await self.client.put_object(self.bucket, obj_name, stream, length=len(file_data)) await self.client.put_object(self.bucket, obj_name, stream, length=len(file_data))
except: except:
raise raise
@ -23,5 +24,5 @@ class S3Storage:
response = await self.client.get_object(self.bucket, obj_name) response = await self.client.get_object(self.bucket, obj_name)
# file_bytes = await response.content.read() # file_bytes = await response.content.read()
return response return response
except: except:
raise raise

View File

@ -5,7 +5,6 @@ import sys
from loguru import logger from loguru import logger
# Периодические пробы мониторинга/оркестратора и служебные doc-эндпоинты. # Периодические пробы мониторинга/оркестратора и служебные doc-эндпоинты.
NOISE_PATHS: tuple[str, ...] = ( NOISE_PATHS: tuple[str, ...] = (
"/healthcheck", "/healthcheck",
@ -22,8 +21,20 @@ _NOISE_MARKERS: tuple[str, ...] = ("/static/", "/static-swagger/")
# Расширения статических ассетов (картинки, стили, скрипты, шрифты). # Расширения статических ассетов (картинки, стили, скрипты, шрифты).
_STATIC_SUFFIXES: tuple[str, ...] = ( _STATIC_SUFFIXES: tuple[str, ...] = (
".png", ".jpg", ".jpeg", ".gif", ".svg", ".ico", ".webp", ".png",
".css", ".js", ".map", ".woff", ".woff2", ".ttf", ".eot", ".jpg",
".jpeg",
".gif",
".svg",
".ico",
".webp",
".css",
".js",
".map",
".woff",
".woff2",
".ttf",
".eot",
) )
@ -73,6 +84,7 @@ def setup_logger(
class InterceptHandler(logging.Handler): class InterceptHandler(logging.Handler):
def emit(self, record: logging.LogRecord) -> None: def emit(self, record: logging.LogRecord) -> None:
lvl: str | int
try: try:
lvl = logger.level(record.levelname).name lvl = logger.level(record.levelname).name
except ValueError: except ValueError:

View File

@ -4,6 +4,7 @@
маппинг JSON из S3 в document/osv_entry/financial_statement_*) реализуется в Срезе 0–2 по маппинг JSON из S3 в document/osv_entry/financial_statement_*) реализуется в Срезе 0–2 по
docs/context/03-architecture.md. Для референса — reference-old-arm/api/src/core/nats_callback.py. docs/context/03-architecture.md. Для референса — reference-old-arm/api/src/core/nats_callback.py.
""" """
from loguru import logger from loguru import logger
from nats.aio.client import Client as NATS from nats.aio.client import Client as NATS