File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ """Utility package for testing and examples.
2+
3+ This package contains helper functions that are not core to the client library,
4+ but are shared across the examples and the tests.
5+ """
Original file line number Diff line number Diff line change @@ -203,18 +203,7 @@ async def rate_limited_image_iter(
203203def create_random_image_generator (
204204 max_images : int , rate_limit_min_interval_ms : int | None = None
205205) -> AsyncIterator [ImageData ]:
206- """Generate a stream of random test images.
207-
208- Args:
209- ----
210- max_images: Maximum number of images to generate
211- rate_limit_min_interval_ms: Minimum interval in ms between images
212-
213- Yields:
214- ------
215- ImageData objects containing random image bytes
216-
217- """
206+ """Create an async generator for images with optional rate limiting."""
218207 if rate_limit_min_interval_ms is not None :
219208 return rate_limited_image_iter (rate_limit_min_interval_ms , max_images )
220209
Original file line number Diff line number Diff line change 1010
1111from dotenv import load_dotenv
1212
13+ from common_utils .image_generation import create_test_image
1314from resolver_athena_client .client .athena_client import AthenaClient
1415from resolver_athena_client .client .athena_options import AthenaOptions
1516from resolver_athena_client .client .channel import (
1819)
1920from resolver_athena_client .client .consts import MAX_DEPLOYMENT_ID_LENGTH
2021from resolver_athena_client .client .models import ImageData
21- from resolver_athena_client .image_generation import create_test_image
2222
2323
2424async def classify_single_image_example (
Original file line number Diff line number Diff line change 1010
1111from dotenv import load_dotenv
1212
13+ from common_utils .image_generation import iter_images
1314from examples .utils .streaming_classify_utils import count_and_yield
1415from resolver_athena_client .client .athena_client import AthenaClient
1516from resolver_athena_client .client .athena_options import AthenaOptions
2324 has_output_errors ,
2425 process_classification_outputs ,
2526)
26- from resolver_athena_client .image_generation import iter_images
2727
2828# Constants
2929INITIAL_PROGRESS_THRESHOLD = 10
Original file line number Diff line number Diff line change 11import pytest
22
3+ from common_utils .image_generation import create_test_image
34from resolver_athena_client .client .athena_client import AthenaClient
45from resolver_athena_client .client .athena_options import AthenaOptions
56from resolver_athena_client .client .channel import (
67 CredentialHelper ,
78 create_channel_with_credentials ,
89)
910from resolver_athena_client .client .models import ImageData
10- from resolver_athena_client .image_generation import create_test_image
1111
1212
1313@pytest .mark .asyncio
Original file line number Diff line number Diff line change 33
44import pytest
55
6+ from common_utils .image_generation import create_random_image_generator
67from resolver_athena_client .client .athena_options import AthenaOptions
78from resolver_athena_client .client .channel import CredentialHelper
8- from resolver_athena_client .image_generation import (
9- create_random_image_generator ,
10- )
119from tests .utils .streaming_classify_utils import (
1210 classify_images ,
1311 classify_images_break_on_first_result ,
Original file line number Diff line number Diff line change 33import pytest
44from dotenv import load_dotenv
55
6+ from common_utils .image_generation import create_test_image
67from resolver_athena_client .client .athena_client import AthenaClient
78from resolver_athena_client .client .athena_options import AthenaOptions
89from resolver_athena_client .client .channel import (
1112)
1213from resolver_athena_client .client .exceptions import AthenaError
1314from resolver_athena_client .client .models import ImageData
14- from resolver_athena_client .image_generation import create_test_image
1515
1616
1717@pytest .mark .asyncio
Original file line number Diff line number Diff line change 33
44import pytest
55
6+ from common_utils .image_generation import create_test_image
67from resolver_athena_client .client .athena_client import AthenaClient
78from resolver_athena_client .client .athena_options import AthenaOptions
89from resolver_athena_client .client .channel import (
1213from resolver_athena_client .client .consts import EXPECTED_HEIGHT , EXPECTED_WIDTH
1314from resolver_athena_client .client .exceptions import AthenaError
1415from resolver_athena_client .client .models import ImageData
15- from resolver_athena_client .image_generation import create_test_image
1616from tests .utils .streaming_classify_utils import classify_images
1717
1818
Original file line number Diff line number Diff line change 55from dotenv import load_dotenv
66from grpc .aio import Channel
77
8+ from common_utils .image_generation import create_test_image
89from resolver_athena_client .client .athena_client import AthenaClient
910from resolver_athena_client .client .athena_options import AthenaOptions
1011from resolver_athena_client .client .models .input_model import ImageData
11- from resolver_athena_client .image_generation import create_test_image
1212
1313
1414def create_channel (host : str , token : str ) -> Channel :
Original file line number Diff line number Diff line change 11import pytest
22
3+ from common_utils .image_generation import iter_images
34from resolver_athena_client .client .athena_client import AthenaClient
45from resolver_athena_client .client .athena_options import AthenaOptions
56from resolver_athena_client .client .channel import (
67 CredentialHelper ,
78 create_channel_with_credentials ,
89)
910from resolver_athena_client .client .deployment_selector import DeploymentSelector
10- from resolver_athena_client .image_generation import iter_images
1111
1212
1313@pytest .mark .asyncio
You can’t perform that action at this time.
0 commit comments