Skip to content

Commit 4736b23

Browse files
committed
Improve matching for local manifests in debug mode
1 parent 5de7f9e commit 4736b23

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/examples/cvat/exchange-oracle/debug.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from collections.abc import Generator
44
from contextlib import ExitStack, contextmanager
55
from logging import Logger
6-
from pathlib import Path
6+
from pathlib import Path, PurePosixPath
77
from typing import Any
88
from unittest import mock
99

@@ -62,7 +62,9 @@ def patched_get_escrow(chain_id: int, escrow_address: str) -> EscrowData:
6262
minio_manifests = minio_client.list_files(bucket="manifests")
6363
logger.debug(f"DEV: Local manifests: {format_sequence(minio_manifests)}")
6464

65-
candidate_files = [fn for fn in minio_manifests if f"{escrow_address}.json" in fn]
65+
candidate_files = [
66+
fn for fn in minio_manifests if PurePosixPath(fn).name == f"{escrow_address}.json"
67+
]
6668
if not candidate_files:
6769
return original_get_escrow(ChainId(chain_id), escrow_address)
6870
elif len(candidate_files) != 1:

packages/examples/cvat/recording-oracle/debug.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from collections.abc import Generator
33
from contextlib import ExitStack, contextmanager
44
from logging import Logger
5+
from pathlib import PurePosixPath
56
from unittest import mock
67

78
import uvicorn
@@ -27,7 +28,9 @@ def patched_get_escrow(chain_id: int, escrow_address: str) -> EscrowData:
2728
minio_manifests = minio_client.list_files(bucket="manifests")
2829
logger.debug(f"DEV: Local manifests: {format_sequence(minio_manifests)}")
2930

30-
candidate_files = [fn for fn in minio_manifests if f"{escrow_address}.json" in fn]
31+
candidate_files = [
32+
fn for fn in minio_manifests if PurePosixPath(fn).name == f"{escrow_address}.json"
33+
]
3134
if not candidate_files:
3235
return original_get_escrow(ChainId(chain_id), escrow_address)
3336
if len(candidate_files) != 1:

0 commit comments

Comments
 (0)