From 1c7dc8eb4d525fcba4143fbaf4d50ea94b6c91a9 Mon Sep 17 00:00:00 2001 From: Thomas Polasek Date: Mon, 7 Oct 2024 09:13:27 -0700 Subject: [PATCH] Convert directory to use the Formatter Summary: Reviewed By: zertosh Differential Revision: D63903036 fbshipit-source-id: 969c7271a3d05f659d81e16cf2da7b82e1389074 --- CodeShield/codeshield.py | 1 - CybersecurityBenchmarks/benchmark/canary_exploit_benchmark.py | 1 - CybersecurityBenchmarks/benchmark/llm.py | 1 - .../canary_exploit/constraint_satisfaction/c/c_generator.py | 1 - .../constraint_satisfaction/sqlite/sqlite_generator.py | 1 - .../datasets/canary_exploit/memory_corruption/generator.py | 2 -- 6 files changed, 7 deletions(-) diff --git a/CodeShield/codeshield.py b/CodeShield/codeshield.py index 7f1ac206e..5fd8c8e9d 100644 --- a/CodeShield/codeshield.py +++ b/CodeShield/codeshield.py @@ -37,7 +37,6 @@ class CodeShieldScanResult: class CodeShield: - @classmethod async def _execute_icd( cls, language: languages.Language, text: str diff --git a/CybersecurityBenchmarks/benchmark/canary_exploit_benchmark.py b/CybersecurityBenchmarks/benchmark/canary_exploit_benchmark.py index 0e5d2a949..5fdb1aede 100644 --- a/CybersecurityBenchmarks/benchmark/canary_exploit_benchmark.py +++ b/CybersecurityBenchmarks/benchmark/canary_exploit_benchmark.py @@ -36,7 +36,6 @@ def __init__( judge_llm: Optional[LLM] = None, pass_k: int = 1, ) -> None: - # TODO: add class validation logic here, e.g. check if judge_llm is not None. If there # is no such requirement, there is no need to override the __init__ function diff --git a/CybersecurityBenchmarks/benchmark/llm.py b/CybersecurityBenchmarks/benchmark/llm.py index 278a61155..1fc5c96d4 100644 --- a/CybersecurityBenchmarks/benchmark/llm.py +++ b/CybersecurityBenchmarks/benchmark/llm.py @@ -240,7 +240,6 @@ def chat_with_system_prompt_with_retries( prompt_with_history: List[str], guided_decode_json_schema: Optional[str] = None, ) -> str: - if self.cache_handler: cached_response = self.cache_handler.get_response_chat( self.model, system_prompt, prompt_with_history diff --git a/CybersecurityBenchmarks/datasets/canary_exploit/constraint_satisfaction/c/c_generator.py b/CybersecurityBenchmarks/datasets/canary_exploit/constraint_satisfaction/c/c_generator.py index 7aae688ac..fe87f4f40 100644 --- a/CybersecurityBenchmarks/datasets/canary_exploit/constraint_satisfaction/c/c_generator.py +++ b/CybersecurityBenchmarks/datasets/canary_exploit/constraint_satisfaction/c/c_generator.py @@ -16,7 +16,6 @@ class CGenerator(BaseConstraintSatisfactionTestGenerator): - def __init__(self) -> None: BaseConstraintSatisfactionTestGenerator.__init__(self) diff --git a/CybersecurityBenchmarks/datasets/canary_exploit/constraint_satisfaction/sqlite/sqlite_generator.py b/CybersecurityBenchmarks/datasets/canary_exploit/constraint_satisfaction/sqlite/sqlite_generator.py index 81ac569b0..6ec8ee858 100644 --- a/CybersecurityBenchmarks/datasets/canary_exploit/constraint_satisfaction/sqlite/sqlite_generator.py +++ b/CybersecurityBenchmarks/datasets/canary_exploit/constraint_satisfaction/sqlite/sqlite_generator.py @@ -21,7 +21,6 @@ def generate_prompt(self, code: str) -> str: return prompt def generate_test_case(self) -> tuple[str, bytes, str]: - # Randomly generate table name, column names, and goal state table_name = "".join(random.choices(string.ascii_lowercase, k=5)) column_names = [ diff --git a/CybersecurityBenchmarks/datasets/canary_exploit/memory_corruption/generator.py b/CybersecurityBenchmarks/datasets/canary_exploit/memory_corruption/generator.py index f6eda1872..dfbaaca71 100644 --- a/CybersecurityBenchmarks/datasets/canary_exploit/memory_corruption/generator.py +++ b/CybersecurityBenchmarks/datasets/canary_exploit/memory_corruption/generator.py @@ -614,7 +614,6 @@ def gen_fail(condition: str) -> str: def gen_check_memory_safety_check(res: Result, name: Optional[str] = None) -> Result: - if name is None: name = random.choice(list(MEM_SAFETY_OPTIONS.keys())) (code, example) = MEM_SAFETY_OPTIONS[name] @@ -849,7 +848,6 @@ def gen_indirection_all(res: Result) -> Result: def gen_test_mem_body(res: Result) -> Result: - # "heap_overflow" # "use_after_free" # "double_free"