maleo-foundation 0.0.49__tar.gz → 0.0.51__tar.gz
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.
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/PKG-INFO +1 -1
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/__init__.py +1 -3
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/utils/exceptions.py +16 -3
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/utils/logger.py +3 -1
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation.egg-info/PKG-INFO +1 -1
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/pyproject.toml +1 -1
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/README.md +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/general/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/general/http.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/google/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/google/cloud/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/google/cloud/logging.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/google/cloud/secret.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/google/cloud/storage.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/utils/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/utils/logger.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/constants.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/db/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/db/database.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/db/engine.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/db/session.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/enums.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/expanded_types/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/expanded_types/client.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/expanded_types/query.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/expanded_types/service.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/extended_types.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/middlewares/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/middlewares/base.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/middlewares/cors.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/responses.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/schemas/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/schemas/general.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/schemas/parameter.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/schemas/result.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/parameters/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/parameters/client.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/parameters/general.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/parameters/service.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/results/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/results/client/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/results/client/controllers/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/results/client/controllers/http.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/results/client/service.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/results/service/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/results/service/controllers/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/results/service/controllers/rest.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/results/service/general.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/results/service/query.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/types.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/utils/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/utils/controller.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/utils/formatter/__init__.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/utils/formatter/case.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/utils/query.py +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation.egg-info/SOURCES.txt +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation.egg-info/dependency_links.txt +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation.egg-info/requires.txt +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation.egg-info/top_level.txt +0 -0
- {maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/setup.cfg +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from .general import BaseGeneralClients
|
|
3
3
|
from .google import GoogleClients
|
|
4
|
-
from .utils import BaseClientUtils
|
|
5
4
|
|
|
6
5
|
class BaseClients:
|
|
7
6
|
General = BaseGeneralClients
|
|
8
|
-
Google = GoogleClients
|
|
9
|
-
Utils = BaseClientUtils
|
|
7
|
+
Google = GoogleClients
|
|
@@ -4,10 +4,11 @@ from fastapi.responses import JSONResponse
|
|
|
4
4
|
from functools import wraps
|
|
5
5
|
from starlette.exceptions import HTTPException as StarletteHTTPException
|
|
6
6
|
from sqlalchemy.exc import SQLAlchemyError
|
|
7
|
+
from typing import Optional
|
|
7
8
|
from maleo_foundation.models.responses import BaseResponses
|
|
8
9
|
from maleo_foundation.models.transfers.results.service.general import BaseServiceGeneralResultsTransfers
|
|
9
10
|
from maleo_foundation.models.transfers.results.service.query import BaseServiceQueryResultsTransfers
|
|
10
|
-
from maleo_foundation.utils.logger import BaseLogger
|
|
11
|
+
from maleo_foundation.utils.logger import BaseLogger, LoggerFactory
|
|
11
12
|
|
|
12
13
|
class BaseExceptions:
|
|
13
14
|
@staticmethod
|
|
@@ -25,10 +26,16 @@ class BaseExceptions:
|
|
|
25
26
|
@staticmethod
|
|
26
27
|
def database_exception_handler(
|
|
27
28
|
operation:str,
|
|
28
|
-
logger:BaseLogger,
|
|
29
|
+
logger:Optional[BaseLogger] = None,
|
|
30
|
+
logger_factory:Optional[LoggerFactory] = None,
|
|
29
31
|
fail_result_class:type[BaseServiceQueryResultsTransfers.Fail] = BaseServiceQueryResultsTransfers.Fail
|
|
30
32
|
):
|
|
31
33
|
"""Decorator to handle database-related exceptions consistently."""
|
|
34
|
+
if logger is not None and logger_factory is not None:
|
|
35
|
+
raise RuntimeError("Only one of 'logger' or 'logger_factory' should be provided, not both.")
|
|
36
|
+
if logger is None and logger_factory is None:
|
|
37
|
+
raise RuntimeError("One of 'logger' or 'logger_factory' must be provided.")
|
|
38
|
+
logger = logger or logger_factory()
|
|
32
39
|
def decorator(func):
|
|
33
40
|
@wraps(func)
|
|
34
41
|
def wrapper(*args, **kwargs):
|
|
@@ -54,10 +61,16 @@ class BaseExceptions:
|
|
|
54
61
|
@staticmethod
|
|
55
62
|
def service_exception_handler(
|
|
56
63
|
operation:str,
|
|
57
|
-
logger:BaseLogger,
|
|
64
|
+
logger:Optional[BaseLogger] = None,
|
|
65
|
+
logger_factory:Optional[LoggerFactory] = None,
|
|
58
66
|
fail_result_class:type[BaseServiceGeneralResultsTransfers.Fail] = BaseServiceGeneralResultsTransfers.Fail
|
|
59
67
|
):
|
|
60
68
|
"""Decorator to handle service-related exceptions consistently."""
|
|
69
|
+
if logger is not None and logger_factory is not None:
|
|
70
|
+
raise RuntimeError("Only one of 'logger' or 'logger_factory' should be provided, not both.")
|
|
71
|
+
if logger is None and logger_factory is None:
|
|
72
|
+
raise RuntimeError("One of 'logger' or 'logger_factory' must be provided.")
|
|
73
|
+
logger = logger or logger_factory()
|
|
61
74
|
def decorator(func):
|
|
62
75
|
@wraps(func)
|
|
63
76
|
def wrapper(*args, **kwargs):
|
|
File without changes
|
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/general/__init__.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/general/http.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/google/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/google/cloud/logging.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/google/cloud/secret.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/google/cloud/storage.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/utils/__init__.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/clients/utils/logger.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/expanded_types/__init__.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/expanded_types/client.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/expanded_types/query.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/expanded_types/service.py
RENAMED
|
File without changes
|
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/middlewares/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/schemas/__init__.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/schemas/general.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/schemas/parameter.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/schemas/result.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/models/transfers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/utils/formatter/__init__.py
RENAMED
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation/utils/formatter/case.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{maleo_foundation-0.0.49 → maleo_foundation-0.0.51}/maleo_foundation.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|