mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 14:45:36 +01:00
Fix lint
This commit is contained in:
@@ -2,18 +2,17 @@ exclude: 'docs|node_modules|migrations|.git|.tox'
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/ambv/black
|
||||
rev: 22.12.0
|
||||
rev: 23.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3.11
|
||||
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: 'v0.0.216'
|
||||
rev: 'v0.0.265'
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: ["--force-exclude"]
|
||||
|
||||
- repo: https://github.com/crate-ci/typos
|
||||
rev: v1.13.6
|
||||
rev: typos-dict-v0.9.26
|
||||
hooks:
|
||||
- id: typos
|
||||
|
||||
850
poetry.lock
generated
850
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -6,16 +6,16 @@ authors = ["Kurbanov Bulat <kurbanovbul@gmail.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
fastapi = "^0.95.0"
|
||||
httpx = "^0.23.3"
|
||||
alembic = "^1.10.2"
|
||||
uvicorn = {extras = ["standard"], version = "^0.21.1"}
|
||||
fastapi = "^0.95.1"
|
||||
httpx = "^0.24.0"
|
||||
alembic = "^1.10.4"
|
||||
uvicorn = {extras = ["standard"], version = "^0.22.0"}
|
||||
arq = "^0.25.0"
|
||||
prometheus-fastapi-instrumentator = "^6.0.0"
|
||||
uvloop = "^0.17.0"
|
||||
gunicorn = "^20.1.0"
|
||||
orjson = "^3.8.8"
|
||||
sentry-sdk = "^1.17.0"
|
||||
orjson = "^3.8.11"
|
||||
sentry-sdk = "^1.22.1"
|
||||
ormar = {extras = ["postgresql"], version = "^0.12.1"}
|
||||
pydantic = "^1.10.4"
|
||||
redis = {version = "4.5.4", extras = ["hiredis"]}
|
||||
@@ -64,14 +64,13 @@ max-complexity = 15
|
||||
[tool.ruff.isort]
|
||||
known-first-party = ["core", "app"]
|
||||
force-sort-within-sections = true
|
||||
force-wrap-aliases = true
|
||||
section-order = ["future", "standard-library", "base_framework", "framework_ext", "third-party", "first-party", "local-folder"]
|
||||
lines-after-imports = 2
|
||||
|
||||
# only_sections = true
|
||||
# force_sort_within_sections = true
|
||||
# lines_after_imports = 2
|
||||
# lexicographical = true
|
||||
# sections = ["FUTURE", "STDLIB", "BASEFRAMEWORK", "FRAMEWORKEXT", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
|
||||
# known_baseframework = ["fastapi",]
|
||||
# known_frameworkext = ["starlette",]
|
||||
[tool.ruff.isort.sections]
|
||||
base_framework = ["fastapi",]
|
||||
framework_ext = ["starlette"]
|
||||
|
||||
[tool.ruff.pyupgrade]
|
||||
keep-runtime-typing = true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import httpx
|
||||
|
||||
|
||||
response = httpx.get("http://localhost:8080/healthcheck")
|
||||
print(f"HEALTHCHECK STATUS: {response.status_code}")
|
||||
exit(0 if response.status_code == 200 else 1)
|
||||
|
||||
@@ -6,9 +6,10 @@ import random
|
||||
from tempfile import SpooledTemporaryFile
|
||||
from typing import Optional, cast
|
||||
|
||||
from fastapi import UploadFile
|
||||
|
||||
from arq.connections import ArqRedis
|
||||
from arq.worker import Retry
|
||||
from fastapi import UploadFile
|
||||
import httpx
|
||||
from redis import asyncio as aioredis
|
||||
from redis.exceptions import LockError
|
||||
@@ -19,6 +20,7 @@ from app.services.downloader import download
|
||||
from app.services.files_client import upload_file
|
||||
from app.services.library_client import Book, get_book, get_books, get_last_book_id
|
||||
|
||||
|
||||
logger = logging.getLogger("telegram_channel_files_manager")
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ from sentry_sdk import capture_exception
|
||||
|
||||
from core.config import env_config
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
from base64 import b64encode
|
||||
|
||||
from arq.connections import ArqRedis
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from starlette.background import BackgroundTask
|
||||
|
||||
from arq.connections import ArqRedis
|
||||
|
||||
from app.depends import check_token
|
||||
from app.models import CachedFile as CachedFileDB
|
||||
from app.serializers import CachedFile, CreateCachedFile
|
||||
@@ -15,6 +17,7 @@ from app.services.files_client import download_file as download_file_from_cache
|
||||
from app.services.library_client import get_book
|
||||
from app.utils import get_cached_file_or_cache
|
||||
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/api/v1", tags=["files"], dependencies=[Depends(check_token)]
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.responses import ORJSONResponse
|
||||
|
||||
from prometheus_fastapi_instrumentator import Instrumentator
|
||||
|
||||
from app.views import healthcheck_router, router
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from fastapi.security import APIKeyHeader
|
||||
|
||||
|
||||
default_security = APIKeyHeader(name="Authorization")
|
||||
|
||||
@@ -5,6 +5,7 @@ from sqlalchemy import MetaData
|
||||
|
||||
from core.config import env_config
|
||||
|
||||
|
||||
DATABASE_URL = (
|
||||
f"postgresql://{env_config.POSTGRES_USER}:{quote(env_config.POSTGRES_PASSWORD)}@"
|
||||
f"{env_config.POSTGRES_HOST}:{env_config.POSTGRES_PORT}/{env_config.POSTGRES_DB}"
|
||||
|
||||
@@ -2,6 +2,7 @@ import sentry_sdk
|
||||
|
||||
from core.config import env_config
|
||||
|
||||
|
||||
sentry_sdk.init(
|
||||
env_config.SENTRY_DSN,
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from core.app import start_app
|
||||
|
||||
|
||||
app = start_app()
|
||||
|
||||
Reference in New Issue
Block a user