Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
apostolosfilippas committed Jul 21, 2024
1 parent 953b1cc commit 0af34f6
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 41 deletions.
12 changes: 6 additions & 6 deletions edsl/agents/Agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,9 @@ def data(self) -> dict:
if dynamic_traits_func:
func = inspect.getsource(dynamic_traits_func)
raw_data["dynamic_traits_function_source_code"] = func
raw_data["dynamic_traits_function_name"] = (
self.dynamic_traits_function_name
)
raw_data[
"dynamic_traits_function_name"
] = self.dynamic_traits_function_name
if hasattr(self, "answer_question_directly"):
raw_data.pop(
"answer_question_directly", None
Expand All @@ -587,9 +587,9 @@ def data(self) -> dict:
raw_data["answer_question_directly_source_code"] = inspect.getsource(
answer_question_directly_func
)
raw_data["answer_question_directly_function_name"] = (
self.answer_question_directly_function_name
)
raw_data[
"answer_question_directly_function_name"
] = self.answer_question_directly_function_name

return raw_data

Expand Down
6 changes: 3 additions & 3 deletions edsl/jobs/interviews/Interview.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def __init__(
self.debug = debug
self.iteration = iteration
self.cache = cache
self.answers: dict[str, str] = (
Answers()
) # will get filled in as interview progresses
self.answers: dict[
str, str
] = Answers() # will get filled in as interview progresses
self.sidecar_model = sidecar_model

# Trackers
Expand Down
6 changes: 3 additions & 3 deletions edsl/jobs/interviews/InterviewStatusMixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def task_status_logs(self) -> InterviewStatusLog:
The keys are the question names; the values are the lists of status log changes for each task.
"""
for task_creator in self.task_creators.values():
self._task_status_log_dict[task_creator.question.question_name] = (
task_creator.status_log
)
self._task_status_log_dict[
task_creator.question.question_name
] = task_creator.status_log
return self._task_status_log_dict

@property
Expand Down
10 changes: 5 additions & 5 deletions edsl/jobs/interviews/InterviewTaskBuildingMixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ def _cancel_skipped_questions(self, current_question: QuestionBase) -> None:
"""
current_question_index: int = self.to_index[current_question.question_name]

next_question: Union[int, EndOfSurvey] = (
self.survey.rule_collection.next_question(
q_now=current_question_index,
answers=self.answers | self.scenario | self.agent["traits"],
)
next_question: Union[
int, EndOfSurvey
] = self.survey.rule_collection.next_question(
q_now=current_question_index,
answers=self.answers | self.scenario | self.agent["traits"],
)

next_question_index = next_question.next_q
Expand Down
18 changes: 9 additions & 9 deletions edsl/jobs/runners/JobsRunnerAsyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,19 @@ async def _build_interview_task(

prompt_dictionary = {}
for answer_key_name in answer_key_names:
prompt_dictionary[answer_key_name + "_user_prompt"] = (
question_name_to_prompts[answer_key_name]["user_prompt"]
)
prompt_dictionary[answer_key_name + "_system_prompt"] = (
question_name_to_prompts[answer_key_name]["system_prompt"]
)
prompt_dictionary[
answer_key_name + "_user_prompt"
] = question_name_to_prompts[answer_key_name]["user_prompt"]
prompt_dictionary[
answer_key_name + "_system_prompt"
] = question_name_to_prompts[answer_key_name]["system_prompt"]

raw_model_results_dictionary = {}
for result in valid_results:
question_name = result["question_name"]
raw_model_results_dictionary[question_name + "_raw_model_response"] = (
result["raw_model_response"]
)
raw_model_results_dictionary[
question_name + "_raw_model_response"
] = result["raw_model_response"]

from edsl.results.Result import Result

Expand Down
7 changes: 3 additions & 4 deletions edsl/questions/QuestionMultipleChoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class QuestionMultipleChoice(QuestionBase):

question_type = "multiple_choice"
purpose = "When options are known and limited"
question_options: Union[list[str], list[list], list[float], list[int]] = (
QuestionOptionsDescriptor()
)
question_options: Union[
list[str], list[list], list[float], list[int]
] = QuestionOptionsDescriptor()

def __init__(
self,
Expand Down Expand Up @@ -75,7 +75,6 @@ def _simulate_answer(

@property
def question_html_content(self) -> str:

if hasattr(self, "option_labels"):
option_labels = self.option_labels
else:
Expand Down
2 changes: 0 additions & 2 deletions edsl/results/DatasetExportMixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ def print(
from edsl.utilities.utilities import is_notebook

if format is None:

if is_notebook():
format = "html"
else:
Expand Down Expand Up @@ -406,7 +405,6 @@ def html(
f.write(df.to_html())

if is_notebook():

html_url = f"/files/{filename}"
html_link = f'<a href="{html_url}" target="_blank">{cta}</a>'
display(HTML(html_link))
Expand Down
18 changes: 9 additions & 9 deletions edsl/results/Result.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ def sub_dicts(self) -> dict[str, dict]:
if key in self.question_to_attributes:
# You might be tempted to just use the naked key
# but this is a bad idea because it pollutes the namespace
question_text_dict[key + "_question_text"] = (
self.question_to_attributes[key]["question_text"]
)
question_options_dict[key + "_question_options"] = (
self.question_to_attributes[key]["question_options"]
)
question_type_dict[key + "_question_type"] = (
self.question_to_attributes[key]["question_type"]
)
question_text_dict[
key + "_question_text"
] = self.question_to_attributes[key]["question_text"]
question_options_dict[
key + "_question_options"
] = self.question_to_attributes[key]["question_options"]
question_type_dict[
key + "_question_type"
] = self.question_to_attributes[key]["question_type"]

return {
"agent": self.agent.traits
Expand Down

0 comments on commit 0af34f6

Please sign in to comment.