circular-fix
Some checks failed
Deploy on push / deploy (push) Failing after 17s

This commit is contained in:
2025-08-17 16:33:54 +03:00
parent bc8447a444
commit e78e12eeee
65 changed files with 3304 additions and 1051 deletions

View File

@@ -1,13 +1,14 @@
import asyncio
import sys
import traceback
from typing import Any, Optional
from typing import Any
from sqlalchemy import and_, distinct, func, join, select
from sqlalchemy.orm import aliased
from sqlalchemy.sql.expression import Select
from auth.orm import Author, AuthorFollower
from cache.cache import cache_author
from orm.community import Community, CommunityFollower
from orm.reaction import Reaction, ReactionKind
from orm.shout import Shout, ShoutAuthor, ShoutTopic
@@ -362,10 +363,8 @@ def update_author_stat(author_id: int) -> None:
:param author_id: Идентификатор автора.
"""
# Поздний импорт для избежания циклических зависимостей
from cache.cache import cache_author
author_query = select(Author).where(Author.id == author_id)
try:
author_query = select(Author).where(Author.id == author_id)
result = get_with_stat(author_query)
if result:
author_with_stat = result[0]
@@ -436,7 +435,7 @@ def get_following_count(entity_type: str, entity_id: int) -> int:
def get_shouts_count(
author_id: Optional[int] = None, topic_id: Optional[int] = None, community_id: Optional[int] = None
author_id: int | None = None, topic_id: int | None = None, community_id: int | None = None
) -> int:
"""Получает количество публикаций"""
try:
@@ -458,7 +457,7 @@ def get_shouts_count(
return 0
def get_authors_count(community_id: Optional[int] = None) -> int:
def get_authors_count(community_id: int | None = None) -> int:
"""Получает количество авторов"""
try:
with local_session() as session:
@@ -479,7 +478,7 @@ def get_authors_count(community_id: Optional[int] = None) -> int:
return 0
def get_topics_count(author_id: Optional[int] = None) -> int:
def get_topics_count(author_id: int | None = None) -> int:
"""Получает количество топиков"""
try:
with local_session() as session:
@@ -509,7 +508,7 @@ def get_communities_count() -> int:
return 0
def get_reactions_count(shout_id: Optional[int] = None, author_id: Optional[int] = None) -> int:
def get_reactions_count(shout_id: int | None = None, author_id: int | None = None) -> int:
"""Получает количество реакций"""
try:
with local_session() as session: