fast-clean 1.1.1__py3-none-any.whl → 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fast_clean/contrib/logging/__init__.py +0 -0
- fast_clean/contrib/logging/enums.py +10 -0
- fast_clean/contrib/logging/sentry.py +23 -0
- fast_clean/contrib/monitoring/__init__.py +0 -0
- fast_clean/contrib/monitoring/middleware.py +6 -0
- fast_clean/contrib/monitoring/router.py +6 -0
- fast_clean/contrib/sqlalchemy_utils/__init__.py +0 -0
- fast_clean/contrib/sqlalchemy_utils/utils.py +26 -0
- fast_clean/db.py +9 -6
- fast_clean/repositories/__init__.py +2 -2
- fast_clean/repositories/crud/__init__.py +9 -9
- fast_clean/repositories/crud/db.py +13 -13
- fast_clean/repositories/crud/in_memory.py +10 -10
- fast_clean/repositories/crud/type_vars.py +13 -13
- fast_clean/repositories/storage/s3.py +1 -1
- fast_clean/schemas/__init__.py +3 -3
- fast_clean/schemas/repository.py +3 -3
- fast_clean/services/lock.py +2 -2
- {fast_clean-1.1.1.dist-info → fast_clean-1.2.0.dist-info}/METADATA +8 -4
- {fast_clean-1.1.1.dist-info → fast_clean-1.2.0.dist-info}/RECORD +22 -18
- fast_clean/tools/__init__.py +0 -6
- fast_clean/tools/cryptography.py +0 -52
- fast_clean/tools/load_seed.py +0 -31
- fast_clean/use_cases.py +0 -38
- {fast_clean-1.1.1.dist-info → fast_clean-1.2.0.dist-info}/WHEEL +0 -0
- {fast_clean-1.1.1.dist-info → fast_clean-1.2.0.dist-info}/top_level.txt +0 -0
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
import sentry_sdk
|
4
|
+
from sentry_sdk.integrations.fastapi import FastApiIntegration
|
5
|
+
from sentry_sdk.integrations.logging import LoggingIntegration
|
6
|
+
|
7
|
+
from .enums import EnvironmentEnum
|
8
|
+
|
9
|
+
|
10
|
+
def use_sentry(
|
11
|
+
dsn: str | None,
|
12
|
+
environment: EnvironmentEnum = EnvironmentEnum.DEVELOPMENT,
|
13
|
+
level: int = logging.DEBUG,
|
14
|
+
event_level: int = logging.ERROR,
|
15
|
+
) -> None:
|
16
|
+
if not dsn:
|
17
|
+
return
|
18
|
+
|
19
|
+
sentry_logging = LoggingIntegration(
|
20
|
+
level=level,
|
21
|
+
event_level=event_level,
|
22
|
+
)
|
23
|
+
sentry_sdk.init(dsn=dsn, environment=str(environment), integrations=[sentry_logging, FastApiIntegration()])
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from typing import Any
|
2
|
+
|
3
|
+
import sqlalchemy_utils
|
4
|
+
from alembic.autogenerate.api import AutogenContext
|
5
|
+
|
6
|
+
|
7
|
+
def render_item(type_: str, obj: Any, autogen_context: AutogenContext):
|
8
|
+
"""
|
9
|
+
Apply custom rendering for selected items.
|
10
|
+
"""
|
11
|
+
|
12
|
+
if type_ == 'type' and isinstance(obj, sqlalchemy_utils.types.ChoiceType):
|
13
|
+
autogen_context.imports.add('import sqlalchemy_utils')
|
14
|
+
autogen_context.imports.add(f'from {obj.choices.__module__} import {obj.choices.__name__}')
|
15
|
+
return f'sqlalchemy_utils.types.ChoiceType({obj.choices.__name__}, impl=sa.{obj.impl.__class__.__name__}())'
|
16
|
+
|
17
|
+
if type_ == 'type' and isinstance(obj, sqlalchemy_utils.types.JSONType):
|
18
|
+
autogen_context.imports.add('import sqlalchemy_utils')
|
19
|
+
return 'sqlalchemy_utils.types.JSONType()'
|
20
|
+
|
21
|
+
if type_ == 'type' and isinstance(obj, sqlalchemy_utils.types.UUIDType):
|
22
|
+
autogen_context.imports.add('import sqlalchemy_utils')
|
23
|
+
return f'sqlalchemy_utils.types.UUIDType(binary={obj.binary})'
|
24
|
+
|
25
|
+
# Default rendering for other objects
|
26
|
+
return False
|
fast_clean/db.py
CHANGED
@@ -21,7 +21,7 @@ from sqlalchemy.ext.asyncio import (
|
|
21
21
|
from sqlalchemy.ext.declarative import declared_attr
|
22
22
|
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
23
23
|
from sqlalchemy.sql import func
|
24
|
-
from sqlalchemy_utils import UUIDType
|
24
|
+
from sqlalchemy_utils.types.uuid import UUIDType
|
25
25
|
from stringcase import snakecase
|
26
26
|
|
27
27
|
from .settings import CoreDbSettingsSchema, CoreSettingsSchema
|
@@ -61,7 +61,7 @@ def make_async_session_factory(
|
|
61
61
|
return async_sessionmaker(asyncio_engine, expire_on_commit=False, autoflush=False)
|
62
62
|
|
63
63
|
|
64
|
-
class
|
64
|
+
class Base(AsyncAttrs, DeclarativeBase):
|
65
65
|
"""
|
66
66
|
Базовая родительская модель.
|
67
67
|
"""
|
@@ -71,7 +71,7 @@ class BaseParent(AsyncAttrs, DeclarativeBase):
|
|
71
71
|
metadata = metadata
|
72
72
|
|
73
73
|
|
74
|
-
class Base
|
74
|
+
class BaseUUID(Base):
|
75
75
|
"""
|
76
76
|
Базовая родительская модель нового типа.
|
77
77
|
"""
|
@@ -90,7 +90,7 @@ class Base(BaseParent):
|
|
90
90
|
return snakecase(cls.__name__)
|
91
91
|
|
92
92
|
|
93
|
-
class
|
93
|
+
class BaseInt(Base):
|
94
94
|
"""
|
95
95
|
Базовая родительская модель старого типа.
|
96
96
|
"""
|
@@ -100,6 +100,10 @@ class BaseOld(BaseParent):
|
|
100
100
|
id: Mapped[int] = mapped_column(primary_key=True)
|
101
101
|
|
102
102
|
|
103
|
+
@declared_attr.directive
|
104
|
+
def __tablename__(cls) -> str:
|
105
|
+
return snakecase(cls.__name__)
|
106
|
+
|
103
107
|
class SessionFactory:
|
104
108
|
"""
|
105
109
|
Фабрика сессий.
|
@@ -170,8 +174,7 @@ class SessionManagerImpl:
|
|
170
174
|
Получаем сессию для выполнения запроса.
|
171
175
|
"""
|
172
176
|
if self.session.in_transaction():
|
173
|
-
|
174
|
-
yield self.session
|
177
|
+
yield self.session
|
175
178
|
else:
|
176
179
|
async with self.session.begin():
|
177
180
|
if immediate:
|
@@ -6,10 +6,10 @@ from .cache import CacheManager as CacheManager
|
|
6
6
|
from .cache import CacheRepositoryProtocol as CacheRepositoryProtocol
|
7
7
|
from .cache import InMemoryCacheRepository as InMemoryCacheRepository
|
8
8
|
from .cache import RedisCacheRepository as RedisCacheRepository
|
9
|
-
from .crud import
|
9
|
+
from .crud import CrudRepositoryIntProtocol as CrudRepositoryIntProtocol
|
10
10
|
from .crud import CrudRepositoryProtocol as CrudRepositoryProtocol
|
11
11
|
from .crud import DbCrudRepository as DbCrudRepository
|
12
|
-
from .crud import
|
12
|
+
from .crud import DbCrudRepositoryInt as DbCrudRepositoryInt
|
13
13
|
from .settings import EnvSettingsRepository as EnvSettingsRepository
|
14
14
|
from .settings import SettingsRepositoryError as SettingsRepositoryError
|
15
15
|
from .settings import SettingsRepositoryFactoryImpl as SettingsRepositoryFactoryImpl
|
@@ -13,17 +13,17 @@ from typing import Any, Protocol, Self
|
|
13
13
|
from fast_clean.schemas import PaginationResultSchema, PaginationSchema
|
14
14
|
|
15
15
|
from .db import DbCrudRepository as DbCrudRepository
|
16
|
-
from .db import
|
16
|
+
from .db import DbCrudRepositoryInt as DbCrudRepositoryInt
|
17
17
|
from .in_memory import InMemoryCrudRepository as InMemoryCrudRepository
|
18
|
-
from .in_memory import
|
18
|
+
from .in_memory import InMemoryCrudRepositoryInt as InMemoryCrudRepositoryInt
|
19
19
|
from .type_vars import (
|
20
20
|
CreateSchemaBaseType,
|
21
|
-
|
21
|
+
CreateSchemaIntType,
|
22
22
|
CreateSchemaType,
|
23
23
|
IdTypeContravariant,
|
24
24
|
ReadSchemaBaseType,
|
25
25
|
UpdateSchemaBaseType,
|
26
|
-
|
26
|
+
UpdateSchemaIntType,
|
27
27
|
UpdateSchemaType,
|
28
28
|
)
|
29
29
|
|
@@ -118,17 +118,17 @@ class CrudRepositoryBaseProtocol(
|
|
118
118
|
...
|
119
119
|
|
120
120
|
|
121
|
-
class
|
121
|
+
class CrudRepositoryIntProtocol(
|
122
122
|
CrudRepositoryBaseProtocol[
|
123
123
|
ReadSchemaBaseType,
|
124
|
-
|
125
|
-
|
124
|
+
CreateSchemaIntType,
|
125
|
+
UpdateSchemaIntType,
|
126
126
|
int,
|
127
127
|
],
|
128
128
|
Protocol[
|
129
129
|
ReadSchemaBaseType,
|
130
|
-
|
131
|
-
|
130
|
+
CreateSchemaIntType,
|
131
|
+
UpdateSchemaIntType,
|
132
132
|
],
|
133
133
|
):
|
134
134
|
"""
|
@@ -28,17 +28,17 @@ from fast_clean.schemas import PaginationResultSchema, PaginationSchema
|
|
28
28
|
|
29
29
|
from .type_vars import (
|
30
30
|
CreateSchemaBaseType,
|
31
|
-
|
31
|
+
CreateSchemaIntType,
|
32
32
|
CreateSchemaType,
|
33
33
|
IdType,
|
34
34
|
ModelBaseType,
|
35
|
-
|
35
|
+
ModelIntType,
|
36
36
|
ModelType,
|
37
37
|
ReadSchemaBaseType,
|
38
|
-
|
38
|
+
ReadSchemaIntType,
|
39
39
|
ReadSchemaType,
|
40
40
|
UpdateSchemaBaseType,
|
41
|
-
|
41
|
+
UpdateSchemaIntType,
|
42
42
|
UpdateSchemaType,
|
43
43
|
)
|
44
44
|
|
@@ -526,19 +526,19 @@ class DbCrudRepositoryBase(
|
|
526
526
|
return order_by_expr
|
527
527
|
|
528
528
|
|
529
|
-
class
|
529
|
+
class DbCrudRepositoryInt(
|
530
530
|
DbCrudRepositoryBase[
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
531
|
+
ModelIntType,
|
532
|
+
ReadSchemaIntType,
|
533
|
+
CreateSchemaIntType,
|
534
|
+
UpdateSchemaIntType,
|
535
535
|
int,
|
536
536
|
],
|
537
537
|
Generic[
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
538
|
+
ModelIntType,
|
539
|
+
ReadSchemaIntType,
|
540
|
+
CreateSchemaIntType,
|
541
|
+
UpdateSchemaIntType,
|
542
542
|
],
|
543
543
|
):
|
544
544
|
"""
|
@@ -15,14 +15,14 @@ from fast_clean.schemas import PaginationResultSchema, PaginationSchema
|
|
15
15
|
|
16
16
|
from .type_vars import (
|
17
17
|
CreateSchemaBaseType,
|
18
|
-
|
18
|
+
CreateSchemaIntType,
|
19
19
|
CreateSchemaType,
|
20
20
|
IdType,
|
21
21
|
ReadSchemaBaseType,
|
22
|
-
|
22
|
+
ReadSchemaIntType,
|
23
23
|
ReadSchemaType,
|
24
24
|
UpdateSchemaBaseType,
|
25
|
-
|
25
|
+
UpdateSchemaIntType,
|
26
26
|
UpdateSchemaType,
|
27
27
|
)
|
28
28
|
|
@@ -311,17 +311,17 @@ class InMemoryCrudRepositoryBase(ABC, Generic[ReadSchemaBaseType, CreateSchemaBa
|
|
311
311
|
return model
|
312
312
|
|
313
313
|
|
314
|
-
class
|
314
|
+
class InMemoryCrudRepositoryInt(
|
315
315
|
InMemoryCrudRepositoryBase[
|
316
|
-
|
317
|
-
|
318
|
-
|
316
|
+
ReadSchemaIntType,
|
317
|
+
CreateSchemaIntType,
|
318
|
+
UpdateSchemaIntType,
|
319
319
|
int,
|
320
320
|
],
|
321
321
|
Generic[
|
322
|
-
|
323
|
-
|
324
|
-
|
322
|
+
ReadSchemaIntType,
|
323
|
+
CreateSchemaIntType,
|
324
|
+
UpdateSchemaIntType,
|
325
325
|
],
|
326
326
|
):
|
327
327
|
"""
|
@@ -5,31 +5,31 @@
|
|
5
5
|
import uuid
|
6
6
|
from typing import TypeVar
|
7
7
|
|
8
|
-
from fast_clean.db import
|
8
|
+
from fast_clean.db import BaseInt, BaseUUID
|
9
9
|
from fast_clean.schemas import (
|
10
10
|
CreateSchema,
|
11
|
-
|
11
|
+
CreateSchemaInt,
|
12
12
|
ReadSchema,
|
13
|
-
|
13
|
+
ReadSchemaInt,
|
14
14
|
UpdateSchema,
|
15
|
-
|
15
|
+
UpdateSchemaInt,
|
16
16
|
)
|
17
17
|
|
18
|
-
ModelBaseType = TypeVar('ModelBaseType', bound=
|
19
|
-
CreateSchemaBaseType = TypeVar('CreateSchemaBaseType', bound=
|
20
|
-
ReadSchemaBaseType = TypeVar('ReadSchemaBaseType', bound=
|
21
|
-
UpdateSchemaBaseType = TypeVar('UpdateSchemaBaseType', bound=
|
18
|
+
ModelBaseType = TypeVar('ModelBaseType', bound=BaseInt | BaseUUID)
|
19
|
+
CreateSchemaBaseType = TypeVar('CreateSchemaBaseType', bound=CreateSchemaInt | CreateSchema)
|
20
|
+
ReadSchemaBaseType = TypeVar('ReadSchemaBaseType', bound=ReadSchemaInt | ReadSchema)
|
21
|
+
UpdateSchemaBaseType = TypeVar('UpdateSchemaBaseType', bound=UpdateSchemaInt | UpdateSchema)
|
22
22
|
IdType = TypeVar('IdType', bound=int | uuid.UUID)
|
23
23
|
IdTypeContravariant = TypeVar('IdTypeContravariant', bound=int | uuid.UUID, contravariant=True)
|
24
24
|
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
ModelIntType = TypeVar('ModelIntType', bound=BaseInt)
|
27
|
+
CreateSchemaIntType = TypeVar('CreateSchemaIntType', bound=CreateSchemaInt)
|
28
|
+
ReadSchemaIntType = TypeVar('ReadSchemaIntType', bound=ReadSchemaInt)
|
29
|
+
UpdateSchemaIntType = TypeVar('UpdateSchemaIntType', bound=UpdateSchemaInt)
|
30
30
|
|
31
31
|
|
32
|
-
ModelType = TypeVar('ModelType', bound=
|
32
|
+
ModelType = TypeVar('ModelType', bound=BaseUUID)
|
33
33
|
CreateSchemaType = TypeVar('CreateSchemaType', bound=CreateSchema)
|
34
34
|
ReadSchemaType = TypeVar('ReadSchemaType', bound=ReadSchema)
|
35
35
|
UpdateSchemaType = TypeVar('UpdateSchemaType', bound=UpdateSchema)
|
@@ -24,7 +24,7 @@ class S3StorageRepository:
|
|
24
24
|
def __init__(self: Self, params: S3StorageParamsSchema):
|
25
25
|
self.params = params
|
26
26
|
self.bucket = self.params.bucket
|
27
|
-
self.client = miniopy_async.Minio(
|
27
|
+
self.client = miniopy_async.Minio( # type: ignore
|
28
28
|
f'{self.params.endpoint}:{self.params.port}',
|
29
29
|
access_key=self.params.access_key,
|
30
30
|
secret_key=self.params.secret_key,
|
fast_clean/schemas/__init__.py
CHANGED
@@ -13,11 +13,11 @@ from .pagination import PaginationResponseSchema as PaginationResponseSchema
|
|
13
13
|
from .pagination import PaginationResultSchema as PaginationResultSchema
|
14
14
|
from .pagination import PaginationSchema as PaginationSchema
|
15
15
|
from .repository import CreateSchema as CreateSchema
|
16
|
-
from .repository import
|
16
|
+
from .repository import CreateSchemaInt as CreateSchemaInt
|
17
17
|
from .repository import ReadSchema as ReadSchema
|
18
|
-
from .repository import
|
18
|
+
from .repository import ReadSchemaInt as ReadSchemaInt
|
19
19
|
from .repository import UpdateSchema as UpdateSchema
|
20
|
-
from .repository import
|
20
|
+
from .repository import UpdateSchemaInt as UpdateSchemaInt
|
21
21
|
from .request_response import RemoteRequestSchema as RemoteRequestSchema
|
22
22
|
from .request_response import RemoteResponseSchema as RemoteResponseSchema
|
23
23
|
from .request_response import RequestSchema as RequestSchema
|
fast_clean/schemas/repository.py
CHANGED
@@ -34,9 +34,9 @@ class UpdateSchemaGeneric(BaseModel, Generic[IdType]):
|
|
34
34
|
id: IdType
|
35
35
|
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
CreateSchemaInt = CreateSchemaGeneric[int]
|
38
|
+
ReadSchemaInt = ReadSchemaGeneric[int]
|
39
|
+
UpdateSchemaInt = UpdateSchemaGeneric[int]
|
40
40
|
|
41
41
|
CreateSchema = CreateSchemaGeneric[uuid.UUID]
|
42
42
|
ReadSchema = ReadSchemaGeneric[uuid.UUID]
|
fast_clean/services/lock.py
CHANGED
@@ -6,9 +6,9 @@ from collections.abc import AsyncIterator
|
|
6
6
|
from contextlib import asynccontextmanager
|
7
7
|
from typing import AsyncContextManager, Protocol
|
8
8
|
|
9
|
-
import redis.asyncio.lock as aioredis_lock
|
10
9
|
from fast_clean.exceptions import LockError
|
11
10
|
from redis import asyncio as aioredis
|
11
|
+
from redis.exceptions import LockError as AIORedisLockError
|
12
12
|
|
13
13
|
|
14
14
|
class LockServiceProtocol(Protocol):
|
@@ -53,5 +53,5 @@ class RedisLockService:
|
|
53
53
|
try:
|
54
54
|
async with self.redis.lock(name, timeout=timeout, sleep=sleep, blocking_timeout=blocking_timeout):
|
55
55
|
yield
|
56
|
-
except
|
56
|
+
except AIORedisLockError as lock_error:
|
57
57
|
raise LockError() from lock_error
|
@@ -1,12 +1,14 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fast-clean
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.2.0
|
4
4
|
Summary: FastAPI Clean Architecture implementation
|
5
|
-
Author-email: Luferov Victor <luferovvs@yandex.ru>, Orlov Artem <squakrazv@yandex.ru>
|
6
|
-
Requires-Python: >=3.
|
5
|
+
Author-email: Luferov Victor <luferovvs@yandex.ru>, Orlov Artem <squakrazv@yandex.ru>, Kashapov Rustam <hardtechnik91@gmail.com>
|
6
|
+
Requires-Python: >=3.13
|
7
7
|
Description-Content-Type: text/markdown
|
8
8
|
Requires-Dist: aiofiles>=24.1.0
|
9
9
|
Requires-Dist: aiokafka>=0.12.0
|
10
|
+
Requires-Dist: aioprometheus>=23.12.0
|
11
|
+
Requires-Dist: alembic>=1.16.2
|
10
12
|
Requires-Dist: cryptography>=44.0.1
|
11
13
|
Requires-Dist: dishka>=1.6.0
|
12
14
|
Requires-Dist: fastapi>=0.115.8
|
@@ -15,10 +17,12 @@ Requires-Dist: faststream>=0.5.34
|
|
15
17
|
Requires-Dist: flatten-dict>=0.4.2
|
16
18
|
Requires-Dist: miniopy-async>=1.21.1
|
17
19
|
Requires-Dist: overrides>=7.7.0
|
18
|
-
Requires-Dist: psycopg>=3.2.4
|
20
|
+
Requires-Dist: psycopg[binary]>=3.2.4
|
19
21
|
Requires-Dist: pydantic>=2.10.6
|
20
22
|
Requires-Dist: pydantic-settings>=2.8.0
|
21
23
|
Requires-Dist: pyyaml>=6.0.2
|
24
|
+
Requires-Dist: sentry-sdk>=2.32.0
|
25
|
+
Requires-Dist: snakecase>=1.0.1
|
22
26
|
Requires-Dist: sqlalchemy-utils>=0.41.2
|
23
27
|
Requires-Dist: sqlalchemy[asyncio]>=2.0.38
|
24
28
|
Requires-Dist: stringcase>=1.2.0
|
@@ -1,7 +1,7 @@
|
|
1
1
|
fast_clean/__init__.py,sha256=sT4tb75t5PXws8W_7wpA0jNtNxkWPFLAMrPlDGS7RHw,51
|
2
2
|
fast_clean/broker.py,sha256=CHnL4Jd6jF5gKgtUXi33j9QFG2EUM4uqhVqdLuxIrZs,4474
|
3
3
|
fast_clean/container.py,sha256=E1e0H1JqGOacH4uBNwkjTDXYhzN56yZi0AmWXQ3DkEQ,3535
|
4
|
-
fast_clean/db.py,sha256=
|
4
|
+
fast_clean/db.py,sha256=8lfs9SS41naPkvyKcsStdBAXo07p_6Kwr_6zx7--oGU,5552
|
5
5
|
fast_clean/depends.py,sha256=nSsn1-c7A0VmtudCI70z5wi0b7TmSUqvHjyZpTE3_wk,7750
|
6
6
|
fast_clean/enums.py,sha256=lPhC_2_r6YFby7Mq-9u_JSiuyZ0e57F2VxBfUwnBZ18,826
|
7
7
|
fast_clean/exceptions.py,sha256=Sp-k-a5z1Gedu0slzj1-rORnr4GP1FXDHKCKRaJq-7o,9485
|
@@ -11,18 +11,25 @@ fast_clean/models.py,sha256=qnNUSwLf0gOW8C98PMIs6vTw7UP3-Nk-k6YoFvHstVM,880
|
|
11
11
|
fast_clean/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
fast_clean/redis.py,sha256=H_SLnDhY_ute8pYHdhIypUGlCwMcVfFA4S2j8vLUph0,578
|
13
13
|
fast_clean/settings.py,sha256=o460LZjXW0_WYe0QB9g0fTgch8dhkUq-6flAnf4LKM4,4715
|
14
|
-
fast_clean/use_cases.py,sha256=XzRqnS3LOkaadbL50-E9f7q3Bi5Yz4AOCHKh82AH0Mg,1384
|
15
14
|
fast_clean/contrib/__init__.py,sha256=AcFNyhc0QGsOnYvzQGanDN3QIAsKpn4d8RIj73F-sGc,63
|
16
15
|
fast_clean/contrib/healthcheck/__init__.py,sha256=p8hUCLdv2qGngTwAeTGIV4h_ZGDm9ZNWMrA5_k3Yi0E,106
|
17
16
|
fast_clean/contrib/healthcheck/router.py,sha256=6kyFuNqR5m3pB_fzerrZ7m7yvoqL_BiwkUMeLrxJVnE,408
|
18
|
-
fast_clean/
|
17
|
+
fast_clean/contrib/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
+
fast_clean/contrib/logging/enums.py,sha256=a-Tz3k4j0aAbUXDvTV6sl2pKKEGuKG94qc3plXixezU,154
|
19
|
+
fast_clean/contrib/logging/sentry.py,sha256=hacxHuHqYreosG_Nt0SPRlKQo0iE1hyY8DH4nbMhb5E,625
|
20
|
+
fast_clean/contrib/monitoring/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
+
fast_clean/contrib/monitoring/middleware.py,sha256=F6EDY_hNBmFlji-cCJwzsm5Wl1S0CsO373rjxfqjlGA,191
|
22
|
+
fast_clean/contrib/monitoring/router.py,sha256=94gffX34VE_Yb6TLaQOP4YyXDQsClzOn4APb45V_HyA,153
|
23
|
+
fast_clean/contrib/sqlalchemy_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
+
fast_clean/contrib/sqlalchemy_utils/utils.py,sha256=5xktmJlQifGpIXMruhe7qofEEu_ExncBTUmlrtFK1YQ,1061
|
25
|
+
fast_clean/repositories/__init__.py,sha256=mHJ6CW1fYkkiSnnYiO3GRAa5YVCPN1otOOKkjbutuhs,1753
|
19
26
|
fast_clean/repositories/cache/__init__.py,sha256=pD7qIS6H8DrnhOptJiXrlGcWYUCIU3VmVQCLccyxx4Q,2511
|
20
27
|
fast_clean/repositories/cache/in_memory.py,sha256=Hb68UrTmQozALcyLrmYPBIfJfi67NvsCTDe1RfqwBHQ,2259
|
21
28
|
fast_clean/repositories/cache/redis.py,sha256=UjrA2CXQtMfHTpowz6Ot952y73YjTEr6zJlBbWblaws,1908
|
22
|
-
fast_clean/repositories/crud/__init__.py,sha256=
|
23
|
-
fast_clean/repositories/crud/db.py,sha256=
|
24
|
-
fast_clean/repositories/crud/in_memory.py,sha256
|
25
|
-
fast_clean/repositories/crud/type_vars.py,sha256=
|
29
|
+
fast_clean/repositories/crud/__init__.py,sha256=m3HotDYyPm4tHKpobZcLoMpcdAgPsU9qrTkATKpS42Y,4391
|
30
|
+
fast_clean/repositories/crud/db.py,sha256=roKUese7s75SJZuNRbkDAY-jGsRfrR80eangZdeijak,23432
|
31
|
+
fast_clean/repositories/crud/in_memory.py,sha256=-beTCvrtyXon27S-I9O5Vk52YtMZZzfa9TmuQxKMw6Y,13407
|
32
|
+
fast_clean/repositories/crud/type_vars.py,sha256=Gb4ew1T1NkitL87hJ75KtpTjOi6PuML5fU_zFAsVUqA,1318
|
26
33
|
fast_clean/repositories/settings/__init__.py,sha256=ZxrncvTDs8pNkhWSy2cxV3a8uElTnrM-b1-vq4ouJok,1485
|
27
34
|
fast_clean/repositories/settings/enums.py,sha256=coqZg6xe_mRFWeihBfnSkCByLuD0pT8Vv4g02tpBk-w,358
|
28
35
|
fast_clean/repositories/settings/env.py,sha256=maQttYENMJyTf4vnSXa4L3R6tKiLmb-d0Q5VS-r9ZuE,2153
|
@@ -32,24 +39,21 @@ fast_clean/repositories/storage/__init__.py,sha256=mP_2NTx_Ec19WCmxecJsbjvNjhy8O
|
|
32
39
|
fast_clean/repositories/storage/enums.py,sha256=bS4L63aEXNaGnJql8A1jmsK4KY916cWnzTW5p_PyLmg,375
|
33
40
|
fast_clean/repositories/storage/local.py,sha256=s5REPU7xczvzin13sKyZtFdiocrgAMk8bnDIbJ90KT4,4270
|
34
41
|
fast_clean/repositories/storage/reader.py,sha256=yAxj51ITWJf0u-KGC3DJ0iTB3pDI1p9ixi_h0ZcWoZ4,3299
|
35
|
-
fast_clean/repositories/storage/s3.py,sha256=
|
42
|
+
fast_clean/repositories/storage/s3.py,sha256=z3YHGk89Ac87qAy3FApCXDpEx_CRdLfLzXBIng-BfUQ,4318
|
36
43
|
fast_clean/repositories/storage/schemas.py,sha256=etlogfK_1uUZPQjHWQN6LWy6-8YY2Sago3Zbf6p0KcQ,623
|
37
|
-
fast_clean/schemas/__init__.py,sha256=
|
44
|
+
fast_clean/schemas/__init__.py,sha256=OrIP8vV_c5tO5fET3slhCRNfiXjgmZnR5hJlVIZYh24,1361
|
38
45
|
fast_clean/schemas/exceptions.py,sha256=E7G9jv4G82Ede7OQ3619vPGwEywc7tKmXW6EolOGRFQ,723
|
39
46
|
fast_clean/schemas/pagination.py,sha256=GEQ-Tbhx6xkMMXhDNWrTEhPv8IdnAOJxH2P1tscmn60,1384
|
40
|
-
fast_clean/schemas/repository.py,sha256=
|
47
|
+
fast_clean/schemas/repository.py,sha256=ASxMJb23H3zwavr7P0_ZpCWZX7FjqAuC75qAIYqejvQ,889
|
41
48
|
fast_clean/schemas/request_response.py,sha256=i4HTpjelWl4DxJ1sQaeanTWB_PThlhVJRhtMMGqRAiQ,693
|
42
49
|
fast_clean/schemas/status_response.py,sha256=mASZRCNtKJnDbmhr8_pBytkE_3NguyTIFqO4aw-nNEQ,269
|
43
50
|
fast_clean/services/__init__.py,sha256=Lvdb5ZibRGwoMn_WENrk9wERUViTsPrU8E_71XtPFJc,617
|
44
|
-
fast_clean/services/lock.py,sha256=
|
51
|
+
fast_clean/services/lock.py,sha256=SLF9_wRx3rgHMw829XwflJgAlGJyXj57o4iVPvGwe78,1653
|
45
52
|
fast_clean/services/seed.py,sha256=M0yA2I5z-jLM2UcW_x7287mwIFW5Vt0fPFaplakGFc0,2836
|
46
53
|
fast_clean/services/transaction.py,sha256=djXR6e6ukgpBXDbVmU095MvRJAIqdOPMgAcege52Qxg,762
|
47
54
|
fast_clean/services/cryptography/__init__.py,sha256=IDokTE-dJriQxdsov3yoVw1OrsgyxJLeBFJwi_Mb7iE,1531
|
48
55
|
fast_clean/services/cryptography/aes.py,sha256=_k0WtnKDaEKdUBegfwmqerE75ER44307CEQ-I2W0abo,4616
|
49
56
|
fast_clean/services/cryptography/enums.py,sha256=cLibSGv6LNVTUI2rm3_DtDwU68GYIAf4kY3GGbtnw1A,494
|
50
|
-
fast_clean/tools/__init__.py,sha256=m8n09uN47JGtAfgWVbXCJOxpzlrUazogqtLo6xPWe3s,181
|
51
|
-
fast_clean/tools/cryptography.py,sha256=Q79-Qb4-nyrid3CNr7uWplT6tghnivFI-bqNUTvqlIQ,1913
|
52
|
-
fast_clean/tools/load_seed.py,sha256=Tm5_r_myrC5dl_WyC6Bx2WKFAkfLf-Pch4ZK6zWN2Qg,867
|
53
57
|
fast_clean/utils/__init__.py,sha256=Q3OiJNdWl51Vd_wSP7iuZQIq4_SjM1mYkqIWPaw94WU,709
|
54
58
|
fast_clean/utils/process.py,sha256=6k2E1q7d31Wq6G5BqJqrX5czimvJExeltk7uO7CxiSg,936
|
55
59
|
fast_clean/utils/pydantic.py,sha256=FtBkNsxdlrhrlEiIHu2wZwF-UR4THETV8mw-h_jevYg,871
|
@@ -59,7 +63,7 @@ fast_clean/utils/thread.py,sha256=ChEWBLupnSEMq4Wro_aiW0QvCLUKedKc0TQFMu7Zg4g,56
|
|
59
63
|
fast_clean/utils/time.py,sha256=nvavbtG4zR_gkrGSbsqKAsBdePxO3LuTeoISbFZIgn0,307
|
60
64
|
fast_clean/utils/type_converters.py,sha256=bMEJeoQB9Q6Qok1-ppn4Ii8ZpIkZwJbD2IzCydSStHw,523
|
61
65
|
fast_clean/utils/typer.py,sha256=1O7BsNGn68bBzNbj0-Ycfhv35WpLzwvYTKn510YNXQQ,663
|
62
|
-
fast_clean-1.
|
63
|
-
fast_clean-1.
|
64
|
-
fast_clean-1.
|
65
|
-
fast_clean-1.
|
66
|
+
fast_clean-1.2.0.dist-info/METADATA,sha256=nnsHb099wnCfTNJ9DGPAfV_c_5SkPA2XLFefwi-11V0,1245
|
67
|
+
fast_clean-1.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
68
|
+
fast_clean-1.2.0.dist-info/top_level.txt,sha256=QfsGs-QLmPCZWWPFOukD0zhMnokH68FoO2KeObl6ZIA,11
|
69
|
+
fast_clean-1.2.0.dist-info/RECORD,,
|
fast_clean/tools/__init__.py
DELETED
fast_clean/tools/cryptography.py
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Модуль, содержащий команды криптографии для шифрования секретных параметров.
|
3
|
-
"""
|
4
|
-
|
5
|
-
from typing import Annotated
|
6
|
-
|
7
|
-
import typer
|
8
|
-
|
9
|
-
from fast_clean.container import get_container
|
10
|
-
from fast_clean.services import CryptographicAlgorithmEnum, CryptographyServiceFactory
|
11
|
-
from fast_clean.utils import typer_async
|
12
|
-
|
13
|
-
|
14
|
-
@typer_async
|
15
|
-
async def encrypt(
|
16
|
-
data: Annotated[str, typer.Argument(help='Данные для шифровки.')],
|
17
|
-
algorithm: Annotated[
|
18
|
-
CryptographicAlgorithmEnum, typer.Option(help='Криптографический алгоритм')
|
19
|
-
] = CryptographicAlgorithmEnum.AES_GCM,
|
20
|
-
) -> None:
|
21
|
-
"""
|
22
|
-
Зашифровываем данные.
|
23
|
-
"""
|
24
|
-
async with get_container() as container:
|
25
|
-
cryptography_service_factory = await container.get(CryptographyServiceFactory)
|
26
|
-
cryptography_service = await cryptography_service_factory.make(algorithm)
|
27
|
-
print(cryptography_service.encrypt(data))
|
28
|
-
|
29
|
-
|
30
|
-
@typer_async
|
31
|
-
async def decrypt(
|
32
|
-
data: Annotated[str, typer.Argument(help='Данные для расшифровки.')],
|
33
|
-
algorithm: Annotated[
|
34
|
-
CryptographicAlgorithmEnum, typer.Option(help='Криптографический алгоритм')
|
35
|
-
] = CryptographicAlgorithmEnum.AES_GCM,
|
36
|
-
) -> None:
|
37
|
-
"""
|
38
|
-
Расшифровываем данные.
|
39
|
-
"""
|
40
|
-
async with get_container() as container:
|
41
|
-
cryptography_service_factory = await container.get(CryptographyServiceFactory)
|
42
|
-
cryptography_service = await cryptography_service_factory.make(algorithm)
|
43
|
-
print(cryptography_service.decrypt(data))
|
44
|
-
|
45
|
-
|
46
|
-
def use_cryptography(app: typer.Typer) -> None:
|
47
|
-
"""
|
48
|
-
Регистрируем команды криптографии для шифрования секретных параметров.
|
49
|
-
"""
|
50
|
-
|
51
|
-
app.command()(encrypt)
|
52
|
-
app.command()(decrypt)
|
fast_clean/tools/load_seed.py
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Модуль, содержащий команды загрузки данных из файлов.
|
3
|
-
"""
|
4
|
-
|
5
|
-
from typing import Annotated
|
6
|
-
|
7
|
-
import typer
|
8
|
-
|
9
|
-
from fast_clean.container import get_container
|
10
|
-
from fast_clean.services import SeedService
|
11
|
-
from fast_clean.utils import typer_async
|
12
|
-
|
13
|
-
|
14
|
-
@typer_async
|
15
|
-
async def load_seed(
|
16
|
-
path: Annotated[str | None, typer.Argument(help='Путь к директории для загрузки данных.')] = None,
|
17
|
-
) -> None:
|
18
|
-
"""
|
19
|
-
Загружаем данные из файлов.
|
20
|
-
"""
|
21
|
-
async with get_container() as container:
|
22
|
-
seed_service = await container.get(SeedService)
|
23
|
-
await seed_service.load_data(path)
|
24
|
-
|
25
|
-
|
26
|
-
def use_load_seed(app: typer.Typer) -> None:
|
27
|
-
"""
|
28
|
-
Регистрируем команды загрузки данных из файлов.
|
29
|
-
"""
|
30
|
-
|
31
|
-
app.command()(load_seed)
|
fast_clean/use_cases.py
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Модуль, содержащий варианты использования.
|
3
|
-
"""
|
4
|
-
|
5
|
-
from __future__ import annotations
|
6
|
-
|
7
|
-
from types import new_class
|
8
|
-
from typing import Any, Protocol, TypeVar, cast
|
9
|
-
|
10
|
-
UseCaseResultSchemaType = TypeVar('UseCaseResultSchemaType', covariant=True)
|
11
|
-
|
12
|
-
|
13
|
-
class UseCaseProtocol(Protocol[UseCaseResultSchemaType]):
|
14
|
-
"""
|
15
|
-
Протокол варианта использования.
|
16
|
-
"""
|
17
|
-
|
18
|
-
async def __call__(self) -> UseCaseResultSchemaType:
|
19
|
-
"""
|
20
|
-
Вызываем вариант использования.
|
21
|
-
"""
|
22
|
-
...
|
23
|
-
|
24
|
-
def __class_getitem__(cls, params: type | tuple[type, ...]) -> type:
|
25
|
-
"""
|
26
|
-
Создаем уникальный класс.
|
27
|
-
|
28
|
-
По умолчанию одинаковые обобщенные классы указывают на один и тот же _GenericAlias.
|
29
|
-
Из-за данного поведения поиск по типу становится невозможным.
|
30
|
-
|
31
|
-
UseCaseA = UseCaseProtocol[None]
|
32
|
-
UseCaseB = UseCaseProtocol[None]
|
33
|
-
assert UseCaseA is UseCaseB
|
34
|
-
|
35
|
-
Поэтому вместо _GenericAlias возвращаем уникального наследника.
|
36
|
-
"""
|
37
|
-
generic_alias = cast(Any, super()).__class_getitem__(params)
|
38
|
-
return new_class(cls.__name__, (generic_alias,))
|
File without changes
|
File without changes
|