Skip to content

Commit 45df1d4

Browse files
authored
CI: run the test suite and checks on every pull request (#5)
1 parent 59f0cf0 commit 45df1d4

2 files changed

Lines changed: 30 additions & 5 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
name: Test (Python ${{ matrix.python }})
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python: ["3.10", "3.12"]
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ matrix.python }}
20+
- run: pip install -e ".[dev]"
21+
- name: Type-check
22+
run: mypy livexface
23+
- name: Test
24+
run: pytest -q tests

‎livexface/client.py‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import builtins
56
import json
67
from pathlib import Path
78
from typing import Any, IO, Sequence, Union
@@ -291,7 +292,7 @@ def compare(
291292
def batch_register(
292293
self,
293294
collection_id: str,
294-
items: list[dict[str, Any]],
295+
items: builtins.list[dict[str, Any]],
295296
) -> BatchResponse:
296297
"""
297298
Batch register up to 20 faces in a single request.
@@ -308,7 +309,7 @@ def batch_register(
308309
])
309310
"""
310311
files: dict[str, Any] = {}
311-
entries = []
312+
entries: builtins.list[dict[str, Any]] = []
312313
for i, item in enumerate(items):
313314
fname, fbytes, ftype = _to_bytes_tuple(item["image"])
314315
files[f"images[{i}]"] = (fname, fbytes, ftype)
@@ -327,7 +328,7 @@ def batch_register(
327328
)
328329
return BatchResponse.from_dict(resp)
329330

330-
def batch_delete(self, collection_id: str, face_ids: list[str]) -> BatchDeleteResponse:
331+
def batch_delete(self, collection_id: str, face_ids: builtins.list[str]) -> BatchDeleteResponse:
331332
"""Batch delete up to 100 faces by their IDs."""
332333
resp = self._c._request(
333334
"DELETE",
@@ -349,7 +350,7 @@ def attributes(self, collection_id: str, image: ImageInput) -> AttributesResult:
349350
def batch_register_async(
350351
self,
351352
collection_id: str,
352-
items: list[dict[str, Any]],
353+
items: builtins.list[dict[str, Any]],
353354
) -> BatchJob:
354355
"""
355356
Submit up to 100 faces for asynchronous registration. Returns a job
@@ -361,7 +362,7 @@ def batch_register_async(
361362
:meth:`active_liveness`) are also supported.
362363
"""
363364
files: dict[str, Any] = {}
364-
entries = []
365+
entries: builtins.list[dict[str, Any]] = []
365366
for i, item in enumerate(items):
366367
fname, fbytes, ftype = _to_bytes_tuple(item["image"])
367368
files[f"images[{i}]"] = (fname, fbytes, ftype)

0 commit comments

Comments
 (0)