fastapi-mongo-base 1.4.1__tar.gz → 1.4.2__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.
- {fastapi_mongo_base-1.4.1/src/fastapi_mongo_base.egg-info → fastapi_mongo_base-1.4.2}/PKG-INFO +1 -1
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/pyproject.toml +1 -1
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/utils/basic.py +41 -12
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2/src/fastapi_mongo_base.egg-info}/PKG-INFO +1 -1
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/LICENSE.txt +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/MANIFEST.in +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/README.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/boilerplate.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/changelog.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/contributing.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/endpoints.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/extra.css +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/index.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/installation.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/license.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/quickstart.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/settings.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/tutorial.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/docs/usage.md +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/mkdocs.yml +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/pytest.ini +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/setup.cfg +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/__init__.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/__init__.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/app_factory.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/config.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/db.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/enums.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/error_responses.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/errors/mongodb_errors.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/errors/resource_errors.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/exceptions.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/middlewares/prometheus.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/prometheus/mongo.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/sentry.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/models.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/py.typed +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/routes.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/schemas.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/sql.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/tasks.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/utils/__init__.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/utils/bsontools.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/utils/timezone.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/utils/usso_routes.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base.egg-info/SOURCES.txt +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base.egg-info/dependency_links.txt +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base.egg-info/requires.txt +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base.egg-info/top_level.txt +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/__init__.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/app/__init__.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/app/logs/app.log +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/app/main.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/app/server.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/conftest.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/test_apis.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/test_app.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/test_db.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/test_mongodb_errors.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/test_openapi_errors.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/test_resource_errors.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/test_sentry.py +0 -0
- {fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/tests/test_usso_routes_workspace.py +0 -0
{fastapi_mongo_base-1.4.1/src/fastapi_mongo_base.egg-info → fastapi_mongo_base-1.4.2}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-mongo-base
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.2
|
|
4
4
|
Summary: A simple boilerplate application, including models and schemas and abstract router, for FastAPI with MongoDB
|
|
5
5
|
Author-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
6
6
|
Maintainer-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fastapi-mongo-base"
|
|
7
|
-
version = "1.4.
|
|
7
|
+
version = "1.4.2"
|
|
8
8
|
description = "A simple boilerplate application, including models and schemas and abstract router, for FastAPI with MongoDB"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -328,9 +328,21 @@ async def gather_sync(
|
|
|
328
328
|
R = TypeVar("R")
|
|
329
329
|
|
|
330
330
|
|
|
331
|
+
def _resolve_mock(
|
|
332
|
+
mock_response: R | Callable[..., R | Awaitable[R]],
|
|
333
|
+
*args: object,
|
|
334
|
+
**kwargs: object,
|
|
335
|
+
) -> R | Awaitable[R]:
|
|
336
|
+
if callable(mock_response):
|
|
337
|
+
return mock_response(*args, **kwargs)
|
|
338
|
+
return mock_response
|
|
339
|
+
|
|
340
|
+
|
|
331
341
|
def debug_mode_mock(
|
|
332
342
|
mock_response: R | Callable[..., R | Awaitable[R]],
|
|
333
|
-
) -> Callable[
|
|
343
|
+
) -> Callable[
|
|
344
|
+
[Callable[..., R | Awaitable[R]]], Callable[..., R | Awaitable[R]]
|
|
345
|
+
]:
|
|
334
346
|
"""
|
|
335
347
|
Return a mock response if debug is enabled.
|
|
336
348
|
|
|
@@ -340,22 +352,39 @@ def debug_mode_mock(
|
|
|
340
352
|
Returns:
|
|
341
353
|
A decorator that returns a mock response if debug is enabled.
|
|
342
354
|
"""
|
|
343
|
-
from ..core.config import Settings
|
|
344
355
|
|
|
345
356
|
def decorator(
|
|
346
|
-
func: Callable[..., Awaitable[R]],
|
|
347
|
-
) -> Callable[..., Awaitable[R]]:
|
|
357
|
+
func: Callable[..., R | Awaitable[R]],
|
|
358
|
+
) -> Callable[..., R | Awaitable[R]]:
|
|
359
|
+
|
|
360
|
+
from ..core.config import Settings
|
|
361
|
+
|
|
348
362
|
@functools.wraps(func)
|
|
349
|
-
async def
|
|
363
|
+
async def async_wrapper(*args: object, **kwargs: object) -> R:
|
|
350
364
|
if Settings.debug:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
return result
|
|
356
|
-
return mock_response
|
|
365
|
+
result = _resolve_mock(mock_response, *args, **kwargs)
|
|
366
|
+
if isinstance(result, Awaitable):
|
|
367
|
+
return await result
|
|
368
|
+
return result
|
|
357
369
|
return await func(*args, **kwargs)
|
|
358
370
|
|
|
359
|
-
|
|
371
|
+
@functools.wraps(func)
|
|
372
|
+
def sync_wrapper(*args: object, **kwargs: object) -> R:
|
|
373
|
+
if Settings.debug:
|
|
374
|
+
result = _resolve_mock(mock_response, *args, **kwargs)
|
|
375
|
+
if isinstance(result, Awaitable):
|
|
376
|
+
msg = (
|
|
377
|
+
"debug_mode_mock callable returned "
|
|
378
|
+
"Awaitable for sync function"
|
|
379
|
+
)
|
|
380
|
+
raise TypeError(msg)
|
|
381
|
+
return result
|
|
382
|
+
return func(*args, **kwargs)
|
|
383
|
+
|
|
384
|
+
return (
|
|
385
|
+
async_wrapper
|
|
386
|
+
if inspect.iscoroutinefunction(func)
|
|
387
|
+
else sync_wrapper
|
|
388
|
+
)
|
|
360
389
|
|
|
361
390
|
return decorator
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2/src/fastapi_mongo_base.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-mongo-base
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.2
|
|
4
4
|
Summary: A simple boilerplate application, including models and schemas and abstract router, for FastAPI with MongoDB
|
|
5
5
|
Author-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
6
6
|
Maintainer-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
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
|
|
File without changes
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/__init__.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/app_factory.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/error_responses.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/core/exceptions.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
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/utils/__init__.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/utils/bsontools.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/utils/timezone.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base/utils/usso_routes.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base.egg-info/requires.txt
RENAMED
|
File without changes
|
{fastapi_mongo_base-1.4.1 → fastapi_mongo_base-1.4.2}/src/fastapi_mongo_base.egg-info/top_level.txt
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
|