Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
push:
branches: [main]
pull_request:

jobs:
test:
name: Test (Python ${{ matrix.python }})
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: pip install -e ".[dev]"
- name: Type-check
run: mypy livexface
- name: Test
run: pytest -q tests
11 changes: 6 additions & 5 deletions livexface/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import builtins
import json
from pathlib import Path
from typing import Any, IO, Sequence, Union
Expand Down Expand Up @@ -291,7 +292,7 @@ def compare(
def batch_register(
self,
collection_id: str,
items: list[dict[str, Any]],
items: builtins.list[dict[str, Any]],
) -> BatchResponse:
"""
Batch register up to 20 faces in a single request.
Expand All @@ -308,7 +309,7 @@ def batch_register(
])
"""
files: dict[str, Any] = {}
entries = []
entries: builtins.list[dict[str, Any]] = []
for i, item in enumerate(items):
fname, fbytes, ftype = _to_bytes_tuple(item["image"])
files[f"images[{i}]"] = (fname, fbytes, ftype)
Expand All @@ -327,7 +328,7 @@ def batch_register(
)
return BatchResponse.from_dict(resp)

def batch_delete(self, collection_id: str, face_ids: list[str]) -> BatchDeleteResponse:
def batch_delete(self, collection_id: str, face_ids: builtins.list[str]) -> BatchDeleteResponse:
"""Batch delete up to 100 faces by their IDs."""
resp = self._c._request(
"DELETE",
Expand All @@ -349,7 +350,7 @@ def attributes(self, collection_id: str, image: ImageInput) -> AttributesResult:
def batch_register_async(
self,
collection_id: str,
items: list[dict[str, Any]],
items: builtins.list[dict[str, Any]],
) -> BatchJob:
"""
Submit up to 100 faces for asynchronous registration. Returns a job
Expand All @@ -361,7 +362,7 @@ def batch_register_async(
:meth:`active_liveness`) are also supported.
"""
files: dict[str, Any] = {}
entries = []
entries: builtins.list[dict[str, Any]] = []
for i, item in enumerate(items):
fname, fbytes, ftype = _to_bytes_tuple(item["image"])
files[f"images[{i}]"] = (fname, fbytes, ftype)
Expand Down
Loading