Skip to content

Commit

Permalink
Attempt no longer uses mutable type defaults (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
leondz authored Dec 11, 2023
1 parent 5e17b44 commit bfb56ac
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions garak/attempt.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,38 @@ def __init__(
status=ATTEMPT_NEW,
prompt=None,
probe_classname=None,
probe_params={},
targets=[],
outputs=[],
notes={},
detector_results={},
probe_params=None,
targets=None,
outputs=None,
notes=None,
detector_results=None,
goal=None,
seq=-1,
) -> None:
self.uuid = uuid.uuid4()
self.status = status
self.prompt = prompt
self.probe_classname = probe_classname
self.probe_params = probe_params
self.targets = targets
self.outputs = outputs
self.notes = notes
self.detector_results = detector_results
if probe_params is None:
self.probe_params = {}
else:
self.probe_params = probe_params
if targets is None:
self.targets = []
else:
self.targets = targets
if outputs is None:
self.outputs = []
else:
self.outputs = outputs
if notes is None:
self.notes = {}
else:
self.notes = notes
if detector_results is None:
self.detector_results = {}
else:
self.detector_results = detector_results
self.goal = goal
self.seq = seq

Expand Down

0 comments on commit bfb56ac

Please sign in to comment.