From c6dfc90151fb9e48e3df8006e102b63339b4f4f8 Mon Sep 17 00:00:00 2001 From: "Brian W. Goldman" <2237679+brianwgoldman@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:36:10 -0600 Subject: [PATCH] Minor cleanup of unused / unneeded things (#348) --- newhelm/annotation.py | 2 -- newhelm/base_test.py | 1 - newhelm/command_line.py | 2 +- newhelm/concurrency.py | 1 - newhelm/external_data.py | 1 - newhelm/general.py | 5 +---- newhelm/record_init.py | 1 - newhelm/single_turn_prompt_response.py | 2 +- newhelm/test_decorator.py | 5 ++--- plugins/standard_tests/newhelm/tests/safe.py | 2 +- tests/test_cli.py | 1 - tests/test_instance_factory.py | 1 - tests/test_test_decorator.py | 1 - 13 files changed, 6 insertions(+), 19 deletions(-) diff --git a/newhelm/annotation.py b/newhelm/annotation.py index a1c84721..442c0995 100644 --- a/newhelm/annotation.py +++ b/newhelm/annotation.py @@ -1,6 +1,4 @@ -from abc import ABC from newhelm.typed_data import TypedData -from typing import List class Annotation(TypedData): diff --git a/newhelm/base_test.py b/newhelm/base_test.py index 45a62483..3d0ccfee 100644 --- a/newhelm/base_test.py +++ b/newhelm/base_test.py @@ -11,7 +11,6 @@ from newhelm.sut_capabilities import SUTCapability from newhelm.tracked_object import TrackedObject from newhelm.typed_data import Typeable, TypedData -from pydantic import BaseModel from typing import Dict, List, Mapping, Sequence, Type diff --git a/newhelm/command_line.py b/newhelm/command_line.py index 523c6a7f..c69a2ccf 100644 --- a/newhelm/command_line.py +++ b/newhelm/command_line.py @@ -1,5 +1,5 @@ import click -from newhelm.config import load_secrets_from_config, write_default_config +from newhelm.config import write_default_config @click.group() diff --git a/newhelm/concurrency.py b/newhelm/concurrency.py index 6debe2e3..752c2371 100644 --- a/newhelm/concurrency.py +++ b/newhelm/concurrency.py @@ -28,4 +28,3 @@ def __enter__(self) -> T: def __exit__(self, exc_type, exc_value, traceback) -> None: self._lock.__exit__(exc_type, exc_value, traceback) - pass diff --git a/newhelm/external_data.py b/newhelm/external_data.py index df773f7f..5e471a14 100644 --- a/newhelm/external_data.py +++ b/newhelm/external_data.py @@ -1,5 +1,4 @@ import gdown # type: ignore -import os import shutil import tempfile import urllib.request diff --git a/newhelm/general.py b/newhelm/general.py index 52fbd5cc..b86ac3bd 100644 --- a/newhelm/general.py +++ b/newhelm/general.py @@ -2,16 +2,13 @@ import hashlib import importlib import inspect -import json import logging -import os import shlex import subprocess import time import uuid -from dataclasses import asdict, is_dataclass from tqdm import tqdm -from typing import Any, Dict, List, Optional, Set, Type, TypeVar +from typing import Dict, List, Optional, Set, Type, TypeVar # Type vars helpful in defining templates. _InT = TypeVar("_InT") diff --git a/newhelm/record_init.py b/newhelm/record_init.py index cefa746d..06228a09 100644 --- a/newhelm/record_init.py +++ b/newhelm/record_init.py @@ -1,5 +1,4 @@ import importlib -from functools import wraps from newhelm.dependency_injection import ( inject_dependencies, serialize_injected_dependencies, diff --git a/newhelm/single_turn_prompt_response.py b/newhelm/single_turn_prompt_response.py index f32a5b1d..b6821f05 100644 --- a/newhelm/single_turn_prompt_response.py +++ b/newhelm/single_turn_prompt_response.py @@ -1,6 +1,6 @@ from newhelm.annotation import Annotation from newhelm.prompt import ChatPrompt, TextPrompt -from newhelm.sut import SUTCompletion, SUTResponse +from newhelm.sut import SUTCompletion from newhelm.typed_data import TypedData from pydantic import BaseModel, Field from typing import Dict, List, Mapping, Optional, Type, TypeVar diff --git a/newhelm/test_decorator.py b/newhelm/test_decorator.py index 703b5deb..416ebefe 100644 --- a/newhelm/test_decorator.py +++ b/newhelm/test_decorator.py @@ -5,15 +5,14 @@ from newhelm.dependency_helper import DependencyHelper from newhelm.prompt import ChatPrompt, TextPrompt from newhelm.record_init import add_initialization_record -from newhelm.single_turn_prompt_response import TestItem, TestItemAnnotations +from newhelm.single_turn_prompt_response import TestItem from newhelm.sut_capabilities import ( AcceptsChatPrompt, AcceptsTextPrompt, ProducesPerTokenLogProbabilities, SUTCapability, ) -from pydantic import BaseModel -from typing import Any, Dict, List, Sequence, Type +from typing import List, Sequence, Type def newhelm_test(requires_sut_capabilities: Sequence[Type[SUTCapability]]): diff --git a/plugins/standard_tests/newhelm/tests/safe.py b/plugins/standard_tests/newhelm/tests/safe.py index 6717b48a..adac7d57 100644 --- a/plugins/standard_tests/newhelm/tests/safe.py +++ b/plugins/standard_tests/newhelm/tests/safe.py @@ -22,7 +22,7 @@ from newhelm.test_decorator import newhelm_test from newhelm.test_registry import TESTS from pydantic import BaseModel -from typing import Any, Dict, List, Mapping +from typing import Dict, List, Mapping HAZARDS_MAPPING = { "ben": "Benign", diff --git a/tests/test_cli.py b/tests/test_cli.py index 793e149f..5578dab8 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,5 +1,4 @@ import os -import pathlib import pytest from tests.utilities import expensive_tests diff --git a/tests/test_instance_factory.py b/tests/test_instance_factory.py index 2854323e..f3d5f895 100644 --- a/tests/test_instance_factory.py +++ b/tests/test_instance_factory.py @@ -1,5 +1,4 @@ import pytest -from dataclasses import dataclass from newhelm.instance_factory import FactoryEntry, InstanceFactory from newhelm.secret_values import InjectSecret from newhelm.tracked_object import TrackedObject diff --git a/tests/test_test_decorator.py b/tests/test_test_decorator.py index 640fc3ae..e5d00f09 100644 --- a/tests/test_test_decorator.py +++ b/tests/test_test_decorator.py @@ -1,5 +1,4 @@ import pytest -from abc import ABC from newhelm.base_test import BaseTest, PromptResponseTest from newhelm.prompt import ChatPrompt, SUTOptions, TextPrompt from newhelm.record_init import InitializationRecord