AOSSIE-Org / AOSSIE-Org/PictoPy

BUG: Backend: Type mismatches in backend, can crash backend on edge cases and unexpected inputs

Aberta
#1,027 2 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
283
Forks
679
Merge médio
7d 2h
PRs com merge (30d)
3

Descrição

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

Tool used
- pyright to find type mismatches

## Found mismatches

### albums.py
- Line 92: Type Mismatch: None cannot be assigned to parameter of type str.
- Line 119: Type Mismatch: None cannot be assigned to parameter of type str.

### faces.py
- Line 92: Type Mismatch: Type int | None is not assignable to return type FaceId (expected int).
- Line 134: Argument Mismatches in db_insert_face_embeddings:
- confidence: List[float] not assignable to float | None.
- bbox: List[BoundingBox] not assignable to BoundingBox | None.
- cluster_id: List[ClusterId] not assignable to ClusterId | None.
- Line 140: Argument Mismatches in db_insert_face_embeddings:
- embeddings: List[FaceEmbedding] not assignable to FaceEmbedding.
- confidence: List[float] not assignable to float | None.
- bbox: List[BoundingBox] not assignable to BoundingBox | None.
- cluster_id: List[ClusterId] not assignable to ClusterId | None.

### FaceDetector.py
- Line 39: Optional Member: "conf_threshold" is not a known attribute of "None".
- Line 55: Optional Member: "get_embedding" is not a known attribute of "None".

### ObjectClassifier.py
- Line 21: Optional Access: Object of type None cannot be called.

### albums.py
- Line 67: Argument Mismatch: str | None cannot be assigned to description and password of type str.
- Line 157: Argument Mismatch: str | None cannot be assigned to description and password of type str.

### facecluster.py
- Line 123-126: Argument Mismatches (__init__): cluster_id, cluster_name, face_count, face_image_base64 receiving incorrect types (int/None instead of str).
- Line 174-180: Argument Mismatches (__init__): id, path, thumbnailPath, metadata, face_id, confidence, bbox receiving incorrect types.
- Line 298: Argument Mismatch: image_path receives str | None but expects str.

### folder.py
- Line 392: Argument Mismatch: str cannot be assigned to parameter folder_id of type int.

### images.py
- Line 66: Argument Mismatch: Mapping[str, Any] cannot be assigned to parameter metadata of type MetadataModel.

### YOLO.py
- Line 180: Argument Mismatch: ndarray passed to color (expected tuple).
- Line 182: Argument Mismatch: ndarray passed to color (expected tuple).
- Line 240: Call Issue: rectangle function call mismatch, and thickness receives ndarray instead of int.

### face_clusters.py
- Line 137: List Invariance: list[Dict[...]] is not assignable to List[Dict[str, FaceId]].
- Line 192: Type Mismatch: None assigned to float.
- Line 222: Argument Mismatch: embedding type mismatch in _validate_embedding.
- Line 359: Argument Mismatch: embedding type mismatch in _validate_embedding.
- Line 386: Argument Mismatch: embedding type mismatch in _validate_embedding.
- Line 392: Argument Mismatch: face_embedding type mismatch in _calculate_cosine_distances.

### images.py
- Line 96: List Invariance: List[UntaggedImageRecord] argument passed to List[Dict[str, str]].
- Line 119: Type Mismatch: len() on list[int] | None.
- Line 121: Optional Iterable: Iterating over object that is potentially None.
- Line 307: Return Type: None returned where int is expected.
- Line 412: Call Issue: get method called with str | None key where str is expected.

I would like to work on this issue

### Record

- [x] I agree to follow this project's Code of Conduct

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.