11import datetime
2+ import inspect
23import json
4+ import uuid
35from collections .abc import Generator
46from contextlib import ExitStack , contextmanager
57from logging import Logger
68from pathlib import Path , PurePosixPath
79from typing import Any
810from unittest import mock
911
10- import inspect
11- import uuid
1212import uvicorn
1313from httpx import URL
1414
@@ -31,9 +31,7 @@ def _mock_cvat_cloud_storage_params(logger: Logger) -> Generator[None, None, Non
3131 def patched_make_cvat_cloud_storage_params (bucket_info : BucketAccessInfo ) -> dict :
3232 original_host_url = bucket_info .host_url
3333
34- if Config .development_config .cvat_in_docker and (
35- "localhost" in original_host_url or "127.0.0.1" in original_host_url
36- ):
34+ if Config .development_config .cvat_in_docker :
3735 bucket_info .host_url = str (
3836 URL (original_host_url ).copy_with (
3937 host = Config .development_config .exchange_oracle_host
@@ -155,10 +153,10 @@ def create_webhook(
155153 escrow_address ,
156154 chain_id ,
157155 type : OracleWebhookTypes ,
158- signature = None ,
159- event_type = None ,
160- event_data = None ,
161- event = None ,
156+ signature = None ,
157+ event_type = None ,
158+ event_data = None ,
159+ event = None ,
162160 ):
163161 if signature in OracleWebhookTypes :
164162 signature = f"{ type .value } -{ utcnow ().isoformat (sep = 'T' )} -{ uuid .uuid4 ()} "
@@ -177,7 +175,7 @@ def create_webhook(
177175 "src.endpoints.webhook.validate_oracle_webhook_signature" ,
178176 patched_validate_oracle_webhook_signature ,
179177 ),
180- mock .patch ("src.services.webhook.inbox" , PatchedInbox ())
178+ mock .patch ("src.services.webhook.inbox" , PatchedInbox ()),
181179 ):
182180 yield
183181
@@ -270,6 +268,7 @@ def apply_local_development_patches() -> Generator[None, None, None]:
270268
271269 yield
272270
271+
273272if __name__ == "__main__" :
274273 with ExitStack () as es :
275274 is_dev = Config .environment == "development"
0 commit comments