Skip to content

Commit d33766e

Browse files
committed
PR feedback; one default for 1k page size
1 parent f824b03 commit d33766e

9 files changed

Lines changed: 30 additions & 43 deletions

File tree

python/lib/sift_client/_internal/low_level_wrappers/assets.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
from sift.assets.v1.assets_pb2_grpc import AssetServiceStub
1616

1717
from sift_client._internal.low_level_wrappers.base import (
18+
DEFAULT_PAGE_SIZE,
1819
LowLevelClientBase,
1920
)
2021
from sift_client.sift_types.asset import Asset, AssetUpdate
2122
from sift_client.transport import GrpcClient, WithGrpcClient
2223

23-
ASSETS_DEFAULT_PAGE_SIZE = 1000
24-
2524

2625
class AssetsLowLevelClient(LowLevelClientBase, WithGrpcClient):
2726
"""Low-level client for the AssetsAPI.
@@ -48,7 +47,7 @@ async def list_all_assets(
4847
query_filter: str | None = None,
4948
order_by: str | None = None,
5049
max_results: int | None = None,
51-
page_size: int | None = ASSETS_DEFAULT_PAGE_SIZE,
50+
page_size: int | None = DEFAULT_PAGE_SIZE,
5251
) -> list[Asset]:
5352
"""List all results matching the given query.
5453
@@ -72,7 +71,7 @@ async def list_all_assets(
7271

7372
async def list_assets(
7473
self,
75-
page_size: int | None = ASSETS_DEFAULT_PAGE_SIZE,
74+
page_size: int | None = DEFAULT_PAGE_SIZE,
7675
page_token: str | None = None,
7776
query_filter: str | None = None,
7877
order_by: str | None = None,

python/lib/sift_client/_internal/low_level_wrappers/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
from abc import ABC
44
from typing import Any, Callable
55

6+
DEFAULT_PAGE_SIZE = 1000
7+
"""Default page size to use for pagination."""
8+
69

710
class LowLevelClientBase(ABC):
811
@staticmethod

python/lib/sift_client/_internal/low_level_wrappers/calculated_channels.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818
from sift.calculated_channels.v2.calculated_channels_pb2_grpc import CalculatedChannelServiceStub
1919

20-
from sift_client._internal.low_level_wrappers.base import LowLevelClientBase
20+
from sift_client._internal.low_level_wrappers.base import DEFAULT_PAGE_SIZE, LowLevelClientBase
2121
from sift_client.sift_types.calculated_channel import (
2222
CalculatedChannel,
2323
CalculatedChannelCreate,
@@ -27,8 +27,6 @@
2727

2828
logger = logging.getLogger(__name__)
2929

30-
CALCULATED_CHANNELS_DEFAULT_PAGE_SIZE = 1000
31-
3230

3331
class CalculatedChannelsLowLevelClient(LowLevelClientBase, WithGrpcClient):
3432
"""Low-level client for the CalculatedChannelsAPI.
@@ -93,7 +91,7 @@ async def list_all_calculated_channels(
9391
query_filter: str | None = None,
9492
order_by: str | None = None,
9593
max_results: int | None = None,
96-
page_size: int | None = CALCULATED_CHANNELS_DEFAULT_PAGE_SIZE,
94+
page_size: int | None = DEFAULT_PAGE_SIZE,
9795
organization_id: str | None = None,
9896
) -> list[CalculatedChannel]:
9997
"""List all calculated channels matching the given query.
@@ -119,7 +117,7 @@ async def list_all_calculated_channels(
119117
async def list_calculated_channels(
120118
self,
121119
*,
122-
page_size: int | None = CALCULATED_CHANNELS_DEFAULT_PAGE_SIZE,
120+
page_size: int | None = DEFAULT_PAGE_SIZE,
123121
page_token: str | None = None,
124122
query_filter: str | None = None,
125123
order_by: str | None = None,
@@ -200,7 +198,7 @@ async def list_calculated_channel_versions(
200198
calculated_channel_id: str | None = None,
201199
client_key: str | None = None,
202200
organization_id: str | None = None,
203-
page_size: int | None = CALCULATED_CHANNELS_DEFAULT_PAGE_SIZE,
201+
page_size: int | None = DEFAULT_PAGE_SIZE,
204202
page_token: str | None = None,
205203
query_filter: str | None = None,
206204
order_by: str | None = None,

python/lib/sift_client/_internal/low_level_wrappers/jobs.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
)
2020
from sift.jobs.v1.jobs_pb2_grpc import JobServiceStub
2121

22-
from sift_client._internal.low_level_wrappers.base import LowLevelClientBase
22+
from sift_client._internal.low_level_wrappers.base import DEFAULT_PAGE_SIZE, LowLevelClientBase
2323
from sift_client.sift_types.job import Job
2424
from sift_client.transport import GrpcClient, WithGrpcClient
2525

26-
JOBS_DEFAULT_PAGE_SIZE = 1000
27-
2826

2927
class JobsLowLevelClient(LowLevelClientBase, WithGrpcClient):
3028
"""Low-level client for the JobService API.
@@ -43,7 +41,7 @@ def __init__(self, grpc_client: GrpcClient):
4341
async def list_jobs(
4442
self,
4543
*,
46-
page_size: int | None = JOBS_DEFAULT_PAGE_SIZE,
44+
page_size: int | None = DEFAULT_PAGE_SIZE,
4745
page_token: str | None = None,
4846
query_filter: str | None = None,
4947
organization_id: str | None = None,
@@ -85,7 +83,7 @@ async def list_all_jobs(
8583
query_filter: str | None = None,
8684
organization_id: str | None = None,
8785
order_by: str | None = None,
88-
page_size: int | None = JOBS_DEFAULT_PAGE_SIZE,
86+
page_size: int | None = DEFAULT_PAGE_SIZE,
8987
max_results: int | None = None,
9088
) -> list[Job]:
9189
"""List all jobs, handling pagination automatically.

python/lib/sift_client/_internal/low_level_wrappers/remote_files.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from sift.remote_files.v1.remote_files_pb2_grpc import RemoteFileServiceStub
1919

2020
from sift_client._internal.low_level_wrappers.base import (
21+
DEFAULT_PAGE_SIZE,
2122
LowLevelClientBase,
2223
)
2324
from sift_client.transport import GrpcClient, WithGrpcClient
@@ -26,8 +27,6 @@
2627
from sift_client.client import SiftClient
2728
from sift_client.sift_types.file_attachment import FileAttachment, FileAttachmentUpdate
2829

29-
REMOTE_FILES_DEFAULT_PAGE_SIZE = 1000
30-
3130

3231
class RemoteFilesLowLevelClient(LowLevelClientBase, WithGrpcClient):
3332
"""Low-level client for the RemoteFilesAPI.
@@ -66,7 +65,7 @@ async def list_all_remote_files(
6665
self,
6766
query_filter: str | None = None,
6867
max_results: int | None = None,
69-
page_size: int | None = REMOTE_FILES_DEFAULT_PAGE_SIZE,
68+
page_size: int | None = DEFAULT_PAGE_SIZE,
7069
order_by: str | None = None,
7170
sift_client: SiftClient | None = None,
7271
) -> list[FileAttachment]:
@@ -93,7 +92,7 @@ async def list_all_remote_files(
9392

9493
async def list_remote_files(
9594
self,
96-
page_size: int | None = REMOTE_FILES_DEFAULT_PAGE_SIZE,
95+
page_size: int | None = DEFAULT_PAGE_SIZE,
9796
page_token: str | None = None,
9897
query_filter: str | None = None,
9998
order_by: str | None = None,

python/lib/sift_client/_internal/low_level_wrappers/rules.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
)
3838
from sift.rules.v1.rules_pb2_grpc import RuleServiceStub
3939

40-
from sift_client._internal.low_level_wrappers.base import LowLevelClientBase
40+
from sift_client._internal.low_level_wrappers.base import DEFAULT_PAGE_SIZE, LowLevelClientBase
4141
from sift_client._internal.low_level_wrappers.reports import ReportsLowLevelClient
4242
from sift_client._internal.util.timestamp import to_pb_timestamp
4343
from sift_client._internal.util.util import count_non_none
@@ -58,8 +58,6 @@
5858
# Configure logging
5959
logger = logging.getLogger(__name__)
6060

61-
DEFAULT_RULE_PAGE_SIZE = 1000
62-
6361

6462
class RulesLowLevelClient(LowLevelClientBase, WithGrpcClient):
6563
"""Low-level client for the RulesAPI.
@@ -497,7 +495,7 @@ async def list_all_rules(
497495
filter_query: str | None = None,
498496
order_by: str | None = None,
499497
max_results: int | None = None,
500-
page_size: int | None = DEFAULT_RULE_PAGE_SIZE,
498+
page_size: int | None = DEFAULT_PAGE_SIZE,
501499
) -> list[Rule]:
502500
"""List all rules."""
503501
return await self._handle_pagination(

python/lib/sift_client/_internal/low_level_wrappers/runs.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
)
1919
from sift.runs.v2.runs_pb2_grpc import RunServiceStub
2020

21-
from sift_client._internal.low_level_wrappers.base import LowLevelClientBase
21+
from sift_client._internal.low_level_wrappers.base import DEFAULT_PAGE_SIZE, LowLevelClientBase
2222
from sift_client._internal.util.timestamp import to_pb_timestamp
2323
from sift_client.sift_types.run import Run, RunCreate, RunUpdate
2424
from sift_client.transport import WithGrpcClient
@@ -31,8 +31,6 @@
3131
# Configure logging
3232
logger = logging.getLogger(__name__)
3333

34-
RUNS_DEFAULT_PAGE_SIZE = 1000
35-
3634

3735
class RunsLowLevelClient(LowLevelClientBase, WithGrpcClient):
3836
"""Low-level client for the RunsAPI.
@@ -68,7 +66,7 @@ async def get_run(self, run_id: str) -> Run:
6866
async def list_runs(
6967
self,
7068
*,
71-
page_size: int | None = RUNS_DEFAULT_PAGE_SIZE,
69+
page_size: int | None = DEFAULT_PAGE_SIZE,
7270
page_token: str | None = None,
7371
query_filter: str | None = None,
7472
order_by: str | None = None,
@@ -106,7 +104,7 @@ async def list_all_runs(
106104
*,
107105
query_filter: str | None = None,
108106
order_by: str | None = None,
109-
page_size: int | None = RUNS_DEFAULT_PAGE_SIZE,
107+
page_size: int | None = DEFAULT_PAGE_SIZE,
110108
max_results: int | None = None,
111109
) -> list[Run]:
112110
"""List all runs with optional filtering.

python/lib/sift_client/_internal/low_level_wrappers/tags.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
)
1212
from sift.tags.v2.tags_pb2_grpc import TagServiceStub
1313

14-
from sift_client._internal.low_level_wrappers.base import LowLevelClientBase
14+
from sift_client._internal.low_level_wrappers.base import DEFAULT_PAGE_SIZE, LowLevelClientBase
1515
from sift_client.sift_types.tag import Tag
1616
from sift_client.transport import WithGrpcClient
1717

@@ -21,8 +21,6 @@
2121
# Configure logging
2222
logger = logging.getLogger(__name__)
2323

24-
TAGS_DEFAULT_PAGE_SIZE = 1000
25-
2624

2725
class TagsLowLevelClient(LowLevelClientBase, WithGrpcClient):
2826
"""Low-level client for the TagsAPI.
@@ -61,7 +59,7 @@ async def create_tag(self, name: str) -> Tag:
6159
async def list_tags(
6260
self,
6361
*,
64-
page_size: int | None = TAGS_DEFAULT_PAGE_SIZE,
62+
page_size: int | None = DEFAULT_PAGE_SIZE,
6563
page_token: str | None = None,
6664
query_filter: str | None = None,
6765
order_by: str | None = None,
@@ -99,7 +97,7 @@ async def list_all_tags(
9997
*,
10098
query_filter: str | None = None,
10199
order_by: str | None = None,
102-
page_size: int | None = TAGS_DEFAULT_PAGE_SIZE,
100+
page_size: int | None = DEFAULT_PAGE_SIZE,
103101
max_results: int | None = None,
104102
) -> list[Tag]:
105103
"""List all tags with optional filtering.

python/lib/sift_client/_internal/low_level_wrappers/test_results.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
)
3434
from sift.test_reports.v1.test_reports_pb2_grpc import TestReportServiceStub
3535

36-
from sift_client._internal.low_level_wrappers.base import LowLevelClientBase
36+
from sift_client._internal.low_level_wrappers.base import DEFAULT_PAGE_SIZE, LowLevelClientBase
3737
from sift_client.sift_types.test_report import (
3838
TestMeasurement,
3939
TestMeasurementCreate,
@@ -53,10 +53,6 @@
5353
# Configure logging
5454
logger = logging.getLogger(__name__)
5555

56-
TEST_REPORTS_DEFAULT_PAGE_SIZE = 1000
57-
TEST_STEPS_DEFAULT_PAGE_SIZE = 1000
58-
TEST_MEASUREMENTS_DEFAULT_PAGE_SIZE = 1000
59-
6056

6157
class TestResultsLowLevelClient(LowLevelClientBase, WithGrpcClient):
6258
"""Low-level client for the TestResultsAPI.
@@ -133,7 +129,7 @@ async def get_test_report(self, test_report_id: str) -> TestReport:
133129
async def list_test_reports(
134130
self,
135131
*,
136-
page_size: int | None = TEST_REPORTS_DEFAULT_PAGE_SIZE,
132+
page_size: int | None = DEFAULT_PAGE_SIZE,
137133
page_token: str | None = None,
138134
query_filter: str | None = None,
139135
order_by: str | None = None,
@@ -171,7 +167,7 @@ async def list_all_test_reports(
171167
*,
172168
query_filter: str | None = None,
173169
order_by: str | None = None,
174-
page_size: int | None = TEST_REPORTS_DEFAULT_PAGE_SIZE,
170+
page_size: int | None = DEFAULT_PAGE_SIZE,
175171
max_results: int | None = None,
176172
) -> list[TestReport]:
177173
"""List all test reports with optional filtering.
@@ -280,7 +276,7 @@ async def list_all_test_steps(
280276
query_filter: str | None = None,
281277
order_by: str | None = None,
282278
max_results: int | None = None,
283-
page_size: int | None = TEST_STEPS_DEFAULT_PAGE_SIZE,
279+
page_size: int | None = DEFAULT_PAGE_SIZE,
284280
) -> list[TestStep]:
285281
"""List all test steps with optional filtering.
286282
@@ -375,7 +371,7 @@ async def create_test_measurements(
375371
async def list_test_measurements(
376372
self,
377373
*,
378-
page_size: int | None = TEST_MEASUREMENTS_DEFAULT_PAGE_SIZE,
374+
page_size: int | None = DEFAULT_PAGE_SIZE,
379375
page_token: str | None = None,
380376
query_filter: str | None = None,
381377
order_by: str | None = None,
@@ -416,7 +412,7 @@ async def list_all_test_measurements(
416412
query_filter: str | None = None,
417413
order_by: str | None = None,
418414
max_results: int | None = None,
419-
page_size: int | None = TEST_MEASUREMENTS_DEFAULT_PAGE_SIZE,
415+
page_size: int | None = DEFAULT_PAGE_SIZE,
420416
) -> list[TestMeasurement]:
421417
"""List all test measurements with optional filtering.
422418

0 commit comments

Comments
 (0)