Skip to content

Commit 136f790

Browse files
committed
Fix issues reported by mypy
1 parent 02f4f32 commit 136f790

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

jbi/queue.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
)
4949

5050

51-
def extract_bug_id_from_item_id(item_id: str) -> int:
51+
def extract_bug_id_from_item_id(item_id: str) -> str:
5252
if match := re.search(ITEM_ID_PATTERN, item_id):
5353
return match.group("bug_id")
5454
raise ValueError(
@@ -141,7 +141,7 @@ def get(self, bug_id: int) -> AsyncIterator[QueueItem]:
141141
pass
142142

143143
@abstractmethod
144-
async def exists(self, item_id: int) -> bool:
144+
async def exists(self, item_id: str) -> bool:
145145
"""
146146
Report whether an item with id `item_id` exists in the queue
147147
"""
@@ -227,7 +227,8 @@ async def exists(self, item_id: str) -> bool:
227227
return False
228228

229229
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())
231232

232233
async def get(self, bug_id: int) -> AsyncIterator[QueueItem]:
233234
folder = self.location / str(bug_id)
@@ -364,4 +365,4 @@ async def delete(self, item_id) -> None:
364365
Remove an item from the queue by item_id
365366
"""
366367
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

Comments
 (0)