From cd29dd65402109e39b3c830a9bceac48a6927865 Mon Sep 17 00:00:00 2001 From: Luke Hinds Date: Wed, 6 Nov 2024 20:59:39 +0000 Subject: [PATCH] Resolve ruff complaints --- promptwright/dataset.py | 1 + promptwright/hf_hub.py | 1 + promptwright/topic_tree.py | 3 +-- tests/test_engine.py | 8 +++++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/promptwright/dataset.py b/promptwright/dataset.py index d5d2739..7491076 100644 --- a/promptwright/dataset.py +++ b/promptwright/dataset.py @@ -1,6 +1,7 @@ import json import re + class Dataset: """ A class to represent a dataset consisting of samples, where each sample contains messages with specific roles. diff --git a/promptwright/hf_hub.py b/promptwright/hf_hub.py index 2f11acc..1c5f628 100644 --- a/promptwright/hf_hub.py +++ b/promptwright/hf_hub.py @@ -2,6 +2,7 @@ from huggingface_hub import login from huggingface_hub.utils import HfHubHTTPError, RepositoryNotFoundError + class HFUploader: """ HFUploader is a class for uploading datasets to the Hugging Face Hub. diff --git a/promptwright/topic_tree.py b/promptwright/topic_tree.py index d5741f5..c36b0f6 100644 --- a/promptwright/topic_tree.py +++ b/promptwright/topic_tree.py @@ -28,8 +28,7 @@ def validate_and_clean_response(response_text: str) -> str | list[str] | None: topics = extract_list(response_text) if topics: return [topic.strip() for topic in topics if topic.strip()] - - return None + return None # noqa: TRY300 except (json.JSONDecodeError, ValueError) as e: print(f"Error parsing response: {str(e)}") return None diff --git a/tests/test_engine.py b/tests/test_engine.py index ad845b0..94e39f8 100644 --- a/tests/test_engine.py +++ b/tests/test_engine.py @@ -1,7 +1,9 @@ -import pytest from unittest.mock import MagicMock, patch -import re -from promptwright.engine import DataEngine, EngineArguments, Dataset, TopicTree + +import pytest + +from promptwright.engine import DataEngine, Dataset, EngineArguments + @pytest.fixture def engine_args():