Skip to content
Closed
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
9 changes: 5 additions & 4 deletions examples/utils/streaming_classify_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import typing
from collections.abc import AsyncIterator

from resolver_athena_client.generated.athena.models_pb2 import (
ClassificationOutput,
ClassifyResponse,
)

from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions
from resolver_athena_client.client.channel import (
Expand All @@ -17,10 +22,6 @@
has_output_errors,
process_classification_outputs,
)
from resolver_athena_client.generated.athena.models_pb2 import (
ClassificationOutput,
ClassifyResponse,
)

T = typing.TypeVar("T")

Expand Down
20 changes: 10 additions & 10 deletions src/resolver_athena_client/client/athena_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
from collections.abc import AsyncGenerator, AsyncIterable, AsyncIterator

import grpc
from resolver_athena_client.generated.athena.models_pb2 import (
ClassificationInput,
ClassificationOutput,
ClassifyRequest,
ClassifyResponse,
HashType,
ImageFormat,
ImageHash,
RequestEncoding,
)
from typing_extensions import Self

from resolver_athena_client.client.athena_options import AthenaOptions
Expand All @@ -19,16 +29,6 @@
from resolver_athena_client.client.transformers.worker_batcher import (
WorkerBatcher,
)
from resolver_athena_client.generated.athena.models_pb2 import (
ClassificationInput,
ClassificationOutput,
ClassifyRequest,
ClassifyResponse,
HashType,
ImageFormat,
ImageHash,
RequestEncoding,
)
from resolver_athena_client.grpc_wrappers.classifier_service import (
ClassifierServiceClient,
)
Expand Down
4 changes: 2 additions & 2 deletions src/resolver_athena_client/client/deployment_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from types import TracebackType

import grpc
from typing_extensions import Self

from resolver_athena_client.generated.athena.models_pb2 import (
ListDeploymentsResponse,
)
from typing_extensions import Self

from resolver_athena_client.grpc_wrappers.classifier_service import (
ClassifierServiceClient,
)
Expand Down
2 changes: 1 addition & 1 deletion src/resolver_athena_client/client/transformers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import brotli
import cv2 as cv
import numpy as np
from resolver_athena_client.generated.athena.models_pb2 import ImageFormat

from resolver_athena_client.client.consts import EXPECTED_HEIGHT, EXPECTED_WIDTH
from resolver_athena_client.client.models import ImageData
from resolver_athena_client.generated.athena.models_pb2 import ImageFormat

# Global optimization constants
_target_size = (EXPECTED_WIDTH, EXPECTED_HEIGHT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from google.protobuf.empty_pb2 import Empty
from grpc import aio

from resolver_athena_client.generated.athena.athena_pb2_grpc import (
ClassifierServiceStub,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/client/models/test_image_data.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Tests for ImageData model."""

import pytest
from resolver_athena_client.generated.athena.models_pb2 import ImageFormat

from resolver_athena_client.client.models import ImageData
from resolver_athena_client.generated.athena.models_pb2 import ImageFormat


def test_image_data_detects_png_format() -> None:
Expand Down
10 changes: 5 additions & 5 deletions tests/client/test_athena_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

import pytest
from grpc import aio

from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions
from resolver_athena_client.client.exceptions import AthenaError
from resolver_athena_client.client.models import ImageData
from resolver_athena_client.generated.athena.models_pb2 import (
ClassificationError,
ClassificationOutput,
ClassifyResponse,
ErrorCode,
)

from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions
from resolver_athena_client.client.exceptions import AthenaError
from resolver_athena_client.client.models import ImageData
from resolver_athena_client.grpc_wrappers.classifier_service import (
ClassifierServiceClient,
)
Expand Down
4 changes: 2 additions & 2 deletions tests/client/test_deployment_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import pytest
from grpc import aio

from resolver_athena_client.client.deployment_selector import DeploymentSelector
from resolver_athena_client.generated.athena.models_pb2 import (
Deployment,
ListDeploymentsResponse,
)

from resolver_athena_client.client.deployment_selector import DeploymentSelector
from resolver_athena_client.grpc_wrappers.classifier_service import (
ClassifierServiceClient,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/client/test_image_format_detector.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Tests for image format detection."""

import pytest
from resolver_athena_client.generated.athena.models_pb2 import ImageFormat

from resolver_athena_client.client.image_format_detector import (
detect_image_format,
)
from resolver_athena_client.generated.athena.models_pb2 import ImageFormat


def test_detect_png_format() -> None:
Expand Down
14 changes: 7 additions & 7 deletions tests/client/test_output_error_handling.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
"""Test classification output error handling functionality."""

import pytest
from resolver_athena_client.generated.athena.models_pb2 import (
Classification,
ClassificationError,
ClassificationOutput,
ClassifyResponse,
ErrorCode,
)

from resolver_athena_client.client.exceptions import ClassificationOutputError
from resolver_athena_client.client.utils import (
Expand All @@ -10,13 +17,6 @@
log_output_errors,
process_classification_outputs,
)
from resolver_athena_client.generated.athena.models_pb2 import (
Classification,
ClassificationError,
ClassificationOutput,
ClassifyResponse,
ErrorCode,
)

# Test constants
EXPECTED_SUCCESS_COUNT = 2
Expand Down
8 changes: 4 additions & 4 deletions tests/client/test_timeout_behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
import pytest
from grpc import StatusCode
from grpc.aio._call import AioRpcError

from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions
from resolver_athena_client.client.models import ImageData
from resolver_athena_client.generated.athena.models_pb2 import (
ClassificationOutput,
ClassifyResponse,
)

from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions
from resolver_athena_client.client.models import ImageData


class MockGrpcError(AioRpcError):
"""Mock gRPC error for testing."""
Expand Down
8 changes: 4 additions & 4 deletions tests/client/transformers/test_worker_batcher_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import asyncio

import pytest

from resolver_athena_client.client.transformers.worker_batcher import (
WorkerBatcher,
)
from resolver_athena_client.generated.athena.models_pb2 import (
ClassificationInput,
ClassifyRequest,
RequestEncoding,
)

from resolver_athena_client.client.transformers.worker_batcher import (
WorkerBatcher,
)

# Test constants for various batch scenarios
FULL_BATCH_SIZE = 3
LARGE_BATCH_SIZE = 5
Expand Down
2 changes: 1 addition & 1 deletion tests/grpc_wrappers/classifier_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import pytest
from google.protobuf.empty_pb2 import Empty

from resolver_athena_client.generated.athena.models_pb2 import (
ClassifyResponse,
ListDeploymentsResponse,
)

from resolver_athena_client.grpc_wrappers.classifier_service import (
ClassifierServiceClient,
)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_classify_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
import grpc.aio
import numpy as np
import pytest

from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions
from resolver_athena_client.client.exceptions import AthenaError
from resolver_athena_client.client.models import ImageData
from resolver_athena_client.generated.athena.models_pb2 import (
Classification,
ClassificationError,
Expand All @@ -24,6 +19,11 @@
RequestEncoding,
)

from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions
from resolver_athena_client.client.exceptions import AthenaError
from resolver_athena_client.client.models import ImageData


@pytest.fixture
def athena_options() -> AthenaOptions:
Expand Down
9 changes: 5 additions & 4 deletions tests/utils/streaming_classify_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import typing
from collections.abc import AsyncIterator

from resolver_athena_client.generated.athena.models_pb2 import (
ClassificationOutput,
ClassifyResponse,
)

from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions
from resolver_athena_client.client.channel import (
Expand All @@ -15,10 +20,6 @@
has_output_errors,
process_classification_outputs,
)
from resolver_athena_client.generated.athena.models_pb2 import (
ClassificationOutput,
ClassifyResponse,
)

T = typing.TypeVar("T")

Expand Down
Loading
Loading