Skip to content

Commit 383cb6d

Browse files
build: Suppress Lint Warnings
1 parent 53bab88 commit 383cb6d

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

src/resolver_athena_client/client/image_format_detector.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from resolver_athena_client.generated.athena.models_pb2 import ImageFormat
44

55

6-
def detect_image_format(data: bytes) -> ImageFormat.ValueType:
6+
def detect_image_format(data: bytes) -> ImageFormat.ValueType: # noqa: PLR0911
77
"""Detect image format from raw bytes using magic number signatures.
88
99
Args:
@@ -20,27 +20,27 @@ def detect_image_format(data: bytes) -> ImageFormat.ValueType:
2020

2121
# Check magic numbers for common image formats
2222
# PNG: starts with \x89PNG (need at least 4 bytes)
23-
if len(data) >= 4 and data[:4] == b"\x89PNG":
23+
if len(data) >= 4 and data[:4] == b"\x89PNG": # noqa: PLR2004
2424
return ImageFormat.IMAGE_FORMAT_PNG
2525

2626
# JPEG: starts with \xFF\xD8\xFF (need at least 3 bytes)
27-
if len(data) >= 3 and data[:3] == b"\xFF\xD8\xFF":
27+
if len(data) >= 3 and data[:3] == b"\xFF\xD8\xFF": # noqa: PLR2004
2828
return ImageFormat.IMAGE_FORMAT_JPEG
2929

3030
# GIF: starts with GIF87a or GIF89a (need at least 6 bytes)
31-
if len(data) >= 6 and data[:6] in (b"GIF87a", b"GIF89a"):
31+
if len(data) >= 6 and data[:6] in (b"GIF87a", b"GIF89a"): # noqa: PLR2004
3232
return ImageFormat.IMAGE_FORMAT_GIF
3333

3434
# BMP: starts with BM (need at least 2 bytes)
35-
if len(data) >= 2 and data[:2] == b"BM":
35+
if len(data) >= 2 and data[:2] == b"BM": # noqa: PLR2004
3636
return ImageFormat.IMAGE_FORMAT_BMP
3737

3838
# WebP: starts with RIFF....WEBP (need at least 12 bytes)
39-
if len(data) >= 12 and data[:4] == b"RIFF" and data[8:12] == b"WEBP":
39+
if len(data) >= 12 and data[:4] == b"RIFF" and data[8:12] == b"WEBP": # noqa: PLR2004
4040
return ImageFormat.IMAGE_FORMAT_WEBP
4141

4242
# TIFF: starts with II* or MM* (need at least 4 bytes)
43-
if len(data) >= 4 and data[:4] in (b"II*\x00", b"MM\x00*"):
43+
if len(data) >= 4 and data[:4] in (b"II*\x00", b"MM\x00*"): # noqa: PLR2004
4444
return ImageFormat.IMAGE_FORMAT_TIFF
4545

4646
# If we can't detect the format, return UNSPECIFIED

src/resolver_athena_client/client/models/input_model.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
consistent input handling across the application.
66
"""
77

8+
from __future__ import annotations
9+
810
import hashlib
11+
from typing import TYPE_CHECKING
912

1013
from resolver_athena_client.client.image_format_detector import (
1114
detect_image_format,
1215
)
13-
from resolver_athena_client.generated.athena.models_pb2 import ImageFormat
16+
17+
if TYPE_CHECKING:
18+
from resolver_athena_client.generated.athena.models_pb2 import ImageFormat
1419

1520

1621
class ImageData:

tests/client/models/test_image_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def test_image_data_transformation_preserves_format() -> None:
7878

7979
# Format should still be PNG (transformers will update it if needed)
8080
assert image_data.image_format == ImageFormat.IMAGE_FORMAT_PNG
81-
assert len(image_data.sha256_hashes) == 2
82-
assert len(image_data.md5_hashes) == 2
81+
assert len(image_data.sha256_hashes) == 2 # noqa: PLR2004
82+
assert len(image_data.md5_hashes) == 2 # noqa: PLR2004
8383

8484

8585
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)