Skip to content

Commit 8f4dfd8

Browse files
Fix ruff formatting in ops.py
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3893d49 commit 8f4dfd8

File tree

1 file changed

+56
-18
lines changed

1 file changed

+56
-18
lines changed

src/everyrow/ops.py

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252

5353

5454
DEFAULT_EFFORT_LEVEL = EffortLevel.MEDIUM
55+
56+
5557
class DefaultAgentResponse(BaseModel):
5658
answer: str
5759

@@ -113,7 +115,9 @@ async def create_scalar_artifact(input: BaseModel, session: Session) -> UUID:
113115
data=CreateArtifactRequestDataType1.from_dict(input.model_dump()),
114116
session_id=session.session_id,
115117
)
116-
response = await create_artifact_artifacts_post.asyncio(client=session.client, body=body)
118+
response = await create_artifact_artifacts_post.asyncio(
119+
client=session.client, body=body
120+
)
117121
response = handle_response(response)
118122
return response.artifact_id
119123

@@ -125,7 +129,9 @@ async def create_table_artifact(input: DataFrame, session: Session) -> UUID:
125129
data=[CreateArtifactRequestDataType0Item.from_dict(r) for r in records],
126130
session_id=session.session_id,
127131
)
128-
response = await create_artifact_artifacts_post.asyncio(client=session.client, body=body)
132+
response = await create_artifact_artifacts_post.asyncio(
133+
client=session.client, body=body
134+
)
129135
response = handle_response(response)
130136
return response.artifact_id
131137

@@ -229,25 +235,35 @@ async def single_agent_async[T: BaseModel](
229235
return_table: bool = False,
230236
) -> EveryrowTask[T]:
231237
"""Submit a single_agent task asynchronously."""
232-
input_data = _prepare_single_input(input, SingleAgentOperationInputType1Item, SingleAgentOperationInputType2)
238+
input_data = _prepare_single_input(
239+
input, SingleAgentOperationInputType1Item, SingleAgentOperationInputType2
240+
)
233241

234242
# Build the operation body with either preset or custom params
235243
body = SingleAgentOperation(
236244
input_=input_data, # type: ignore
237245
task=task,
238246
session_id=session.session_id,
239-
response_schema=SingleAgentOperationResponseSchemaType0.from_dict(response_model.model_json_schema()),
240-
effort_level=PublicEffortLevel(effort_level.value) if effort_level is not None else UNSET,
247+
response_schema=SingleAgentOperationResponseSchemaType0.from_dict(
248+
response_model.model_json_schema()
249+
),
250+
effort_level=PublicEffortLevel(effort_level.value)
251+
if effort_level is not None
252+
else UNSET,
241253
llm=LLMEnumPublic(llm.value) if llm is not None else UNSET,
242254
iteration_budget=iteration_budget if iteration_budget is not None else UNSET,
243255
include_research=include_research if include_research is not None else UNSET,
244256
return_list=return_table,
245257
)
246258

247-
response = await single_agent_operations_single_agent_post.asyncio(client=session.client, body=body)
259+
response = await single_agent_operations_single_agent_post.asyncio(
260+
client=session.client, body=body
261+
)
248262
response = handle_response(response)
249263

250-
cohort_task: EveryrowTask[T] = EveryrowTask(response_model=response_model, is_map=False, is_expand=return_table)
264+
cohort_task: EveryrowTask[T] = EveryrowTask(
265+
response_model=response_model, is_map=False, is_expand=return_table
266+
)
251267
cohort_task.set_submitted(response.task_id, response.session_id, session.client)
252268
return cohort_task
253269

@@ -337,19 +353,27 @@ async def agent_map_async(
337353
input_=input_data, # type: ignore
338354
task=task,
339355
session_id=session.session_id,
340-
response_schema=AgentMapOperationResponseSchemaType0.from_dict(response_model.model_json_schema()),
341-
effort_level=PublicEffortLevel(effort_level.value) if effort_level is not None else UNSET,
356+
response_schema=AgentMapOperationResponseSchemaType0.from_dict(
357+
response_model.model_json_schema()
358+
),
359+
effort_level=PublicEffortLevel(effort_level.value)
360+
if effort_level is not None
361+
else UNSET,
342362
llm=LLMEnumPublic(llm.value) if llm is not None else UNSET,
343363
iteration_budget=iteration_budget if iteration_budget is not None else UNSET,
344364
include_research=include_research if include_research is not None else UNSET,
345365
join_with_input=True,
346366
enforce_row_independence=enforce_row_independence,
347367
)
348368

349-
response = await agent_map_operations_agent_map_post.asyncio(client=session.client, body=body)
369+
response = await agent_map_operations_agent_map_post.asyncio(
370+
client=session.client, body=body
371+
)
350372
response = handle_response(response)
351373

352-
cohort_task = EveryrowTask(response_model=response_model, is_map=True, is_expand=False)
374+
cohort_task = EveryrowTask(
375+
response_model=response_model, is_map=True, is_expand=False
376+
)
353377
cohort_task.set_submitted(response.task_id, response.session_id, session.client)
354378
return cohort_task
355379

@@ -388,7 +412,9 @@ async def screen[T: BaseModel](
388412
if isinstance(result, TableResult):
389413
return result
390414
raise EveryrowError("Screen task did not return a table result")
391-
cohort_task = await screen_async(task=task, session=session, input=input, response_model=response_model)
415+
cohort_task = await screen_async(
416+
task=task, session=session, input=input, response_model=response_model
417+
)
392418
result = await cohort_task.await_result()
393419
if isinstance(result, TableResult):
394420
return result
@@ -409,10 +435,14 @@ async def screen_async[T: BaseModel](
409435
input_=input_data, # type: ignore
410436
task=task,
411437
session_id=session.session_id,
412-
response_schema=ScreenOperationResponseSchemaType0.from_dict(actual_response_model.model_json_schema()),
438+
response_schema=ScreenOperationResponseSchemaType0.from_dict(
439+
actual_response_model.model_json_schema()
440+
),
413441
)
414442

415-
response = await screen_operations_screen_post.asyncio(client=session.client, body=body)
443+
response = await screen_operations_screen_post.asyncio(
444+
client=session.client, body=body
445+
)
416446
response = handle_response(response)
417447

418448
cohort_task: EveryrowTask[T] = EveryrowTask(
@@ -499,7 +529,9 @@ async def rank_async[T: BaseModel](
499529
# Validate that field_name exists in the model
500530
properties = response_schema.get("properties", {})
501531
if field_name not in properties:
502-
raise ValueError(f"Field {field_name} not in response model {response_model.__name__}")
532+
raise ValueError(
533+
f"Field {field_name} not in response model {response_model.__name__}"
534+
)
503535
else:
504536
# Build a minimal JSON schema with just the sort field
505537
json_type_map = {
@@ -510,7 +542,9 @@ async def rank_async[T: BaseModel](
510542
}
511543
response_schema = {
512544
"type": "object",
513-
"properties": {field_name: {"type": json_type_map.get(field_type, field_type)}},
545+
"properties": {
546+
field_name: {"type": json_type_map.get(field_type, field_type)}
547+
},
514548
"required": [field_name],
515549
}
516550

@@ -620,7 +654,9 @@ async def merge_async(
620654
session_id=session.session_id,
621655
)
622656

623-
response = await merge_operations_merge_post.asyncio(client=session.client, body=body)
657+
response = await merge_operations_merge_post.asyncio(
658+
client=session.client, body=body
659+
)
624660
response = handle_response(response)
625661

626662
merge_task = MergeTask()
@@ -715,7 +751,9 @@ async def dedupe_async(
715751
strategy_prompt=strategy_prompt if strategy_prompt is not None else UNSET,
716752
)
717753

718-
response = await dedupe_operations_dedupe_post.asyncio(client=session.client, body=body)
754+
response = await dedupe_operations_dedupe_post.asyncio(
755+
client=session.client, body=body
756+
)
719757
response = handle_response(response)
720758

721759
cohort_task = EveryrowTask(response_model=BaseModel, is_map=True, is_expand=False)

0 commit comments

Comments
 (0)