From 3414f3b6640531d8409a3f18d82edb87919aee88 Mon Sep 17 00:00:00 2001 From: GLEF1X Date: Sat, 9 Sep 2023 15:10:41 -0400 Subject: [PATCH] [refactoring]: `event_fetching` -> `core/event_fetching` --- .../{ => core}/event_fetching/__init__.py | 0 .../event_fetching/class_based/__init__.py | 0 .../event_fetching/class_based/base.py | 0 .../event_fetching/class_based/bill.py | 0 .../event_fetching/class_based/error.py | 0 .../event_fetching/class_based/transaction.py | 0 .../class_based/webhook_transaction.py | 0 .../{ => core}/event_fetching/dispatcher.py | 2 +- .../{ => core}/event_fetching/executor.py | 6 +++--- glQiwiApi/{ => core}/event_fetching/filters.py | 0 .../event_fetching/webhooks/__init__.py | 0 .../{ => core}/event_fetching/webhooks/app.py | 18 ++++++++++-------- .../event_fetching/webhooks/config.py | 0 .../event_fetching/webhooks/dto/__init__.py | 0 .../event_fetching/webhooks/dto/errors.py | 0 .../webhooks/middlewares/__init__.py | 0 .../event_fetching/webhooks/middlewares/ip.py | 4 ++-- .../webhooks/services/__init__.py | 0 .../webhooks/services/collision_detector.py | 0 .../webhooks/services/security/__init__.py | 0 .../webhooks/services/security/ip.py | 0 .../event_fetching/webhooks/utils.py | 2 +- .../event_fetching/webhooks/views/__init__.py | 0 .../event_fetching/webhooks/views/base.py | 6 +++--- .../event_fetching/webhooks/views/bill_view.py | 2 +- .../webhooks/views/transaction_view.py | 4 ++-- .../test_webhook/test_app.py | 9 ++++----- .../test_services/test_collision_detector.py | 2 +- .../test_webhook/test_views/test_p2p_view.py | 7 ++----- .../test_webhook/test_views/test_txn_view.py | 6 ++---- 30 files changed, 32 insertions(+), 36 deletions(-) rename glQiwiApi/{ => core}/event_fetching/__init__.py (100%) rename glQiwiApi/{ => core}/event_fetching/class_based/__init__.py (100%) rename glQiwiApi/{ => core}/event_fetching/class_based/base.py (100%) rename glQiwiApi/{ => core}/event_fetching/class_based/bill.py (100%) rename glQiwiApi/{ => core}/event_fetching/class_based/error.py (100%) rename glQiwiApi/{ => core}/event_fetching/class_based/transaction.py (100%) rename glQiwiApi/{ => core}/event_fetching/class_based/webhook_transaction.py (100%) rename glQiwiApi/{ => core}/event_fetching/dispatcher.py (98%) rename glQiwiApi/{ => core}/event_fetching/executor.py (98%) rename glQiwiApi/{ => core}/event_fetching/filters.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/__init__.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/app.py (71%) rename glQiwiApi/{ => core}/event_fetching/webhooks/config.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/dto/__init__.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/dto/errors.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/middlewares/__init__.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/middlewares/ip.py (83%) rename glQiwiApi/{ => core}/event_fetching/webhooks/services/__init__.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/services/collision_detector.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/services/security/__init__.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/services/security/ip.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/utils.py (96%) rename glQiwiApi/{ => core}/event_fetching/webhooks/views/__init__.py (100%) rename glQiwiApi/{ => core}/event_fetching/webhooks/views/base.py (92%) rename glQiwiApi/{ => core}/event_fetching/webhooks/views/bill_view.py (93%) rename glQiwiApi/{ => core}/event_fetching/webhooks/views/transaction_view.py (87%) diff --git a/glQiwiApi/event_fetching/__init__.py b/glQiwiApi/core/event_fetching/__init__.py similarity index 100% rename from glQiwiApi/event_fetching/__init__.py rename to glQiwiApi/core/event_fetching/__init__.py diff --git a/glQiwiApi/event_fetching/class_based/__init__.py b/glQiwiApi/core/event_fetching/class_based/__init__.py similarity index 100% rename from glQiwiApi/event_fetching/class_based/__init__.py rename to glQiwiApi/core/event_fetching/class_based/__init__.py diff --git a/glQiwiApi/event_fetching/class_based/base.py b/glQiwiApi/core/event_fetching/class_based/base.py similarity index 100% rename from glQiwiApi/event_fetching/class_based/base.py rename to glQiwiApi/core/event_fetching/class_based/base.py diff --git a/glQiwiApi/event_fetching/class_based/bill.py b/glQiwiApi/core/event_fetching/class_based/bill.py similarity index 100% rename from glQiwiApi/event_fetching/class_based/bill.py rename to glQiwiApi/core/event_fetching/class_based/bill.py diff --git a/glQiwiApi/event_fetching/class_based/error.py b/glQiwiApi/core/event_fetching/class_based/error.py similarity index 100% rename from glQiwiApi/event_fetching/class_based/error.py rename to glQiwiApi/core/event_fetching/class_based/error.py diff --git a/glQiwiApi/event_fetching/class_based/transaction.py b/glQiwiApi/core/event_fetching/class_based/transaction.py similarity index 100% rename from glQiwiApi/event_fetching/class_based/transaction.py rename to glQiwiApi/core/event_fetching/class_based/transaction.py diff --git a/glQiwiApi/event_fetching/class_based/webhook_transaction.py b/glQiwiApi/core/event_fetching/class_based/webhook_transaction.py similarity index 100% rename from glQiwiApi/event_fetching/class_based/webhook_transaction.py rename to glQiwiApi/core/event_fetching/class_based/webhook_transaction.py diff --git a/glQiwiApi/event_fetching/dispatcher.py b/glQiwiApi/core/event_fetching/dispatcher.py similarity index 98% rename from glQiwiApi/event_fetching/dispatcher.py rename to glQiwiApi/core/event_fetching/dispatcher.py index f03065c3..198461b7 100644 --- a/glQiwiApi/event_fetching/dispatcher.py +++ b/glQiwiApi/core/event_fetching/dispatcher.py @@ -20,7 +20,7 @@ cast, ) -from glQiwiApi.event_fetching.class_based.base import Handler +from glQiwiApi.core.event_fetching.class_based.base import Handler from glQiwiApi.qiwi.clients.p2p.types import BillWebhook from glQiwiApi.qiwi.clients.wallet.types.transaction import Transaction from glQiwiApi.qiwi.clients.wallet.types.webhooks import TransactionWebhook diff --git a/glQiwiApi/event_fetching/executor.py b/glQiwiApi/core/event_fetching/executor.py similarity index 98% rename from glQiwiApi/event_fetching/executor.py rename to glQiwiApi/core/event_fetching/executor.py index 4ba0b594..70264203 100644 --- a/glQiwiApi/event_fetching/executor.py +++ b/glQiwiApi/core/event_fetching/executor.py @@ -20,9 +20,9 @@ from aiohttp.web import _run_app # noqa from glQiwiApi import QiwiWrapper -from glQiwiApi.event_fetching.dispatcher import BaseDispatcher -from glQiwiApi.event_fetching.webhooks.app import configure_app -from glQiwiApi.event_fetching.webhooks.config import WebhookConfig +from glQiwiApi.core.event_fetching.dispatcher import BaseDispatcher +from glQiwiApi.core.event_fetching.webhooks.app import configure_app +from glQiwiApi.core.event_fetching.webhooks.config import WebhookConfig from glQiwiApi.ext.webhook_url import WebhookURL from glQiwiApi.qiwi.clients.wallet.client import QiwiWallet from glQiwiApi.qiwi.clients.wallet.methods.history import MAX_HISTORY_LIMIT diff --git a/glQiwiApi/event_fetching/filters.py b/glQiwiApi/core/event_fetching/filters.py similarity index 100% rename from glQiwiApi/event_fetching/filters.py rename to glQiwiApi/core/event_fetching/filters.py diff --git a/glQiwiApi/event_fetching/webhooks/__init__.py b/glQiwiApi/core/event_fetching/webhooks/__init__.py similarity index 100% rename from glQiwiApi/event_fetching/webhooks/__init__.py rename to glQiwiApi/core/event_fetching/webhooks/__init__.py diff --git a/glQiwiApi/event_fetching/webhooks/app.py b/glQiwiApi/core/event_fetching/webhooks/app.py similarity index 71% rename from glQiwiApi/event_fetching/webhooks/app.py rename to glQiwiApi/core/event_fetching/webhooks/app.py index cbf0ab82..f9427ad9 100644 --- a/glQiwiApi/event_fetching/webhooks/app.py +++ b/glQiwiApi/core/event_fetching/webhooks/app.py @@ -2,16 +2,18 @@ from aiohttp import web -from glQiwiApi.event_fetching.dispatcher import BaseDispatcher -from glQiwiApi.event_fetching.webhooks.config import WebhookConfig -from glQiwiApi.event_fetching.webhooks.middlewares.ip import ip_filter_middleware -from glQiwiApi.event_fetching.webhooks.services.collision_detector import ( +from glQiwiApi.core.event_fetching.dispatcher import BaseDispatcher +from glQiwiApi.core.event_fetching.webhooks.config import WebhookConfig +from glQiwiApi.core.event_fetching.webhooks.middlewares.ip import ip_filter_middleware +from glQiwiApi.core.event_fetching.webhooks.services.collision_detector import ( HashBasedCollisionDetector, ) -from glQiwiApi.event_fetching.webhooks.services.security.ip import IPFilter -from glQiwiApi.event_fetching.webhooks.utils import inject_dependencies -from glQiwiApi.event_fetching.webhooks.views.bill_view import QiwiBillWebhookView -from glQiwiApi.event_fetching.webhooks.views.transaction_view import QiwiTransactionWebhookView +from glQiwiApi.core.event_fetching.webhooks.services.security.ip import IPFilter +from glQiwiApi.core.event_fetching.webhooks.utils import inject_dependencies +from glQiwiApi.core.event_fetching.webhooks.views.bill_view import QiwiBillWebhookView +from glQiwiApi.core.event_fetching.webhooks.views.transaction_view import ( + QiwiTransactionWebhookView, +) from glQiwiApi.qiwi.clients.p2p.types import BillWebhook from glQiwiApi.qiwi.clients.wallet.types.webhooks import TransactionWebhook diff --git a/glQiwiApi/event_fetching/webhooks/config.py b/glQiwiApi/core/event_fetching/webhooks/config.py similarity index 100% rename from glQiwiApi/event_fetching/webhooks/config.py rename to glQiwiApi/core/event_fetching/webhooks/config.py diff --git a/glQiwiApi/event_fetching/webhooks/dto/__init__.py b/glQiwiApi/core/event_fetching/webhooks/dto/__init__.py similarity index 100% rename from glQiwiApi/event_fetching/webhooks/dto/__init__.py rename to glQiwiApi/core/event_fetching/webhooks/dto/__init__.py diff --git a/glQiwiApi/event_fetching/webhooks/dto/errors.py b/glQiwiApi/core/event_fetching/webhooks/dto/errors.py similarity index 100% rename from glQiwiApi/event_fetching/webhooks/dto/errors.py rename to glQiwiApi/core/event_fetching/webhooks/dto/errors.py diff --git a/glQiwiApi/event_fetching/webhooks/middlewares/__init__.py b/glQiwiApi/core/event_fetching/webhooks/middlewares/__init__.py similarity index 100% rename from glQiwiApi/event_fetching/webhooks/middlewares/__init__.py rename to glQiwiApi/core/event_fetching/webhooks/middlewares/__init__.py diff --git a/glQiwiApi/event_fetching/webhooks/middlewares/ip.py b/glQiwiApi/core/event_fetching/webhooks/middlewares/ip.py similarity index 83% rename from glQiwiApi/event_fetching/webhooks/middlewares/ip.py rename to glQiwiApi/core/event_fetching/webhooks/middlewares/ip.py index 18ce9939..5a9c527f 100644 --- a/glQiwiApi/event_fetching/webhooks/middlewares/ip.py +++ b/glQiwiApi/core/event_fetching/webhooks/middlewares/ip.py @@ -5,8 +5,8 @@ from aiohttp.typedefs import Handler from aiohttp.web_middlewares import middleware -from glQiwiApi.event_fetching.webhooks.services.security.ip import IPFilter -from glQiwiApi.event_fetching.webhooks.utils import check_ip +from glQiwiApi.core.event_fetching.webhooks.services.security.ip import IPFilter +from glQiwiApi.core.event_fetching.webhooks.utils import check_ip logger = logging.getLogger('glQiwiApi.webhooks.middlewares') diff --git a/glQiwiApi/event_fetching/webhooks/services/__init__.py b/glQiwiApi/core/event_fetching/webhooks/services/__init__.py similarity index 100% rename from glQiwiApi/event_fetching/webhooks/services/__init__.py rename to glQiwiApi/core/event_fetching/webhooks/services/__init__.py diff --git a/glQiwiApi/event_fetching/webhooks/services/collision_detector.py b/glQiwiApi/core/event_fetching/webhooks/services/collision_detector.py similarity index 100% rename from glQiwiApi/event_fetching/webhooks/services/collision_detector.py rename to glQiwiApi/core/event_fetching/webhooks/services/collision_detector.py diff --git a/glQiwiApi/event_fetching/webhooks/services/security/__init__.py b/glQiwiApi/core/event_fetching/webhooks/services/security/__init__.py similarity index 100% rename from glQiwiApi/event_fetching/webhooks/services/security/__init__.py rename to glQiwiApi/core/event_fetching/webhooks/services/security/__init__.py diff --git a/glQiwiApi/event_fetching/webhooks/services/security/ip.py b/glQiwiApi/core/event_fetching/webhooks/services/security/ip.py similarity index 100% rename from glQiwiApi/event_fetching/webhooks/services/security/ip.py rename to glQiwiApi/core/event_fetching/webhooks/services/security/ip.py diff --git a/glQiwiApi/event_fetching/webhooks/utils.py b/glQiwiApi/core/event_fetching/webhooks/utils.py similarity index 96% rename from glQiwiApi/event_fetching/webhooks/utils.py rename to glQiwiApi/core/event_fetching/webhooks/utils.py index f9886ff7..1a672aca 100644 --- a/glQiwiApi/event_fetching/webhooks/utils.py +++ b/glQiwiApi/core/event_fetching/webhooks/utils.py @@ -8,7 +8,7 @@ from aiohttp.abc import AbstractView from aiohttp.web_request import Request -from glQiwiApi.event_fetching.webhooks.services.security.ip import IPFilter +from glQiwiApi.core.event_fetching.webhooks.services.security.ip import IPFilter def check_ip(ip_filter: IPFilter, request: web.Request) -> Tuple[str, bool]: diff --git a/glQiwiApi/event_fetching/webhooks/views/__init__.py b/glQiwiApi/core/event_fetching/webhooks/views/__init__.py similarity index 100% rename from glQiwiApi/event_fetching/webhooks/views/__init__.py rename to glQiwiApi/core/event_fetching/webhooks/views/__init__.py diff --git a/glQiwiApi/event_fetching/webhooks/views/base.py b/glQiwiApi/core/event_fetching/webhooks/views/base.py similarity index 92% rename from glQiwiApi/event_fetching/webhooks/views/base.py rename to glQiwiApi/core/event_fetching/webhooks/views/base.py index 0ca25031..ee386536 100644 --- a/glQiwiApi/event_fetching/webhooks/views/base.py +++ b/glQiwiApi/core/event_fetching/webhooks/views/base.py @@ -6,9 +6,9 @@ from aiohttp import web from aiohttp.web_request import Request -from glQiwiApi.event_fetching.dispatcher import BaseDispatcher -from glQiwiApi.event_fetching.webhooks.dto import WebhookAPIError -from glQiwiApi.event_fetching.webhooks.services.collision_detector import ( +from glQiwiApi.core.event_fetching.dispatcher import BaseDispatcher +from glQiwiApi.core.event_fetching.webhooks.dto import WebhookAPIError +from glQiwiApi.core.event_fetching.webhooks.services.collision_detector import ( AbstractCollisionDetector, UnexpectedCollision, ) diff --git a/glQiwiApi/event_fetching/webhooks/views/bill_view.py b/glQiwiApi/core/event_fetching/webhooks/views/bill_view.py similarity index 93% rename from glQiwiApi/event_fetching/webhooks/views/bill_view.py rename to glQiwiApi/core/event_fetching/webhooks/views/bill_view.py index 211c7639..d1b131cb 100644 --- a/glQiwiApi/event_fetching/webhooks/views/bill_view.py +++ b/glQiwiApi/core/event_fetching/webhooks/views/bill_view.py @@ -3,7 +3,7 @@ from aiohttp import web -from glQiwiApi.event_fetching.webhooks.views.base import BaseWebhookView +from glQiwiApi.core.event_fetching.webhooks.views.base import BaseWebhookView from glQiwiApi.qiwi.clients.p2p.types import BillWebhook from glQiwiApi.types.exceptions import WebhookSignatureUnverifiedError diff --git a/glQiwiApi/event_fetching/webhooks/views/transaction_view.py b/glQiwiApi/core/event_fetching/webhooks/views/transaction_view.py similarity index 87% rename from glQiwiApi/event_fetching/webhooks/views/transaction_view.py rename to glQiwiApi/core/event_fetching/webhooks/views/transaction_view.py index fe5ba5fc..0d969bcf 100644 --- a/glQiwiApi/event_fetching/webhooks/views/transaction_view.py +++ b/glQiwiApi/core/event_fetching/webhooks/views/transaction_view.py @@ -2,8 +2,8 @@ from aiohttp import web -from glQiwiApi.event_fetching.webhooks.dto import WebhookAPIError -from glQiwiApi.event_fetching.webhooks.views.base import BaseWebhookView +from glQiwiApi.core.event_fetching.webhooks.dto import WebhookAPIError +from glQiwiApi.core.event_fetching.webhooks.views.base import BaseWebhookView from glQiwiApi.qiwi.clients.wallet.types.webhooks import TransactionWebhook from glQiwiApi.types.exceptions import WebhookSignatureUnverifiedError diff --git a/tests/unit/test_event_fetching/test_webhook/test_app.py b/tests/unit/test_event_fetching/test_webhook/test_app.py index 99cddb0c..f36fe89c 100644 --- a/tests/unit/test_event_fetching/test_webhook/test_app.py +++ b/tests/unit/test_event_fetching/test_webhook/test_app.py @@ -4,11 +4,10 @@ from aiohttp.web_app import Application from aiohttp.web_request import Request -from glQiwiApi.event_fetching.dispatcher import QiwiDispatcher -from glQiwiApi.event_fetching.webhooks.app import configure_app -from glQiwiApi.event_fetching.webhooks.config import EncryptionConfig, WebhookConfig -from glQiwiApi.event_fetching.webhooks.middlewares.ip import ip_filter_middleware -from glQiwiApi.event_fetching.webhooks.services.security.ip import IPFilter +from glQiwiApi.core.event_fetching import IPFilter, QiwiDispatcher +from glQiwiApi.core.event_fetching.webhooks.app import configure_app +from glQiwiApi.core.event_fetching.webhooks.config import EncryptionConfig, WebhookConfig +from glQiwiApi.core.event_fetching.webhooks.middlewares.ip import ip_filter_middleware from tests.unit.test_event_fetching.mocks import WebhookTestData diff --git a/tests/unit/test_event_fetching/test_webhook/test_services/test_collision_detector.py b/tests/unit/test_event_fetching/test_webhook/test_services/test_collision_detector.py index debc17b4..9253c188 100644 --- a/tests/unit/test_event_fetching/test_webhook/test_services/test_collision_detector.py +++ b/tests/unit/test_event_fetching/test_webhook/test_services/test_collision_detector.py @@ -2,7 +2,7 @@ import pytest -from glQiwiApi.event_fetching.webhooks.services.collision_detector import ( +from glQiwiApi.core.event_fetching import ( HashBasedCollisionDetector, UnexpectedCollision, UnhashableObjectError, diff --git a/tests/unit/test_event_fetching/test_webhook/test_views/test_p2p_view.py b/tests/unit/test_event_fetching/test_webhook/test_views/test_p2p_view.py index 57d7b933..ef8b69f6 100644 --- a/tests/unit/test_event_fetching/test_webhook/test_views/test_p2p_view.py +++ b/tests/unit/test_event_fetching/test_webhook/test_views/test_p2p_view.py @@ -7,11 +7,8 @@ from aiohttp.web_app import Application from glQiwiApi.core import QiwiBillWebhookView -from glQiwiApi.event_fetching.dispatcher import QiwiDispatcher -from glQiwiApi.event_fetching.webhooks.services.collision_detector import ( - HashBasedCollisionDetector, -) -from glQiwiApi.event_fetching.webhooks.utils import inject_dependencies +from glQiwiApi.core.event_fetching import HashBasedCollisionDetector, QiwiDispatcher +from glQiwiApi.core.event_fetching.webhooks.utils import inject_dependencies from glQiwiApi.qiwi.clients.p2p.types import BillWebhook from tests.unit.test_event_fetching.mocks import WebhookTestData diff --git a/tests/unit/test_event_fetching/test_webhook/test_views/test_txn_view.py b/tests/unit/test_event_fetching/test_webhook/test_views/test_txn_view.py index 619369bc..be28db97 100644 --- a/tests/unit/test_event_fetching/test_webhook/test_views/test_txn_view.py +++ b/tests/unit/test_event_fetching/test_webhook/test_views/test_txn_view.py @@ -9,12 +9,10 @@ from aiohttp.web_app import Application from glQiwiApi.core import QiwiTransactionWebhookView +from glQiwiApi.core.event_fetching import HashBasedCollisionDetector from glQiwiApi.core.event_fetching.dispatcher import QiwiDispatcher +from glQiwiApi.core.event_fetching.webhooks.dto import WebhookAPIError from glQiwiApi.core.event_fetching.webhooks.utils import inject_dependencies -from glQiwiApi.event_fetching.webhooks.dto import WebhookAPIError -from glQiwiApi.event_fetching.webhooks.services.collision_detector import ( - HashBasedCollisionDetector, -) from glQiwiApi.qiwi.clients.wallet.types import TransactionWebhook from tests.unit.test_event_fetching.mocks import WebhookTestData