|
48 | 48 | )
|
49 | 49 |
|
50 | 50 |
|
51 |
| -def extract_bug_id_from_item_id(item_id: str) -> int: |
| 51 | +def extract_bug_id_from_item_id(item_id: str) -> str: |
52 | 52 | if match := re.search(ITEM_ID_PATTERN, item_id):
|
53 | 53 | return match.group("bug_id")
|
54 | 54 | raise ValueError(
|
@@ -141,7 +141,7 @@ def get(self, bug_id: int) -> AsyncIterator[QueueItem]:
|
141 | 141 | pass
|
142 | 142 |
|
143 | 143 | @abstractmethod
|
144 |
| - async def exists(self, item_id: int) -> bool: |
| 144 | + async def exists(self, item_id: str) -> bool: |
145 | 145 | """
|
146 | 146 | Report whether an item with id `item_id` exists in the queue
|
147 | 147 | """
|
@@ -227,7 +227,8 @@ async def exists(self, item_id: str) -> bool:
|
227 | 227 | return False
|
228 | 228 |
|
229 | 229 | item_path = (self.location / bug_id / item_id).with_suffix(".json")
|
230 |
| - return item_path.exists() |
| 230 | + # even though pathlib.Path.exists() returns a bool, mypy doesn't seem to get it |
| 231 | + return bool(item_path.exists()) |
231 | 232 |
|
232 | 233 | async def get(self, bug_id: int) -> AsyncIterator[QueueItem]:
|
233 | 234 | folder = self.location / str(bug_id)
|
@@ -364,4 +365,4 @@ async def delete(self, item_id) -> None:
|
364 | 365 | Remove an item from the queue by item_id
|
365 | 366 | """
|
366 | 367 | bug_id = extract_bug_id_from_item_id(item_id)
|
367 |
| - await self.backend.remove(bug_id=bug_id, identifier=item_id) |
| 368 | + await self.backend.remove(bug_id=int(bug_id), identifier=item_id) |
0 commit comments