Skip to content

Commit 19b495c

Browse files
lint
1 parent 0ec3400 commit 19b495c

6 files changed

Lines changed: 14 additions & 0 deletions

File tree

temporalio/contrib/google_gemini_sdk/_gemini_activity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def __init__(
5151
client: GeminiClient,
5252
credentials: google.auth.credentials.Credentials | None = None,
5353
) -> None:
54+
"""Initialize with a genai.Client and optional extra credentials."""
5455
self._client = client
5556
self._credentials = credentials
5657

temporalio/contrib/google_gemini_sdk/_temporal_api_client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def __init__( # pyright: ignore[reportMissingSuperCall]
7777
location: str | None = None,
7878
activity_config: ActivityConfig | None = None,
7979
) -> None:
80+
"""Initialize without calling super (no HTTP clients needed)."""
8081
# Do NOT call super().__init__() — it creates HTTP clients, loads
8182
# credentials, etc. We only set the properties the SDK's request
8283
# formatting code accesses.
@@ -164,6 +165,7 @@ async def async_request(
164165
request_dict: dict[str, object],
165166
http_options: HttpOptionsOrDict | None = None,
166167
) -> SdkHttpResponse:
168+
"""Dispatch an async API request through a Temporal activity."""
167169
config: ActivityConfig = {**self._activity_config}
168170
if "summary" not in config:
169171
# Default summary is the API path (e.g. "models/gemini-2.5-flash:generateContent").
@@ -192,6 +194,7 @@ def request(
192194
request_dict: dict[str, object],
193195
http_options: HttpOptionsOrDict | None = None,
194196
) -> SdkHttpResponse:
197+
"""Raise — sync requests not supported in workflows."""
195198
raise RuntimeError(
196199
"Synchronous requests are not supported in Temporal workflows. "
197200
"Use the AsyncClient returned by gemini_client() instead."
@@ -204,6 +207,7 @@ def request_streamed(
204207
request_dict: dict[str, object],
205208
http_options: HttpOptionsOrDict | None = None,
206209
) -> Any:
210+
"""Raise — sync streaming not supported in workflows."""
207211
raise RuntimeError(
208212
"Synchronous streaming is not supported in Temporal workflows. "
209213
"Use the AsyncClient returned by gemini_client() instead."
@@ -216,6 +220,7 @@ async def async_request_streamed(
216220
request_dict: dict[str, object],
217221
http_options: HttpOptionsOrDict | None = None,
218222
) -> Any:
223+
"""Dispatch a streamed request, batching chunks in the activity."""
219224
config: ActivityConfig = {**self._activity_config}
220225
if "summary" not in config:
221226
config["summary"] = f"{http_method.upper()} {path}"
@@ -247,21 +252,25 @@ async def _yield_chunks():
247252
# so we raise here to catch any unexpected direct usage.
248253

249254
def upload_file(self, *args: Any, **kwargs: Any) -> Any:
255+
"""Raise — use client.files.upload() instead."""
250256
raise NotImplementedError(
251257
"Use client.files.upload() instead of the internal upload_file() method."
252258
)
253259

254260
async def async_upload_file(self, *args: Any, **kwargs: Any) -> Any:
261+
"""Raise — use client.files.upload() instead."""
255262
raise NotImplementedError(
256263
"Use client.files.upload() instead of the internal async_upload_file() method."
257264
)
258265

259266
def download_file(self, *args: Any, **kwargs: Any) -> Any:
267+
"""Raise — use client.files.download() instead."""
260268
raise NotImplementedError(
261269
"Use client.files.download() instead of the internal download_file() method."
262270
)
263271

264272
async def async_download_file(self, *args: Any, **kwargs: Any) -> Any:
273+
"""Raise — use client.files.download() instead."""
265274
raise NotImplementedError(
266275
"Use client.files.download() instead of the internal async_download_file() method."
267276
)

temporalio/contrib/google_gemini_sdk/_temporal_async_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def __init__(
3939
api_client: TemporalApiClient,
4040
activity_config: ActivityConfig | None = None,
4141
) -> None:
42+
"""Initialize with Temporal-aware files and file search stores."""
4243
super().__init__(api_client)
4344
self._files = TemporalAsyncFiles(api_client, activity_config)
4445
self._file_search_stores = TemporalAsyncFileSearchStores(

temporalio/contrib/google_gemini_sdk/_temporal_file_search_stores.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def __init__(
4242
api_client: TemporalApiClient,
4343
activity_config: ActivityConfig | None = None,
4444
) -> None:
45+
"""Initialize with activity config for upload timeouts."""
4546
super().__init__(api_client)
4647
self._activity_config = activity_config or ActivityConfig(
4748
start_to_close_timeout=timedelta(seconds=60),

temporalio/contrib/google_gemini_sdk/_temporal_files.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def __init__(
4646
api_client: TemporalApiClient,
4747
activity_config: ActivityConfig | None = None,
4848
) -> None:
49+
"""Initialize with activity config for file operation timeouts."""
4950
super().__init__(api_client)
5051
self._activity_config = activity_config or ActivityConfig(
5152
start_to_close_timeout=timedelta(seconds=60),
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Tests for the Google Gemini SDK Temporal integration."""

0 commit comments

Comments
 (0)