Skip to content

Commit 58cb890

Browse files
committed
Format files with latest ruff
1 parent 2b54d42 commit 58cb890

File tree

13 files changed

+50
-62
lines changed

13 files changed

+50
-62
lines changed

databricks-production-qa-demo/steps/deployment/deployment_deploy.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,10 @@
3131

3232

3333
@step(enable_cache=False)
34-
def deployment_deploy() -> (
35-
Annotated[
36-
Optional[DatabricksDeploymentService],
37-
ArtifactConfig(
38-
name="databricks_deployment", is_deployment_artifact=True
39-
),
40-
]
41-
):
34+
def deployment_deploy() -> Annotated[
35+
Optional[DatabricksDeploymentService],
36+
ArtifactConfig(name="databricks_deployment", is_deployment_artifact=True),
37+
]:
4238
"""Predictions step.
4339
4440
This is an example of a predictions step that takes the data in and returns

huggingface-sagemaker/steps/deploying/huggingface_deployment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ def deploy_to_huggingface(
4747
save_model_to_deploy.entrypoint()
4848

4949
logger.info("Model saved locally. Pushing to HuggingFace...")
50-
assert secret, "No secret found with name 'huggingface_creds'. Please create one with your `token`."
50+
assert secret, (
51+
"No secret found with name 'huggingface_creds'. Please create one with your `token`."
52+
)
5153

5254
token = secret.secret_values["token"]
5355
api = HfApi(token=token)

huggingface-sagemaker/steps/promotion/promote_get_metrics.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@
2727

2828

2929
@step
30-
def promote_get_metrics() -> (
31-
Tuple[
32-
Annotated[Dict[str, Any], "latest_metrics"],
33-
Annotated[Dict[str, Any], "current_metrics"],
34-
]
35-
):
30+
def promote_get_metrics() -> Tuple[
31+
Annotated[Dict[str, Any], "latest_metrics"],
32+
Annotated[Dict[str, Any], "current_metrics"],
33+
]:
3634
"""Get metrics for comparison for promoting a model.
3735
3836
This is an example of a metric retrieval step. It is used to retrieve

llm-complete-guide/steps/eval_retrieval.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ def perform_small_retrieval_evaluation(use_reranking: bool) -> float:
275275

276276

277277
@step
278-
def retrieval_evaluation_small() -> (
279-
Annotated[float, "small_failure_rate_retrieval"]
280-
):
278+
def retrieval_evaluation_small() -> Annotated[
279+
float, "small_failure_rate_retrieval"
280+
]:
281281
"""Executes the retrieval evaluation step without reranking.
282282
283283
Returns:
@@ -287,9 +287,9 @@ def retrieval_evaluation_small() -> (
287287

288288

289289
@step
290-
def retrieval_evaluation_small_with_reranking() -> (
291-
Annotated[float, "small_failure_rate_retrieval_reranking"]
292-
):
290+
def retrieval_evaluation_small_with_reranking() -> Annotated[
291+
float, "small_failure_rate_retrieval_reranking"
292+
]:
293293
"""Executes the retrieval evaluation step with reranking.
294294
295295
Returns:

llm-complete-guide/steps/hf_dataset_loader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323

2424

2525
@step(output_materializers=HFDatasetMaterializer)
26-
def load_hf_dataset() -> (
27-
Tuple[Annotated[Dataset, "train"], Annotated[Dataset, "test"]]
28-
):
26+
def load_hf_dataset() -> Tuple[
27+
Annotated[Dataset, "train"], Annotated[Dataset, "test"]
28+
]:
2929
train_dataset = load_dataset(DATASET_NAME_DEFAULT, split="train")
3030
test_dataset = load_dataset(DATASET_NAME_DEFAULT, split="test")
3131
return train_dataset, test_dataset

magic-photobooth/k8s_run.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,11 @@ def generate_video_frames(
326326
settings={"orchestrator.kubernetes": kubernetes_settings},
327327
enable_cache=False,
328328
)
329-
def image_to_video() -> (
330-
Tuple[
331-
Annotated[PILImage.Image, "generated_image"],
332-
Annotated[bytes, "video_data"],
333-
Annotated[HTMLString, "video_html"],
334-
]
335-
):
329+
def image_to_video() -> Tuple[
330+
Annotated[PILImage.Image, "generated_image"],
331+
Annotated[bytes, "video_data"],
332+
Annotated[HTMLString, "video_html"],
333+
]:
336334
model_path = f"{TrainConfig().hf_username}/{TrainConfig().hf_repo_suffix}"
337335

338336
pipe = AutoPipelineForText2Image.from_pretrained(

magic-photobooth/modal_run.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,11 @@ def generate_video_frames(
308308
settings={"step_operator.modal": modal_settings},
309309
enable_cache=False,
310310
)
311-
def image_to_video() -> (
312-
Tuple[
313-
Annotated[PILImage.Image, "generated_image"],
314-
Annotated[bytes, "video_data"],
315-
Annotated[HTMLString, "video_html"],
316-
]
317-
):
311+
def image_to_video() -> Tuple[
312+
Annotated[PILImage.Image, "generated_image"],
313+
Annotated[bytes, "video_data"],
314+
Annotated[HTMLString, "video_html"],
315+
]:
318316
model_path = f"{TrainConfig().hf_username}/{TrainConfig().hf_repo_suffix}"
319317

320318
pipe = AutoPipelineForText2Image.from_pretrained(

magic-photobooth/modal_run_using_azure_data.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,11 @@ def generate_video_frames(
300300
settings={"step_operator.modal": modal_settings},
301301
enable_cache=False,
302302
)
303-
def image_to_video() -> (
304-
Tuple[
305-
Annotated[PILImage.Image, "generated_image"],
306-
Annotated[bytes, "video_data"],
307-
Annotated[HTMLString, "video_html"],
308-
]
309-
):
303+
def image_to_video() -> Tuple[
304+
Annotated[PILImage.Image, "generated_image"],
305+
Annotated[bytes, "video_data"],
306+
Annotated[HTMLString, "video_html"],
307+
]:
310308
model_path = f"{TrainConfig().hf_username}/{TrainConfig().hf_repo_suffix}"
311309

312310
pipe = AutoPipelineForText2Image.from_pretrained(

oncoclear/steps/model_promoter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def model_promoter(accuracy: float, stage: str = "production") -> bool:
4444

4545
if accuracy < 0.8:
4646
logger.info(
47-
f"Model accuracy {accuracy*100:.2f}% is below 80% ! Not promoting model."
47+
f"Model accuracy {accuracy * 100:.2f}% is below 80% ! Not promoting model."
4848
)
4949
else:
5050
logger.info(f"Model promoted to {stage}!")

retail-forecast/pipelines/training_pipeline.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212

1313

1414
@pipeline(name="retail_forecast_pipeline")
15-
def training_pipeline() -> (
16-
Tuple[
17-
Annotated[Dict[str, float], "model_metrics"],
18-
Annotated[HTMLString, "evaluation_report"],
19-
Annotated[HTMLString, "forecast_dashboard"],
20-
Annotated[HTMLString, "sales_visualization"],
21-
]
22-
):
15+
def training_pipeline() -> Tuple[
16+
Annotated[Dict[str, float], "model_metrics"],
17+
Annotated[HTMLString, "evaluation_report"],
18+
Annotated[HTMLString, "forecast_dashboard"],
19+
Annotated[HTMLString, "sales_visualization"],
20+
]:
2321
"""Simple retail forecasting pipeline using Prophet.
2422
2523
Steps:

0 commit comments

Comments
 (0)