From 06c430d05e993606ce76f1c84f91cd93b7efb7e3 Mon Sep 17 00:00:00 2001 From: Joachim Date: Thu, 31 Aug 2023 11:12:13 -0700 Subject: [PATCH] #3 replace "tool" with "idea" --- EditAcptFactTime.py | 4 +- EditAgenda.py | 2 +- EditToolUnit.py => EditIdeaUnit.py | 328 ++--- EditMain.py | 40 +- EditMember2bd.py | 2 +- EditProblem.py | 60 +- README.md | 20 +- main_app.py | 16 +- main_system.py | 44 +- src/agent/agent.py | 1066 ++++++++--------- src/agent/examples/example_agents.py | 178 +-- src/agent/group.py | 8 +- src/agent/hreg_time.py | 8 +- src/agent/{tool.py => idea.py} | 282 ++--- src/agent/lemma.py | 160 +-- src/agent/required.py | 16 +- src/agent/test_/test_group.py | 4 +- src/agent/test_/test_lemma.py | 116 +- src/agent/test_/test_required.py | 30 +- src/agent/test_/test_road.py | 26 +- .../test_idea_attr_holder.py} | 34 +- .../test_idea_core.py} | 296 ++--- src/agent/test__idea/test_idea_kid.py | 6 + .../test_idea_meld.py} | 280 ++--- .../test_idea_road_change.py} | 88 +- src/agent/test__idea/test_idea_root.py | 7 + src/agent/test__tool/test_tool_kid.py | 6 - src/agent/test__tool/test_tool_root.py | 7 - src/agent/test_agent/test_agent_.py | 44 +- src/agent/test_agent/test_agent_acptfacts.py | 292 ++--- src/agent/test_agent/test_agent_agenda.py | 332 ++--- src/agent/test_agent/test_agent_bond.py | 222 ++-- .../test_agent/test_agent_desc_change.py | 222 ++-- src/agent/test_agent/test_agent_groups.py | 252 ++-- src/agent/test_agent/test_agent_idea_crud.py | 535 +++++++++ ...t_tool_list.py => test_agent_idea_list.py} | 484 ++++---- src/agent/test_agent/test_agent_idea_tree.py | 465 +++++++ src/agent/test_agent/test_agent_json.py | 112 +- src/agent/test_agent/test_agent_meld.py | 150 +-- src/agent/test_agent/test_agent_members.py | 54 +- src/agent/test_agent/test_agent_metrics.py | 8 +- src/agent/test_agent/test_agent_range.py | 112 +- src/agent/test_agent/test_agent_required.py | 328 ++--- src/agent/test_agent/test_agent_time.py | 166 +-- src/agent/test_agent/test_agent_tool_crud.py | 535 --------- src/agent/test_agent/test_agent_tool_tree.py | 465 ------- .../test_agent/test_agent_tree_metrics.py | 44 +- src/agent/tree_metrics.py | 16 +- src/agent/x_func.py | 70 +- src/pyqt5_kit/pyqt_func.py | 90 +- src/system/bank_sqlstr.py | 44 +- src/system/examples/example_persons.py | 158 +-- src/system/person.py | 4 +- src/system/system.py | 28 +- src/system/test_person/test_person_.py | 38 +- .../test_person/test_person_agentlink.py | 4 +- src/system/test_person/test_person_digest.py | 88 +- src/system/test_system/test_bank_sqlstr.py | 64 +- src/system/test_system/test_system_agent.py | 12 +- src/system/test_system/test_system_bank.py | 12 +- .../test_system_person_dest_agent.py | 72 +- .../test_system_person_task_received.py | 4 +- ui/EditAcptFactTimeUI.py | 4 +- ui/EditAcptFactTimeUI.ui | 4 +- ui/{EditToolUI.py => EditIdeaUI.py} | 2 +- ui/{EditToolUnitUI.py => EditIdeaUnitUI.py} | 68 +- ui/{EditToolUnitUI.ui => EditIdeaUnitUI.ui} | 18 +- ui/EditMainUI.py | 8 +- ui/EditMainUI.ui | 2 +- ui/EditProblemUI.py | 10 +- ui/EditProblemUI.ui | 4 +- ui/MainWindow.py | 4 +- ui/MainWindow.ui | 4 +- ui/SystemMainUI.py | 26 +- ui/systemMainUI.ui | 6 +- ui/ui_EditAcptFactTimeUI.py | 8 +- ui/ui_EditMainUI.py | 8 +- ui/ui_EditProblemUI.py | 10 +- ui/ui_EditYokeunitRootDatesUI.py | 10 +- ui/ui_EditYokeunitUI.py | 68 +- ...ToolunitMainUI.py => ui_IdeaunitMainUI.py} | 10 +- ui/ui_MainWindow.py | 4 +- ui/ui_SystemMainUI.py | 24 +- ui/ui_main_window.py | 20 +- 84 files changed, 4491 insertions(+), 4491 deletions(-) rename EditToolUnit.py => EditIdeaUnit.py (83%) rename src/agent/{tool.py => idea.py} (77%) rename src/agent/{test__tool/test_tool_attr_holder.py => test__idea/test_idea_attr_holder.py} (60%) rename src/agent/{test__tool/test_tool_core.py => test__idea/test_idea_core.py} (53%) create mode 100644 src/agent/test__idea/test_idea_kid.py rename src/agent/{test__tool/test_tool_meld.py => test__idea/test_idea_meld.py} (62%) rename src/agent/{test__tool/test_tool_road_change.py => test__idea/test_idea_road_change.py} (64%) create mode 100644 src/agent/test__idea/test_idea_root.py delete mode 100644 src/agent/test__tool/test_tool_kid.py delete mode 100644 src/agent/test__tool/test_tool_root.py create mode 100644 src/agent/test_agent/test_agent_idea_crud.py rename src/agent/test_agent/{test_agent_tool_list.py => test_agent_idea_list.py} (54%) create mode 100644 src/agent/test_agent/test_agent_idea_tree.py delete mode 100644 src/agent/test_agent/test_agent_tool_crud.py delete mode 100644 src/agent/test_agent/test_agent_tool_tree.py rename ui/{EditToolUI.py => EditIdeaUI.py} (75%) rename ui/{EditToolUnitUI.py => EditIdeaUnitUI.py} (94%) rename ui/{EditToolUnitUI.ui => EditIdeaUnitUI.ui} (98%) rename ui/{ui_ToolunitMainUI.py => ui_IdeaunitMainUI.py} (84%) diff --git a/EditAcptFactTime.py b/EditAcptFactTime.py index 6e0b6a994..2c0b5b0ea 100644 --- a/EditAcptFactTime.py +++ b/EditAcptFactTime.py @@ -65,10 +65,10 @@ def update_acptfact(self): self.close() def display_acptfact_time(self): - # minutes_tool = self.agent_x.get_tool_kid( + # minutes_idea = self.agent_x.get_idea_kid( # road=f"{self.agent_x._desc},time,jajatime" # ) - minutes_acptfact = self.agent_x._toolroot._acptfactunits[ + minutes_acptfact = self.agent_x._idearoot._acptfactunits[ f"{self.agent_x._desc},time,jajatime" ] diff --git a/EditAgenda.py b/EditAgenda.py index ad06c72d9..ea8c103ee 100644 --- a/EditAgenda.py +++ b/EditAgenda.py @@ -6,7 +6,7 @@ from src.pyqt5_kit.pyqt_func import num2str, lw_diplay from src.agent.hreg_time import ( SuffFactUnitHregTime, - _get_time_hreg_weekday_tool, + _get_time_hreg_weekday_idea, convert1440toHHMM, ) diff --git a/EditToolUnit.py b/EditIdeaUnit.py similarity index 83% rename from EditToolUnit.py rename to EditIdeaUnit.py index 7b83b3515..587471a53 100644 --- a/EditToolUnit.py +++ b/EditIdeaUnit.py @@ -1,7 +1,7 @@ -# command to for converting ui form to python file: pyuic5 ui\EditToolUnitUI.ui -o ui\EditToolUnitUI.py +# command to for converting ui form to python file: pyuic5 ui\EditIdeaUnitUI.ui -o ui\EditIdeaUnitUI.py import sys -from src.agent.tool import ToolKid, ToolAttrHolder -from ui.EditToolUnitUI import Ui_Form +from src.agent.idea import IdeaKid, IdeaAttrHolder +from ui.EditIdeaUnitUI import Ui_Form from PyQt5 import QtWidgets as qtw, QtCore from PyQt5.QtWidgets import QTableWidgetItem as qtw1, QTableWidget as qtw0 from src.agent.hreg_time import SuffFactUnitHregTime @@ -19,7 +19,7 @@ ) -class EditToolUnit(qtw0, Ui_Form): +class EditIdeaUnit(qtw0, Ui_Form): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -29,12 +29,12 @@ def __init__(self, *args, **kwargs): self.close_button.clicked.connect(self.close) self.quit_button.clicked.connect(sys.exit) - self.basetoolunit.itemClicked.connect(self.yo_tree_item_selected) - self.basetoolunit.itemActivated.connect(self.yo_tree_item_expanded) - self.submit_node_update.clicked.connect(self.tool_update) - self.submit_node_delete.clicked.connect(self.tool_delete) - self.submit_child_insert.clicked.connect(self.tool_insert) - self.submit_duty_insert.clicked.connect(self.tool_duty_insert) + self.baseideaunit.itemClicked.connect(self.yo_tree_item_selected) + self.baseideaunit.itemActivated.connect(self.yo_tree_item_expanded) + self.submit_node_update.clicked.connect(self.idea_update) + self.submit_node_delete.clicked.connect(self.idea_delete) + self.submit_child_insert.clicked.connect(self.idea_insert) + self.submit_duty_insert.clicked.connect(self.idea_duty_insert) self.cb_rootrank.stateChanged.connect(self.refresh_tree) self.cb_yo_id.stateChanged.connect(self.refresh_tree) @@ -51,9 +51,9 @@ def __init__(self, *args, **kwargs): self.cb_yo2bd_count.stateChanged.connect(self.refresh_tree) self.combo_dim_root.currentTextChanged.connect(self.refresh_tree) - self.tool2group_table.itemClicked.connect(self.tool2group_table_select) - self.tool2group_delete_button.clicked.connect(self.tool2group_delete) - self.tool2group_insert_button.clicked.connect(self.tool2group_update) + self.idea2group_table.itemClicked.connect(self.idea2group_table_select) + self.idea2group_delete_button.clicked.connect(self.idea2group_delete) + self.idea2group_insert_button.clicked.connect(self.idea2group_update) self.required_table.itemClicked.connect(self.required_table_select) self.required_base_combo.currentTextChanged.connect( self.required_sufffact_combo_load @@ -95,7 +95,7 @@ def set_base_to_hregtime(self): self.required_base_combo.setCurrentText("Myagent,time,jajatime") def add_hreg_to_agent(self): - self.agent_x.set_time_hreg_tools(c400_count=7) + self.agent_x.set_time_hreg_ideas(c400_count=7) self.refresh_tree() def yo_tree_item_setHidden(self, setHiddenBool): @@ -142,12 +142,12 @@ def yo_tree_item_setHidden(self, setHiddenBool): self.hreg_length_hr.setHidden(setHiddenBool) self.hreg_length_min.setHidden(setHiddenBool) self.submit_child_insert.setHidden(setHiddenBool) - self.tool2group_table.setHidden(setHiddenBool) - self.tool2group_table.clear() - self.tool2group_table.setRowCount(1) - self.tool2group_insert_combo.setHidden(setHiddenBool) - self.tool2group_delete_button.setHidden(setHiddenBool) - self.tool2group_insert_button.setHidden(setHiddenBool) + self.idea2group_table.setHidden(setHiddenBool) + self.idea2group_table.clear() + self.idea2group_table.setRowCount(1) + self.idea2group_insert_combo.setHidden(setHiddenBool) + self.idea2group_delete_button.setHidden(setHiddenBool) + self.idea2group_insert_button.setHidden(setHiddenBool) self.requiredheir_table.setHidden(True) self.required_table.setHidden(setHiddenBool) self.required_base_combo.setHidden(setHiddenBool) @@ -201,7 +201,7 @@ def yo_tree_item_setHidden(self, setHiddenBool): self.prom_label_02.setText("") self.yo_action_cb.setChecked(False) self.yo_description.setText("") - self.tool_desc_on_populate = "" + self.idea_desc_on_populate = "" self.yo_weight.setText("") # self.required_base_combo.setText("") # self.required_sufffact_combo.setText("") @@ -215,7 +215,7 @@ def yo_tree_item_setHidden(self, setHiddenBool): self.required_sufffact_open_combo.clear() self.required_sufffact_nigh_combo.clear() self.required_sufffact_divisor_combo.clear() - self.tool2group_insert_combo.clear() + self.idea2group_insert_combo.clear() if setHiddenBool == False: self.yo_x_populate() @@ -223,14 +223,14 @@ def yo_tree_item_setHidden(self, setHiddenBool): def yo_x_populate(self): self.label_parent_id.setText(f"Current Node road : {self.yo_x._walk}") self.yo_description.setText(self.yo_x._desc) - # self.tool_desc_on_populate = self.yo_x._desc + # self.idea_desc_on_populate = self.yo_x._desc self.yo_walk.setText(self.yo_x._walk) self.yo_weight.setText(num2str(self.yo_x._weight)) self.yo_begin.setText(num2str(self.yo_x._begin)) self.yo_special_road.clear() self.yo_numeric_road.clear() if f"{type(self.yo_x)}" != "": - self.populate_tool_kid_actions() + self.populate_idea_kid_actions() self.yo_close.setText(num2str(self.yo_x._close)) self.yo_action_cb.setChecked(self.yo_x.promise) self.yo_problem_bool_cb.setChecked(self.yo_x._problem_bool) @@ -240,42 +240,42 @@ def yo_x_populate(self): self.required_table_load() self.requiredheir_table_load() self.required_base_combo_load() - self.tool2group_table_load() - self.tool2group_insert_combo_load() + self.idea2group_table_load() + self.idea2group_insert_combo_load() if self.combo_dim_root.currentText() == "": self.combo_dim_root.addItems(list(self.agent_x.get_required_bases())) - def populate_tool_kid_actions(self): + def populate_idea_kid_actions(self): self.yo_addin.setText(num2str(self.yo_x._addin)) self.yo_numor.setText(num2str(self.yo_x._numor)) self.yo_denom.setText(num2str(self.yo_x._denom)) self.yo_reest.setChecked(bool_val(self.yo_x._reest)) - tool_road_list = self.agent_x.get_tool_tree_ordered_road_list() - tool_road_list.append("") - self.yo_special_road.addItems(tool_road_list) + idea_road_list = self.agent_x.get_idea_tree_ordered_road_list() + idea_road_list.append("") + self.yo_special_road.addItems(idea_road_list) self.yo_special_road.setCurrentText(self.yo_x._special_road) - self.yo_numeric_road.addItems(tool_road_list) + self.yo_numeric_road.addItems(idea_road_list) self.yo_numeric_road.setCurrentText(self.yo_x._numeric_road) def yo_tree_item_selected(self): - tool_desc = self.basetoolunit.currentItem().data(2, 10) - tool_walk = self.basetoolunit.currentItem().data(2, 11) - if tool_walk not in ("", None): - self.yo_x = self.agent_x.get_tool_kid(road=f"{tool_walk},{tool_desc}") + idea_desc = self.baseideaunit.currentItem().data(2, 10) + idea_walk = self.baseideaunit.currentItem().data(2, 11) + if idea_walk not in ("", None): + self.yo_x = self.agent_x.get_idea_kid(road=f"{idea_walk},{idea_desc}") else: - self.yo_x = self.agent_x._toolroot + self.yo_x = self.agent_x._idearoot self.yo_tree_item_setHidden(setHiddenBool=False) def yo_tree_item_expanded(self): - root = self.basetoolunit.invisibleRootItem() - self.tool_tree_set_is_expanded(root) + root = self.baseideaunit.invisibleRootItem() + self.idea_tree_set_is_expanded(root) def required_base_combo_load(self): - # create list of all tool roads (road+desc) + # create list of all idea roads (road+desc) self.required_base_combo.clear() self.required_base_combo.addItems([""]) self.required_base_combo.addItems( - self.agent_x.get_tool_tree_ordered_road_list() + self.agent_x.get_idea_tree_ordered_road_list() ) def required_sufffact_combo_load(self): @@ -290,12 +290,12 @@ def required_sufffact_combo_load(self): def required_sufffact_xxxx_combo_load(self): filtered_list = [] if self.required_sufffact_combo.currentText() not in [self.agent_x._desc, ""]: - sufffact_tool = self.agent_x.get_tool_kid( + sufffact_idea = self.agent_x.get_idea_kid( road=self.required_sufffact_combo.currentText() ) - if sufffact_tool._special_road != None: + if sufffact_idea._special_road != None: filtered_list = self.agent_x.get_heir_road_list( - sufffact_tool._special_road + sufffact_idea._special_road ) self.required_sufffact_open_combo.clear() self.required_sufffact_nigh_combo.clear() @@ -319,40 +319,40 @@ def required_sufffact_open_combo_select(self): self.required_sufffact_open_combo_sel_actions() def required_sufffact_open_combo_sel_actions(self): - open_tool_x = self.agent_x.get_tool_kid( + open_idea_x = self.agent_x.get_idea_kid( road=self.required_sufffact_open_combo.currentText() ) - if open_tool_x._begin != None: - self.required_sufffact_open.setText(str(open_tool_x._begin)) - if open_tool_x._close != None: - self.required_sufffact_nigh.setText(str(open_tool_x._close)) - if open_tool_x._addin != None: - self.required_sufffact_divisor.setText(str(open_tool_x._addin)) - if open_tool_x._numor != None: - self.required_sufffact_divisor.setText(str(open_tool_x._numor)) - if open_tool_x._denom != None: - self.required_sufffact_divisor.setText(str(open_tool_x._denom)) - if open_tool_x._reest != None: - self.required_sufffact_divisor.setText(str(open_tool_x._reest)) + if open_idea_x._begin != None: + self.required_sufffact_open.setText(str(open_idea_x._begin)) + if open_idea_x._close != None: + self.required_sufffact_nigh.setText(str(open_idea_x._close)) + if open_idea_x._addin != None: + self.required_sufffact_divisor.setText(str(open_idea_x._addin)) + if open_idea_x._numor != None: + self.required_sufffact_divisor.setText(str(open_idea_x._numor)) + if open_idea_x._denom != None: + self.required_sufffact_divisor.setText(str(open_idea_x._denom)) + if open_idea_x._reest != None: + self.required_sufffact_divisor.setText(str(open_idea_x._reest)) def numeric_road_combo_select(self): if self.required_sufffact_open_combo.currentText() not in [ self.agent_x._desc, "", ]: - open_tool_x = self.agent_x.get_tool_kid( + open_idea_x = self.agent_x.get_idea_kid( road=self.required_sufffact_open_combo.currentText() ) - # nigh_tool_x = self.agent_x.get_tool_kid( + # nigh_idea_x = self.agent_x.get_idea_kid( # road=self.required_sufffact_nigh_combo.currentText() # ) - # divisor_tool_x = self.agent_x.get_tool_kid( + # divisor_idea_x = self.agent_x.get_idea_kid( # road=self.required_sufffact_divisor_combo.currentText() # ) - # if open_tool_x._begin != None: - # self.required_sufffact_open.setText(str(open_tool_x._begin)) - # if open_tool_x._close != None: - # self.required_sufffact_nigh.setText(str(open_tool_x._close)) + # if open_idea_x._begin != None: + # self.required_sufffact_open.setText(str(open_idea_x._begin)) + # if open_idea_x._close != None: + # self.required_sufffact_nigh.setText(str(open_idea_x._close)) def set_sufffact_open_combo(self): if ( @@ -363,15 +363,15 @@ def set_sufffact_open_combo(self): ] and self.required_sufffact_open.toPlainText() != "" ): - open_tool_x = self.agent_x.get_tool_kid( + open_idea_x = self.agent_x.get_idea_kid( road=self.required_sufffact_open_combo.currentText() ) open_int = str2float(self.required_sufffact_open.toPlainText()) - open_kids = open_tool_x.get_kids_in_range(begin=open_int, close=open_int) + open_kids = open_idea_x.get_kids_in_range(begin=open_int, close=open_int) if len(open_kids) == 1: - tool_x = open_kids[0] + idea_x = open_kids[0] self.required_sufffact_open_combo.setCurrentText( - f"{tool_x._walk},{tool_x._desc}" + f"{idea_x._walk},{idea_x._desc}" ) def set_sufffact_nigh_combo(self): @@ -383,15 +383,15 @@ def set_sufffact_nigh_combo(self): ] and self.required_sufffact_nigh.toPlainText() != "" ): - nigh_tool_x = self.agent_x.get_tool_kid( + nigh_idea_x = self.agent_x.get_idea_kid( road=self.required_sufffact_nigh_combo.currentText() ) nigh_int = int(self.required_sufffact_nigh.toPlainText()) - nigh_kids = nigh_tool_x.get_kids_in_range(begin=nigh_int, close=nigh_int) + nigh_kids = nigh_idea_x.get_kids_in_range(begin=nigh_int, close=nigh_int) if len(nigh_kids) == 1: - tool_x = nigh_kids[0] + idea_x = nigh_kids[0] self.required_sufffact_nigh_combo.setCurrentText( - f"{tool_x._walk},{tool_x._desc}" + f"{idea_x._walk},{idea_x._desc}" ) def set_sufffact_divisor_combo(self): @@ -403,17 +403,17 @@ def set_sufffact_divisor_combo(self): ] and self.required_sufffact_divisor.toPlainText() != "" ): - divisor_tool_x = self.agent_x.get_tool_kid( + divisor_idea_x = self.agent_x.get_idea_kid( road=self.required_sufffact_divisor_combo.currentText() ) divisor_int = int(self.required_sufffact_divisor.toPlainText()) - divisor_kids = divisor_tool_x.get_kids_in_range( + divisor_kids = divisor_idea_x.get_kids_in_range( begin=divisor_int, close=divisor_int ) if len(divisor_kids) == 1: - tool_x = divisor_kids[0] + idea_x = divisor_kids[0] self.required_sufffact_divisor_combo.setCurrentText( - f"{tool_x._walk},{tool_x._desc}" + f"{idea_x._walk},{idea_x._desc}" ) def required_sufffact_nigh_combo_select(self): @@ -422,11 +422,11 @@ def required_sufffact_nigh_combo_select(self): self.agent_x._desc, "", ]: - nigh_tool_x = self.agent_x.get_tool_kid( + nigh_idea_x = self.agent_x.get_idea_kid( road=self.required_sufffact_nigh_combo.currentText() ) - if nigh_tool_x._close != None: - self.required_sufffact_nigh.setText(str(nigh_tool_x._close)) + if nigh_idea_x._close != None: + self.required_sufffact_nigh.setText(str(nigh_idea_x._close)) def required_sufffact_divisor_combo_select(self): self.required_sufffact_divisor.setText("") @@ -434,11 +434,11 @@ def required_sufffact_divisor_combo_select(self): self.agent_x._desc, "", ]: - divisor_tool_x = self.agent_x.get_tool_kid( + divisor_idea_x = self.agent_x.get_idea_kid( road=self.required_sufffact_divisor_combo.currentText() ) - if divisor_tool_x._denom != None: - self.required_sufffact_divisor.setText(str(divisor_tool_x._denom)) + if divisor_idea_x._denom != None: + self.required_sufffact_divisor.setText(str(divisor_idea_x._denom)) def required_table_load(self): self.required_table.clear() @@ -685,10 +685,10 @@ def required_upsert(self): open_x = str2float(self.required_sufffact_open.toPlainText()) nigh_x = str2float(self.required_sufffact_nigh.toPlainText()) divisor_x = str2float(self.required_sufffact_divisor.toPlainText()) - tool_desc = self.basetoolunit.currentItem().data(2, 10) - tool_walk = self.basetoolunit.currentItem().data(2, 11) - self.agent_x.edit_tool_attr( - road=f"{tool_walk},{tool_desc}", + idea_desc = self.baseideaunit.currentItem().data(2, 10) + idea_walk = self.baseideaunit.currentItem().data(2, 11) + self.agent_x.edit_idea_attr( + road=f"{idea_walk},{idea_desc}", required_base=base_x, required_sufffact=sufffact_x, required_sufffact_open=open_x, @@ -703,7 +703,7 @@ def required_upsert(self): # nigh=nigh_x, # divisor=divisor_x, # ) - self.agent_x.get_tool_list() + self.agent_x.get_idea_list() self.required_table_load() def required_delete(self): @@ -717,22 +717,22 @@ def required_delete(self): ) self.required_table_load() - def tool2group_table_select(self): - self.tool2group_delete_button.setText( - f"""Remove {self.tool2group_table.item(self.tool2group_table.currentRow(), 1).text()}""" + def idea2group_table_select(self): + self.idea2group_delete_button.setText( + f"""Remove {self.idea2group_table.item(self.idea2group_table.currentRow(), 1).text()}""" ) - def tool2group_table_load(self): - # tool2group_table is qtw.QTableWidget() - self.tool2group_table.clear() - self.tool2group_table.sortItems(1, QtCore.Qt.AscendingOrder) - self.tool2group_table.horizontalHeaderVisible = False - self.tool2group_table.verticalHeaderVisible = False - self.tool2group_table.setColumnWidth(0, 150) - self.tool2group_table.setColumnHidden(1, True) - self.tool2group_table.setColumnWidth(1, 50) - self.tool2group_table.setColumnWidth(2, 70) - self.tool2group_table.setHorizontalHeaderLabels( + def idea2group_table_load(self): + # idea2group_table is qtw.QTableWidget() + self.idea2group_table.clear() + self.idea2group_table.sortItems(1, QtCore.Qt.AscendingOrder) + self.idea2group_table.horizontalHeaderVisible = False + self.idea2group_table.verticalHeaderVisible = False + self.idea2group_table.setColumnWidth(0, 150) + self.idea2group_table.setColumnHidden(1, True) + self.idea2group_table.setColumnWidth(1, 50) + self.idea2group_table.setColumnWidth(2, 70) + self.idea2group_table.setHorizontalHeaderLabels( ["Group display", "group_name", "LW Force"] ) # print(f"{self.yo_x._grouplinks=}") @@ -745,22 +745,22 @@ def tool2group_table_load(self): # print(f"{groupheirs_list=}") for row, groupheir in enumerate(groupheirs_list, start=1): - self.tool2group_table.setRowCount(row) + self.idea2group_table.setRowCount(row) x_text = f" Heir: {groupheir.name}" for grouplink in grouplinks_list: if grouplink.name == groupheir.name: x_text = f"{groupheir.name}" - self.tool2group_table.setItem(row - 1, 0, qtw1(x_text)) - self.tool2group_table.setItem(row - 1, 1, qtw1(groupheir.name)) - self.tool2group_table.setItem( + self.idea2group_table.setItem(row - 1, 0, qtw1(x_text)) + self.idea2group_table.setItem(row - 1, 1, qtw1(groupheir.name)) + self.idea2group_table.setItem( row - 1, 2, qtw1(lw_diplay(groupheir._agent_credit)), ) - self.tool2group_table.sortItems(1, QtCore.Qt.AscendingOrder) + self.idea2group_table.sortItems(1, QtCore.Qt.AscendingOrder) - def tool2group_insert_combo_load(self): + def idea2group_insert_combo_load(self): # groupunits_list = list(self.agent_x._groupunits.values()) groupunits_names_list = [] for groupunit in self.agent_x._groups.values(): @@ -772,41 +772,41 @@ def tool2group_insert_combo_load(self): groupunits_names_list.append(groupunit.name) groupunits_names_list.sort(key=lambda x: x.lower(), reverse=False) - self.tool2group_insert_combo.clear() - self.tool2group_insert_combo.addItems(groupunits_names_list) + self.idea2group_insert_combo.clear() + self.idea2group_insert_combo.addItems(groupunits_names_list) - def tool2group_update(self): - bd_name_new = self.tool2group_insert_combo.currentText() + def idea2group_update(self): + bd_name_new = self.idea2group_insert_combo.currentText() if bd_name_new == "": - raise Exception("bd_name is empty, tool2bd cannot be updated") + raise Exception("bd_name is empty, idea2bd cannot be updated") grouplink_new = GroupLink(name=GroupName(bd_name_new), weight=1) - self.agent_x.edit_tool_attr( + self.agent_x.edit_idea_attr( road=f"{self.yo_x._walk},{self.yo_x._desc}", grouplink=grouplink_new ) - self.tool2group_insert_combo_load() - self.tool2group_table_load() + self.idea2group_insert_combo_load() + self.idea2group_table_load() - def tool2group_delete(self): + def idea2group_delete(self): delete_group_name = "" - if self.tool2group_table.currentRow() != None: - delete_group_name = self.tool2group_table.item( - self.tool2group_table.currentRow(), 1 + if self.idea2group_table.currentRow() != None: + delete_group_name = self.idea2group_table.item( + self.idea2group_table.currentRow(), 1 ).text() - self.agent_x.edit_tool_attr( + self.agent_x.edit_idea_attr( road=f"{self.yo_x._walk},{self.yo_x._desc}", grouplink_del=delete_group_name, ) - self.tool2group_insert_combo_load() - self.tool2group_table_load() + self.idea2group_insert_combo_load() + self.idea2group_table_load() - def tool_delete(self): - self.agent_x.del_tool_kid(road=f"{self.yo_x._walk},{self.yo_x._desc}") - self.basetoolunit.clear() + def idea_delete(self): + self.agent_x.del_idea_kid(road=f"{self.yo_x._walk},{self.yo_x._desc}") + self.baseideaunit.clear() self.refresh_tree(disable_is_expanded=True) - def tool_edit_nonroad_data(self, tool_road): - self.agent_x.edit_tool_attr( - road=tool_road, + def idea_edit_nonroad_data(self, idea_road): + self.agent_x.edit_idea_attr( + road=idea_road, weight=float(self.yo_weight.toPlainText()), begin=str2float(self.yo_begin.toPlainText()), close=str2float(self.yo_close.toPlainText()), @@ -834,9 +834,9 @@ def tool_edit_nonroad_data(self, tool_road): is_expanded=None, ) - def tool_edit_road(self, tool_road): - self.agent_x.edit_tool_desc( - old_road=tool_road, + def idea_edit_road(self, idea_road): + self.agent_x.edit_idea_desc( + old_road=idea_road, new_desc=self.yo_description.toPlainText(), ) @@ -844,42 +844,42 @@ def tool_edit_road(self, tool_road): self.refresh_tree(disable_is_expanded=True) self.yo_tree_item_setHidden(setHiddenBool=True) - def tool_update(self): - tool_road = None + def idea_update(self): + idea_road = None if self.yo_x._walk not in (None, ""): - tool_road = Road(f"{self.yo_x._walk},{self.yo_x._desc}") + idea_road = Road(f"{self.yo_x._walk},{self.yo_x._desc}") else: - tool_road = Road(f"{self.yo_x._desc}") - self.tool_edit_nonroad_data(tool_road=tool_road) + idea_road = Road(f"{self.yo_x._desc}") + self.idea_edit_nonroad_data(idea_road=idea_road) # if ( - # self.tool_desc_on_populate != self.yo_description.toPlainText() - # and self.tool_desc_on_populate != "" - # and self.tool_desc_on_populate != None + # self.idea_desc_on_populate != self.yo_description.toPlainText() + # and self.idea_desc_on_populate != "" + # and self.idea_desc_on_populate != None # ): - # self.tool_edit_road() + # self.idea_edit_road() if self.yo_x._desc != self.yo_description.toPlainText(): - self.tool_edit_road(tool_road=tool_road) + self.idea_edit_road(idea_road=idea_road) - def tool_duty_insert(self): + def idea_duty_insert(self): new_walk = f"{self.yo_x._desc}" if self.yo_x._walk not in ("", None): new_walk = f"{self.yo_x._walk},{self.yo_x._desc}" new_road = f"{new_walk},{self.yo_description.toPlainText()}" - self.tool_insert() + self.idea_insert() # add done/not_done children not_done_text = "not done" - self.agent_x.add_tool( - tool_kid=ToolKid(_desc=not_done_text), + self.agent_x.add_idea( + idea_kid=IdeaKid(_desc=not_done_text), walk=new_road, ) done_text = "done" - self.agent_x.add_tool( - tool_kid=ToolKid(_desc=done_text), + self.agent_x.add_idea( + idea_kid=IdeaKid(_desc=done_text), walk=new_road, ) # set required to "not done" - self.agent_x.edit_tool_attr( + self.agent_x.edit_idea_attr( road=new_road, required_base=new_road, required_sufffact=f"{new_road},{not_done_text}", @@ -890,9 +890,9 @@ def tool_duty_insert(self): ) self.refresh_tree() - def tool_insert(self): - new_tool = ToolKid(_desc=self.yo_description.toPlainText()) - tool_attr_x = ToolAttrHolder( + def idea_insert(self): + new_idea = IdeaKid(_desc=self.yo_description.toPlainText()) + idea_attr_x = IdeaAttrHolder( weight=float(self.yo_weight.toPlainText()), begin=str2float(self.yo_begin.toPlainText()), close=str2float(self.yo_close.toPlainText()), @@ -921,14 +921,14 @@ def tool_insert(self): problem_bool=None, on_meld_weight_action=None, ) - new_tool._set_tool_attr(tool_attr=tool_attr_x) - new_tool.set_kids_empty_if_null() + new_idea._set_idea_attr(idea_attr=idea_attr_x) + new_idea.set_kids_empty_if_null() take_parent_children_bool = self.cb_yo_insert_allChildren.checkState() == 2 new_walk = f"{self.yo_x._desc}" if self.yo_x._walk not in ("", None): new_walk = f"{self.yo_x._walk},{self.yo_x._desc}" - self.agent_x.add_tool( - tool_kid=new_tool, + self.agent_x.add_idea( + idea_kid=new_idea, walk=new_walk, ) self.refresh_tree() @@ -950,14 +950,14 @@ def refresh_tree(self, disable_is_expanded: bool = False): required_view_base = self.combo_dim_root.currentText() acptfactheir_view_flag = self.cb_acptfactheir_view.checkState() == 2 - # root = self.basetoolunit.invisibleRootItem() + # root = self.baseideaunit.invisibleRootItem() # self.yo_tree_isExpanded(node=root, level=1) - root = self.basetoolunit.invisibleRootItem() + root = self.baseideaunit.invisibleRootItem() if not disable_is_expanded: - self.tool_tree_set_is_expanded(root) + self.idea_tree_set_is_expanded(root) tree_root = get_pyqttree( - toolroot=self.agent_x._toolroot, + idearoot=self.agent_x._idearoot, yo_agenda_flag=yo_agenda_flag, yo_action_flag=yo_action_flag, yo_acptfactunit_time_flag=yo_acptfactunit_time_flag, @@ -974,10 +974,10 @@ def refresh_tree(self, disable_is_expanded: bool = False): src_agent=self.agent_x, ) - self.basetoolunit.clear() - self.basetoolunit.insertTopLevelItems(0, [tree_root]) + self.baseideaunit.clear() + self.baseideaunit.insertTopLevelItems(0, [tree_root]) - root = self.basetoolunit.invisibleRootItem() + root = self.baseideaunit.invisibleRootItem() self.pyqt_tree_setExpanded(root) # self.yo_tree_item_setHidden(setHiddenBool=True) @@ -989,7 +989,7 @@ def pyqt_tree_setExpanded(self, root): item.setExpanded(item.data(2, 20)) self.pyqt_tree_setExpanded(item) - def tool_tree_set_is_expanded(self, root): + def idea_tree_set_is_expanded(self, root): child_count = root.childCount() for i in range(child_count): item = root.child(i) @@ -1001,8 +1001,8 @@ def tool_tree_set_is_expanded(self, root): # print(f"road={road_x},{desc_x}") # print(f"{_road=}") - self.agent_x.edit_tool_attr(road=_road, is_expanded=is_expanded) - self.tool_tree_set_is_expanded(item) + self.agent_x.edit_idea_attr(road=_road, is_expanded=is_expanded) + self.idea_tree_set_is_expanded(item) def required_table_select(self): self.required_base_combo_load() diff --git a/EditMain.py b/EditMain.py index c68f6506a..e35950eb5 100644 --- a/EditMain.py +++ b/EditMain.py @@ -4,7 +4,7 @@ from PyQt5 import QtGui as qtg from PyQt5 import QtCore as qtc from PyQt5.QtWidgets import QTableWidgetItem as qtw1 -from EditToolUnit import EditToolUnit +from EditIdeaUnit import EditIdeaUnit from EditMember import EditMember from src.pyqt5_kit.pyqt_func import ( lw_diplay, @@ -21,13 +21,13 @@ class EditMainViewException(Exception): class EditMainView(qtw.QWidget, Ui_Form): """The settings dialog window""" - refresh_toolunit_submitted = qtc.pyqtSignal(bool) + refresh_ideaunit_submitted = qtc.pyqtSignal(bool) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.setupUi(self) self.refresh_button.clicked.connect(self.refresh_all) - self.basetoolunit.itemClicked.connect(self.open_edittoolunit) + self.baseideaunit.itemClicked.connect(self.open_editideaunit) self.member_list.itemClicked.connect(self.open_edit_member) self.close_button.clicked.connect(self.close) self.open_groupedit_button.clicked.connect(self.open_edit_member) @@ -78,14 +78,14 @@ def get_acptfacts_list(self): if self.display_problem_acptfacts_cb.checkState() == 2: x_list.extend( acptfact - for acptfact in self.agent_x._toolroot._acptfactunits.values() + for acptfact in self.agent_x._idearoot._acptfactunits.values() if ( - self.agent_x.get_tool_kid(road=acptfact.base)._problem_bool - or self.agent_x.get_tool_kid(road=acptfact.pick)._problem_bool + self.agent_x.get_idea_kid(road=acptfact.base)._problem_bool + or self.agent_x.get_idea_kid(road=acptfact.pick)._problem_bool ) ) else: - x_list = self.agent_x._toolroot._acptfactunits.values() + x_list = self.agent_x._idearoot._acptfactunits.values() return x_list def acptfacts_table_load(self): @@ -142,7 +142,7 @@ def acptfact_clear_fields(self): def acptfact_table_select(self): self.acptfact_base_update_combo.clear() self.acptfact_base_update_combo.addItems( - self.agent_x.get_tool_tree_ordered_road_list() + self.agent_x.get_idea_tree_ordered_road_list() ) self.acptfact_base_update_combo.setCurrentText( self.acptfacts_table.item(self.acptfacts_table.currentRow(), 2).text() @@ -184,7 +184,7 @@ def acptfact_update_heir(self, base_road): ): raise EditMainViewException("No table selection for acptfact update.") acptfact_update_combo_text = self.acptfact_update_combo.currentText() - self.agent_x._toolroot._acptfactunits[ + self.agent_x._idearoot._acptfactunits[ base_road ].acptfact = acptfact_update_combo_text self.base_road = None @@ -193,7 +193,7 @@ def acptfact_update_heir(self, base_road): def refresh_all(self): if self.agent_x != None: self.refresh_member_list() - self.refresh_tool_tree() + self.refresh_idea_tree() self.acptfacts_table_load() def refresh_member_list(self): @@ -219,11 +219,11 @@ def refresh_member_list(self): self.member_list.setItem(row - 1, 0, qtw.QTableWidgetItem(member.name)) self.member_list.setItem(row - 1, 1, qt_agent_credit) - def open_edittoolunit(self): - self.EditToolunit = EditToolUnit() - self.EditToolunit.agent_x = self.agent_x - self.EditToolunit.refresh_tree() - self.EditToolunit.show() + def open_editideaunit(self): + self.EditIdeaunit = EditIdeaUnit() + self.EditIdeaunit.agent_x = self.agent_x + self.EditIdeaunit.refresh_tree() + self.EditIdeaunit.show() def open_edit_member(self): self.edit_member = EditMember() @@ -231,10 +231,10 @@ def open_edit_member(self): self.edit_member.refresh_all() self.edit_member.show() - def refresh_tool_tree(self): - tree_root = get_pyqttree(toolroot=self.agent_x._toolroot) - self.basetoolunit.clear() - self.basetoolunit.insertTopLevelItems(0, [tree_root]) + def refresh_idea_tree(self): + tree_root = get_pyqttree(idearoot=self.agent_x._idearoot) + self.baseideaunit.clear() + self.baseideaunit.insertTopLevelItems(0, [tree_root]) # expand to depth set by agent def yo_tree_setExpanded(root): @@ -244,5 +244,5 @@ def yo_tree_setExpanded(root): item.setExpanded(item.data(2, 20)) yo_tree_setExpanded(item) - root = self.basetoolunit.invisibleRootItem() + root = self.baseideaunit.invisibleRootItem() yo_tree_setExpanded(root) diff --git a/EditMember2bd.py b/EditMember2bd.py index 21913ae3a..03bf6633b 100644 --- a/EditMember2bd.py +++ b/EditMember2bd.py @@ -8,7 +8,7 @@ class EditMember2bd(qtw.QWidget, Ui_Form): """The settings dialog window""" - refresh_toolunit_submitted = qtc.pyqtSignal(bool) + refresh_ideaunit_submitted = qtc.pyqtSignal(bool) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/EditProblem.py b/EditProblem.py index 9f0a14872..1aa4f619d 100644 --- a/EditProblem.py +++ b/EditProblem.py @@ -4,11 +4,11 @@ from PyQt5 import QtGui as qtg from PyQt5 import QtCore as qtc from PyQt5.QtWidgets import QTableWidgetItem as qti -from EditToolUnit import EditToolUnit +from EditIdeaUnit import EditIdeaUnit from EditMember import EditMember from src.pyqt5_kit.pyqt_func import lw_diplay, get_pyqttree, num2str from src.agent.group import groupunit_shop, grouplink_shop -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from src.agent.road import Road, get_walk_from_road, get_terminus_node_from_road from sys import exit as sys_exit @@ -39,7 +39,7 @@ class EditProblem(qtw.QWidget, Ui_Form): """The settings dialog window""" - refresh_toolunit_submitted = qtc.pyqtSignal(bool) + refresh_ideaunit_submitted = qtc.pyqtSignal(bool) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -47,7 +47,7 @@ def __init__(self, *args, **kwargs): self.close_button.clicked.connect(self.close) self.quit_button.clicked.connect(sys_exit) self.refresh_button.clicked.connect(self.refresh_all) - self.basetoolunit.itemClicked.connect(self.open_edittoolunit) + self.baseideaunit.itemClicked.connect(self.open_editideaunit) self.add_group_button.clicked.connect(self.add_group) self.load_problem_button.clicked.connect(self.load_problem) @@ -115,20 +115,20 @@ def create_grouplinks_list(self): return grouplinks_x_list def load_problem(self): - self.set_problem_dominate_action_tool(road=self.problem_name_text.text()) - self.set_problem_dominate_action_tool(road=self.action1_text.text()) - self.set_problem_dominate_action_tool(road=self.action2_text.text()) - self.set_problem_dominate_action_tool(road=self.action3_text.text()) + self.set_problem_dominate_action_idea(road=self.problem_name_text.text()) + self.set_problem_dominate_action_idea(road=self.action1_text.text()) + self.set_problem_dominate_action_idea(road=self.action2_text.text()) + self.set_problem_dominate_action_idea(road=self.action3_text.text()) self.refresh_all() - def set_problem_dominate_action_tool(self, road): + def set_problem_dominate_action_idea(self, road): if road != "": prob_walk = get_walk_from_road(road) prob_desc = get_terminus_node_from_road(road) - prob_tool = ToolKid(_desc=prob_desc, _walk=prob_walk) + prob_idea = IdeaKid(_desc=prob_desc, _walk=prob_walk) for grouplink_x in self.create_grouplinks_list(): - prob_tool.set_grouplink(grouplink_x) - self.agent_x.set_dominate_promise_tool(tool_kid=prob_tool) + prob_idea.set_grouplink(grouplink_x) + self.agent_x.set_dominate_promise_idea(idea_kid=prob_idea) def add_group(self): if self.add_group_text not in (None, ""): @@ -148,15 +148,15 @@ def refresh_all(self): if self.agent_x != None: self.refresh_agenda_list() - self.refresh_tool_tree() + self.refresh_idea_tree() - tool_road_list = self.agent_x.get_tool_tree_ordered_road_list() - tool_road_list.insert(0, "") + idea_road_list = self.agent_x.get_idea_tree_ordered_road_list() + idea_road_list.insert(0, "") self.problem_name_combo.clear() - self.problem_name_combo.addItems(tool_road_list) + self.problem_name_combo.addItems(idea_road_list) self.problem_context_combo.clear() - self.problem_context_combo.addItems(tool_road_list) + self.problem_context_combo.addItems(idea_road_list) self.group1_name_combo.clear() self.group2_name_combo.clear() self.group3_name_combo.clear() @@ -166,9 +166,9 @@ def refresh_all(self): self.action1_combo.clear() self.action2_combo.clear() self.action3_combo.clear() - self.action1_combo.addItems(tool_road_list) - self.action2_combo.addItems(tool_road_list) - self.action3_combo.addItems(tool_road_list) + self.action1_combo.addItems(idea_road_list) + self.action2_combo.addItems(idea_road_list) + self.action3_combo.addItems(idea_road_list) def select_agenda_item(self): pass @@ -256,11 +256,11 @@ def set_agenda_table_gui_attr(self): ] ) - def open_edittoolunit(self): - self.EditToolunit = EditToolUnit() - self.EditToolunit.agent_x = self.agent_x - self.EditToolunit.refresh_tree() - self.EditToolunit.show() + def open_editideaunit(self): + self.EditIdeaunit = EditIdeaUnit() + self.EditIdeaunit.agent_x = self.agent_x + self.EditIdeaunit.refresh_tree() + self.EditIdeaunit.show() def open_edit_member(self): self.edit_member = EditMember() @@ -268,10 +268,10 @@ def open_edit_member(self): self.edit_member.refresh_all() self.edit_member.show() - def refresh_tool_tree(self): - tree_root = get_pyqttree(toolroot=self.agent_x._toolroot) - self.basetoolunit.clear() - self.basetoolunit.insertTopLevelItems(0, [tree_root]) + def refresh_idea_tree(self): + tree_root = get_pyqttree(idearoot=self.agent_x._idearoot) + self.baseideaunit.clear() + self.baseideaunit.insertTopLevelItems(0, [tree_root]) # expand to depth set by agent def yo_tree_setExpanded(root): @@ -281,5 +281,5 @@ def yo_tree_setExpanded(root): item.setExpanded(item.data(2, 20)) yo_tree_setExpanded(item) - root = self.basetoolunit.invisibleRootItem() + root = self.baseideaunit.invisibleRootItem() yo_tree_setExpanded(root) diff --git a/README.md b/README.md index c15d85423..58d619b09 100644 --- a/README.md +++ b/README.md @@ -78,25 +78,25 @@ AgentUnit MemberUnit objects AgentUnit GroupUnit objects -AgentUnit ToolUnit objects +AgentUnit IdeaUnit objects -AgentUnit ToolUnit hierarchical structure +AgentUnit IdeaUnit hierarchical structure -AgentUnit ToolUnit GroupLink objects +AgentUnit IdeaUnit GroupLink objects -AgentUnit ToolUnit GroupLine objects +AgentUnit IdeaUnit GroupLine objects -AgentUnit ToolUnit GroupHeir objects +AgentUnit IdeaUnit GroupHeir objects -AgentUnit ToolUnit GroupHeir objects +AgentUnit IdeaUnit GroupHeir objects -AgentUnit ToolUnit RequiredFactUnit objects +AgentUnit IdeaUnit RequiredFactUnit objects -AgentUnit ToolUnit RequiredFactHeir objects +AgentUnit IdeaUnit RequiredFactHeir objects -AgentUnit ToolUnit AcptFactUnit objects +AgentUnit IdeaUnit AcptFactUnit objects -AgentUnit ToolUnit AcptFactHeir objects +AgentUnit IdeaUnit AcptFactHeir objects ## 1.3 Test-Driven-Development diff --git a/main_app.py b/main_app.py index 5003bbfe3..b27fdc8f8 100644 --- a/main_app.py +++ b/main_app.py @@ -199,10 +199,10 @@ def set_acptfact_time_open_5daysago(self): def _set_acptfact_time_open_midnight_attr(self): road_minute = f"{self.agent_x._desc},time,jajatime" open_dt = self.agent_x.get_time_dt_from_min( - self.agent_x._toolroot._acptfactunits[road_minute].open + self.agent_x._idearoot._acptfactunits[road_minute].open ) nigh_dt = self.agent_x.get_time_dt_from_min( - self.agent_x._toolroot._acptfactunits[road_minute].nigh + self.agent_x._idearoot._acptfactunits[road_minute].nigh ) open_midnight = datetime( year=open_dt.year, @@ -302,7 +302,7 @@ def agent_new(self): self.agent_x._set_acptfacts_empty_if_null() self.agent_x.set_members_empty_if_null() self.agent_x.set_groupunits_empty_if_null() - self.agent_x.set_time_hreg_tools(c400_count=7) + self.agent_x.set_time_hreg_ideas(c400_count=7) road_minute = f"{self.agent_x._desc},time,jajatime" self.agent_x.set_acptfact( base=road_minute, pick=road_minute, open=1000000, nigh=1000000 @@ -312,10 +312,10 @@ def agent_new(self): def refresh_datetime_display(self): road_minute = f"{self.agent_x._desc},time,jajatime" jajatime_open = self.agent_x.get_time_dt_from_min( - self.agent_x._toolroot._acptfactunits[road_minute].open + self.agent_x._idearoot._acptfactunits[road_minute].open ) jajatime_nigh = self.agent_x.get_time_dt_from_min( - self.agent_x._toolroot._acptfactunits[road_minute].nigh + self.agent_x._idearoot._acptfactunits[road_minute].nigh ) week_days = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") self.root_datetime_curr_label.setText( @@ -340,7 +340,7 @@ def agent_load(self, lw_json: str): self.refresh_all() def get_acptfacts_list(self): - return self.agent_x._toolroot._acptfactunits.values() + return self.agent_x._idearoot._acptfactunits.values() def acptfacts_table_load(self): self.acptfacts_table.setRowCount(0) @@ -395,7 +395,7 @@ def acptfact_update_heir(self, base_road): ): raise MainAppException("No table selection for acptfact update.") acptfact_update_combo_text = self.acptfact_update_combo.currentText() - self.agent_x._toolroot._acptfactunits[ + self.agent_x._idearoot._acptfactunits[ base_road ].acptfact = acptfact_update_combo_text self.base_road = None @@ -478,7 +478,7 @@ def set_agenda_states_table_properties(self): "jajatime", "jaja_nigh", "agent_importance", - "tool_road", + "idea_road", "branch_percent", ] ) diff --git a/main_system.py b/main_system.py index d23f4c360..2a489ca73 100644 --- a/main_system.py +++ b/main_system.py @@ -362,20 +362,20 @@ def get_ignores_list(self): x_list.extend([file] for file in digest_file_list) return x_list - def get_p_tools_list(self): + def get_p_ideas_list(self): x_list = [] if self.person_dest_agent != None: - tool_list = self.person_dest_agent.get_tool_tree_ordered_road_list() + idea_list = self.person_dest_agent.get_idea_tree_ordered_road_list() - for tool_road in tool_list: - tool_obj = self.person_dest_agent.get_tool_kid(tool_road) + for idea_road in idea_list: + idea_obj = self.person_dest_agent.get_idea_kid(idea_road) - if tool_obj._walk.find("time") != 3: + if idea_obj._walk.find("time") != 3: x_list.append( [ - lw_diplay(tool_obj._agent_importance), - tool_road, - len(tool_obj._grouplinks), + lw_diplay(idea_obj._agent_importance), + idea_road, + len(idea_obj._grouplinks), ] ) @@ -412,7 +412,7 @@ def get_p_acptfacts_list(self): if self.person_dest_agent != None: for ( acptfactunit - ) in self.person_dest_agent._toolroot._acptfactunits.values(): + ) in self.person_dest_agent._idearoot._acptfactunits.values(): open_nigh = "" if acptfactunit.open is None and acptfactunit.nigh is None: open_nigh = "" @@ -479,29 +479,29 @@ def _sub_refresh_ignores_table(self): ] self.refresh_x(self.ignores_table, column_headers, ignores_list) - def _sub_refresh_p_tools_table(self): - p_tools_list = self.get_p_tools_list() - if len(p_tools_list) >= 0: + def _sub_refresh_p_ideas_table(self): + p_ideas_list = self.get_p_ideas_list() + if len(p_ideas_list) >= 0: column_headers = [ "agent_importance", - f"Tools Table ({len(p_tools_list)})", + f"Ideas Table ({len(p_ideas_list)})", "grouplinks", ] else: column_headers = [ "agent_importance", - "Tools Table", + "Ideas Table", "grouplinks", ] - self.w_tools_table.setObjectName("Tools Table") - self.w_tools_table.setColumnHidden(0, False) - self.w_tools_table.setColumnHidden(1, False) - self.w_tools_table.setColumnHidden(2, False) + self.w_ideas_table.setObjectName("Ideas Table") + self.w_ideas_table.setColumnHidden(0, False) + self.w_ideas_table.setColumnHidden(1, False) + self.w_ideas_table.setColumnHidden(2, False) self.refresh_x( - table_x=self.w_tools_table, + table_x=self.w_ideas_table, column_header=column_headers, - populate_list=p_tools_list, + populate_list=p_ideas_list, column_width=[50, 300, 50], ) @@ -551,7 +551,7 @@ def _sub_refresh_p_agenda_table(self): column_headers = [ "agent_importance", f"Agenda ({len(p_agenda_list)})", - "Tool Walk", + "Idea Walk", ] self.refresh_x( @@ -579,7 +579,7 @@ def refresh_person(self): self.person_dest_agent = ( self.person_x.get_dest_agent_from_digest_agent_files() ) - self._sub_refresh_p_tools_table() + self._sub_refresh_p_ideas_table() self._sub_refresh_p_members_table() self._sub_refresh_p_groups_table() self._sub_refresh_p_acptfacts_table() diff --git a/src/agent/agent.py b/src/agent/agent.py index 36fee5f2d..f6d190775 100644 --- a/src/agent/agent.py +++ b/src/agent/agent.py @@ -34,9 +34,9 @@ ) from src.agent.tree_metrics import TreeMetrics from src.agent.x_func import x_get_json -from src.agent.tool import ToolCore, ToolKid, ToolRoot, ToolAttrHolder +from src.agent.idea import IdeaCore, IdeaKid, IdeaRoot, IdeaAttrHolder from src.agent.hreg_time import ( - _get_time_hreg_src_tool, + _get_time_hreg_src_idea, get_time_min_from_dt as hreg_get_time_min_from_dt, convert1440toReadableTime, get_number_with_postfix, @@ -71,8 +71,8 @@ class AgentUnit: _weight: float = None _members: dict[MemberName:MemberUnit] = None _groups: dict[GroupName:GroupUnit] = None - _toolroot: ToolRoot = None - _tool_dict: dict[Road:ToolCore] = None + _idearoot: IdeaRoot = None + _idea_dict: dict[Road:IdeaCore] = None _max_tree_traverse: int = 3 _tree_traverse_count: int = None _rational: bool = False @@ -83,7 +83,7 @@ def __init__(self, _weight: float = None, _desc=None) -> None: self._weight = _weight if _desc is None: _desc = "" - self._toolroot = ToolRoot(_desc=_desc, _uid=1) + self._idearoot = IdeaRoot(_desc=_desc, _uid=1) self._desc = _desc def set_banking_attr_memberunits(self, river_tmembers: dict): @@ -117,22 +117,22 @@ def get_bond_status(self) -> bool: if tree_metrics_x.bond_promise_count != 1: return False - promise_tool_road = tree_metrics_x.an_promise_tool_road + promise_idea_road = tree_metrics_x.an_promise_idea_road if ( - self._are_all_members_groups_are_in_tool_kid(road=promise_tool_road) + self._are_all_members_groups_are_in_idea_kid(road=promise_idea_road) == False ): return False - return self.all_tools_relevant_to_promise_tool(road=promise_tool_road) != False + return self.all_ideas_relevant_to_promise_idea(road=promise_idea_road) != False def export_all_bonds(self, dir: str): - self.set_all_tool_uids_unique() + self.set_all_idea_uids_unique() self.set_agent_metrics() # dict_x = {} - for yx in self.get_tool_list(): + for yx in self.get_idea_list(): if yx.promise: - cx = self.get_agent_sprung_from_single_tool(yx.get_road()) + cx = self.get_agent_sprung_from_single_idea(yx.get_road()) file_name = f"{yx._uid}.json" x_func_save_file( dest_dir=dir, @@ -142,17 +142,17 @@ def export_all_bonds(self, dir: str): ) return {} - def get_agent_sprung_from_single_tool(self, road: Road): + def get_agent_sprung_from_single_idea(self, road: Road): self.set_agent_metrics() - tool_x = self.get_tool_kid(road=road) - new_weight = self._weight * tool_x._agent_importance - cx = AgentUnit(_desc=self._toolroot._desc, _weight=new_weight) + idea_x = self.get_idea_kid(road=road) + new_weight = self._weight * idea_x._agent_importance + cx = AgentUnit(_desc=self._idearoot._desc, _weight=new_weight) - for road_assc in sorted(list(self._get_all_tool_assoc_roads(road))): - src_yx = self.get_tool_kid(road=road_assc) + for road_assc in sorted(list(self._get_all_idea_assoc_roads(road))): + src_yx = self.get_idea_kid(road=road_assc) new_yx = copy_deepcopy(src_yx) if new_yx._walk != "": - cx.add_tool(tool_kid=new_yx, walk=new_yx._walk) + cx.add_idea(idea_kid=new_yx, walk=new_yx._walk) cx.set_agent_metrics() # TODO grab groups @@ -160,30 +160,30 @@ def get_agent_sprung_from_single_tool(self, road: Road): # TODO grab acptfacts return cx - def _get_all_tool_assoc_roads(self, road: Road) -> set[Road]: - tool_ancestor_list = get_ancestor_roads(road=road) - tool_x = self.get_tool_kid(road=road) + def _get_all_idea_assoc_roads(self, road: Road) -> set[Road]: + idea_ancestor_list = get_ancestor_roads(road=road) + idea_x = self.get_idea_kid(road=road) requiredunit_base_road_list = [] - for requiredunit_obj in tool_x._requiredunits.values(): + for requiredunit_obj in idea_x._requiredunits.values(): required_base = requiredunit_obj.base requiredunit_base_road_list.extend(get_ancestor_roads(required_base)) requiredunit_base_road_list.extend(self.get_heir_road_list(required_base)) - tool_assoc_list = [road] - tool_assoc_list.extend(tool_ancestor_list) - tool_assoc_list.extend(requiredunit_base_road_list) - return set(tool_assoc_list) + idea_assoc_list = [road] + idea_assoc_list.extend(idea_ancestor_list) + idea_assoc_list.extend(requiredunit_base_road_list) + return set(idea_assoc_list) - def all_tools_relevant_to_promise_tool(self, road: Road) -> bool: - promise_tool_assoc_set = set(self._get_all_tool_assoc_roads(road=road)) - all_tools_set = set(self.get_tool_tree_ordered_road_list()) - return all_tools_set == all_tools_set.intersection(promise_tool_assoc_set) + def all_ideas_relevant_to_promise_idea(self, road: Road) -> bool: + promise_idea_assoc_set = set(self._get_all_idea_assoc_roads(road=road)) + all_ideas_set = set(self.get_idea_tree_ordered_road_list()) + return all_ideas_set == all_ideas_set.intersection(promise_idea_assoc_set) - def _are_all_members_groups_are_in_tool_kid(self, road: Road) -> bool: - tool_kid = self.get_tool_kid(road=road) - # get dict of all tool groupheirs - groupheir_list = tool_kid._groupheirs.keys() + def _are_all_members_groups_are_in_idea_kid(self, road: Road) -> bool: + idea_kid = self.get_idea_kid(road=road) + # get dict of all idea groupheirs + groupheir_list = idea_kid._groupheirs.keys() groupheir_dict = {groupheir_name: 1 for groupheir_name in groupheir_list} non_single_groupunits = { groupunit.name: groupunit @@ -211,14 +211,14 @@ def get_time_min_from_dt(self, dt: datetime) -> float: return hreg_get_time_min_from_dt(dt=dt) def get_time_c400_from_min(self, min: int) -> int: - c400_tool = self.get_tool_kid(f"{self._desc},time,tech,400 year cycle") - c400_min = c400_tool._close - return int(min / c400_min), c400_tool, min % c400_min + c400_idea = self.get_idea_kid(f"{self._desc},time,tech,400 year cycle") + c400_min = c400_idea._close + return int(min / c400_min), c400_idea, min % c400_min def get_time_c400yr_from_min(self, min: int): # given int minutes within 400 year range return year and remainder minutes - c400_count, c400_tool, c400yr_min = self.get_time_c400_from_min(min=min) - c100_4_96y = c400_tool.get_kids_in_range(begin=c400yr_min, close=c400yr_min)[0] + c400_count, c400_idea, c400yr_min = self.get_time_c400_from_min(min=min) + c100_4_96y = c400_idea.get_kids_in_range(begin=c400yr_min, close=c400yr_min)[0] cXXXyr_min = c400yr_min - c100_4_96y._begin # identify which range the time is in @@ -226,34 +226,34 @@ def get_time_c400yr_from_min(self, min: int): 50492160, 52596000, ): # 96 year and 100 year spans - yr4_1461 = self.get_tool_kid(f"{self._desc},time,tech,4year with leap") + yr4_1461 = self.get_idea_kid(f"{self._desc},time,tech,4year with leap") yr4_cycles = int(cXXXyr_min / yr4_1461._close) cXyr_min = cXXXyr_min % yr4_1461._close - yr1_tool = yr4_1461.get_kids_in_range(begin=cXyr_min, close=cXyr_min)[0] + yr1_idea = yr4_1461.get_kids_in_range(begin=cXyr_min, close=cXyr_min)[0] elif c100_4_96y._close - c100_4_96y._begin == 2102400: - yr4_1460 = self.get_tool_kid(f"{self._desc},time,tech,4year wo leap") + yr4_1460 = self.get_idea_kid(f"{self._desc},time,tech,4year wo leap") yr4_cycles = 0 - yr1_tool = yr4_1460.get_kids_in_range(begin=cXXXyr_min, close=cXXXyr_min)[0] + yr1_idea = yr4_1460.get_kids_in_range(begin=cXXXyr_min, close=cXXXyr_min)[0] cXyr_min = cXXXyr_min % yr4_1460._close - yr1_rem_min = cXyr_min - yr1_tool._begin - yr1_tool_begin = int(yr1_tool._desc.split("-")[0]) - 1 + yr1_rem_min = cXyr_min - yr1_idea._begin + yr1_idea_begin = int(yr1_idea._desc.split("-")[0]) - 1 c100_4_96y_begin = int(c100_4_96y._desc.split("-")[0]) - year_num = c100_4_96y_begin + (4 * yr4_cycles) + yr1_tool_begin - return year_num, yr1_tool, yr1_rem_min + year_num = c100_4_96y_begin + (4 * yr4_cycles) + yr1_idea_begin + return year_num, yr1_idea, yr1_rem_min def get_time_month_from_min(self, min: int): - year_num, yr1_tool, yr1_tool_rem_min = self.get_time_c400yr_from_min(min=min) + year_num, yr1_idea, yr1_idea_rem_min = self.get_time_c400yr_from_min(min=min) yrx = None - if yr1_tool._close - yr1_tool._begin == 525600: - yrx = self.get_tool_kid(f"{self._desc},time,tech,365 year") - elif yr1_tool._close - yr1_tool._begin == 527040: - yrx = self.get_tool_kid(f"{self._desc},time,tech,366 year") - mon_x = yrx.get_kids_in_range(begin=yr1_tool_rem_min, close=yr1_tool_rem_min)[0] - month_rem_min = yr1_tool_rem_min - mon_x._begin + if yr1_idea._close - yr1_idea._begin == 525600: + yrx = self.get_idea_kid(f"{self._desc},time,tech,365 year") + elif yr1_idea._close - yr1_idea._begin == 527040: + yrx = self.get_idea_kid(f"{self._desc},time,tech,366 year") + mon_x = yrx.get_kids_in_range(begin=yr1_idea_rem_min, close=yr1_idea_rem_min)[0] + month_rem_min = yr1_idea_rem_min - mon_x._begin month_num = int(mon_x._desc.split("-")[0]) - day_x = self.get_tool_kid(f"{self._desc},time,tech,day") + day_x = self.get_idea_kid(f"{self._desc},time,tech,day") day_num = int(month_rem_min / day_x._close) day_rem_min = month_rem_min % day_x._close return month_num, day_num, day_rem_min, day_x @@ -305,17 +305,17 @@ def get_jajatime_repeating_readable_text( def _get_jajatime_week_readable_text(self, open: int, divisor: int) -> str: open_in_week = open % divisor week_road = f"{self._desc},time,tech,week" - weekday_tools_dict = self.get_tool_ranged_kids( - tool_road=week_road, begin=open_in_week + weekday_ideas_dict = self.get_idea_ranged_kids( + idea_road=week_road, begin=open_in_week ) - weekday_tool_node = None - for tool in weekday_tools_dict.values(): - weekday_tool_node = tool + weekday_idea_node = None + for idea in weekday_ideas_dict.values(): + weekday_idea_node = idea if divisor == 10080: - return f"every {weekday_tool_node._desc} at {convert1440toReadableTime(min1440=open % 1440)}" + return f"every {weekday_idea_node._desc} at {convert1440toReadableTime(min1440=open % 1440)}" num_with_postfix = get_number_with_postfix(num=divisor // 10080) - return f"every {num_with_postfix} {weekday_tool_node._desc} at {convert1440toReadableTime(min1440=open % 1440)}" + return f"every {num_with_postfix} {weekday_idea_node._desc} at {convert1440toReadableTime(min1440=open % 1440)}" def get_members_metrics(self): tree_metrics = self.get_tree_metrics() @@ -612,32 +612,32 @@ def _edit_grouplinks_name( new_name: GroupName, allow_group_overwite: bool, ): - for tool_x in self.get_tool_list(): + for idea_x in self.get_idea_list(): if ( - tool_x._grouplinks.get(new_name) != None - and tool_x._grouplinks.get(old_name) != None + idea_x._grouplinks.get(new_name) != None + and idea_x._grouplinks.get(old_name) != None ): - old_grouplink = tool_x._grouplinks.get(old_name) + old_grouplink = idea_x._grouplinks.get(old_name) old_grouplink.name = new_name - tool_x._grouplinks.get(new_name).meld( + idea_x._grouplinks.get(new_name).meld( other_grouplink=old_grouplink, other_on_meld_weight_action="sum", src_on_meld_weight_action="sum", ) - tool_x.del_grouplink(groupname=old_name) + idea_x.del_grouplink(groupname=old_name) elif ( - tool_x._grouplinks.get(new_name) is None - and tool_x._grouplinks.get(old_name) != None + idea_x._grouplinks.get(new_name) is None + and idea_x._grouplinks.get(old_name) != None ): - old_grouplink = tool_x._grouplinks.get(old_name) + old_grouplink = idea_x._grouplinks.get(old_name) new_grouplink = grouplink_shop( name=new_name, creditor_weight=old_grouplink.creditor_weight, debtor_weight=old_grouplink.debtor_weight, ) - tool_x.set_grouplink(grouplink=new_grouplink) - tool_x.del_grouplink(groupname=old_name) + idea_x.set_grouplink(grouplink=new_grouplink) + idea_x.del_grouplink(groupname=old_name) def get_groupunits_name_list(self): groupname_list = list(self._groups.keys()) @@ -657,8 +657,8 @@ def set_time_acptfacts(self, open: datetime = None, nigh: datetime = None) -> No nigh=nigh_minutes, ) - def _is_tool_rangeroot(self, tool_road: Road): - anc_roads = get_ancestor_roads(road=tool_road) + def _is_idea_rangeroot(self, idea_road: Road): + anc_roads = get_ancestor_roads(road=idea_road) parent_road = self._desc if len(anc_roads) == 1 else anc_roads[1] # figure out if parent is range @@ -666,39 +666,39 @@ def _is_tool_rangeroot(self, tool_road: Road): if len(parent_road.split(",")) == 1: parent_range = False else: - parent_tool = self.get_tool_kid(road=parent_road) - parent_range = parent_tool._begin != None and parent_tool._close != None + parent_idea = self.get_idea_kid(road=parent_road) + parent_range = parent_idea._begin != None and parent_idea._close != None # figure out if numeric source exists - tool_x = self.get_tool_kid(road=tool_road) + idea_x = self.get_idea_kid(road=idea_road) numeric_src_road = None - numeric_src_road = tool_x._numeric_road != None + numeric_src_road = idea_x._numeric_road != None return not numeric_src_road and not parent_range def _get_rangeroot_acptfactunits(self): return [ acptfact - for acptfact in self._toolroot._acptfactunits.values() + for acptfact in self._idearoot._acptfactunits.values() if acptfact.open != None and acptfact.nigh != None - and self._is_tool_rangeroot(tool_road=acptfact.base) + and self._is_idea_rangeroot(idea_road=acptfact.base) ] - def _get_rangeroot_1stlevel_associates(self, ranged_acptfactunits: list[ToolCore]): + def _get_rangeroot_1stlevel_associates(self, ranged_acptfactunits: list[IdeaCore]): lemmas_x = Lemmas() lemmas_x.set_empty_if_null() - # lemma_tools = {} + # lemma_ideas = {} for acptfact in ranged_acptfactunits: - acptfact_tool = self.get_tool_kid(road=acptfact.base) - for kid in acptfact_tool._kids.values(): - lemmas_x.eval(tool_x=kid, src_acptfact=acptfact, src_tool=acptfact_tool) + acptfact_idea = self.get_idea_kid(road=acptfact.base) + for kid in acptfact_idea._kids.values(): + lemmas_x.eval(idea_x=kid, src_acptfact=acptfact, src_idea=acptfact_idea) - if acptfact_tool._special_road != None: + if acptfact_idea._special_road != None: lemmas_x.eval( - tool_x=self.get_tool_kid(road=acptfact_tool._special_road), + idea_x=self.get_idea_kid(road=acptfact_idea._special_road), src_acptfact=acptfact, - src_tool=acptfact_tool, + src_idea=acptfact_idea, ) return lemmas_x @@ -717,19 +717,19 @@ def _get_lemma_acptfactunits(self) -> dict: raise InvalidAgentException("lemma loop failed") lemma_y = lemmas_x.get_unevaluated_lemma() - tool_x = lemma_y.tool_x + idea_x = lemma_y.idea_x acptfact_x = lemma_y.calc_acptfact - road_x = f"{tool_x._walk},{tool_x._desc}" + road_x = f"{idea_x._walk},{idea_x._desc}" lemma_acptfactunits[road_x] = acptfact_x - for kid2 in tool_x._kids.values(): - lemmas_x.eval(tool_x=kid2, src_acptfact=acptfact_x, src_tool=tool_x) - if tool_x._special_road not in [None, ""]: + for kid2 in idea_x._kids.values(): + lemmas_x.eval(idea_x=kid2, src_acptfact=acptfact_x, src_idea=idea_x) + if idea_x._special_road not in [None, ""]: lemmas_x.eval( - tool_x=self.get_tool_kid(road=tool_x._special_road), + idea_x=self.get_idea_kid(road=idea_x._special_road), src_acptfact=acptfact_x, - src_tool=tool_x, + src_idea=idea_x, ) return lemma_acptfactunits @@ -740,37 +740,37 @@ def set_acptfact( pick: Road, open: float = None, nigh: float = None, - create_missing_tools: bool = None, + create_missing_ideas: bool = None, ): # sourcery skip: low-code-quality - if create_missing_tools: - self._set_toolkid_if_empty(road=base) - self._set_toolkid_if_empty(road=pick) + if create_missing_ideas: + self._set_ideakid_if_empty(road=base) + self._set_ideakid_if_empty(road=pick) self._set_acptfacts_empty_if_null() self._execute_tree_traverse() - acptfact_tool = self.get_tool_kid(road=base) + acptfact_idea = self.get_idea_kid(road=base) - if acptfact_tool._begin is None and acptfact_tool._close is None: - self._edit_set_toolroot_acptfactunits( + if acptfact_idea._begin is None and acptfact_idea._close is None: + self._edit_set_idearoot_acptfactunits( base=base, pick=pick, open=open, nigh=nigh ) - # if acptfact's tool no range or is a "range-root" then allow acptfact to be set by user + # if acptfact's idea no range or is a "range-root" then allow acptfact to be set by user elif ( - acptfact_tool._begin != None - and acptfact_tool._close != None - and self._is_tool_rangeroot(tool_road=base) == False + acptfact_idea._begin != None + and acptfact_idea._close != None + and self._is_idea_rangeroot(idea_road=base) == False ): raise InvalidAgentException( f"Non range-root acptfact:{base} can only be set by range-root acptfact" ) elif ( - acptfact_tool._begin != None - and acptfact_tool._close != None - and self._is_tool_rangeroot(tool_road=base) == True + acptfact_idea._begin != None + and acptfact_idea._close != None + and self._is_idea_rangeroot(idea_road=base) == True ): - # when tool is "range-root" identify any required.bases that are descendents + # when idea is "range-root" identify any required.bases that are descendents # calculate and set those descendent acptfacts # example: timeline range (0-, 1.5e9) is range-root # example: "timeline,weeks" (spllt 10080) is range-descendent @@ -780,40 +780,40 @@ def set_acptfact( # user should not set "timeline,weeks" acptfact, only "timeline" acptfact and # "timeline,weeks" should be set automatica_lly since there exists a required # that has that base. - self._edit_set_toolroot_acptfactunits( + self._edit_set_idearoot_acptfactunits( base=base, pick=pick, open=open, nigh=nigh ) # Find all AcptFact descendents and any special_road connections "Lemmas" lemmas_dict = self._get_lemma_acptfactunits() - for current_acptfact in self._toolroot._acptfactunits.values(): + for current_acptfact in self._idearoot._acptfactunits.values(): for lemma_acptfact in lemmas_dict.values(): if lemma_acptfact.base == current_acptfact.base: - self._edit_set_toolroot_acptfactunits( + self._edit_set_idearoot_acptfactunits( base=lemma_acptfact.base, pick=lemma_acptfact.pick, open=lemma_acptfact.open, nigh=lemma_acptfact.nigh, ) - self._toolroot._acptfactunits[ + self._idearoot._acptfactunits[ lemma_acptfact.base ] = lemma_acptfact for missing_acptfact in self.get_missing_acptfact_bases().keys(): for lemma_acptfact in lemmas_dict.values(): if lemma_acptfact.base == missing_acptfact: - self._toolroot._acptfactunits[ + self._idearoot._acptfactunits[ lemma_acptfact.base ] = lemma_acptfact self.set_agent_metrics() - def _edit_set_toolroot_acptfactunits( + def _edit_set_idearoot_acptfactunits( self, pick: Road, base: Road, open: float, nigh: float ): acptfactunit = acptfactunit_shop(base=base, pick=pick, open=open, nigh=nigh) try: - acptfact_obj = self._toolroot._acptfactunits[base] + acptfact_obj = self._idearoot._acptfactunits[base] if pick != None: acptfact_obj.set_attr(pick=pick) if open != None: @@ -821,10 +821,10 @@ def _edit_set_toolroot_acptfactunits( if nigh != None: acptfact_obj.set_attr(nigh=nigh) except KeyError as e: - self._toolroot._acptfactunits[acptfactunit.base] = acptfactunit + self._idearoot._acptfactunits[acptfactunit.base] = acptfactunit def get_acptfactunits_base_and_acptfact_list(self): - acptfact_list = list(self._toolroot._acptfactunits.values()) + acptfact_list = list(self._idearoot._acptfactunits.values()) node_dict = { acptfact_x.base.lower(): acptfact_x for acptfact_x in acptfact_list } @@ -842,54 +842,54 @@ def get_acptfactunits_base_and_acptfact_list(self): def del_acptfact(self, base: Road): self._set_acptfacts_empty_if_null() - self._toolroot._acptfactunits.pop(base) + self._idearoot._acptfactunits.pop(base) def get_tree_metrics(self) -> TreeMetrics: tree_metrics = TreeMetrics() - self._toolroot._level = 0 + self._idearoot._level = 0 tree_metrics.evaluate_node( - level=self._toolroot._level, - requireds=self._toolroot._requiredunits, - grouplinks=self._toolroot._grouplinks, - uid=self._toolroot._uid, - promise=self._toolroot.promise, - tool_road=self._toolroot.get_road(), + level=self._idearoot._level, + requireds=self._idearoot._requiredunits, + grouplinks=self._idearoot._grouplinks, + uid=self._idearoot._uid, + promise=self._idearoot.promise, + idea_road=self._idearoot.get_road(), ) - tool_list = [self._toolroot] - while tool_list != []: - tool_x = tool_list.pop() - if tool_x._kids != None: - for tool_kid in tool_x._kids.values(): - self._eval_tree_metrics(tool_x, tool_kid, tree_metrics, tool_list) + idea_list = [self._idearoot] + while idea_list != []: + idea_x = idea_list.pop() + if idea_x._kids != None: + for idea_kid in idea_x._kids.values(): + self._eval_tree_metrics(idea_x, idea_kid, tree_metrics, idea_list) return tree_metrics - def _eval_tree_metrics(self, tool_x, tool_kid, tree_metrics, tool_list): - tool_kid._level = tool_x._level + 1 + def _eval_tree_metrics(self, idea_x, idea_kid, tree_metrics, idea_list): + idea_kid._level = idea_x._level + 1 tree_metrics.evaluate_node( - level=tool_kid._level, - requireds=tool_kid._requiredunits, - grouplinks=tool_kid._grouplinks, - uid=tool_kid._uid, - promise=tool_kid.promise, - tool_road=tool_kid.get_road(), + level=idea_kid._level, + requireds=idea_kid._requiredunits, + grouplinks=idea_kid._grouplinks, + uid=idea_kid._uid, + promise=idea_kid.promise, + idea_road=idea_kid.get_road(), ) - tool_list.append(tool_kid) + idea_list.append(idea_kid) - def get_tool_uid_max(self) -> int: + def get_idea_uid_max(self) -> int: tree_metrics = self.get_tree_metrics() return tree_metrics.uid_max - def set_all_tool_uids_unique(self): + def set_all_idea_uids_unique(self): tree_metrics = self.get_tree_metrics() - tool_uid_max = tree_metrics.uid_max - tool_uid_dict = tree_metrics.uid_dict + idea_uid_max = tree_metrics.uid_max + idea_uid_dict = tree_metrics.uid_dict - for tool_x in self.get_tool_list(): - if tool_x._uid is None or tool_uid_dict.get(tool_x._uid) > 1: - new_tool_uid_max = tool_uid_max + 1 - self.edit_tool_attr(road=tool_x.get_road(), uid=new_tool_uid_max) - tool_uid_max = new_tool_uid_max + for idea_x in self.get_idea_list(): + if idea_x._uid is None or idea_uid_dict.get(idea_x._uid) > 1: + new_idea_uid_max = idea_uid_max + 1 + self.edit_idea_attr(road=idea_x.get_road(), uid=new_idea_uid_max) + idea_uid_max = new_idea_uid_max def get_node_count(self): tree_metrics = self.get_tree_metrics() @@ -912,46 +912,46 @@ def get_missing_acptfact_bases(self): tree_metrics = self.get_tree_metrics() required_bases = tree_metrics.required_bases missing_bases = {} - if self._toolroot._acptfactunits is None: + if self._idearoot._acptfactunits is None: missing_bases = required_bases - elif self._toolroot._acptfactunits != None: + elif self._idearoot._acptfactunits != None: for base, base_count in required_bases.items(): try: - levelCount = self._toolroot._acptfactunits[base] + levelCount = self._idearoot._acptfactunits[base] except KeyError: missing_bases[base] = base_count return missing_bases - def add_tool( + def add_idea( self, - tool_kid: ToolCore, + idea_kid: IdeaCore, walk: Road, - create_missing_tools_groups: bool = None, + create_missing_ideas_groups: bool = None, ): - temp_tool = self._toolroot + temp_idea = self._idearoot _road = walk.split(",") temp_road = _road.pop(0) - # toolroot cannot be replaced + # idearoot cannot be replaced if temp_road == self._desc and _road == []: - tool_kid.set_road(parent_road=Road(self._desc)) + idea_kid.set_road(parent_road=Road(self._desc)) else: parent_road = [temp_road] while _road != []: temp_road = _road.pop(0) - temp_tool = self._get_or_create_leveln_tool( - parent_tool=temp_tool, tool_desc=temp_road + temp_idea = self._get_or_create_leveln_idea( + parent_idea=temp_idea, idea_desc=temp_road ) parent_road.append(temp_road) - tool_kid.set_road(parent_road=",".join(parent_road)) + idea_kid.set_road(parent_road=",".join(parent_road)) - temp_tool.add_kid(tool_kid) + temp_idea.add_kid(idea_kid) - if create_missing_tools_groups: - self._create_missing_tools(road=Road(f"{walk},{tool_kid._desc}")) - self._create_missing_groups_members(grouplinks=tool_kid._grouplinks) + if create_missing_ideas_groups: + self._create_missing_ideas(road=Road(f"{walk},{idea_kid._desc}")) + self._create_missing_groups_members(grouplinks=idea_kid._grouplinks) def _create_missing_groups_members(self, grouplinks: dict[GroupName:GroupLink]): for grouplink_x in grouplinks.values(): @@ -959,52 +959,52 @@ def _create_missing_groups_members(self, grouplinks: dict[GroupName:GroupLink]): groupunit_x = groupunit_shop(name=grouplink_x.name, _members={}) self.set_groupunit(groupunit=groupunit_x) - def _create_missing_tools(self, road): + def _create_missing_ideas(self, road): self.set_agent_metrics() - posted_tool = self.get_tool_kid(road) + posted_idea = self.get_idea_kid(road) - for required_x in posted_tool._requiredunits.values(): - self._set_toolkid_if_empty(road=required_x.base) + for required_x in posted_idea._requiredunits.values(): + self._set_ideakid_if_empty(road=required_x.base) for sufffact_x in required_x.sufffacts.values(): - self._set_toolkid_if_empty(road=sufffact_x.need) - if posted_tool._special_road != None: - self._set_toolkid_if_empty(road=posted_tool._special_road) - if posted_tool._numeric_road != None: - self._set_toolkid_if_empty(road=posted_tool._numeric_road) + self._set_ideakid_if_empty(road=sufffact_x.need) + if posted_idea._special_road != None: + self._set_ideakid_if_empty(road=posted_idea._special_road) + if posted_idea._numeric_road != None: + self._set_ideakid_if_empty(road=posted_idea._numeric_road) - def _set_toolkid_if_empty(self, road: Road): + def _set_ideakid_if_empty(self, road: Road): try: - self.get_tool_kid(road) + self.get_idea_kid(road) except InvalidAgentException: - base_tool = ToolKid( + base_idea = IdeaKid( _desc=get_terminus_node_from_road(road=road), _walk=get_walk_from_road(road=road), ) - self.add_tool(tool_kid=base_tool, walk=base_tool._walk) + self.add_idea(idea_kid=base_idea, walk=base_idea._walk) - # def _get_or_create_level1_tool(self, tool_desc: str) -> ToolKid: - # return_tool = None + # def _get_or_create_level1_idea(self, idea_desc: str) -> IdeaKid: + # return_idea = None # try: - # return_tool = self._kids[tool_desc] + # return_idea = self._kids[idea_desc] # except Exception: # KeyError - # self.add_kid(ToolKid(_desc=tool_desc)) - # return_tool = self._kids[tool_desc] + # self.add_kid(IdeaKid(_desc=idea_desc)) + # return_idea = self._kids[idea_desc] - # return return_tool + # return return_idea - def _get_or_create_leveln_tool(self, parent_tool: ToolCore, tool_desc: str): - return_tool = None + def _get_or_create_leveln_idea(self, parent_idea: IdeaCore, idea_desc: str): + return_idea = None try: - return_tool = parent_tool._kids[tool_desc] + return_idea = parent_idea._kids[idea_desc] except Exception: KeyError - parent_tool.add_kid(ToolKid(_desc=tool_desc)) - return_tool = parent_tool._kids[tool_desc] + parent_idea.add_kid(IdeaKid(_desc=idea_desc)) + return_idea = parent_idea._kids[idea_desc] - return return_tool + return return_idea - def del_tool_kid(self, road: Road, del_children: bool = True): + def del_idea_kid(self, road: Road, del_children: bool = True): x_road = road.split(",") temp_desc = x_road.pop(0) temps_d = [temp_desc] @@ -1016,32 +1016,32 @@ def del_tool_kid(self, road: Road, del_children: bool = True): if x_road == []: if not del_children: - d_temp_tool = self.get_tool_kid(road=",".join(temps_d)) - for kid in d_temp_tool._kids.values(): - self.add_tool(tool_kid=kid, walk=",".join(temps_d[:-1])) - self._toolroot._kids.pop(temp_desc) + d_temp_idea = self.get_idea_kid(road=",".join(temps_d)) + for kid in d_temp_idea._kids.values(): + self.add_idea(idea_kid=kid, walk=",".join(temps_d[:-1])) + self._idearoot._kids.pop(temp_desc) elif x_road != []: - i_temp_tool = self._toolroot._kids[temp_desc] + i_temp_idea = self._idearoot._kids[temp_desc] while x_road != []: temp_desc = x_road.pop(0) - parent_temp_tool = i_temp_tool - i_temp_tool = i_temp_tool._kids[temp_desc] + parent_temp_idea = i_temp_idea + i_temp_idea = i_temp_idea._kids[temp_desc] - parent_temp_tool._kids.pop(temp_desc) + parent_temp_idea._kids.pop(temp_desc) self.set_agent_metrics() - def agent_and_toolroot_desc_edit(self, new_desc): + def agent_and_idearoot_desc_edit(self, new_desc): self._desc = new_desc - self.edit_tool_desc(old_road=self._toolroot._desc, new_desc=new_desc) + self.edit_idea_desc(old_road=self._idearoot._desc, new_desc=new_desc) - def edit_tool_desc( + def edit_idea_desc( self, old_road: Road, new_desc: str, ): - # confirm tool exists - if self.get_tool_kid(road=old_road) is None: - raise InvalidAgentException(f"Tool {old_road=} does not exist") + # confirm idea exists + if self.get_idea_kid(road=old_road) is None: + raise InvalidAgentException(f"Idea {old_road=} does not exist") walk = get_walk_from_road(road=old_road) new_road = road_validate(Road(f"{walk},{new_desc}")) @@ -1049,46 +1049,46 @@ def edit_tool_desc( if old_road != new_road: # if root _desc is changed if walk == "": - self._toolroot._desc = new_desc - self._toolroot._walk = walk + self._idearoot._desc = new_desc + self._idearoot._walk = walk else: - self._non_root_tool_desc_edit(old_road, new_desc, walk) - self._toolroot_find_replace_road(old_road=old_road, new_road=new_road) + self._non_root_idea_desc_edit(old_road, new_desc, walk) + self._idearoot_find_replace_road(old_road=old_road, new_road=new_road) self._set_acptfacts_empty_if_null() - self._toolroot._acptfactunits = find_replace_road_key_dict( - dict_x=self._toolroot._acptfactunits, + self._idearoot._acptfactunits = find_replace_road_key_dict( + dict_x=self._idearoot._acptfactunits, old_road=old_road, new_road=new_road, ) - def _non_root_tool_desc_edit(self, old_road, new_desc, walk): - tool_z = self.get_tool_kid(road=old_road) - tool_z._desc = new_desc - tool_z._walk = walk - tool_parent = self.get_tool_kid(road=get_walk_from_road(old_road)) - tool_parent._kids.pop(get_terminus_node_from_road(old_road)) - tool_parent._kids[tool_z._desc] = tool_z - - def _toolroot_find_replace_road(self, old_road, new_road): - self._toolroot.find_replace_road(old_road=old_road, new_road=new_road) - - tool_iter_list = [self._toolroot] - while tool_iter_list != []: - listed_tool = tool_iter_list.pop() - # put all tool_children in tool list - if listed_tool._kids != None: - for tool_kid in listed_tool._kids.values(): - tool_iter_list.append(tool_kid) + def _non_root_idea_desc_edit(self, old_road, new_desc, walk): + idea_z = self.get_idea_kid(road=old_road) + idea_z._desc = new_desc + idea_z._walk = walk + idea_parent = self.get_idea_kid(road=get_walk_from_road(old_road)) + idea_parent._kids.pop(get_terminus_node_from_road(old_road)) + idea_parent._kids[idea_z._desc] = idea_z + + def _idearoot_find_replace_road(self, old_road, new_road): + self._idearoot.find_replace_road(old_road=old_road, new_road=new_road) + + idea_iter_list = [self._idearoot] + while idea_iter_list != []: + listed_idea = idea_iter_list.pop() + # put all idea_children in idea list + if listed_idea._kids != None: + for idea_kid in listed_idea._kids.values(): + idea_iter_list.append(idea_kid) if is_sub_road_in_src_road( - src_road=tool_kid._walk, + src_road=idea_kid._walk, sub_road=old_road, ): - tool_kid._walk = change_road( - current_road=tool_kid._walk, + idea_kid._walk = change_road( + current_road=idea_kid._walk, old_road=old_road, new_road=new_road, ) - tool_kid.find_replace_road(old_road=old_road, new_road=new_road) + idea_kid.find_replace_road(old_road=old_road, new_road=new_road) def get_begin_close_if_denom_or_numeric_road( self, @@ -1098,29 +1098,29 @@ def get_begin_close_if_denom_or_numeric_road( numor: float, denom: float, reest: bool, - tool_road: Road, + idea_road: Road, numeric_road: Road, ): - anc_roads = get_ancestor_roads(road=tool_road) + anc_roads = get_ancestor_roads(road=idea_road) if (addin != None or numor != None or denom != None or reest != None) and len( anc_roads ) == 1: - raise InvalidAgentException("Root Tool cannot have numor denom reest.") + raise InvalidAgentException("Root Idea cannot have numor denom reest.") parent_road = self._desc if len(anc_roads) == 1 else anc_roads[1] parent_has_range = None - parent_tool_x = self.get_tool_kid(road=parent_road) - parent_begin = parent_tool_x._begin - parent_close = parent_tool_x._close + parent_idea_x = self.get_idea_kid(road=parent_road) + parent_begin = parent_idea_x._begin + parent_close = parent_idea_x._close parent_has_range = parent_begin is not None and parent_close is not None numeric_begin = None numeric_close = None numeric_range = None if numeric_road != None: - numeric_tool_x = self.get_tool_kid(road=numeric_road) - numeric_begin = numeric_tool_x._begin - numeric_close = numeric_tool_x._close + numeric_idea_x = self.get_idea_kid(road=numeric_road) + numeric_begin = numeric_idea_x._begin + numeric_close = numeric_idea_x._close numeric_range = numeric_begin != None and numeric_close != None if parent_has_range and addin not in [None, 0]: @@ -1143,11 +1143,11 @@ def get_begin_close_if_denom_or_numeric_road( if parent_has_range and numeric_range: raise InvalidAgentException( - "Tool has begin-close range parent, cannot have numeric_road" + "Idea has begin-close range parent, cannot have numeric_road" ) elif not parent_has_range and not numeric_range and numor != None: raise InvalidAgentException( - f"Tool cannot edit {numor=}/denom/reest of '{tool_road}' if parent '{parent_road}' or toolcore._numeric_road does not have begin/close range" + f"Idea cannot edit {numor=}/denom/reest of '{idea_road}' if parent '{parent_road}' or ideacore._numeric_road does not have begin/close range" ) return begin, close @@ -1195,7 +1195,7 @@ def _transform_begin_close( return begin, close - def edit_tool_attr( + def edit_idea_attr( self, road: Road, weight: int = None, @@ -1208,7 +1208,7 @@ def edit_tool_attr( required_sufffact_divisor: int = None, required_del_sufffact_base: Road = None, required_del_sufffact_need: Road = None, - required_suff_tool_active_status: str = None, + required_suff_idea_active_status: str = None, begin: float = None, close: float = None, addin: float = None, @@ -1252,11 +1252,11 @@ def edit_tool_attr( numor=numor, denom=denom, reest=reest, - tool_road=road, + idea_road=road, numeric_road=numeric_road, ) - tool_attr = ToolAttrHolder( + idea_attr = IdeaAttrHolder( weight=weight, uid=uid, required=required, @@ -1267,7 +1267,7 @@ def edit_tool_attr( required_sufffact_divisor=required_sufffact_divisor, required_del_sufffact_base=required_del_sufffact_base, required_del_sufffact_need=required_del_sufffact_need, - required_suff_tool_active_status=required_suff_tool_active_status, + required_suff_idea_active_status=required_suff_idea_active_status, begin=begin, close=close, addin=addin, @@ -1286,47 +1286,47 @@ def edit_tool_attr( problem_bool=problem_bool, on_meld_weight_action=on_meld_weight_action, ) - if tool_attr.required_sufffact != None: - suffact_tool = self.get_tool_kid(road=required_sufffact) - tool_attr.set_sufffact_range_attributes_influenced_by_sufffact_tool( - sufffact_open=suffact_tool._begin, - sufffact_nigh=suffact_tool._close, - # suffact_numor=suffact_tool.anc_numor, - sufffact_denom=suffact_tool._denom, - # anc_reest=suffact_tool.anc_reest, + if idea_attr.required_sufffact != None: + suffact_idea = self.get_idea_kid(road=required_sufffact) + idea_attr.set_sufffact_range_attributes_influenced_by_sufffact_idea( + sufffact_open=suffact_idea._begin, + sufffact_nigh=suffact_idea._close, + # suffact_numor=suffact_idea.anc_numor, + sufffact_denom=suffact_idea._denom, + # anc_reest=suffact_idea.anc_reest, ) - temp_tool = self.get_tool_kid(road=road) - temp_tool._set_tool_attr(tool_attr=tool_attr) - if f"{type(temp_tool)}".find("'.tool.ToolRoot'>") <= 0: - temp_tool._set_toolkid_attr(acptfactunit=acptfactunit) + temp_idea = self.get_idea_kid(road=road) + temp_idea._set_idea_attr(idea_attr=idea_attr) + if f"{type(temp_idea)}".find("'.idea.IdeaRoot'>") <= 0: + temp_idea._set_ideakid_attr(acptfactunit=acptfactunit) # deleting a grouplink reqquires a tree traverse to correctly set groupheirs and grouplines if grouplink_del != None or grouplink != None: self.set_agent_metrics() - def del_tool_required_sufffact( + def del_idea_required_sufffact( self, road: Road, required_base: Road, required_sufffact: Road ): - self.edit_tool_attr( + self.edit_idea_attr( road=road, required_del_sufffact_base=required_base, required_del_sufffact_need=required_sufffact, ) def _set_acptfacts_empty_if_null(self): - self._toolroot.set_acptfactunits_empty_if_null() + self._idearoot.set_acptfactunits_empty_if_null() def get_agenda_items( self, base: Road = None, agenda_todo: bool = True, agenda_state: bool = True - ) -> list[ToolCore]: + ) -> list[IdeaCore]: return [ - tool for tool in self.get_tool_list() if tool.is_agenda_item(base_x=base) + idea for idea in self.get_idea_list() if idea.is_agenda_item(base_x=base) ] def set_agenda_task_complete(self, task_road: Road, base: Road): - promise_item = self.get_tool_kid(road=task_road) + promise_item = self.get_idea_kid(road=task_road) promise_item.set_acptfactunit_to_complete( - base_acptfactunit=self._toolroot._acptfactunits[base] + base_acptfactunit=self._idearoot._acptfactunits[base] ) def get_memberunit_total_creditor_weight(self): @@ -1339,17 +1339,17 @@ def get_memberunit_total_debtor_weight(self): memberunit.get_debtor_weight() for memberunit in self._members.values() ) - def _add_to_memberunits_agent_credit_debt(self, tool_agent_importance: float): + def _add_to_memberunits_agent_credit_debt(self, idea_agent_importance: float): sum_memberunit_creditor_weight = self.get_memberunit_total_creditor_weight() sum_memberunit_debtor_weight = self.get_memberunit_total_debtor_weight() for memberunit_x in self._members.values(): au_agent_credit = ( - tool_agent_importance * memberunit_x.get_creditor_weight() + idea_agent_importance * memberunit_x.get_creditor_weight() ) / sum_memberunit_creditor_weight au_agent_debt = ( - tool_agent_importance * memberunit_x.get_debtor_weight() + idea_agent_importance * memberunit_x.get_debtor_weight() ) / sum_memberunit_debtor_weight memberunit_x.add_agent_credit_debt( @@ -1360,18 +1360,18 @@ def _add_to_memberunits_agent_credit_debt(self, tool_agent_importance: float): ) def _add_to_memberunits_agent_agenda_credit_debt( - self, tool_agent_importance: float + self, idea_agent_importance: float ): sum_memberunit_creditor_weight = self.get_memberunit_total_creditor_weight() sum_memberunit_debtor_weight = self.get_memberunit_total_debtor_weight() for memberunit_x in self._members.values(): au_agent_agenda_credit = ( - tool_agent_importance * memberunit_x.get_creditor_weight() + idea_agent_importance * memberunit_x.get_creditor_weight() ) / sum_memberunit_creditor_weight au_agent_agenda_debt = ( - tool_agent_importance * memberunit_x.get_debtor_weight() + idea_agent_importance * memberunit_x.get_debtor_weight() ) / sum_memberunit_debtor_weight memberunit_x.add_agent_credit_debt( @@ -1414,18 +1414,18 @@ def _set_groupunits_agent_importance(self, groupheirs: dict[GroupName:GroupLink] ) def _distribute_agent_agenda_importance(self): - for tool in self._tool_dict.values(): - # If there are no grouplines associated with tool + for idea in self._idea_dict.values(): + # If there are no grouplines associated with idea # distribute agent_importance via general memberunit # credit ratio and debt ratio - # if tool.is_agenda_item() and tool._grouplines == {}: - if tool.is_agenda_item(): - if tool._grouplines == {}: + # if idea.is_agenda_item() and idea._grouplines == {}: + if idea.is_agenda_item(): + if idea._grouplines == {}: self._add_to_memberunits_agent_agenda_credit_debt( - tool._agent_importance + idea._agent_importance ) else: - for groupline_x in tool._grouplines.values(): + for groupline_x in idea._grouplines.values(): self.add_to_group_agent_agenda_credit_debt( groupname=groupline_x.name, groupline_agent_credit=groupline_x._agent_credit, @@ -1476,10 +1476,10 @@ def _reset_memberunit_agent_credit_debt(self): for memberunit in self._members.values(): memberunit.reset_agent_credit_debt() - def _toolroot_inherit_requiredheirs(self): - self._toolroot.set_requiredunits_empty_if_null() + def _idearoot_inherit_requiredheirs(self): + self._idearoot.set_requiredunits_empty_if_null() x_dict = {} - for required in self._toolroot._requiredunits.values(): + for required in self._idearoot._requiredunits.values(): x_required = RequiredHeir(base=required.base, sufffacts=None) x_sufffacts = {} for w in required.sufffacts.values(): @@ -1492,49 +1492,49 @@ def _toolroot_inherit_requiredheirs(self): x_sufffacts[sufffact_x.need] = sufffact_x x_required.sufffacts = x_sufffacts x_dict[x_required.base] = x_required - self._toolroot._requiredheirs = x_dict + self._idearoot._requiredheirs = x_dict - def get_tool_kid(self, road: Road) -> ToolKid: + def get_idea_kid(self, road: Road) -> IdeaKid: if road is None: - raise InvalidAgentException("get_tool_kid received road=None") + raise InvalidAgentException("get_idea_kid received road=None") nodes = road.split(",") src = nodes.pop(0) - temp_tool = None + temp_idea = None - if nodes == [] and src == self._toolroot._desc: - temp_tool = self._toolroot + if nodes == [] and src == self._idearoot._desc: + temp_idea = self._idearoot # raise InvalidAgentException(f"Cannot return root '{src}'") else: - tool_desc = src if nodes == [] else nodes.pop(0) + idea_desc = src if nodes == [] else nodes.pop(0) try: - temp_tool = self._toolroot._kids.get(tool_desc) + temp_idea = self._idearoot._kids.get(idea_desc) while nodes != []: - tool_desc = nodes.pop(0) - temp_tool = temp_tool._kids[tool_desc] - if temp_tool is None: + idea_desc = nodes.pop(0) + temp_idea = temp_idea._kids[idea_desc] + if temp_idea is None: raise InvalidAgentException( - f"Temp_tool is None {tool_desc=}. No item at '{road}'" + f"Temp_idea is None {idea_desc=}. No item at '{road}'" ) except: raise InvalidAgentException( - f"Getting {tool_desc=} failed no item at '{road}'" + f"Getting {idea_desc=} failed no item at '{road}'" ) - return temp_tool + return temp_idea - def get_tool_ranged_kids( - self, tool_road: str, begin: float = None, close: float = None - ) -> dict[ToolCore]: - parent_tool = self.get_tool_kid(road=tool_road) + def get_idea_ranged_kids( + self, idea_road: str, begin: float = None, close: float = None + ) -> dict[IdeaCore]: + parent_idea = self.get_idea_kid(road=idea_road) if begin is None and close is None: - begin = parent_tool._begin - close = parent_tool._close + begin = parent_idea._begin + close = parent_idea._close elif begin != None and close is None: close = begin - tool_list = parent_tool.get_kids_in_range(begin=begin, close=close) - return {tool_x._desc: tool_x for tool_x in tool_list} + idea_list = parent_idea.get_kids_in_range(begin=begin, close=close) + return {idea_x._desc: idea_x for idea_x in idea_list} def _set_ancestor_metrics(self, road: Road): # sourcery skip: low-code-quality @@ -1545,144 +1545,144 @@ def _set_ancestor_metrics(self, road: Road): group_everyone = None if len(road.split(",")) <= 1: - group_everyone = self._toolroot._groupheirs in [None, {}] + group_everyone = self._idearoot._groupheirs in [None, {}] else: ancestor_roads = get_ancestor_roads(road=road) # remove root road ancestor_roads.pop(len(ancestor_roads) - 1) while ancestor_roads != []: - # youngest_untouched_tool - yu_tool_obj = self.get_tool_kid(road=ancestor_roads.pop(0)) - yu_tool_obj.set_descendant_promise_count_zero_if_null() - yu_tool_obj._descendant_promise_count += da_count - if yu_tool_obj.is_kidless(): - yu_tool_obj.set_kidless_grouplines() - child_grouplines = yu_tool_obj._grouplines + # youngest_untouched_idea + yu_idea_obj = self.get_idea_kid(road=ancestor_roads.pop(0)) + yu_idea_obj.set_descendant_promise_count_zero_if_null() + yu_idea_obj._descendant_promise_count += da_count + if yu_idea_obj.is_kidless(): + yu_idea_obj.set_kidless_grouplines() + child_grouplines = yu_idea_obj._grouplines else: - yu_tool_obj.set_grouplines(child_grouplines=child_grouplines) + yu_idea_obj.set_grouplines(child_grouplines=child_grouplines) - if yu_tool_obj._task == True: + if yu_idea_obj._task == True: da_count += 1 if ( group_everyone != False - and yu_tool_obj._all_member_credit != False - and yu_tool_obj._all_member_debt != False - and yu_tool_obj._groupheirs != {} + and yu_idea_obj._all_member_credit != False + and yu_idea_obj._all_member_debt != False + and yu_idea_obj._groupheirs != {} or group_everyone != False - and yu_tool_obj._all_member_credit == False - and yu_tool_obj._all_member_debt == False + and yu_idea_obj._all_member_credit == False + and yu_idea_obj._all_member_debt == False ): group_everyone = False elif group_everyone != False: group_everyone = True - yu_tool_obj._all_member_credit = group_everyone - yu_tool_obj._all_member_debt = group_everyone + yu_idea_obj._all_member_credit = group_everyone + yu_idea_obj._all_member_debt = group_everyone if ( group_everyone != False - and self._toolroot._all_member_credit != False - and self._toolroot._all_member_debt != False - and self._toolroot._groupheirs != {} + and self._idearoot._all_member_credit != False + and self._idearoot._all_member_debt != False + and self._idearoot._groupheirs != {} or group_everyone != False - and self._toolroot._all_member_credit == False - and self._toolroot._all_member_debt == False + and self._idearoot._all_member_credit == False + and self._idearoot._all_member_debt == False ): group_everyone = False - elif group_everyone != False and yu_tool_obj._groupheirs == {}: + elif group_everyone != False and yu_idea_obj._groupheirs == {}: group_everyone = True - self._toolroot._all_member_credit = group_everyone - self._toolroot._all_member_debt = group_everyone + self._idearoot._all_member_credit = group_everyone + self._idearoot._all_member_debt = group_everyone - if self._toolroot.is_kidless(): - self._toolroot.set_kidless_grouplines() + if self._idearoot.is_kidless(): + self._idearoot.set_kidless_grouplines() else: - self._toolroot.set_grouplines(child_grouplines=child_grouplines) - self._toolroot.set_descendant_promise_count_zero_if_null() - self._toolroot._descendant_promise_count += da_count + self._idearoot.set_grouplines(child_grouplines=child_grouplines) + self._idearoot.set_descendant_promise_count_zero_if_null() + self._idearoot._descendant_promise_count += da_count def _set_root_attributes(self): - self._toolroot._level = 0 - self._toolroot.set_road(parent_road="") - self._toolroot.set_requiredheirs( - requiredheirs=self._toolroot._requiredunits, agent_tool_dict=self._tool_dict + self._idearoot._level = 0 + self._idearoot.set_road(parent_road="") + self._idearoot.set_requiredheirs( + requiredheirs=self._idearoot._requiredunits, agent_idea_dict=self._idea_dict ) - self._toolroot.inherit_groupheirs() - self._toolroot.clear_grouplines() - self._toolroot.set_acptfactunits_empty_if_null() - self._toolroot._weight = 1 - self._toolroot._kids_total_weight = 0 - self._toolroot.set_kids_total_weight() - self._toolroot.set_sibling_total_weight(1) - self._toolroot.set_agent_importance(coin_onset_x=0, parent_coin_cease=1) - self._toolroot.set_groupheirs_agent_credit_debit() - self._toolroot.set_ancestor_promise_count(0, False) - self._toolroot.clear_descendant_promise_count() - self._toolroot.clear_all_member_credit_debt() - self._toolroot.promise = False - - if self._toolroot.is_kidless(): - self._set_ancestor_metrics(road=self._toolroot._walk) - self._distribute_agent_importance(tool=self._toolroot) + self._idearoot.inherit_groupheirs() + self._idearoot.clear_grouplines() + self._idearoot.set_acptfactunits_empty_if_null() + self._idearoot._weight = 1 + self._idearoot._kids_total_weight = 0 + self._idearoot.set_kids_total_weight() + self._idearoot.set_sibling_total_weight(1) + self._idearoot.set_agent_importance(coin_onset_x=0, parent_coin_cease=1) + self._idearoot.set_groupheirs_agent_credit_debit() + self._idearoot.set_ancestor_promise_count(0, False) + self._idearoot.clear_descendant_promise_count() + self._idearoot.clear_all_member_credit_debt() + self._idearoot.promise = False + + if self._idearoot.is_kidless(): + self._set_ancestor_metrics(road=self._idearoot._walk) + self._distribute_agent_importance(idea=self._idearoot) def _set_kids_attributes( self, - tool_kid: ToolKid, + idea_kid: IdeaKid, coin_onset: float, parent_coin_cease: float, - parent_tool: ToolKid = None, - ) -> ToolKid: + parent_idea: IdeaKid = None, + ) -> IdeaKid: parent_acptfacts = None parent_requiredheirs = None - if parent_tool is None: - parent_tool = self._toolroot - parent_acptfacts = self._toolroot._acptfactunits - parent_requiredheirs = self._toolroot_inherit_requiredheirs() + if parent_idea is None: + parent_idea = self._idearoot + parent_acptfacts = self._idearoot._acptfactunits + parent_requiredheirs = self._idearoot_inherit_requiredheirs() else: - parent_acptfacts = parent_tool._acptfactheirs - parent_requiredheirs = parent_tool._requiredheirs - - tool_kid.set_level(parent_level=parent_tool._level) - tool_kid.set_road(parent_road=parent_tool._walk, parent_desc=parent_tool._desc) - tool_kid.set_acptfactunits_empty_if_null() - tool_kid.set_acptfactheirs(acptfacts=parent_acptfacts) - tool_kid.set_requiredheirs(parent_requiredheirs, self._tool_dict) - tool_kid.inherit_groupheirs(parent_groupheirs=parent_tool._groupheirs) - tool_kid.clear_grouplines() - tool_kid.set_active_status(tree_traverse_count=self._tree_traverse_count) - tool_kid.set_sibling_total_weight(parent_tool._kids_total_weight) - # tool_kid.set_agent_importance( - # parent_agent_importance=parent_tool._agent_importance, + parent_acptfacts = parent_idea._acptfactheirs + parent_requiredheirs = parent_idea._requiredheirs + + idea_kid.set_level(parent_level=parent_idea._level) + idea_kid.set_road(parent_road=parent_idea._walk, parent_desc=parent_idea._desc) + idea_kid.set_acptfactunits_empty_if_null() + idea_kid.set_acptfactheirs(acptfacts=parent_acptfacts) + idea_kid.set_requiredheirs(parent_requiredheirs, self._idea_dict) + idea_kid.inherit_groupheirs(parent_groupheirs=parent_idea._groupheirs) + idea_kid.clear_grouplines() + idea_kid.set_active_status(tree_traverse_count=self._tree_traverse_count) + idea_kid.set_sibling_total_weight(parent_idea._kids_total_weight) + # idea_kid.set_agent_importance( + # parent_agent_importance=parent_idea._agent_importance, # coin_onset_x=coin_onset_x, - # parent_coin_cease=parent_tool._agent_coin_cease, + # parent_coin_cease=parent_idea._agent_coin_cease, # ) - tool_kid.set_agent_importance( + idea_kid.set_agent_importance( coin_onset_x=coin_onset, - parent_agent_importance=parent_tool._agent_importance, + parent_agent_importance=parent_idea._agent_importance, parent_coin_cease=parent_coin_cease, ) - tool_kid.set_ancestor_promise_count( - parent_tool._ancestor_promise_count, parent_tool.promise + idea_kid.set_ancestor_promise_count( + parent_idea._ancestor_promise_count, parent_idea.promise ) - tool_kid.clear_descendant_promise_count() - tool_kid.clear_all_member_credit_debt() + idea_kid.clear_descendant_promise_count() + idea_kid.clear_all_member_credit_debt() - if tool_kid.is_kidless(): - # set tool's ancestor metrics using agent root as common reference - self._set_ancestor_metrics(road=tool_kid.get_road()) - self._distribute_agent_importance(tool=tool_kid) + if idea_kid.is_kidless(): + # set idea's ancestor metrics using agent root as common reference + self._set_ancestor_metrics(road=idea_kid.get_road()) + self._distribute_agent_importance(idea=idea_kid) - def _distribute_agent_importance(self, tool: ToolCore): + def _distribute_agent_importance(self, idea: IdeaCore): # TODO manage situations where groupheir.creditor_weight is None for all groupheirs # TODO manage situations where groupheir.debtor_weight is None for all groupheirs - if tool.is_groupheirless() == False: - self._set_groupunits_agent_importance(groupheirs=tool._groupheirs) - elif tool.is_groupheirless(): + if idea.is_groupheirless() == False: + self._set_groupunits_agent_importance(groupheirs=idea._groupheirs) + elif idea.is_groupheirless(): self._add_to_memberunits_agent_credit_debt( - tool_agent_importance=tool._agent_importance + idea_agent_importance=idea._agent_importance ) def get_agent_importance( @@ -1691,16 +1691,16 @@ def get_agent_importance( sibling_ratio = weight / sibling_total_weight return parent_agent_importance * sibling_ratio - def get_tool_list(self): + def get_idea_list(self): self.set_agent_metrics() - return list(self._tool_dict.values()) + return list(self._idea_dict.values()) def set_agent_metrics(self): self._set_acptfacts_empty_if_null() self._rational = False self._tree_traverse_count = 0 - self._tool_dict = {self._toolroot.get_road(): self._toolroot} + self._idea_dict = {self._idearoot.get_road(): self._idearoot} while ( not self._rational and self._tree_traverse_count < self._max_tree_traverse @@ -1708,75 +1708,75 @@ def set_agent_metrics(self): self._execute_tree_traverse() self._run_after_each_tree_traverse() self._tree_traverse_count += 1 - self._run_after_tool_all_tree_traverses() + self._run_after_idea_all_tree_traverses() def _execute_tree_traverse(self): - self._run_before_tool_tree_traverse() + self._run_before_idea_tree_traverse() self._set_root_attributes() - coin_onset = self._toolroot._agent_coin_onset - parent_coin_cease = self._toolroot._agent_coin_cease + coin_onset = self._idearoot._agent_coin_onset + parent_coin_cease = self._idearoot._agent_coin_cease - cache_tool_list = [] - for tool_kid in self._toolroot._kids.values(): + cache_idea_list = [] + for idea_kid in self._idearoot._kids.values(): self._set_kids_attributes( - tool_kid=tool_kid, + idea_kid=idea_kid, coin_onset=coin_onset, parent_coin_cease=parent_coin_cease, ) - cache_tool_list.append(tool_kid) - coin_onset += tool_kid._agent_importance + cache_idea_list.append(idea_kid) + coin_onset += idea_kid._agent_importance # no function recursion, recursion by iterateing over list that can be added to by iterations - while cache_tool_list != []: - parent_tool = cache_tool_list.pop() + while cache_idea_list != []: + parent_idea = cache_idea_list.pop() if self._tree_traverse_count == 0: - self._tool_dict[parent_tool.get_road()] = parent_tool + self._idea_dict[parent_idea.get_road()] = parent_idea - if parent_tool._kids != None: - coin_onset = parent_tool._agent_coin_onset - parent_coin_cease = parent_tool._agent_coin_cease - for tool_kid in parent_tool._kids.values(): + if parent_idea._kids != None: + coin_onset = parent_idea._agent_coin_onset + parent_coin_cease = parent_idea._agent_coin_cease + for idea_kid in parent_idea._kids.values(): self._set_kids_attributes( - tool_kid=tool_kid, + idea_kid=idea_kid, coin_onset=coin_onset, parent_coin_cease=parent_coin_cease, - parent_tool=parent_tool, + parent_idea=parent_idea, ) - cache_tool_list.append(tool_kid) - coin_onset += tool_kid._agent_importance + cache_idea_list.append(idea_kid) + coin_onset += idea_kid._agent_importance def _run_after_each_tree_traverse(self): - any_tool_active_status_changed = False - for tool in self._tool_dict.values(): - tool.set_active_status_hx_empty_if_null() - if tool._active_status_hx.get(self._tree_traverse_count) != None: - any_tool_active_status_changed = True + any_idea_active_status_changed = False + for idea in self._idea_dict.values(): + idea.set_active_status_hx_empty_if_null() + if idea._active_status_hx.get(self._tree_traverse_count) != None: + any_idea_active_status_changed = True - if any_tool_active_status_changed == False: + if any_idea_active_status_changed == False: self._rational = True - def _run_after_tool_all_tree_traverses(self): + def _run_after_idea_all_tree_traverses(self): self._distribute_agent_agenda_importance() self._distribute_groups_agent_importance() self._set_agent_agenda_ratio_credit_debt() - def _run_before_tool_tree_traverse(self): + def _run_before_idea_tree_traverse(self): self._reset_groupunits_agent_credit_debt() self._reset_groupunits_agent_credit_debt() self._reset_memberunit_agent_credit_debt() def get_heir_road_list(self, src_road: Road): - # create list of all tool roads (road+desc) + # create list of all idea roads (road+desc) return [ road - for road in self.get_tool_tree_ordered_road_list() + for road in self.get_idea_tree_ordered_road_list() if road.find(src_road) == 0 ] - def get_tool_tree_ordered_road_list(self, no_range_descendents: bool = False): - tool_list = self.get_tool_list() - node_dict = {tool.get_road().lower(): tool.get_road() for tool in tool_list} + def get_idea_tree_ordered_road_list(self, no_range_descendents: bool = False): + idea_list = self.get_idea_list() + node_dict = {idea.get_road().lower(): idea.get_road() for idea in idea_list} node_lowercase_ordered_list = sorted(list(node_dict)) node_orginalcase_ordered_list = [ node_dict[node_l] for node_l in node_lowercase_ordered_list @@ -1791,19 +1791,19 @@ def get_tool_tree_ordered_road_list(self, no_range_descendents: bool = False): if len(anc_list) == 1: list_x.append(road) elif len(anc_list) == 2: - if self._toolroot._begin is None and self._toolroot._close is None: + if self._idearoot._begin is None and self._idearoot._close is None: list_x.append(road) else: - parent_tool = self.get_tool_kid(road=anc_list[1]) - if parent_tool._begin is None and parent_tool._close is None: + parent_idea = self.get_idea_kid(road=anc_list[1]) + if parent_idea._begin is None and parent_idea._close is None: list_x.append(road) return list_x def get_acptfactunits_dict(self): x_dict = {} - if self._toolroot._acptfactunits != None: - for acptfact_road, acptfact_obj in self._toolroot._acptfactunits.items(): + if self._idearoot._acptfactunits != None: + for acptfact_road, acptfact_obj in self._idearoot._acptfactunits.items(): x_dict[acptfact_road] = acptfact_obj.get_dict() return x_dict @@ -1824,26 +1824,26 @@ def groupunit_shops_dict(self): def get_dict(self): self.set_agent_metrics() return { - "_kids": self._toolroot.get_kids_dict(), - "_requiredunits": self._toolroot.get_requiredunits_dict(), + "_kids": self._idearoot.get_kids_dict(), + "_requiredunits": self._idearoot.get_requiredunits_dict(), "_acptfactunits": self.get_acptfactunits_dict(), "_members": self.get_members_dict(), "_groups": self.groupunit_shops_dict(), - "_grouplinks": self._toolroot.get_grouplinks_dict(), + "_grouplinks": self._idearoot.get_grouplinks_dict(), "_weight": self._weight, "_desc": self._desc, - "_uid": self._toolroot._uid, - "_begin": self._toolroot._begin, - "_close": self._toolroot._close, - "_addin": self._toolroot._addin, - "_numor": self._toolroot._numor, - "_denom": self._toolroot._denom, - "_reest": self._toolroot._reest, - "_problem_bool": self._toolroot._problem_bool, - "_is_expanded": self._toolroot._is_expanded, - "_special_road": self._toolroot._special_road, - "_numeric_road": self._toolroot._numeric_road, - "_on_meld_weight_action": self._toolroot._on_meld_weight_action, + "_uid": self._idearoot._uid, + "_begin": self._idearoot._begin, + "_close": self._idearoot._close, + "_addin": self._idearoot._addin, + "_numor": self._idearoot._numor, + "_denom": self._idearoot._denom, + "_reest": self._idearoot._reest, + "_problem_bool": self._idearoot._problem_bool, + "_is_expanded": self._idearoot._is_expanded, + "_special_road": self._idearoot._special_road, + "_numeric_road": self._idearoot._numeric_road, + "_on_meld_weight_action": self._idearoot._on_meld_weight_action, "_max_tree_traverse": self._max_tree_traverse, } @@ -1851,15 +1851,15 @@ def get_json(self): x_dict = self.get_dict() return x_get_json(dict_x=x_dict) - def set_time_hreg_tools(self, c400_count): - toolbase_list = _get_time_hreg_src_tool(c400_count=c400_count) - while len(toolbase_list) != 0: - yb = toolbase_list.pop(0) + def set_time_hreg_ideas(self, c400_count): + ideabase_list = _get_time_hreg_src_idea(c400_count=c400_count) + while len(ideabase_list) != 0: + yb = ideabase_list.pop(0) special_road_x = None if yb.sr != None: special_road_x = f"{self._desc},{yb.sr}" - tool_x = ToolKid( + idea_x = IdeaKid( _desc=yb.n, _begin=yb.b, _close=yb.c, @@ -1872,16 +1872,16 @@ def set_time_hreg_tools(self, c400_count): _special_road=special_road_x, ) road_x = f"{self._desc},{yb.rr}" - self.add_tool(tool_kid=tool_x, walk=road_x) + self.add_idea(idea_kid=idea_x, walk=road_x) numeric_road_x = None if yb.nr != None: numeric_road_x = f"{self._desc},{yb.nr}" - self.edit_tool_attr( + self.edit_idea_attr( road=f"{road_x},{yb.n}", numeric_road=numeric_road_x ) if yb.a != None: - self.edit_tool_attr( + self.edit_idea_attr( road=f"{road_x},{yb.n}", addin=yb.a, denom=yb.md, numor=yb.mn ) @@ -1892,24 +1892,24 @@ def get_agent4member( ): self.set_agent_metrics() agent4member = AgentUnit(_desc=member_name) - agent4member._toolroot._agent_importance = self._toolroot._agent_importance + agent4member._idearoot._agent_importance = self._idearoot._agent_importance # get member's members: memberzone # get memberzone groups member_groups = self.get_member_groups(member_name=member_name) - # set agent4member by traversing the tool tree and selecting associated groups + # set agent4member by traversing the idea tree and selecting associated groups # set root not_included_agent_importance = 0 - agent4member._toolroot._kids = {} - for ykx in self._toolroot._kids.values(): + agent4member._idearoot._kids = {} + for ykx in self._idearoot._kids.values(): y4a_included = any( group_ancestor.name in member_groups for group_ancestor in ykx._grouplines.values() ) if y4a_included: - y4a_new = ToolKid( + y4a_new = IdeaKid( _desc=ykx._desc, _agent_importance=ykx._agent_importance, _requiredunits=ykx._requiredunits, @@ -1919,47 +1919,47 @@ def get_agent4member( promise=ykx.promise, _task=ykx._task, ) - agent4member._toolroot._kids[ykx._desc] = y4a_new + agent4member._idearoot._kids[ykx._desc] = y4a_new else: not_included_agent_importance += ykx._agent_importance if not_included_agent_importance > 0: - y4a_other = ToolKid( + y4a_other = IdeaKid( _desc="__other__", _agent_importance=not_included_agent_importance, ) - agent4member._toolroot._kids[y4a_other._desc] = y4a_other + agent4member._idearoot._kids[y4a_other._desc] = y4a_other return agent4member # def get_agenda_items( # self, agenda_todo: bool = True, agenda_state: bool = True, base: Road = None - # ) -> list[ToolCore]: + # ) -> list[IdeaCore]: # return list(self.get_agenda_items(base=base)) - def set_dominate_promise_tool(self, tool_kid: ToolKid): - tool_kid.promise = True - self.add_tool( - tool_kid=tool_kid, - walk=Road(f"{tool_kid._walk}"), - create_missing_tools_groups=True, + def set_dominate_promise_idea(self, idea_kid: IdeaKid): + idea_kid.promise = True + self.add_idea( + idea_kid=idea_kid, + walk=Road(f"{idea_kid._walk}"), + create_missing_ideas_groups=True, ) - def get_tool_list_without_toolroot(self): - x_list = self.get_tool_list() + def get_idea_list_without_idearoot(self): + x_list = self.get_idea_list() x_list.pop(0) return x_list def make_meldable(self, starting_digest_agent): - self.edit_tool_desc( - old_road=Road(f"{self._toolroot._desc}"), - new_desc=starting_digest_agent._toolroot._desc, + self.edit_idea_desc( + old_road=Road(f"{self._idearoot._desc}"), + new_desc=starting_digest_agent._idearoot._desc, ) def meld(self, other_agent): self.meld_groups(other_agent=other_agent) self.meld_members(other_agent=other_agent) - self.meld_toolroot(other_agent=other_agent) + self.meld_idearoot(other_agent=other_agent) self.meld_acptfacts(other_agent=other_agent) self._weight = get_meld_weight( src_weight=self._weight, @@ -1968,16 +1968,16 @@ def meld(self, other_agent): other_on_meld_weight_action="default", ) - def meld_toolroot(self, other_agent): - self._toolroot.meld(other_tool=other_agent._toolroot, _toolroot=True) - o_tool_list = other_agent.get_tool_list_without_toolroot() - for oyx in o_tool_list: + def meld_idearoot(self, other_agent): + self._idearoot.meld(other_idea=other_agent._idearoot, _idearoot=True) + o_idea_list = other_agent.get_idea_list_without_idearoot() + for oyx in o_idea_list: o_road = road_validate(f"{oyx._walk},{oyx._desc}") try: - main_tool = self.get_tool_kid(o_road) - main_tool.meld(other_tool=oyx) + main_idea = self.get_idea_kid(o_road) + main_idea.meld(other_idea=oyx) except Exception: - self.add_tool(walk=oyx._walk, tool_kid=oyx) + self.add_idea(walk=oyx._walk, idea_kid=oyx) def meld_members(self, other_agent): self.set_members_empty_if_null() @@ -2000,13 +2000,13 @@ def meld_groups(self, other_agent): def meld_acptfacts(self, other_agent): self._set_acptfacts_empty_if_null() other_agent._set_acptfacts_empty_if_null() - for hx in other_agent._toolroot._acptfactunits.values(): - if self._toolroot._acptfactunits.get(hx.base) is None: + for hx in other_agent._idearoot._acptfactunits.values(): + if self._idearoot._acptfactunits.get(hx.base) is None: self.set_acptfact( base=hx.base, acptfact=hx.acptfact, open=hx.open, nigh=hx.nigh ) else: - self._toolroot._acptfactunits.get(hx.base).meld(hx) + self._idearoot._acptfactunits.get(hx.base).meld(hx) # class Agentshop: @@ -2016,65 +2016,65 @@ def get_from_json(lw_json: str) -> AgentUnit: def get_from_dict(lw_dict: dict) -> AgentUnit: c_x = AgentUnit() - c_x._toolroot._requiredunits = requireds_get_from_dict( + c_x._idearoot._requiredunits = requireds_get_from_dict( requireds_dict=lw_dict["_requiredunits"] ) - c_x._toolroot._acptfactunits = acptfactunits_get_from_dict( + c_x._idearoot._acptfactunits = acptfactunits_get_from_dict( x_dict=lw_dict["_acptfactunits"] ) c_x._groups = groupunits_get_from_dict(x_dict=lw_dict["_groups"]) - c_x._toolroot._grouplinks = grouplinks_get_from_dict(x_dict=lw_dict["_grouplinks"]) + c_x._idearoot._grouplinks = grouplinks_get_from_dict(x_dict=lw_dict["_grouplinks"]) c_x._members = memberunits_get_from_dict(x_dict=lw_dict["_members"]) c_x._desc = lw_dict["_desc"] - c_x._toolroot._desc = lw_dict["_desc"] + c_x._idearoot._desc = lw_dict["_desc"] c_x._weight = lw_dict["_weight"] c_x._max_tree_traverse = lw_dict.get("_max_tree_traverse") if lw_dict.get("_max_tree_traverse") is None: c_x._max_tree_traverse = 20 - c_x._toolroot._weight = lw_dict["_weight"] - c_x._toolroot._uid = lw_dict["_uid"] - c_x._toolroot._begin = lw_dict["_begin"] - c_x._toolroot._close = lw_dict["_close"] - c_x._toolroot._numor = lw_dict["_numor"] - c_x._toolroot._denom = lw_dict["_denom"] - c_x._toolroot._reest = lw_dict["_reest"] - c_x._toolroot._special_road = lw_dict["_special_road"] - c_x._toolroot._numeric_road = lw_dict["_numeric_road"] - c_x._toolroot._is_expanded = lw_dict["_is_expanded"] - - tool_dict_list = [] + c_x._idearoot._weight = lw_dict["_weight"] + c_x._idearoot._uid = lw_dict["_uid"] + c_x._idearoot._begin = lw_dict["_begin"] + c_x._idearoot._close = lw_dict["_close"] + c_x._idearoot._numor = lw_dict["_numor"] + c_x._idearoot._denom = lw_dict["_denom"] + c_x._idearoot._reest = lw_dict["_reest"] + c_x._idearoot._special_road = lw_dict["_special_road"] + c_x._idearoot._numeric_road = lw_dict["_numeric_road"] + c_x._idearoot._is_expanded = lw_dict["_is_expanded"] + + idea_dict_list = [] for x_dict in lw_dict["_kids"].values(): x_dict["temp_road"] = c_x._desc - tool_dict_list.append(x_dict) + idea_dict_list.append(x_dict) - while tool_dict_list != []: - tool_dict = tool_dict_list.pop(0) - for x_dict in tool_dict["_kids"].values(): - temp_road = tool_dict["temp_road"] - temp_desc = tool_dict["_desc"] + while idea_dict_list != []: + idea_dict = idea_dict_list.pop(0) + for x_dict in idea_dict["_kids"].values(): + temp_road = idea_dict["temp_road"] + temp_desc = idea_dict["_desc"] x_dict["temp_road"] = f"{temp_road},{temp_desc}" - tool_dict_list.append(x_dict) - - tool_obj = ToolKid( - _desc=tool_dict["_desc"], - _weight=tool_dict["_weight"], - _uid=tool_dict["_uid"], - _begin=tool_dict["_begin"], - _close=tool_dict["_close"], - _numor=tool_dict["_numor"], - _denom=tool_dict["_denom"], - _reest=tool_dict["_reest"], - promise=tool_dict["promise"], + idea_dict_list.append(x_dict) + + idea_obj = IdeaKid( + _desc=idea_dict["_desc"], + _weight=idea_dict["_weight"], + _uid=idea_dict["_uid"], + _begin=idea_dict["_begin"], + _close=idea_dict["_close"], + _numor=idea_dict["_numor"], + _denom=idea_dict["_denom"], + _reest=idea_dict["_reest"], + promise=idea_dict["promise"], _requiredunits=requireds_get_from_dict( - requireds_dict=tool_dict["_requiredunits"] + requireds_dict=idea_dict["_requiredunits"] ), - _grouplinks=grouplinks_get_from_dict(tool_dict["_grouplinks"]), - _acptfactunits=acptfactunits_get_from_dict(tool_dict["_acptfactunits"]), - _is_expanded=tool_dict["_is_expanded"], - _special_road=tool_dict["_special_road"], - _numeric_road=tool_dict["_numeric_road"], + _grouplinks=grouplinks_get_from_dict(idea_dict["_grouplinks"]), + _acptfactunits=acptfactunits_get_from_dict(idea_dict["_acptfactunits"]), + _is_expanded=idea_dict["_is_expanded"], + _special_road=idea_dict["_special_road"], + _numeric_road=idea_dict["_numeric_road"], ) - c_x.add_tool(tool_kid=tool_obj, walk=tool_dict["temp_road"]) + c_x.add_idea(idea_kid=idea_obj, walk=idea_dict["temp_road"]) c_x.set_agent_metrics() # clean up tree traverse defined fields return c_x diff --git a/src/agent/examples/example_agents.py b/src/agent/examples/example_agents.py index d56210455..386ab6944 100644 --- a/src/agent/examples/example_agents.py +++ b/src/agent/examples/example_agents.py @@ -1,4 +1,4 @@ -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from src.agent.required import ( acptfactunit_shop, sufffactunit_shop, @@ -74,17 +74,17 @@ def get_agent_with_4_levels() -> AgentUnit: agent_x = AgentUnit(_weight=10, _desc=src_road) work = "work" - tool_kid_work = ToolKid(_weight=30, _desc=work, promise=True) - agent_x.add_tool(tool_kid=tool_kid_work, walk=src_road) + idea_kid_work = IdeaKid(_weight=30, _desc=work, promise=True) + agent_x.add_idea(idea_kid=idea_kid_work, walk=src_road) cat = "feed cat" - tool_kid_feedcat = ToolKid(_weight=30, _desc=cat, promise=True) - agent_x.add_tool(tool_kid=tool_kid_feedcat, walk=src_road) + idea_kid_feedcat = IdeaKid(_weight=30, _desc=cat, promise=True) + agent_x.add_idea(idea_kid=idea_kid_feedcat, walk=src_road) week_text = "weekdays" week_road = f"{src_road},{week_text}" - tool_kid_weekdays = ToolKid(_weight=40, _desc=week_text) - agent_x.add_tool(tool_kid=tool_kid_weekdays, walk=src_road) + idea_kid_weekdays = IdeaKid(_weight=40, _desc=week_text) + agent_x.add_idea(idea_kid=idea_kid_weekdays, walk=src_road) sun_text = "Sunday" mon_text = "Monday" @@ -94,44 +94,44 @@ def get_agent_with_4_levels() -> AgentUnit: fri_text = "Friday" sat_text = "Saturday" - tool_grandkidU = ToolKid(_weight=20, _desc=sun_text) - tool_grandkidM = ToolKid(_weight=20, _desc=mon_text) - tool_grandkidT = ToolKid(_weight=20, _desc=tue_text) - tool_grandkidW = ToolKid(_weight=20, _desc=wed_text) - tool_grandkidR = ToolKid(_weight=30, _desc=thu_text) - tool_grandkidF = ToolKid(_weight=40, _desc=fri_text) - tool_grandkidA = ToolKid(_weight=50, _desc=sat_text) - - agent_x.add_tool(tool_grandkidU, week_road) - agent_x.add_tool(tool_grandkidM, week_road) - agent_x.add_tool(tool_grandkidT, week_road) - agent_x.add_tool(tool_grandkidW, week_road) - agent_x.add_tool(tool_grandkidR, week_road) - agent_x.add_tool(tool_grandkidF, week_road) - agent_x.add_tool(tool_grandkidA, week_road) + idea_grandkidU = IdeaKid(_weight=20, _desc=sun_text) + idea_grandkidM = IdeaKid(_weight=20, _desc=mon_text) + idea_grandkidT = IdeaKid(_weight=20, _desc=tue_text) + idea_grandkidW = IdeaKid(_weight=20, _desc=wed_text) + idea_grandkidR = IdeaKid(_weight=30, _desc=thu_text) + idea_grandkidF = IdeaKid(_weight=40, _desc=fri_text) + idea_grandkidA = IdeaKid(_weight=50, _desc=sat_text) + + agent_x.add_idea(idea_grandkidU, week_road) + agent_x.add_idea(idea_grandkidM, week_road) + agent_x.add_idea(idea_grandkidT, week_road) + agent_x.add_idea(idea_grandkidW, week_road) + agent_x.add_idea(idea_grandkidR, week_road) + agent_x.add_idea(idea_grandkidF, week_road) + agent_x.add_idea(idea_grandkidA, week_road) states_text = "nation-state" states_road = f"{src_road},{states_text}" - tool_kid_states = ToolKid(_weight=30, _desc=states_text) - agent_x.add_tool(tool_kid=tool_kid_states, walk=f"{src_road}") + idea_kid_states = IdeaKid(_weight=30, _desc=states_text) + agent_x.add_idea(idea_kid=idea_kid_states, walk=f"{src_road}") usa_text = "USA" usa_road = f"{states_road},{usa_text}" france_text = "France" brazil_text = "Brazil" - tool_grandkid_usa = ToolKid(_weight=50, _desc=usa_text) - tool_grandkid_france = ToolKid(_weight=50, _desc=france_text) - tool_grandkid_brazil = ToolKid(_weight=50, _desc=brazil_text) - agent_x.add_tool(tool_grandkid_france, states_road) - agent_x.add_tool(tool_grandkid_brazil, states_road) - agent_x.add_tool(tool_grandkid_usa, states_road) + idea_grandkid_usa = IdeaKid(_weight=50, _desc=usa_text) + idea_grandkid_france = IdeaKid(_weight=50, _desc=france_text) + idea_grandkid_brazil = IdeaKid(_weight=50, _desc=brazil_text) + agent_x.add_idea(idea_grandkid_france, states_road) + agent_x.add_idea(idea_grandkid_brazil, states_road) + agent_x.add_idea(idea_grandkid_usa, states_road) texas_text = "Texas" oregon_text = "Oregon" - tool_grandgrandkid_usa_texas = ToolKid(_weight=50, _desc=texas_text) - tool_grandgrandkid_usa_oregon = ToolKid(_weight=50, _desc=oregon_text) - agent_x.add_tool(tool_grandgrandkid_usa_texas, usa_road) - agent_x.add_tool(tool_grandgrandkid_usa_oregon, usa_road) + idea_grandgrandkid_usa_texas = IdeaKid(_weight=50, _desc=texas_text) + idea_grandgrandkid_usa_oregon = IdeaKid(_weight=50, _desc=oregon_text) + agent_x.add_idea(idea_grandgrandkid_usa_texas, usa_road) + agent_x.add_idea(idea_grandgrandkid_usa_oregon, usa_road) return agent_x @@ -153,8 +153,8 @@ def get_agent_with_4_levels_and_2requireds() -> AgentUnit: ) work_text = "work" work_road = f"{agent_x._desc},{work_text}" - agent_x.edit_tool_attr(road=work_road, required=work_wk_required) - agent_x.edit_tool_attr(road=work_road, required=nation_required) + agent_x.edit_idea_attr(road=work_road, required=work_wk_required) + agent_x.edit_idea_attr(road=work_road, required=nation_required) return agent_x @@ -176,24 +176,24 @@ def get_agent_with7amCleanTableRequired() -> AgentUnit: day_24hr = "24hr day" am = "am" pm = "pm" - tool_timeline = ToolKid(_weight=40, _desc=timetech) - tool_24hr_day = ToolKid(_weight=40, _desc=day_24hr, _begin=0.0, _close=24.0) - tool_am = ToolKid(_weight=50, _desc=am, _begin=0, _close=12) - tool_01 = ToolKid(_weight=50, _desc="1", _begin=1, _close=2) - tool_02 = ToolKid(_weight=50, _desc="2", _begin=2, _close=3) - tool_03 = ToolKid(_weight=50, _desc="3", _begin=3, _close=4) - tool_pm = ToolKid(_weight=50, _desc=pm, _begin=12, _close=24) + idea_timeline = IdeaKid(_weight=40, _desc=timetech) + idea_24hr_day = IdeaKid(_weight=40, _desc=day_24hr, _begin=0.0, _close=24.0) + idea_am = IdeaKid(_weight=50, _desc=am, _begin=0, _close=12) + idea_01 = IdeaKid(_weight=50, _desc="1", _begin=1, _close=2) + idea_02 = IdeaKid(_weight=50, _desc="2", _begin=2, _close=3) + idea_03 = IdeaKid(_weight=50, _desc="3", _begin=3, _close=4) + idea_pm = IdeaKid(_weight=50, _desc=pm, _begin=12, _close=24) time_road = f"{src},{timetech}" day24hr_road = f"{time_road},{day_24hr}" am_road = f"{day_24hr},{am}" - agent_x.add_tool(tool_timeline, src) - agent_x.add_tool(tool_24hr_day, time_road) - agent_x.add_tool(tool_am, day24hr_road) - agent_x.add_tool(tool_pm, day24hr_road) - agent_x.add_tool(tool_01, am_road) # tool_am - agent_x.add_tool(tool_02, am_road) # tool_am - agent_x.add_tool(tool_03, am_road) # tool_am + agent_x.add_idea(idea_timeline, src) + agent_x.add_idea(idea_24hr_day, time_road) + agent_x.add_idea(idea_am, day24hr_road) + agent_x.add_idea(idea_pm, day24hr_road) + agent_x.add_idea(idea_01, am_road) # idea_am + agent_x.add_idea(idea_02, am_road) # idea_am + agent_x.add_idea(idea_03, am_road) # idea_am housework = "housework" house_road = f"{src},{housework}" @@ -203,17 +203,17 @@ def get_agent_with7amCleanTableRequired() -> AgentUnit: get_soap = "get soap" get_soap_road = f"{clean_road},{get_soap}" remove_dish = "remove dishs" - tool_housework = ToolKid(_weight=40, _desc=housework) - tool_cleantable = ToolKid(_weight=40, _desc=clean_table, promise=True) - tool_tabledishs = ToolKid(_weight=40, _desc=remove_dish, promise=True) - tool_tablesoap = ToolKid(_weight=40, _desc=get_soap, promise=True) - tool_grabsoap = ToolKid(_weight=40, _desc="grab soap", promise=True) - - agent_x.add_tool(tool_kid=tool_housework, walk=src) - agent_x.add_tool(tool_kid=tool_cleantable, walk=house_road) - agent_x.add_tool(tool_kid=tool_tabledishs, walk=clean_road) - agent_x.add_tool(tool_kid=tool_tablesoap, walk=clean_road) - agent_x.add_tool(tool_kid=tool_grabsoap, walk=get_soap_road) + idea_housework = IdeaKid(_weight=40, _desc=housework) + idea_cleantable = IdeaKid(_weight=40, _desc=clean_table, promise=True) + idea_tabledishs = IdeaKid(_weight=40, _desc=remove_dish, promise=True) + idea_tablesoap = IdeaKid(_weight=40, _desc=get_soap, promise=True) + idea_grabsoap = IdeaKid(_weight=40, _desc="grab soap", promise=True) + + agent_x.add_idea(idea_kid=idea_housework, walk=src) + agent_x.add_idea(idea_kid=idea_cleantable, walk=house_road) + agent_x.add_idea(idea_kid=idea_tabledishs, walk=clean_road) + agent_x.add_idea(idea_kid=idea_tablesoap, walk=clean_road) + agent_x.add_idea(idea_kid=idea_grabsoap, walk=get_soap_road) clean_table_7am_base = day24hr_road clean_table_7am_sufffact_road = day24hr_road @@ -228,10 +228,10 @@ def get_agent_with7amCleanTableRequired() -> AgentUnit: base=clean_table_7am_base, sufffacts={clean_table_7am_sufffact_x.need: clean_table_7am_sufffact_x}, ) - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=f"{agent_x._desc},housework,clean table", required=clean_table_7am_required ) - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=f"{agent_x._desc},work", required=clean_table_7am_required ) return agent_x @@ -241,23 +241,23 @@ def get_agent_1Task_1CE0MinutesRequired_1AcptFact() -> AgentUnit: lw_desc = "test45" agent_x = AgentUnit(_weight=10, _desc=lw_desc) ced_min_desc = "CE0_minutes" - ced_minutes = ToolKid(_desc=ced_min_desc) + ced_minutes = IdeaKid(_desc=ced_min_desc) ced_road = f"{lw_desc},{ced_min_desc}" - agent_x.add_tool(tool_kid=ced_minutes, walk=lw_desc) + agent_x.add_idea(idea_kid=ced_minutes, walk=lw_desc) mail_desc = "obtain mail" - mail_task = ToolKid(_desc=mail_desc, promise=True) - agent_x.add_tool(tool_kid=mail_task, walk=lw_desc) + mail_task = IdeaKid(_desc=mail_desc, promise=True) + agent_x.add_idea(idea_kid=mail_task, walk=lw_desc) sufffact_x = sufffactunit_shop(need=ced_road, open=80, nigh=90) x_task_required = RequiredUnit( base=sufffact_x.need, sufffacts={sufffact_x.need: sufffact_x} ) mail_road = f"{lw_desc},{mail_desc}" - agent_x.edit_tool_attr(road=mail_road, required=x_task_required) + agent_x.edit_idea_attr(road=mail_road, required=x_task_required) x_acptfact = acptfactunit_shop(base=ced_road, pick=ced_road, open=85, nigh=95) # print( - # f"1Task_1CE0MinutesRequired_1AcptFact 2. {len(agent_x._toolroot._kids)=} {x_acptfact.base=}" + # f"1Task_1CE0MinutesRequired_1AcptFact 2. {len(agent_x._idearoot._kids)=} {x_acptfact.base=}" # ) agent_x.set_acptfact( base=x_acptfact.base, @@ -265,7 +265,7 @@ def get_agent_1Task_1CE0MinutesRequired_1AcptFact() -> AgentUnit: open=x_acptfact.open, nigh=x_acptfact.nigh, ) - # print(f"1Task_1CE0MinutesRequired_1AcptFact 3. {len(agent_x._toolroot._kids)=}") + # print(f"1Task_1CE0MinutesRequired_1AcptFact 3. {len(agent_x._idearoot._kids)=}") return agent_x @@ -273,17 +273,17 @@ def get_agent_1Task_1CE0MinutesRequired_1AcptFact() -> AgentUnit: def get_agent_x1_3levels_1required_1acptfacts() -> AgentUnit: prom = "prom" x_agent = AgentUnit(_weight=10, _desc=prom) - tool_kid_shave = ToolKid(_weight=30, _desc="shave", promise=True) - x_agent.add_tool(tool_kid=tool_kid_shave, walk=prom) + idea_kid_shave = IdeaKid(_weight=30, _desc="shave", promise=True) + x_agent.add_idea(idea_kid=idea_kid_shave, walk=prom) weekdays = "weekdays" - tool_kid_weekdays = ToolKid(_weight=40, _desc=weekdays) - x_agent.add_tool(tool_kid=tool_kid_weekdays, walk=prom) + idea_kid_weekdays = IdeaKid(_weight=40, _desc=weekdays) + x_agent.add_idea(idea_kid=idea_kid_weekdays, walk=prom) - tool_grandkidU = ToolKid(_weight=20, _desc="Sunday") - tool_grandkidM = ToolKid(_weight=20, _desc="Monday") + idea_grandkidU = IdeaKid(_weight=20, _desc="Sunday") + idea_grandkidM = IdeaKid(_weight=20, _desc="Monday") week_road = f"{prom},{weekdays}" - x_agent.add_tool(tool_kid=tool_grandkidU, walk=week_road) - x_agent.add_tool(tool_kid=tool_grandkidM, walk=week_road) + x_agent.add_idea(idea_kid=idea_grandkidU, walk=week_road) + x_agent.add_idea(idea_kid=idea_grandkidM, walk=week_road) shave_base = "prom,weekdays" shave_sufffact_road = "prom,weekdays,Monday" @@ -293,12 +293,12 @@ def get_agent_x1_3levels_1required_1acptfacts() -> AgentUnit: sufffacts={shave_sufffact_x.need: shave_sufffact_x}, ) - x_agent.edit_tool_attr(road="prom,shave", required=shave_required) + x_agent.edit_idea_attr(road="prom,shave", required=shave_required) x_agent.set_acptfact(base="prom,weekdays", pick="prom,weekdays,Sunday") acptfactunit_x = acptfactunit_shop( base="prom,weekdays", pick="prom,weekdays,Sunday,church" ) - x_agent.edit_tool_attr(road="prom,shave", acptfactunit=acptfactunit_x) + x_agent.edit_idea_attr(road="prom,shave", acptfactunit=acptfactunit_x) return x_agent @@ -306,14 +306,14 @@ def get_agent_base_time_example() -> AgentUnit: g_src = "src" g_lw = AgentUnit(_desc=g_src) plant = "plant" - x_tool = ToolKid(_desc=plant) - g_lw.add_tool(x_tool, walk=g_src) + x_idea = IdeaKid(_desc=plant) + g_lw.add_idea(x_idea, walk=g_src) return g_lw def get_agent_irrational_example() -> AgentUnit: - # this agent has no conclusive agenda because 2 promise tools are in contradiction + # this agent has no conclusive agenda because 2 promise ideas are in contradiction # "egg first" is true when "chicken first" is false # "chicken first" is true when "egg first" is true # Step 0: if chicken._active_status == True, egg._active_status is set to False @@ -331,26 +331,26 @@ def get_agent_irrational_example() -> AgentUnit: egg_text = "egg first" egg_road = f"{src_road},{egg_text}" - agent_x.add_tool(tool_kid=ToolKid(_desc=egg_text), walk=src_road) + agent_x.add_idea(idea_kid=IdeaKid(_desc=egg_text), walk=src_road) chicken_text = "chicken first" chicken_road = f"{src_road},{chicken_text}" - agent_x.add_tool(tool_kid=ToolKid(_desc=chicken_text), walk=src_road) + agent_x.add_idea(idea_kid=IdeaKid(_desc=chicken_text), walk=src_road) # set egg promise is True when chicken first is False - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=egg_road, promise=True, required_base=chicken_road, - required_suff_tool_active_status=True, + required_suff_idea_active_status=True, ) # set chick promise is True when egg first is False - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=chicken_road, promise=True, required_base=egg_road, - required_suff_tool_active_status=False, + required_suff_idea_active_status=False, ) return agent_x diff --git a/src/agent/group.py b/src/agent/group.py index bd7c9decc..9670ff82e 100644 --- a/src/agent/group.py +++ b/src/agent/group.py @@ -143,7 +143,7 @@ def meld_attributes_that_will_be_equal(self, other_group): # if self.name != other_group.name: # raise InvalidGroupException( - # f"Meld fail tool={self._walk},{self._desc} {attrs[0]}:{attrs[1]} with {other_tool._walk},{other_tool._desc} {attrs[0]}:{attrs[2]}" + # f"Meld fail idea={self._walk},{self._desc} {attrs[0]}:{attrs[1]} with {other_idea._walk},{other_idea._desc} {attrs[0]}:{attrs[2]}" # ) @@ -279,14 +279,14 @@ class GroupHeir(GroupCore): def set_agent_credit_debt( self, - tool_agent_importance, + idea_agent_importance, groupheirs_creditor_weight_sum: float, groupheirs_debtor_weight_sum: float, ): - self._agent_credit = tool_agent_importance * ( + self._agent_credit = idea_agent_importance * ( self.creditor_weight / groupheirs_creditor_weight_sum ) - self._agent_debt = tool_agent_importance * ( + self._agent_debt = idea_agent_importance * ( self.debtor_weight / groupheirs_debtor_weight_sum ) diff --git a/src/agent/hreg_time.py b/src/agent/hreg_time.py index be6b75187..e3068a62c 100644 --- a/src/agent/hreg_time.py +++ b/src/agent/hreg_time.py @@ -1,5 +1,5 @@ from src.agent.required import Road, SuffFactUnit -from src.agent.tool import ToolBare as YB +from src.agent.idea import IdeaBare as YB from dataclasses import dataclass from datetime import datetime @@ -185,7 +185,7 @@ def jajatime_nigh(self): return self.get_jajatime_open() + self._event_minutes -def _get_time_hreg_src_tool(c400_count: int): +def _get_time_hreg_src_idea(c400_count: int): src = "time" list_x = [] list_x += _get_time_hreg_ced(local_root=src, tech="minutes", c400_count=c400_count) @@ -228,7 +228,7 @@ def _get_time_hreg_ced(local_root: str, tech: str, c400_count: int): list_x += _get_time_hreg_month(local_root=rt, multipler=m) list_x += _get_time_hreg_day(local_root=rt, multipler=m) list_x += _get_time_hreg_hour(local_root=rt, multipler=m) - list_x += _get_time_hreg_weekday_tool(local_root=rt, multipler=m, jajatime=jaja) + list_x += _get_time_hreg_weekday_idea(local_root=rt, multipler=m, jajatime=jaja) return list_x @@ -279,7 +279,7 @@ def _get_time_hreg_years(local_root: str, jajatime: str): return hreg_list -def _get_time_hreg_weekday_tool(local_root: str, multipler: int, jajatime: str): +def _get_time_hreg_weekday_idea(local_root: str, multipler: int, jajatime: str): m = multipler week = "week" nr = f"{local_root},{jajatime},week" diff --git a/src/agent/tool.py b/src/agent/idea.py similarity index 77% rename from src/agent/tool.py rename to src/agent/idea.py index c0f8a4133..eb397c737 100644 --- a/src/agent/tool.py +++ b/src/agent/idea.py @@ -31,12 +31,12 @@ from copy import deepcopy -class InvalidToolException(Exception): +class InvalidIdeaException(Exception): pass @dataclasses.dataclass -class ToolBare: +class IdeaBare: n: str = None # name weight: int = 1 b: float = None # begin @@ -51,7 +51,7 @@ class ToolBare: @dataclasses.dataclass -class ToolAttrHolder: +class IdeaAttrHolder: weight: int = None uid: int = None required: RequiredUnit = None @@ -62,7 +62,7 @@ class ToolAttrHolder: required_sufffact_divisor: int = None required_del_sufffact_base: Road = None required_del_sufffact_need: Road = None - required_suff_tool_active_status: str = None + required_suff_idea_active_status: str = None begin: float = None close: float = None addin: float = None @@ -82,7 +82,7 @@ class ToolAttrHolder: is_expanded: bool = None on_meld_weight_action: str = None - def set_sufffact_range_attributes_influenced_by_sufffact_tool( + def set_sufffact_range_attributes_influenced_by_sufffact_idea( self, sufffact_open, sufffact_nigh, @@ -104,7 +104,7 @@ def set_sufffact_range_attributes_influenced_by_sufffact_tool( @dataclasses.dataclass -class ToolCore: +class IdeaCore: _desc: str = None _uid: int = None _walk: str = None @@ -229,7 +229,7 @@ def set_acptfactunit(self, acptfactunit: AcptFactUnit): self.set_acptfactunits_empty_if_null() self._acptfactunits[acptfactunit.base] = acptfactunit - def _set_toolkid_attr( + def _set_ideakid_attr( self, acptfactunit: AcptFactUnit = None, acptfactunit_base: Road = None, @@ -255,10 +255,10 @@ def get_acptfactunits_dict(self): return acptfactunits_dict def set_acptfactunit_to_complete(self, base_acptfactunit: AcptFactUnit): - # if a tool is considered a task that means a acptfactheir.open attribute can be increased to - # a number <= acptfactheir.nighmake that makes the tool no longer a task. This method finds - # the minimal acptfactheir.open to change tool._task == False. tool_core._acptfactheir cannot be straight up manpulated - # so tool._acptfactunit reqquires being changed. + # if a idea is considered a task that means a acptfactheir.open attribute can be increased to + # a number <= acptfactheir.nighmake that makes the idea no longer a task. This method finds + # the minimal acptfactheir.open to change idea._task == False. idea_core._acptfactheir cannot be straight up manpulated + # so idea._acptfactunit reqquires being changed. # self.set_acptfactunits(base=acptfact, acptfact=base, open=sufffact_nigh, nigh=acptfact_nigh) acptfact_curb_x = acptfactunit_shop( base=base_acptfactunit.base, @@ -288,12 +288,12 @@ def set_agent_importance( def get_kids_in_range(self, begin: float, close: float) -> list: return [ - tool_x - for tool_x in self._kids.values() + idea_x + for idea_x in self._kids.values() if ( - (begin >= tool_x._begin and begin < tool_x._close) - or (close > tool_x._begin and close < tool_x._close) - or (begin <= tool_x._begin and close >= tool_x._close) + (begin >= idea_x._begin and begin < idea_x._close) + or (close > idea_x._begin and close < idea_x._close) + or (begin <= idea_x._begin and close >= idea_x._close) ) ] @@ -386,8 +386,8 @@ def set_grouplines(self, child_grouplines: dict[GroupName:Groupline] = None): def set_kids_total_weight(self): self._kids_total_weight = 0 self.set_kids_empty_if_null() - for tool_x in self._kids.values(): - self._kids_total_weight += tool_x._weight + for idea_x in self._kids.values(): + self._kids_total_weight += idea_x._weight def get_groupheirs_creditor_weight_sum(self): self.set_grouplink_empty_if_null() @@ -404,7 +404,7 @@ def set_groupheirs_agent_credit_debit(self): groupheirs_debtor_weight_sum = self.get_groupheirs_debtor_weight_sum() for groupheir_x in self._groupheirs.values(): groupheir_x.set_agent_credit_debt( - tool_agent_importance=self._agent_importance, + idea_agent_importance=self._agent_importance, groupheirs_creditor_weight_sum=groupheirs_creditor_weight_sum, groupheirs_debtor_weight_sum=groupheirs_debtor_weight_sum, ) @@ -416,150 +416,150 @@ def set_kids_empty_if_null(self): def clear_grouplines(self): self._grouplines = {} - def _set_tool_desc(self, desc): + def _set_idea_desc(self, desc): if desc != None: self._desc = desc - def meld_requiredunits(self, other_tool): + def meld_requiredunits(self, other_idea): self.set_requiredunits_empty_if_null() - other_tool.set_requiredunits_empty_if_null() - for lx in other_tool._requiredunits.values(): + other_idea.set_requiredunits_empty_if_null() + for lx in other_idea._requiredunits.values(): if self._requiredunits.get(lx.base) is None: self._requiredunits[lx.base] = lx else: self._requiredunits.get(lx.base).meld(lx) - def meld_grouplinks(self, other_tool): + def meld_grouplinks(self, other_idea): self.set_grouplink_empty_if_null() - other_tool.set_grouplink_empty_if_null() - for bl in other_tool._grouplinks.values(): + other_idea.set_grouplink_empty_if_null() + for bl in other_idea._grouplinks.values(): if self._grouplinks.get(bl.name) != None: self._grouplinks.get(bl.name).meld( other_grouplink=bl, - other_on_meld_weight_action=other_tool._on_meld_weight_action, + other_on_meld_weight_action=other_idea._on_meld_weight_action, src_on_meld_weight_action=self._on_meld_weight_action, ) else: self._grouplinks[bl.name] = bl - def meld_acptfactunits(self, other_tool): + def meld_acptfactunits(self, other_idea): self.set_acptfactunits_empty_if_null() - other_tool.set_acptfactunits_empty_if_null() - for hc in other_tool._acptfactunits.values(): + other_idea.set_acptfactunits_empty_if_null() + for hc in other_idea._acptfactunits.values(): if self._acptfactunits.get(hc.base) is None: self._acptfactunits[hc.base] = hc else: self._acptfactunits.get(hc.base).meld(hc) - def meld(self, other_tool, _toolroot: bool = None): - if _toolroot and self._desc != other_tool._desc: - raise InvalidToolException( - f"Meld fail toolroot _desc '{self._desc}' not the same as '{other_tool._desc}'" + def meld(self, other_idea, _idearoot: bool = None): + if _idearoot and self._desc != other_idea._desc: + raise InvalidIdeaException( + f"Meld fail idearoot _desc '{self._desc}' not the same as '{other_idea._desc}'" ) - if _toolroot: + if _idearoot: self._weight = 1 else: self._weight = get_meld_weight( src_weight=self._weight, src_on_meld_weight_action=self._on_meld_weight_action, - other_weight=other_tool._weight, - other_on_meld_weight_action=other_tool._on_meld_weight_action, + other_weight=other_idea._weight, + other_on_meld_weight_action=other_idea._on_meld_weight_action, ) - self.meld_requiredunits(other_tool=other_tool) - self.meld_grouplinks(other_tool=other_tool) - self.meld_acptfactunits(other_tool=other_tool) - self.meld_attributes_that_will_be_equal(other_tool=other_tool) + self.meld_requiredunits(other_idea=other_idea) + self.meld_grouplinks(other_idea=other_idea) + self.meld_acptfactunits(other_idea=other_idea) + self.meld_attributes_that_will_be_equal(other_idea=other_idea) - def meld_attributes_that_will_be_equal(self, other_tool): + def meld_attributes_that_will_be_equal(self, other_idea): xl = [ - ("_uid", self._uid, other_tool._uid), - ("_begin", self._begin, other_tool._begin), - ("_close", self._close, other_tool._close), - ("_addin", self._addin, other_tool._addin), - ("_denom", self._denom, other_tool._denom), - ("_numor", self._numor, other_tool._numor), - ("_reest", self._reest, other_tool._reest), - ("_special_road", self._special_road, other_tool._special_road), - ("_numeric_road", self._numeric_road, other_tool._numeric_road), - ("promise", self.promise, other_tool.promise), - ("_is_expanded", self._is_expanded, other_tool._is_expanded), + ("_uid", self._uid, other_idea._uid), + ("_begin", self._begin, other_idea._begin), + ("_close", self._close, other_idea._close), + ("_addin", self._addin, other_idea._addin), + ("_denom", self._denom, other_idea._denom), + ("_numor", self._numor, other_idea._numor), + ("_reest", self._reest, other_idea._reest), + ("_special_road", self._special_road, other_idea._special_road), + ("_numeric_road", self._numeric_road, other_idea._numeric_road), + ("promise", self.promise, other_idea.promise), + ("_is_expanded", self._is_expanded, other_idea._is_expanded), ] while xl != []: attrs = xl.pop() if attrs[1] != attrs[2]: - raise InvalidToolException( - f"Meld fail tool={self._walk},{self._desc} {attrs[0]}:{attrs[1]} with {other_tool._walk},{other_tool._desc} {attrs[0]}:{attrs[2]}" + raise InvalidIdeaException( + f"Meld fail idea={self._walk},{self._desc} {attrs[0]}:{attrs[1]} with {other_idea._walk},{other_idea._desc} {attrs[0]}:{attrs[2]}" ) - def _set_tool_attr(self, tool_attr: ToolAttrHolder): - if tool_attr.weight != None: - self._weight = tool_attr.weight - if tool_attr.uid != None: - self._uid = tool_attr.uid - if tool_attr.required != None: - self.set_required_unit(required=tool_attr.required) - if tool_attr.required_base != None and tool_attr.required_sufffact != None: + def _set_idea_attr(self, idea_attr: IdeaAttrHolder): + if idea_attr.weight != None: + self._weight = idea_attr.weight + if idea_attr.uid != None: + self._uid = idea_attr.uid + if idea_attr.required != None: + self.set_required_unit(required=idea_attr.required) + if idea_attr.required_base != None and idea_attr.required_sufffact != None: self.set_required_sufffact( - base=tool_attr.required_base, - sufffact=tool_attr.required_sufffact, - open=tool_attr.required_sufffact_open, - nigh=tool_attr.required_sufffact_nigh, - divisor=tool_attr.required_sufffact_divisor, + base=idea_attr.required_base, + sufffact=idea_attr.required_sufffact, + open=idea_attr.required_sufffact_open, + nigh=idea_attr.required_sufffact_nigh, + divisor=idea_attr.required_sufffact_divisor, ) if ( - tool_attr.required_base != None - and tool_attr.required_suff_tool_active_status != None + idea_attr.required_base != None + and idea_attr.required_suff_idea_active_status != None ): - self.set_required_suff_tool_active_status( - base=tool_attr.required_base, - suff_tool_active_status=tool_attr.required_suff_tool_active_status, + self.set_required_suff_idea_active_status( + base=idea_attr.required_base, + suff_idea_active_status=idea_attr.required_suff_idea_active_status, ) - if tool_attr.begin != None: - self._begin = tool_attr.begin - if tool_attr.close != None: - self._close = tool_attr.close - if tool_attr.addin != None: - self._addin = tool_attr.addin - if tool_attr.numor != None: - self._numor = tool_attr.numor - if tool_attr.denom != None: - self._denom = tool_attr.denom - if tool_attr.reest != None: - self._reest = tool_attr.reest - if tool_attr.numeric_road != None: - self._numeric_road = tool_attr.numeric_road - if tool_attr.special_road != None: - self._special_road = tool_attr.special_road - if tool_attr.descendant_promise_count != None: - self._descendant_promise_count = tool_attr.descendant_promise_count - if tool_attr.all_member_credit != None: - self._all_member_credit = tool_attr.all_member_credit - if tool_attr.all_member_debt != None: - self._all_member_debt = tool_attr.all_member_debt - if tool_attr.grouplink != None: - self.set_grouplink(grouplink=tool_attr.grouplink) - if tool_attr.grouplink_del != None: - self.del_grouplink(groupname=tool_attr.grouplink_del) - if tool_attr.is_expanded != None: - self._is_expanded = tool_attr.is_expanded - if tool_attr.promise != None: - self.promise = tool_attr.promise - if tool_attr.problem_bool != None: - self._problem_bool = tool_attr.problem_bool - if tool_attr.on_meld_weight_action != None: - self._check_get_on_meld_weight_actions(tool_attr.on_meld_weight_action) - self._on_meld_weight_action = tool_attr.on_meld_weight_action + if idea_attr.begin != None: + self._begin = idea_attr.begin + if idea_attr.close != None: + self._close = idea_attr.close + if idea_attr.addin != None: + self._addin = idea_attr.addin + if idea_attr.numor != None: + self._numor = idea_attr.numor + if idea_attr.denom != None: + self._denom = idea_attr.denom + if idea_attr.reest != None: + self._reest = idea_attr.reest + if idea_attr.numeric_road != None: + self._numeric_road = idea_attr.numeric_road + if idea_attr.special_road != None: + self._special_road = idea_attr.special_road + if idea_attr.descendant_promise_count != None: + self._descendant_promise_count = idea_attr.descendant_promise_count + if idea_attr.all_member_credit != None: + self._all_member_credit = idea_attr.all_member_credit + if idea_attr.all_member_debt != None: + self._all_member_debt = idea_attr.all_member_debt + if idea_attr.grouplink != None: + self.set_grouplink(grouplink=idea_attr.grouplink) + if idea_attr.grouplink_del != None: + self.del_grouplink(groupname=idea_attr.grouplink_del) + if idea_attr.is_expanded != None: + self._is_expanded = idea_attr.is_expanded + if idea_attr.promise != None: + self.promise = idea_attr.promise + if idea_attr.problem_bool != None: + self._problem_bool = idea_attr.problem_bool + if idea_attr.on_meld_weight_action != None: + self._check_get_on_meld_weight_actions(idea_attr.on_meld_weight_action) + self._on_meld_weight_action = idea_attr.on_meld_weight_action self._del_requiredunit_all_cases( - base=tool_attr.required_del_sufffact_base, - sufffact=tool_attr.required_del_sufffact_need, + base=idea_attr.required_del_sufffact_base, + sufffact=idea_attr.required_del_sufffact_need, ) self._set_addin_to_zero_if_any_transformations_exist() def _check_get_on_meld_weight_actions(self, on_meld_weight_action: str): if on_meld_weight_action not in (list(get_on_meld_weight_actions())): - raise InvalidToolException( - f"ToolCore unit '{self._desc}' cannot have on_meld_weight_action '{on_meld_weight_action}'." + raise InvalidIdeaException( + f"IdeaCore unit '{self._desc}' cannot have on_meld_weight_action '{on_meld_weight_action}'." ) def _set_addin_to_zero_if_any_transformations_exist(self): @@ -577,16 +577,16 @@ def _del_requiredunit_all_cases(self, base: Road, sufffact: Road): if len(self._requiredunits[base].sufffacts) == 0: self.del_requiredunit_base(base=base) - def set_required_suff_tool_active_status( - self, base: Road, suff_tool_active_status: str + def set_required_suff_idea_active_status( + self, base: Road, suff_idea_active_status: str ): requiredunit_x = self._get_or_create_requiredunit(base=base) - if suff_tool_active_status == False: - requiredunit_x.suff_tool_active_status = False - elif suff_tool_active_status == "Set to Ignore": - requiredunit_x.suff_tool_active_status = None - elif suff_tool_active_status == True: - requiredunit_x.suff_tool_active_status = True + if suff_idea_active_status == False: + requiredunit_x.suff_idea_active_status = False + elif suff_idea_active_status == "Set to Ignore": + requiredunit_x.suff_idea_active_status = None + elif suff_idea_active_status == True: + requiredunit_x.suff_idea_active_status = True def _get_or_create_requiredunit(self, base: Road): self.set_requiredunits_empty_if_null() @@ -615,26 +615,26 @@ def del_requiredunit_base(self, base: Road): try: self._requiredunits.pop(base) except KeyError as e: - raise InvalidToolException(f"No RequiredUnit at '{base}'") from e + raise InvalidIdeaException(f"No RequiredUnit at '{base}'") from e def del_requiredunit_sufffact(self, base: Road, sufffact: Road): required_unit = self._requiredunits[base] required_unit.del_sufffact(sufffact=sufffact) - def add_kid(self, tool_kid): - if tool_kid._numor != None: - # if tool_kid._denom != None: - # if tool_kid._reest != None: + def add_kid(self, idea_kid): + if idea_kid._numor != None: + # if idea_kid._denom != None: + # if idea_kid._reest != None: if self._begin is None or self._close is None: - raise InvalidToolException( - f"Tool {tool_kid._walk},{tool_kid._desc} cannot have numor,denom,reest if parent does not have begin/close range" + raise InvalidIdeaException( + f"Idea {idea_kid._walk},{idea_kid._desc} cannot have numor,denom,reest if parent does not have begin/close range" ) - tool_kid._begin = self._begin * tool_kid._numor / tool_kid._denom - tool_kid._close = self._close * tool_kid._numor / tool_kid._denom + idea_kid._begin = self._begin * idea_kid._numor / idea_kid._denom + idea_kid._close = self._close * idea_kid._numor / idea_kid._denom self.set_kids_empty_if_null() - self._kids[tool_kid._desc] = tool_kid + self._kids[idea_kid._desc] = idea_kid self._kids = dict(sorted(self._kids.items())) def set_grouplink_empty_if_null(self): @@ -685,10 +685,10 @@ def set_active_status(self, tree_traverse_count: int): self.set_requiredheirs_status() for requiredheir in self._requiredheirs.values(): - # one required.status is false, tool.active_status is false + # one required.status is false, idea.active_status is false if requiredheir._status == False: self._active_status = False - # one required.task is true, tool._task is True + # one required.task is true, idea._task is True if requiredheir._task == True: self._task = True @@ -723,7 +723,7 @@ def _coalesce_with_requiredunits(self, requiredheirs: dict[Road:RequiredHeir]): def set_requiredheirs( self, requiredheirs: dict[Road:RequiredCore], - agent_tool_dict: dict[Road:] = None, + agent_idea_dict: dict[Road:] = None, ): coalesced_requireds = self._coalesce_with_requiredunits(requiredheirs) @@ -732,7 +732,7 @@ def set_requiredheirs( requiredheir_x = RequiredHeir( base=required.base, sufffacts=None, - suff_tool_active_status=required.suff_tool_active_status, + suff_idea_active_status=required.suff_idea_active_status, ) sufffacts_x = {} for w in required.sufffacts.values(): @@ -745,11 +745,11 @@ def set_requiredheirs( sufffacts_x[sufffact_x.need] = sufffact_x requiredheir_x.sufffacts = sufffacts_x - if agent_tool_dict != None: - base_tool = agent_tool_dict.get(required.base) - if base_tool != None: - requiredheir_x.set_curr_tool_active_status( - bool_x=base_tool._active_status + if agent_idea_dict != None: + base_idea = agent_idea_dict.get(required.base) + if base_idea != None: + requiredheir_x.set_curr_idea_active_status( + bool_x=base_idea._active_status ) x_dict[requiredheir_x.base] = requiredheir_x @@ -843,10 +843,10 @@ def find_replace_road(self, old_road: Road, new_road: Road): @dataclasses.dataclass -class ToolKid(ToolCore): +class IdeaKid(IdeaCore): pass @dataclasses.dataclass -class ToolRoot(ToolCore): +class IdeaRoot(IdeaCore): pass diff --git a/src/agent/lemma.py b/src/agent/lemma.py index 865e88e36..181a07b73 100644 --- a/src/agent/lemma.py +++ b/src/agent/lemma.py @@ -1,6 +1,6 @@ from dataclasses import dataclass from src.agent.required import AcptFactUnit, Road, acptfactunit_shop -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid class InvalidLemmaException(Exception): @@ -11,7 +11,7 @@ class InvalidLemmaException(Exception): class Lemma: src_acptfact: AcptFactUnit calc_acptfact: AcptFactUnit - tool_x: ToolKid + idea_x: IdeaKid eval_status: bool eval_count: int @@ -26,33 +26,33 @@ def set_empty_if_null(self): def _get_loop_range_calc_acptfact_attr( self, - tool_begin: float, - tool_close: float, + idea_begin: float, + idea_close: float, src_open: float, src_nigh: float, - src_tool_begin: float, - src_tool_close: float, + src_idea_begin: float, + src_idea_close: float, ): acptfact_open = None acptfact_nigh = None - # if src_tool and acptfact_tool have same range return same src acptfact range - if tool_begin == src_tool_begin and tool_close == src_tool_close: + # if src_idea and acptfact_idea have same range return same src acptfact range + if idea_begin == src_idea_begin and idea_close == src_idea_close: acptfact_open = src_open acptfact_nigh = src_nigh else: # create both ranges and get calc ranges for both. Return the not null one r1_open, r1_nigh = self._get_range_calc_acptfact_attr( - tool_begin=tool_begin, - tool_close=tool_close, - src_open=src_tool_begin, + idea_begin=idea_begin, + idea_close=idea_close, + src_open=src_idea_begin, src_nigh=src_nigh, ) r2_open, r2_nigh = self._get_range_calc_acptfact_attr( - tool_begin=tool_begin, - tool_close=tool_close, + idea_begin=idea_begin, + idea_close=idea_close, src_open=src_open, - src_nigh=src_tool_close, + src_nigh=src_idea_close, ) # # if both are not null return r1_nigh as acptfact_open and r2_open as acptfact_nigh # if r1_open != None and r1_nigh != None and r2_open != None and r2_nigh != None: @@ -69,89 +69,89 @@ def _get_loop_range_calc_acptfact_attr( def _get_range_calc_acptfact_attr( self, - tool_begin, - tool_close, + idea_begin, + idea_close, src_open, src_nigh, ): # sourcery skip: remove-redundant-if acptfact_open = None acptfact_nigh = None - if src_open <= tool_begin and src_nigh >= tool_close: - # if parent range contains all tool range - acptfact_open = tool_begin - acptfact_nigh = tool_close - elif src_open >= tool_begin and src_nigh < tool_close: - # if parent range exists inside tool range + if src_open <= idea_begin and src_nigh >= idea_close: + # if parent range contains all idea range + acptfact_open = idea_begin + acptfact_nigh = idea_close + elif src_open >= idea_begin and src_nigh < idea_close: + # if parent range exists inside idea range acptfact_open = src_open acptfact_nigh = src_nigh - elif src_open >= tool_begin and src_open < tool_close and src_nigh > tool_close: - # if parent range begins inside tool range and ends outside tool range + elif src_open >= idea_begin and src_open < idea_close and src_nigh > idea_close: + # if parent range begins inside idea range and ends outside idea range acptfact_open = src_open - acptfact_nigh = tool_close + acptfact_nigh = idea_close elif ( - # if parent range begins outside tool range and ends inside tool range - src_open <= tool_begin - and src_nigh > tool_begin - and src_nigh < tool_close + # if parent range begins outside idea range and ends inside idea range + src_open <= idea_begin + and src_nigh > idea_begin + and src_nigh < idea_close ): - acptfact_open = tool_begin + acptfact_open = idea_begin acptfact_nigh = src_nigh return acptfact_open, acptfact_nigh def _get_multipler_calc_acptfact_attr( self, - tool_begin, - tool_close, - tool_numor, - tool_denom, + idea_begin, + idea_close, + idea_numor, + idea_denom, src_open, src_nigh, ): return self._get_range_calc_acptfact_attr( - tool_begin=tool_begin, - tool_close=tool_close, - src_open=src_open * tool_numor / tool_denom, - src_nigh=src_nigh * tool_numor / tool_denom, + idea_begin=idea_begin, + idea_close=idea_close, + src_open=src_open * idea_numor / idea_denom, + src_nigh=src_nigh * idea_numor / idea_denom, ) def _get_remainder_calc_acptfact_attr( self, - tool_begin, - tool_close, + idea_begin, + idea_close, src_open, src_nigh, ): acptfact_open = None acptfact_nigh = None - if src_nigh - src_open >= tool_close: # - tool_begin: - acptfact_open = tool_begin - acptfact_nigh = tool_close + if src_nigh - src_open >= idea_close: # - idea_begin: + acptfact_open = idea_begin + acptfact_nigh = idea_close else: - acptfact_open = src_open % tool_close - acptfact_nigh = src_nigh % tool_close + acptfact_open = src_open % idea_close + acptfact_nigh = src_nigh % idea_close return acptfact_open, acptfact_nigh def _create_new_acptfact( - self, tool_x: ToolKid, src_acptfact: AcptFactUnit, src_tool: ToolKid + self, idea_x: IdeaKid, src_acptfact: AcptFactUnit, src_idea: IdeaKid ) -> AcptFactUnit: - if tool_x._begin is None or tool_x._close is None: + if idea_x._begin is None or idea_x._close is None: raise InvalidLemmaException( - f"Tool {tool_x._walk},{tool_x._desc} does not have range" + f"Idea {idea_x._walk},{idea_x._desc} does not have range" ) - tool_begin = tool_x._begin - tool_close = tool_x._close - tool_numor = tool_x._numor - tool_denom = tool_x._denom - tool_reest = tool_x._reest + idea_begin = idea_x._begin + idea_close = idea_x._close + idea_numor = idea_x._numor + idea_denom = idea_x._denom + idea_reest = idea_x._reest src_open = src_acptfact.open src_nigh = src_acptfact.nigh - src_tool_begin = src_tool._begin - src_tool_close = src_tool._close - tool_road = f"{tool_x._walk},{tool_x._desc}" + src_idea_begin = src_idea._begin + src_idea_close = src_idea._close + idea_road = f"{idea_x._walk},{idea_x._desc}" acptfact_open = None acptfact_nigh = None @@ -159,44 +159,44 @@ def _create_new_acptfact( if src_open is None and src_nigh is None: acptfact_open = None acptfact_nigh = None - elif (tool_numor is None or tool_denom is None) and src_open > src_nigh: + elif (idea_numor is None or idea_denom is None) and src_open > src_nigh: acptfact_open, acptfact_nigh = self._get_loop_range_calc_acptfact_attr( - tool_begin=tool_begin, - tool_close=tool_close, + idea_begin=idea_begin, + idea_close=idea_close, src_open=src_open, src_nigh=src_nigh, - src_tool_begin=src_tool_begin, - src_tool_close=src_tool_close, + src_idea_begin=src_idea_begin, + src_idea_close=src_idea_close, ) - elif tool_numor is None or tool_denom is None: + elif idea_numor is None or idea_denom is None: acptfact_open, acptfact_nigh = self._get_range_calc_acptfact_attr( - tool_begin=tool_begin, - tool_close=tool_close, + idea_begin=idea_begin, + idea_close=idea_close, src_open=src_open, src_nigh=src_nigh, ) - elif tool_numor != None and tool_denom != None and tool_reest in (False, None): + elif idea_numor != None and idea_denom != None and idea_reest in (False, None): acptfact_open, acptfact_nigh = self._get_multipler_calc_acptfact_attr( - tool_begin=tool_begin, - tool_close=tool_close, - tool_numor=tool_numor, - tool_denom=tool_denom, + idea_begin=idea_begin, + idea_close=idea_close, + idea_numor=idea_numor, + idea_denom=idea_denom, src_open=src_open, src_nigh=src_nigh, ) - elif tool_numor != None and tool_denom != None and tool_reest == True: + elif idea_numor != None and idea_denom != None and idea_reest == True: acptfact_open, acptfact_nigh = self._get_remainder_calc_acptfact_attr( - tool_begin=tool_begin, - tool_close=tool_close, + idea_begin=idea_begin, + idea_close=idea_close, src_open=src_open, src_nigh=src_nigh, ) active_status = acptfact_open is not None and acptfact_nigh is not None return acptfactunit_shop( - base=tool_road, - pick=tool_road, + base=idea_road, + pick=idea_road, open=acptfact_open, nigh=acptfact_nigh, ) @@ -213,23 +213,23 @@ def get_unevaluated_lemma(self): lemma.eval_status = True return lemma - # def _add_lemma_tool( - def eval(self, tool_x: ToolKid, src_acptfact: AcptFactUnit, src_tool: ToolKid): + # def _add_lemma_idea( + def eval(self, idea_x: IdeaKid, src_acptfact: AcptFactUnit, src_idea: IdeaKid): new_acptfact = self._create_new_acptfact( - tool_x=tool_x, src_acptfact=src_acptfact, src_tool=src_tool + idea_x=idea_x, src_acptfact=src_acptfact, src_idea=src_idea ) - road_x = f"{tool_x._walk},{tool_x._desc}" + road_x = f"{idea_x._walk},{idea_x._desc}" if self.lemmas.get(road_x) is None: self.lemmas[road_x] = Lemma( src_acptfact=src_acptfact, calc_acptfact=new_acptfact, - tool_x=tool_x, + idea_x=idea_x, eval_status=False, eval_count=1, ) # else: # # if new acptfactunit is inactive (acptfact.open == None and acptfact.nigh == None) - # # or current lemma acptfactunit acptfact.open == tool._being and acptfact.acptfact == tool._close + # # or current lemma acptfactunit acptfact.open == idea._being and acptfact.acptfact == idea._close # # do nothing # pass # # current_lemma_acptfact = lemma_dict.get(road_x)[1] diff --git a/src/agent/required.py b/src/agent/required.py index 5d7bc0c3c..a30adce20 100644 --- a/src/agent/required.py +++ b/src/agent/required.py @@ -368,9 +368,9 @@ class RequiredCore: base: Road sufffacts: dict[Road:SuffFactUnit] # None: ignore, - # True: base tool._active_status required be True, - # False: base tool._active_status required be False - suff_tool_active_status: bool = None + # True: base idea._active_status required be True, + # False: base idea._active_status required be False + suff_idea_active_status: bool = None def get_key_road(self): return self.base @@ -444,7 +444,7 @@ def get_dict(self): class RequiredHeir(RequiredCore): _status: bool = None _task: bool = None - _curr_tool_active_status: bool = None + _curr_idea_active_status: bool = None def clear_status(self): self._status = None @@ -466,8 +466,8 @@ def _get_base_acptfact(self, acptfacts: dict[Road:AcptFactHeir]): return x_acptfact - def set_curr_tool_active_status(self, bool_x: bool): - self._curr_tool_active_status = bool_x + def set_curr_idea_active_status(self, bool_x: bool): + self._curr_idea_active_status = bool_x def set_status(self, acptfacts: dict[Road:AcptFactHeir]): self.clear_status() @@ -486,8 +486,8 @@ def set_status(self, acptfacts: dict[Road:AcptFactHeir]): self._status = bool( is_single_sufffact_true or ( - self._curr_tool_active_status != None - and self._curr_tool_active_status == self.suff_tool_active_status + self._curr_idea_active_status != None + and self._curr_idea_active_status == self.suff_idea_active_status ) ) self._task = True if is_single_task_true else None diff --git a/src/agent/test_/test_group.py b/src/agent/test_/test_group.py index e7d1dfb4c..05abb1805 100644 --- a/src/agent/test_/test_group.py +++ b/src/agent/test_/test_group.py @@ -433,7 +433,7 @@ def test_brankLink_set_agent_importanceCorrectly(): bikers_debt_weight = 6.0 grouplinks_sum_creditor_weight = 60 grouplinks_sum_debtor_weight = 60 - tool_agent_importance = 1 + idea_agent_importance = 1 group_heir_x = groupheir_shop( name=bikers_name, creditor_weight=bikers_creditor_weight, @@ -442,7 +442,7 @@ def test_brankLink_set_agent_importanceCorrectly(): # WHEN group_heir_x.set_agent_credit_debt( - tool_agent_importance=tool_agent_importance, + idea_agent_importance=idea_agent_importance, groupheirs_creditor_weight_sum=grouplinks_sum_creditor_weight, groupheirs_debtor_weight_sum=grouplinks_sum_debtor_weight, ) diff --git a/src/agent/test_/test_lemma.py b/src/agent/test_/test_lemma.py index ed35e4e89..b1d4e2e0b 100644 --- a/src/agent/test_/test_lemma.py +++ b/src/agent/test_/test_lemma.py @@ -1,15 +1,15 @@ from src.agent.required import acptfactunit_shop from src.agent.lemma import Lemma, Lemmas -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid def test_lemma_attributes_exist(): lemma = Lemma( - src_acptfact=1, calc_acptfact=2, tool_x=3, eval_status=4, eval_count=5 + src_acptfact=1, calc_acptfact=2, idea_x=3, eval_status=4, eval_count=5 ) assert lemma.src_acptfact == 1 assert lemma.calc_acptfact == 2 - assert lemma.tool_x == 3 + assert lemma.idea_x == 3 assert lemma.eval_status == 4 assert lemma.eval_count == 5 @@ -31,12 +31,12 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario1(): lemmas_x = Lemmas() # When - tool_kid = ToolKid(_desc="timerange1", _walk="src", _begin=0, _close=12) - src_tool = ToolKid(_desc="whatever", _walk="src", _begin=-13, _close=500) - tr1 = f"{tool_kid._walk},{tool_kid._desc}" + idea_kid = IdeaKid(_desc="timerange1", _walk="src", _begin=0, _close=12) + src_idea = IdeaKid(_desc="whatever", _walk="src", _begin=-13, _close=500) + tr1 = f"{idea_kid._walk},{idea_kid._desc}" src_acptfact = acptfactunit_shop(base=tr1, pick=tr1, open=0, nigh=30) new_acptfact = lemmas_x._create_new_acptfact( - tool_x=tool_kid, src_acptfact=src_acptfact, src_tool=src_tool + idea_x=idea_kid, src_acptfact=src_acptfact, src_idea=src_idea ) # Then @@ -51,12 +51,12 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario2(): lemmas_x = Lemmas() # When - tool_kid = ToolKid(_desc="timerange1", _walk="src", _begin=7, _close=12) - tr1 = f"{tool_kid._walk},{tool_kid._desc}" + idea_kid = IdeaKid(_desc="timerange1", _walk="src", _begin=7, _close=12) + tr1 = f"{idea_kid._walk},{idea_kid._desc}" src_acptfact = acptfactunit_shop(base=tr1, pick=tr1, open=0, nigh=30) - src_tool = ToolKid(_desc="whatever", _walk="src", _begin=-13, _close=500) + src_idea = IdeaKid(_desc="whatever", _walk="src", _begin=-13, _close=500) new_acptfact = lemmas_x._create_new_acptfact( - tool_x=tool_kid, src_acptfact=src_acptfact, src_tool=src_tool + idea_x=idea_kid, src_acptfact=src_acptfact, src_idea=src_idea ) # Then @@ -70,7 +70,7 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario3_denom(): lx.set_empty_if_null() # When - tool_kid = ToolKid( + idea_kid = IdeaKid( _desc="timerange1", _walk="src", _begin=0, @@ -79,11 +79,11 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario3_denom(): _denom=10, _reest=False, ) - tr1 = f"{tool_kid._walk},{tool_kid._desc}" + tr1 = f"{idea_kid._walk},{idea_kid._desc}" src_acptfact = acptfactunit_shop(base=tr1, pick=tr1, open=0, nigh=30) - src_tool = ToolKid(_desc="whatever", _walk="src", _begin=-13, _close=500) + src_idea = IdeaKid(_desc="whatever", _walk="src", _begin=-13, _close=500) new_acptfact = lx._create_new_acptfact( - tool_x=tool_kid, src_acptfact=src_acptfact, src_tool=src_tool + idea_x=idea_kid, src_acptfact=src_acptfact, src_idea=src_idea ) # Then @@ -97,18 +97,18 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario3_2_denom(): lx.set_empty_if_null() # When - src_tool = ToolKid(_desc="range_x", _walk="src", _begin=0, _close=10080) - tool_kid = ToolKid( + src_idea = IdeaKid(_desc="range_x", _walk="src", _begin=0, _close=10080) + idea_kid = IdeaKid( _desc="timerange1", _walk="src,range_x", _begin=7200, _close=8440, _reest=False, ) - src_road = f"{src_tool._walk},{src_tool._desc}" + src_road = f"{src_idea._walk},{src_idea._desc}" src_acptfact = acptfactunit_shop(base=src_road, pick=src_road, open=7200, nigh=7200) new_acptfact = lx._create_new_acptfact( - tool_x=tool_kid, src_acptfact=src_acptfact, src_tool=src_tool + idea_x=idea_kid, src_acptfact=src_acptfact, src_idea=src_idea ) # Then @@ -122,7 +122,7 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario4_denomReest( lemmas_x.set_empty_if_null() # When - tool_kid = ToolKid( + idea_kid = IdeaKid( _desc="timerange1", _walk="src", _begin=0, @@ -131,11 +131,11 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario4_denomReest( _denom=1, _reest=True, ) - tr1 = f"{tool_kid._walk},{tool_kid._desc}" + tr1 = f"{idea_kid._walk},{idea_kid._desc}" src_acptfact = acptfactunit_shop(base=tr1, pick=tr1, open=120, nigh=150) - src_tool = ToolKid(_desc="whatever", _walk="src", _begin=-13, _close=500) + src_idea = IdeaKid(_desc="whatever", _walk="src", _begin=-13, _close=500) new_acptfact = lemmas_x._create_new_acptfact( - tool_x=tool_kid, src_acptfact=src_acptfact, src_tool=src_tool + idea_x=idea_kid, src_acptfact=src_acptfact, src_idea=src_idea ) # Then @@ -149,7 +149,7 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario5_denomReest( lemmas_x.set_empty_if_null() # When - tool_kid = ToolKid( + idea_kid = IdeaKid( _desc="timerange1", _walk="src", _begin=0, @@ -158,11 +158,11 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario5_denomReest( _denom=952, _reest=True, ) - tr1 = f"{tool_kid._walk},{tool_kid._desc}" + tr1 = f"{idea_kid._walk},{idea_kid._desc}" src_acptfact = acptfactunit_shop(base=tr1, pick=tr1, open=100, nigh=150) - src_tool = ToolKid(_desc="whatever", _walk="src", _begin=-13, _close=500) + src_idea = IdeaKid(_desc="whatever", _walk="src", _begin=-13, _close=500) new_acptfact = lemmas_x._create_new_acptfact( - tool_x=tool_kid, src_acptfact=src_acptfact, src_tool=src_tool + idea_x=idea_kid, src_acptfact=src_acptfact, src_idea=src_idea ) # Then @@ -174,7 +174,7 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario6_denomReest( # Given lemmas_x = Lemmas() lemmas_x.set_empty_if_null() - tool_src = ToolKid( + idea_src = IdeaKid( _desc="timerange1", _walk="src", _begin=0, @@ -182,7 +182,7 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario6_denomReest( ) # When/Then Check - tr3_kid = ToolKid( + tr3_kid = IdeaKid( _desc="subera", _walk="src", _begin=40, @@ -191,13 +191,13 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario6_denomReest( tr3 = f"{tr3_kid._walk},{tr3_kid._desc}" src_acptfact = acptfactunit_shop(base=tr3, pick=tr3, open=30, nigh=20) tr3_30_20_acptfact = lemmas_x._create_new_acptfact( - tool_x=tr3_kid, src_acptfact=src_acptfact, src_tool=tool_src + idea_x=tr3_kid, src_acptfact=src_acptfact, src_idea=idea_src ) assert tr3_30_20_acptfact.open == 40 assert tr3_30_20_acptfact.nigh == 50 # When/Then Check - trb_kid = ToolKid( + trb_kid = IdeaKid( _desc="subera", _walk="src", _begin=40, @@ -206,13 +206,13 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario6_denomReest( trb = f"{trb_kid._walk},{trb_kid._desc}" src_acptfact = acptfactunit_shop(base=trb, pick=trb, open=30, nigh=20) trb_30_20_acptfact = lemmas_x._create_new_acptfact( - tool_x=trb_kid, src_acptfact=src_acptfact, src_tool=tool_src + idea_x=trb_kid, src_acptfact=src_acptfact, src_idea=idea_src ) assert trb_30_20_acptfact.open == 40 assert trb_30_20_acptfact.nigh == 60 # When/Then Check - tr4_kid = ToolKid( + tr4_kid = IdeaKid( _desc="subera", _walk="src", _begin=55, @@ -221,13 +221,13 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario6_denomReest( tr4 = f"{tr4_kid._walk},{tr4_kid._desc}" src_acptfact = acptfactunit_shop(base=tr4, pick=tr4, open=30, nigh=20) tr4_30_20_acptfact = lemmas_x._create_new_acptfact( - tool_x=tr4_kid, src_acptfact=src_acptfact, src_tool=tool_src + idea_x=tr4_kid, src_acptfact=src_acptfact, src_idea=idea_src ) assert tr4_30_20_acptfact.open == 55 assert tr4_30_20_acptfact.nigh == 10 # When/Then Check - tr5_kid = ToolKid( + tr5_kid = IdeaKid( _desc="subera", _walk="src", _begin=0, @@ -236,7 +236,7 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario6_denomReest( tr5 = f"{tr5_kid._walk},{tr5_kid._desc}" src_acptfact = acptfactunit_shop(base=tr5, pick=tr5, open=30, nigh=20) tr5_0_60_acptfact = lemmas_x._create_new_acptfact( - tool_x=tr5_kid, src_acptfact=src_acptfact, src_tool=tool_src + idea_x=tr5_kid, src_acptfact=src_acptfact, src_idea=idea_src ) assert tr5_0_60_acptfact.open == 30 assert tr5_0_60_acptfact.nigh == 20 @@ -248,7 +248,7 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario7_denomReest( lemmas_x.set_empty_if_null() # When - tool_kid = ToolKid( + idea_kid = IdeaKid( _desc="timerange1", _walk="src", _begin=0, @@ -257,11 +257,11 @@ def test_lemmas_create_new_acptfact_createsCorrectAcptFact_scenario7_denomReest( _denom=1, _reest=True, ) - tr1 = f"{tool_kid._walk},{tool_kid._desc}" + tr1 = f"{idea_kid._walk},{idea_kid._desc}" src_acptfact = acptfactunit_shop(base=tr1, pick=tr1, open=90, nigh=150) - src_tool = ToolKid(_desc="whatever", _walk="src", _begin=-13, _close=500) + src_idea = IdeaKid(_desc="whatever", _walk="src", _begin=-13, _close=500) new_acptfact = lemmas_x._create_new_acptfact( - tool_x=tool_kid, src_acptfact=src_acptfact, src_tool=src_tool + idea_x=idea_kid, src_acptfact=src_acptfact, src_idea=src_idea ) # Then @@ -288,30 +288,30 @@ def test_lemmas_get_unevaluated_lemma_ReturnsCorrectLemmaWhenPopulated(): # Given 2 in lemmas lemmas_x = Lemmas() lemmas_x.lemmas = {} - src_tool = ToolKid(_desc="whatever", _walk="src", _begin=-13, _close=500) + src_idea = IdeaKid(_desc="whatever", _walk="src", _begin=-13, _close=500) - tr1_tool = ToolKid(_desc="timerange1", _walk="src", _begin=7, _close=12) - tr1 = f"{tr1_tool._walk},{tr1_tool._desc}" + tr1_idea = IdeaKid(_desc="timerange1", _walk="src", _begin=7, _close=12) + tr1 = f"{tr1_idea._walk},{tr1_idea._desc}" src_acptfact = acptfactunit_shop(base=tr1, pick=tr1, open=0, nigh=30) - lemmas_x.eval(tool_x=tr1_tool, src_acptfact=src_acptfact, src_tool=src_tool) + lemmas_x.eval(idea_x=tr1_idea, src_acptfact=src_acptfact, src_idea=src_idea) - tr2_tool = ToolKid(_desc="timerange2", _walk="src", _begin=40, _close=60) - tr2 = f"{tr2_tool._walk},{tr2_tool._desc}" + tr2_idea = IdeaKid(_desc="timerange2", _walk="src", _begin=40, _close=60) + tr2 = f"{tr2_idea._walk},{tr2_idea._desc}" src_acptfact = acptfactunit_shop(base=tr2, pick=tr2, open=55, nigh=60) - lemmas_x.eval(tool_x=tr2_tool, src_acptfact=src_acptfact, src_tool=src_tool) + lemmas_x.eval(idea_x=tr2_idea, src_acptfact=src_acptfact, src_idea=src_idea) # When lem1 = lemmas_x.get_unevaluated_lemma() - print(f"{lem1.tool_x=}") + print(f"{lem1.idea_x=}") print(f"{tr1=}") lem2 = lemmas_x.get_unevaluated_lemma() - print(f"{lem2.tool_x=}") + print(f"{lem2.idea_x=}") lem3 = lemmas_x.get_unevaluated_lemma() print(f"{lem3=}") # Then - assert lem1.tool_x in (tr1_tool, tr2_tool) - assert lem2.tool_x in (tr1_tool, tr2_tool) + assert lem1.idea_x in (tr1_idea, tr2_idea) + assert lem2.idea_x in (tr1_idea, tr2_idea) assert lem3 is None lemmas_x = None @@ -321,20 +321,20 @@ def test_lemmas_is_lemmas_incomplete_ReturnsCorrectBoolWhenPopulated(): # Given lemmas_z = Lemmas() lemmas_z.lemmas = {} - src_tool = ToolKid(_desc="whatever", _walk="src", _begin=-13, _close=500) + src_idea = IdeaKid(_desc="whatever", _walk="src", _begin=-13, _close=500) # for lemma in lemmas_z.lemmas.values(): # print(f"Does not exist: {lemma.eval_status=} {lemma.calc_acptfact=}") - tr1_tool = ToolKid(_desc="timerange1", _walk="src", _begin=7, _close=12) - tr1_road = f"{tr1_tool._walk},{tr1_tool._desc}" + tr1_idea = IdeaKid(_desc="timerange1", _walk="src", _begin=7, _close=12) + tr1_road = f"{tr1_idea._walk},{tr1_idea._desc}" src_acptfact = acptfactunit_shop(base=tr1_road, pick=tr1_road, open=0, nigh=30) - lemmas_z.eval(tool_x=tr1_tool, src_acptfact=src_acptfact, src_tool=src_tool) + lemmas_z.eval(idea_x=tr1_idea, src_acptfact=src_acptfact, src_idea=src_idea) - tr2_tool = ToolKid(_desc="timerange2", _walk="src", _begin=40, _close=60) - tr2_road = f"{tr2_tool._walk},{tr2_tool._desc}" + tr2_idea = IdeaKid(_desc="timerange2", _walk="src", _begin=40, _close=60) + tr2_road = f"{tr2_idea._walk},{tr2_idea._desc}" src_acptfact = acptfactunit_shop(base=tr2_road, pick=tr2_road, open=55, nigh=60) - lemmas_z.eval(tool_x=tr2_tool, src_acptfact=src_acptfact, src_tool=src_tool) + lemmas_z.eval(idea_x=tr2_idea, src_acptfact=src_acptfact, src_idea=src_idea) # When/Then assert len(lemmas_z.lemmas) == 2 diff --git a/src/agent/test_/test_required.py b/src/agent/test_/test_required.py index 8f57cc28d..ae783fecb 100644 --- a/src/agent/test_/test_required.py +++ b/src/agent/test_/test_required.py @@ -14,11 +14,11 @@ def test_RequiredCore_attributesExist(): sufffact_x = sufffactunit_shop(need="casa,weekday,wednesday") sufffacts = {sufffact_x.need: sufffact_x} required = RequiredCore( - base=ced_day, sufffacts=sufffacts, suff_tool_active_status=False + base=ced_day, sufffacts=sufffacts, suff_idea_active_status=False ) assert required.base == ced_day assert required.sufffacts == sufffacts - assert required.suff_tool_active_status == False + assert required.suff_idea_active_status == False def test_RequiredHeir_clear_works(): @@ -31,7 +31,7 @@ def test_RequiredHeir_clear_works(): assert required._status required.clear_status() assert required._status is None - assert required._curr_tool_active_status is None + assert required._curr_idea_active_status is None def test_RequiredHeir_set_status_CorrectlySetsStatus(): @@ -78,25 +78,25 @@ def test_RequiredHeir_set_status_EmptyAcptFactCorrectlySetsStatus(): assert required._status == False -def test_RequiredHeir_set_curr_tool_active_status_Correctly(): +def test_RequiredHeir_set_curr_idea_active_status_Correctly(): # GIVEN ced_day = "casa,ced_day" required = RequiredHeir(base=ced_day, sufffacts=None) - assert required._curr_tool_active_status is None + assert required._curr_idea_active_status is None # WHEN - required.set_curr_tool_active_status(bool_x=True) + required.set_curr_idea_active_status(bool_x=True) # THEN - assert required._curr_tool_active_status + assert required._curr_idea_active_status def test_RequiredHeir_set_status_AgendaTrueCorrectlySetsStatusTrue(): # GIVEN required = RequiredHeir( - base="casa,weekday", sufffacts={}, suff_tool_active_status=True + base="casa,weekday", sufffacts={}, suff_idea_active_status=True ) - required.set_curr_tool_active_status(bool_x=True) + required.set_curr_idea_active_status(bool_x=True) assert required._status is None # WHEN @@ -109,9 +109,9 @@ def test_RequiredHeir_set_status_AgendaTrueCorrectlySetsStatusTrue(): def test_RequiredHeir_set_status_AgendaFalseCorrectlySetsStatusTrue(): # GIVEN required = RequiredHeir( - base="casa,weekday", sufffacts={}, suff_tool_active_status=False + base="casa,weekday", sufffacts={}, suff_idea_active_status=False ) - required.set_curr_tool_active_status(bool_x=False) + required.set_curr_idea_active_status(bool_x=False) assert required._status is None # WHEN required.set_status(acptfacts=None) @@ -122,9 +122,9 @@ def test_RequiredHeir_set_status_AgendaFalseCorrectlySetsStatusTrue(): def test_RequiredHeir_set_status_AgendaTrueCorrectlySetsStatusFalse(): # GIVEN required = RequiredHeir( - base="casa,weekday", sufffacts={}, suff_tool_active_status=True + base="casa,weekday", sufffacts={}, suff_idea_active_status=True ) - required.set_curr_tool_active_status(bool_x=False) + required.set_curr_idea_active_status(bool_x=False) assert required._status is None # WHEN required.set_status(acptfacts=None) @@ -135,9 +135,9 @@ def test_RequiredHeir_set_status_AgendaTrueCorrectlySetsStatusFalse(): def test_RequiredHeir_set_status_AgendaNoneCorrectlySetsStatusFalse(): # GIVEN required = RequiredHeir( - base="casa,weekday", sufffacts={}, suff_tool_active_status=True + base="casa,weekday", sufffacts={}, suff_idea_active_status=True ) - required.set_curr_tool_active_status(bool_x=None) + required.set_curr_idea_active_status(bool_x=None) assert required._status is None # WHEN required.set_status(acptfacts={}) diff --git a/src/agent/test_/test_road.py b/src/agent/test_/test_road.py index 1935b8ff9..d6c663647 100644 --- a/src/agent/test_/test_road.py +++ b/src/agent/test_/test_road.py @@ -11,7 +11,7 @@ get_ancestor_roads, ) from src.agent.required import sufffactunit_shop -from src.agent.tool import ToolCore +from src.agent.idea import IdeaCore from pytest import raises as pytest_raises @@ -196,30 +196,30 @@ def test_find_replace_road_key_dict_ReturnsCorrectDict_Scenario1(): # bloomers_road = Road(f"{src},{person_text},{bloomers_text}") # old_roses_text = "roses" # old_roses_road = Road(f"{src},{person_text},{bloomers_text},{old_roses_text}") -# tool_roses = ToolCore(_desc=old_roses_text, _walk=bloomers_road) -# tool_bloomers = ToolCore(_desc=bloomers_text, _walk=person_road) -# tool_bloomers.add_kid(tool_kid=tool_roses) +# idea_roses = IdeaCore(_desc=old_roses_text, _walk=bloomers_road) +# idea_bloomers = IdeaCore(_desc=bloomers_text, _walk=person_road) +# idea_bloomers.add_kid(idea_kid=idea_roses) -# for tool_key, tool_obj in tool_bloomers._kids.items(): -# assert tool_key == old_roses_text -# assert tool_obj.get_key_road() == old_roses_text -# assert tool_obj._desc == old_roses_text +# for idea_key, idea_obj in idea_bloomers._kids.items(): +# assert idea_key == old_roses_text +# assert idea_obj.get_key_road() == old_roses_text +# assert idea_obj._desc == old_roses_text # # WHEN # new_roses_text = "roses2" # new_roses_road = Road(f"src,person,{new_roses_text}") # new_kids_x = find_replace_road_key_dict( -# dict_x=tool_bloomers._kids, +# dict_x=idea_bloomers._kids, # old_road=old_roses_road, # new_road=new_roses_road, # key_is_last_node=True, # ) # # THEN -# for tool_key, tool_obj in new_kids_x.items(): -# assert tool_key == new_roses_text -# assert tool_obj.get_key_road() == new_roses_text -# assert tool_obj._desc == new_roses_text +# for idea_key, idea_obj in new_kids_x.items(): +# assert idea_key == new_roses_text +# assert idea_obj.get_key_road() == new_roses_text +# assert idea_obj._desc == new_roses_text # assert new_kids_x.get(old_roses_road) is None diff --git a/src/agent/test__tool/test_tool_attr_holder.py b/src/agent/test__idea/test_idea_attr_holder.py similarity index 60% rename from src/agent/test__tool/test_tool_attr_holder.py rename to src/agent/test__idea/test_idea_attr_holder.py index 1cffe8799..6a69e802e 100644 --- a/src/agent/test__tool/test_tool_attr_holder.py +++ b/src/agent/test__idea/test_idea_attr_holder.py @@ -1,9 +1,9 @@ -from src.agent.tool import ToolAttrHolder +from src.agent.idea import IdeaAttrHolder from pytest import raises as pytest_raise -def test_tool_attr_holder_exists(): - new_obj = ToolAttrHolder() +def test_idea_attr_holder_exists(): + new_obj = IdeaAttrHolder() assert new_obj.weight is None assert new_obj.uid is None assert new_obj.required is None @@ -14,7 +14,7 @@ def test_tool_attr_holder_exists(): assert new_obj.required_sufffact_divisor is None assert new_obj.required_del_sufffact_base is None assert new_obj.required_del_sufffact_need is None - assert new_obj.required_suff_tool_active_status is None + assert new_obj.required_suff_idea_active_status is None assert new_obj.begin is None assert new_obj.close is None assert new_obj.addin is None @@ -35,25 +35,25 @@ def test_tool_attr_holder_exists(): assert new_obj.on_meld_weight_action is None -def test_tool_attr_holder_CorrectlyCalculatesSuffFactRanges(): +def test_idea_attr_holder_CorrectlyCalculatesSuffFactRanges(): # Given - tool_attr = ToolAttrHolder(required_sufffact="some_road") - assert tool_attr.required_sufffact_open is None - assert tool_attr.required_sufffact_nigh is None - # assert tool_attr.required_sufffact_numor is None - assert tool_attr.required_sufffact_divisor is None - # assert tool_attr.required_sufffact_reest is None + idea_attr = IdeaAttrHolder(required_sufffact="some_road") + assert idea_attr.required_sufffact_open is None + assert idea_attr.required_sufffact_nigh is None + # assert idea_attr.required_sufffact_numor is None + assert idea_attr.required_sufffact_divisor is None + # assert idea_attr.required_sufffact_reest is None # WHEN - tool_attr.set_sufffact_range_attributes_influenced_by_sufffact_tool( + idea_attr.set_sufffact_range_attributes_influenced_by_sufffact_idea( sufffact_open=5.0, sufffact_nigh=20.0, # sufffact_numor, sufffact_denom=4.0, # sufffact_reest, ) - assert tool_attr.required_sufffact_open == 5.0 - assert tool_attr.required_sufffact_nigh == 20.0 - # assert tool_attr.required_sufffact_numor is None - assert tool_attr.required_sufffact_divisor == 4.0 - # assert tool_attr.required_sufffact_reest is None + assert idea_attr.required_sufffact_open == 5.0 + assert idea_attr.required_sufffact_nigh == 20.0 + # assert idea_attr.required_sufffact_numor is None + assert idea_attr.required_sufffact_divisor == 4.0 + # assert idea_attr.required_sufffact_reest is None diff --git a/src/agent/test__tool/test_tool_core.py b/src/agent/test__idea/test_idea_core.py similarity index 53% rename from src/agent/test__tool/test_tool_core.py rename to src/agent/test__idea/test_idea_core.py index d487239c4..62fd648da 100644 --- a/src/agent/test__tool/test_tool_core.py +++ b/src/agent/test__idea/test_idea_core.py @@ -1,4 +1,4 @@ -from src.agent.tool import ToolCore +from src.agent.idea import IdeaCore from src.agent.group import GroupName, grouplink_shop, groupheir_shop from src.agent.required import ( RequiredUnit, @@ -10,8 +10,8 @@ from pytest import raises as pytest_raise -def test_tool_core_exists(): - new_obj = ToolCore() +def test_idea_core_exists(): + new_obj = IdeaCore() assert new_obj assert new_obj._kids is None assert new_obj._weight >= 1 @@ -42,24 +42,24 @@ def test_tool_core_exists(): assert new_obj._agent_coin_cease is None -def test_tool_core_get_key_road_works(): +def test_idea_core_get_key_road_works(): x_walk = "src,round_things" x_desc = "ball" - tool = ToolCore(_desc=x_desc, _walk=x_walk) - assert tool.get_key_road() == f"{x_desc}" + idea = IdeaCore(_desc=x_desc, _walk=x_walk) + assert idea.get_key_road() == f"{x_desc}" -def test_tool_core_is_heir_CorrectlyIdentifiesHeirs(): - tool_core = ToolCore() +def test_idea_core_is_heir_CorrectlyIdentifiesHeirs(): + idea_core = IdeaCore() texas_road = "prom,Nation-States,USA,Texas" usa_road = "prom,Nation-States,USA" - assert tool_core.is_heir(src=usa_road, heir=usa_road) - assert tool_core.is_heir(src=usa_road, heir=texas_road) - assert tool_core.is_heir(src="earth,sea", heir="earth,seaside,beach") == False - assert tool_core.is_heir(src="earth,sea", heir="earth,seaside") == False + assert idea_core.is_heir(src=usa_road, heir=usa_road) + assert idea_core.is_heir(src=usa_road, heir=texas_road) + assert idea_core.is_heir(src="earth,sea", heir="earth,seaside,beach") == False + assert idea_core.is_heir(src="earth,sea", heir="earth,seaside") == False -def test_tool_core_grouplinks_exist(): +def test_idea_core_grouplinks_exist(): # GIVEN biker_creditor_weight = 12 biker_debtor_weight = 15 @@ -81,16 +81,16 @@ def test_tool_core_grouplinks_exist(): group_links = {swimmer_link.name: swimmer_link, biker_link.name: biker_link} # WHEN - tool_core = ToolCore(_desc="exercising", _grouplinks=group_links) + idea_core = IdeaCore(_desc="exercising", _grouplinks=group_links) # THEN - assert tool_core._grouplinks == group_links + assert idea_core._grouplinks == group_links # assert group_link_x.weight == 1.0 # group_link_x = grouplink_shop(name=bikers_name, weight=bikers_weight) # assert group_link_x.weight == 3.0 -def test_tool_core_get_inherited_groupheirs_weight_sum_WorksCorrectlyWithValues(): +def test_idea_core_get_inherited_groupheirs_weight_sum_WorksCorrectlyWithValues(): # GIVEN biker_creditor_weight = 12 biker_debtor_weight = 15 @@ -114,113 +114,113 @@ def test_tool_core_get_inherited_groupheirs_weight_sum_WorksCorrectlyWithValues( group_links = {swimmer_link.name: swimmer_link, biker_link.name: biker_link} # WHEN - tool_core = ToolCore(_desc="exercising", _groupheirs=group_links) + idea_core = IdeaCore(_desc="exercising", _groupheirs=group_links) # THEN - assert tool_core.get_groupheirs_creditor_weight_sum() != None - assert tool_core.get_groupheirs_creditor_weight_sum() == 41 - assert tool_core.get_groupheirs_debtor_weight_sum() != None - assert tool_core.get_groupheirs_debtor_weight_sum() == 47 + assert idea_core.get_groupheirs_creditor_weight_sum() != None + assert idea_core.get_groupheirs_creditor_weight_sum() == 41 + assert idea_core.get_groupheirs_debtor_weight_sum() != None + assert idea_core.get_groupheirs_debtor_weight_sum() == 47 - assert len(tool_core._groupheirs) == 2 + assert len(idea_core._groupheirs) == 2 - swimmer_groupheir = tool_core._groupheirs.get(swimmer_text) + swimmer_groupheir = idea_core._groupheirs.get(swimmer_text) assert swimmer_groupheir._agent_credit is None assert swimmer_groupheir._agent_debt is None - biker_groupheir = tool_core._groupheirs.get(biker_text) + biker_groupheir = idea_core._groupheirs.get(biker_text) assert biker_groupheir._agent_credit is None assert biker_groupheir._agent_debt is None # WHEN - tool_core._agent_importance = 0.25 - tool_core.set_groupheirs_agent_credit_debit() + idea_core._agent_importance = 0.25 + idea_core.set_groupheirs_agent_credit_debit() # THEN - print(f"{len(tool_core._groupheirs)=}") - swimmer_groupheir = tool_core._groupheirs.get(swimmer_text) + print(f"{len(idea_core._groupheirs)=}") + swimmer_groupheir = idea_core._groupheirs.get(swimmer_text) assert swimmer_groupheir._agent_credit != None assert swimmer_groupheir._agent_debt != None - biker_groupheir = tool_core._groupheirs.get(biker_text) + biker_groupheir = idea_core._groupheirs.get(biker_text) assert biker_groupheir._agent_credit != None assert biker_groupheir._agent_debt != None -def test_tool_core_get_grouplinks_weight_sum_WorksCorrectlyNoValues(): +def test_idea_core_get_grouplinks_weight_sum_WorksCorrectlyNoValues(): # GIVEN /WHEN - tool_core = ToolCore(_desc="exercising") + idea_core = IdeaCore(_desc="exercising") # THEN - assert tool_core.get_groupheirs_creditor_weight_sum() != None - assert tool_core.get_groupheirs_debtor_weight_sum() != None + assert idea_core.get_groupheirs_creditor_weight_sum() != None + assert idea_core.get_groupheirs_debtor_weight_sum() != None # does not crash with empty set - tool_core.set_groupheirs_agent_credit_debit() + idea_core.set_groupheirs_agent_credit_debit() -def test_tool_core_set_requiredheirsCorrectlyTakesFromOutside(): +def test_idea_core_set_requiredheirsCorrectlyTakesFromOutside(): # GIVEN - tool = ToolCore(_desc="ball") + idea = IdeaCore(_desc="ball") sufffact_x = sufffactunit_shop(need="ball,run", open=0, nigh=7) sufffacts = {sufffact_x.need: sufffact_x} requiredunit = RequiredUnit(base="ball,run", sufffacts=sufffacts) requiredunits = {requiredunit.base: requiredunit} requiredheir = RequiredHeir(base="ball,run", sufffacts=sufffacts) requiredheirs = {requiredheir.base: requiredheir} - assert tool._requiredunits is None - assert tool._requiredheirs is None - tool.set_requiredheirs(requiredheirs=requiredheirs) - assert tool._requiredunits == {} - assert tool._requiredheirs == requiredheirs - assert id(tool._requiredheirs) != id(requiredheirs) + assert idea._requiredunits is None + assert idea._requiredheirs is None + idea.set_requiredheirs(requiredheirs=requiredheirs) + assert idea._requiredunits == {} + assert idea._requiredheirs == requiredheirs + assert id(idea._requiredheirs) != id(requiredheirs) -def test_tool_core_set_requiredheirsCorrectlyTakesFromSelf(): +def test_idea_core_set_requiredheirsCorrectlyTakesFromSelf(): sufffact_x = sufffactunit_shop(need="ball,run", open=0, nigh=7) sufffacts = {sufffact_x.need: sufffact_x} requiredunit = RequiredUnit(base="ball,run", sufffacts=sufffacts) requiredunits = {requiredunit.base: requiredunit} - tool = ToolCore(_desc="ball", _requiredunits=requiredunits) + idea = IdeaCore(_desc="ball", _requiredunits=requiredunits) requiredheir = RequiredHeir(base="ball,run", sufffacts=sufffacts) requiredheirs = {requiredheir.base: requiredheir} - assert tool._requiredunits != None - assert tool._requiredheirs is None - tool.set_requiredheirs(requiredheirs=None) - assert tool._requiredheirs == requiredheirs + assert idea._requiredunits != None + assert idea._requiredheirs is None + idea.set_requiredheirs(requiredheirs=None) + assert idea._requiredheirs == requiredheirs -def test_tool_core_clear_descendant_promise_count_ClearsCorrectly(): - tool = ToolCore(_desc="ball", _descendant_promise_count=55) - assert tool._descendant_promise_count == 55 - tool.clear_descendant_promise_count() - assert tool._descendant_promise_count is None +def test_idea_core_clear_descendant_promise_count_ClearsCorrectly(): + idea = IdeaCore(_desc="ball", _descendant_promise_count=55) + assert idea._descendant_promise_count == 55 + idea.clear_descendant_promise_count() + assert idea._descendant_promise_count is None -def test_tool_core_clear_all_member_credit_debt_ClearsCorrectly(): - tool = ToolCore(_desc="ball", _all_member_credit=55, _all_member_debt=33) - assert tool._all_member_credit == 55 - assert tool._all_member_debt == 33 - tool.clear_all_member_credit_debt() - assert tool._all_member_credit is None - assert tool._all_member_debt is None +def test_idea_core_clear_all_member_credit_debt_ClearsCorrectly(): + idea = IdeaCore(_desc="ball", _all_member_credit=55, _all_member_debt=33) + assert idea._all_member_credit == 55 + assert idea._all_member_debt == 33 + idea.clear_all_member_credit_debt() + assert idea._all_member_credit is None + assert idea._all_member_debt is None -def test_get_kids_in_range_GetsCorrectTools(): +def test_get_kids_in_range_GetsCorrectIdeas(): # Given - tool_x = ToolCore(_desc="366months", _begin=0, _close=366) - tool_x.add_kid(tool_kid=ToolCore(_desc="Jan", _begin=0, _close=31)) - tool_x.add_kid(tool_kid=ToolCore(_desc="Feb29", _begin=31, _close=60)) - tool_x.add_kid(tool_kid=ToolCore(_desc="Mar", _begin=31, _close=91)) + idea_x = IdeaCore(_desc="366months", _begin=0, _close=366) + idea_x.add_kid(idea_kid=IdeaCore(_desc="Jan", _begin=0, _close=31)) + idea_x.add_kid(idea_kid=IdeaCore(_desc="Feb29", _begin=31, _close=60)) + idea_x.add_kid(idea_kid=IdeaCore(_desc="Mar", _begin=31, _close=91)) # When/Then - assert len(tool_x.get_kids_in_range(begin=100, close=120)) == 0 - assert len(tool_x.get_kids_in_range(begin=0, close=31)) == 1 - assert len(tool_x.get_kids_in_range(begin=5, close=5)) == 1 - assert len(tool_x.get_kids_in_range(begin=0, close=61)) == 3 - assert tool_x.get_kids_in_range(begin=31, close=31)[0]._desc == "Feb29" + assert len(idea_x.get_kids_in_range(begin=100, close=120)) == 0 + assert len(idea_x.get_kids_in_range(begin=0, close=31)) == 1 + assert len(idea_x.get_kids_in_range(begin=5, close=5)) == 1 + assert len(idea_x.get_kids_in_range(begin=0, close=61)) == 3 + assert idea_x.get_kids_in_range(begin=31, close=31)[0]._desc == "Feb29" -def test_tool_get_dict_ReturnsDict(): +def test_idea_get_dict_ReturnsDict(): # GIVEN src_text = "src" week_text = "weekdays" @@ -289,7 +289,7 @@ def test_tool_get_dict_ReturnsDict(): } x1_grouplinks = {biker_name: biker_get_dict, flyer_name: flyer_get_dict} - temp_tool = ToolCore( + temp_idea = IdeaCore( _walk="src,work", _kids=None, _grouplinks=biker_and_flyer_grouplinks, @@ -304,186 +304,186 @@ def test_tool_get_dict_ReturnsDict(): _problem_bool=True, ) acptfactunit_x = acptfactunit_shop(base=week_road, pick=week_road, open=5, nigh=59) - temp_tool._set_toolkid_attr(acptfactunit=acptfactunit_x) + temp_idea._set_ideakid_attr(acptfactunit=acptfactunit_x) # WHEN - toolkid_dict = temp_tool.get_dict() + ideakid_dict = temp_idea.get_dict() # THEN - assert toolkid_dict != None - assert toolkid_dict["_kids"] == temp_tool.get_kids_dict() - assert toolkid_dict["_requiredunits"] == temp_tool.get_requiredunits_dict() - assert toolkid_dict["_grouplinks"] == temp_tool.get_grouplinks_dict() - assert toolkid_dict["_grouplinks"] == x1_grouplinks - assert toolkid_dict["_weight"] == temp_tool._weight - assert toolkid_dict["_desc"] == temp_tool._desc - assert toolkid_dict["_uid"] == temp_tool._uid - assert toolkid_dict["_begin"] == temp_tool._begin - assert toolkid_dict["_close"] == temp_tool._close - assert toolkid_dict["_numor"] == temp_tool._numor - assert toolkid_dict["_denom"] == temp_tool._denom - assert toolkid_dict["_reest"] == temp_tool._reest - assert toolkid_dict["_special_road"] == temp_tool._special_road - assert toolkid_dict["promise"] == temp_tool.promise - assert toolkid_dict["_problem_bool"] == temp_tool._problem_bool - assert toolkid_dict["_is_expanded"] == temp_tool._is_expanded - assert len(toolkid_dict["_acptfactunits"]) == len( - temp_tool.get_acptfactunits_dict() + assert ideakid_dict != None + assert ideakid_dict["_kids"] == temp_idea.get_kids_dict() + assert ideakid_dict["_requiredunits"] == temp_idea.get_requiredunits_dict() + assert ideakid_dict["_grouplinks"] == temp_idea.get_grouplinks_dict() + assert ideakid_dict["_grouplinks"] == x1_grouplinks + assert ideakid_dict["_weight"] == temp_idea._weight + assert ideakid_dict["_desc"] == temp_idea._desc + assert ideakid_dict["_uid"] == temp_idea._uid + assert ideakid_dict["_begin"] == temp_idea._begin + assert ideakid_dict["_close"] == temp_idea._close + assert ideakid_dict["_numor"] == temp_idea._numor + assert ideakid_dict["_denom"] == temp_idea._denom + assert ideakid_dict["_reest"] == temp_idea._reest + assert ideakid_dict["_special_road"] == temp_idea._special_road + assert ideakid_dict["promise"] == temp_idea.promise + assert ideakid_dict["_problem_bool"] == temp_idea._problem_bool + assert ideakid_dict["_is_expanded"] == temp_idea._is_expanded + assert len(ideakid_dict["_acptfactunits"]) == len( + temp_idea.get_acptfactunits_dict() ) - assert toolkid_dict["_on_meld_weight_action"] == temp_tool._on_meld_weight_action + assert ideakid_dict["_on_meld_weight_action"] == temp_idea._on_meld_weight_action -def test_tool_vaild_DenomCorrectInheritsBeginAndClose(): - parent_tool = ToolCore(_desc="work", _begin=22.0, _close=66.0) - kid_tool_given = ToolCore(_desc="clean", _numor=1, _denom=11.0, _reest=False) - kid_tool_expected = ToolCore( +def test_idea_vaild_DenomCorrectInheritsBeginAndClose(): + parent_idea = IdeaCore(_desc="work", _begin=22.0, _close=66.0) + kid_idea_given = IdeaCore(_desc="clean", _numor=1, _denom=11.0, _reest=False) + kid_idea_expected = IdeaCore( _desc="clean", _numor=1, _denom=11.0, _reest=False, _begin=2, _close=6 ) - parent_tool.add_kid(tool_kid=kid_tool_given) - assert parent_tool._kids["clean"]._begin == 2 - assert parent_tool._kids["clean"]._close == 6 - assert parent_tool._kids["clean"] == kid_tool_expected + parent_idea.add_kid(idea_kid=kid_idea_given) + assert parent_idea._kids["clean"]._begin == 2 + assert parent_idea._kids["clean"]._close == 6 + assert parent_idea._kids["clean"] == kid_idea_expected -def test_tool_invaild_DenomThrowsError(): - parent_tool = ToolCore(_desc="work") - kid_tool = ToolCore(_desc="clean", _walk="src", _numor=1, _denom=11.0, _reest=False) +def test_idea_invaild_DenomThrowsError(): + parent_idea = IdeaCore(_desc="work") + kid_idea = IdeaCore(_desc="clean", _walk="src", _numor=1, _denom=11.0, _reest=False) # When/Then with pytest_raise(Exception) as excinfo: - parent_tool.add_kid(tool_kid=kid_tool) + parent_idea.add_kid(idea_kid=kid_idea) assert ( str(excinfo.value) - == "Tool src,clean cannot have numor,denom,reest if parent does not have begin/close range" + == "Idea src,clean cannot have numor,denom,reest if parent does not have begin/close range" ) -def test_tool_get_requiredheir_correctlyReturnsRequiredHeir(): +def test_idea_get_requiredheir_correctlyReturnsRequiredHeir(): # GIVEN - tool_x = ToolCore(_desc="test4") + idea_x = IdeaCore(_desc="test4") test5_text = "test5" required_heir_x = RequiredHeir(base=test5_text, sufffacts={}) required_heirs_x = {required_heir_x.base: required_heir_x} - tool_x.set_requiredheirs(requiredheirs=required_heirs_x) + idea_x.set_requiredheirs(requiredheirs=required_heirs_x) # WHEN - required_heir_z = tool_x.get_requiredheir(base=test5_text) + required_heir_z = idea_x.get_requiredheir(base=test5_text) # THEN assert required_heir_z != None assert required_heir_z.base == test5_text -def test_tool_get_requiredheir_correctlyReturnsNone(): +def test_idea_get_requiredheir_correctlyReturnsNone(): # GIVEN - tool_x = ToolCore(_desc="test4") + idea_x = IdeaCore(_desc="test4") test5_text = "test5" required_heir_x = RequiredHeir(base=test5_text, sufffacts={}) required_heirs_x = {required_heir_x.base: required_heir_x} - tool_x.set_requiredheirs(requiredheirs=required_heirs_x) + idea_x.set_requiredheirs(requiredheirs=required_heirs_x) # WHEN test6_text = "test6" - required_heir_test6 = tool_x.get_requiredheir(base=test6_text) + required_heir_test6 = idea_x.get_requiredheir(base=test6_text) # THEN assert required_heir_test6 is None -def test_tool_set_active_status_SetsNullactive_status_hxToNonEmpty(): +def test_idea_set_active_status_SetsNullactive_status_hxToNonEmpty(): # GIVEN - tool_x = ToolCore(_desc="test4") - assert tool_x._active_status_hx is None + idea_x = IdeaCore(_desc="test4") + assert idea_x._active_status_hx is None # WHEN - tool_x.set_active_status(tree_traverse_count=3) + idea_x.set_active_status(tree_traverse_count=3) # THEN - assert tool_x._active_status_hx == {3: True} + assert idea_x._active_status_hx == {3: True} -def test_tool_set_active_status_IfFullactive_status_hxResetToTrue(): +def test_idea_set_active_status_IfFullactive_status_hxResetToTrue(): # GIVEN - tool_x = ToolCore(_desc="test4") - tool_x._active_status_hx = {0: True, 4: False} - assert tool_x._active_status_hx != {0: True} + idea_x = IdeaCore(_desc="test4") + idea_x._active_status_hx = {0: True, 4: False} + assert idea_x._active_status_hx != {0: True} # WHEN - tool_x.set_active_status(tree_traverse_count=0) + idea_x.set_active_status(tree_traverse_count=0) # THEN - assert tool_x._active_status_hx == {0: True} + assert idea_x._active_status_hx == {0: True} -# def test_tool_set_active_status_IfFullactive_status_hxResetToFalse(): +# def test_idea_set_active_status_IfFullactive_status_hxResetToFalse(): # # GIVEN -# tool_x = ToolCore(_desc="test4") -# tool_x.set_required_sufffact( +# idea_x = IdeaCore(_desc="test4") +# idea_x.set_required_sufffact( # base="testing1,second", # sufffact="testing1,second,next", # open=None, # nigh=None, # divisor=None, # ) -# tool_x._active_status_hx = {0: True, 4: False} -# assert tool_x._active_status_hx != {0: False} +# idea_x._active_status_hx = {0: True, 4: False} +# assert idea_x._active_status_hx != {0: False} # # WHEN -# tool_x.set_active_status(tree_traverse_count=0) +# idea_x.set_active_status(tree_traverse_count=0) # # THEN -# assert tool_x._active_status_hx == {0: False} +# assert idea_x._active_status_hx == {0: False} -def test_tool_record_active_status_hx_CorrectlyRecordsHistory(): +def test_idea_record_active_status_hx_CorrectlyRecordsHistory(): # GIVEN - tool_x = ToolCore(_desc="test4") - assert tool_x._active_status_hx is None + idea_x = IdeaCore(_desc="test4") + assert idea_x._active_status_hx is None # WHEN - tool_x.record_active_status_hx( + idea_x.record_active_status_hx( tree_traverse_count=0, prev_active_status=None, curr_active_status=True, ) # THEN - assert tool_x._active_status_hx == {0: True} + assert idea_x._active_status_hx == {0: True} # WHEN - tool_x.record_active_status_hx( + idea_x.record_active_status_hx( tree_traverse_count=1, prev_active_status=True, curr_active_status=True, ) # THEN - assert tool_x._active_status_hx == {0: True} + assert idea_x._active_status_hx == {0: True} # WHEN - tool_x.record_active_status_hx( + idea_x.record_active_status_hx( tree_traverse_count=2, prev_active_status=True, curr_active_status=False, ) # THEN - assert tool_x._active_status_hx == {0: True, 2: False} + assert idea_x._active_status_hx == {0: True, 2: False} # WHEN - tool_x.record_active_status_hx( + idea_x.record_active_status_hx( tree_traverse_count=3, prev_active_status=False, curr_active_status=False, ) # THEN - assert tool_x._active_status_hx == {0: True, 2: False} + assert idea_x._active_status_hx == {0: True, 2: False} # WHEN - tool_x.record_active_status_hx( + idea_x.record_active_status_hx( tree_traverse_count=4, prev_active_status=False, curr_active_status=True, ) # THEN - assert tool_x._active_status_hx == {0: True, 2: False, 4: True} + assert idea_x._active_status_hx == {0: True, 2: False, 4: True} # WHEN - tool_x.record_active_status_hx( + idea_x.record_active_status_hx( tree_traverse_count=0, prev_active_status=False, curr_active_status=False, ) # THEN - assert tool_x._active_status_hx == {0: False} + assert idea_x._active_status_hx == {0: False} diff --git a/src/agent/test__idea/test_idea_kid.py b/src/agent/test__idea/test_idea_kid.py new file mode 100644 index 000000000..5e32c3be6 --- /dev/null +++ b/src/agent/test__idea/test_idea_kid.py @@ -0,0 +1,6 @@ +from src.agent.idea import IdeaKid + + +def test_idea_kid_exists(): + new_obj = IdeaKid() + assert new_obj diff --git a/src/agent/test__tool/test_tool_meld.py b/src/agent/test__idea/test_idea_meld.py similarity index 62% rename from src/agent/test__tool/test_tool_meld.py rename to src/agent/test__idea/test_idea_meld.py index 3d7ed86ea..650f62e1e 100644 --- a/src/agent/test__tool/test_tool_meld.py +++ b/src/agent/test__idea/test_idea_meld.py @@ -1,11 +1,11 @@ -from src.agent.tool import ToolCore, ToolAttrHolder +from src.agent.idea import IdeaCore, IdeaAttrHolder from src.agent.group import GroupLink, GroupName, grouplink_shop from src.agent.required import RequiredUnit, acptfactunit_shop as c_acptfactunit, Road from pytest import raises as pytest_raises -def custom_set_tool_attr( - tool: ToolCore, +def custom_set_idea_attr( + idea: IdeaCore, weight: int = None, uid: int = None, required: RequiredUnit = None, # delete/replace RequiredUnit @@ -16,7 +16,7 @@ def custom_set_tool_attr( required_sufffact_divisor: int = None, required_del_sufffact_base: Road = None, required_del_sufffact_need: Road = None, - required_suff_tool_active_status: str = None, + required_suff_idea_active_status: str = None, begin: float = None, close: float = None, addin: int = None, @@ -35,7 +35,7 @@ def custom_set_tool_attr( problem_bool: bool = None, on_meld_weight_action: str = None, ): - tool_attr = ToolAttrHolder( + idea_attr = IdeaAttrHolder( weight=weight, uid=uid, required=required, @@ -46,7 +46,7 @@ def custom_set_tool_attr( required_sufffact_divisor=required_sufffact_divisor, required_del_sufffact_base=required_del_sufffact_base, required_del_sufffact_need=required_del_sufffact_need, - required_suff_tool_active_status=required_suff_tool_active_status, + required_suff_idea_active_status=required_suff_idea_active_status, begin=begin, close=close, addin=addin, @@ -66,28 +66,28 @@ def custom_set_tool_attr( on_meld_weight_action=on_meld_weight_action, ) - tool._set_tool_attr(tool_attr=tool_attr) + idea._set_idea_attr(idea_attr=idea_attr) -def test_tool_required_meld_BaseScenarioWorks(): +def test_idea_required_meld_BaseScenarioWorks(): # GIVEN required_base_x1 = "src,ball,run" - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr( - tool=yx1, + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr( + idea=yx1, required_base=required_base_x1, required_sufffact=required_base_x1, ) - yx2 = ToolCore(_desc="spirit") - custom_set_tool_attr( - tool=yx2, + yx2 = IdeaCore(_desc="spirit") + custom_set_idea_attr( + idea=yx2, required_base=required_base_x1, required_sufffact=required_base_x1, ) # WHEN - yx1.meld(other_tool=yx2) + yx1.meld(other_idea=yx2) # THEN lu_x = RequiredUnit(base=required_base_x1, sufffacts={}) @@ -98,26 +98,26 @@ def test_tool_required_meld_BaseScenarioWorks(): assert yx1._weight == 1 -def test_tool_required_meld_TwoRequiredsScenarioWorks(): +def test_idea_required_meld_TwoRequiredsScenarioWorks(): # GIVEN required_base_x1 = "src,ball,run" required_base_x2 = "src,ball,swim" - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr( - tool=yx1, + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr( + idea=yx1, required_base=required_base_x1, required_sufffact=required_base_x1, ) - yx2 = ToolCore(_desc="spirit") - custom_set_tool_attr( - tool=yx2, + yx2 = IdeaCore(_desc="spirit") + custom_set_idea_attr( + idea=yx2, required_base=required_base_x2, required_sufffact=required_base_x2, ) # WHEN - yx1.meld(other_tool=yx2) + yx1.meld(other_idea=yx2) # THEN assert len(yx1._requiredunits) == 2 @@ -125,31 +125,31 @@ def test_tool_required_meld_TwoRequiredsScenarioWorks(): assert yx1._requiredunits[required_base_x2] != None -def test_tool_required_meld_TwoRequiredsMeldScenarioWorks(): +def test_idea_required_meld_TwoRequiredsMeldScenarioWorks(): # GIVEN required_base_x1 = "src,ball,run" required_base_x2 = "src,ball,swim" - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr( - tool=yx1, + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr( + idea=yx1, required_base=required_base_x1, required_sufffact=required_base_x1, ) - custom_set_tool_attr( - tool=yx1, + custom_set_idea_attr( + idea=yx1, required_base=required_base_x2, required_sufffact=required_base_x2, ) - yx2 = ToolCore(_desc="spirit") - custom_set_tool_attr( - tool=yx2, + yx2 = IdeaCore(_desc="spirit") + custom_set_idea_attr( + idea=yx2, required_base=required_base_x2, required_sufffact=required_base_x2, ) # WHEN - yx1.meld(other_tool=yx2) + yx1.meld(other_idea=yx2) # THEN # lu_x = RequiredUnit(base=required_base_x1, sufffacts={}) @@ -161,68 +161,68 @@ def test_tool_required_meld_TwoRequiredsMeldScenarioWorks(): assert yx1._requiredunits[required_base_x2] != None -def test_tool_grouplink_meld_BaseScenarioWorks_on_meld_weight_actionEquals_default(): +def test_idea_grouplink_meld_BaseScenarioWorks_on_meld_weight_actionEquals_default(): # GIVEN - yx1 = ToolCore(_desc="spirit") + yx1 = IdeaCore(_desc="spirit") br1 = "Running" - custom_set_tool_attr(tool=yx1, on_meld_weight_action="default") - custom_set_tool_attr( - tool=yx1, grouplink=grouplink_shop(name=br1, creditor_weight=2) + custom_set_idea_attr(idea=yx1, on_meld_weight_action="default") + custom_set_idea_attr( + idea=yx1, grouplink=grouplink_shop(name=br1, creditor_weight=2) ) - yx2 = ToolCore(_desc="Rocking") - custom_set_tool_attr(tool=yx2, on_meld_weight_action="default") - custom_set_tool_attr( - tool=yx2, grouplink=grouplink_shop(name=br1, creditor_weight=3) + yx2 = IdeaCore(_desc="Rocking") + custom_set_idea_attr(idea=yx2, on_meld_weight_action="default") + custom_set_idea_attr( + idea=yx2, grouplink=grouplink_shop(name=br1, creditor_weight=3) ) # WHEN - yx1.meld(other_tool=yx2) + yx1.meld(other_idea=yx2) # THEN bl_x = grouplink_shop(name=br1, creditor_weight=2) assert yx1._grouplinks[br1] == bl_x -def test_tool_grouplink_meld_BaseScenarioWorks_on_meld_weight_actionEquals_sum(): +def test_idea_grouplink_meld_BaseScenarioWorks_on_meld_weight_actionEquals_sum(): # GIVEN - yx1 = ToolCore(_desc="spirit") + yx1 = IdeaCore(_desc="spirit") br1 = "Running" - custom_set_tool_attr(tool=yx1, on_meld_weight_action="sum") - custom_set_tool_attr( - tool=yx1, grouplink=grouplink_shop(name=br1, creditor_weight=2, debtor_weight=3) + custom_set_idea_attr(idea=yx1, on_meld_weight_action="sum") + custom_set_idea_attr( + idea=yx1, grouplink=grouplink_shop(name=br1, creditor_weight=2, debtor_weight=3) ) - yx2 = ToolCore(_desc="Rocking") - custom_set_tool_attr(tool=yx2, on_meld_weight_action="sum") - custom_set_tool_attr( - tool=yx2, grouplink=grouplink_shop(name=br1, creditor_weight=2, debtor_weight=3) + yx2 = IdeaCore(_desc="Rocking") + custom_set_idea_attr(idea=yx2, on_meld_weight_action="sum") + custom_set_idea_attr( + idea=yx2, grouplink=grouplink_shop(name=br1, creditor_weight=2, debtor_weight=3) ) # WHEN - yx1.meld(other_tool=yx2) + yx1.meld(other_idea=yx2) # THEN lu_x = grouplink_shop(name=br1, creditor_weight=4, debtor_weight=6) assert yx1._grouplinks[br1] == lu_x -def test_tool_grouplink_meld_TwoGroupsScenarioWorks(): +def test_idea_grouplink_meld_TwoGroupsScenarioWorks(): # GIVEN - yx1 = ToolCore(_desc="spirit") + yx1 = IdeaCore(_desc="spirit") br1 = "Running" - custom_set_tool_attr(tool=yx1, on_meld_weight_action="sum") - custom_set_tool_attr( - tool=yx1, grouplink=grouplink_shop(name=br1, creditor_weight=2) + custom_set_idea_attr(idea=yx1, on_meld_weight_action="sum") + custom_set_idea_attr( + idea=yx1, grouplink=grouplink_shop(name=br1, creditor_weight=2) ) br2 = "Bears" - yx2 = ToolCore(_desc="Rocking") - custom_set_tool_attr(tool=yx1, on_meld_weight_action="sum") - custom_set_tool_attr( - tool=yx2, grouplink=grouplink_shop(name=br2, creditor_weight=2) + yx2 = IdeaCore(_desc="Rocking") + custom_set_idea_attr(idea=yx1, on_meld_weight_action="sum") + custom_set_idea_attr( + idea=yx2, grouplink=grouplink_shop(name=br2, creditor_weight=2) ) # WHEN - yx1.meld(other_tool=yx2) + yx1.meld(other_idea=yx2) # THEN lu_x1 = grouplink_shop(name=br1, creditor_weight=2) @@ -231,7 +231,7 @@ def test_tool_grouplink_meld_TwoGroupsScenarioWorks(): assert yx1._grouplinks[br2] == lu_x2 -def test_tool_acptfactunits_meld_BaseScenarioWorks(): +def test_idea_acptfactunits_meld_BaseScenarioWorks(): # GIVEN src = "casa" tech_text = "tech" @@ -239,12 +239,12 @@ def test_tool_acptfactunits_meld_BaseScenarioWorks(): bowl_text = "bowl" bowl_road = f"{src},{tech_text},{bowl_text}" hc_1 = c_acptfactunit(base=tech_road, pick=bowl_road) - yx1 = ToolCore(_desc="spirit") + yx1 = IdeaCore(_desc="spirit") yx1.set_acptfactunits_empty_if_null() yx1.set_acptfactunit(acptfactunit=hc_1) hc_2 = c_acptfactunit(base=tech_road, pick=bowl_road) - yx2 = ToolCore(_desc="fun") + yx2 = IdeaCore(_desc="fun") yx2.set_acptfactunits_empty_if_null() yx2.set_acptfactunit(acptfactunit=hc_2) @@ -257,7 +257,7 @@ def test_tool_acptfactunits_meld_BaseScenarioWorks(): assert yx1._acptfactunits == yx2._acptfactunits -def test_tool_acptfactunits_meld_2AcptFactUnitsWorks(): +def test_idea_acptfactunits_meld_2AcptFactUnitsWorks(): # GIVEN src = "casa" tech_text = "tech" @@ -268,15 +268,15 @@ def test_tool_acptfactunits_meld_2AcptFactUnitsWorks(): plate_road = f"{src},{tech_text},{plate_text}" hc_1 = c_acptfactunit(base=tech_road, pick=bowl_road) - yx1 = ToolCore(_desc="spirit") + yx1 = IdeaCore(_desc="spirit") yx1.set_acptfactunit(acptfactunit=hc_1) hc_2 = c_acptfactunit(base=plate_road, pick=plate_road) - yx2 = ToolCore(_desc="fun") + yx2 = IdeaCore(_desc="fun") yx2.set_acptfactunit(acptfactunit=hc_2) # WHEN - yx1.meld(other_tool=yx2) + yx1.meld(other_idea=yx2) # THEN assert len(yx1._acptfactunits) == 2 @@ -284,7 +284,7 @@ def test_tool_acptfactunits_meld_2AcptFactUnitsWorks(): assert yx1._acptfactunits != yx2._acptfactunits -def test_tool_attributes_meld_Works(): +def test_idea_attributes_meld_Works(): # GIVEN src = "casa" tech_text = "tech" @@ -294,9 +294,9 @@ def test_tool_attributes_meld_Works(): plate_text = "plate" plate_road = f"{src},{tech_text},{plate_text}" - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr( - tool=yx1, + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr( + idea=yx1, uid="test_uid1", weight=7, begin=1, @@ -313,9 +313,9 @@ def test_tool_attributes_meld_Works(): is_expanded=True, ) - yx2 = ToolCore(_desc="fun") - custom_set_tool_attr( - tool=yx2, + yx2 = IdeaCore(_desc="fun") + custom_set_idea_attr( + idea=yx2, uid="test_uid1", weight=7, begin=1, @@ -352,199 +352,199 @@ def test_tool_attributes_meld_Works(): assert yx1._is_expanded == True -def test_tool_attributes_meld_FailRaisesError_uid(): +def test_idea_attributes_meld_FailRaisesError_uid(): x_name = "_uid" x_val = "test_uid1" - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, uid=x_val) - yx2 = ToolCore(_desc="fun") + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, uid=x_val) + yx2 = IdeaCore(_desc="fun") # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" ) -def test_tool_attributes_meld_FailRaisesError_begin(): +def test_idea_attributes_meld_FailRaisesError_begin(): x_name = "_begin" x_val = 77 - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, begin=x_val) - yx2 = ToolCore(_desc="fun") + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, begin=x_val) + yx2 = IdeaCore(_desc="fun") # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" ) -def test_tool_attributes_meld_FailRaisesError_close(): +def test_idea_attributes_meld_FailRaisesError_close(): x_name = "_close" x_val = 77 - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, close=x_val) - yx2 = ToolCore(_desc="fun") + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, close=x_val) + yx2 = IdeaCore(_desc="fun") # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" ) -def test_tool_attributes_meld_FailRaisesError_addin(): +def test_idea_attributes_meld_FailRaisesError_addin(): x_name = "_addin" x_val = 77 - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, addin=x_val) - yx2 = ToolCore(_desc="fun") + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, addin=x_val) + yx2 = IdeaCore(_desc="fun") # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" ) -def test_tool_attributes_meld_FailRaisesError_denom(): +def test_idea_attributes_meld_FailRaisesError_denom(): x_name = "_denom" x_val = 15 - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, denom=x_val) - yx2 = ToolCore(_desc="fun") + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, denom=x_val) + yx2 = IdeaCore(_desc="fun") # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" ) -def test_tool_attributes_meld_FailRaisesError_numor(): +def test_idea_attributes_meld_FailRaisesError_numor(): x_name = "_numor" x_val = 77 - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, numor=x_val) - yx2 = ToolCore(_desc="fun") + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, numor=x_val) + yx2 = IdeaCore(_desc="fun") # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" ) -def test_tool_attributes_meld_FailRaisesError_reest(): +def test_idea_attributes_meld_FailRaisesError_reest(): x_name = "_reest" x_val = 77 - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, reest=x_val) - yx2 = ToolCore(_desc="fun") + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, reest=x_val) + yx2 = IdeaCore(_desc="fun") # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" ) -def test_tool_attributes_meld_FailRaisesError_special_road(): +def test_idea_attributes_meld_FailRaisesError_special_road(): x_name = "_special_road" x_val = "test_special_road1" - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, special_road=x_val) - yx2 = ToolCore(_desc="fun") + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, special_road=x_val) + yx2 = IdeaCore(_desc="fun") # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" ) -def test_tool_attributes_meld_FailRaisesError_numeric_road(): +def test_idea_attributes_meld_FailRaisesError_numeric_road(): x_name = "_numeric_road" x_val = "test_numeric_road1" - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, numeric_road=x_val) - yx2 = ToolCore(_desc="fun") + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, numeric_road=x_val) + yx2 = IdeaCore(_desc="fun") # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" ) -def test_tool_attributes_meld_FailRaisesError_action(): +def test_idea_attributes_meld_FailRaisesError_action(): x_name = "promise" x_val = True - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, promise=x_val) - yx2 = ToolCore(_desc="fun") + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, promise=x_val) + yx2 = IdeaCore(_desc="fun") # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:False" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:False" ) -# def test_tool_attributes_meld_FailRaisesError_all_member_credit(): -# def test_tool_attributes_meld_FailRaisesError_all_member_debt(): +# def test_idea_attributes_meld_FailRaisesError_all_member_credit(): +# def test_idea_attributes_meld_FailRaisesError_all_member_debt(): # x_name = "_all_member_credit" # x_name = "_all_member_debt" # x_val = "test_all_member_credit1" # x_val = "test_all_member_debt1" -# yx1 = ToolCore(_desc="spirit") -# custom_set_tool_attr(tool=yx1, all_member_credit=x_val) -# custom_set_tool_attr(tool=yx1, all_member_debt=x_val) -# yx2 = ToolCore(_desc="fun") +# yx1 = IdeaCore(_desc="spirit") +# custom_set_idea_attr(idea=yx1, all_member_credit=x_val) +# custom_set_idea_attr(idea=yx1, all_member_debt=x_val) +# yx2 = IdeaCore(_desc="fun") # # WHEN/THEN # with pytest_raises(Exception) as excinfo: # yx1.meld(yx2) # assert ( # str(excinfo.value) -# == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" +# == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:None" # ) -def test_tool_attributes_meld_FailRaisesError_is_expanded(): +def test_idea_attributes_meld_FailRaisesError_is_expanded(): x_name = "_is_expanded" x_val = False outside_val = True - yx1 = ToolCore(_desc="spirit") - custom_set_tool_attr(tool=yx1, is_expanded=x_val) - yx2 = ToolCore(_desc="fun") - custom_set_tool_attr(tool=yx2, is_expanded=outside_val) + yx1 = IdeaCore(_desc="spirit") + custom_set_idea_attr(idea=yx1, is_expanded=x_val) + yx2 = IdeaCore(_desc="fun") + custom_set_idea_attr(idea=yx2, is_expanded=outside_val) # WHEN/THEN with pytest_raises(Exception) as excinfo: yx1.meld(yx2) assert ( str(excinfo.value) - == f"Meld fail tool={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:True" + == f"Meld fail idea={yx1._walk},{yx1._desc} {x_name}:{x_val} with {yx2._walk},{yx2._desc} {x_name}:True" ) diff --git a/src/agent/test__tool/test_tool_road_change.py b/src/agent/test__idea/test_idea_road_change.py similarity index 64% rename from src/agent/test__tool/test_tool_road_change.py rename to src/agent/test__idea/test_idea_road_change.py index 2a2941e13..8b604bab8 100644 --- a/src/agent/test__tool/test_tool_road_change.py +++ b/src/agent/test__idea/test_idea_road_change.py @@ -1,35 +1,35 @@ -from src.agent.tool import ToolCore +from src.agent.idea import IdeaCore from src.agent.required import RequiredUnit, sufffactunit_shop, Road, acptfactunit_shop from pytest import raises as pytest_raises -def test_tool_find_replace_road_Changes_walk(): - # GIVEN Tool with _walk that will be changed +def test_idea_find_replace_road_Changes_walk(): + # GIVEN Idea with _walk that will be changed src = "src" old_person = "person1" bloomers_text = "bloomers" bloomers_road = f"{src},{old_person},{bloomers_text}" roses_text = "roses" roses_road = f"{src},{old_person},{bloomers_text},{roses_text}" - tool_x = ToolCore(_desc=roses_text, _walk=bloomers_road) - assert Road(f"{tool_x._walk}") == bloomers_road - assert Road(f"{tool_x._walk},{tool_x._desc}") == roses_road + idea_x = IdeaCore(_desc=roses_text, _walk=bloomers_road) + assert Road(f"{idea_x._walk}") == bloomers_road + assert Road(f"{idea_x._walk},{idea_x._desc}") == roses_road # WHEN new_person = "person1" old_person_road = f"{src},{old_person}" new_person_road = f"{src},{new_person}" - tool_x.find_replace_road(old_road=old_person_road, new_road=new_person_road) + idea_x.find_replace_road(old_road=old_person_road, new_road=new_person_road) # THEN new_bloomers_road = f"{src},{new_person},{bloomers_text}" new_roses_road = f"{src},{new_person},{bloomers_text},{roses_text}" - assert Road(f"{tool_x._walk}") == new_bloomers_road - assert Road(f"{tool_x._walk},{tool_x._desc}") == new_roses_road + assert Road(f"{idea_x._walk}") == new_bloomers_road + assert Road(f"{idea_x._walk},{idea_x._desc}") == new_roses_road -def test_tool_find_replace_road_Changes_special_road_numeric_road(): - # GIVEN Tool with special road and numeric road that will be changed +def test_idea_find_replace_road_Changes_special_road_numeric_road(): + # GIVEN Idea with special road and numeric road that will be changed src = "src" person = "person" bloomers_text = "bloomers" @@ -47,29 +47,29 @@ def test_tool_find_replace_road_Changes_special_road_numeric_road(): fertilizer_text = "fertilizer" fertilizer_road = f"{src},{farm_text},{fertilizer_text}" farm_road = f"{src},{farm_text}" - tool_x = ToolCore( + idea_x = IdeaCore( _desc=roses_text, _walk=bloomers_road, _special_road=old_rain_road, _numeric_road=old_snow_road, ) - assert tool_x._special_road == old_rain_road - assert tool_x._numeric_road == old_snow_road + assert idea_x._special_road == old_rain_road + assert idea_x._numeric_road == old_snow_road # WHEN new_water_text = "h2o" new_water_road = f"{src},{new_water_text}" new_rain_road = f"{src},{new_water_text},{rain_text}" new_snow_road = f"{src},{new_water_text},{snow_text}" - tool_x.find_replace_road(old_road=old_water_road, new_road=new_water_road) + idea_x.find_replace_road(old_road=old_water_road, new_road=new_water_road) # THEN - assert tool_x._special_road == new_rain_road - assert tool_x._numeric_road == new_snow_road + assert idea_x._special_road == new_rain_road + assert idea_x._numeric_road == new_snow_road -def test_tool_find_replace_road_Changes_requiredunits(): - # GIVEN Tool with required that will be changed +def test_idea_find_replace_road_Changes_requiredunits(): + # GIVEN Idea with required that will be changed src = "src" person = "person" bloomers_text = "bloomers" @@ -85,10 +85,10 @@ def test_tool_find_replace_road_Changes_requiredunits(): sufffacts_x = {sufffact_x.need: sufffact_x} required_x = RequiredUnit(base=old_water_road, sufffacts=sufffacts_x) requireds_x = {required_x.base: required_x} - tool_x = ToolCore(_desc=roses_text, _requiredunits=requireds_x) + idea_x = IdeaCore(_desc=roses_text, _requiredunits=requireds_x) # confirm asserts - assert tool_x._requiredunits.get(old_water_road) != None - old_water_rain_required = tool_x._requiredunits[old_water_road] + assert idea_x._requiredunits.get(old_water_road) != None + old_water_rain_required = idea_x._requiredunits[old_water_road] assert old_water_rain_required.base == old_water_road assert old_water_rain_required.sufffacts.get(old_rain_road) != None water_rain_l_sufffact = old_water_rain_required.sufffacts[old_rain_road] @@ -97,13 +97,13 @@ def test_tool_find_replace_road_Changes_requiredunits(): # WHEN new_water_text = "h2o" new_water_road = f"{src},{new_water_text}" - assert tool_x._requiredunits.get(new_water_road) is None - tool_x.find_replace_road(old_road=old_water_road, new_road=new_water_road) + assert idea_x._requiredunits.get(new_water_road) is None + idea_x.find_replace_road(old_road=old_water_road, new_road=new_water_road) # THEN - assert tool_x._requiredunits.get(old_water_road) is None - assert tool_x._requiredunits.get(new_water_road) != None - new_water_rain_required = tool_x._requiredunits[new_water_road] + assert idea_x._requiredunits.get(old_water_road) is None + assert idea_x._requiredunits.get(new_water_road) != None + new_water_rain_required = idea_x._requiredunits[new_water_road] assert new_water_rain_required.base == new_water_road new_rain_road = f"{src},{new_water_text},{rain_text}" assert new_water_rain_required.sufffacts.get(old_rain_road) is None @@ -111,8 +111,8 @@ def test_tool_find_replace_road_Changes_requiredunits(): new_water_rain_l_sufffact = new_water_rain_required.sufffacts[new_rain_road] assert new_water_rain_l_sufffact.need == new_rain_road - print(f"{len(tool_x._requiredunits)=}") - required_obj = tool_x._requiredunits.get(new_water_road) + print(f"{len(idea_x._requiredunits)=}") + required_obj = idea_x._requiredunits.get(new_water_road) assert required_obj != None print(f"{len(required_obj.sufffacts)=}") @@ -121,8 +121,8 @@ def test_tool_find_replace_road_Changes_requiredunits(): assert sufffact_obj.need == new_rain_road -def test_tool_find_replace_road_Changes_acptfactunits(): - # GIVEN Tool with acptfactunit that will be changed +def test_idea_find_replace_road_Changes_acptfactunits(): + # GIVEN Idea with acptfactunit that will be changed src = "src" person = "person" bloomers_text = "bloomers" @@ -136,34 +136,34 @@ def test_tool_find_replace_road_Changes_acptfactunits(): acptfactunit_x = acptfactunit_shop(base=old_water_road, pick=old_rain_road) acptfactunits_x = {acptfactunit_x.base: acptfactunit_x} - tool_x = ToolCore(_desc=roses_text, _acptfactunits=acptfactunits_x) - assert tool_x._acptfactunits[old_water_road] != None - old_water_rain_acptfactunit = tool_x._acptfactunits[old_water_road] + idea_x = IdeaCore(_desc=roses_text, _acptfactunits=acptfactunits_x) + assert idea_x._acptfactunits[old_water_road] != None + old_water_rain_acptfactunit = idea_x._acptfactunits[old_water_road] assert old_water_rain_acptfactunit.base == old_water_road assert old_water_rain_acptfactunit.pick == old_rain_road # WHEN new_water_text = "h2o" new_water_road = f"{src},{new_water_text}" - assert tool_x._acptfactunits.get(new_water_road) is None - tool_x.find_replace_road(old_road=old_water_road, new_road=new_water_road) + assert idea_x._acptfactunits.get(new_water_road) is None + idea_x.find_replace_road(old_road=old_water_road, new_road=new_water_road) # THEN - assert tool_x._acptfactunits.get(old_water_road) is None - assert tool_x._acptfactunits.get(new_water_road) != None - new_water_rain_acptfactunit = tool_x._acptfactunits[new_water_road] + assert idea_x._acptfactunits.get(old_water_road) is None + assert idea_x._acptfactunits.get(new_water_road) != None + new_water_rain_acptfactunit = idea_x._acptfactunits[new_water_road] assert new_water_rain_acptfactunit.base == new_water_road new_rain_road = f"{src},{new_water_text},{rain_text}" assert new_water_rain_acptfactunit.pick == new_rain_road - print(f"{len(tool_x._acptfactunits)=}") - acptfactunit_obj = tool_x._acptfactunits.get(new_water_road) + print(f"{len(idea_x._acptfactunits)=}") + acptfactunit_obj = idea_x._acptfactunits.get(new_water_road) assert acptfactunit_obj != None assert acptfactunit_obj.base == new_water_road assert acptfactunit_obj.pick == new_rain_road -def test_tool_get_key_road_returnsCorrectInfo(): +def test_idea_get_key_road_returnsCorrectInfo(): red_text = "red" - tool_red = ToolCore(_desc=red_text) - assert tool_red.get_key_road() == red_text + idea_red = IdeaCore(_desc=red_text) + assert idea_red.get_key_road() == red_text diff --git a/src/agent/test__idea/test_idea_root.py b/src/agent/test__idea/test_idea_root.py new file mode 100644 index 000000000..56791b993 --- /dev/null +++ b/src/agent/test__idea/test_idea_root.py @@ -0,0 +1,7 @@ +from src.agent.idea import IdeaRoot + + +def test_idea_core_exists(): + new_obj = IdeaRoot() + assert new_obj + assert new_obj._kids is None diff --git a/src/agent/test__tool/test_tool_kid.py b/src/agent/test__tool/test_tool_kid.py deleted file mode 100644 index ba8d5845e..000000000 --- a/src/agent/test__tool/test_tool_kid.py +++ /dev/null @@ -1,6 +0,0 @@ -from src.agent.tool import ToolKid - - -def test_tool_kid_exists(): - new_obj = ToolKid() - assert new_obj diff --git a/src/agent/test__tool/test_tool_root.py b/src/agent/test__tool/test_tool_root.py deleted file mode 100644 index 357fc35d7..000000000 --- a/src/agent/test__tool/test_tool_root.py +++ /dev/null @@ -1,7 +0,0 @@ -from src.agent.tool import ToolRoot - - -def test_tool_core_exists(): - new_obj = ToolRoot() - assert new_obj - assert new_obj._kids is None diff --git a/src/agent/test_agent/test_agent_.py b/src/agent/test_agent/test_agent_.py index d07aa3da3..018663357 100644 --- a/src/agent/test_agent/test_agent_.py +++ b/src/agent/test_agent/test_agent_.py @@ -12,47 +12,47 @@ def test_agent_exists(): assert new_obj._max_tree_traverse == 3 assert new_obj._tree_traverse_count is None assert new_obj._rational == False - assert str(type(new_obj._toolroot)).find(".tool.ToolRoot'>") + assert str(type(new_obj._idearoot)).find(".idea.IdeaRoot'>") def test_agent_IsAbleToSetTaskAsComplete(): agent_x = get_agent_1Task_1CE0MinutesRequired_1AcptFact() assert agent_x != None - assert len(agent_x._toolroot._kids["obtain mail"]._requiredunits) == 1 - tool_list = agent_x.get_tool_list() - # for tool in tool_list: - # print(tool._desc) - mail_tool = tool_list[1] - assert mail_tool.promise == True - assert mail_tool._task == True + assert len(agent_x._idearoot._kids["obtain mail"]._requiredunits) == 1 + idea_list = agent_x.get_idea_list() + # for idea in idea_list: + # print(idea._desc) + mail_idea = idea_list[1] + assert mail_idea.promise == True + assert mail_idea._task == True ced_min_desc = "CE0_minutes" ced_road = f"test45,{ced_min_desc}" agent_x.set_acptfact(base=ced_road, pick=ced_road, open=82, nigh=85) - tool_list = agent_x.get_tool_list() - assert mail_tool.promise == True - assert mail_tool._task == False + idea_list = agent_x.get_idea_list() + assert mail_idea.promise == True + assert mail_idea._task == False -def test_agent_IsAbleToEditAcptFactUnitAnyAncestor_Tool_1(): +def test_agent_IsAbleToEditAcptFactUnitAnyAncestor_Idea_1(): agent_x = get_agent_1Task_1CE0MinutesRequired_1AcptFact() ced_min_desc = "CE0_minutes" ced_road = f"test45,{ced_min_desc}" agent_x.set_acptfact(base=ced_road, pick=ced_road, open=82, nigh=85) - tool_list = agent_x.get_tool_list() - mail_tool = tool_list[1] - assert mail_tool.promise == True - assert mail_tool._task == False + idea_list = agent_x.get_idea_list() + mail_idea = idea_list[1] + assert mail_idea.promise == True + assert mail_idea._task == False agent_x.set_acptfact(base=ced_road, pick=ced_road, open=82, nigh=95) - tool_list = agent_x.get_tool_list() - mail_tool = tool_list[1] - assert mail_tool.promise == True - assert mail_tool._task == True + idea_list = agent_x.get_idea_list() + mail_idea = idea_list[1] + assert mail_idea.promise == True + assert mail_idea._task == True -def test_agent_tooloot_uid_isAlwaysEqualTo1(): +def test_agent_ideaoot_uid_isAlwaysEqualTo1(): # GIVEN src_text = "testing_lw" src_road = src_text @@ -61,7 +61,7 @@ def test_agent_tooloot_uid_isAlwaysEqualTo1(): sx = AgentUnit(_desc=src_text) # THEN - assert sx._toolroot._uid == 1 + assert sx._idearoot._uid == 1 def test_agent_set_max_tree_traverse_CorrectlySetsInt(): diff --git a/src/agent/test_agent/test_agent_acptfacts.py b/src/agent/test_agent/test_agent_acptfacts.py index f04a855e1..8a483bde2 100644 --- a/src/agent/test_agent/test_agent_acptfacts.py +++ b/src/agent/test_agent/test_agent_acptfacts.py @@ -1,5 +1,5 @@ from src.agent.required import acptfactunit_shop, acptfactunit_shop, acptfactheir_shop -from src.agent.tool import ToolKid, Road +from src.agent.idea import IdeaKid, Road from src.agent.examples.example_agents import ( get_agent_with_4_levels as examples_get_agent_with_4_levels, ) @@ -13,28 +13,28 @@ def test_agent_acptfact_exists(): weekday_road = Road(f"{agent_x._desc},weekdays") sunday_lw_acptfact = acptfactunit_shop(base=weekday_road, pick=sunday_road) print(sunday_lw_acptfact) - agent_x._toolroot._acptfactunits = {sunday_lw_acptfact.base: sunday_lw_acptfact} - assert agent_x._toolroot._acptfactunits != None - agent_x._toolroot._acptfactunits = None - assert agent_x._toolroot._acptfactunits is None + agent_x._idearoot._acptfactunits = {sunday_lw_acptfact.base: sunday_lw_acptfact} + assert agent_x._idearoot._acptfactunits != None + agent_x._idearoot._acptfactunits = None + assert agent_x._idearoot._acptfactunits is None agent_x.set_acptfact(base=weekday_road, pick=sunday_road) - assert agent_x._toolroot._acptfactunits == { + assert agent_x._idearoot._acptfactunits == { sunday_lw_acptfact.base: sunday_lw_acptfact } - agent_x._toolroot._acptfactunits = None - assert agent_x._toolroot._acptfactunits is None + agent_x._idearoot._acptfactunits = None + assert agent_x._idearoot._acptfactunits is None usa_week_road = Road(f"{agent_x._desc},nation-state") usa_week_unit = acptfactunit_shop( base=usa_week_road, pick=usa_week_road, open=608, nigh=610 ) - agent_x._toolroot._acptfactunits = {usa_week_unit.base: usa_week_unit} + agent_x._idearoot._acptfactunits = {usa_week_unit.base: usa_week_unit} - agent_x._toolroot._acptfactunits = None - assert agent_x._toolroot._acptfactunits is None + agent_x._idearoot._acptfactunits = None + assert agent_x._idearoot._acptfactunits is None agent_x.set_acptfact(base=usa_week_road, pick=usa_week_road, open=608, nigh=610) - assert agent_x._toolroot._acptfactunits != None - assert agent_x._toolroot._acptfactunits == {usa_week_unit.base: usa_week_unit} + assert agent_x._idearoot._acptfactunits != None + assert agent_x._idearoot._acptfactunits == {usa_week_unit.base: usa_week_unit} def test_agent_acptfact_create(): @@ -43,25 +43,25 @@ def test_agent_acptfact_create(): weekday_road = Road(f"{agent_x._desc},weekdays") agent_x.set_acptfact(base=weekday_road, pick=sunday_road) sunday_lw_acptfact = acptfactunit_shop(base=weekday_road, pick=sunday_road) - assert agent_x._toolroot._acptfactunits == { + assert agent_x._idearoot._acptfactunits == { sunday_lw_acptfact.base: sunday_lw_acptfact } -def test_set_acptfact_FailsToCreateWhenBaseAndAcptFactAreDifferenctAndAcptFactToolIsNotRangeRoot(): +def test_set_acptfact_FailsToCreateWhenBaseAndAcptFactAreDifferenctAndAcptFactIdeaIsNotRangeRoot(): # Given src_text = "src" lw_x = AgentUnit(_desc=src_text) time_x = "time_x" - lw_x.add_tool(tool_kid=ToolKid(_desc=time_x, _begin=0, _close=140), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=time_x, _begin=0, _close=140), walk=src_text) t_x_road = Road(f"{src_text},{time_x}") age1st = "age1st" - lw_x.add_tool(tool_kid=ToolKid(_desc=age1st, _begin=0, _close=20), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age1st, _begin=0, _close=20), walk=t_x_road) a1_road = Road(f"{t_x_road},{age1st}") a1e1st = "a1_era1st" - lw_x.add_tool(tool_kid=ToolKid(_desc=a1e1st, _begin=20, _close=30), walk=a1_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=a1e1st, _begin=20, _close=30), walk=a1_road) a1e1_road = Road(f"{a1_road},{a1e1st}") - assert lw_x._toolroot._acptfactunits in (None, {}) + assert lw_x._idearoot._acptfactunits in (None, {}) # When/Then with pytest_raises(Exception) as excinfo: @@ -79,7 +79,7 @@ def test_agent_acptfact_create(): weekday_road = Road(f"{agent_x._desc},weekdays") agent_x.set_acptfact(base=weekday_road, pick=sunday_road) sunday_lw_acptfact = acptfactunit_shop(base=weekday_road, pick=sunday_road) - assert agent_x._toolroot._acptfactunits == { + assert agent_x._idearoot._acptfactunits == { sunday_lw_acptfact.base: sunday_lw_acptfact } @@ -87,34 +87,34 @@ def test_agent_acptfact_create(): agent_x.del_acptfact(base=weekday_road) # Then - assert agent_x._toolroot._acptfactunits == {} + assert agent_x._idearoot._acptfactunits == {} -def test_agent_get_tool_list_AcptFactHeirsCorrectlyInherited(): +def test_agent_get_idea_list_AcptFactHeirsCorrectlyInherited(): # GIVEN src_text = "src" agent_x = AgentUnit(_desc=src_text) swim_text = "swim" swim_road = Road(f"{src_text},{swim_text}") - agent_x.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=src_text) + agent_x.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=src_text) fast_text = "fast" slow_text = "slow" fast_road = Road(f"{swim_road},{fast_text}") slow_road = Road(f"{swim_road},{slow_text}") - agent_x.add_tool(tool_kid=ToolKid(_desc=fast_text), walk=swim_road) - agent_x.add_tool(tool_kid=ToolKid(_desc=slow_text), walk=swim_road) + agent_x.add_idea(idea_kid=IdeaKid(_desc=fast_text), walk=swim_road) + agent_x.add_idea(idea_kid=IdeaKid(_desc=slow_text), walk=swim_road) earth_text = "earth" earth_road = Road(f"{src_text},{earth_text}") - agent_x.add_tool(tool_kid=ToolKid(_desc=earth_text), walk=src_text) + agent_x.add_idea(idea_kid=IdeaKid(_desc=earth_text), walk=src_text) - swim_tool = agent_x.get_tool_kid(road=swim_road) - fast_tool = agent_x.get_tool_kid(road=fast_road) - slow_tool = agent_x.get_tool_kid(road=slow_road) + swim_idea = agent_x.get_idea_kid(road=swim_road) + fast_idea = agent_x.get_idea_kid(road=fast_road) + slow_idea = agent_x.get_idea_kid(road=slow_road) - assert swim_tool._acptfactheirs is None - assert fast_tool._acptfactheirs is None - assert slow_tool._acptfactheirs is None + assert swim_idea._acptfactheirs is None + assert fast_idea._acptfactheirs is None + assert slow_idea._acptfactheirs is None # WHEN agent_x.set_acptfact(base=earth_road, pick=earth_road, open=1.0, nigh=5.0) @@ -124,48 +124,48 @@ def test_agent_get_tool_list_AcptFactHeirsCorrectlyInherited(): acptfacts_none_range = {acptfact_none_range.base: acptfact_none_range} # THEN - assert swim_tool._acptfactheirs != None - assert fast_tool._acptfactheirs != None - assert slow_tool._acptfactheirs != None - assert swim_tool._acptfactheirs == acptfactheirs_set_range - assert fast_tool._acptfactheirs == acptfactheirs_set_range - assert slow_tool._acptfactheirs == acptfactheirs_set_range - print(f"{swim_tool._acptfactheirs=}") - assert len(swim_tool._acptfactheirs) == 1 + assert swim_idea._acptfactheirs != None + assert fast_idea._acptfactheirs != None + assert slow_idea._acptfactheirs != None + assert swim_idea._acptfactheirs == acptfactheirs_set_range + assert fast_idea._acptfactheirs == acptfactheirs_set_range + assert slow_idea._acptfactheirs == acptfactheirs_set_range + print(f"{swim_idea._acptfactheirs=}") + assert len(swim_idea._acptfactheirs) == 1 # WHEN - swim_tool._acptfactheirs.get(earth_road).set_range_null() + swim_idea._acptfactheirs.get(earth_road).set_range_null() # THEN - assert swim_tool._acptfactheirs == acptfacts_none_range - assert fast_tool._acptfactheirs == acptfactheirs_set_range - assert slow_tool._acptfactheirs == acptfactheirs_set_range + assert swim_idea._acptfactheirs == acptfacts_none_range + assert fast_idea._acptfactheirs == acptfactheirs_set_range + assert slow_idea._acptfactheirs == acptfactheirs_set_range - acptfact_x1 = swim_tool._acptfactheirs.get(earth_road) + acptfact_x1 = swim_idea._acptfactheirs.get(earth_road) acptfact_x1.set_range_null() print(type(acptfact_x1)) assert str(type(acptfact_x1)).find(".required.AcptFactHeir'>") -def test_agent_get_tool_list_AcptFactUnitCorrectlyTransformsacptfactheir_shop(): +def test_agent_get_idea_list_AcptFactUnitCorrectlyTransformsacptfactheir_shop(): # GIVEN src_text = "src" agent_x = AgentUnit(_desc=src_text) swim_text = "swim" swim_road = f"{src_text},{swim_text}" - agent_x.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=src_text) - swim_tool = agent_x.get_tool_kid(road=swim_road) + agent_x.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=src_text) + swim_idea = agent_x.get_idea_kid(road=swim_road) fast_text = "fast" slow_text = "slow" - agent_x.add_tool(tool_kid=ToolKid(_desc=fast_text), walk=swim_road) - agent_x.add_tool(tool_kid=ToolKid(_desc=slow_text), walk=swim_road) + agent_x.add_idea(idea_kid=IdeaKid(_desc=fast_text), walk=swim_road) + agent_x.add_idea(idea_kid=IdeaKid(_desc=slow_text), walk=swim_road) earth_text = "earth" earth_road = Road(f"{src_text},{earth_text}") - agent_x.add_tool(tool_kid=ToolKid(_desc=earth_text), walk=src_text) + agent_x.add_idea(idea_kid=IdeaKid(_desc=earth_text), walk=src_text) - assert swim_tool._acptfactheirs is None + assert swim_idea._acptfactheirs is None # WHEN agent_x.set_acptfact(base=earth_road, pick=earth_road, open=1.0, nigh=5.0) @@ -175,7 +175,7 @@ def test_agent_get_tool_list_AcptFactUnitCorrectlyTransformsacptfactheir_shop(): base=earth_road, pick=earth_road, open=1.0, nigh=5.0 ) first_earthdict = {first_earthheir.base: first_earthheir} - assert swim_tool._acptfactheirs == first_earthdict + assert swim_idea._acptfactheirs == first_earthdict # WHEN # earth_curb = acptfactunit_shop(base=earth_road, pick=earth_road, open=3.0, nigh=4.0) @@ -187,47 +187,47 @@ def test_agent_get_tool_list_AcptFactUnitCorrectlyTransformsacptfactheir_shop(): base=earth_road, pick=earth_road, open=3.0, nigh=5.0 ) after_earthdict = {after_earthheir.base: after_earthheir} - assert swim_tool._acptfactheirs == after_earthdict + assert swim_idea._acptfactheirs == after_earthdict -def test_agent_get_tool_list_AcptFactHeirCorrectlyDeletesAcptFactUnit(): +def test_agent_get_idea_list_AcptFactHeirCorrectlyDeletesAcptFactUnit(): # GIVEN src_text = "src" agent_x = AgentUnit(_desc=src_text) swim_text = "swim" swim_road = Road(f"{src_text},{swim_text}") - agent_x.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=src_text) + agent_x.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=src_text) fast_text = "fast" slow_text = "slow" fast_road = Road(f"{swim_road},{fast_text}") slow_road = Road(f"{swim_road},{slow_text}") - agent_x.add_tool(tool_kid=ToolKid(_desc=fast_text), walk=swim_road) - agent_x.add_tool(tool_kid=ToolKid(_desc=slow_text), walk=swim_road) + agent_x.add_idea(idea_kid=IdeaKid(_desc=fast_text), walk=swim_road) + agent_x.add_idea(idea_kid=IdeaKid(_desc=slow_text), walk=swim_road) earth_text = "earth" earth_road = Road(f"{src_text},{earth_text}") - agent_x.add_tool(tool_kid=ToolKid(_desc=earth_text), walk=src_text) + agent_x.add_idea(idea_kid=IdeaKid(_desc=earth_text), walk=src_text) - swim_tool = agent_x.get_tool_kid(road=swim_road) + swim_idea = agent_x.get_idea_kid(road=swim_road) first_earthheir = acptfactheir_shop( base=earth_road, pick=earth_road, open=200.0, nigh=500.0 ) first_earthdict = {first_earthheir.base: first_earthheir} - assert swim_tool._acptfactheirs is None + assert swim_idea._acptfactheirs is None # WHEN agent_x.set_acptfact(base=earth_road, pick=earth_road, open=200.0, nigh=500.0) # THEN - assert swim_tool._acptfactheirs == first_earthdict + assert swim_idea._acptfactheirs == first_earthdict earth_curb = acptfactunit_shop(base=earth_road, pick=earth_road, open=3.0, nigh=4.0) - swim_tool.set_acptfactunit(acptfactunit=earth_curb) + swim_idea.set_acptfactunit(acptfactunit=earth_curb) agent_x.set_agent_metrics() - assert swim_tool._acptfactheirs == first_earthdict - assert swim_tool._acptfactunits == {} + assert swim_idea._acptfactheirs == first_earthdict + assert swim_idea._acptfactunits == {} def test_get_ranged_acptfacts(): @@ -235,39 +235,39 @@ def test_get_ranged_acptfacts(): src_text = "src" lw_x = AgentUnit(_desc=src_text) time_x = "time_x" - lw_x.add_tool(tool_kid=ToolKid(_desc=time_x, _begin=0, _close=140), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=time_x, _begin=0, _close=140), walk=src_text) clean = "clean" - lw_x.add_tool(tool_kid=ToolKid(_desc=clean, promise=True), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=clean, promise=True), walk=src_text) c_road = f"{src_text},{clean}" t_x_road = f"{src_text},{time_x}" - # lw_x.edit_tool_attr(road=c_road, required_base=t_x_road, required_sufffact=t_x_road, required_sufffact_open=5, required_sufffact_nigh=10) + # lw_x.edit_idea_attr(road=c_road, required_base=t_x_road, required_sufffact=t_x_road, required_sufffact_open=5, required_sufffact_nigh=10) lw_x.set_acptfact(base=t_x_road, pick=t_x_road, open=5, nigh=10) - print(f"Given a single ranged acptfact {lw_x._toolroot._acptfactunits=}") - assert len(lw_x._toolroot._acptfactunits) == 1 + print(f"Given a single ranged acptfact {lw_x._idearoot._acptfactunits=}") + assert len(lw_x._idearoot._acptfactunits) == 1 # When/Then assert len(lw_x._get_rangeroot_acptfactunits()) == 1 # When one ranged acptfact added place = "place_x" - lw_x.add_tool(tool_kid=ToolKid(_desc=place, _begin=600, _close=800), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=place, _begin=600, _close=800), walk=src_text) p_road = f"{src_text},{place}" lw_x.set_acptfact(base=p_road, pick=p_road, open=5, nigh=10) - print(f"When one ranged acptfact added {lw_x._toolroot._acptfactunits=}") - assert len(lw_x._toolroot._acptfactunits) == 2 + print(f"When one ranged acptfact added {lw_x._idearoot._acptfactunits=}") + assert len(lw_x._idearoot._acptfactunits) == 2 # Then assert len(lw_x._get_rangeroot_acptfactunits()) == 2 # When one non-ranged_acptfact added mood = "mood_x" - lw_x.add_tool(tool_kid=ToolKid(_desc=mood), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=mood), walk=src_text) m_road = f"{src_text},{mood}" lw_x.set_acptfact(base=m_road, pick=m_road) - print(f"When one non-ranged_acptfact added {lw_x._toolroot._acptfactunits=}") - assert len(lw_x._toolroot._acptfactunits) == 3 + print(f"When one non-ranged_acptfact added {lw_x._idearoot._acptfactunits=}") + assert len(lw_x._idearoot._acptfactunits) == 3 # Then assert len(lw_x._get_rangeroot_acptfactunits()) == 2 @@ -278,32 +278,32 @@ def test_get_roots_ranged_acptfacts(): src_text = "src" lw_x = AgentUnit(_desc=src_text) time_x = "time_x" - lw_x.add_tool(tool_kid=ToolKid(_desc=time_x, _begin=0, _close=140), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=time_x, _begin=0, _close=140), walk=src_text) t_x_road = f"{src_text},{time_x}" mood_x = "mood_x" - lw_x.add_tool(tool_kid=ToolKid(_desc=mood_x), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=mood_x), walk=src_text) m_x_road = f"{src_text},{mood_x}" happy = "happy" sad = "Sad" - lw_x.add_tool(tool_kid=ToolKid(_desc=happy), walk=m_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=sad), walk=m_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=happy), walk=m_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=sad), walk=m_x_road) lw_x.set_acptfact(base=t_x_road, pick=t_x_road, open=5, nigh=10) lw_x.set_acptfact(base=m_x_road, pick=f"{m_x_road},{happy}") print( - f"Given a root ranged acptfact and non-range acptfact:\n{lw_x._toolroot._acptfactunits=}" + f"Given a root ranged acptfact and non-range acptfact:\n{lw_x._idearoot._acptfactunits=}" ) - assert len(lw_x._toolroot._acptfactunits) == 2 + assert len(lw_x._idearoot._acptfactunits) == 2 # When/Then assert len(lw_x._get_rangeroot_acptfactunits()) == 1 assert lw_x._get_rangeroot_acptfactunits()[0].base == t_x_road - # a acptfact who's tool range is defined by numeric_root is not "rangeroot" + # a acptfact who's idea range is defined by numeric_root is not "rangeroot" mirrow_x = "mirrow_x" - lw_x.add_tool(tool_kid=ToolKid(_desc=mirrow_x, _numeric_road=time_x), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=mirrow_x, _numeric_road=time_x), walk=src_text) m_x_road = f"{src_text},{mirrow_x}" lw_x.set_acptfact(base=m_x_road, pick=t_x_road, open=5, nigh=10) - assert len(lw_x._toolroot._acptfactunits) == 3 + assert len(lw_x._idearoot._acptfactunits) == 3 # When/Then assert len(lw_x._get_rangeroot_acptfactunits()) == 1 @@ -315,10 +315,10 @@ def test_create_lemma_acptfacts_CorrectlyCreates1stLevelLemmaAcptFact_Scenario1( lw_x = AgentUnit(_desc=src_text) # # the action # clean = "clean" - # lw_x.add_tool(tool_kid=ToolKid(_desc=clean, promise=True), walk=src_text) + # lw_x.add_idea(idea_kid=IdeaKid(_desc=clean, promise=True), walk=src_text) time_x = "time_x" - lw_x.add_tool(tool_kid=ToolKid(_desc=time_x, _begin=0, _close=140), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=time_x, _begin=0, _close=140), walk=src_text) t_x_road = f"{src_text},{time_x}" age1st = "age1st" age2nd = "age2nd" @@ -327,13 +327,13 @@ def test_create_lemma_acptfacts_CorrectlyCreates1stLevelLemmaAcptFact_Scenario1( age5th = "age5th" age6th = "age6th" age7th = "age7th" - lw_x.add_tool(tool_kid=ToolKid(_desc=age1st, _begin=0, _close=20), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age2nd, _begin=20, _close=40), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age3rd, _begin=40, _close=60), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age4th, _begin=60, _close=80), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age5th, _begin=80, _close=100), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age6th, _begin=100, _close=120), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age7th, _begin=120, _close=140), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age1st, _begin=0, _close=20), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age2nd, _begin=20, _close=40), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age3rd, _begin=40, _close=60), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age4th, _begin=60, _close=80), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age5th, _begin=80, _close=100), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age6th, _begin=100, _close=120), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age7th, _begin=120, _close=140), walk=t_x_road) # set for instant moment in 3rd age lw_x.set_acptfact(base=time_x, pick=time_x, open=45, nigh=45) @@ -376,10 +376,10 @@ def test_create_lemma_acptfacts_CorrectlyCreates1stLevelLemmaAcptFact_Scenario2( lw_x = AgentUnit(_desc=src_text) # # the action # clean = "clean" - # lw_x.add_tool(tool_kid=ToolKid(_desc=clean, promise=True), walk=src_text) + # lw_x.add_idea(idea_kid=IdeaKid(_desc=clean, promise=True), walk=src_text) time_x = "time_x" - lw_x.add_tool(tool_kid=ToolKid(_desc=time_x, _begin=0, _close=140), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=time_x, _begin=0, _close=140), walk=src_text) t_x_road = f"{src_text},{time_x}" age1st = "age1st" age2nd = "age2nd" @@ -388,13 +388,13 @@ def test_create_lemma_acptfacts_CorrectlyCreates1stLevelLemmaAcptFact_Scenario2( age5th = "age5th" age6th = "age6th" age7th = "age7th" - lw_x.add_tool(tool_kid=ToolKid(_desc=age1st, _begin=0, _close=20), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age2nd, _begin=20, _close=40), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age3rd, _begin=40, _close=60), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age4th, _begin=60, _close=80), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age5th, _begin=80, _close=100), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age6th, _begin=100, _close=120), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age7th, _begin=120, _close=140), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age1st, _begin=0, _close=20), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age2nd, _begin=20, _close=40), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age3rd, _begin=40, _close=60), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age4th, _begin=60, _close=80), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age5th, _begin=80, _close=100), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age6th, _begin=100, _close=120), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age7th, _begin=120, _close=140), walk=t_x_road) # set for instant moment in 3rd age lw_x.set_acptfact(base=time_x, pick=time_x, open=35, nigh=65) @@ -435,10 +435,10 @@ def test_create_lemma_acptfacts_CorrectlyCreates1stLevelLemmaAcptFact_Scenario3( lw_x = AgentUnit(_desc=src_text) # # the action # clean = "clean" - # lw_x.add_tool(tool_kid=ToolKid(_desc=clean, promise=True), walk=src_text) + # lw_x.add_idea(idea_kid=IdeaKid(_desc=clean, promise=True), walk=src_text) time_x = "time_x" - lw_x.add_tool(tool_kid=ToolKid(_desc=time_x, _begin=0, _close=140), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=time_x, _begin=0, _close=140), walk=src_text) t_x_road = f"{src_text},{time_x}" age1st = "age1st" age2nd = "age2nd" @@ -447,33 +447,33 @@ def test_create_lemma_acptfacts_CorrectlyCreates1stLevelLemmaAcptFact_Scenario3( age5th = "age5th" age6th = "age6th" age7th = "age7th" - lw_x.add_tool(tool_kid=ToolKid(_desc=age1st, _begin=0, _close=20), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age2nd, _begin=20, _close=40), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age3rd, _begin=40, _close=60), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age4th, _begin=60, _close=80), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age5th, _begin=80, _close=100), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age6th, _begin=100, _close=120), walk=t_x_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=age7th, _begin=120, _close=140), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age1st, _begin=0, _close=20), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age2nd, _begin=20, _close=40), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age3rd, _begin=40, _close=60), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age4th, _begin=60, _close=80), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age5th, _begin=80, _close=100), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age6th, _begin=100, _close=120), walk=t_x_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=age7th, _begin=120, _close=140), walk=t_x_road) a2_road = f"{t_x_road},{age2nd}" a2e1st = "a1_era1st" a2e2nd = "a1_era2nd" a2e3rd = "a1_era3rd" a2e4th = "a1_era4th" - lw_x.add_tool(tool_kid=ToolKid(_desc=a2e1st, _begin=20, _close=30), walk=a2_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=a2e2nd, _begin=30, _close=34), walk=a2_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=a2e3rd, _begin=34, _close=38), walk=a2_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=a2e4th, _begin=38, _close=40), walk=a2_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=a2e1st, _begin=20, _close=30), walk=a2_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=a2e2nd, _begin=30, _close=34), walk=a2_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=a2e3rd, _begin=34, _close=38), walk=a2_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=a2e4th, _begin=38, _close=40), walk=a2_road) a3_road = f"{t_x_road},{age3rd}" a3e1st = "a3_era1st" a3e2nd = "a3_era2nd" a3e3rd = "a3_era3rd" a3e4th = "a3_era4th" - lw_x.add_tool(tool_kid=ToolKid(_desc=a3e1st, _begin=40, _close=45), walk=a3_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=a3e2nd, _begin=45, _close=50), walk=a3_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=a3e3rd, _begin=55, _close=58), walk=a3_road) - lw_x.add_tool(tool_kid=ToolKid(_desc=a3e4th, _begin=58, _close=60), walk=a3_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=a3e1st, _begin=40, _close=45), walk=a3_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=a3e2nd, _begin=45, _close=50), walk=a3_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=a3e3rd, _begin=55, _close=58), walk=a3_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc=a3e4th, _begin=58, _close=60), walk=a3_road) # set for instant moment in 3rd age lw_x.set_acptfact(base=time_x, pick=time_x, open=35, nigh=55) @@ -519,22 +519,22 @@ def test_create_lemma_acptfacts_CorrectlyCreates1stLevelLemmaAcptFact_Scenario4( time_x = "time_x" arsub1 = "arbitary_subsection1" as1_road = f"{src_text},{arsub1}" - lw_x.add_tool(tool_kid=ToolKid(_desc=arsub1, _begin=0, _close=140), walk=src_text) - # range-root tool has special_road - lw_x.add_tool( - tool_kid=ToolKid(_desc=time_x, _begin=0, _close=140, _special_road=as1_road), + lw_x.add_idea(idea_kid=IdeaKid(_desc=arsub1, _begin=0, _close=140), walk=src_text) + # range-root idea has special_road + lw_x.add_idea( + idea_kid=IdeaKid(_desc=time_x, _begin=0, _close=140, _special_road=as1_road), walk=src_text, ) arsub2 = "arbitary_subsection2" as2_road = f"{src_text},{arsub2}" - lw_x.add_tool(tool_kid=ToolKid(_desc=arsub2, _begin=0, _close=20), walk=src_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=arsub2, _begin=0, _close=20), walk=src_text) - # non-range-root child tool has special_road + # non-range-root child idea has special_road t_x_road = f"{src_text},{time_x}" age1st = "age1st" - lw_x.add_tool( - tool_kid=ToolKid(_desc=age1st, _begin=0, _close=20, _special_road=as2_road), + lw_x.add_idea( + idea_kid=IdeaKid(_desc=age1st, _begin=0, _close=20, _special_road=as2_road), walk=t_x_road, ) @@ -559,7 +559,7 @@ def test_create_lemma_acptfacts_CorrectlyCreates1stLevelLemmaAcptFact_Scenario4( def test_create_lemma_acptfacts_CorrectlyCreatesNthLevelLemmaAcptFact_Scenario4_1(): src_text = "src" lw_x = AgentUnit(_desc=src_text) - lw_x.set_time_hreg_tools(c400_count=7) + lw_x.set_time_hreg_ideas(c400_count=7) jajatime_road = "src,time,jajatime" lw_x.set_acptfact(base=jajatime_road, pick=jajatime_road, open=1500, nigh=1500) lhu = lw_x._get_lemma_acptfactunits() @@ -585,7 +585,7 @@ def test_create_lemma_acptfacts_CorrectlyCreatesNthLevelLemmaAcptFact_Scenario4_ def test_create_lemma_acptfacts_CorrectlyCreatesNthLevelLemmaAcptFact_Scenario5(): src_text = "src" lw_x = AgentUnit(_desc=src_text) - lw_x.set_time_hreg_tools(c400_count=7) + lw_x.set_time_hreg_ideas(c400_count=7) jajatime_road = "src,time,jajatime" lw_x.set_acptfact( base=jajatime_road, pick=jajatime_road, open=1500, nigh=1063954002 @@ -611,7 +611,7 @@ def test_create_lemma_acptfacts_CorrectlyCreatesNthLevelLemmaAcptFact_Scenario5( def test_create_lemma_acptfacts_CorrectlyCreatesNthLevelLemmaAcptFact_Scenario6(): src_text = "src" lw_x = AgentUnit(_desc=src_text) - lw_x.set_time_hreg_tools(c400_count=7) + lw_x.set_time_hreg_ideas(c400_count=7) jajatime_road = "src,time,jajatime" lw_x.set_acptfact( base=jajatime_road, pick=jajatime_road, open=1063954000, nigh=1063954002 @@ -634,7 +634,7 @@ def test_create_lemma_acptfacts_CorrectlyCreatesNthLevelLemmaAcptFact_Scenario7( # Given src_text = "src" lw_x = AgentUnit(_desc=src_text) - lw_x.set_time_hreg_tools(c400_count=7) + lw_x.set_time_hreg_ideas(c400_count=7) jajatime_road = "src,time,jajatime" # When given a minute range that should be Thursday to Monday midnight @@ -677,7 +677,7 @@ def test_create_lemma_acptfacts_CorrectlyCreatesNthLevelLemmaAcptFact_Scenario8( # Given src_text = "src" lw_x = AgentUnit(_desc=src_text) - lw_x.set_time_hreg_tools(c400_count=7) + lw_x.set_time_hreg_ideas(c400_count=7) jajatime_road = "src,time,jajatime" # When given a minute range that should be Thursday to Monday midnight @@ -716,55 +716,55 @@ def test_create_lemma_acptfacts_CorrectlyCreatesNthLevelLemmaAcptFact_Scenario8( # assert lhu["src,time,tech,week,Wednesday"].active == False -def test_agent_set_acptfact_create_missing_tools_CreatesBaseAndAcptFact(): +def test_agent_set_acptfact_create_missing_ideas_CreatesBaseAndAcptFact(): # GIVEN src_text = "src" sx = AgentUnit(_desc=src_text) - sx._toolroot.set_kids_empty_if_null() + sx._idearoot.set_kids_empty_if_null() prob_text = "problems" prob_road = Road(f"{src_text},{prob_text}") climate_text = "climate" climate_road = Road(f"{src_text},{prob_text},{climate_text}") - assert sx._toolroot._kids.get(prob_text) is None + assert sx._idearoot._kids.get(prob_text) is None # WHEN - sx.set_acptfact(base=prob_road, pick=climate_road, create_missing_tools=True) + sx.set_acptfact(base=prob_road, pick=climate_road, create_missing_ideas=True) # THEN - assert sx._toolroot._kids.get(prob_text) != None - assert sx.get_tool_kid(road=prob_road) != None - assert sx.get_tool_kid(road=climate_road) != None + assert sx._idearoot._kids.get(prob_text) != None + assert sx.get_idea_kid(road=prob_road) != None + assert sx.get_idea_kid(road=climate_road) != None def test_agent_get_acptfactunits_base_and_acptfact_list_CorrectlyReturnsListOfAcptFactUnits(): # GIVEN src_text = "src" sx = AgentUnit(_desc=src_text) - sx._toolroot.set_kids_empty_if_null() + sx._idearoot.set_kids_empty_if_null() prob_text = "problems" prob_road = Road(f"{src_text},{prob_text}") climate_text = "climate" climate_road = Road(f"{src_text},{prob_text},{climate_text}") - sx.set_acptfact(base=prob_road, pick=climate_road, create_missing_tools=True) + sx.set_acptfact(base=prob_road, pick=climate_road, create_missing_ideas=True) weather_text = "weather" weather_road = Road(f"{src_text},{weather_text}") windy_text = "windy" windy_road = Road(f"{src_text},{weather_text},{windy_text}") - sx.set_acptfact(base=weather_road, pick=windy_road, create_missing_tools=True) + sx.set_acptfact(base=weather_road, pick=windy_road, create_missing_ideas=True) hot_text = "hot" hot_road = Road(f"{src_text},{weather_text},{hot_text}") - sx.set_acptfact(base=weather_road, pick=hot_road, create_missing_tools=True) + sx.set_acptfact(base=weather_road, pick=hot_road, create_missing_ideas=True) cold_text = "cold" cold_road = Road(f"{src_text},{weather_text},{cold_text}") - sx.set_acptfact(base=weather_road, pick=cold_road, create_missing_tools=True) + sx.set_acptfact(base=weather_road, pick=cold_road, create_missing_ideas=True) games_text = "games" games_road = Road(f"{src_text},{games_text}") football_text = "football" football_road = Road(f"{src_text},{games_text},{football_text}") - sx.set_acptfact(base=games_road, pick=football_road, create_missing_tools=True) + sx.set_acptfact(base=games_road, pick=football_road, create_missing_ideas=True) # WHEN acptfactunit_list_x = sx.get_acptfactunits_base_and_acptfact_list() diff --git a/src/agent/test_agent/test_agent_agenda.py b/src/agent/test_agent/test_agent_agenda.py index ed61147b1..366eef9ee 100644 --- a/src/agent/test_agent/test_agent_agenda.py +++ b/src/agent/test_agent/test_agent_agenda.py @@ -1,7 +1,7 @@ from datetime import datetime from src.agent.agent import AgentUnit, get_from_json from src.agent.examples.get_agent_examples_dir import get_agent_examples_dir -from src.agent.tool import ToolCore, ToolKid +from src.agent.idea import IdeaCore, IdeaKid from src.agent.road import Road from src.agent.required import RequiredUnit, SuffFactStatusFinder from src.agent.group import groupunit_shop, grouplink_shop @@ -45,8 +45,8 @@ def test_get_agenda_returns_agenda_with_only_required_allowed(): # THEN assert agenda_list # for agenda_item in agenda_list: - # yr_tale(tool=agenda_item) - yr_tale(tool=agenda_list[0]) + # yr_tale(idea=agenda_item) + yr_tale(idea=agenda_list[0]) assert len(agenda_list) == 1 print(f"{agenda_list=}") @@ -99,9 +99,9 @@ def test_get_agenda_with_7amItem(): a1.set_acptfact( base=day24hr_road, pick=day24hr_road, open=day24hr_open, nigh=day24hr_nigh ) - print(a1._toolroot._acptfactunits[day24hr_road]) - print(a1._toolroot._kids[housework_text]._kids[clean_text]._requiredunits) - print(a1._toolroot._kids[housework_text]._kids[clean_text]._active_status) + print(a1._idearoot._acptfactunits[day24hr_road]) + print(a1._idearoot._kids[housework_text]._kids[clean_text]._requiredunits) + print(a1._idearoot._kids[housework_text]._kids[clean_text]._active_status) # WHEN agenda_list = a1.get_agenda_items() @@ -119,15 +119,15 @@ def test_get_agenda_with_7amItem(): def test_get_agenda_does_not_return_promise_items_outside_range(): src = "src" a1 = AgentUnit(_desc=src) - a1.set_time_hreg_tools(c400_count=7) + a1.set_time_hreg_ideas(c400_count=7) c_desc = "clean" - c_tool = ToolKid(_desc=c_desc, promise=True) - a1.add_tool(tool_kid=c_tool, walk=src) + c_idea = IdeaKid(_desc=c_desc, promise=True) + a1.add_idea(idea_kid=c_idea, walk=src) c_road = f"{src},{c_desc}" jajatime = "src,time,jajatime" jajaday = "src,time,jajatime,day" - a1.edit_tool_attr( + a1.edit_idea_attr( road=c_road, required_base=jajatime, required_sufffact=jajaday, @@ -157,10 +157,10 @@ def test_exammple_agenda_exists(): min_text = "TlME,day_minute" a1.set_acptfact(base=min_text, pick=min_text, open=0, nigh=1399) assert a1 - # for tool_kid in a1._toolroot._kids.values(): - # # print(tool_kid._desc) - # assert str(type(tool_kid)) != "" - # assert tool_kid.promise != None + # for idea_kid in a1._idearoot._kids.values(): + # # print(idea_kid._desc) + # assert str(type(idea_kid)) != "" + # assert idea_kid.promise != None # WHEN agenda_list = a1.get_agenda_items() @@ -214,15 +214,15 @@ def test_exammple_AgendaHasCorrectAttributes(): # a1.set_acptfact(base=movie_road, pick=movie_text) # WHEN - tool_action_list = a1.get_agenda_items() + idea_action_list = a1.get_agenda_items() # THEN print("Test might be deprecated if it's not worthy it to fix this test source.") - assert len(tool_action_list) == 27 + assert len(idea_action_list) == 27 a1.set_acptfact(base=month_week_road, pick=f"{month_week_road},1st week") - tool_action_list = a1.get_agenda_items() - assert len(tool_action_list) == 27 + idea_action_list = a1.get_agenda_items() + assert len(idea_action_list) == 27 weekday_text = "weekdays" weekday_road = f"{src_road},{weekday_text}" @@ -230,28 +230,28 @@ def test_exammple_AgendaHasCorrectAttributes(): monday_road = f"{weekday_road},{monday_text}" a1.set_acptfact(base=weekday_road, pick=monday_road) - tool_action_list = a1.get_agenda_items() - assert len(tool_action_list) == 39 + idea_action_list = a1.get_agenda_items() + assert len(idea_action_list) == 39 a1.set_acptfact(base=weekday_road, pick=weekday_road) - tool_action_list = a1.get_agenda_items() - assert len(tool_action_list) == 53 + idea_action_list = a1.get_agenda_items() + assert len(idea_action_list) == 53 # a1.set_acptfact(base=nations_road, pick=nations_road) - # tool_action_list = a1.get_agenda_items() - # assert len(tool_action_list) == 53 + # idea_action_list = a1.get_agenda_items() + # assert len(idea_action_list) == 53 # for base in a1.get_missing_acptfact_bases(): # print(f"{base=}") - # for agenda_item in tool_action_list: + # for agenda_item in idea_action_list: # print(f"{agenda_item._uid=} {agenda_item._walk=}") - # for agenda_item in tool_action_list: + # for agenda_item in idea_action_list: # # print(f"{agenda_item._walk=}") # pass - print(len(tool_action_list)) + print(len(idea_action_list)) def test_exammple_AgendaCanFiltersOnBase(): @@ -270,7 +270,7 @@ def test_exammple_AgendaCanFiltersOnBase(): # if required.base == weekdays: # print(f" {weekdays}") - # a1.edit_tool_attr( + # a1.edit_idea_attr( # road="TlME,sufffacts,cleaning,laundry wednesday", # required_del_sufffact_base=weekdays, # required_del_sufffact_need=weekdays, @@ -296,9 +296,9 @@ def test_set_agenda_task_as_complete_RangeWorksCorrectly(): day_road = f"{time_road},{day_text}" a1 = AgentUnit(_desc=src_text) - a1.add_tool(tool_kid=ToolKid(_desc=run_text, promise=True), walk=src_text) - a1.add_tool(tool_kid=ToolKid(_desc=day_text, _begin=0, _close=500), walk=time_road) - a1.edit_tool_attr( + a1.add_idea(idea_kid=IdeaKid(_desc=run_text, promise=True), walk=src_text) + a1.add_idea(idea_kid=IdeaKid(_desc=day_text, _begin=0, _close=500), walk=time_road) + a1.edit_idea_attr( road=run_road, required_base=day_road, required_sufffact=day_road, @@ -307,12 +307,12 @@ def test_set_agenda_task_as_complete_RangeWorksCorrectly(): ) a1.set_acptfact(base=day_road, pick=day_road, open=30, nigh=87) a1.get_agenda_items() - run_requiredunits = a1._toolroot._kids[run_text]._requiredunits[day_road] + run_requiredunits = a1._idearoot._kids[run_text]._requiredunits[day_road] print(f"{run_requiredunits=}") print(f"{run_requiredunits.sufffacts[day_road]._status=}") print(f"{run_requiredunits.sufffacts[day_road]._task=}") print(f"{a1.get_required_bases()=}") - assert len(a1.get_tool_list()) == 4 + assert len(a1.get_idea_list()) == 4 assert len(a1.get_agenda_items()) == 1 assert a1.get_agenda_items()[0]._task == True @@ -336,9 +336,9 @@ def test_set_agenda_task_as_complete_DivisionWorksCorrectly(): day_road = f"{time_road},{day_text}" a1 = AgentUnit(_desc=src_text) - a1.add_tool(tool_kid=ToolKid(_desc=run_text, promise=True), walk=src_text) - a1.add_tool(tool_kid=ToolKid(_desc=day_text, _begin=0, _close=500), walk=time_road) - a1.edit_tool_attr( + a1.add_idea(idea_kid=IdeaKid(_desc=run_text, promise=True), walk=src_text) + a1.add_idea(idea_kid=IdeaKid(_desc=day_text, _begin=0, _close=500), walk=time_road) + a1.edit_idea_attr( road=run_road, required_base=day_road, required_sufffact=day_road, @@ -347,8 +347,8 @@ def test_set_agenda_task_as_complete_DivisionWorksCorrectly(): required_sufffact_divisor=2, ) - run_tool = a1.get_tool_kid(road=run_road) - # print(f"{run_tool._acptfactheirs=}") + run_idea = a1.get_idea_kid(road=run_road) + # print(f"{run_idea._acptfactheirs=}") a1.set_acptfact(base=day_road, pick=day_road, open=1, nigh=2) assert len(a1.get_agenda_items()) == 1 a1.set_acptfact(base=day_road, pick=day_road, open=2, nigh=2) @@ -357,13 +357,13 @@ def test_set_agenda_task_as_complete_DivisionWorksCorrectly(): assert len(a1.get_agenda_items()) == 0 a1.set_acptfact(base=day_road, pick=day_road, open=401, nigh=402) assert len(a1.get_agenda_items()) == 1 - # print(f"{run_tool._acptfactheirs=}") - print(f"{run_tool._acptfactunits=}") + # print(f"{run_idea._acptfactheirs=}") + print(f"{run_idea._acptfactunits=}") # When a1.set_agenda_task_complete(task_road=run_road, base=day_road) - print(f"{run_tool._acptfactunits=}") - # print(f"{run_tool._acptfactheirs=}") + print(f"{run_idea._acptfactunits=}") + # print(f"{run_idea._acptfactheirs=}") assert len(a1.get_agenda_items()) == 0 @@ -377,25 +377,25 @@ def test_agent_get_from_json_LoadsActionFromJSONCorrectly(): a1 = get_from_json(lw_json=a1_json) # THEN - assert len(a1.get_tool_list()) == 253 - print(f"{len(a1.get_tool_list())=}") - veg_tool = a1._tool_dict.get("TlME,casa,body care,make veggies every morning") - assert not veg_tool._active_status - assert veg_tool.promise + assert len(a1.get_idea_list()) == 253 + print(f"{len(a1.get_idea_list())=}") + veg_idea = a1._idea_dict.get("TlME,casa,body care,make veggies every morning") + assert not veg_idea._active_status + assert veg_idea.promise - # tool_list = a1.get_tool_list() + # idea_list = a1.get_idea_list() # action_true_count = 0 - # for tool in tool_list: - # if str(type(tool)).find(".tool.ToolKid'>") > 0: - # assert tool._active_status in (True, False) - # assert tool.promise in (True, False) - # # if tool._active_status == True: - # # print(tool._desc) - # if tool.promise == True: + # for idea in idea_list: + # if str(type(idea)).find(".idea.IdeaKid'>") > 0: + # assert idea._active_status in (True, False) + # assert idea.promise in (True, False) + # # if idea._active_status == True: + # # print(idea._desc) + # if idea.promise == True: # action_true_count += 1 - # # if tool.promise == False: - # # print(f"action is false {tool._desc}") - # # for required in tool._requiredunits.values(): + # # if idea.promise == False: + # # print(f"action is false {idea._desc}") + # # for required in idea._requiredunits.values(): # # assert required._status in (True, False) # assert action_true_count > 0 @@ -408,10 +408,10 @@ def test_weekdayAgendaItemsCorrectlyReturned(): a1 = AgentUnit(_desc="src") a1._set_acptfacts_empty_if_null() - a1.set_time_hreg_tools(c400_count=7) + a1.set_time_hreg_ideas(c400_count=7) things_text = "things to do" - a1.add_tool(ToolKid(_desc=things_text), walk=a1._desc) + a1.add_idea(IdeaKid(_desc=things_text), walk=a1._desc) t_road = f"{a1._desc},{things_text}" clean = "clean" run = "run" @@ -419,12 +419,12 @@ def test_weekdayAgendaItemsCorrectlyReturned(): jog = "job" veg = "veg" lift = "life" - a1.add_tool(ToolKid(_desc=clean, promise=True), walk=t_road) - a1.add_tool(ToolKid(_desc=run, promise=True), walk=t_road) - a1.add_tool(ToolKid(_desc=swim, promise=True), walk=t_road) - a1.add_tool(ToolKid(_desc=jog, promise=True), walk=t_road) - a1.add_tool(ToolKid(_desc=veg, promise=True), walk=t_road) - a1.add_tool(ToolKid(_desc=lift, promise=True), walk=t_road) + a1.add_idea(IdeaKid(_desc=clean, promise=True), walk=t_road) + a1.add_idea(IdeaKid(_desc=run, promise=True), walk=t_road) + a1.add_idea(IdeaKid(_desc=swim, promise=True), walk=t_road) + a1.add_idea(IdeaKid(_desc=jog, promise=True), walk=t_road) + a1.add_idea(IdeaKid(_desc=veg, promise=True), walk=t_road) + a1.add_idea(IdeaKid(_desc=lift, promise=True), walk=t_road) w_word = f"{a1._desc},time,tech,week" mon_road = f"{w_word},Monday" tue_road = f"{w_word},Tuesday" @@ -441,43 +441,43 @@ def test_weekdayAgendaItemsCorrectlyReturned(): v_road = f"{t_road},{veg}" l_road = f"{t_road},{lift}" - a1.edit_tool_attr( + a1.edit_idea_attr( road=c_road, required_base=tue_road, required_sufffact=tue_road, ) - a1.edit_tool_attr( + a1.edit_idea_attr( road=r_road, required_base=wed_road, required_sufffact=wed_road, ) - a1.edit_tool_attr( + a1.edit_idea_attr( road=s_road, required_base=thu_road, required_sufffact=thu_road, ) - a1.edit_tool_attr( + a1.edit_idea_attr( road=j_road, required_base=fri_road, required_sufffact=fri_road, ) - a1.edit_tool_attr( + a1.edit_idea_attr( road=v_road, required_base=sat_road, required_sufffact=sat_road, ) - a1.edit_tool_attr( + a1.edit_idea_attr( road=l_road, required_base=sun_road, required_sufffact=sun_road, ) - c_tool = a1.get_tool_kid(road=c_road) - c_required = c_tool._requiredunits + c_idea = a1.get_idea_kid(road=c_road) + c_required = c_idea._requiredunits # for required_y in c_required.values(): # for sufffact_y in required_y.sufffacts.values(): # print( - # f"Tool: {c_tool._walk},{c_tool._desc} Required: {required_y.base} open:{sufffact_y.open} nigh:{sufffact_y.nigh} diff:{sufffact_y.nigh-sufffact_y.open}" + # f"Idea: {c_idea._walk},{c_idea._desc} Required: {required_y.base} open:{sufffact_y.open} nigh:{sufffact_y.nigh} diff:{sufffact_y.nigh-sufffact_y.open}" # ) # for base, count_x in a1.get_required_bases().items(): @@ -497,73 +497,73 @@ def test_weekdayAgendaItemsCorrectlyReturned(): fri_min = a1.get_time_min_from_dt(dt=fri_dt) sat_min = a1.get_time_min_from_dt(dt=sat_dt) sun_min = a1.get_time_min_from_dt(dt=sun_dt) - assert a1._toolroot._acptfactunits.get("src,time,jajatime") is None + assert a1._idearoot._acptfactunits.get("src,time,jajatime") is None # When print("\nset acptfact for Sunday") road_minute = f"{a1._desc},time,jajatime" a1.set_acptfact(base=road_minute, pick=road_minute, open=sun_min, nigh=sun_min) - # for acptfact in a1._toolroot._acptfactunits.values(): + # for acptfact in a1._idearoot._acptfactunits.values(): # print(f"{acptfact.base=} (H: {acptfact.acptfact}) {acptfact.active=} {acptfact.open=} {acptfact.nigh=}") # Then tech_root = "src,time,tech" - assert len(a1._toolroot._acptfactunits) == 7 - print(a1._toolroot._acptfactunits["src,time,jajatime"]) - print(a1._toolroot._acptfactunits[f"{tech_root},week,Saturday"]) - print(a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"]) - print(a1._toolroot._acptfactunits[f"{tech_root},week,Tuesday"]) - print(a1._toolroot._acptfactunits[f"{tech_root},week,Wednesday"]) - print(a1._toolroot._acptfactunits[f"{tech_root},week,Thursday"]) - print(a1._toolroot._acptfactunits[f"{tech_root},week,Friday"]) - assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"] - assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"].open == 1440 - assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"].nigh == 1440 - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"].active == True - - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Tuesday"].active == False - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Wednesday"].active == False - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Thursday"].active == False - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Friday"].active == False - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Saturday"].active == False + assert len(a1._idearoot._acptfactunits) == 7 + print(a1._idearoot._acptfactunits["src,time,jajatime"]) + print(a1._idearoot._acptfactunits[f"{tech_root},week,Saturday"]) + print(a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"]) + print(a1._idearoot._acptfactunits[f"{tech_root},week,Tuesday"]) + print(a1._idearoot._acptfactunits[f"{tech_root},week,Wednesday"]) + print(a1._idearoot._acptfactunits[f"{tech_root},week,Thursday"]) + print(a1._idearoot._acptfactunits[f"{tech_root},week,Friday"]) + assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"] + assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"].open == 1440 + assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"].nigh == 1440 + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"].active == True + + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Tuesday"].active == False + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Wednesday"].active == False + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Thursday"].active == False + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Friday"].active == False + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Saturday"].active == False # When print("\nset acptfact for Sat through Monday") a1.set_acptfact(base=road_minute, pick=road_minute, open=sat_min, nigh=mon_min) - # for acptfact in a1._toolroot._acptfactunits.values(): + # for acptfact in a1._idearoot._acptfactunits.values(): # print(f"{acptfact.base=} (H: {acptfact.acptfact}) {acptfact.active=} {acptfact.open=} {acptfact.nigh=}") # Then - assert a1._toolroot._acptfactunits[f"{tech_root},week,Saturday"] - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Saturday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Tuesday"].active == False - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Wednesday"].active == False - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Thursday"].active == False - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Friday"].active == False - - assert a1._toolroot._acptfactunits[f"{tech_root},week,Saturday"].open == 0 - assert a1._toolroot._acptfactunits[f"{tech_root},week,Saturday"].nigh == 1440 - assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"].open == 1440 - assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"].nigh == 2880 + assert a1._idearoot._acptfactunits[f"{tech_root},week,Saturday"] + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Saturday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Tuesday"].active == False + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Wednesday"].active == False + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Thursday"].active == False + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Friday"].active == False + + assert a1._idearoot._acptfactunits[f"{tech_root},week,Saturday"].open == 0 + assert a1._idearoot._acptfactunits[f"{tech_root},week,Saturday"].nigh == 1440 + assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"].open == 1440 + assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"].nigh == 2880 # When print("\nset acptfacts for Sunday through Friday") a1.set_acptfact(base=road_minute, pick=road_minute, open=sun_min, nigh=fri_min) - # for acptfact in a1._toolroot._acptfactunits.values(): + # for acptfact in a1._idearoot._acptfactunits.values(): # print(f"{acptfact.base=} (H: {acptfact.acptfact}) {acptfact.active=} {acptfact.open=} {acptfact.nigh=}") # Then - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Saturday"].active == False - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Tuesday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Wednesday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Thursday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Friday"].active == False + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Saturday"].active == False + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Tuesday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Wednesday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Thursday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Friday"].active == False - assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"].open == 1440 - assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"].nigh == 2880 + assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"].open == 1440 + assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"].nigh == 2880 # When print("\nset acptfacts for 10 day stretch") @@ -574,15 +574,15 @@ def test_weekdayAgendaItemsCorrectlyReturned(): a1.set_acptfact( base=road_minute, pick=road_minute, open=dayzero_min, nigh=dayten_min ) - # for acptfact in a1._toolroot._acptfactunits.values(): + # for acptfact in a1._idearoot._acptfactunits.values(): # print(f"{acptfact.base=} (H: {acptfact.acptfact}) {acptfact.active=} {acptfact.open=} {acptfact.nigh=}") - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Saturday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Sunday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Tuesday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Wednesday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Thursday"].active == True - # assert a1._toolroot._acptfactunits[f"{tech_root},week,Friday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Saturday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Sunday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Tuesday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Wednesday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Thursday"].active == True + # assert a1._idearoot._acptfactunits[f"{tech_root},week,Friday"].active == True def test_agent_create_agenda_item_CorrectlyCreatesAllAgentAttributes(): @@ -597,14 +597,14 @@ def test_agent_create_agenda_item_CorrectlyCreatesAllAgentAttributes(): a1.set_agent_metrics() assert len(a1._members) == 0 assert len(a1._groups) == 0 - assert len(a1._toolroot._kids) == 0 + assert len(a1._idearoot._kids) == 0 clean_things_text = "cleaning things" clean_things_road = Road(f"{src_text},{clean_things_text}") clean_cookery_text = "clean cookery" clean_cookery_road = Road(f"{src_text},{clean_things_text},{clean_cookery_text}") - clean_cookery_tool = ToolKid(_desc=clean_cookery_text, _walk=clean_things_road) - print(f"{clean_cookery_tool.get_road()=}") + clean_cookery_idea = IdeaKid(_desc=clean_cookery_text, _walk=clean_things_road) + print(f"{clean_cookery_idea.get_road()=}") home_text = "home" home_road = Road(f"{src_text},{home_text}") cookery_room_text = "cookery room" @@ -613,18 +613,18 @@ def test_agent_create_agenda_item_CorrectlyCreatesAllAgentAttributes(): cookery_dirty_road = Road(f"{cookery_room_road},{cookery_dirty_text}") # create gregorian timeline - a1.set_time_hreg_tools(c400_count=7) + a1.set_time_hreg_ideas(c400_count=7) daytime_road = Road(f"{src_text},time,jajatime,day") open_8am = 480 nigh_8am = 480 dirty_cookery_required = RequiredUnit(base=cookery_room_road, sufffacts={}) dirty_cookery_required.set_sufffact(sufffact=cookery_dirty_road) - clean_cookery_tool.set_required_unit(required=dirty_cookery_required) + clean_cookery_idea.set_required_unit(required=dirty_cookery_required) daytime_required = RequiredUnit(base=daytime_road, sufffacts={}) daytime_required.set_sufffact(sufffact=daytime_road, open=open_8am, nigh=nigh_8am) - clean_cookery_tool.set_required_unit(required=daytime_required) + clean_cookery_idea.set_required_unit(required=daytime_required) # anna_text = "anna" # anna_memberunit = memberunit_shop(name=anna_text) @@ -638,41 +638,41 @@ def test_agent_create_agenda_item_CorrectlyCreatesAllAgentAttributes(): # groupunit_z.set_memberlink(memberlink=anna_memberlink) # groupunit_z.set_memberlink(memberlink=beto_memberlink) grouplink_z = grouplink_shop(name=family_text) - clean_cookery_tool.set_grouplink(grouplink=grouplink_z) + clean_cookery_idea.set_grouplink(grouplink=grouplink_z) assert len(a1._members) == 0 assert len(a1._groups) == 0 - assert len(a1._toolroot._kids) == 1 - assert a1.get_tool_kid(road=daytime_road)._begin == 0 - assert a1.get_tool_kid(road=daytime_road)._close == 1440 - print(f"{clean_cookery_tool.get_road()=}") + assert len(a1._idearoot._kids) == 1 + assert a1.get_idea_kid(road=daytime_road)._begin == 0 + assert a1.get_idea_kid(road=daytime_road)._close == 1440 + print(f"{clean_cookery_idea.get_road()=}") # GIVEN - a1.set_dominate_promise_tool(tool_kid=clean_cookery_tool) + a1.set_dominate_promise_idea(idea_kid=clean_cookery_idea) # THEN - # for tool_kid in a1._toolroot._kids.keys(): - # print(f" {tool_kid=}") - - print(f"{clean_cookery_tool.get_road()=}") - assert a1.get_tool_kid(road=clean_cookery_road) != None - assert a1.get_tool_kid(road=clean_cookery_road)._desc == clean_cookery_text - assert a1.get_tool_kid(road=clean_cookery_road).promise - assert len(a1.get_tool_kid(road=clean_cookery_road)._requiredunits) == 2 - assert a1.get_tool_kid(road=clean_things_road) != None - assert a1.get_tool_kid(road=cookery_room_road) != None - assert a1.get_tool_kid(road=cookery_dirty_road) != None - assert a1.get_tool_kid(road=daytime_road)._begin == 0 - assert a1.get_tool_kid(road=daytime_road)._close == 1440 + # for idea_kid in a1._idearoot._kids.keys(): + # print(f" {idea_kid=}") + + print(f"{clean_cookery_idea.get_road()=}") + assert a1.get_idea_kid(road=clean_cookery_road) != None + assert a1.get_idea_kid(road=clean_cookery_road)._desc == clean_cookery_text + assert a1.get_idea_kid(road=clean_cookery_road).promise + assert len(a1.get_idea_kid(road=clean_cookery_road)._requiredunits) == 2 + assert a1.get_idea_kid(road=clean_things_road) != None + assert a1.get_idea_kid(road=cookery_room_road) != None + assert a1.get_idea_kid(road=cookery_dirty_road) != None + assert a1.get_idea_kid(road=daytime_road)._begin == 0 + assert a1.get_idea_kid(road=daytime_road)._close == 1440 assert len(a1._groups) == 1 assert a1._groups.get(family_text) != None assert a1._groups.get(family_text)._members in (None, {}) - assert len(a1._toolroot._kids) == 3 + assert len(a1._idearoot._kids) == 3 -def get_tasks_count(tool_list: list[ToolCore]) -> int: - return sum(bool(toolcore._task) for toolcore in tool_list) +def get_tasks_count(idea_list: list[IdeaCore]) -> int: + return sum(bool(ideacore._task) for ideacore in idea_list) def test_Issue116Resolved_correctlySetsTaskAsTrue(): @@ -686,30 +686,30 @@ def test_Issue116Resolved_correctlySetsTaskAsTrue(): a1.set_acptfact( base=jajatime_road, pick=jajatime_road, open=1063998720, nigh=1064130373 ) - action_tool_list = a1.get_agenda_items() + action_idea_list = a1.get_agenda_items() # THEN - assert len(action_tool_list) == 66 + assert len(action_idea_list) == 66 jajatime_road = "Myagent,time,jajatime" night_text = "late_night_go_to_sleep" night_road = f"Myagent,D&B,{night_text}" - night_tool = a1._tool_dict.get(night_road) - # for tool_x in a1.get_agenda_items(): - # # if tool_x._task != True: - # # print(f"{len(action_tool_list)=} {tool_x._task=} {tool_x.get_road()}") - # if tool_x._desc == night_desc: - # night_tool = tool_x - # print(f"{tool_x.get_road()=}") - - print(f"\nTool = '{night_text}' and required '{jajatime_road}'") - acptfactheir_jajatime = night_tool._acptfactheirs.get(jajatime_road) + night_idea = a1._idea_dict.get(night_road) + # for idea_x in a1.get_agenda_items(): + # # if idea_x._task != True: + # # print(f"{len(action_idea_list)=} {idea_x._task=} {idea_x.get_road()}") + # if idea_x._desc == night_desc: + # night_idea = idea_x + # print(f"{idea_x.get_road()=}") + + print(f"\nIdea = '{night_text}' and required '{jajatime_road}'") + acptfactheir_jajatime = night_idea._acptfactheirs.get(jajatime_road) print(f"\n{acptfactheir_jajatime=}") print(f" {a1.get_jajatime_repeating_readable_text(open=1063998720)}") print(f" {a1.get_jajatime_repeating_readable_text(open=1064130373)}") # for requiredheir in agenda_item._requiredheirs.values(): # print(f"{requiredheir.base=} {requiredheir._status=} {requiredheir._task=}") - requiredheir_jajatime = night_tool._requiredheirs.get(jajatime_road) + requiredheir_jajatime = night_idea._requiredheirs.get(jajatime_road) requiredheir_text = f"\nrequiredheir_jajatime= '{requiredheir_jajatime.base}', status={requiredheir_jajatime._status}, task={requiredheir_jajatime._task}" print(requiredheir_text) @@ -736,4 +736,4 @@ def test_Issue116Resolved_correctlySetsTaskAsTrue(): print(f" {segr_obj.sufffact_open_trans=} {segr_obj.sufffact_nigh_trans=}") print(f" {segr_obj._active_status=} {segr_obj._task_status=}") - assert get_tasks_count(action_tool_list) == 64 + assert get_tasks_count(action_idea_list) == 64 diff --git a/src/agent/test_agent/test_agent_bond.py b/src/agent/test_agent/test_agent_bond.py index 9cd6d36f5..45a9d8195 100644 --- a/src/agent/test_agent/test_agent_bond.py +++ b/src/agent/test_agent/test_agent_bond.py @@ -4,7 +4,7 @@ get_meld_of_agent_files, ) from src.agent.examples.get_agent_examples_dir import get_agent_examples_dir -from src.agent.tool import ToolCore, ToolKid +from src.agent.idea import IdeaCore, IdeaKid from src.agent.road import Road from src.agent.required import RequiredUnit from src.agent.member import memberlink_shop @@ -35,56 +35,56 @@ def test_agentunit_get_bond_status_ReturnsCorrectBool(): casa_text = "case" casa_road = Road(f"{jessi_text},{casa_text}") - # WHEN\THEN no action tool exists - cx.add_tool(tool_kid=ToolKid(_desc=casa_text), walk=jessi_text) + # WHEN\THEN no action idea exists + cx.add_idea(idea_kid=IdeaKid(_desc=casa_text), walk=jessi_text) assert cx.get_bond_status() == False - # WHEN\THEN 1 action tool exists + # WHEN\THEN 1 action idea exists clean_cookery_text = "clean cookery" - cx.add_tool( - tool_kid=ToolKid(_desc=clean_cookery_text, promise=True), walk=casa_road + cx.add_idea( + idea_kid=IdeaKid(_desc=clean_cookery_text, promise=True), walk=casa_road ) assert cx.get_bond_status() - # WHEN\THEN 2 action tool exists + # WHEN\THEN 2 action idea exists clean_hallway_text = "clean hallway" - cx.add_tool( - tool_kid=ToolKid(_desc=clean_hallway_text, promise=True), walk=casa_road + cx.add_idea( + idea_kid=IdeaKid(_desc=clean_hallway_text, promise=True), walk=casa_road ) assert cx.get_bond_status() == False - # WHEN\THEN 1 action tool deleted (1 total) + # WHEN\THEN 1 action idea deleted (1 total) clean_hallway_road = Road(f"{jessi_text},{casa_text},{clean_hallway_text}") - cx.del_tool_kid(road=clean_hallway_road) + cx.del_idea_kid(road=clean_hallway_road) assert cx.get_bond_status() - # WHEN\THEN 1 action tool deleted (0 total) + # WHEN\THEN 1 action idea deleted (0 total) clean_cookery_road = Road(f"{jessi_text},{casa_text},{clean_cookery_text}") - cx.del_tool_kid(road=clean_cookery_road) + cx.del_idea_kid(road=clean_cookery_road) assert cx.get_bond_status() == False - # for tool_kid in cx._toolroot._kids.values(): - # print(f"after {tool_kid._desc=} {tool_kid.promise=}") + # for idea_kid in cx._idearoot._kids.values(): + # print(f"after {idea_kid._desc=} {idea_kid.promise=}") -def test_agentunit_get_bond_status_ReturnsCorrectBoolWhenOnlyActionToolGroupheirsMatchAgentGroups(): +def test_agentunit_get_bond_status_ReturnsCorrectBoolWhenOnlyActionIdeaGroupheirsMatchAgentGroups(): # GIVEN jessi_text = "jessi" cx = AgentUnit(_desc=jessi_text) casa_text = "case" casa_road = Road(f"{jessi_text},{casa_text}") - cx.add_tool(tool_kid=ToolKid(_desc=casa_text), walk=jessi_text) + cx.add_idea(idea_kid=IdeaKid(_desc=casa_text), walk=jessi_text) clean_cookery_text = "clean cookery" clean_cookery_road = Road(f"{jessi_text},{casa_text},{clean_cookery_text}") - cx.add_tool( - tool_kid=ToolKid(_desc=clean_cookery_text, promise=True), walk=casa_road + cx.add_idea( + idea_kid=IdeaKid(_desc=clean_cookery_text, promise=True), walk=casa_road ) tom_text = "tom" cx.add_memberunit(name=tom_text) assert cx.get_bond_status() == False # WHEN - cx.edit_tool_attr(road=clean_cookery_road, grouplink=grouplink_shop(name=tom_text)) + cx.edit_idea_attr(road=clean_cookery_road, grouplink=grouplink_shop(name=tom_text)) # THEN assert cx.get_bond_status() @@ -95,26 +95,26 @@ def test_agentunit_get_bond_status_ReturnsCorrectBoolWhenOnlyActionToolGroupheir assert cx.get_bond_status() == False -def test_agentunit_get_bond_status_ChecksActionToolGroupsheirsEqualAgentGroupunits(): +def test_agentunit_get_bond_status_ChecksActionIdeaGroupsheirsEqualAgentGroupunits(): # GIVEN jessi_text = "jessi" cx = AgentUnit(_desc=jessi_text) casa_text = "case" casa_road = Road(f"{jessi_text},{casa_text}") - cx.add_tool(tool_kid=ToolKid(_desc=casa_text), walk=jessi_text) + cx.add_idea(idea_kid=IdeaKid(_desc=casa_text), walk=jessi_text) clean_cookery_text = "clean cookery" clean_cookery_road = Road(f"{jessi_text},{casa_text},{clean_cookery_text}") - cx.add_tool( - tool_kid=ToolKid(_desc=clean_cookery_text, promise=True), walk=casa_road + cx.add_idea( + idea_kid=IdeaKid(_desc=clean_cookery_text, promise=True), walk=casa_road ) tom_text = "tom" cx.add_memberunit(name=tom_text) assert cx.get_bond_status() == False # WHEN - cx.edit_tool_attr(road=clean_cookery_road, grouplink=grouplink_shop(name=tom_text)) - clean_cookery_tool = cx.get_tool_kid(road=clean_cookery_road) - assert len(clean_cookery_tool._groupheirs) == 1 + cx.edit_idea_attr(road=clean_cookery_road, grouplink=grouplink_shop(name=tom_text)) + clean_cookery_idea = cx.get_idea_kid(road=clean_cookery_road) + assert len(clean_cookery_idea._groupheirs) == 1 # THEN assert cx.get_bond_status() @@ -125,17 +125,17 @@ def test_agentunit_get_bond_status_ChecksActionToolGroupsheirsEqualAgentGroupuni assert cx.get_bond_status() == False -def test_agentunit_get_bond_status_ChecksActionToolGroupsheirsEqualAgentGroupunits2(): +def test_agentunit_get_bond_status_ChecksActionIdeaGroupsheirsEqualAgentGroupunits2(): # GIVEN jessi_text = "jessi" cx = AgentUnit(_desc=jessi_text) casa_text = "case" casa_road = Road(f"{jessi_text},{casa_text}") - cx.add_tool(tool_kid=ToolKid(_desc=casa_text), walk=jessi_text) + cx.add_idea(idea_kid=IdeaKid(_desc=casa_text), walk=jessi_text) clean_cookery_text = "clean cookery" clean_cookery_road = Road(f"{jessi_text},{casa_text},{clean_cookery_text}") - cx.add_tool( - tool_kid=ToolKid(_desc=clean_cookery_text, promise=True), walk=casa_road + cx.add_idea( + idea_kid=IdeaKid(_desc=clean_cookery_text, promise=True), walk=casa_road ) assert cx.get_bond_status() @@ -151,7 +151,7 @@ def test_agentunit_get_bond_status_ChecksActionToolGroupsheirsEqualAgentGroupuni assert cx.get_bond_status() == False # WHEN - cx.edit_tool_attr( + cx.edit_idea_attr( road=clean_cookery_road, grouplink=grouplink_shop(name=home_occupants_text) ) # THEN @@ -165,91 +165,91 @@ def test_agentunit_get_bond_status_ChecksActionToolGroupsheirsEqualAgentGroupuni assert cx.get_bond_status() == False -def test_agentunit_get_bond_status_ChecksOnlyNecessaryToolsExist_MultipleScenario(): +def test_agentunit_get_bond_status_ChecksOnlyNecessaryIdeasExist_MultipleScenario(): # GIVEN jessi_text = "jessi" cx = AgentUnit(_desc=jessi_text) casa_text = "case" casa_road = Road(f"{jessi_text},{casa_text}") - cx.add_tool(tool_kid=ToolKid(_desc=casa_text), walk=jessi_text) + cx.add_idea(idea_kid=IdeaKid(_desc=casa_text), walk=jessi_text) clean_cookery_text = "clean cookery" clean_cookery_road = Road(f"{jessi_text},{casa_text},{clean_cookery_text}") # WHEN/THEN - cx.add_tool( - tool_kid=ToolKid(_desc=clean_cookery_text, promise=True), walk=casa_road + cx.add_idea( + idea_kid=IdeaKid(_desc=clean_cookery_text, promise=True), walk=casa_road ) assert cx.get_bond_status() # WHEN/THEN water_text = "water" water_road = Road(f"{jessi_text},{water_text}") - cx.add_tool(tool_kid=ToolKid(_desc=water_text), walk=jessi_text) + cx.add_idea(idea_kid=IdeaKid(_desc=water_text), walk=jessi_text) assert cx.get_bond_status() == False rain_text = "rain" rain_road = Road(f"{jessi_text},{water_text},{rain_text}") - cx.add_tool(tool_kid=ToolKid(_desc=rain_text), walk=water_road) + cx.add_idea(idea_kid=IdeaKid(_desc=rain_text), walk=water_road) # WHEN/THEN - cx.edit_tool_attr( + cx.edit_idea_attr( road=clean_cookery_road, required_base=water_road, required_sufffact=rain_road ) assert cx.get_bond_status() -def test_agentunit_get_agent_sprung_from_single_tool_ReturnsCorrectAgentScenario1(): +def test_agentunit_get_agent_sprung_from_single_idea_ReturnsCorrectAgentScenario1(): # GIVEN jessi_text = "jessi" cx = AgentUnit(_desc=jessi_text) casa_text = "case" casa_road = Road(f"{jessi_text},{casa_text}") - cx.add_tool( - tool_kid=ToolKid(_desc=casa_text, _begin=-1, _close=19), walk=jessi_text + cx.add_idea( + idea_kid=IdeaKid(_desc=casa_text, _begin=-1, _close=19), walk=jessi_text ) clean_cookery_text = "clean cookery" clean_cookery_road = Road(f"{jessi_text},{casa_text},{clean_cookery_text}") - cx.add_tool( - tool_kid=ToolKid(_desc=clean_cookery_text, promise=True, _begin=2, _close=4), + cx.add_idea( + idea_kid=IdeaKid(_desc=clean_cookery_text, promise=True, _begin=2, _close=4), walk=casa_road, ) water_text = "water" water_road = Road(f"{jessi_text},{water_text}") - cx.add_tool(tool_kid=ToolKid(_desc=water_text), walk=jessi_text) + cx.add_idea(idea_kid=IdeaKid(_desc=water_text), walk=jessi_text) assert cx.get_bond_status() == False # WHEN - bond_agent = cx.get_agent_sprung_from_single_tool(road=clean_cookery_road) + bond_agent = cx.get_agent_sprung_from_single_idea(road=clean_cookery_road) # THEN # assert bond_agent._desc == clean_cookery_text - print(f"{len(bond_agent._tool_dict)=}") - assert len(bond_agent._tool_dict) == 3 - b_src_tool = bond_agent.get_tool_kid(road=jessi_text) - src_src_tool = cx.get_tool_kid(road=jessi_text) - assert b_src_tool._uid == src_src_tool._uid - assert b_src_tool._begin == src_src_tool._begin - assert b_src_tool._close == src_src_tool._close - assert b_src_tool != src_src_tool - - b_casa_tool = bond_agent.get_tool_kid(road=casa_road) - src_casa_tool = cx.get_tool_kid(road=casa_road) - assert b_casa_tool._uid == src_casa_tool._uid - assert b_casa_tool._begin == src_casa_tool._begin - assert b_casa_tool._close == src_casa_tool._close - assert b_casa_tool != src_casa_tool - - b_clean_cookery_tool = bond_agent.get_tool_kid(road=clean_cookery_road) - src_clean_cookery_tool = cx.get_tool_kid(road=clean_cookery_road) - assert b_clean_cookery_tool._uid == src_clean_cookery_tool._uid - assert b_clean_cookery_tool._begin == src_clean_cookery_tool._begin - assert b_clean_cookery_tool._close == src_clean_cookery_tool._close - assert b_clean_cookery_tool != src_clean_cookery_tool - - assert bond_agent._toolroot._kids.get(water_text) is None - - # for byx in bond_agent._tool_dict.values(): - # cyx = cx.get_tool_kid(road=byx.get_road()) + print(f"{len(bond_agent._idea_dict)=}") + assert len(bond_agent._idea_dict) == 3 + b_src_idea = bond_agent.get_idea_kid(road=jessi_text) + src_src_idea = cx.get_idea_kid(road=jessi_text) + assert b_src_idea._uid == src_src_idea._uid + assert b_src_idea._begin == src_src_idea._begin + assert b_src_idea._close == src_src_idea._close + assert b_src_idea != src_src_idea + + b_casa_idea = bond_agent.get_idea_kid(road=casa_road) + src_casa_idea = cx.get_idea_kid(road=casa_road) + assert b_casa_idea._uid == src_casa_idea._uid + assert b_casa_idea._begin == src_casa_idea._begin + assert b_casa_idea._close == src_casa_idea._close + assert b_casa_idea != src_casa_idea + + b_clean_cookery_idea = bond_agent.get_idea_kid(road=clean_cookery_road) + src_clean_cookery_idea = cx.get_idea_kid(road=clean_cookery_road) + assert b_clean_cookery_idea._uid == src_clean_cookery_idea._uid + assert b_clean_cookery_idea._begin == src_clean_cookery_idea._begin + assert b_clean_cookery_idea._close == src_clean_cookery_idea._close + assert b_clean_cookery_idea != src_clean_cookery_idea + + assert bond_agent._idearoot._kids.get(water_text) is None + + # for byx in bond_agent._idea_dict.values(): + # cyx = cx.get_idea_kid(road=byx.get_road()) # assert byx._uid == cyx._uid # print(f"{byx.get_road()=} {byx._begin=} {byx._close=}") # print(f"{cyx.get_road()=} {cyx._begin=} {cyx._close=}") @@ -259,7 +259,7 @@ def test_agentunit_get_agent_sprung_from_single_tool_ReturnsCorrectAgentScenario # assert yx4._desc == cyx._kids.get(yx4._desc)._desc # for cx3 in cyx._kids.values(): # if cx3._desc == water_text: - # print(f"checking src agent tool kid_desc='{cx3._desc}'") + # print(f"checking src agent idea kid_desc='{cx3._desc}'") # assert byx._kids.get(cx3._desc) is None # else: # assert cx3._desc == byx._kids.get(cx3._desc)._desc @@ -268,15 +268,15 @@ def test_agentunit_get_agent_sprung_from_single_tool_ReturnsCorrectAgentScenario # # assert byx._kids != cyx._kids # assert byx != cyx - assert len(bond_agent._tool_dict) == 3 - assert bond_agent._toolroot._kids.get(water_text) is None + assert len(bond_agent._idea_dict) == 3 + assert bond_agent._idearoot._kids.get(water_text) is None def test_agentunit_export_all_bonds_ExportsFileOfBonds_2files(env_dir_setup_cleanup): # GIVEN cx = example_agents_get_agent_with_4_levels_and_2requireds_2acptfacts() - cx_tool_list = cx.get_tool_list() - action_count = sum(bool(yx.promise) for yx in cx_tool_list) + cx_idea_list = cx.get_idea_list() + action_count = sum(bool(yx.promise) for yx in cx_idea_list) assert action_count == 2 with pytest_raises(Exception) as excinfo: x_func_dir_files(dir_path=get_temp_env_dir()) @@ -302,9 +302,9 @@ def test_agentunit_export_all_bonds_ExportsFileOfBonds_2files(env_dir_setup_clea # def test_agentunit_export_all_bonds_ExportsFileOfBonds_69files(env_dir_setup_cleanup): # # GIVEN # cx = example_agents_agent_v001() -# cx_tool_list = cx.get_tool_list() +# cx_idea_list = cx.get_idea_list() # action_count = 0 -# for yx in cx_tool_list: +# for yx in cx_idea_list: # if yx.promise: # action_count += 1 # assert action_count == 69 @@ -329,8 +329,8 @@ def test_agentunit_export_all_bonds_ExportsFileOfBonds_2files(env_dir_setup_clea def test_agentunit_export_all_bonds_ReturnsDictOfBonds(env_dir_setup_cleanup): # GIVEN cx = example_agents_get_agent_with_4_levels_and_2requireds_2acptfacts() - cx_tool_list = cx.get_tool_list() - action_count = sum(bool(yx.promise) for yx in cx_tool_list) + cx_idea_list = cx.get_idea_list() + action_count = sum(bool(yx.promise) for yx in cx_idea_list) assert action_count == 2 # WHEN @@ -359,12 +359,12 @@ def test_agentunit_get_meld_of_agent_files_MeldsIntoSourceAgent_Scenario1( src_cx = AgentUnit(_weight=10, _desc=src) work = "work" - tool_kid_work = ToolKid(_weight=30, _desc=work, promise=True) - src_cx.add_tool(tool_kid=tool_kid_work, walk=f"{src}") + idea_kid_work = IdeaKid(_weight=30, _desc=work, promise=True) + src_cx.add_idea(idea_kid=idea_kid_work, walk=f"{src}") cat = "feed cat" - tool_kid_feedcat = ToolKid(_weight=20, _desc=cat, promise=True) - src_cx.add_tool(tool_kid=tool_kid_feedcat, walk=f"{src}") + idea_kid_feedcat = IdeaKid(_weight=20, _desc=cat, promise=True) + src_cx.add_idea(idea_kid=idea_kid_feedcat, walk=f"{src}") src_cx.export_all_bonds(dir=get_temp_env_dir()) @@ -375,15 +375,15 @@ def test_agentunit_get_meld_of_agent_files_MeldsIntoSourceAgent_Scenario1( # THEN assert src_cx._weight == new_cx._weight - assert src_cx._toolroot._weight == new_cx._toolroot._weight + assert src_cx._idearoot._weight == new_cx._idearoot._weight cat_t = "feed cat" assert ( - src_cx._toolroot._kids.get(cat_t)._agent_coin_onset - == new_cx._toolroot._kids.get(cat_t)._agent_coin_onset + src_cx._idearoot._kids.get(cat_t)._agent_coin_onset + == new_cx._idearoot._kids.get(cat_t)._agent_coin_onset ) - assert src_cx._toolroot._kids.get(cat_t) == new_cx._toolroot._kids.get(cat_t) - assert src_cx._toolroot._kids == new_cx._toolroot._kids - assert src_cx._toolroot == new_cx._toolroot + assert src_cx._idearoot._kids.get(cat_t) == new_cx._idearoot._kids.get(cat_t) + assert src_cx._idearoot._kids == new_cx._idearoot._kids + assert src_cx._idearoot == new_cx._idearoot assert src_cx == new_cx @@ -398,12 +398,12 @@ def test_agentunit_get_meld_of_agent_files_MeldsIntoSourceAgent_Scenario1( # work_road = f"{src},{work_text}" # cat_text = "feed cat" -# cat_tool = ToolKid(_weight=20, _desc=cat_text, promise=True) -# src_cx.add_tool(tool_kid=cat_tool, walk=work_road) +# cat_idea = IdeaKid(_weight=20, _desc=cat_text, promise=True) +# src_cx.add_idea(idea_kid=cat_idea, walk=work_road) # plant_text = "water plant" -# plant_tool = ToolKid(_weight=30, _desc=plant_text, promise=True) -# src_cx.add_tool(tool_kid=plant_tool, walk=work_road) +# plant_idea = IdeaKid(_weight=30, _desc=plant_text, promise=True) +# src_cx.add_idea(idea_kid=plant_idea, walk=work_road) # src_cx.export_all_bonds(dir=get_temp_env_dir()) # # WHEN @@ -413,21 +413,21 @@ def test_agentunit_get_meld_of_agent_files_MeldsIntoSourceAgent_Scenario1( # # THEN # assert src_cx._weight == new_cx._weight -# assert src_cx._toolroot._weight == new_cx._toolroot._weight -# assert len(src_cx._toolroot._kids) == 1 -# assert len(src_cx._toolroot._kids) == len(new_cx._toolroot._kids) -# src_work_tool = src_cx._toolroot._kids.get(work_text) -# new_work_tool = new_cx._toolroot._kids.get(work_text) -# src_cat_tool = src_work_tool._kids.get(cat_text) -# new_cat_tool = new_work_tool._kids.get(cat_text) -# print(f"{src_cat_tool._agent_importance=} {new_cat_tool._agent_importance=}") -# assert src_cat_tool._weight == new_cat_tool._weight -# assert src_work_tool._kids.get(cat_text) == new_work_tool._kids.get(cat_text) - -# assert src_cx._toolroot._kids.get(cat_text) == new_cx._toolroot._kids.get(cat_text) -# assert src_cx._toolroot._kids == new_cx._toolroot._kids -# assert src_cx._toolroot == new_cx._toolroot +# assert src_cx._idearoot._weight == new_cx._idearoot._weight +# assert len(src_cx._idearoot._kids) == 1 +# assert len(src_cx._idearoot._kids) == len(new_cx._idearoot._kids) +# src_work_idea = src_cx._idearoot._kids.get(work_text) +# new_work_idea = new_cx._idearoot._kids.get(work_text) +# src_cat_idea = src_work_idea._kids.get(cat_text) +# new_cat_idea = new_work_idea._kids.get(cat_text) +# print(f"{src_cat_idea._agent_importance=} {new_cat_idea._agent_importance=}") +# assert src_cat_idea._weight == new_cat_idea._weight +# assert src_work_idea._kids.get(cat_text) == new_work_idea._kids.get(cat_text) + +# assert src_cx._idearoot._kids.get(cat_text) == new_cx._idearoot._kids.get(cat_text) +# assert src_cx._idearoot._kids == new_cx._idearoot._kids +# assert src_cx._idearoot == new_cx._idearoot # assert src_cx == new_cx -# - [ ] create test_agentunit_get_bond_status_ReturnsFalseWhenNotOnlyActionToolAcptFactsExist +# - [ ] create test_agentunit_get_bond_status_ReturnsFalseWhenNotOnlyActionIdeaAcptFactsExist diff --git a/src/agent/test_agent/test_agent_desc_change.py b/src/agent/test_agent/test_agent_desc_change.py index 832fd642d..434b1da2b 100644 --- a/src/agent/test_agent/test_agent_desc_change.py +++ b/src/agent/test_agent/test_agent_desc_change.py @@ -1,5 +1,5 @@ from src.agent.agent import AgentUnit -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from src.agent.examples.example_agents import ( get_agent_with_4_levels_and_2requireds_2acptfacts, ) @@ -7,29 +7,29 @@ from src.agent.required import Road, AcptFactUnit -def test_tool_desc_fails_when_tool_does_not_exist(): +def test_idea_desc_fails_when_idea_does_not_exist(): # GIVEN src = "src" work_text = "work" work_road = f"{src},{work_text}" swim_text = "swim" sx = AgentUnit(_desc=src) - sx.add_tool(walk=src, tool_kid=ToolKid(_desc=work_text)) - sx.add_tool(walk=work_road, tool_kid=ToolKid(_desc=swim_text)) + sx.add_idea(walk=src, idea_kid=IdeaKid(_desc=work_text)) + sx.add_idea(walk=work_road, idea_kid=IdeaKid(_desc=swim_text)) # When/Then - no_tool_road = Road(f"{src},bees") + no_idea_road = Road(f"{src},bees") with pytest_raises(Exception) as excinfo: - sx.edit_tool_desc(old_road=no_tool_road, new_desc="pigeons") + sx.edit_idea_desc(old_road=no_idea_road, new_desc="pigeons") assert ( str(excinfo.value) - == f"Getting tool_desc='bees' failed no item at '{no_tool_road}'" + == f"Getting idea_desc='bees' failed no item at '{no_idea_road}'" ) -# when editing a tool description it's possible that the change breaks a required.base, sufffact.need or acptfact.base or acptfact.acptfact +# when editing a idea description it's possible that the change breaks a required.base, sufffact.need or acptfact.base or acptfact.acptfact # fixing this quickly looks difficult. Maybe push it off -def test_where_level0_tool_desc_change_breaks_tool_walk_of_child_tools(): +def test_where_level0_idea_desc_change_breaks_idea_walk_of_child_ideas(): # GIVEN src = "src" work_text = "work" @@ -37,29 +37,29 @@ def test_where_level0_tool_desc_change_breaks_tool_walk_of_child_tools(): swim_text = "swim" swim_road = f"{src},{work_text},{swim_text}" sx = AgentUnit(_desc=src) - sx.add_tool(walk=src, tool_kid=ToolKid(_desc=work_text)) - sx.add_tool(walk=work_road, tool_kid=ToolKid(_desc=swim_text)) + sx.add_idea(walk=src, idea_kid=IdeaKid(_desc=work_text)) + sx.add_idea(walk=work_road, idea_kid=IdeaKid(_desc=swim_text)) assert sx._desc == src - assert sx._toolroot._desc == src - work_tool = sx.get_tool_kid(road=work_road) - assert work_tool._walk == src - swim_tool = sx.get_tool_kid(road=swim_road) - assert swim_tool._walk == work_road + assert sx._idearoot._desc == src + work_idea = sx.get_idea_kid(road=work_road) + assert work_idea._walk == src + swim_idea = sx.get_idea_kid(road=swim_road) + assert swim_idea._walk == work_road # WHEN moon = "moon" - sx.edit_tool_desc(old_road=src, new_desc=moon) + sx.edit_idea_desc(old_road=src, new_desc=moon) # THEN assert sx._desc == src # does not change agent name - assert sx._toolroot._desc == moon - assert sx._toolroot._walk == "" - assert work_tool._walk == moon - assert swim_tool._walk == f"{moon},{work_text}" + assert sx._idearoot._desc == moon + assert sx._idearoot._walk == "" + assert work_idea._walk == moon + assert swim_idea._walk == f"{moon},{work_text}" -def test_tool_find_replace_road_Changes_kids_scenario1(): - # GIVEN Tool with kids that will be changed +def test_idea_find_replace_road_Changes_kids_scenario1(): + # GIVEN Idea with kids that will be changed src = "src" old_person_text = "person" old_person_road = Road(f"{src},{old_person_text}") @@ -73,41 +73,41 @@ def test_tool_find_replace_road_Changes_kids_scenario1(): ) sx = AgentUnit(_desc=src) - sx.add_tool(walk=src, tool_kid=ToolKid(_desc=old_person_text)) - sx.add_tool(walk=old_person_road, tool_kid=ToolKid(_desc=bloomers_text)) - sx.add_tool(walk=old_bloomers_road, tool_kid=ToolKid(_desc=roses_text)) - sx.add_tool(walk=old_roses_road, tool_kid=ToolKid(_desc=red_text)) - r_tool_roses = sx.get_tool_kid(old_roses_road) - r_tool_bloomers = sx.get_tool_kid(old_bloomers_road) - - assert r_tool_bloomers._kids.get(roses_text) != None - assert r_tool_roses._walk == old_bloomers_road - assert r_tool_roses._kids.get(red_text) != None - r_tool_red = r_tool_roses._kids.get(red_text) - assert r_tool_red._walk == old_roses_road + sx.add_idea(walk=src, idea_kid=IdeaKid(_desc=old_person_text)) + sx.add_idea(walk=old_person_road, idea_kid=IdeaKid(_desc=bloomers_text)) + sx.add_idea(walk=old_bloomers_road, idea_kid=IdeaKid(_desc=roses_text)) + sx.add_idea(walk=old_roses_road, idea_kid=IdeaKid(_desc=red_text)) + r_idea_roses = sx.get_idea_kid(old_roses_road) + r_idea_bloomers = sx.get_idea_kid(old_bloomers_road) + + assert r_idea_bloomers._kids.get(roses_text) != None + assert r_idea_roses._walk == old_bloomers_road + assert r_idea_roses._kids.get(red_text) != None + r_idea_red = r_idea_roses._kids.get(red_text) + assert r_idea_red._walk == old_roses_road # WHEN new_person_text = "globe" new_person_road = Road(f"{src},{new_person_text}") - sx.edit_tool_desc(old_road=old_person_road, new_desc=new_person_text) + sx.edit_idea_desc(old_road=old_person_road, new_desc=new_person_text) # THEN - assert sx._toolroot._kids.get(new_person_text) != None - assert sx._toolroot._kids.get(old_person_text) is None + assert sx._idearoot._kids.get(new_person_text) != None + assert sx._idearoot._kids.get(old_person_text) is None - assert r_tool_bloomers._walk == new_person_road - assert r_tool_bloomers._kids.get(roses_text) != None + assert r_idea_bloomers._walk == new_person_road + assert r_idea_bloomers._kids.get(roses_text) != None - r_tool_roses = r_tool_bloomers._kids.get(roses_text) + r_idea_roses = r_idea_bloomers._kids.get(roses_text) new_bloomers_road = Road(f"{src},{new_person_text},{bloomers_text}") - assert r_tool_roses._walk == new_bloomers_road - assert r_tool_roses._kids.get(red_text) != None - r_tool_red = r_tool_roses._kids.get(red_text) + assert r_idea_roses._walk == new_bloomers_road + assert r_idea_roses._kids.get(red_text) != None + r_idea_red = r_idea_roses._kids.get(red_text) new_roses_road = Road(f"{src},{new_person_text},{bloomers_text},{roses_text}") - assert r_tool_red._walk == new_roses_road + assert r_idea_red._walk == new_roses_road -def test_agent_edit_tool_desc_Changes_acptfactunits(): +def test_agent_edit_idea_desc_Changes_acptfactunits(): # GIVEN agent with acptfactunits that will be changed src = "src" person = "person" @@ -121,60 +121,60 @@ def test_agent_edit_tool_desc_Changes_acptfactunits(): old_rain_road = f"{src},{old_water_text},{rain_text}" sx = AgentUnit(_desc=src) - sx.add_tool(walk=src, tool_kid=ToolKid(_desc=person)) - sx.add_tool(walk=bloomers_road, tool_kid=ToolKid(_desc=roses_text)) - sx.add_tool(walk=old_water_road, tool_kid=ToolKid(_desc=rain_text)) + sx.add_idea(walk=src, idea_kid=IdeaKid(_desc=person)) + sx.add_idea(walk=bloomers_road, idea_kid=IdeaKid(_desc=roses_text)) + sx.add_idea(walk=old_water_road, idea_kid=IdeaKid(_desc=rain_text)) sx.set_acptfact(base=old_water_road, pick=old_rain_road) - tool_x = sx.get_tool_kid(road=roses_road) - assert sx._toolroot._acptfactunits[old_water_road] != None - old_water_rain_acptfactunit = sx._toolroot._acptfactunits[old_water_road] + idea_x = sx.get_idea_kid(road=roses_road) + assert sx._idearoot._acptfactunits[old_water_road] != None + old_water_rain_acptfactunit = sx._idearoot._acptfactunits[old_water_road] assert old_water_rain_acptfactunit.base == old_water_road assert old_water_rain_acptfactunit.pick == old_rain_road # WHEN new_water_text = "h2o" new_water_road = f"{src},{new_water_text}" - sx.add_tool(walk=src, tool_kid=ToolKid(_desc=new_water_text)) - assert sx._toolroot._acptfactunits.get(new_water_road) is None - sx.edit_tool_desc(old_road=old_water_road, new_desc=new_water_text) + sx.add_idea(walk=src, idea_kid=IdeaKid(_desc=new_water_text)) + assert sx._idearoot._acptfactunits.get(new_water_road) is None + sx.edit_idea_desc(old_road=old_water_road, new_desc=new_water_text) # THEN - assert sx._toolroot._acptfactunits.get(old_water_road) is None - assert sx._toolroot._acptfactunits.get(new_water_road) != None - new_water_rain_acptfactunit = sx._toolroot._acptfactunits[new_water_road] + assert sx._idearoot._acptfactunits.get(old_water_road) is None + assert sx._idearoot._acptfactunits.get(new_water_road) != None + new_water_rain_acptfactunit = sx._idearoot._acptfactunits[new_water_road] assert new_water_rain_acptfactunit.base == new_water_road new_rain_road = f"{src},{new_water_text},{rain_text}" assert new_water_rain_acptfactunit.pick == new_rain_road - assert sx._toolroot._acptfactunits.get(new_water_road) - acptfactunit_obj = sx._toolroot._acptfactunits.get(new_water_road) - # for acptfactunit_key, acptfactunit_obj in sx._toolroot._acptfactunits.items(): + assert sx._idearoot._acptfactunits.get(new_water_road) + acptfactunit_obj = sx._idearoot._acptfactunits.get(new_water_road) + # for acptfactunit_key, acptfactunit_obj in sx._idearoot._acptfactunits.items(): # assert acptfactunit_key == new_water_road assert acptfactunit_obj.base == new_water_road assert acptfactunit_obj.pick == new_rain_road -def test_agent_edit_tool_desc_ChangesToolRoot_special_road(): +def test_agent_edit_idea_desc_ChangesIdeaRoot_special_road(): # GIVEN this should never happen but it's not currently banned src = "src" old_person_text = "person" old_person_road = Road(f"{src},{old_person_text}") sx = AgentUnit(_desc=src) - sx.add_tool(walk=src, tool_kid=ToolKid(_desc=old_person_text)) - sx.edit_tool_attr(road=src, special_road=old_person_road) - assert sx._toolroot._special_road == old_person_road + sx.add_idea(walk=src, idea_kid=IdeaKid(_desc=old_person_text)) + sx.edit_idea_attr(road=src, special_road=old_person_road) + assert sx._idearoot._special_road == old_person_road # WHEN new_person_text = "globe" - sx.edit_tool_desc(old_road=old_person_road, new_desc=new_person_text) + sx.edit_idea_desc(old_road=old_person_road, new_desc=new_person_text) # THEN new_person_road = Road(f"{src},{new_person_text}") - assert sx._toolroot._special_road == new_person_road + assert sx._idearoot._special_road == new_person_road -def test_agent_edit_tool_desc_ChangesToolKidN_special_road(): +def test_agent_edit_idea_desc_ChangesIdeaKidN_special_road(): src = "src" person_text = "person" person_road = Road(f"{src},{person_text}") @@ -186,48 +186,48 @@ def test_agent_edit_tool_desc_ChangesToolKidN_special_road(): mood_road = Road(f"{src},{mood_text}") sx = AgentUnit(_desc=src) - sx.add_tool(walk=src, tool_kid=ToolKid(_desc=person_text)) - sx.add_tool(walk=person_road, tool_kid=ToolKid(_desc=old_water_text)) - sx.add_tool(walk=old_water_road, tool_kid=ToolKid(_desc=rain_text)) - sx.add_tool(walk=src, tool_kid=ToolKid(_desc=mood_text)) + sx.add_idea(walk=src, idea_kid=IdeaKid(_desc=person_text)) + sx.add_idea(walk=person_road, idea_kid=IdeaKid(_desc=old_water_text)) + sx.add_idea(walk=old_water_road, idea_kid=IdeaKid(_desc=rain_text)) + sx.add_idea(walk=src, idea_kid=IdeaKid(_desc=mood_text)) - sx.edit_tool_attr(road=mood_road, special_road=old_rain_road) - mood_tool = sx.get_tool_kid(road=mood_road) - assert mood_tool._special_road == old_rain_road + sx.edit_idea_attr(road=mood_road, special_road=old_rain_road) + mood_idea = sx.get_idea_kid(road=mood_road) + assert mood_idea._special_road == old_rain_road # WHEN new_water_text = "h2o" new_rain_road = f"{src},{person_text},{new_water_text},{rain_text}" - sx.edit_tool_desc(old_road=old_water_road, new_desc=new_water_text) + sx.edit_idea_desc(old_road=old_water_road, new_desc=new_water_text) # THEN - # for tool_x in sx._toolroot._kids.values(): - # print(f"{tool_x._walk=} {tool_x._desc=}") - # tool_x.set_kids_empty_if_null() - # for tool_y in tool_x._kids.values(): - # print(f"{tool_y._walk=} {tool_y._desc=}") - # tool_y.set_kids_empty_if_null() - # for tool_z in tool_y._kids.values(): - # print(f"{tool_z._walk=} {tool_z._desc=}") - assert mood_tool._special_road == new_rain_road - - -def test_agent_desc_change_ChangesToolRequiredUnitsScenario1(): + # for idea_x in sx._idearoot._kids.values(): + # print(f"{idea_x._walk=} {idea_x._desc=}") + # idea_x.set_kids_empty_if_null() + # for idea_y in idea_x._kids.values(): + # print(f"{idea_y._walk=} {idea_y._desc=}") + # idea_y.set_kids_empty_if_null() + # for idea_z in idea_y._kids.values(): + # print(f"{idea_z._walk=} {idea_z._desc=}") + assert mood_idea._special_road == new_rain_road + + +def test_agent_desc_change_ChangesIdeaRequiredUnitsScenario1(): # GIVEN agent_x = get_agent_with_4_levels_and_2requireds_2acptfacts() old_weekday_text = "weekdays" old_weekday_road = f"{agent_x._desc},{old_weekday_text}" wednesday_text = "Wednesday" old_wednesday_road = f"{agent_x._desc},{old_weekday_text},{wednesday_text}" - work_tool = agent_x.get_tool_kid(f"{agent_x._desc},work") + work_idea = agent_x.get_idea_kid(f"{agent_x._desc},work") usa = f"{agent_x._desc},nation-state,USA" nationstate = f"{agent_x._desc},nation-state" # work_wk_required = RequiredUnit(base=weekday, sufffacts={wed_sufffact.need: wed_sufffact}) # nation_required = RequiredUnit(base=nationstate, sufffacts={usa_sufffact.need: usa_sufffact}) - assert len(work_tool._requiredunits) == 2 - assert work_tool._requiredunits.get(old_weekday_road) != None - wednesday_tool = agent_x.get_tool_kid(old_weekday_road) - work_weekday_required = work_tool._requiredunits.get(old_weekday_road) + assert len(work_idea._requiredunits) == 2 + assert work_idea._requiredunits.get(old_weekday_road) != None + wednesday_idea = agent_x.get_idea_kid(old_weekday_road) + work_weekday_required = work_idea._requiredunits.get(old_weekday_road) assert work_weekday_required.sufffacts.get(old_wednesday_road) != None assert ( work_weekday_required.sufffacts.get(old_wednesday_road).need @@ -236,46 +236,46 @@ def test_agent_desc_change_ChangesToolRequiredUnitsScenario1(): new_weekday_text = "days of week" new_weekday_road = f"{agent_x._desc},{new_weekday_text}" new_wednesday_road = f"{agent_x._desc},{new_weekday_text},{wednesday_text}" - assert work_tool._requiredunits.get(new_weekday_text) is None + assert work_idea._requiredunits.get(new_weekday_text) is None # WHEN - # for key_x, required_x in work_tool._requiredunits.items(): + # for key_x, required_x in work_idea._requiredunits.items(): # print(f"Before {key_x=} {required_x.base=}") - print(f"BEFORE {wednesday_tool._desc=}") - print(f"BEFORE {wednesday_tool._walk=}") - agent_x.edit_tool_desc(old_road=old_weekday_road, new_desc=new_weekday_text) - # for key_x, required_x in work_tool._requiredunits.items(): + print(f"BEFORE {wednesday_idea._desc=}") + print(f"BEFORE {wednesday_idea._walk=}") + agent_x.edit_idea_desc(old_road=old_weekday_road, new_desc=new_weekday_text) + # for key_x, required_x in work_idea._requiredunits.items(): # print(f"AFTER {key_x=} {required_x.base=}") - print(f"AFTER {wednesday_tool._desc=}") - print(f"AFTER {wednesday_tool._walk=}") + print(f"AFTER {wednesday_idea._desc=}") + print(f"AFTER {wednesday_idea._walk=}") # THEN - assert work_tool._requiredunits.get(new_weekday_road) != None - assert work_tool._requiredunits.get(old_weekday_road) is None - work_weekday_required = work_tool._requiredunits.get(new_weekday_road) + assert work_idea._requiredunits.get(new_weekday_road) != None + assert work_idea._requiredunits.get(old_weekday_road) is None + work_weekday_required = work_idea._requiredunits.get(new_weekday_road) assert work_weekday_required.sufffacts.get(new_wednesday_road) != None assert ( work_weekday_required.sufffacts.get(new_wednesday_road).need == new_wednesday_road ) - assert len(work_tool._requiredunits) == 2 + assert len(work_idea._requiredunits) == 2 -def test_agent_agent_and_toolroot_desc_edit_CorrectlyChangesBoth(): +def test_agent_agent_and_idearoot_desc_edit_CorrectlyChangesBoth(): # GIVEN agent_x = get_agent_with_4_levels_and_2requireds_2acptfacts() old_desc = "src" assert agent_x._desc == old_desc - assert agent_x._toolroot._desc == old_desc + assert agent_x._idearoot._desc == old_desc mid_desc1 = "tim" - agent_x.edit_tool_desc(old_road=old_desc, new_desc=mid_desc1) + agent_x.edit_idea_desc(old_road=old_desc, new_desc=mid_desc1) assert agent_x._desc == old_desc - assert agent_x._toolroot._desc == mid_desc1 + assert agent_x._idearoot._desc == mid_desc1 # WHEN new_desc2 = "bob" - agent_x.agent_and_toolroot_desc_edit(new_desc=new_desc2) + agent_x.agent_and_idearoot_desc_edit(new_desc=new_desc2) # THEN assert agent_x._desc == new_desc2 - assert agent_x._toolroot._desc == new_desc2 + assert agent_x._idearoot._desc == new_desc2 diff --git a/src/agent/test_agent/test_agent_groups.py b/src/agent/test_agent/test_agent_groups.py index 862935fc7..09d41ceb9 100644 --- a/src/agent/test_agent/test_agent_groups.py +++ b/src/agent/test_agent/test_agent_groups.py @@ -1,6 +1,6 @@ from src.agent.group import GroupName, grouplink_shop, groupunit_shop from src.agent.member import MemberName, memberunit_shop, memberlink_shop -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from src.agent.required import Road from src.agent.examples.example_agents import agent_v001 as examples_agent_v001 from src.agent.agent import AgentUnit @@ -63,17 +63,17 @@ def test_example_has_groups(): # WHEN lw_x.set_agent_metrics() - tool_dict = lw_x._tool_dict + idea_dict = lw_x._idea_dict # THEN - db_tool = tool_dict.get("TlME,D&B") - print(f"{db_tool._desc=} {db_tool._grouplinks=}") - assert len(db_tool._grouplinks) == 3 - # for tool_key in tool_dict: - # print(f"{tool_key=}") - # if tool._desc == "D&B": - # print(f"{tool._desc=} {tool._grouplinks=}") - # db_grouplink_len = len(tool._grouplinks) + db_idea = idea_dict.get("TlME,D&B") + print(f"{db_idea._desc=} {db_idea._grouplinks=}") + assert len(db_idea._grouplinks) == 3 + # for idea_key in idea_dict: + # print(f"{idea_key=}") + # if idea._desc == "D&B": + # print(f"{idea._desc=} {idea._grouplinks=}") + # db_grouplink_len = len(idea._grouplinks) # assert db_grouplink_len == 3 @@ -91,37 +91,37 @@ def test_agent_set_grouplink_correctly_sets_grouplinks(): assert len(lw_x._members) == 3 assert len(lw_x._groups) == 3 swim_text = "swim" - lw_x.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=prom_text) + lw_x.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=prom_text) grouplink_rico = grouplink_shop(name=GroupName(rico_text), creditor_weight=10) grouplink_carm = grouplink_shop(name=GroupName(carm_text), creditor_weight=10) grouplink_patr = grouplink_shop(name=GroupName(patr_text), creditor_weight=10) swim_road = f"{prom_text},{swim_text}" - lw_x.edit_tool_attr(road=swim_road, grouplink=grouplink_rico) - lw_x.edit_tool_attr(road=swim_road, grouplink=grouplink_carm) - lw_x.edit_tool_attr(road=swim_road, grouplink=grouplink_patr) + lw_x.edit_idea_attr(road=swim_road, grouplink=grouplink_rico) + lw_x.edit_idea_attr(road=swim_road, grouplink=grouplink_carm) + lw_x.edit_idea_attr(road=swim_road, grouplink=grouplink_patr) - assert lw_x._toolroot._grouplinks in (None, {}) - assert len(lw_x._toolroot._kids[swim_text]._grouplinks) == 3 + assert lw_x._idearoot._grouplinks in (None, {}) + assert len(lw_x._idearoot._kids[swim_text]._grouplinks) == 3 - lw_x.add_tool(tool_kid=ToolKid(_desc="streets"), walk=swim_road) + lw_x.add_idea(idea_kid=IdeaKid(_desc="streets"), walk=swim_road) # WHEN - tool_list = lw_x.get_tool_list() + idea_list = lw_x.get_idea_list() # THEN - tool_prom = tool_list[1] - tool_prom_swim = tool_list[2] + idea_prom = idea_list[1] + idea_prom_swim = idea_list[2] - assert len(tool_prom._grouplinks) == 3 - assert len(tool_prom._groupheirs) == 3 - assert tool_prom_swim._grouplinks in (None, {}) - assert len(tool_prom_swim._groupheirs) == 3 + assert len(idea_prom._grouplinks) == 3 + assert len(idea_prom._groupheirs) == 3 + assert idea_prom_swim._grouplinks in (None, {}) + assert len(idea_prom_swim._groupheirs) == 3 - print(f"{len(tool_list)}") - print(f"{tool_list[0]._grouplinks}") - print(f"{tool_list[0]._groupheirs}") - print(f"{tool_list[1]._groupheirs}") - assert len(lw_x._toolroot._kids["swim"]._groupheirs) == 3 + print(f"{len(idea_list)}") + print(f"{idea_list[0]._grouplinks}") + print(f"{idea_list[0]._groupheirs}") + print(f"{idea_list[1]._groupheirs}") + assert len(lw_x._idearoot._kids["swim"]._groupheirs) == 3 def test_agent_set_grouplink_correctly_deletes_grouplinks(): @@ -138,39 +138,39 @@ def test_agent_set_grouplink_correctly_deletes_grouplinks(): swim_text = "swim" swim_road = f"{prom_text},{swim_text}" - a_x.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=prom_text) + a_x.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=prom_text) grouplink_rico = grouplink_shop(name=GroupName(rico_text), creditor_weight=10) grouplink_carm = grouplink_shop(name=GroupName(carm_text), creditor_weight=10) grouplink_patr = grouplink_shop(name=GroupName(patr_text), creditor_weight=10) - swim_tool = a_x.get_tool_kid(road=swim_road) - a_x.edit_tool_attr(road=swim_road, grouplink=grouplink_rico) - a_x.edit_tool_attr(road=swim_road, grouplink=grouplink_carm) - a_x.edit_tool_attr(road=swim_road, grouplink=grouplink_patr) + swim_idea = a_x.get_idea_kid(road=swim_road) + a_x.edit_idea_attr(road=swim_road, grouplink=grouplink_rico) + a_x.edit_idea_attr(road=swim_road, grouplink=grouplink_carm) + a_x.edit_idea_attr(road=swim_road, grouplink=grouplink_patr) - # tool_list = a_x.get_tool_list() - # tool_prom = tool_list[1] - assert len(swim_tool._grouplinks) == 3 - assert len(swim_tool._groupheirs) == 3 + # idea_list = a_x.get_idea_list() + # idea_prom = idea_list[1] + assert len(swim_idea._grouplinks) == 3 + assert len(swim_idea._groupheirs) == 3 - # print(f"{len(tool_list)}") - # print(f"{tool_list[0]._grouplinks}") - # print(f"{tool_list[0]._groupheirs}") - # print(f"{tool_list[1]._groupheirs}") - assert len(a_x._toolroot._kids[swim_text]._grouplinks) == 3 - assert len(a_x._toolroot._kids[swim_text]._groupheirs) == 3 + # print(f"{len(idea_list)}") + # print(f"{idea_list[0]._grouplinks}") + # print(f"{idea_list[0]._groupheirs}") + # print(f"{idea_list[1]._groupheirs}") + assert len(a_x._idearoot._kids[swim_text]._grouplinks) == 3 + assert len(a_x._idearoot._kids[swim_text]._groupheirs) == 3 # WHEN - a_x.edit_tool_attr(road=swim_road, grouplink_del=rico_text) + a_x.edit_idea_attr(road=swim_road, grouplink_del=rico_text) # THEN - swim_tool = a_x.get_tool_kid(road=swim_road) - print(f"{swim_tool._desc=}") - print(f"{swim_tool._grouplinks=}") - print(f"{swim_tool._groupheirs=}") + swim_idea = a_x.get_idea_kid(road=swim_road) + print(f"{swim_idea._desc=}") + print(f"{swim_idea._grouplinks=}") + print(f"{swim_idea._groupheirs=}") - assert len(a_x._toolroot._kids[swim_text]._grouplinks) == 2 - assert len(a_x._toolroot._kids[swim_text]._groupheirs) == 2 + assert len(a_x._idearoot._kids[swim_text]._grouplinks) == 2 + assert len(a_x._idearoot._kids[swim_text]._groupheirs) == 2 def test_agent_set_grouplink_CorrectlyCalculatesInheritedGroupLinkAgentImportance(): @@ -185,21 +185,21 @@ def test_agent_set_grouplink_CorrectlyCalculatesInheritedGroupLinkAgentImportanc blink_rico = grouplink_shop(name=rico_text, creditor_weight=20, debtor_weight=6) blink_carm = grouplink_shop(name=carm_text, creditor_weight=10, debtor_weight=1) blink_patr = grouplink_shop(name=patr_text, creditor_weight=10) - a_x._toolroot.set_grouplink(grouplink=blink_rico) - a_x._toolroot.set_grouplink(grouplink=blink_carm) - a_x._toolroot.set_grouplink(grouplink=blink_patr) - assert len(a_x._toolroot._grouplinks) == 3 + a_x._idearoot.set_grouplink(grouplink=blink_rico) + a_x._idearoot.set_grouplink(grouplink=blink_carm) + a_x._idearoot.set_grouplink(grouplink=blink_patr) + assert len(a_x._idearoot._grouplinks) == 3 # WHEN - tool_list = a_x.get_tool_list() + idea_list = a_x.get_idea_list() # THEN - tool_prom = tool_list[0] - assert len(tool_prom._groupheirs) == 3 + idea_prom = idea_list[0] + assert len(idea_prom._groupheirs) == 3 - bheir_rico = tool_prom._groupheirs.get(rico_text) - bheir_carm = tool_prom._groupheirs.get(carm_text) - bheir_patr = tool_prom._groupheirs.get(patr_text) + bheir_rico = idea_prom._groupheirs.get(rico_text) + bheir_carm = idea_prom._groupheirs.get(carm_text) + bheir_patr = idea_prom._groupheirs.get(patr_text) assert bheir_rico._agent_credit == 0.5 assert bheir_rico._agent_debt == 0.75 assert bheir_carm._agent_credit == 0.25 @@ -214,7 +214,7 @@ def test_agent_set_grouplink_CorrectlyCalculatesInheritedGroupLinkAgentImportanc # agent_credit_sum = 0 # agent_debt_sum = 0 - # for group in a_x._toolroot._groupheirs.values(): + # for group in a_x._idearoot._groupheirs.values(): # print(f"{group=}") # assert group._agent_credit != None # assert group._agent_credit in [0.25, 0.5] @@ -227,7 +227,7 @@ def test_agent_set_grouplink_CorrectlyCalculatesInheritedGroupLinkAgentImportanc # assert agent_debt_sum == 1 -def test_agent_get_tool_list_CorrectlyCalculates1LevelAgentGroupAgentImportance(): +def test_agent_get_idea_list_CorrectlyCalculates1LevelAgentGroupAgentImportance(): # GIVEN prom_text = "prom" a_x = AgentUnit(_desc=prom_text) @@ -241,9 +241,9 @@ def test_agent_get_tool_list_CorrectlyCalculates1LevelAgentGroupAgentImportance( blink_rico = grouplink_shop(name=rico_text, creditor_weight=20, debtor_weight=6) blink_carm = grouplink_shop(name=carm_text, creditor_weight=10, debtor_weight=1) blink_patr = grouplink_shop(name=patr_text, creditor_weight=10) - a_x._toolroot.set_grouplink(grouplink=blink_rico) - a_x._toolroot.set_grouplink(grouplink=blink_carm) - a_x._toolroot.set_grouplink(grouplink=blink_patr) + a_x._idearoot.set_grouplink(grouplink=blink_rico) + a_x._idearoot.set_grouplink(grouplink=blink_carm) + a_x._idearoot.set_grouplink(grouplink=blink_patr) assert len(a_x._groups) == 3 @@ -269,7 +269,7 @@ def test_agent_get_tool_list_CorrectlyCalculates1LevelAgentGroupAgentImportance( # WHEN a_x.set_memberunit(memberunit=memberunit_shop(name=MemberName(sele_text))) bl_sele = grouplink_shop(name=sele_text, creditor_weight=37) - a_x._toolroot.set_grouplink(grouplink=bl_sele) + a_x._idearoot.set_grouplink(grouplink=bl_sele) assert len(a_x._groups) == 4 a_x.set_agent_metrics() @@ -299,12 +299,12 @@ def test_agent_get_tool_list_CorrectlyCalculates1LevelAgentGroupAgentImportance( ) -def test_agent_get_tool_list_CorrectlyCalculates3levelAgentGroupAgentImportance(): +def test_agent_get_idea_list_CorrectlyCalculates3levelAgentGroupAgentImportance(): # GIVEN prom_text = "prom" a_x = AgentUnit(_desc=prom_text) swim_text = "swim" - a_x.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=prom_text) + a_x.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=prom_text) rico_text = "rico" carm_text = "carmen" @@ -315,9 +315,9 @@ def test_agent_get_tool_list_CorrectlyCalculates3levelAgentGroupAgentImportance( rico_grouplink = grouplink_shop(name=rico_text, creditor_weight=20, debtor_weight=6) carm_grouplink = grouplink_shop(name=carm_text, creditor_weight=10, debtor_weight=1) parm_grouplink = grouplink_shop(name=patr_text, creditor_weight=10) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=rico_grouplink) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=carm_grouplink) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=parm_grouplink) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=rico_grouplink) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=carm_grouplink) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=parm_grouplink) assert len(a_x._groups) == 3 # WHEN @@ -340,12 +340,12 @@ def test_agent_get_tool_list_CorrectlyCalculates3levelAgentGroupAgentImportance( assert group_rico._agent_debt + group_carm._agent_debt + group_patr._agent_debt == 1 -def test_agent_get_tool_list_CorrectlyCalculatesGroupAgentImportanceLWwithGroupEmptyBranch(): +def test_agent_get_idea_list_CorrectlyCalculatesGroupAgentImportanceLWwithGroupEmptyBranch(): # GIVEN prom_text = "prom" a_x = AgentUnit(_desc=prom_text) swim_text = "swim" - a_x.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=prom_text) + a_x.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=prom_text) rico_text = "rico" carm_text = "carmen" @@ -356,38 +356,38 @@ def test_agent_get_tool_list_CorrectlyCalculatesGroupAgentImportanceLWwithGroupE rico_grouplink = grouplink_shop(name=rico_text, creditor_weight=20, debtor_weight=6) carm_grouplink = grouplink_shop(name=carm_text, creditor_weight=10, debtor_weight=1) parm_grouplink = grouplink_shop(name=patr_text, creditor_weight=10) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=rico_grouplink) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=carm_grouplink) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=parm_grouplink) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=rico_grouplink) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=carm_grouplink) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=parm_grouplink) # no grouplinks attached to this one - a_x.add_tool(tool_kid=ToolKid(_desc="hunt", _weight=3), walk="prom") + a_x.add_idea(idea_kid=IdeaKid(_desc="hunt", _weight=3), walk="prom") - assert a_x._toolroot._grouplinks is None + assert a_x._idearoot._grouplinks is None # WHEN a_x.set_agent_metrics() # THEN - assert a_x._toolroot._grouplinks == {} + assert a_x._idearoot._grouplinks == {} with pytest_raises(Exception) as excinfo: - a_x._toolroot._grouplinks[rico_text] + a_x._idearoot._grouplinks[rico_text] assert str(excinfo.value) == f"'{rico_text}'" with pytest_raises(Exception) as excinfo: - a_x._toolroot._grouplinks[carm_text] + a_x._idearoot._grouplinks[carm_text] assert str(excinfo.value) == f"'{carm_text}'" with pytest_raises(Exception) as excinfo: - a_x._toolroot._grouplinks[patr_text] + a_x._idearoot._grouplinks[patr_text] assert str(excinfo.value) == f"'{patr_text}'" with pytest_raises(Exception) as excinfo: - a_x._toolroot._kids["hunt"]._groupheirs[rico_text] + a_x._idearoot._kids["hunt"]._groupheirs[rico_text] assert str(excinfo.value) == f"'{rico_text}'" with pytest_raises(Exception) as excinfo: - a_x._toolroot._kids["hunt"]._groupheirs[carm_text] + a_x._idearoot._kids["hunt"]._groupheirs[carm_text] assert str(excinfo.value) == f"'{carm_text}'" with pytest_raises(Exception) as excinfo: - a_x._toolroot._kids["hunt"]._groupheirs[patr_text] + a_x._idearoot._kids["hunt"]._groupheirs[patr_text] assert str(excinfo.value) == f"'{patr_text}'" # THEN @@ -515,16 +515,16 @@ def test_agent_edit_groupUnit_name_CorrectlyChangesGroupLinks(): outdoor_road = Road(f"{a_x._desc},{outdoor_text}") camping_text = "camping" camping_road = Road(f"{a_x._desc},{outdoor_text},{camping_text}") - a_x.add_tool(walk=outdoor_road, tool_kid=ToolKid(_desc=camping_text)) + a_x.add_idea(walk=outdoor_road, idea_kid=IdeaKid(_desc=camping_text)) - camping_tool = a_x.get_tool_kid(camping_road) + camping_idea = a_x.get_idea_kid(camping_road) swim_grouplink = grouplink_shop( name=swim_groupunit.name, creditor_weight=5, debtor_weight=3 ) - camping_tool.set_grouplink(swim_grouplink) - assert camping_tool._grouplinks.get(swim_text) != None - assert camping_tool._grouplinks.get(swim_text).creditor_weight == 5 - assert camping_tool._grouplinks.get(swim_text).debtor_weight == 3 + camping_idea.set_grouplink(swim_grouplink) + assert camping_idea._grouplinks.get(swim_text) != None + assert camping_idea._grouplinks.get(swim_text).creditor_weight == 5 + assert camping_idea._grouplinks.get(swim_text).debtor_weight == 3 # WHEN jog_text = "jog" @@ -533,10 +533,10 @@ def test_agent_edit_groupUnit_name_CorrectlyChangesGroupLinks(): ) # THEN - assert camping_tool._grouplinks.get(swim_text) is None - assert camping_tool._grouplinks.get(jog_text) != None - assert camping_tool._grouplinks.get(jog_text).creditor_weight == 5 - assert camping_tool._grouplinks.get(jog_text).debtor_weight == 3 + assert camping_idea._grouplinks.get(swim_text) is None + assert camping_idea._grouplinks.get(jog_text) != None + assert camping_idea._grouplinks.get(jog_text).creditor_weight == 5 + assert camping_idea._grouplinks.get(jog_text).debtor_weight == 3 def test_agent_edit_groupUnit_name_CorrectlyMeldsGroupLinesGroupLinksGroupHeirs(): @@ -556,23 +556,23 @@ def test_agent_edit_groupUnit_name_CorrectlyMeldsGroupLinesGroupLinksGroupHeirs( outdoor_road = Road(f"{a_x._desc},{outdoor_text}") camping_text = "camping" camping_road = Road(f"{a_x._desc},{outdoor_text},{camping_text}") - a_x.add_tool(walk=outdoor_road, tool_kid=ToolKid(_desc=camping_text)) + a_x.add_idea(walk=outdoor_road, idea_kid=IdeaKid(_desc=camping_text)) - camping_tool = a_x.get_tool_kid(camping_road) + camping_idea = a_x.get_idea_kid(camping_road) swim_grouplink = grouplink_shop( name=swim_groupunit.name, creditor_weight=5, debtor_weight=3 ) - camping_tool.set_grouplink(swim_grouplink) + camping_idea.set_grouplink(swim_grouplink) jog_grouplink = grouplink_shop( name=jog_groupunit.name, creditor_weight=7, debtor_weight=10 ) - camping_tool.set_grouplink(jog_grouplink) - assert camping_tool._grouplinks.get(swim_text) != None - assert camping_tool._grouplinks.get(swim_text).creditor_weight == 5 - assert camping_tool._grouplinks.get(swim_text).debtor_weight == 3 - assert camping_tool._grouplinks.get(jog_text) != None - assert camping_tool._grouplinks.get(jog_text).creditor_weight == 7 - assert camping_tool._grouplinks.get(jog_text).debtor_weight == 10 + camping_idea.set_grouplink(jog_grouplink) + assert camping_idea._grouplinks.get(swim_text) != None + assert camping_idea._grouplinks.get(swim_text).creditor_weight == 5 + assert camping_idea._grouplinks.get(swim_text).debtor_weight == 3 + assert camping_idea._grouplinks.get(jog_text) != None + assert camping_idea._grouplinks.get(jog_text).creditor_weight == 7 + assert camping_idea._grouplinks.get(jog_text).debtor_weight == 10 # WHEN a_x.edit_groupunit_name( @@ -580,32 +580,32 @@ def test_agent_edit_groupUnit_name_CorrectlyMeldsGroupLinesGroupLinksGroupHeirs( ) # THEN - assert camping_tool._grouplinks.get(swim_text) is None - assert camping_tool._grouplinks.get(jog_text) != None - assert camping_tool._grouplinks.get(jog_text).creditor_weight == 12 - assert camping_tool._grouplinks.get(jog_text).debtor_weight == 13 + assert camping_idea._grouplinks.get(swim_text) is None + assert camping_idea._grouplinks.get(jog_text) != None + assert camping_idea._grouplinks.get(jog_text).creditor_weight == 12 + assert camping_idea._grouplinks.get(jog_text).debtor_weight == 13 -def test_agent_add_tool_CreatesMissingGroups(): +def test_agent_add_idea_CreatesMissingGroups(): # GIVEN src_text = "src" a_x = AgentUnit(_desc=src_text) a_x.set_groupunits_empty_if_null() - new_tool_parent_road = f"{src_text},work,cleaning" + new_idea_parent_road = f"{src_text},work,cleaning" clean_cookery_text = "clean_cookery" - clean_cookery_tool = ToolKid(_weight=40, _desc=clean_cookery_text, promise=True) + clean_cookery_idea = IdeaKid(_weight=40, _desc=clean_cookery_text, promise=True) family_text = "family" grouplink_z = grouplink_shop(name=family_text) - clean_cookery_tool.set_grouplink(grouplink=grouplink_z) + clean_cookery_idea.set_grouplink(grouplink=grouplink_z) assert len(a_x._groups) == 0 assert a_x._groups.get(family_text) is None # WHEN - a_x.add_tool( - tool_kid=clean_cookery_tool, - walk=new_tool_parent_road, - create_missing_tools_groups=True, + a_x.add_idea( + idea_kid=clean_cookery_idea, + walk=new_idea_parent_road, + create_missing_ideas_groups=True, ) # THEN @@ -614,18 +614,18 @@ def test_agent_add_tool_CreatesMissingGroups(): assert a_x._groups.get(family_text)._members in (None, {}) -def test_agent_add_tool_DoesNotOverwriteGroups(): +def test_agent_add_idea_DoesNotOverwriteGroups(): # GIVEN src_text = "src" a_x = AgentUnit(_desc=src_text) a_x.set_groupunits_empty_if_null() - new_tool_parent_road = f"{src_text},work,cleaning" + new_idea_parent_road = f"{src_text},work,cleaning" clean_cookery_text = "clean_cookery" - clean_cookery_tool = ToolKid(_weight=40, _desc=clean_cookery_text, promise=True) + clean_cookery_idea = IdeaKid(_weight=40, _desc=clean_cookery_text, promise=True) family_text = "family" grouplink_z = grouplink_shop(name=family_text) - clean_cookery_tool.set_grouplink(grouplink=grouplink_z) + clean_cookery_idea.set_grouplink(grouplink=grouplink_z) groupunit_z = groupunit_shop(name=family_text) groupunit_z.set_memberlink(memberlink=memberlink_shop(name="ann1")) @@ -638,10 +638,10 @@ def test_agent_add_tool_DoesNotOverwriteGroups(): assert len(a_x._groups.get(family_text)._members) == 2 # WHEN - a_x.add_tool( - tool_kid=clean_cookery_tool, - walk=new_tool_parent_road, - create_missing_tools_groups=True, + a_x.add_idea( + idea_kid=clean_cookery_idea, + walk=new_idea_parent_road, + create_missing_ideas_groups=True, ) # THEN diff --git a/src/agent/test_agent/test_agent_idea_crud.py b/src/agent/test_agent/test_agent_idea_crud.py new file mode 100644 index 000000000..5dd56f0cc --- /dev/null +++ b/src/agent/test_agent/test_agent_idea_crud.py @@ -0,0 +1,535 @@ +from src.agent.examples.example_agents import get_agent_with_4_levels +from src.agent.idea import IdeaKid +from src.agent.required import RequiredUnit, acptfactunit_shop +from src.agent.agent import AgentUnit +from src.agent.group import grouplink_shop +from pytest import raises as pytest_raises +from src.agent.road import Road + + +def test_root_has_kids(): + # GIVEN + agent_x = AgentUnit(_desc="prom") + idearoot_x = agent_x._idearoot + idea1 = IdeaKid(_weight=30, _desc="work") + idea2 = IdeaKid(_weight=40, _desc="ulty") + + # WHEN + agent_x.add_idea(idea_kid=idea1, walk=agent_x._desc) + agent_x.add_idea(idea_kid=idea2, walk=agent_x._desc) + + # THEN + assert idearoot_x._weight == 1 + assert idearoot_x._kids + assert len(idearoot_x._kids) == 2 + + +def test_kid_can_have_kids(): + # GIVEN/WHEN + agent_x = get_agent_with_4_levels() + + # THEN + assert agent_x._weight == 10 + assert agent_x._idearoot._kids + print(f"{len(agent_x._idearoot._kids)=} {agent_x._idearoot._walk=}") + assert agent_x.get_level_count(level=0) == 1 + weekdays_kids = agent_x._idearoot._kids["weekdays"]._kids + weekdays_len = len(weekdays_kids) + print(f"{weekdays_len=} {agent_x._idearoot._walk=}") + # for idea in weekdays_kids.values(): + # print(f"{idea._desc=}") + assert agent_x.get_node_count() == 17 + assert agent_x.get_level_count(level=1) == 4 + assert agent_x.get_level_count(level=2) == 10 + assert agent_x.get_level_count(level=3) == 2 + + +def test_agent_add_idea_CanAddKidToRootIdea(): + # GIVEN + agent_x = get_agent_with_4_levels() + assert agent_x.get_node_count() == 17 + assert agent_x.get_level_count(level=1) == 4 + + new_idea_parent_road = agent_x._desc + new_idea = IdeaKid(_weight=40, _desc="new_idea") + + # WHEN + agent_x.add_idea(idea_kid=new_idea, walk=new_idea_parent_road) + + # THEN + print(f"{(agent_x._desc == new_idea_parent_road[0])=}") + print(f"{(len(new_idea_parent_road) == 1)=}") + assert agent_x.get_node_count() == 18 + assert agent_x.get_level_count(level=1) == 5 + + +def test_agent_add_idea_CanAddKidToKidIdea(): + # GIVEN + agent_x = get_agent_with_4_levels() + assert agent_x.get_node_count() == 17 + assert agent_x.get_level_count(level=2) == 10 + + new_idea_parent_road = f"{agent_x._desc},work" + new_idea = IdeaKid(_weight=40, _desc="new_york") + + # WHEN + agent_x.add_idea(idea_kid=new_idea, walk=new_idea_parent_road) + + # THEN + # print(f"{(agent_x._desc == new_idea_parent_road[0])=}") + # print(agent_x._idearoot._kids["work"]) + # print(f"{(len(new_idea_parent_road) == 1)=}") + assert agent_x.get_node_count() == 18 + assert agent_x.get_level_count(level=2) == 11 + assert ( + agent_x._idearoot._kids["work"]._kids["new_york"]._walk + == f"{agent_x._desc},work" + ) + agent_x._idearoot._kids["work"]._kids["new_york"].set_road(parent_road="testing") + assert agent_x._idearoot._kids["work"]._kids["new_york"]._walk == "testing" + assert agent_x.get_agenda_items + + +def test_agent_add_idea_CanAddKidToGrandkidIdea(): + # GIVEN + agent_x = get_agent_with_4_levels() + assert agent_x.get_node_count() == 17 + assert agent_x.get_level_count(level=3) == 2 + new_idea_parent_road = f"{agent_x._desc},weekdays,Wednesday" + new_idea = IdeaKid(_weight=40, _desc="new_idea") + + # WHEN + agent_x.add_idea(idea_kid=new_idea, walk=new_idea_parent_road) + + # THEN + print(f"{(agent_x._desc == new_idea_parent_road[0])=}") + print(agent_x._idearoot._kids["work"]) + print(f"{(len(new_idea_parent_road) == 1)=}") + assert agent_x.get_node_count() == 18 + assert agent_x.get_level_count(level=3) == 3 + + +def test_agent_add_idea_CanCreateRoadToGrandkidIdea(): + # GIVEN + agent_x = get_agent_with_4_levels() + assert agent_x.get_node_count() == 17 + assert agent_x.get_level_count(level=3) == 2 + new_idea_parent_road = f"{agent_x._desc},ww2,battles,coralsea" + new_idea = IdeaKid(_weight=40, _desc="USS Saratoga") + + # WHEN + agent_x.add_idea(idea_kid=new_idea, walk=new_idea_parent_road) + + # THEN + print(agent_x._idearoot._kids["ww2"]) + print(f"{(len(new_idea_parent_road) == 1)=}") + assert agent_x._idearoot._kids["ww2"]._desc == "ww2" + assert agent_x._idearoot._kids["ww2"]._kids["battles"]._desc == "battles" + assert agent_x.get_node_count() == 21 + assert agent_x.get_level_count(level=3) == 3 + + +def test_agent_add_idea_creates_requireds_ideas(): + # GIVEN + agent_x = get_agent_with_4_levels() + assert agent_x.get_node_count() == 17 + assert agent_x.get_level_count(level=3) == 2 + src_text = agent_x._idearoot._desc + new_idea_parent_road = f"{src_text},work,cleaning" + clean_cookery_text = "clean_cookery" + clean_cookery_idea = IdeaKid(_weight=40, _desc=clean_cookery_text, promise=True) + + buildings_text = "buildings" + buildings_road = Road(f"{src_text},{buildings_text}") + cookery_room_text = "cookery" + cookery_room_road = Road(f"{src_text},{buildings_text},{cookery_room_text}") + cookery_dirty_text = "dirty" + cookery_dirty_road = Road(f"{cookery_room_road},{cookery_dirty_text}") + required_x = RequiredUnit(base=cookery_room_road, sufffacts={}) + required_x.set_sufffact(sufffact=cookery_dirty_road) + clean_cookery_idea.set_required_unit(required=required_x) + + assert agent_x._idearoot._kids.get(buildings_text) is None + + # WHEN + agent_x.add_idea( + idea_kid=clean_cookery_idea, + walk=new_idea_parent_road, + create_missing_ideas_groups=True, + ) + + # THEN + print(f"{(len(new_idea_parent_road) == 1)=}") + # for idea_kid in agent_x._idearoot._kids.values(): + # print(f"{idea_kid._desc=}") + assert agent_x._idearoot._kids.get(buildings_text) != None + assert agent_x.get_idea_kid(road=buildings_road) != None + assert agent_x.get_idea_kid(road=cookery_dirty_road) != None + assert agent_x.get_node_count() == 22 + assert agent_x.get_level_count(level=3) == 4 + + +def test_agent_idearoot_is_heir_CorrectlyChecksLineage(): + agent_x = get_agent_with_4_levels() + sunday_road = f"{agent_x._desc},weekdays,Sunday" + weekday_road = f"{agent_x._desc},weekdays" + assert agent_x._idearoot.is_heir(src=weekday_road, heir=weekday_road) + assert agent_x._idearoot.is_heir(src=weekday_road, heir=sunday_road) + assert agent_x._idearoot.is_heir(src=sunday_road, heir=weekday_road) == False + + +def test_agent_del_idea_kid_IdeaLevel0CannotBeDeleted(): + # Given + agent_x = get_agent_with_4_levels() + root_road = f"{agent_x._desc}" + + # When/Then + with pytest_raises(Exception) as excinfo: + agent_x.del_idea_kid(road=root_road) + assert str(excinfo.value) == "Object cannot delete itself" + + +def test_agent_del_idea_kid_IdeaLevel1CanBeDeleted_ChildrenDeleted(): + # Given + agent_x = get_agent_with_4_levels() + weekdays_road = f"{agent_x._desc},weekdays" + sunday_road = f"{agent_x._desc},weekdays,Sunday" + assert agent_x.get_idea_kid(road=weekdays_road) + assert agent_x.get_idea_kid(road=sunday_road) + + # When + agent_x.del_idea_kid(road=weekdays_road) + + # Then + with pytest_raises(Exception) as excinfo: + agent_x.get_idea_kid(road=weekdays_road) + assert ( + str(excinfo.value) + == f"Getting idea_desc='weekdays' failed no item at '{weekdays_road}'" + ) + new_sunday_road = f"{agent_x._desc},Sunday" + with pytest_raises(Exception) as excinfo: + agent_x.get_idea_kid(road=new_sunday_road) + assert ( + str(excinfo.value) + == f"Getting idea_desc='Sunday' failed no item at '{new_sunday_road}'" + ) + + +def test_agent_del_idea_kid_IdeaLevel1CanBeDeleted_ChildrenInherited(): + # Given + agent_x = get_agent_with_4_levels() + weekdays_road = f"{agent_x._desc},weekdays" + old_sunday_road = f"{agent_x._desc},weekdays,Sunday" + assert agent_x.get_idea_kid(road=old_sunday_road) + + # When + agent_x.del_idea_kid(road=weekdays_road, del_children=False) + + # Then + with pytest_raises(Exception) as excinfo: + agent_x.get_idea_kid(road=old_sunday_road) + assert ( + str(excinfo.value) + == f"Getting idea_desc='Sunday' failed no item at '{old_sunday_road}'" + ) + new_sunday_road = f"{agent_x._desc},Sunday" + assert agent_x.get_idea_kid(road=new_sunday_road) + new_sunday_idea = agent_x.get_idea_kid(road=new_sunday_road) + assert new_sunday_idea._walk == f"{agent_x._desc}" + + +def test_agent_del_idea_kid_IdeaLevel2CanBeDeleted_ChildrenDeleted(): + # Given + agent_x = get_agent_with_4_levels() + monday_road = f"{agent_x._desc},weekdays,Monday" + assert agent_x.get_idea_kid(road=monday_road) + + # When + agent_x.del_idea_kid(road=monday_road) + + # Then + with pytest_raises(Exception) as excinfo: + agent_x.get_idea_kid(road=monday_road) + assert ( + str(excinfo.value) + == f"Getting idea_desc='Monday' failed no item at '{monday_road}'" + ) + + +def test_agent_del_idea_kid_IdeaLevelNCanBeDeleted_ChildrenDeleted(): + # Given + agent_x = get_agent_with_4_levels() + states = "nation-state" + USA = "USA" + Texas = "Texas" + texas_road = f"{agent_x._desc},{states},{USA},{Texas}" + assert agent_x.get_idea_kid(road=texas_road) + + # When + agent_x.del_idea_kid(road=texas_road) + + # Then + with pytest_raises(Exception) as excinfo: + agent_x.get_idea_kid(road=texas_road) + assert ( + str(excinfo.value) + == f"Getting idea_desc='Texas' failed no item at '{texas_road}'" + ) + + +def test_agent_edit_idea_attr_IsAbleToEditAnyAncestor_Idea(): + agent_x = get_agent_with_4_levels() + work_text = "work" + work_road = f"{agent_x._desc},{work_text}" + print(f"{work_road=}") + current_weight = agent_x._idearoot._kids[work_text]._weight + assert current_weight == 30 + agent_x.edit_idea_attr(road=work_road, weight=23) + new_weight = agent_x._idearoot._kids[work_text]._weight + assert new_weight == 23 + + # uid: int = None, + agent_x._idearoot._kids[work_text]._uid = 34 + uid_curr = agent_x._idearoot._kids[work_text]._uid + assert uid_curr == 34 + agent_x.edit_idea_attr(road=work_road, uid=23) + uid_new = agent_x._idearoot._kids[work_text]._uid + assert uid_new == 23 + + # begin: float = None, + # close: float = None, + agent_x._idearoot._kids[work_text]._begin = 39 + begin_curr = agent_x._idearoot._kids[work_text]._begin + assert begin_curr == 39 + agent_x._idearoot._kids[work_text]._close = 43 + close_curr = agent_x._idearoot._kids[work_text]._close + assert close_curr == 43 + agent_x.edit_idea_attr(road=work_road, begin=25, close=29) + assert agent_x._idearoot._kids[work_text]._begin == 25 + assert agent_x._idearoot._kids[work_text]._close == 29 + + # acptfactunit: acptfactunit_shop = None, + # agent_x._idearoot._kids[work_text]._acptfactunits = None + assert agent_x._idearoot._kids[work_text]._acptfactunits is None + acptfact_road = "src,weekdays,Sunday" + acptfactunit_x = acptfactunit_shop(base=acptfact_road, pick=acptfact_road) + + work_acptfactunits = agent_x._idearoot._kids[work_text]._acptfactunits + print(f"{work_acptfactunits=}") + agent_x.edit_idea_attr(road=work_road, acptfactunit=acptfactunit_x) + work_acptfactunits = agent_x._idearoot._kids[work_text]._acptfactunits + print(f"{work_acptfactunits=}") + assert agent_x._idearoot._kids[work_text]._acptfactunits == { + acptfactunit_x.base: acptfactunit_x + } + + # _descendant_promise_count: int = None, + agent_x._idearoot._kids[work_text]._descendant_promise_count = 81 + _descendant_promise_count_curr = agent_x._idearoot._kids[ + work_text + ]._descendant_promise_count + assert _descendant_promise_count_curr == 81 + agent_x.edit_idea_attr(road=work_road, descendant_promise_count=67) + _descendant_promise_count_new = agent_x._idearoot._kids[ + work_text + ]._descendant_promise_count + assert _descendant_promise_count_new == 67 + + # _all_member_credit: bool = None, + agent_x._idearoot._kids[work_text]._all_member_credit = 74 + _all_member_credit_curr = agent_x._idearoot._kids[work_text]._all_member_credit + assert _all_member_credit_curr == 74 + agent_x.edit_idea_attr(road=work_road, all_member_credit=59) + _all_member_credit_new = agent_x._idearoot._kids[work_text]._all_member_credit + assert _all_member_credit_new == 59 + + # _all_member_debt: bool = None, + agent_x._idearoot._kids[work_text]._all_member_debt = 74 + _all_member_debt_curr = agent_x._idearoot._kids[work_text]._all_member_debt + assert _all_member_debt_curr == 74 + agent_x.edit_idea_attr(road=work_road, all_member_debt=59) + _all_member_debt_new = agent_x._idearoot._kids[work_text]._all_member_debt + assert _all_member_debt_new == 59 + + # _grouplink: dict = None, + agent_x._idearoot._kids[work_text]._grouplinks = { + "fun": grouplink_shop(name="fun", creditor_weight=1, debtor_weight=7) + } + _grouplinks = agent_x._idearoot._kids[work_text]._grouplinks + assert _grouplinks == { + "fun": grouplink_shop(name="fun", creditor_weight=1, debtor_weight=7) + } + agent_x.edit_idea_attr( + road=work_road, + grouplink=grouplink_shop(name="fun", creditor_weight=4, debtor_weight=8), + ) + assert agent_x._idearoot._kids[work_text]._grouplinks == { + "fun": grouplink_shop(name="fun", creditor_weight=4, debtor_weight=8) + } + + # _is_expanded: dict = None, + agent_x._idearoot._kids[work_text]._is_expanded = "what" + _is_expanded = agent_x._idearoot._kids[work_text]._is_expanded + assert _is_expanded == "what" + agent_x.edit_idea_attr(road=work_road, is_expanded=True) + assert agent_x._idearoot._kids[work_text]._is_expanded == True + + # promise: dict = None, + agent_x._idearoot._kids[work_text].promise = "funfun3" + action = agent_x._idearoot._kids[work_text].promise + assert action == "funfun3" + agent_x.edit_idea_attr(road=work_road, promise=True) + assert agent_x._idearoot._kids[work_text].promise == True + + # _problem_bool + agent_x._idearoot._kids[work_text]._problem_bool = "heat2" + _problem_bool = agent_x._idearoot._kids[work_text]._problem_bool + assert _problem_bool == "heat2" + agent_x.edit_idea_attr(road=work_road, problem_bool=True) + assert agent_x._idearoot._kids[work_text]._problem_bool == True + + # _special_road: dict = None, + agent_x._idearoot._kids[work_text]._special_road = "fun3rol" + special_road = agent_x._idearoot._kids[work_text]._special_road + assert special_road == "fun3rol" + agent_x.edit_idea_attr(road=work_road, special_road="my,work,end") + assert agent_x._idearoot._kids[work_text]._special_road == "my,work,end" + + +def test_agent_edit_idea_attr_agentIsAbleToEdit_on_meld_weight_action_AnyIdeaIfInvaildThrowsError(): + agent_x = get_agent_with_4_levels() + work_road = f"{agent_x._desc},work" + + # When/Then + with pytest_raises(Exception) as excinfo: + agent_x.edit_idea_attr(road=work_road, on_meld_weight_action="yahoo9") + assert ( + str(excinfo.value) + == "IdeaCore unit 'work' cannot have on_meld_weight_action 'yahoo9'." + ) + + +def test_agent_edit_idea_attr_agentIsAbleToEditDenomAnyIdeaIfInvaildDenomThrowsError(): + src = "src" + agent_x = AgentUnit(_desc=src) + # When/Then + with pytest_raises(Exception) as excinfo: + agent_x.edit_idea_attr(road="", denom=46) + assert str(excinfo.value) == "Root Idea cannot have numor denom reest." + + work = "work" + w_road = f"{src},{work}" + work_idea = IdeaKid(_desc=work) + agent_x.add_idea(work_idea, walk=src) + clean = "clean" + clean_idea = IdeaKid(_desc=clean) + c_road = f"{w_road},{clean}" + agent_x.add_idea(clean_idea, walk=w_road) + + # When/Then + with pytest_raises(Exception) as excinfo: + agent_x.edit_idea_attr(road=c_road, denom=46) + assert ( + str(excinfo.value) + == "Idea cannot edit numor=1/denom/reest of 'src,work,clean' if parent 'src,work' or ideacore._numeric_road does not have begin/close range" + ) + + # Given + agent_x.edit_idea_attr(road=w_road, begin=44, close=110) + agent_x.edit_idea_attr(road=c_road, denom=11) + clean_idea = agent_x.get_idea_kid(road=c_road) + assert clean_idea._begin == 4 + assert clean_idea._close == 10 + + +def test_agent_edit_idea_attr_agentIsAbleToEditDenomAnyIdeaInvaildDenomThrowsError(): + # Given + src = "src" + agent_x = AgentUnit(_desc=src) + work = "work" + w_road = f"{src},{work}" + work_idea = IdeaKid(_desc=work, _begin=8, _close=14) + agent_x.add_idea(work_idea, walk=src) + + clean = "clean" + clean_idea = IdeaKid(_desc=clean, _denom=1) + c_road = f"{w_road},{clean}" + agent_x.add_idea(clean_idea, walk=w_road) + + clean_idea = agent_x.get_idea_kid(road=c_road) + + day = "day_range" + day_idea = IdeaKid(_desc=day, _begin=44, _close=110) + day_road = f"{src},{day}" + agent_x.add_idea(day_idea, walk=src) + + # When/Then + with pytest_raises(Exception) as excinfo: + agent_x.edit_idea_attr(road=c_road, numeric_road=day_road) + assert ( + str(excinfo.value) + == "Idea has begin-close range parent, cannot have numeric_road" + ) + + agent_x.edit_idea_attr(road=w_road, numeric_road=day_road) + + +def test_agent_edit_idea_attr_agentWhenParentAndNumeric_roadBothHaveRangeThrowError(): + # Given + src = "src" + agent_x = AgentUnit(_desc=src) + work = "work" + w_road = f"{src},{work}" + work_idea = IdeaKid(_desc=work) + agent_x.add_idea(work_idea, walk=src) + day = "day_range" + day_idea = IdeaKid(_desc=day, _begin=44, _close=110) + day_road = f"{src},{day}" + agent_x.add_idea(day_idea, walk=src) + + work_idea2 = agent_x.get_idea_kid(road=w_road) + assert work_idea2._begin is None + assert work_idea2._close is None + + with pytest_raises(Exception) as excinfo: + agent_x.edit_idea_attr(road=w_road, denom=11) + assert ( + str(excinfo.value) + == "Idea cannot edit numor=1/denom/reest of 'src,work' if parent 'src' or ideacore._numeric_road does not have begin/close range" + ) + + # When + agent_x.edit_idea_attr(road=w_road, numeric_road=day_road) + + # Then + work_idea3 = agent_x.get_idea_kid(road=w_road) + assert work_idea3._addin is None + assert work_idea3._numor is None + assert work_idea3._denom is None + assert work_idea3._reest is None + assert work_idea3._begin == 44 + assert work_idea3._close == 110 + agent_x.edit_idea_attr(road=w_road, denom=11, numeric_road=day_road) + assert work_idea3._begin == 4 + assert work_idea3._close == 10 + assert work_idea3._numor == 1 + assert work_idea3._denom == 11 + assert work_idea3._reest == False + assert work_idea3._addin == 0 + + +def test_agent_add_idea_MustReorderKidsDictToBeAlphabetical(): + # Given + src_text = "src" + ax = AgentUnit(_desc=src_text) + work_text = "work" + ax.add_idea(IdeaKid(_desc=work_text), walk=src_text) + swim_text = "swim" + ax.add_idea(IdeaKid(_desc=swim_text), walk=src_text) + + # WHEN + idea_list = list(ax._idearoot._kids.values()) + + # THEN + assert idea_list[0]._desc == swim_text diff --git a/src/agent/test_agent/test_agent_tool_list.py b/src/agent/test_agent/test_agent_idea_list.py similarity index 54% rename from src/agent/test_agent/test_agent_tool_list.py rename to src/agent/test_agent/test_agent_idea_list.py index 88be44caf..6925c5059 100644 --- a/src/agent/test_agent/test_agent_tool_list.py +++ b/src/agent/test_agent/test_agent_idea_list.py @@ -4,7 +4,7 @@ get_agent_with7amCleanTableRequired, agent_v001, ) -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from src.agent.required import sufffactunit_shop, RequiredUnit, RequiredHeir from src.agent.road import Road from src.agent.agent import AgentUnit @@ -27,10 +27,10 @@ def test_agent_yoke_dict_isDictionaryAndIsFullyPopulated(): agent_x.set_agent_metrics() # THEN - assert len(agent_x._tool_dict) == 17 + assert len(agent_x._idea_dict) == 17 -def test_agent_get_tool_list_SetsSatiateStatusCorrectlyWhenAcptFactSaysNo(): +def test_agent_get_idea_list_SetsSatiateStatusCorrectlyWhenAcptFactSaysNo(): # GIVEN agent_x = get_agent_with_4_levels_and_2requireds() week_text = "weekdays" @@ -40,20 +40,20 @@ def test_agent_get_tool_list_SetsSatiateStatusCorrectlyWhenAcptFactSaysNo(): # WHEN agent_x.set_acptfact(base=week_road, pick=sun_road) - tool_list = agent_x.get_tool_list() + idea_list = agent_x.get_idea_list() # THEN - assert tool_list - assert len(tool_list) == 17 + assert idea_list + assert len(idea_list) == 17 - # for tool in agent_x._tool_dict.values(): - # print(f"{work_road=} {tool.get_road()=}") + # for idea in agent_x._idea_dict.values(): + # print(f"{work_road=} {idea.get_road()=}") work_text = "work" work_road = f"{agent_x._desc},{work_text}" - assert agent_x._tool_dict.get(work_road)._active_status == False + assert agent_x._idea_dict.get(work_road)._active_status == False -def test_agent_get_tool_list_SetsSatiateStatusCorrectlyWhenAcptFactChanges(): +def test_agent_get_idea_list_SetsSatiateStatusCorrectlyWhenAcptFactChanges(): # GIVEN agent_x = get_agent_with_4_levels_and_2requireds() week_text = "weekdays" @@ -67,10 +67,10 @@ def test_agent_get_tool_list_SetsSatiateStatusCorrectlyWhenAcptFactChanges(): agent_x.set_acptfact(base=week_road, pick=sun_road) # THEN - tool_list = agent_x.get_tool_list() - assert tool_list - assert len(tool_list) == 17 - assert agent_x._tool_dict.get(work_road)._active_status == False + idea_list = agent_x.get_idea_list() + assert idea_list + assert len(idea_list) == 17 + assert agent_x._idea_dict.get(work_road)._active_status == False # WHEN states_text = "nation-state" @@ -80,10 +80,10 @@ def test_agent_get_tool_list_SetsSatiateStatusCorrectlyWhenAcptFactChanges(): agent_x.set_acptfact(base=states_road, pick=usa_road) # THEN - tool_list = agent_x.get_tool_list() - assert tool_list - assert len(tool_list) == 17 - assert agent_x._tool_dict.get(work_road)._active_status + idea_list = agent_x.get_idea_list() + assert idea_list + assert len(idea_list) == 17 + assert agent_x._idea_dict.get(work_road)._active_status # WHEN france_text = "France" @@ -91,13 +91,13 @@ def test_agent_get_tool_list_SetsSatiateStatusCorrectlyWhenAcptFactChanges(): agent_x.set_acptfact(base=states_road, pick=france_road) # THEN - tool_list = agent_x.get_tool_list() - assert tool_list - assert len(tool_list) == 17 - assert agent_x._tool_dict.get(work_road)._active_status == False + idea_list = agent_x.get_idea_list() + assert idea_list + assert len(idea_list) == 17 + assert agent_x._idea_dict.get(work_road)._active_status == False -def test_agent_get_tool_list_returns_correct_list(): +def test_agent_get_idea_list_returns_correct_list(): # GIVEN agent_x = get_agent_with_4_levels_and_2requireds() week_text = "weekdays" @@ -113,15 +113,15 @@ def test_agent_get_tool_list_returns_correct_list(): work_text = "work" work_road = f"{agent_x._desc},{work_text}" - work_tool = agent_x.get_tool_kid(work_road) - print(f"{agent_x._desc=} {len(work_tool._requiredunits)=}") - # print(f"{work_tool._requiredunits=}") - print(f"{agent_x._desc=} {len(agent_x._toolroot._acptfactunits)=}") - # print(f"{agent_x._toolroot._acptfactunits=}") + work_idea = agent_x.get_idea_kid(work_road) + print(f"{agent_x._desc=} {len(work_idea._requiredunits)=}") + # print(f"{work_idea._requiredunits=}") + print(f"{agent_x._desc=} {len(agent_x._idearoot._acptfactunits)=}") + # print(f"{agent_x._idearoot._acptfactunits=}") - tool_list = agent_x.get_tool_list() - assert tool_list - assert len(tool_list) == 17 + idea_list = agent_x.get_idea_list() + assert idea_list + assert len(idea_list) == 17 usa_text = "USA" usa_road = f"{state_road},{usa_text}" @@ -142,14 +142,14 @@ def test_agent_get_tool_list_returns_correct_list(): sufffacts={wed.need: wed}, _status=True, _task=False, - _curr_tool_active_status=True, + _curr_idea_active_status=True, ) sta_lh = RequiredHeir( base=state_road, sufffacts={usa.need: usa}, _status=True, _task=False, - _curr_tool_active_status=True, + _curr_idea_active_status=True, ) x1_requiredunits = { @@ -165,25 +165,25 @@ def test_agent_get_tool_list_returns_correct_list(): agent_x.set_acptfact(base=state_road, pick=oregon_road) # THEN - work_tool = agent_x._tool_dict.get(work_road) - print(f"\nlook at {work_tool.get_road()=}") - assert work_tool._walk == f"{agent_x._desc}" - assert work_tool._kids == {} - assert work_tool._weight == 30 - assert work_tool._desc == work_text - assert work_tool._level == 1 - assert work_tool._active_status - assert work_tool.promise - # print(f"{work_tool._requiredheirs=}") - curr_requiredheir_state = work_tool._requiredheirs[state_road] + work_idea = agent_x._idea_dict.get(work_road) + print(f"\nlook at {work_idea.get_road()=}") + assert work_idea._walk == f"{agent_x._desc}" + assert work_idea._kids == {} + assert work_idea._weight == 30 + assert work_idea._desc == work_text + assert work_idea._level == 1 + assert work_idea._active_status + assert work_idea.promise + # print(f"{work_idea._requiredheirs=}") + curr_requiredheir_state = work_idea._requiredheirs[state_road] print(f" {curr_requiredheir_state=}") print(f" {curr_requiredheir_state._status=}\n") - # assert work_tool._requiredheirs == x1_requiredheirs + # assert work_idea._requiredheirs == x1_requiredheirs - assert len(work_tool._requiredheirs) == len(x1_requiredheirs) - week_requiredheir = work_tool._requiredheirs.get(week_road) + assert len(work_idea._requiredheirs) == len(x1_requiredheirs) + week_requiredheir = work_idea._requiredheirs.get(week_road) # usa_sufffact = week_requiredheir.sufffacts.get(usa_road) - print(f" {work_tool._desc=}") + print(f" {work_idea._desc=}") # print(f" {usa_sufffact.base=}") # print(f" {usa_sufffact._task=}") # print(f" {usa_sufffact._task=}") @@ -195,21 +195,21 @@ def test_agent_get_tool_list_returns_correct_list(): # assert usa_sufffact._status == w_need._status # assert week_requiredheir.sufffacts == week_requiredheir.sufffacts - # assert work_tool._requiredunits == x1_requiredunits + # assert work_idea._requiredunits == x1_requiredunits - # print("iterate through every tool...") - # for curr_tool in tool_list: - # if str(type(curr_tool)).find(".tool.ToolKid'>") > 0: - # assert curr_tool._active_status != None + # print("iterate through every idea...") + # for curr_idea in idea_list: + # if str(type(curr_idea)).find(".idea.IdeaKid'>") > 0: + # assert curr_idea._active_status != None # # print("") - # # print(f"{curr_tool._desc=}") - # # print(f"{len(curr_tool._requiredunits)=}") + # # print(f"{curr_idea._desc=}") + # # print(f"{len(curr_idea._requiredunits)=}") # print( - # f" {curr_tool._desc} iterate through every requiredheir... {len(curr_tool._requiredheirs)=} {curr_tool._desc=}" + # f" {curr_idea._desc} iterate through every requiredheir... {len(curr_idea._requiredheirs)=} {curr_idea._desc=}" # ) - # # print(f"{curr_tool._requiredheirs=}") - # for required in curr_tool._requiredheirs.values(): + # # print(f"{curr_idea._requiredheirs=}") + # for required in curr_idea._requiredheirs.values(): # assert str(type(required)).find(".required.RequiredHeir'>") > 0 # print(f" {required.base=}") # assert required._status != None @@ -227,76 +227,76 @@ def test_agent_set_agent_metrics_CorrectlyClears_agent_coin(): work_text = "work" catt_text = "feed cat" week_text = "weekdays" - ax._toolroot._agent_coin_onset = 13 - ax._toolroot._agent_coin_cease = 13 - ax._toolroot._kids.get(work_text)._agent_coin_onset = 13 - ax._toolroot._kids.get(work_text)._agent_coin_cease = 13 - ax._toolroot._kids.get(catt_text)._agent_coin_onset = 13 - ax._toolroot._kids.get(catt_text)._agent_coin_cease = 13 - ax._toolroot._kids.get(week_text)._agent_coin_onset = 13 - ax._toolroot._kids.get(week_text)._agent_coin_cease = 13 - - assert ax._toolroot._agent_coin_onset == 13 - assert ax._toolroot._agent_coin_cease == 13 - assert ax._toolroot._kids.get(work_text)._agent_coin_onset == 13 - assert ax._toolroot._kids.get(work_text)._agent_coin_cease == 13 - assert ax._toolroot._kids.get(catt_text)._agent_coin_onset == 13 - assert ax._toolroot._kids.get(catt_text)._agent_coin_cease == 13 - assert ax._toolroot._kids.get(week_text)._agent_coin_onset == 13 - assert ax._toolroot._kids.get(week_text)._agent_coin_cease == 13 + ax._idearoot._agent_coin_onset = 13 + ax._idearoot._agent_coin_cease = 13 + ax._idearoot._kids.get(work_text)._agent_coin_onset = 13 + ax._idearoot._kids.get(work_text)._agent_coin_cease = 13 + ax._idearoot._kids.get(catt_text)._agent_coin_onset = 13 + ax._idearoot._kids.get(catt_text)._agent_coin_cease = 13 + ax._idearoot._kids.get(week_text)._agent_coin_onset = 13 + ax._idearoot._kids.get(week_text)._agent_coin_cease = 13 + + assert ax._idearoot._agent_coin_onset == 13 + assert ax._idearoot._agent_coin_cease == 13 + assert ax._idearoot._kids.get(work_text)._agent_coin_onset == 13 + assert ax._idearoot._kids.get(work_text)._agent_coin_cease == 13 + assert ax._idearoot._kids.get(catt_text)._agent_coin_onset == 13 + assert ax._idearoot._kids.get(catt_text)._agent_coin_cease == 13 + assert ax._idearoot._kids.get(week_text)._agent_coin_onset == 13 + assert ax._idearoot._kids.get(week_text)._agent_coin_cease == 13 # WHEN ax.set_agent_metrics() # THEN - assert ax._toolroot._agent_coin_onset != 13 - assert ax._toolroot._agent_coin_cease != 13 - assert ax._toolroot._kids.get(work_text)._agent_coin_onset != 13 - assert ax._toolroot._kids.get(work_text)._agent_coin_cease != 13 - assert ax._toolroot._kids.get(catt_text)._agent_coin_onset != 13 - assert ax._toolroot._kids.get(catt_text)._agent_coin_cease != 13 - assert ax._toolroot._kids.get(week_text)._agent_coin_onset != 13 - assert ax._toolroot._kids.get(week_text)._agent_coin_cease != 13 + assert ax._idearoot._agent_coin_onset != 13 + assert ax._idearoot._agent_coin_cease != 13 + assert ax._idearoot._kids.get(work_text)._agent_coin_onset != 13 + assert ax._idearoot._kids.get(work_text)._agent_coin_cease != 13 + assert ax._idearoot._kids.get(catt_text)._agent_coin_onset != 13 + assert ax._idearoot._kids.get(catt_text)._agent_coin_cease != 13 + assert ax._idearoot._kids.get(week_text)._agent_coin_onset != 13 + assert ax._idearoot._kids.get(week_text)._agent_coin_cease != 13 -def test_agent_get_tool_list_CorrectlyCalculatesToolAttr_agent_coin(): +def test_agent_get_idea_list_CorrectlyCalculatesIdeaAttr_agent_coin(): # GIVEN src_text = "src" ax = AgentUnit(_weight=10, _desc=src_text) auto_text = "auto" - auto_tool = ToolKid(_desc=auto_text, _weight=10) - ax.add_tool(tool_kid=auto_tool, walk=src_text) + auto_idea = IdeaKid(_desc=auto_text, _weight=10) + ax.add_idea(idea_kid=auto_idea, walk=src_text) barn_text = "barn" barn_road = f"{src_text},{barn_text}" - barn_tool = ToolKid(_desc=barn_text, _weight=60) - ax.add_tool(tool_kid=barn_tool, walk=src_text) + barn_idea = IdeaKid(_desc=barn_text, _weight=60) + ax.add_idea(idea_kid=barn_idea, walk=src_text) lamb_text = "lambs" lamb_road = f"{barn_road},{lamb_text}" - lamb_tool = ToolKid(_desc=lamb_text, _weight=1) - ax.add_tool(tool_kid=lamb_tool, walk=barn_road) + lamb_idea = IdeaKid(_desc=lamb_text, _weight=1) + ax.add_idea(idea_kid=lamb_idea, walk=barn_road) duck_text = "ducks" duck_road = f"{barn_road},{duck_text}" - duck_tool = ToolKid(_desc=duck_text, _weight=2) - ax.add_tool(tool_kid=duck_tool, walk=barn_road) + duck_idea = IdeaKid(_desc=duck_text, _weight=2) + ax.add_idea(idea_kid=duck_idea, walk=barn_road) coal_text = "coal" - coal_tool = ToolKid(_desc=coal_text, _weight=30) - ax.add_tool(tool_kid=coal_tool, walk=src_text) - - assert ax._toolroot._agent_coin_onset is None - assert ax._toolroot._agent_coin_cease is None - assert ax._toolroot._kids.get(auto_text)._agent_coin_onset is None - assert ax._toolroot._kids.get(auto_text)._agent_coin_cease is None - assert ax._toolroot._kids.get(barn_text)._agent_coin_onset is None - assert ax._toolroot._kids.get(barn_text)._agent_coin_cease is None - assert ax._toolroot._kids.get(coal_text)._agent_coin_onset is None - assert ax._toolroot._kids.get(coal_text)._agent_coin_cease is None - lamb_before = ax.get_tool_kid(road=lamb_road) + coal_idea = IdeaKid(_desc=coal_text, _weight=30) + ax.add_idea(idea_kid=coal_idea, walk=src_text) + + assert ax._idearoot._agent_coin_onset is None + assert ax._idearoot._agent_coin_cease is None + assert ax._idearoot._kids.get(auto_text)._agent_coin_onset is None + assert ax._idearoot._kids.get(auto_text)._agent_coin_cease is None + assert ax._idearoot._kids.get(barn_text)._agent_coin_onset is None + assert ax._idearoot._kids.get(barn_text)._agent_coin_cease is None + assert ax._idearoot._kids.get(coal_text)._agent_coin_onset is None + assert ax._idearoot._kids.get(coal_text)._agent_coin_cease is None + lamb_before = ax.get_idea_kid(road=lamb_road) assert lamb_before._agent_coin_onset is None assert lamb_before._agent_coin_cease is None - duck_before = ax.get_tool_kid(road=duck_road) + duck_before = ax.get_idea_kid(road=duck_road) assert duck_before._agent_coin_onset is None assert duck_before._agent_coin_cease is None @@ -304,51 +304,51 @@ def test_agent_get_tool_list_CorrectlyCalculatesToolAttr_agent_coin(): ax.set_agent_metrics() # THEN - assert ax._toolroot._agent_coin_onset == 0.0 - assert ax._toolroot._agent_coin_cease == 1.0 - assert ax._toolroot._kids.get(auto_text)._agent_coin_onset == 0.0 - assert ax._toolroot._kids.get(auto_text)._agent_coin_cease == 0.1 - assert ax._toolroot._kids.get(barn_text)._agent_coin_onset == 0.1 - assert ax._toolroot._kids.get(barn_text)._agent_coin_cease == 0.7 - assert ax._toolroot._kids.get(coal_text)._agent_coin_onset == 0.7 - assert ax._toolroot._kids.get(coal_text)._agent_coin_cease == 1.0 - - duck_after = ax.get_tool_kid(road=duck_road) + assert ax._idearoot._agent_coin_onset == 0.0 + assert ax._idearoot._agent_coin_cease == 1.0 + assert ax._idearoot._kids.get(auto_text)._agent_coin_onset == 0.0 + assert ax._idearoot._kids.get(auto_text)._agent_coin_cease == 0.1 + assert ax._idearoot._kids.get(barn_text)._agent_coin_onset == 0.1 + assert ax._idearoot._kids.get(barn_text)._agent_coin_cease == 0.7 + assert ax._idearoot._kids.get(coal_text)._agent_coin_onset == 0.7 + assert ax._idearoot._kids.get(coal_text)._agent_coin_cease == 1.0 + + duck_after = ax.get_idea_kid(road=duck_road) assert duck_after._agent_coin_onset == 0.1 assert duck_after._agent_coin_cease == 0.5 - lamb_after = ax.get_tool_kid(road=lamb_road) + lamb_after = ax.get_idea_kid(road=lamb_road) assert lamb_after._agent_coin_onset == 0.5 assert lamb_after._agent_coin_cease == 0.7 -def test_agent_get_tool_list_without_root_CorrectlyCalculatesToolAttributes(): +def test_agent_get_idea_list_without_root_CorrectlyCalculatesIdeaAttributes(): # GIVEN agent_x = get_agent_with7amCleanTableRequired() # WHEN - tool_list_without_toolroot = agent_x.get_tool_list_without_toolroot() - tool_list_with_toolroot = agent_x.get_tool_list() + idea_list_without_idearoot = agent_x.get_idea_list_without_idearoot() + idea_list_with_idearoot = agent_x.get_idea_list() # THEN - assert len(tool_list_without_toolroot) == 29 - assert len(tool_list_without_toolroot) + 1 == len(tool_list_with_toolroot) + assert len(idea_list_without_idearoot) == 29 + assert len(idea_list_without_idearoot) + 1 == len(idea_list_with_idearoot) - # for tool in agent_x.get_tool_list_without_toolroot(): - # assert str(type(tool)).find(".tool.ToolKid'>") > 0 + # for idea in agent_x.get_idea_list_without_idearoot(): + # assert str(type(idea)).find(".idea.IdeaKid'>") > 0 - # for tool in agent_x.get_tool_list_without_toolroot(): - # print(f"{tool._desc=}") + # for idea in agent_x.get_idea_list_without_idearoot(): + # print(f"{idea._desc=}") -def test_agent_get_tool_list_CorrectlyCalculatesRangeAttributes(): +def test_agent_get_idea_list_CorrectlyCalculatesRangeAttributes(): # GIVEN agent_x = get_agent_with7amCleanTableRequired() - tool_list = agent_x.get_tool_list() + idea_list = agent_x.get_idea_list() housework = "housework" house_road = f"{agent_x._desc},{housework}" clean_text = "clean table" clean_road = f"{house_road},{clean_text}" - assert agent_x._tool_dict.get(clean_road)._active_status == False + assert agent_x._idea_dict.get(clean_road)._active_status == False # set acptfacts as midnight to 8am day24hr_base = f"{agent_x._desc},timetech,24hr day" @@ -363,23 +363,23 @@ def test_agent_get_tool_list_CorrectlyCalculatesRangeAttributes(): # THEN agent_x.set_agent_metrics() - assert agent_x._tool_dict.get(clean_road)._active_status + assert agent_x._idea_dict.get(clean_road)._active_status # WHEN # set acptfacts as 8am to 10am day24hr_open = 8.0 day24hr_nigh = 10.0 - print(agent_x._toolroot._acptfactunits["src,timetech,24hr day"]) + print(agent_x._idearoot._acptfactunits["src,timetech,24hr day"]) agent_x.set_acptfact( base=day24hr_base, pick=day24hr_pick, open=day24hr_open, nigh=day24hr_nigh ) - print(agent_x._toolroot._acptfactunits["src,timetech,24hr day"]) - print(agent_x._toolroot._kids["housework"]._kids[clean_text]._requiredunits) - # agent_x._toolroot._kids["housework"]._kids[clean_text]._active_status = None + print(agent_x._idearoot._acptfactunits["src,timetech,24hr day"]) + print(agent_x._idearoot._kids["housework"]._kids[clean_text]._requiredunits) + # agent_x._idearoot._kids["housework"]._kids[clean_text]._active_status = None # THEN agent_x.set_agent_metrics() - assert agent_x._tool_dict.get(clean_road)._active_status == False + assert agent_x._idea_dict.get(clean_road)._active_status == False def test_get_agenda_items(): @@ -395,7 +395,7 @@ def test_get_agenda_items(): assert len(promise_items) == 1 -def test_exammple_tool_list_HasCorrectData(): +def test_exammple_idea_list_HasCorrectData(): agent_x = agent_v001() print(f"{agent_x.get_required_bases()=}") # day_hour = "TlME,day_hour" @@ -412,34 +412,34 @@ def test_exammple_tool_list_HasCorrectData(): agent_x.set_acptfact(base=internet, pick=internet) assert agent_x != None # print(f"{agent_x._desc=}") - # print(f"{len(agent_x._toolroot._kids)=}") + # print(f"{len(agent_x._idearoot._kids)=}") ulty_text = "Ultimate Frisbee" ulty_road = f"{agent_x._desc},{ulty_text}" - # if agent_x._toolroot._kids["Ultimate Frisbee"]._desc == "Ultimate Frisbee": - assert agent_x._toolroot._kids[ulty_text]._requiredunits != None + # if agent_x._idearoot._kids["Ultimate Frisbee"]._desc == "Ultimate Frisbee": + assert agent_x._idearoot._kids[ulty_text]._requiredunits != None assert agent_x._desc != None - # for acptfact in agent_x._toolroot._acptfactunits.values(): + # for acptfact in agent_x._idearoot._acptfactunits.values(): # print(f"{acptfact=}") - tool_list = agent_x.get_tool_list() - # print(f"{str(type(tool))=}") - # print(f"{len(tool_list)=}") + idea_list = agent_x.get_idea_list() + # print(f"{str(type(idea))=}") + # print(f"{len(idea_list)=}") laundry_text = "laundry monday" laundry_road = f"{agent_x._desc},casa,cleaning,{laundry_text}" - # for tool in tool_list: + # for idea in idea_list: # assert ( - # str(type(tool)).find(".tool.ToolRoot'>") > 0 - # or str(type(tool)).find(".tool.ToolKid'>") > 0 + # str(type(idea)).find(".idea.IdeaRoot'>") > 0 + # or str(type(idea)).find(".idea.IdeaKid'>") > 0 # ) - # # print(f"{tool._desc=}") - # if tool._desc == laundry_text: - # for required in tool._requiredunits.values(): - # print(f"{tool._desc=} {required.base=}") # {required.sufffacts=}") - # assert tool._active_status == False - assert agent_x._tool_dict.get(laundry_road)._active_status == False + # # print(f"{idea._desc=}") + # if idea._desc == laundry_text: + # for required in idea._requiredunits.values(): + # print(f"{idea._desc=} {required.base=}") # {required.sufffacts=}") + # assert idea._active_status == False + assert agent_x._idea_dict.get(laundry_road)._active_status == False # WHEN agent_x.set_acptfact(base="TlME,weekdays", pick="TlME,weekdays,Monday") @@ -447,10 +447,10 @@ def test_exammple_tool_list_HasCorrectData(): agent_x.set_agent_metrics() # THEN - assert agent_x._tool_dict.get(laundry_road)._active_status == False + assert agent_x._idea_dict.get(laundry_road)._active_status == False -def test_exammple_tool_list_OptionWeekdaysCorrectlyWork(): +def test_exammple_idea_list_OptionWeekdaysCorrectlyWork(): # GIVEN agent_x = agent_v001() day_hour = "TlME,day_hour" @@ -470,7 +470,7 @@ def test_exammple_tool_list_OptionWeekdaysCorrectlyWork(): year_month = "TlME,year_month" agent_x.set_acptfact(base=year_month, pick=year_month, open=0, nigh=1000) - tool_list = agent_x.get_tool_list() + idea_list = agent_x.get_idea_list() missing_acptfacts = agent_x.get_missing_acptfact_bases() # for missing_acptfact, count in missing_acptfacts.items(): # print(f"{missing_acptfact=} {count=}") @@ -486,25 +486,25 @@ def test_exammple_tool_list_OptionWeekdaysCorrectlyWork(): } mt_required = RequiredUnit(base=weekday_road, sufffacts=mt_sufffacts) mt_required_x = RequiredHeir(base=weekday_road, sufffacts=mt_sufffacts) - agent_x._toolroot.set_required_unit(required=mt_required) + agent_x._idearoot.set_required_unit(required=mt_required) # print(f"{agent_x._requiredunits[weekday_road].base=}") # print(f"{agent_x._requiredunits[weekday_road].sufffacts[mon_road].need=}") # print(f"{agent_x._requiredunits[weekday_road].sufffacts[tue_road].need=}") - print(f"{agent_x._toolroot._requiredunits[weekday_road].sufffacts=}") - sufffact_mon = agent_x._toolroot._requiredunits[weekday_road].sufffacts.get( + print(f"{agent_x._idearoot._requiredunits[weekday_road].sufffacts=}") + sufffact_mon = agent_x._idearoot._requiredunits[weekday_road].sufffacts.get( mon_road ) - sufffact_tue = agent_x._toolroot._requiredunits[weekday_road].sufffacts.get( + sufffact_tue = agent_x._idearoot._requiredunits[weekday_road].sufffacts.get( tue_road ) assert sufffact_mon assert sufffact_mon == mt_required.sufffacts[sufffact_mon.need] assert sufffact_tue assert sufffact_tue == mt_required.sufffacts[sufffact_tue.need] - assert agent_x._toolroot._requiredunits[weekday_road] == mt_required + assert agent_x._idearoot._requiredunits[weekday_road] == mt_required # WHEN - tool_list = agent_x.get_tool_list() + idea_list = agent_x.get_idea_list() # THEN assert sufffact_mon @@ -512,33 +512,33 @@ def test_exammple_tool_list_OptionWeekdaysCorrectlyWork(): assert sufffact_tue assert sufffact_tue == mt_required.sufffacts[sufffact_tue.need] - assert agent_x._toolroot._requiredheirs[weekday_road] == mt_required_x + assert agent_x._idearoot._requiredheirs[weekday_road] == mt_required_x bird_walk = "TlME,casa" bird_desc = "say hi to birds" bird_road = Road(f"{bird_walk},{bird_desc}") - assert from_list_get_active_status(road=bird_road, tool_list=tool_list) == False + assert from_list_get_active_status(road=bird_road, idea_list=idea_list) == False agent_x.set_acptfact(base="TlME,weekdays", pick="TlME,weekdays,Monday") - tool_list = agent_x.get_tool_list() - casa_tool = agent_x._toolroot._kids["casa"] - twee_tool = casa_tool._kids["say hi to birds"] - print(f"{len(agent_x._toolroot._requiredheirs)=}") - print(f"{len(casa_tool._requiredheirs)=}") - print(f"{len(twee_tool._requiredheirs)=}") + idea_list = agent_x.get_idea_list() + casa_idea = agent_x._idearoot._kids["casa"] + twee_idea = casa_idea._kids["say hi to birds"] + print(f"{len(agent_x._idearoot._requiredheirs)=}") + print(f"{len(casa_idea._requiredheirs)=}") + print(f"{len(twee_idea._requiredheirs)=}") - # assert YR.get_active_status(road=bird_tool, tool_list=tool_list) == True + # assert YR.get_active_status(road=bird_idea, idea_list=idea_list) == True # agent_x.set_acptfact(base="TlME,weekdays", pick="TlME,weekdays,Tuesday") - # tool_list = agent_x.get_tool_list() - # assert YR.get_active_status(road=bird_tool, tool_list=tool_list) == True + # idea_list = agent_x.get_idea_list() + # assert YR.get_active_status(road=bird_idea, idea_list=idea_list) == True # agent_x.set_acptfact(base="TlME,weekdays", pick="TlME,weekdays,Wednesday") - # tool_list = agent_x.get_tool_list() - # assert YR.get_active_status(road=bird_tool, tool_list=tool_list) == False + # idea_list = agent_x.get_idea_list() + # assert YR.get_active_status(road=bird_idea, idea_list=idea_list) == False -def test_exammple_tool_list_Every6WeeksRequired(): +def test_exammple_idea_list_Every6WeeksRequired(): # GIVEN agent_x = agent_v001() src_text = "TlME" @@ -550,7 +550,7 @@ def test_exammple_tool_list_Every6WeeksRequired(): # WHEN agent_x.set_acptfact(base=day_road, pick=day_road, open=0, nigh=23) agent_x.set_acptfact(base=min_road, pick=min_road, open=0, nigh=59) - tool_list = agent_x.get_tool_list() + idea_list = agent_x.get_idea_list() # THEN ced_week_base = f"{src_text},ced_week" @@ -558,34 +558,34 @@ def test_exammple_tool_list_Every6WeeksRequired(): sufffact_divisor = None sufffact_open = None sufffact_nigh = None - print(f"{len(tool_list)=}") + print(f"{len(idea_list)=}") clean_sheet_road = "TlME,casa,cleaning,clean sheets couch blankets" - clean_sheet_tool = agent_x.get_tool_kid(road=clean_sheet_road) - # print(f"{clean_sheet_tool._requiredunits.values()=}") - ced_week_required = clean_sheet_tool._requiredunits.get(ced_week_base) + clean_sheet_idea = agent_x.get_idea_kid(road=clean_sheet_road) + # print(f"{clean_sheet_idea._requiredunits.values()=}") + ced_week_required = clean_sheet_idea._requiredunits.get(ced_week_base) ced_week_suffact = ced_week_required.sufffacts.get(ced_week_base) print( - f"{clean_sheet_tool._desc=} {ced_week_required.base=} {ced_week_suffact.need=}" + f"{clean_sheet_idea._desc=} {ced_week_required.base=} {ced_week_suffact.need=}" ) - # print(f"{clean_sheet_tool._desc=} {ced_week_required.base=} {sufffact_x=}") + # print(f"{clean_sheet_idea._desc=} {ced_week_required.base=} {sufffact_x=}") sufffact_divisor = ced_week_suffact.divisor sufffact_open = ced_week_suffact.open sufffact_nigh = ced_week_suffact.nigh - # print(f"{tool._requiredunits=}") - assert clean_sheet_tool._active_status == False + # print(f"{idea._requiredunits=}") + assert clean_sheet_idea._active_status == False - # for tool in tool_list: - # # print(f"{tool._walk=}") - # if tool._desc == "clean sheets couch blankets": - # print(f"{tool.get_road()=}") + # for idea in idea_list: + # # print(f"{idea._walk=}") + # if idea._desc == "clean sheets couch blankets": + # print(f"{idea.get_road()=}") assert sufffact_divisor == 6 assert sufffact_open == 1 print( - "There exists a tool with a required_base TlME,ced_week that also has lemmet div =6 and open/nigh =1" + "There exists a idea with a required_base TlME,ced_week that also has lemmet div =6 and open/nigh =1" ) - # print(f"{len(tool_list)=}") + # print(f"{len(idea_list)=}") ced_week_open = 6001 # WHEN @@ -598,77 +598,77 @@ def test_exammple_tool_list_Every6WeeksRequired(): print( f"Nation-states set and also acptfact set: {ced_week_base=} with {ced_week_open=} and {ced_week_open=}" ) - print(f"{agent_x._toolroot._acptfactunits=}") - tool_list = agent_x.get_tool_list() + print(f"{agent_x._idearoot._acptfactunits=}") + idea_list = agent_x.get_idea_list() # THEN week_text = "ced_week" week_road = f"TlME,{week_text}" clean_couch_text = "clean sheets couch blankets" clean_couch_road = f"TlME,casa,cleaning,{clean_couch_text}" - clean_couch_tool = agent_x.get_tool_kid(road=clean_couch_road) - week_required = clean_couch_tool._requiredunits.get(week_road) + clean_couch_idea = agent_x.get_idea_kid(road=clean_couch_road) + week_required = clean_couch_idea._requiredunits.get(week_road) week_sufffact = week_required.sufffacts.get(week_road) - print(f"{clean_couch_tool._desc=} {week_required.base=} {week_sufffact=}") + print(f"{clean_couch_idea._desc=} {week_required.base=} {week_sufffact=}") assert week_sufffact.divisor == 6 and week_sufffact.open == 1 -def print_sufffact_info(road: str, tool_list): +def print_sufffact_info(road: str, idea_list): satiate_status = None sufffact_divisor = None sufffact_open = None sufffact_nigh = None - for tool in tool_list: - if tool._walk == road: - for required in tool._requiredunits.values(): + for idea in idea_list: + if idea._walk == road: + for required in idea._requiredunits.values(): for sufffact_x in required.sufffacts.values(): print( - f"{tool._desc=} base:{required.base} need:{sufffact_x.need} open:{sufffact_x.open} nigh:{sufffact_x.nigh} div:{sufffact_x.divisor} status:{sufffact_x._status}" + f"{idea._desc=} base:{required.base} need:{sufffact_x.need} open:{sufffact_x.open} nigh:{sufffact_x.nigh} div:{sufffact_x.divisor} status:{sufffact_x._status}" ) -def test_exammple_tool_list_EveryToolHasSatiateStatus(): +def test_exammple_idea_list_EveryIdeaHasSatiateStatus(): # GIVEN agent_x = agent_v001() # WHEN - tool_list = agent_x.get_tool_list() + idea_list = agent_x.get_idea_list() # THEN - print(f"{len(tool_list)=}") - # first_tool_kid_count = 0 - # first_tool_kid_none_count = 0 - # first_tool_kid_true_count = 0 - # first_tool_kid_false_count = 0 - # for tool in tool_list: - # if str(type(tool)).find(".tool.ToolKid'>") > 0: - # first_tool_kid_count += 1 - # if tool._active_status is None: - # first_tool_kid_none_count += 1 - # elif tool._active_status: - # first_tool_kid_true_count += 1 - # elif tool._active_status == False: - # first_tool_kid_false_count += 1 - - # print(f"{first_tool_kid_count=}") - # print(f"{first_tool_kid_none_count=}") - # print(f"{first_tool_kid_true_count=}") - # print(f"{first_tool_kid_false_count=}") - - # tool_kid_count = 0 - # for tool in tool_list_without_toolroot: - # tool_kid_count += 1 - # print(f"{tool._desc=} {tool_kid_count=}") - # assert tool._active_status != None - # assert tool._active_status in (True, False) - # assert tool_kid_count == len(tool_list_without_toolroot) - - assert len(tool_list) - 1 == sum(tool._active_status != None for tool in tool_list) - assert 1 == sum(tool._active_status is None for tool in tool_list) - - -def test_exammple_tool_list_EveryOtherMonthWorks(): + print(f"{len(idea_list)=}") + # first_idea_kid_count = 0 + # first_idea_kid_none_count = 0 + # first_idea_kid_true_count = 0 + # first_idea_kid_false_count = 0 + # for idea in idea_list: + # if str(type(idea)).find(".idea.IdeaKid'>") > 0: + # first_idea_kid_count += 1 + # if idea._active_status is None: + # first_idea_kid_none_count += 1 + # elif idea._active_status: + # first_idea_kid_true_count += 1 + # elif idea._active_status == False: + # first_idea_kid_false_count += 1 + + # print(f"{first_idea_kid_count=}") + # print(f"{first_idea_kid_none_count=}") + # print(f"{first_idea_kid_true_count=}") + # print(f"{first_idea_kid_false_count=}") + + # idea_kid_count = 0 + # for idea in idea_list_without_idearoot: + # idea_kid_count += 1 + # print(f"{idea._desc=} {idea_kid_count=}") + # assert idea._active_status != None + # assert idea._active_status in (True, False) + # assert idea_kid_count == len(idea_list_without_idearoot) + + assert len(idea_list) - 1 == sum(idea._active_status != None for idea in idea_list) + assert 1 == sum(idea._active_status is None for idea in idea_list) + + +def test_exammple_idea_list_EveryOtherMonthWorks(): # GIVEN agent_x = agent_v001() src_road = "TlME" @@ -693,8 +693,8 @@ def test_exammple_tool_list_EveryOtherMonthWorks(): weekdays_text = "weekdays" weekdays_road = f"{src_road},{weekdays_text}" agent_x.set_acptfact(base=weekdays_road, pick=weekdays_road) - tool_list = agent_x.get_tool_list() - print(f"{len(tool_list)=}") + idea_list = agent_x.get_idea_list() + print(f"{len(idea_list)=}") casa_text = "casa" casa_road = f"{src_road},{casa_text}" @@ -703,7 +703,7 @@ def test_exammple_tool_list_EveryOtherMonthWorks(): mat_desc = "deep clean play mat" mat_road = Road(f"{clean_road},{mat_desc}") # commented out since it's difficult to understand - assert from_list_get_active_status(road=mat_road, tool_list=tool_list) == False + assert from_list_get_active_status(road=mat_road, idea_list=idea_list) == False year_month_base = "TlME,year_month" print(f"{year_month_base=}, {year_month_base=}") @@ -714,8 +714,8 @@ def test_exammple_tool_list_EveryOtherMonthWorks(): agent_x.set_acptfact(base=ced_week, pick=ced_week, open=0, nigh=4) # THEN - tool_list = agent_x.get_tool_list() - print(f"{len(tool_list)=}") - print(f"{len(agent_x._toolroot._acptfactunits)=}") - # from_list_get_active_status(road=mat_road, tool_list=tool_list) - assert from_list_get_active_status(road=mat_road, tool_list=tool_list) + idea_list = agent_x.get_idea_list() + print(f"{len(idea_list)=}") + print(f"{len(agent_x._idearoot._acptfactunits)=}") + # from_list_get_active_status(road=mat_road, idea_list=idea_list) + assert from_list_get_active_status(road=mat_road, idea_list=idea_list) diff --git a/src/agent/test_agent/test_agent_idea_tree.py b/src/agent/test_agent/test_agent_idea_tree.py new file mode 100644 index 000000000..c39202934 --- /dev/null +++ b/src/agent/test_agent/test_agent_idea_tree.py @@ -0,0 +1,465 @@ +from src.agent.examples.example_agents import ( + get_agent_with_4_levels as example_agents_get_agent_with_4_levels, +) +from src.agent.member import MemberName +from src.agent.idea import IdeaKid +from src.agent.agent import AgentUnit +from src.agent.group import Groupline, GroupLink +from pytest import raises as pytest_raises + + +def test_set_agent_metrics_CorrectlyClearsDescendantAttributes(): + agent_x = example_agents_get_agent_with_4_levels() + + # idea "src,weekdays,Sunday" + # idea "src,weekdays,Monday" + # idea "src,weekdays,Tuesday" + # idea "src,weekdays,Wednesday" + # idea "src,weekdays,Thursday" + # idea "src,weekdays,Friday" + # idea "src,weekdays,Saturday" + # idea "src,weekdays" + # idea "src,nation-state,USA,Texas" + # idea "src,nation-state,USA,Oregon" + # idea "src,nation-state,USA" + # idea "src,nation-state,France" + # idea "src,nation-state,Brazil" + # idea "src,nation-state" + # idea "work" # , promise=True) + # idea "feed cat" # , promise=True) + # idea "src" + + # test root init status: + yrx = agent_x._idearoot + assert yrx._descendant_promise_count is None + assert yrx._all_member_credit is None + assert yrx._all_member_debt is None + assert yrx._kids["work"]._descendant_promise_count is None + assert yrx._kids["work"]._all_member_credit is None + assert yrx._kids["work"]._all_member_debt is None + assert yrx._kids["weekdays"]._kids["Monday"]._descendant_promise_count is None + assert yrx._kids["weekdays"]._kids["Monday"]._all_member_credit is None + assert yrx._kids["weekdays"]._kids["Monday"]._all_member_debt is None + + yrx._descendant_promise_count = -2 + yrx._all_member_credit = -2 + yrx._all_member_debt = -2 + yrx._kids["work"]._descendant_promise_count = -2 + yrx._kids["work"]._all_member_credit = -2 + yrx._kids["work"]._all_member_debt = -2 + yrx._kids["weekdays"]._kids["Monday"]._descendant_promise_count = -2 + yrx._kids["weekdays"]._kids["Monday"]._all_member_credit = -2 + yrx._kids["weekdays"]._kids["Monday"]._all_member_debt = -2 + + assert yrx._descendant_promise_count == -2 + assert yrx._all_member_credit == -2 + assert yrx._all_member_debt == -2 + assert yrx._kids["work"]._descendant_promise_count == -2 + assert yrx._kids["work"]._all_member_credit == -2 + assert yrx._kids["work"]._all_member_debt == -2 + assert yrx._kids["weekdays"]._kids["Monday"]._descendant_promise_count == -2 + assert yrx._kids["weekdays"]._kids["Monday"]._all_member_credit == -2 + assert yrx._kids["weekdays"]._kids["Monday"]._all_member_debt == -2 + + agent_x.set_agent_metrics() + + assert yrx._descendant_promise_count == 2 + assert yrx._kids["work"]._descendant_promise_count == 0 + assert yrx._kids["weekdays"]._kids["Monday"]._descendant_promise_count == 0 + + assert yrx._kids["weekdays"]._kids["Monday"]._all_member_credit == True + assert yrx._kids["weekdays"]._kids["Monday"]._all_member_debt == True + assert yrx._kids["work"]._all_member_credit == True + assert yrx._kids["work"]._all_member_debt == True + assert yrx._all_member_credit == True + assert yrx._all_member_debt == True + + +def test_get_idea_kid_CorrectlyReturnsIdea(): + lw_x = example_agents_get_agent_with_4_levels() + + brazil = "src,nation-state,Brazil" + idea_kid = lw_x.get_idea_kid(road=brazil) + assert idea_kid != None + assert idea_kid._desc == "Brazil" + + weekdays = "src,weekdays" + idea_kid = lw_x.get_idea_kid(road=weekdays) + assert idea_kid != None + assert idea_kid._desc == "weekdays" + + # src = "src" + # with pytest.raises(Exception) as excinfo: + # lw_x.get_idea_kid(road=src) + # assert str(excinfo.value) == f"Cannot return root '{src}'" + src = "src" + idea_root = lw_x.get_idea_kid(road=src) + assert idea_root != None + assert idea_root._desc == src + + wrong_road = "src,bobdylan" + with pytest_raises(Exception) as excinfo: + lw_x.get_idea_kid(road=wrong_road) + assert ( + str(excinfo.value) + == f"Getting idea_desc='bobdylan' failed no item at '{wrong_road}'" + ) + + +def test_set_agent_metrics_RootOnlyCorrectlySetsDescendantAttributes(): + lw_x = AgentUnit(_desc="src") + assert lw_x._idearoot._descendant_promise_count is None + assert lw_x._idearoot._all_member_credit is None + assert lw_x._idearoot._all_member_debt is None + + lw_x.set_agent_metrics() + assert lw_x._idearoot._descendant_promise_count == 0 + assert lw_x._idearoot._all_member_credit == True + assert lw_x._idearoot._all_member_debt == True + + +def test_set_agent_metrics_NLevelCorrectlySetsDescendantAttributes_1(): + lw_x = example_agents_get_agent_with_4_levels() + x_idea = IdeaKid(_desc="email", promise=True) + lw_x.add_idea(idea_kid=x_idea, walk="src,work") + + # idea "src,weekdays,Sunday" + # idea "src,weekdays,Monday" + # idea "src,weekdays,Tuesday" + # idea "src,weekdays,Wednesday" + # idea "src,weekdays,Thursday" + # idea "src,weekdays,Friday" + # idea "src,weekdays,Saturday" + # idea "src,weekdays" + # idea "src,nation-state,USA,Texas" + # idea "src,nation-state,USA,Oregon" + # idea "src,nation-state,USA" + # idea "src,nation-state,France" + # idea "src,nation-state,Brazil" + # idea "src,nation-state" + # idea "work" # , promise=True) + # idea "feed cat" # , promise=True) + # idea "src" + + # test root init status: + assert lw_x._idearoot._descendant_promise_count is None + assert lw_x._idearoot._all_member_credit is None + assert lw_x._idearoot._all_member_debt is None + assert lw_x._idearoot._kids["work"]._descendant_promise_count is None + assert lw_x._idearoot._kids["work"]._all_member_credit is None + assert lw_x._idearoot._kids["work"]._all_member_debt is None + assert ( + lw_x._idearoot._kids["weekdays"]._kids["Monday"]._descendant_promise_count + is None + ) + assert lw_x._idearoot._kids["weekdays"]._kids["Monday"]._all_member_credit is None + assert lw_x._idearoot._kids["weekdays"]._kids["Monday"]._all_member_debt is None + + lw_x.set_agent_metrics() + assert lw_x._idearoot._descendant_promise_count == 3 + assert lw_x._idearoot._kids["work"]._descendant_promise_count == 1 + assert lw_x._idearoot._kids["work"]._kids["email"]._descendant_promise_count == 0 + assert ( + lw_x._idearoot._kids["weekdays"]._kids["Monday"]._descendant_promise_count == 0 + ) + assert lw_x._idearoot._all_member_credit == True + assert lw_x._idearoot._all_member_debt == True + assert lw_x._idearoot._kids["work"]._all_member_credit == True + assert lw_x._idearoot._kids["work"]._all_member_debt == True + assert lw_x._idearoot._kids["weekdays"]._kids["Monday"]._all_member_credit == True + assert lw_x._idearoot._kids["weekdays"]._kids["Monday"]._all_member_debt == True + + +def test_set_agent_metrics_NLevelCorrectlySetsDescendantAttributes_2(): + lw_x = example_agents_get_agent_with_4_levels() + x1_idea = IdeaKid(_desc="email", promise=True) + lw_x.add_idea(idea_kid=x1_idea, walk="src,work") + x2_idea = IdeaKid(_desc="sweep", promise=True) + lw_x.add_idea(idea_kid=x2_idea, walk="src,work") + + lw_x.add_memberunit(name="sandy") + x_grouplink = GroupLink(name="sandy") + lw_x._idearoot._kids["work"]._kids["email"].set_grouplink(grouplink=x_grouplink) + # print(lw_x._kids["work"]._kids["email"]) + # print(lw_x._kids["work"]._kids["email"]._grouplink) + lw_x.set_agent_metrics() + # print(lw_x._kids["work"]._kids["email"]) + # print(lw_x._kids["work"]._kids["email"]._grouplink) + + assert lw_x._idearoot._all_member_credit == False + assert lw_x._idearoot._all_member_debt == False + assert lw_x._idearoot._kids["work"]._all_member_credit == False + assert lw_x._idearoot._kids["work"]._all_member_debt == False + assert lw_x._idearoot._kids["work"]._kids["email"]._all_member_credit == False + assert lw_x._idearoot._kids["work"]._kids["email"]._all_member_debt == False + assert lw_x._idearoot._kids["work"]._kids["sweep"]._all_member_credit == True + assert lw_x._idearoot._kids["work"]._kids["sweep"]._all_member_debt == True + assert lw_x._idearoot._kids["weekdays"]._all_member_credit == True + assert lw_x._idearoot._kids["weekdays"]._all_member_debt == True + assert lw_x._idearoot._kids["weekdays"]._kids["Monday"]._all_member_credit == True + assert lw_x._idearoot._kids["weekdays"]._kids["Monday"]._all_member_debt == True + assert lw_x._idearoot._kids["weekdays"]._kids["Tuesday"]._all_member_credit == True + assert lw_x._idearoot._kids["weekdays"]._kids["Tuesday"]._all_member_debt == True + + +def test_TreeTraverseSetsClearsGrouplineestorsCorrectly(): + # sourcery skip: simplify-empty-collection-comparison + agent_x = example_agents_get_agent_with_4_levels() + agent_x.set_agent_metrics() + # idea tree has no grouplinks + assert agent_x._idearoot._grouplines == {} + agent_x._idearoot._grouplines = {1: "testtest"} + assert agent_x._idearoot._grouplines != {} + agent_x.set_agent_metrics() + assert agent_x._idearoot._grouplines == {} + + # test for level 1 and level n + agent_x._idearoot._kids["work"]._grouplines = {1: "testtest"} + assert agent_x._idearoot._kids["work"]._grouplines != {} + agent_x.set_agent_metrics() + assert agent_x._idearoot._kids["work"]._grouplines == {} + + +def test_TreeTraverseSetsGrouplineestorFromRootCorrectly(): + # GIVEN + a_x = example_agents_get_agent_with_4_levels() + a_x.set_agent_metrics() + # idea tree has no grouplinks + assert a_x._idearoot._grouplines == {} + sandy_text = "sandy" + sandy_grouplink = GroupLink(name=sandy_text) + a_x.add_memberunit(name=sandy_text) + a_x._idearoot.set_grouplink(grouplink=sandy_grouplink) + # idea tree has grouplines + assert a_x._idearoot._groupheirs.get(sandy_text) is None + + # WHEN + a_x.set_agent_metrics() + + # THEN + assert a_x._idearoot._groupheirs.get(sandy_text) != None + assert a_x._idearoot._groupheirs.get(sandy_text).name == sandy_text + assert a_x._idearoot._grouplines != {} + root_idea = a_x.get_idea_kid(road=f"{a_x._idearoot._desc}") + sandy_groupline = a_x._idearoot._grouplines.get(sandy_text) + print(f"{sandy_groupline._agent_credit=} {root_idea._agent_importance=} ") + print(f" {sandy_groupline._agent_debt=} {root_idea._agent_importance=} ") + sum_x = 0 + cat_road = "src,feed cat" + cat_idea = a_x.get_idea_kid(cat_road) + week_road = "src,weekdays" + week_idea = a_x.get_idea_kid(week_road) + work_road = "src,work" + work_idea = a_x.get_idea_kid(work_road) + nation_road = "src,nation-state" + nation_idea = a_x.get_idea_kid(nation_road) + sum_x = cat_idea._agent_importance + print(f"{cat_idea._agent_importance=} {sum_x} ") + sum_x += week_idea._agent_importance + print(f"{week_idea._agent_importance=} {sum_x} ") + sum_x += work_idea._agent_importance + print(f"{work_idea._agent_importance=} {sum_x} ") + sum_x += nation_idea._agent_importance + print(f"{nation_idea._agent_importance=} {sum_x} ") + assert sum_x >= 1.0 + assert sum_x < 1.00000000001 + + # for kid_idea in root_idea._kids.values(): + # sum_x += kid_idea._agent_importance + # print(f" {kid_idea._agent_importance=} {sum_x=} {kid_idea.get_road()=}") + assert round(sandy_groupline._agent_credit, 15) == 1 + assert round(sandy_groupline._agent_debt, 15) == 1 + x_groupline = Groupline( + name=sandy_text, + _agent_credit=0.9999999999999998, + _agent_debt=0.9999999999999998, + ) + assert a_x._idearoot._grouplines == {x_groupline.name: x_groupline} + + +def test_TreeTraverseSetsGrouplineestorFromNonRootCorrectly(): + lw_x = example_agents_get_agent_with_4_levels() + lw_x.set_agent_metrics() + # idea tree has no grouplinks + assert lw_x._idearoot._grouplines == {} + lw_x.add_memberunit(name="sandy") + x_grouplink = GroupLink(name="sandy") + lw_x._idearoot._kids["work"].set_grouplink(grouplink=x_grouplink) + + # idea tree has grouplinks + lw_x.set_agent_metrics() + assert lw_x._idearoot._grouplines != {} + x_groupline = Groupline( + name="sandy", _agent_credit=0.23076923076923078, _agent_debt=0.23076923076923078 + ) + assert lw_x._idearoot._grouplines == {x_groupline.name: x_groupline} + assert lw_x._idearoot._kids["work"]._grouplines != {} + assert lw_x._idearoot._kids["work"]._grouplines == {x_groupline.name: x_groupline} + + +def test_agent4member_Exists(): + agent_x = example_agents_get_agent_with_4_levels() + x1_idea = IdeaKid(_desc="email", promise=True) + agent_x.add_idea(idea_kid=x1_idea, walk="src,work") + x2_idea = IdeaKid(_desc="sweep", promise=True) + agent_x.add_idea(idea_kid=x2_idea, walk="src,work") + + sandy_name = MemberName("sandy") + agent_x.add_memberunit(name=sandy_name) + x_grouplink = GroupLink(name=sandy_name) + yrx = agent_x._idearoot + yrx._kids["work"]._kids["email"].set_grouplink(grouplink=x_grouplink) + sandy_agent4member = agent_x.get_agent4member( + acptfacts=None, member_name=sandy_name + ) + assert sandy_agent4member + assert str(type(sandy_agent4member)).find(".agent.AgentUnit'>") + assert sandy_agent4member._desc == sandy_name + + +def test_agent4member_hasCorrectLevel1StructureNoGrouplessBranches(): + agent_x = example_agents_get_agent_with_4_levels() + x1_idea = IdeaKid(_desc="email", promise=True) + agent_x.add_idea(idea_kid=x1_idea, walk="src,work") + x2_idea = IdeaKid(_desc="sweep", promise=True) + agent_x.add_idea(idea_kid=x2_idea, walk="src,work") + + billy_name = MemberName("billy") + agent_x.add_memberunit(name=billy_name) + billy_bl = GroupLink(name=billy_name) + yrx = agent_x._idearoot + yrx._kids["weekdays"].set_grouplink(grouplink=billy_bl) + yrx._kids["feed cat"].set_grouplink(grouplink=billy_bl) + yrx._kids["nation-state"].set_grouplink(grouplink=billy_bl) + + sandy_name = MemberName("sandy") + agent_x.add_memberunit(name=sandy_name) + sandy_bl = GroupLink(name=sandy_name) + yrx._kids["work"]._kids["email"].set_grouplink(grouplink=sandy_bl) + + sandy_agent4member = agent_x.get_agent4member( + acptfacts=None, member_name=sandy_name + ) + assert len(sandy_agent4member._idearoot._kids) > 0 + print(f"{len(sandy_agent4member._idearoot._kids)=}") + assert ( + str(type(sandy_agent4member._idearoot._kids.get("work"))).find( + ".idea.IdeaKid'>" + ) + > 0 + ) + assert sandy_agent4member._idearoot._kids.get("feed cat") is None + assert sandy_agent4member._idearoot._agent_importance == 1 + y4a_work = sandy_agent4member._idearoot._kids.get("work") + assert y4a_work._agent_importance == yrx._kids["work"]._agent_importance + assert sandy_agent4member._idearoot._kids.get("__other__") != None + y4a_others = sandy_agent4member._idearoot._kids.get("__other__") + others_agent_importance = yrx._kids["weekdays"]._agent_importance + others_agent_importance += yrx._kids["feed cat"]._agent_importance + others_agent_importance += yrx._kids["nation-state"]._agent_importance + print(f"{others_agent_importance=}") + assert round(y4a_others._agent_importance, 15) == round(others_agent_importance, 15) + + +def test_agent_get_orderd_node_list_WorksCorrectly(): + lw_x = example_agents_get_agent_with_4_levels() + assert lw_x.get_idea_tree_ordered_road_list() + ordered_node_list = lw_x.get_idea_tree_ordered_road_list() + # for node in ordered_node_list: + # print(f"{node}") + assert len(ordered_node_list) == 17 + assert lw_x.get_idea_tree_ordered_road_list()[0] == "src" + assert lw_x.get_idea_tree_ordered_road_list()[8] == "src,weekdays" + + lw_y = AgentUnit(_desc="MyAgent") + assert lw_y.get_idea_tree_ordered_road_list()[0] == "MyAgent" + + +def test_agent_get_orderd_node_list_CorrectlyFiltersRangedIdeaRoads(): + src = "src" + agent_x = AgentUnit(_desc=src) + time = "timeline" + agent_x.add_idea(IdeaKid(_desc=time, _begin=0, _close=700), walk=src) + t_road = f"{src},{time}" + week = "weeks" + agent_x.add_idea(IdeaKid(_desc=week, _denom=7), walk=t_road) + + assert len(agent_x.get_idea_tree_ordered_road_list()) == 3 + assert len(agent_x.get_idea_tree_ordered_road_list(no_range_descendents=True)) == 2 + + +def test_agent_get_heir_road_list_returnsCorrectList(): + lw_x = example_agents_get_agent_with_4_levels() + weekdays = "src,weekdays" + assert lw_x.get_heir_road_list(src_road=weekdays) + heir_node_road_list = lw_x.get_heir_road_list(src_road=weekdays) + # for node in heir_node_road_list: + # print(f"{node}") + assert len(heir_node_road_list) == 8 + assert heir_node_road_list[0] == weekdays + assert heir_node_road_list[3] == f"{weekdays},Saturday" + assert heir_node_road_list[4] == f"{weekdays},Sunday" + + +# def test_agent4member_hasCorrectLevel1StructureWithGrouplessBranches_2(): +# lw_desc = "src" +# lw_x = AgentUnit(_desc=lw_desc) +# lw_x.add_idea(idea_kid=IdeaKid(_desc="A", _weight=7), walk="src") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="C", _weight=3), walk="src,A") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="E", _weight=7), walk="src,A,C") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="D", _weight=7), walk="src,A,C") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="B", _weight=13), walk="src") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="F", _weight=23), walk="src") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="G", _weight=57), walk="src") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="I"), walk="src,G") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="H"), walk="src,G") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="J"), walk="src,G,I") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="K"), walk="src,G,I") +# lw_x.add_idea(idea_kid=IdeaKid(_desc="M"), walk="src,G,H") + +# billy_name = MemberName("billy") +# lw_x.add_memberunit(name=billy_name) +# billy_bl = GroupLink(name=billy_name) +# lw_x.edit_idea_attr(road="src,G", grouplink=billy_bl) +# lw_x.edit_idea_attr(road="src,G,H,M", grouplink=billy_bl) + +# sandy_name = MemberName("sandy") +# lw_x.add_memberunit(name=sandy_name) +# sandy_bl = GroupLink(name=sandy_name) +# lw_x.edit_idea_attr(road="src,A", grouplink=sandy_bl) +# lw_x.edit_idea_attr(road="src,B", grouplink=sandy_bl) +# lw_x.edit_idea_attr(road="src,A,C,E", grouplink=sandy_bl) + +# # expected sandy +# exp_sandy = AgentUnit(_desc=lw_desc) +# exp_sandy.add_idea(idea_kid=IdeaKid(_desc="A", _agent_importance=0.07), walk="src") +# exp_sandy.add_idea(idea_kid=IdeaKid(_desc="C", _agent_importance=0.07), walk="src,A") +# exp_sandy.add_idea(idea_kid=IdeaKid(_desc="E", _agent_importance=0.5), walk="src,A,C") +# exp_sandy.add_idea(idea_kid=IdeaKid(_desc="B", _agent_importance=0.13), walk="src") + +# # generated sandy +# gen_sandy = lw_x.get_agent4member(acptfacts=None, member_name=sandy_name) + +# # confirm generated sandy is correct +# assert gen_sandy.get_idea_kid(road="src,A")._agent_importance == 0.07 +# assert gen_sandy.get_idea_kid(road="src,A,C")._agent_importance == 0.07 +# assert gen_sandy.get_idea_kid(road="src,A,C,E")._agent_importance == 0.5 +# assert gen_sandy.get_idea_kid(road="src,B")._agent_importance == 0.13 +# assert ( +# gen_sandy.get_idea_kid(road="src,A")._agent_importance +# == exp_sandy.get_idea_kid(road="src,A")._agent_importance +# ) +# assert ( +# gen_sandy.get_idea_kid(road="src,A,C")._agent_importance +# == exp_sandy.get_idea_kid(road="src,A,C")._agent_importance +# ) +# assert ( +# gen_sandy.get_idea_kid(road="src,A,C,E")._agent_importance +# == exp_sandy.get_idea_kid(road="src,A,C,E")._agent_importance +# ) +# assert ( +# gen_sandy.get_idea_kid(road="src,B")._agent_importance +# == exp_sandy.get_idea_kid(road="src,B")._agent_importance +# ) +# gen_sandy_list = gen_sandy.get_idea_list() +# assert len(gen_sandy_list) == 5 diff --git a/src/agent/test_agent/test_agent_json.py b/src/agent/test_agent/test_agent_json.py index 41b493e27..34edd61bb 100644 --- a/src/agent/test_agent/test_agent_json.py +++ b/src/agent/test_agent/test_agent_json.py @@ -31,24 +31,24 @@ def test_agent_get_dict_ReturnsDictObject(): assert x_dict != None assert str(type(x_dict)) == "" assert x_dict["_desc"] == x_agent._desc - assert x_dict["_desc"] == x_agent._toolroot._desc + assert x_dict["_desc"] == x_agent._idearoot._desc assert x_dict["_weight"] == x_agent._weight - assert x_dict["_weight"] == x_agent._toolroot._weight + assert x_dict["_weight"] == x_agent._idearoot._weight assert x_dict["_max_tree_traverse"] == x_agent._max_tree_traverse - assert x_dict["_addin"] == x_agent._toolroot._addin - assert x_dict["_numor"] == x_agent._toolroot._numor - assert x_dict["_denom"] == x_agent._toolroot._denom - assert x_dict["_reest"] == x_agent._toolroot._reest - assert x_dict["_problem_bool"] == x_agent._toolroot._problem_bool - assert x_dict["_on_meld_weight_action"] == x_agent._toolroot._on_meld_weight_action + assert x_dict["_addin"] == x_agent._idearoot._addin + assert x_dict["_numor"] == x_agent._idearoot._numor + assert x_dict["_denom"] == x_agent._idearoot._denom + assert x_dict["_reest"] == x_agent._idearoot._reest + assert x_dict["_problem_bool"] == x_agent._idearoot._problem_bool + assert x_dict["_on_meld_weight_action"] == x_agent._idearoot._on_meld_weight_action assert len(x_dict["_members"]) == len(x_agent._members) assert len(x_dict["_groups"]) == len(x_agent._groups) - assert len(x_dict["_kids"]) == len(x_agent._toolroot._kids) + assert len(x_dict["_kids"]) == len(x_agent._idearoot._kids) with pytest_raises(KeyError) as excinfo: x_dict["_level"] assert str(excinfo.value) == "'_level'" - # for kid in x_agent._toolroot._kids.values(): + # for kid in x_agent._idearoot._kids.values(): # # print(len(x_dict["_kids"][kid._desc]["_kids"])) # # print(x_dict["_kids"][kid._desc]) # # print(len(kid._kids)) @@ -65,14 +65,14 @@ def test_agent_get_dict_ReturnsDictObject(): # ap_text = "Asset management" # ap_road = f"{x_agent._desc},{ap_text}" - # ap_tool = x_agent.get_tool_kid(road=ap_road) + # ap_idea = x_agent.get_idea_kid(road=ap_road) # print(f"checking {ap_text}...") - # print(x_dict["_kids"][ap_tool._desc]["_requiredunits"]) - # assert len(x_dict["_kids"][ap_tool._desc]["_requiredunits"]) == 1 + # print(x_dict["_kids"][ap_idea._desc]["_requiredunits"]) + # assert len(x_dict["_kids"][ap_idea._desc]["_requiredunits"]) == 1 month_week_text = "month_week" month_week_road = f"{x_agent._desc},{month_week_text}" - month_week_tool = x_agent.get_tool_kid(road=month_week_road) + month_week_idea = x_agent.get_idea_kid(road=month_week_road) print("checking TlME,month_week...special_road equal to...") print(x_dict["_kids"][month_week_text]["_special_road"]) print(x_dict["_kids"][month_week_text]) @@ -108,22 +108,22 @@ def test_export_to_JSON_simple_example_works(): # print(x_dict) assert x_dict["_desc"] == x_agent._desc assert x_dict["_weight"] == x_agent._weight - assert x_dict["_addin"] == x_agent._toolroot._addin - assert x_dict["_numor"] == x_agent._toolroot._numor - assert x_dict["_denom"] == x_agent._toolroot._denom - assert x_dict["_reest"] == x_agent._toolroot._reest - assert x_dict["_problem_bool"] == x_agent._toolroot._problem_bool - assert len(x_dict["_kids"]) == len(x_agent._toolroot._kids) + assert x_dict["_addin"] == x_agent._idearoot._addin + assert x_dict["_numor"] == x_agent._idearoot._numor + assert x_dict["_denom"] == x_agent._idearoot._denom + assert x_dict["_reest"] == x_agent._idearoot._reest + assert x_dict["_problem_bool"] == x_agent._idearoot._problem_bool + assert len(x_dict["_kids"]) == len(x_agent._idearoot._kids) kids = x_dict["_kids"] shave_dict = kids["shave"] shave_acptfactunits = shave_dict["_acptfactunits"] print(f"{shave_acptfactunits=}") assert len(shave_acptfactunits) == 1 assert len(shave_acptfactunits) == len( - x_agent._toolroot._kids["shave"]._acptfactunits + x_agent._idearoot._kids["shave"]._acptfactunits ) - # for _ in x_agent._toolroot._kids.values(): + # for _ in x_agent._idearoot._kids.values(): # # check requireds exist have correct values # pass @@ -140,7 +140,7 @@ def test_export_to_JSON_BigExampleCorrectlyReturnsValues(): base=hour_min_road, pick=hour_min_road, open=5, nigh=59 ) print("step 2") - x_agent.edit_tool_attr(road=acptfactunit_x.base, acptfactunit=acptfactunit_x) + x_agent.edit_idea_attr(road=acptfactunit_x.base, acptfactunit=acptfactunit_x) print("step 3") x_agent.set_max_tree_traverse(int_x=2) @@ -156,25 +156,25 @@ def test_export_to_JSON_BigExampleCorrectlyReturnsValues(): assert x_dict["_desc"] == x_agent._desc assert x_dict["_max_tree_traverse"] == 2 assert x_dict["_max_tree_traverse"] == x_agent._max_tree_traverse - assert x_dict["_addin"] == x_agent._toolroot._addin - assert x_dict["_numor"] == x_agent._toolroot._numor - assert x_dict["_denom"] == x_agent._toolroot._denom - assert x_dict["_reest"] == x_agent._toolroot._reest - assert x_dict["_problem_bool"] == x_agent._toolroot._problem_bool - assert len(x_dict["_kids"]) == len(x_agent._toolroot._kids) + assert x_dict["_addin"] == x_agent._idearoot._addin + assert x_dict["_numor"] == x_agent._idearoot._numor + assert x_dict["_denom"] == x_agent._idearoot._denom + assert x_dict["_reest"] == x_agent._idearoot._reest + assert x_dict["_problem_bool"] == x_agent._idearoot._problem_bool + assert len(x_dict["_kids"]) == len(x_agent._idearoot._kids) kids = x_dict["_kids"] shave_dict = kids["day_minute"] shave_acptfactunits = shave_dict["_acptfactunits"] print(f"{shave_acptfactunits=}") assert len(shave_acptfactunits) == 1 assert len(shave_acptfactunits) == len( - x_agent._toolroot._kids["day_minute"]._acptfactunits + x_agent._idearoot._kids["day_minute"]._acptfactunits ) # assert x_dict["_level"] == x_agent._level # sourcery skip: no-loop-in-tests - for kid in x_agent._toolroot._kids.values(): + for kid in x_agent._idearoot._kids.values(): print(kid._desc) with contextlib.suppress(KeyError): requireds = x_dict["_kids"][kid._desc]["_requiredunits"] @@ -195,12 +195,12 @@ def test_agent_get_json_CorrectlyWorksForSimpleExample(): bikers_link = GroupLink(name=GroupName("bikers")) grouplinks_dict = {bikers_link.name: bikers_link} - agent_y._toolroot._grouplinks = grouplinks_dict + agent_y._idearoot._grouplinks = grouplinks_dict flyers_name = GroupName("flyers") flyers_link = GroupLink(name=flyers_name) grouplinks_dict_f = {flyers_link.name: flyers_link, bikers_link.name: bikers_link} - agent_y._toolroot._kids["shave"]._grouplinks = grouplinks_dict_f + agent_y._idearoot._kids["shave"]._grouplinks = grouplinks_dict_f x_json = agent_y.get_json() assert x_is_json(x_json) == True @@ -210,24 +210,24 @@ def test_agent_get_json_CorrectlyWorksForSimpleExample(): assert agent_x._desc == agent_y._desc assert agent_x._max_tree_traverse == 23 assert agent_x._max_tree_traverse == agent_y._max_tree_traverse - assert agent_x._toolroot._walk == "" - assert agent_x._toolroot._walk == agent_y._toolroot._walk - assert agent_x._toolroot._requiredunits == {} - assert len(agent_x._toolroot._kids) == 2 - assert len(agent_x._toolroot._kids["weekdays"]._kids) == 2 - assert agent_x._toolroot._kids["weekdays"]._kids["Sunday"]._weight == 20 + assert agent_x._idearoot._walk == "" + assert agent_x._idearoot._walk == agent_y._idearoot._walk + assert agent_x._idearoot._requiredunits == {} + assert len(agent_x._idearoot._kids) == 2 + assert len(agent_x._idearoot._kids["weekdays"]._kids) == 2 + assert agent_x._idearoot._kids["weekdays"]._kids["Sunday"]._weight == 20 # print(agent_y.get_dict()) - assert len(agent_x._toolroot._kids["shave"]._requiredunits) == 1 - assert len(agent_x._toolroot._acptfactunits) == 1 - assert len(agent_x._toolroot._grouplinks) == 1 - assert len(agent_x._toolroot._kids["shave"]._grouplinks) == 2 - print(agent_x._toolroot._kids["shave"]._acptfactunits) - assert len(agent_x._toolroot._kids["shave"]._acptfactunits) == 1 + assert len(agent_x._idearoot._kids["shave"]._requiredunits) == 1 + assert len(agent_x._idearoot._acptfactunits) == 1 + assert len(agent_x._idearoot._grouplinks) == 1 + assert len(agent_x._idearoot._kids["shave"]._grouplinks) == 2 + print(agent_x._idearoot._kids["shave"]._acptfactunits) + assert len(agent_x._idearoot._kids["shave"]._acptfactunits) == 1 def test_agent_get_json_CorrectlyWorksForNotSimpleExample(): lw1 = example_agents_agent_v001() - lw1.set_agent_metrics() # clean up tool _road defintions + lw1.set_agent_metrics() # clean up idea _road defintions lw1_json = lw1.get_json() assert x_is_json(json_x=lw1_json) @@ -243,11 +243,11 @@ def test_agent_get_json_CorrectlyWorksForNotSimpleExample(): assert lw3._desc == lw1._desc assert lw3._max_tree_traverse == 2 assert lw3._max_tree_traverse == lw1._max_tree_traverse - assert lw3._toolroot._desc != None - assert lw3._toolroot._desc == lw1._toolroot._desc - assert lw3._toolroot._walk == "" - assert lw3._toolroot._walk == lw1._toolroot._walk - assert len(lw3._toolroot._kids) == len(lw1._toolroot._kids) + assert lw3._idearoot._desc != None + assert lw3._idearoot._desc == lw1._idearoot._desc + assert lw3._idearoot._walk == "" + assert lw3._idearoot._walk == lw1._idearoot._walk + assert len(lw3._idearoot._kids) == len(lw1._idearoot._kids) assert len(lw3._groups) == 34 assert len(lw3._members) == 22 # for kid in lw3._kids.values(): @@ -308,8 +308,8 @@ def test_agent_jsonExportCorrectyExportsWeights(): cx1 = example_agents_agent_v001() cx1._weight = 15 assert 15 == cx1._weight - assert cx1._toolroot._weight != cx1._weight - assert cx1._toolroot._weight == 1 + assert cx1._idearoot._weight != cx1._weight + assert cx1._idearoot._weight == 1 # WHEN cx2 = agent_get_from_json(cx1.get_json()) @@ -317,6 +317,6 @@ def test_agent_jsonExportCorrectyExportsWeights(): # THEN assert cx1._weight == 15 assert cx1._weight == cx2._weight - assert cx1._toolroot._weight == 1 - assert cx1._toolroot._weight == cx2._toolroot._weight - assert cx1._toolroot._kids == cx2._toolroot._kids + assert cx1._idearoot._weight == 1 + assert cx1._idearoot._weight == cx2._idearoot._weight + assert cx1._idearoot._kids == cx2._idearoot._kids diff --git a/src/agent/test_agent/test_agent_meld.py b/src/agent/test_agent/test_agent_meld.py index 494984ee4..4e7a6599c 100644 --- a/src/agent/test_agent/test_agent_meld.py +++ b/src/agent/test_agent/test_agent_meld.py @@ -1,4 +1,4 @@ -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from src.agent.agent import AgentUnit from src.agent.group import groupunit_shop from src.agent.member import memberunit_shop @@ -90,25 +90,25 @@ def test_agent_meld_GroupUnits(): # assert ax1._groups.get(x2_name).uid == 5 -def test_agent_toolroot_meld_ToolRootAttrCorrectlyMelded(): +def test_agent_idearoot_meld_IdeaRootAttrCorrectlyMelded(): # GIVEN src = "casa" ax1 = AgentUnit(_desc="spirit") ax2 = AgentUnit(_desc="spirit") - ax2._toolroot._uid = 4 - assert ax1._toolroot._uid == 1 - assert ax2._toolroot._uid == 4 + ax2._idearoot._uid = 4 + assert ax1._idearoot._uid == 1 + assert ax2._idearoot._uid == 4 # WHEN / THEN with pytest_raises(Exception) as excinfo: ax1.meld(ax2) assert ( str(excinfo.value) - == "Meld fail tool=None,spirit _uid:1 with None,spirit _uid:4" + == "Meld fail idea=None,spirit _uid:1 with None,spirit _uid:4" ) -def test_agent_toolroot_meld_Add4ToolsScenario(): +def test_agent_idearoot_meld_Add4IdeasScenario(): # GIVEN src = "casa" tech_text = "tech" @@ -123,22 +123,22 @@ def test_agent_toolroot_meld_Add4ToolsScenario(): ax1 = AgentUnit(_desc="spirit") ax2 = AgentUnit(_desc="spirit") - ax2.add_tool(walk=src, tool_kid=ToolKid(_desc=tech_text)) - ax2.add_tool(walk=tech_road, tool_kid=ToolKid(_desc=bowl_text)) - ax2.add_tool(walk=swim_road, tool_kid=ToolKid(_desc=free_text)) + ax2.add_idea(walk=src, idea_kid=IdeaKid(_desc=tech_text)) + ax2.add_idea(walk=tech_road, idea_kid=IdeaKid(_desc=bowl_text)) + ax2.add_idea(walk=swim_road, idea_kid=IdeaKid(_desc=free_text)) # WHEN ax1.meld(ax2) # THEN - assert len(ax1.get_tool_list()) == 5 - assert ax1.get_tool_kid(road=tech_road)._desc == tech_text - assert ax1.get_tool_kid(road=bowl_road)._desc == bowl_text - assert ax1.get_tool_kid(road=swim_road)._desc == swim_text - assert ax1.get_tool_kid(road=free_road)._desc == free_text + assert len(ax1.get_idea_list()) == 5 + assert ax1.get_idea_kid(road=tech_road)._desc == tech_text + assert ax1.get_idea_kid(road=bowl_road)._desc == bowl_text + assert ax1.get_idea_kid(road=swim_road)._desc == swim_text + assert ax1.get_idea_kid(road=free_road)._desc == free_text -def test_agent_toolroot_meld_2SameToolsScenario(): +def test_agent_idearoot_meld_2SameIdeasScenario(): # GIVEN src = "casa" tech_text = "tech" @@ -147,20 +147,20 @@ def test_agent_toolroot_meld_2SameToolsScenario(): bowl_road = f"{src},{tech_text},{bowl_text}" ax1 = AgentUnit(_desc=src) - ax1.add_tool(walk=src, tool_kid=ToolKid(_desc=tech_text)) - ax1.add_tool(walk=tech_road, tool_kid=ToolKid(_desc=bowl_text)) + ax1.add_idea(walk=src, idea_kid=IdeaKid(_desc=tech_text)) + ax1.add_idea(walk=tech_road, idea_kid=IdeaKid(_desc=bowl_text)) ax2 = AgentUnit(_desc=src) - ax2.add_tool(walk=src, tool_kid=ToolKid(_desc=tech_text)) - ax2.add_tool(walk=tech_road, tool_kid=ToolKid(_desc=bowl_text)) + ax2.add_idea(walk=src, idea_kid=IdeaKid(_desc=tech_text)) + ax2.add_idea(walk=tech_road, idea_kid=IdeaKid(_desc=bowl_text)) - assert ax1.get_tool_kid(road=bowl_road)._weight == 1 + assert ax1.get_idea_kid(road=bowl_road)._weight == 1 # WHEN ax1.meld(ax2) # THEN - assert ax1.get_tool_kid(road=bowl_road)._weight == 1 - assert len(ax1.get_tool_list()) == 3 + assert ax1.get_idea_kid(road=bowl_road)._weight == 1 + assert len(ax1.get_idea_list()) == 3 def test_agent_acptfactunits_meld_BaseScenarioWorks(): @@ -172,22 +172,22 @@ def test_agent_acptfactunits_meld_BaseScenarioWorks(): bowl_road = f"{src},{tech_text},{bowl_text}" ax1 = AgentUnit(_desc="test7") - ax1.add_tool(walk=src, tool_kid=ToolKid(_desc=tech_text)) - ax1.add_tool(walk=tech_road, tool_kid=ToolKid(_desc=bowl_text)) + ax1.add_idea(walk=src, idea_kid=IdeaKid(_desc=tech_text)) + ax1.add_idea(walk=tech_road, idea_kid=IdeaKid(_desc=bowl_text)) ax1.set_acptfact(base=tech_road, pick=bowl_road) ax2 = AgentUnit(_desc="test7") - ax2.add_tool(walk=src, tool_kid=ToolKid(_desc=tech_text)) - ax2.add_tool(walk=tech_road, tool_kid=ToolKid(_desc=bowl_text)) + ax2.add_idea(walk=src, idea_kid=IdeaKid(_desc=tech_text)) + ax2.add_idea(walk=tech_road, idea_kid=IdeaKid(_desc=bowl_text)) ax2.set_acptfact(base=tech_road, pick=bowl_road) # WHEN ax1.meld(ax2) # THEN - assert len(ax1._toolroot._acptfactunits) == 1 - assert len(ax1._toolroot._acptfactunits) == len(ax2._toolroot._acptfactunits) - assert ax1._toolroot._acptfactunits == ax2._toolroot._acptfactunits + assert len(ax1._idearoot._acptfactunits) == 1 + assert len(ax1._idearoot._acptfactunits) == len(ax2._idearoot._acptfactunits) + assert ax1._idearoot._acptfactunits == ax2._idearoot._acptfactunits def test_agent_acptfactunits_meld_2AcptFactUnitsWorks(): @@ -202,15 +202,15 @@ def test_agent_acptfactunits_meld_2AcptFactUnitsWorks(): free_text = "freestyle" ax1 = AgentUnit(_desc="test7") - ax1.add_tool(walk=src, tool_kid=ToolKid(_desc=tech_text)) - ax1.add_tool(walk=tech_road, tool_kid=ToolKid(_desc=bowl_text)) - ax1.add_tool(walk=swim_road, tool_kid=ToolKid(_desc=free_text)) + ax1.add_idea(walk=src, idea_kid=IdeaKid(_desc=tech_text)) + ax1.add_idea(walk=tech_road, idea_kid=IdeaKid(_desc=bowl_text)) + ax1.add_idea(walk=swim_road, idea_kid=IdeaKid(_desc=free_text)) ax1.set_acptfact(base=tech_road, pick=bowl_road) ax2 = AgentUnit(_desc="test7") - ax2.add_tool(walk=src, tool_kid=ToolKid(_desc=tech_text)) - ax2.add_tool(walk=tech_road, tool_kid=ToolKid(_desc=bowl_text)) - ax2.add_tool(walk=swim_road, tool_kid=ToolKid(_desc=free_text)) + ax2.add_idea(walk=src, idea_kid=IdeaKid(_desc=tech_text)) + ax2.add_idea(walk=tech_road, idea_kid=IdeaKid(_desc=bowl_text)) + ax2.add_idea(walk=swim_road, idea_kid=IdeaKid(_desc=free_text)) ax2.set_acptfact(base=tech_road, pick=bowl_road) ax2.set_acptfact(base=swim_road, pick=swim_road) @@ -218,12 +218,12 @@ def test_agent_acptfactunits_meld_2AcptFactUnitsWorks(): ax1.meld(ax2) # THEN - assert len(ax1._toolroot._acptfactunits) == 2 - assert len(ax1._toolroot._acptfactunits) == len(ax2._toolroot._acptfactunits) - assert ax1._toolroot._acptfactunits == ax2._toolroot._acptfactunits + assert len(ax1._idearoot._acptfactunits) == 2 + assert len(ax1._idearoot._acptfactunits) == len(ax2._idearoot._acptfactunits) + assert ax1._idearoot._acptfactunits == ax2._idearoot._acptfactunits -def test_agent_acptfactunits_meld_ToolsMeldedBeforeAcptFacts(): +def test_agent_acptfactunits_meld_IdeasMeldedBeforeAcptFacts(): # GIVEN src = "casa" swim_text = "swim" @@ -233,7 +233,7 @@ def test_agent_acptfactunits_meld_ToolsMeldedBeforeAcptFacts(): ax1 = AgentUnit(_desc="test7") ax2 = AgentUnit(_desc="test7") - ax2.add_tool(walk=swim_road, tool_kid=ToolKid(_desc=free_text)) + ax2.add_idea(walk=swim_road, idea_kid=IdeaKid(_desc=free_text)) ax2.set_acptfact(base=swim_road, pick=swim_road) # WHEN @@ -241,11 +241,11 @@ def test_agent_acptfactunits_meld_ToolsMeldedBeforeAcptFacts(): # THEN print() - assert len(ax1._toolroot._acptfactunits) == 1 - assert ax1.get_tool_kid(swim_road)._desc == swim_text - assert ax1._toolroot._kids[swim_text]._desc == swim_text - assert len(ax1._toolroot._acptfactunits) == len(ax2._toolroot._acptfactunits) - assert ax1._toolroot._acptfactunits == ax2._toolroot._acptfactunits + assert len(ax1._idearoot._acptfactunits) == 1 + assert ax1.get_idea_kid(swim_road)._desc == swim_text + assert ax1._idearoot._kids[swim_text]._desc == swim_text + assert len(ax1._idearoot._acptfactunits) == len(ax2._idearoot._acptfactunits) + assert ax1._idearoot._acptfactunits == ax2._idearoot._acptfactunits def test_agent_acptfactunits_meld_GroupsMeldedBefore_Members(): @@ -279,10 +279,10 @@ def test_agent_acptfactunits_meld_AcptFactsAttributeCorrectlySet(): free_road = f"{src},{free_text}" ax1 = AgentUnit(_desc="test7") - ax1.add_tool(walk=swim_road, tool_kid=ToolKid(_desc=free_text)) + ax1.add_idea(walk=swim_road, idea_kid=IdeaKid(_desc=free_text)) ax2 = AgentUnit(_desc="test7") - ax2.add_tool(walk=swim_road, tool_kid=ToolKid(_desc=free_text)) + ax2.add_idea(walk=swim_road, idea_kid=IdeaKid(_desc=free_text)) ax2.set_acptfact(base=swim_road, pick=free_road, open=23, nigh=27) # WHEN @@ -290,25 +290,25 @@ def test_agent_acptfactunits_meld_AcptFactsAttributeCorrectlySet(): # THEN print() - assert len(ax1._toolroot._acptfactunits) == 1 - assert ax1._toolroot._acptfactunits[swim_road].base == swim_road - assert ax1._toolroot._acptfactunits[swim_road].pick == free_road - assert ax1._toolroot._acptfactunits[swim_road].open == 23 - assert ax1._toolroot._acptfactunits[swim_road].nigh == 27 + assert len(ax1._idearoot._acptfactunits) == 1 + assert ax1._idearoot._acptfactunits[swim_road].base == swim_road + assert ax1._idearoot._acptfactunits[swim_road].pick == free_road + assert ax1._idearoot._acptfactunits[swim_road].open == 23 + assert ax1._idearoot._acptfactunits[swim_road].nigh == 27 def test_agent_meld_worksCorrectlyForLargeExample(): # GIVEN src = "TlME" ax1 = AgentUnit(_desc=src) - ax1._toolroot._uid = 1 + ax1._idearoot._uid = 1 ax2 = agent_v001() - ax2r_bl = ax2._toolroot._grouplines + ax2r_bl = ax2._idearoot._grouplines fam_text = "Family" print( - f"Before {ax2r_bl.get(fam_text)._agent_credit=} {ax2._toolroot._kids_total_weight=}" + f"Before {ax2r_bl.get(fam_text)._agent_credit=} {ax2._idearoot._kids_total_weight=}" ) # WHEN @@ -317,17 +317,17 @@ def test_agent_meld_worksCorrectlyForLargeExample(): # THEN print( - f"After {ax2r_bl.get(fam_text)._agent_debt=} {ax2._toolroot._kids_total_weight=}" + f"After {ax2r_bl.get(fam_text)._agent_debt=} {ax2._idearoot._kids_total_weight=}" ) assert ax1._weight == ax2._weight - assert ax1._toolroot._kids == ax2._toolroot._kids - assert ax1._toolroot._uid == ax2._toolroot._uid - assert ax1._toolroot._acptfactunits == ax2._toolroot._acptfactunits + assert ax1._idearoot._kids == ax2._idearoot._kids + assert ax1._idearoot._uid == ax2._idearoot._uid + assert ax1._idearoot._acptfactunits == ax2._idearoot._acptfactunits assert ax1._groups == ax2._groups assert ax1._members == ax2._members - assert len(ax1._toolroot._acptfactunits) == 2 - assert len(ax1._toolroot._acptfactunits) == len(ax2._toolroot._acptfactunits) + assert len(ax1._idearoot._acptfactunits) == 2 + assert len(ax1._idearoot._acptfactunits) == len(ax2._idearoot._acptfactunits) assert ax1._desc == ax2._desc print(f"{len(ax1._groups.items())=}") # for ax1_group_key, ax1_group_obj in ax1._groups.items(): @@ -335,20 +335,20 @@ def test_agent_meld_worksCorrectlyForLargeExample(): # assert ax1_group_obj.uid == ax2._groups[ax1_group_key].uid # assert ax1_group_obj == ax2._groups[ax1_group_key] assert ax1._groups == ax2._groups - assert len(ax1.get_tool_list()) == len(ax2.get_tool_list()) + assert len(ax1.get_idea_list()) == len(ax2.get_idea_list()) - ax1r_bl = ax1._toolroot._grouplines + ax1r_bl = ax1._idearoot._grouplines print( - f"Melded {ax1r_bl.get(fam_text)._agent_debt=} {ax1._toolroot._kids_total_weight=}" + f"Melded {ax1r_bl.get(fam_text)._agent_debt=} {ax1._idearoot._kids_total_weight=}" ) assert ax1r_bl.get(fam_text) != None # assert ax1r_bl.get(fam_text) == ax2r_bl.get(fam_text) # assert ax1r_bl.get(fam_text).agent_credit == ax2r_bl.get(fam_text).agent_credit - print(f"{ax1r_bl.get(fam_text)._agent_credit=} {ax1._toolroot._kids_total_weight=}") - print(f"{ax2r_bl.get(fam_text)._agent_credit=} {ax1._toolroot._kids_total_weight=}") - print(f" {ax1r_bl.get(fam_text)._agent_debt=} {ax1._toolroot._kids_total_weight=}") - print(f" {ax2r_bl.get(fam_text)._agent_debt=} {ax1._toolroot._kids_total_weight=}") + print(f"{ax1r_bl.get(fam_text)._agent_credit=} {ax1._idearoot._kids_total_weight=}") + print(f"{ax2r_bl.get(fam_text)._agent_credit=} {ax1._idearoot._kids_total_weight=}") + print(f" {ax1r_bl.get(fam_text)._agent_debt=} {ax1._idearoot._kids_total_weight=}") + print(f" {ax2r_bl.get(fam_text)._agent_debt=} {ax1._idearoot._kids_total_weight=}") assert ( abs(ax1r_bl.get(fam_text)._agent_credit - ax2r_bl.get(fam_text)._agent_credit) < 0.0001 @@ -362,29 +362,29 @@ def test_agent_meld_worksCorrectlyForLargeExample(): # if groupline.name != fam_text: # assert groupline == ax2r_bl.get(groupline.name) assert ax1r_bl == ax2r_bl - # assert ax1._toolroot._grouplines == ax2._toolroot._grouplines - # assert ax1._toolroot == ax2._toolroot + # assert ax1._idearoot._grouplines == ax2._idearoot._grouplines + # assert ax1._idearoot == ax2._idearoot def test_agent_meld_make_meldable(): # GIVEN src = "Yahoo" ax1 = AgentUnit(_desc=src) - ax1._toolroot._uid = 1 + ax1._idearoot._uid = 1 ax2 = agent_v001() - assert ax2._toolroot._desc != ax1._toolroot._desc + assert ax2._idearoot._desc != ax1._idearoot._desc with pytest_raises(Exception) as excinfo: assert ax2.meld(other_agent=ax1) assert ( str(excinfo.value) - == f"Meld fail toolroot _desc '{ax2._desc}' not the same as '{ax1._desc}'" + == f"Meld fail idearoot _desc '{ax2._desc}' not the same as '{ax1._desc}'" ) # WHEN assert ax2._weight == 1 ax1.make_meldable(starting_digest_agent=ax2) - assert ax2._toolroot._desc == ax1._toolroot._desc + assert ax2._idearoot._desc == ax1._idearoot._desc # THEN assert ax2._weight == 1 diff --git a/src/agent/test_agent/test_agent_members.py b/src/agent/test_agent/test_agent_members.py index b4a3a5f14..1ef76d35b 100644 --- a/src/agent/test_agent/test_agent_members.py +++ b/src/agent/test_agent/test_agent_members.py @@ -5,7 +5,7 @@ agent_v001_with_large_agenda as examples_agent_v001_with_large_agenda, ) from src.agent.agent import AgentUnit -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from pytest import raises as pytest_raises from src.system.bank_sqlstr import RiverTmemberUnit @@ -57,16 +57,16 @@ def test_agent_set_member_correctly_sets_members_1(): assert a_x._groups["rico"]._single_member == True # WHEN - a_x._toolroot.set_grouplink( + a_x._idearoot.set_grouplink( grouplink=grouplink_shop(name=GroupName("rico"), creditor_weight=10) ) - a_x._toolroot.set_grouplink( + a_x._idearoot.set_grouplink( grouplink=grouplink_shop(name=GroupName("carmen"), creditor_weight=10) ) - a_x._toolroot.set_grouplink( + a_x._idearoot.set_grouplink( grouplink=grouplink_shop(name=GroupName("patrick"), creditor_weight=10) ) - assert len(a_x._toolroot._grouplinks) == 3 + assert len(a_x._idearoot._grouplinks) == 3 def test_agent_set_member_correctly_sets_members_2(): @@ -90,7 +90,7 @@ def test_agent_set_member_correctly_sets_members_2(): assert a_x._members[carm_text].debtor_weight == 5 -def test_agent_get_tool_list_CorrectlySetsMemberLinkAgentCreditAndDebt(): +def test_agent_get_idea_list_CorrectlySetsMemberLinkAgentCreditAndDebt(): # GIVEN prom_text = "prom" a_x = AgentUnit(_desc=prom_text) @@ -103,9 +103,9 @@ def test_agent_get_tool_list_CorrectlySetsMemberLinkAgentCreditAndDebt(): bl_rico = grouplink_shop(name=rico_text, creditor_weight=20, debtor_weight=40) bl_carm = grouplink_shop(name=carm_text, creditor_weight=10, debtor_weight=5) bl_patr = grouplink_shop(name=patr_text, creditor_weight=10, debtor_weight=5) - a_x._toolroot.set_grouplink(grouplink=bl_rico) - a_x._toolroot.set_grouplink(grouplink=bl_carm) - a_x._toolroot.set_grouplink(grouplink=bl_patr) + a_x._idearoot.set_grouplink(grouplink=bl_rico) + a_x._idearoot.set_grouplink(grouplink=bl_carm) + a_x._idearoot.set_grouplink(grouplink=bl_patr) rico_groupunit = a_x._groups.get(rico_text) carm_groupunit = a_x._groups.get(carm_text) @@ -175,7 +175,7 @@ def test_agent_get_tool_list_CorrectlySetsMemberLinkAgentCreditAndDebt(): # WHEN another action, make sure metrics are as expected selena_text = "selena" a_x.set_memberunit(memberunit=memberunit_shop(name=MemberName(selena_text))) - a_x._toolroot.set_grouplink( + a_x._idearoot.set_grouplink( grouplink=grouplink_shop( name=GroupName(selena_text), creditor_weight=20, debtor_weight=13 ) @@ -240,12 +240,12 @@ def test_agent_get_tool_list_CorrectlySetsMemberLinkAgentCreditAndDebt(): ) -def test_agent_get_tool_list_CorrectlySetsMemberUnitAgentImportance(): +def test_agent_get_idea_list_CorrectlySetsMemberUnitAgentImportance(): # GIVEN prom_text = "prom" a_x = AgentUnit(_desc=prom_text) swim_text = "swim" - a_x.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=prom_text) + a_x.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=prom_text) rico_text = "rico" carm_text = "carmen" patr_text = "patrick" @@ -255,9 +255,9 @@ def test_agent_get_tool_list_CorrectlySetsMemberUnitAgentImportance(): bl_rico = grouplink_shop(name=rico_text, creditor_weight=20, debtor_weight=40) bl_carm = grouplink_shop(name=carm_text, creditor_weight=10, debtor_weight=5) bl_patr = grouplink_shop(name=patr_text, creditor_weight=10, debtor_weight=5) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=bl_rico) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=bl_carm) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=bl_patr) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=bl_rico) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=bl_carm) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=bl_patr) rico_memberunit = a_x._members.get(rico_text) carm_memberunit = a_x._members.get(carm_text) @@ -318,7 +318,7 @@ def test_agent_get_tool_list_CorrectlySetsMemberUnitAgentImportance(): # WHEN another action, make sure metrics are as expected selena_text = "selena" a_x.set_memberunit(memberunit=memberunit_shop(name=MemberName(selena_text))) - a_x._toolroot.set_grouplink( + a_x._idearoot.set_grouplink( grouplink=grouplink_shop(name=selena_text, creditor_weight=20, debtor_weight=10) ) a_x.set_agent_metrics() @@ -384,12 +384,12 @@ def test_agent_get_tool_list_CorrectlySetsMemberUnitAgentImportance(): # assert memberunit_agent_debt_sum < 1.00000001 -def test_agent_get_tool_list_CorrectlySetsPartGroupedLWMemberUnitAgentImportance(): +def test_agent_get_idea_list_CorrectlySetsPartGroupedLWMemberUnitAgentImportance(): # GIVEN prom_text = "prom" a_x = AgentUnit(_desc=prom_text) swim_text = "swim" - a_x.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=prom_text) + a_x.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=prom_text) rico_text = "rico" carm_text = "carmen" patr_text = "patrick" @@ -399,15 +399,15 @@ def test_agent_get_tool_list_CorrectlySetsPartGroupedLWMemberUnitAgentImportance bl_rico = grouplink_shop(name=rico_text, creditor_weight=20, debtor_weight=40) bl_carm = grouplink_shop(name=carm_text, creditor_weight=10, debtor_weight=5) bl_patr = grouplink_shop(name=patr_text, creditor_weight=10, debtor_weight=5) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=bl_rico) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=bl_carm) - a_x._toolroot._kids[swim_text].set_grouplink(grouplink=bl_patr) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=bl_rico) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=bl_carm) + a_x._idearoot._kids[swim_text].set_grouplink(grouplink=bl_patr) # no grouplinks attached to this one hunt_text = "hunt" - a_x.add_tool(tool_kid=ToolKid(_desc=hunt_text, _weight=3), walk=prom_text) + a_x.add_idea(idea_kid=IdeaKid(_desc=hunt_text, _weight=3), walk=prom_text) - assert a_x._toolroot._grouplinks is None + assert a_x._idearoot._grouplinks is None # WHEN a_x.set_agent_metrics() @@ -497,10 +497,10 @@ def test_agent_get_tool_list_CorrectlySetsPartGroupedLWMemberUnitAgentImportance # assert memberunit_agent_debt_sum < 1.00000001 -def test_agent_get_tool_list_WithAllMembersWeighted(): +def test_agent_get_idea_list_WithAllMembersWeighted(): # GIVEN a_x = AgentUnit(_desc="prom") - a_x.add_tool(tool_kid=ToolKid(_desc="swim"), walk="prom") + a_x.add_idea(idea_kid=IdeaKid(_desc="swim"), walk="prom") rico_text = "rico" carm_text = "carmen" patr_text = "patrick" @@ -629,7 +629,7 @@ def test_agent_agenda_credit_debt_IsCorrectlySet(): else: agenda_yes_grouplines_count += 1 agenda_yes_grouplines_agent_i_sum += agenda_item._agent_importance - # print(f"tool importance: {agenda_item._agent_importance:.7f} {sum_agent_agenda_importance:.5f} {agenda_item._desc=} ") + # print(f"idea importance: {agenda_item._agent_importance:.7f} {sum_agent_agenda_importance:.5f} {agenda_item._desc=} ") # print(f"{agenda_item.get_road()}") print(f"{sum_agent_agenda_importance=}") assert agenda_no_grouplines_count == 20 @@ -745,7 +745,7 @@ def test_agent_agenda_ratio_credit_debt_IsCorrectlySetWhenAgendaIsEmpty(): def test_agent_get_member_groups_returnsCorrectData(): a_x = AgentUnit(_desc="prom") - a_x.add_tool(tool_kid=ToolKid(_desc="swim"), walk="prom") + a_x.add_idea(idea_kid=IdeaKid(_desc="swim"), walk="prom") rico = "rico" carmen = "carmen" patrick = "patrick" diff --git a/src/agent/test_agent/test_agent_metrics.py b/src/agent/test_agent/test_agent_metrics.py index d53ac6b37..f178edd91 100644 --- a/src/agent/test_agent/test_agent_metrics.py +++ b/src/agent/test_agent/test_agent_metrics.py @@ -30,7 +30,7 @@ def test_agent_get_missing_acptfact_bases_ReturnsAllBasesNotCoveredByAcptFacts() assert len(missing_bases) == 11 -def test_agent_3AdvocatesNoToolKid(): +def test_agent_3AdvocatesNoIdeaKid(): # GIVEN rico_text = "rico" carm_text = "carmen" @@ -44,13 +44,13 @@ def test_agent_3AdvocatesNoToolKid(): a_x.set_memberunit(memberunit=au_rico) a_x.set_memberunit(memberunit=au_carm) a_x.set_memberunit(memberunit=au_patr) - a_x._toolroot.set_grouplink( + a_x._idearoot.set_grouplink( grouplink=grouplink_shop(name=GroupName(rico_text), creditor_weight=10) ) - a_x._toolroot.set_grouplink( + a_x._idearoot.set_grouplink( grouplink=grouplink_shop(name=GroupName(carm_text), creditor_weight=10) ) - a_x._toolroot.set_grouplink( + a_x._idearoot.set_grouplink( grouplink=grouplink_shop(name=GroupName(patr_text), creditor_weight=10) ) diff --git a/src/agent/test_agent/test_agent_range.py b/src/agent/test_agent/test_agent_range.py index 35892f7c5..84047a08c 100644 --- a/src/agent/test_agent/test_agent_range.py +++ b/src/agent/test_agent/test_agent_range.py @@ -1,140 +1,140 @@ -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from src.agent.agent import AgentUnit -def test_agentAddingToolWithAddinCorrectlyTransformsRangeScenario1(): +def test_agentAddingIdeaWithAddinCorrectlyTransformsRangeScenario1(): # Given src = "src" agent_x = AgentUnit(_weight=10, _desc=src) l1 = "level1" - tool_kid_l1 = ToolKid(_weight=30, _desc=l1) - agent_x.add_tool(walk=src, tool_kid=tool_kid_l1) + idea_kid_l1 = IdeaKid(_weight=30, _desc=l1) + agent_x.add_idea(walk=src, idea_kid=idea_kid_l1) l1_road = f"{src},{l1}" rx1 = "range_root_example" - tool_kid_rx1 = ToolKid(_weight=30, _desc=rx1) - agent_x.add_tool(walk=l1_road, tool_kid=tool_kid_rx1) + idea_kid_rx1 = IdeaKid(_weight=30, _desc=rx1) + agent_x.add_idea(walk=l1_road, idea_kid=idea_kid_rx1) rx1_road = f"{l1_road},{rx1}" - agent_x.edit_tool_attr(road=rx1_road, begin=10, close=25) + agent_x.edit_idea_attr(road=rx1_road, begin=10, close=25) - y_tool = agent_x.get_tool_kid(road=rx1_road) - print(f"Add example child tool to road='{rx1_road}'") + y_idea = agent_x.get_idea_kid(road=rx1_road) + print(f"Add example child idea to road='{rx1_road}'") rcA = "range_child_example" - tool_kid_rcA = ToolKid(_weight=30, _begin=10, _close=25, _desc=rcA) - agent_x.add_tool(walk=rx1_road, tool_kid=tool_kid_rcA) + idea_kid_rcA = IdeaKid(_weight=30, _begin=10, _close=25, _desc=rcA) + agent_x.add_idea(walk=rx1_road, idea_kid=idea_kid_rcA) rcA_road = f"{rx1_road},{rcA}" - x_tool = agent_x.get_tool_kid(road=rcA_road) + x_idea = agent_x.get_idea_kid(road=rcA_road) - assert x_tool._begin == 10 - assert x_tool._close == 25 + assert x_idea._begin == 10 + assert x_idea._close == 25 # When - agent_x.edit_tool_attr(road=rcA_road, addin=7) + agent_x.edit_idea_attr(road=rcA_road, addin=7) # Then - assert x_tool._begin == 17 - assert x_tool._close == 32 + assert x_idea._begin == 17 + assert x_idea._close == 32 -def test_agentAddingToolWithAddinCorrectlyTransformsRangeScenario2(): +def test_agentAddingIdeaWithAddinCorrectlyTransformsRangeScenario2(): # Given src = "src" agent_x = AgentUnit(_weight=10, _desc=src) l1 = "level1" - tool_kid_l1 = ToolKid(_weight=30, _desc=l1) - agent_x.add_tool(walk=src, tool_kid=tool_kid_l1) + idea_kid_l1 = IdeaKid(_weight=30, _desc=l1) + agent_x.add_idea(walk=src, idea_kid=idea_kid_l1) l1_road = f"{src},{l1}" rx1 = "range_root_example" - tool_kid_rx1 = ToolKid(_weight=30, _desc=rx1) - agent_x.add_tool(walk=l1_road, tool_kid=tool_kid_rx1) + idea_kid_rx1 = IdeaKid(_weight=30, _desc=rx1) + agent_x.add_idea(walk=l1_road, idea_kid=idea_kid_rx1) rx1_road = f"{l1_road},{rx1}" - agent_x.edit_tool_attr(road=rx1_road, begin=10, close=25) + agent_x.edit_idea_attr(road=rx1_road, begin=10, close=25) - y_tool = agent_x.get_tool_kid(road=rx1_road) - print(f"Add example child tool to road='{rx1_road}'") + y_idea = agent_x.get_idea_kid(road=rx1_road) + print(f"Add example child idea to road='{rx1_road}'") rcA = "range_child_example" - tool_kid_rcA = ToolKid(_weight=30, _begin=10, _close=25, _desc=rcA) - agent_x.add_tool(walk=rx1_road, tool_kid=tool_kid_rcA) + idea_kid_rcA = IdeaKid(_weight=30, _begin=10, _close=25, _desc=rcA) + agent_x.add_idea(walk=rx1_road, idea_kid=idea_kid_rcA) rcA_road = f"{rx1_road},{rcA}" - x_tool = agent_x.get_tool_kid(road=rcA_road) + x_idea = agent_x.get_idea_kid(road=rcA_road) - assert x_tool._begin == 10 - assert x_tool._close == 25 - assert x_tool._addin is None + assert x_idea._begin == 10 + assert x_idea._close == 25 + assert x_idea._addin is None # When - agent_x.edit_tool_attr(road=rcA_road, addin=15, denom=5) + agent_x.edit_idea_attr(road=rcA_road, addin=15, denom=5) # Then - assert x_tool._begin == 5 - assert x_tool._close == 8 - assert x_tool._addin == 15 - assert x_tool._denom == 5 + assert x_idea._begin == 5 + assert x_idea._close == 8 + assert x_idea._addin == 15 + assert x_idea._denom == 5 -def test_get_tool_ranged_kids_CorrectlyReturnsAllChildren(): +def test_get_idea_ranged_kids_CorrectlyReturnsAllChildren(): # GIVEN src_text = "src" cx = AgentUnit(_desc=src_text) - cx.set_time_hreg_tools(c400_count=7) + cx.set_time_hreg_ideas(c400_count=7) # WHEN weekunit_road = f"{cx._desc},time,tech,week" - ranged_tools = cx.get_tool_ranged_kids(tool_road=weekunit_road) + ranged_ideas = cx.get_idea_ranged_kids(idea_road=weekunit_road) # # THEN - assert len(ranged_tools) == 7 + assert len(ranged_ideas) == 7 -def test_get_tool_ranged_kids_CorrectlyReturnsSomeChildrenScen1(): +def test_get_idea_ranged_kids_CorrectlyReturnsSomeChildrenScen1(): # GIVEN src_text = "src" cx = AgentUnit(_desc=src_text) - cx.set_time_hreg_tools(c400_count=7) + cx.set_time_hreg_ideas(c400_count=7) # WHEN weekunit_road = f"{cx._desc},time,tech,week" begin_x = 1440 close_x = 4 * 1440 - ranged_tools = cx.get_tool_ranged_kids( - tool_road=weekunit_road, begin=begin_x, close=close_x + ranged_ideas = cx.get_idea_ranged_kids( + idea_road=weekunit_road, begin=begin_x, close=close_x ) # THEN - # for tool_x in ranged_tools.values(): + # for idea_x in ranged_ideas.values(): # print( - # f"{begin_x=} {close_x=} {tool_x._desc=} {tool_x._begin=} {tool_x._close=} " + # f"{begin_x=} {close_x=} {idea_x._desc=} {idea_x._begin=} {idea_x._close=} " # ) - assert len(ranged_tools) == 3 + assert len(ranged_ideas) == 3 -def test_get_tool_ranged_kids_CorrectlyReturnsSomeChildrenScen2(): +def test_get_idea_ranged_kids_CorrectlyReturnsSomeChildrenScen2(): # GIVEN src_text = "src" cx = AgentUnit(_desc=src_text) - cx.set_time_hreg_tools(c400_count=7) + cx.set_time_hreg_ideas(c400_count=7) # WHEN THEN week_road = f"{cx._desc},time,tech,week" - assert len(cx.get_tool_ranged_kids(tool_road=week_road, begin=0, close=1440)) == 1 - assert len(cx.get_tool_ranged_kids(tool_road=week_road, begin=0, close=2000)) == 2 - assert len(cx.get_tool_ranged_kids(tool_road=week_road, begin=0, close=3000)) == 3 + assert len(cx.get_idea_ranged_kids(idea_road=week_road, begin=0, close=1440)) == 1 + assert len(cx.get_idea_ranged_kids(idea_road=week_road, begin=0, close=2000)) == 2 + assert len(cx.get_idea_ranged_kids(idea_road=week_road, begin=0, close=3000)) == 3 -def test_get_tool_ranged_kids_CorrectlyReturnsSomeChildrenScen3(): +def test_get_idea_ranged_kids_CorrectlyReturnsSomeChildrenScen3(): # GIVEN src_text = "src" cx = AgentUnit(_desc=src_text) - cx.set_time_hreg_tools(c400_count=7) + cx.set_time_hreg_ideas(c400_count=7) # WHEN THEN week_road = f"{cx._desc},time,tech,week" - assert len(cx.get_tool_ranged_kids(tool_road=week_road, begin=0)) == 1 - assert len(cx.get_tool_ranged_kids(tool_road=week_road, begin=1440)) == 1 + assert len(cx.get_idea_ranged_kids(idea_road=week_road, begin=0)) == 1 + assert len(cx.get_idea_ranged_kids(idea_road=week_road, begin=1440)) == 1 diff --git a/src/agent/test_agent/test_agent_required.py b/src/agent/test_agent/test_agent_required.py index 1d0f5a703..d2d88ea1d 100644 --- a/src/agent/test_agent/test_agent_required.py +++ b/src/agent/test_agent/test_agent_required.py @@ -3,7 +3,7 @@ get_agent_with_4_levels as example_agents_get_agent_with_4_levels, get_agent_irrational_example as example_agents_get_agent_irrational_example, ) -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from src.agent.required import sufffactunit_shop, RequiredUnit, RequiredHeir from src.agent.agent import AgentUnit from src.agent.x_func import from_list_get_active_status @@ -24,12 +24,12 @@ def test_agent_requiredunits_create(): ) print(f"{type(work_wk_required.base)=}") print(f"{work_wk_required.base=}") - agent_x.edit_tool_attr(road=work_road, required=work_wk_required) - work_tool = agent_x._toolroot._kids[work_text] - assert work_tool._requiredunits != None - print(work_tool._requiredunits) - assert work_tool._requiredunits[weekday_road] != None - assert work_tool._requiredunits[weekday_road] == work_wk_required + agent_x.edit_idea_attr(road=work_road, required=work_wk_required) + work_idea = agent_x._idearoot._kids[work_text] + assert work_idea._requiredunits != None + print(work_idea._requiredunits) + assert work_idea._requiredunits[weekday_road] != None + assert work_idea._requiredunits[weekday_road] == work_wk_required def test_agent_set_requiredunits_status(): @@ -47,21 +47,21 @@ def test_agent_set_requiredunits_status(): ) print(f"{type(work_wk_required.base)=}") print(f"{work_wk_required.base=}") - agent_x.edit_tool_attr(road=work_road, required=work_wk_required) - work_tool = agent_x._toolroot._kids[work_text] - assert work_tool._requiredunits != None - print(work_tool._requiredunits) - assert work_tool._requiredunits[weekday_road] != None - assert work_tool._requiredunits[weekday_road] == work_wk_required + agent_x.edit_idea_attr(road=work_road, required=work_wk_required) + work_idea = agent_x._idearoot._kids[work_text] + assert work_idea._requiredunits != None + print(work_idea._requiredunits) + assert work_idea._requiredunits[weekday_road] != None + assert work_idea._requiredunits[weekday_road] == work_wk_required def test_agenda_returned_WhenNoRequiredsExist(): lw_x = example_agents_get_agent_with_4_levels() lw_x.set_agent_metrics() work_text = "work" - assert lw_x._toolroot._kids[work_text]._task == True + assert lw_x._idearoot._kids[work_text]._task == True cat_text = "feed cat" - assert lw_x._toolroot._kids[cat_text]._task == True + assert lw_x._idearoot._kids[cat_text]._task == True def test_agent_requiredheirs_AreCorrectlyInherited(): @@ -83,25 +83,25 @@ def test_agent_requiredheirs_AreCorrectlyInherited(): base=weekday_road, sufffacts=sufffacts, _status=False, - _curr_tool_active_status=True, + _curr_idea_active_status=True, ) print(f"{work_wk_build_requiredunit.base=}") - agent_x.edit_tool_attr(road=work_road, required=work_wk_build_requiredunit) - work_tool = agent_x._toolroot._kids[work_text] - assert work_tool._requiredunits != None - # print(work_tool._requiredunits) - assert work_tool._requiredunits[weekday_road] != None - assert work_tool._requiredunits[weekday_road] == work_wk_build_requiredunit + agent_x.edit_idea_attr(road=work_road, required=work_wk_build_requiredunit) + work_idea = agent_x._idearoot._kids[work_text] + assert work_idea._requiredunits != None + # print(work_idea._requiredunits) + assert work_idea._requiredunits[weekday_road] != None + assert work_idea._requiredunits[weekday_road] == work_wk_build_requiredunit try: - work_tool._requiredheirs[weekday_road] + work_idea._requiredheirs[weekday_road] except TypeError as e: assert str(e) == "'NoneType' object is not subscriptable" - tool_list = agent_x.get_tool_list() + idea_list = agent_x.get_idea_list() - from_list_get_active_status(road=work_road, tool_list=tool_list) + from_list_get_active_status(road=work_road, idea_list=idea_list) - work_wk_cal_requiredheir = work_tool._requiredheirs[weekday_road] + work_wk_cal_requiredheir = work_idea._requiredheirs[weekday_road] print(f"{len(work_wk_cal_requiredheir.sufffacts)=}") assert len(work_wk_cal_requiredheir.sufffacts) == 1 sufffact_wed = work_wk_cal_requiredheir.sufffacts.get("src,weekdays,Wednesday") @@ -140,53 +140,53 @@ def test_agent_requiredheirs_AreCorrectlyInheritedTo4LevelsFromRoot(): base=week_road, sufffacts=sufffacts_x, _status=False, - _curr_tool_active_status=True, + _curr_idea_active_status=True, ) - a4.edit_tool_attr(road=work_road, required=work_wk_build_requiredunit) + a4.edit_idea_attr(road=work_road, required=work_wk_build_requiredunit) # WHEN rla_text = "hp" rla_road = f"{work_road},{rla_text}" - a4.add_tool(tool_kid=ToolKid(_desc=rla_text), walk=rla_road) + a4.add_idea(idea_kid=IdeaKid(_desc=rla_text), walk=rla_road) cost_text = "cost_tracking" cost_road = f"{rla_road},{cost_text}" - a4.add_tool(tool_kid=ToolKid(_desc=cost_text), walk=cost_road) - a4.get_tool_list() + a4.add_idea(idea_kid=IdeaKid(_desc=cost_text), walk=cost_road) + a4.get_idea_list() # THEN - work_tool = a4._toolroot._kids[work_text] - rla_tool = work_tool._kids[rla_text] - cost_tool = rla_tool._kids[cost_text] + work_idea = a4._idearoot._kids[work_text] + rla_idea = work_idea._kids[rla_text] + cost_idea = rla_idea._kids[cost_text] # 1 - work_wk_calc_requiredheir = work_tool._requiredheirs[week_road] + work_wk_calc_requiredheir = work_idea._requiredheirs[week_road] assert work_wk_calc_requiredheir == work_wk_built_requiredheir # 2 - rla_week_requiredheir = rla_tool._requiredheirs[week_road] + rla_week_requiredheir = rla_idea._requiredheirs[week_road] assert rla_week_requiredheir.base == work_wk_built_requiredheir.base assert rla_week_requiredheir.sufffacts == work_wk_built_requiredheir.sufffacts assert ( - rla_week_requiredheir.suff_tool_active_status - == work_wk_built_requiredheir.suff_tool_active_status + rla_week_requiredheir.suff_idea_active_status + == work_wk_built_requiredheir.suff_idea_active_status ) assert rla_week_requiredheir._status == work_wk_built_requiredheir._status assert rla_week_requiredheir._task == work_wk_built_requiredheir._task - assert rla_week_requiredheir._curr_tool_active_status - assert rla_week_requiredheir._curr_tool_active_status != work_wk_built_requiredheir + assert rla_week_requiredheir._curr_idea_active_status + assert rla_week_requiredheir._curr_idea_active_status != work_wk_built_requiredheir # 3 - cost_week_requiredheir = cost_tool._requiredheirs[week_road] + cost_week_requiredheir = cost_idea._requiredheirs[week_road] assert cost_week_requiredheir.base == work_wk_built_requiredheir.base assert cost_week_requiredheir.sufffacts == work_wk_built_requiredheir.sufffacts assert ( - cost_week_requiredheir.suff_tool_active_status - == work_wk_built_requiredheir.suff_tool_active_status + cost_week_requiredheir.suff_idea_active_status + == work_wk_built_requiredheir.suff_idea_active_status ) assert cost_week_requiredheir._status == work_wk_built_requiredheir._status assert cost_week_requiredheir._task == work_wk_built_requiredheir._task - assert cost_week_requiredheir._curr_tool_active_status - assert cost_week_requiredheir._curr_tool_active_status != work_wk_built_requiredheir + assert cost_week_requiredheir._curr_idea_active_status + assert cost_week_requiredheir._curr_idea_active_status != work_wk_built_requiredheir def test_agent_requiredheirs_AreCorrectlyInheritedTo4LevelsFromLevel2(): @@ -207,59 +207,59 @@ def test_agent_requiredheirs_AreCorrectlyInheritedTo4LevelsFromLevel2(): base=week_road, sufffacts=sufffacts, _status=False, - _curr_tool_active_status=True, + _curr_idea_active_status=True, ) - a4.edit_tool_attr(road=work_road, required=work_wk_build_requiredunit) + a4.edit_idea_attr(road=work_road, required=work_wk_build_requiredunit) rla_text = "hp" rla_road = f"{work_road},{rla_text}" - a4.add_tool(tool_kid=ToolKid(_desc=rla_text), walk=rla_road) + a4.add_idea(idea_kid=IdeaKid(_desc=rla_text), walk=rla_road) cost_text = "cost_tracking" cost_road = f"{rla_road},{cost_text}" - a4.add_tool(tool_kid=ToolKid(_desc=cost_text), walk=cost_road) + a4.add_idea(idea_kid=IdeaKid(_desc=cost_text), walk=cost_road) - work_tool = a4._toolroot._kids[work_text] - rla_tool = work_tool._kids[rla_text] - cost_tool = rla_tool._kids[cost_text] + work_idea = a4._idearoot._kids[work_text] + rla_idea = work_idea._kids[rla_text] + cost_idea = rla_idea._kids[cost_text] - assert a4._toolroot._requiredheirs is None - assert work_tool._requiredheirs is None - assert rla_tool._requiredheirs is None - assert cost_tool._requiredheirs is None + assert a4._idearoot._requiredheirs is None + assert work_idea._requiredheirs is None + assert rla_idea._requiredheirs is None + assert cost_idea._requiredheirs is None # WHEN - tool_list = a4.get_tool_list() + idea_list = a4.get_idea_list() # THEN - assert a4._toolroot._requiredheirs == {} # work_wk_built_requiredheir + assert a4._idearoot._requiredheirs == {} # work_wk_built_requiredheir # 1 - assert work_tool._requiredheirs[week_road] == work_wk_built_requiredheir + assert work_idea._requiredheirs[week_road] == work_wk_built_requiredheir # 2 - rla_week_requiredheir = rla_tool._requiredheirs[week_road] + rla_week_requiredheir = rla_idea._requiredheirs[week_road] assert rla_week_requiredheir.base == work_wk_built_requiredheir.base assert rla_week_requiredheir.sufffacts == work_wk_built_requiredheir.sufffacts assert ( - rla_week_requiredheir.suff_tool_active_status - == work_wk_built_requiredheir.suff_tool_active_status + rla_week_requiredheir.suff_idea_active_status + == work_wk_built_requiredheir.suff_idea_active_status ) assert rla_week_requiredheir._status == work_wk_built_requiredheir._status assert rla_week_requiredheir._task == work_wk_built_requiredheir._task - assert rla_week_requiredheir._curr_tool_active_status - assert rla_week_requiredheir._curr_tool_active_status != work_wk_built_requiredheir + assert rla_week_requiredheir._curr_idea_active_status + assert rla_week_requiredheir._curr_idea_active_status != work_wk_built_requiredheir # 3 - cost_week_requiredheir = cost_tool._requiredheirs[week_road] + cost_week_requiredheir = cost_idea._requiredheirs[week_road] assert cost_week_requiredheir.base == work_wk_built_requiredheir.base assert cost_week_requiredheir.sufffacts == work_wk_built_requiredheir.sufffacts assert ( - cost_week_requiredheir.suff_tool_active_status - == work_wk_built_requiredheir.suff_tool_active_status + cost_week_requiredheir.suff_idea_active_status + == work_wk_built_requiredheir.suff_idea_active_status ) assert cost_week_requiredheir._status == work_wk_built_requiredheir._status assert cost_week_requiredheir._task == work_wk_built_requiredheir._task - assert cost_week_requiredheir._curr_tool_active_status - assert cost_week_requiredheir._curr_tool_active_status != work_wk_built_requiredheir + assert cost_week_requiredheir._curr_idea_active_status + assert cost_week_requiredheir._curr_idea_active_status != work_wk_built_requiredheir def test_agent_requiredunits_set_UnCoupledMethod(): @@ -273,23 +273,23 @@ def test_agent_requiredunits_set_UnCoupledMethod(): wed_road = f"{weekday_road},{wed_text}" # When - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=work_road, required_base=weekday_road, required_sufffact=wed_road ) # Then - work_tool1 = agent_x.get_tool_kid(road=work_road) - assert work_tool1._requiredunits != None - print(work_tool1._requiredunits) - assert work_tool1._requiredunits[weekday_road] != None - assert work_tool1._requiredunits[weekday_road].sufffacts[wed_road].open is None - assert work_tool1._requiredunits[weekday_road].sufffacts[wed_road].nigh is None + work_idea1 = agent_x.get_idea_kid(road=work_road) + assert work_idea1._requiredunits != None + print(work_idea1._requiredunits) + assert work_idea1._requiredunits[weekday_road] != None + assert work_idea1._requiredunits[weekday_road].sufffacts[wed_road].open is None + assert work_idea1._requiredunits[weekday_road].sufffacts[wed_road].nigh is None work_wk_required1 = RequiredUnit(base=weekday_road, sufffacts=None) work_wk_required1.set_sufffact(sufffact=wed_road) print(f" {type(work_wk_required1.base)=}") print(f" {work_wk_required1.base=}") - assert work_tool1._requiredunits[weekday_road] == work_wk_required1 + assert work_idea1._requiredunits[weekday_road] == work_wk_required1 # Given divisor_x = 34 @@ -297,7 +297,7 @@ def test_agent_requiredunits_set_UnCoupledMethod(): nigh_x = 12 # When - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=work_road, required_base=weekday_road, required_sufffact=wed_road, @@ -307,8 +307,8 @@ def test_agent_requiredunits_set_UnCoupledMethod(): ) # Then - assert work_tool1._requiredunits[weekday_road].sufffacts[wed_road].open == 12 - assert work_tool1._requiredunits[weekday_road].sufffacts[wed_road].nigh == 12 + assert work_idea1._requiredunits[weekday_road].sufffacts[wed_road].open == 12 + assert work_idea1._requiredunits[weekday_road].sufffacts[wed_road].nigh == 12 wed_sufffact2 = sufffactunit_shop( need=wed_road, divisor=divisor_x, open=open_x, nigh=nigh_x @@ -318,12 +318,12 @@ def test_agent_requiredunits_set_UnCoupledMethod(): ) print(f"{type(work_wk_required2.base)=}") print(f"{work_wk_required2.base=}") - assert work_tool1._requiredunits[weekday_road] == work_wk_required2 + assert work_idea1._requiredunits[weekday_road] == work_wk_required2 # When thu_text = "Thursday" thu_road = f"{weekday_road},{thu_text}" - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=work_road, required_base=weekday_road, required_sufffact=thu_road, @@ -333,10 +333,10 @@ def test_agent_requiredunits_set_UnCoupledMethod(): ) # Then - assert len(work_tool1._requiredunits[weekday_road].sufffacts) == 2 + assert len(work_idea1._requiredunits[weekday_road].sufffacts) == 2 -def test_agent_requiredunits_set_sufffactToolWithDenomSetsSuffFactDivision(): +def test_agent_requiredunits_set_sufffactIdeaWithDenomSetsSuffFactDivision(): # Given agent_x = example_agents_get_agent_with_4_levels() work = "work" @@ -345,13 +345,13 @@ def test_agent_requiredunits_set_sufffactToolWithDenomSetsSuffFactDivision(): time_road = f"{agent_x._desc},{time}" week = "week" week_road = f"{agent_x._desc},{time},{week}" - agent_x.add_tool( - tool_kid=ToolKid(_desc=time, _begin=100, _close=2000), walk=agent_x._desc + agent_x.add_idea( + idea_kid=IdeaKid(_desc=time, _begin=100, _close=2000), walk=agent_x._desc ) - agent_x.add_tool(tool_kid=ToolKid(_desc=week, _denom=7), walk=time_road) + agent_x.add_idea(idea_kid=IdeaKid(_desc=week, _denom=7), walk=time_road) # When - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=work_road, required_base=time_road, required_sufffact=week_road, @@ -361,14 +361,14 @@ def test_agent_requiredunits_set_sufffactToolWithDenomSetsSuffFactDivision(): ) # Then - work_tool1 = agent_x.get_tool_kid(road=work_road) - assert work_tool1._requiredunits[time_road] != None - assert work_tool1._requiredunits[time_road].sufffacts[week_road].divisor == 7 - assert work_tool1._requiredunits[time_road].sufffacts[week_road].open == 2 - assert work_tool1._requiredunits[time_road].sufffacts[week_road].nigh == 5 + work_idea1 = agent_x.get_idea_kid(road=work_road) + assert work_idea1._requiredunits[time_road] != None + assert work_idea1._requiredunits[time_road].sufffacts[week_road].divisor == 7 + assert work_idea1._requiredunits[time_road].sufffacts[week_road].open == 2 + assert work_idea1._requiredunits[time_road].sufffacts[week_road].nigh == 5 -def test_agent_requiredunits_set_sufffactToolWithBeginCloseSetsSuffFactOpenNigh(): +def test_agent_requiredunits_set_sufffactIdeaWithBeginCloseSetsSuffFactOpenNigh(): # Given agent_x = example_agents_get_agent_with_4_levels() work = "work" @@ -377,15 +377,15 @@ def test_agent_requiredunits_set_sufffactToolWithBeginCloseSetsSuffFactOpenNigh( time_road = f"{agent_x._desc},{time}" rus_war = "rus_war" rus_war_road = f"{agent_x._desc},{time},{rus_war}" - agent_x.add_tool( - tool_kid=ToolKid(_desc=time, _begin=100, _close=2000), walk=agent_x._desc + agent_x.add_idea( + idea_kid=IdeaKid(_desc=time, _begin=100, _close=2000), walk=agent_x._desc ) - agent_x.add_tool( - tool_kid=ToolKid(_desc=rus_war, _begin=22, _close=34), walk=time_road + agent_x.add_idea( + idea_kid=IdeaKid(_desc=rus_war, _begin=22, _close=34), walk=time_road ) # When - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=work_road, required_base=time_road, required_sufffact=rus_war_road, @@ -395,11 +395,11 @@ def test_agent_requiredunits_set_sufffactToolWithBeginCloseSetsSuffFactOpenNigh( ) # Then - work_tool1 = agent_x.get_tool_kid(road=work_road) - assert work_tool1._requiredunits[time_road] != None - assert work_tool1._requiredunits[time_road].sufffacts[rus_war_road].divisor is None - assert work_tool1._requiredunits[time_road].sufffacts[rus_war_road].open == 22 - assert work_tool1._requiredunits[time_road].sufffacts[rus_war_road].nigh == 34 + work_idea1 = agent_x.get_idea_kid(road=work_road) + assert work_idea1._requiredunits[time_road] != None + assert work_idea1._requiredunits[time_road].sufffacts[rus_war_road].divisor is None + assert work_idea1._requiredunits[time_road].sufffacts[rus_war_road].open == 22 + assert work_idea1._requiredunits[time_road].sufffacts[rus_war_road].nigh == 34 def test_agent_requiredunits_del_required_sufffact_UncoupledMethod1(): @@ -409,30 +409,30 @@ def test_agent_requiredunits_del_required_sufffact_UncoupledMethod1(): weekday_road = f"{agent_x._desc},weekdays" wed_road = f"{agent_x._desc},weekdays,Wednesday" - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=work_road, required_base=weekday_road, required_sufffact=wed_road ) thu_road = f"{agent_x._desc},weekdays,Thursday" - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=work_road, required_base=weekday_road, required_sufffact=thu_road, ) - work_tool1 = agent_x.get_tool_kid(road=work_road) - assert len(work_tool1._requiredunits[weekday_road].sufffacts) == 2 + work_idea1 = agent_x.get_idea_kid(road=work_road) + assert len(work_idea1._requiredunits[weekday_road].sufffacts) == 2 # When - agent_x.del_tool_required_sufffact( + agent_x.del_idea_required_sufffact( road=work_road, required_base=weekday_road, required_sufffact=thu_road, ) # Then - assert len(work_tool1._requiredunits[weekday_road].sufffacts) == 1 + assert len(work_idea1._requiredunits[weekday_road].sufffacts) == 1 # When - agent_x.del_tool_required_sufffact( + agent_x.del_idea_required_sufffact( road=work_road, required_base=weekday_road, required_sufffact=wed_road, @@ -440,9 +440,9 @@ def test_agent_requiredunits_del_required_sufffact_UncoupledMethod1(): # Then with pytest_raises(KeyError) as excinfo: - work_tool1._requiredunits[weekday_road] + work_idea1._requiredunits[weekday_road] assert str(excinfo.value) == f"'{weekday_road}'" - assert work_tool1._requiredunits == {} + assert work_idea1._requiredunits == {} def test_agent_requiredunits_del_required_sufffact_UncoupledMethod2(): @@ -450,18 +450,18 @@ def test_agent_requiredunits_del_required_sufffact_UncoupledMethod2(): agent_x = example_agents_get_agent_with_4_levels() work_road = f"{agent_x._desc},work" weekdays_road = f"{agent_x._desc},weekdays" - work_tool1 = agent_x.get_tool_kid(road=work_road) - work_tool1.set_requiredunits_empty_if_null() - assert len(work_tool1._requiredunits) == 0 + work_idea1 = agent_x.get_idea_kid(road=work_road) + work_idea1.set_requiredunits_empty_if_null() + assert len(work_idea1._requiredunits) == 0 # When with pytest_raises(Exception) as excinfo: - work_tool1.del_requiredunit_base(weekdays_road) + work_idea1.del_requiredunit_base(weekdays_road) assert str(excinfo.value) == f"No RequiredUnit at '{weekdays_road}'" -def test_agent_edit_tool_attr_agentIsAbleToEdit_suff_tool_active_status_AnyToolIfInvaildThrowsError(): - # _suff_tool_active_status: str = None +def test_agent_edit_idea_attr_agentIsAbleToEdit_suff_idea_active_status_AnyIdeaIfInvaildThrowsError(): + # _suff_idea_active_status: str = None # must be 1 of 3: bool: True, bool: False, str="Set to Ignore" # GIVEN agent_x = example_agents_get_agent_with_4_levels() @@ -471,59 +471,59 @@ def test_agent_edit_tool_attr_agentIsAbleToEdit_suff_tool_active_status_AnyToolI commute_text = "commute to work" commute_road = f"{src_road},{commute_text}" - agent_x.add_tool(tool_kid=ToolKid(_desc=commute_text), walk=src_road) - agent_x.get_tool_list() # set tree metrics - commute_tool = agent_x.get_tool_kid(road=commute_road) - assert len(commute_tool._requiredunits) == 0 + agent_x.add_idea(idea_kid=IdeaKid(_desc=commute_text), walk=src_road) + agent_x.get_idea_list() # set tree metrics + commute_idea = agent_x.get_idea_kid(road=commute_road) + assert len(commute_idea._requiredunits) == 0 # WHEN - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=commute_road, required_base=work_road, - required_suff_tool_active_status=True, + required_suff_idea_active_status=True, ) # THEN - assert len(commute_tool._requiredunits) == 1 - requiredunit_work = commute_tool._requiredunits.get(work_road) + assert len(commute_idea._requiredunits) == 1 + requiredunit_work = commute_idea._requiredunits.get(work_road) assert requiredunit_work.base == work_road assert len(requiredunit_work.sufffacts) == 0 - assert requiredunit_work.suff_tool_active_status == True + assert requiredunit_work.suff_idea_active_status == True # WHEN - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=commute_road, required_base=work_road, - required_suff_tool_active_status=False, + required_suff_idea_active_status=False, ) # THEN - assert len(commute_tool._requiredunits) == 1 - requiredunit_work = commute_tool._requiredunits.get(work_road) + assert len(commute_idea._requiredunits) == 1 + requiredunit_work = commute_idea._requiredunits.get(work_road) assert requiredunit_work.base == work_road assert len(requiredunit_work.sufffacts) == 0 - assert requiredunit_work.suff_tool_active_status == False + assert requiredunit_work.suff_idea_active_status == False # WHEN - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=commute_road, required_base=work_road, - required_suff_tool_active_status="Set to Ignore", + required_suff_idea_active_status="Set to Ignore", ) # THEN - assert len(commute_tool._requiredunits) == 1 - requiredunit_work = commute_tool._requiredunits.get(work_road) + assert len(commute_idea._requiredunits) == 1 + requiredunit_work = commute_idea._requiredunits.get(work_road) assert requiredunit_work.base == work_road assert len(requiredunit_work.sufffacts) == 0 - assert requiredunit_work.suff_tool_active_status is None + assert requiredunit_work.suff_idea_active_status is None -def test_agent_requiredunits_ToolUnitActiveStatusInfluencesRequiredUnitStatus(): - # GIVEN an Agent with 5 tools, 1 AcptFact: - # 1. tool(...,weekdays) exists - # 2. tool(...,weekdays,wednesday) exists - # 3. tool(...,weekdays,thursday) exists +def test_agent_requiredunits_IdeaUnitActiveStatusInfluencesRequiredUnitStatus(): + # GIVEN an Agent with 5 ideas, 1 AcptFact: + # 1. idea(...,weekdays) exists + # 2. idea(...,weekdays,wednesday) exists + # 3. idea(...,weekdays,thursday) exists agent_x = example_agents_get_agent_with_4_levels() src_road = agent_x._desc work_text = "work" @@ -535,49 +535,49 @@ def test_agent_requiredunits_ToolUnitActiveStatusInfluencesRequiredUnitStatus(): thu_text = "Thursday" thu_road = f"{weekdays_road},{thu_text}" - # 4. tool(...,work) with + # 4. idea(...,work) with # 4.1 RequiredUnit: base=weekdays_road, need=thu_road # 4.2 .active_status = False - agent_x.edit_tool_attr( + agent_x.edit_idea_attr( road=work_road, required_base=weekdays_road, required_sufffact=thu_road, ) - agent_x.get_tool_list() # set tree metrics - work_tool = agent_x.get_tool_kid(road=work_road) - assert work_tool._active_status == False + agent_x.get_idea_list() # set tree metrics + work_idea = agent_x.get_idea_kid(road=work_road) + assert work_idea._active_status == False - # 5. tool(...,commute to work) with - # 5.1. RequiredUnit: tool(base=...,work) has .suff_tool_active_status = True - # 5.2. tool(...,work).active_status = False + # 5. idea(...,commute to work) with + # 5.1. RequiredUnit: idea(base=...,work) has .suff_idea_active_status = True + # 5.2. idea(...,work).active_status = False commute_text = "commute to work" commute_road = f"{src_road},{commute_text}" - agent_x.add_tool(tool_kid=ToolKid(_desc=commute_text), walk=src_road) - agent_x.edit_tool_attr( + agent_x.add_idea(idea_kid=IdeaKid(_desc=commute_text), walk=src_road) + agent_x.edit_idea_attr( road=commute_road, required_base=work_road, - required_suff_tool_active_status=True, + required_suff_idea_active_status=True, ) - commute_tool = agent_x.get_tool_kid(road=commute_road) - agent_x.get_tool_list() - assert commute_tool._active_status == False + commute_idea = agent_x.get_idea_kid(road=commute_road) + agent_x.get_idea_list() + assert commute_idea._active_status == False # AcptFact: base: (...,weekdays) pick: (...,weekdays,wednesday) agent_x.set_acptfact(base=weekdays_road, pick=wed_road) agent_x.set_agent_metrics() - assert work_tool._active_status == False - assert commute_tool._active_status == False + assert work_idea._active_status == False + assert commute_idea._active_status == False # WHEN print("before changing acptfact") agent_x.set_acptfact(base=weekdays_road, pick=thu_road) print("after changing acptfact") - agent_x.get_tool_list() - assert work_tool._active_status == True + agent_x.get_idea_list() + assert work_idea._active_status == True # THEN - assert commute_tool._active_status == True + assert commute_idea._active_status == True def test_agent_set_agent_metrics_InitimemberSetsRationalAttrToFalse(): @@ -604,8 +604,8 @@ def test_agent_tree_traverses_StopWhenNoChangeInStatusIsDetected(): # WHEN agent_x.set_agent_metrics() - # for tool_key in agent_x._tool_dict.keys(): - # print(f"{tool_key=}") + # for idea_key in agent_x._idea_dict.keys(): + # print(f"{idea_key=}") # THEN assert agent_x._tree_traverse_count == 2 diff --git a/src/agent/test_agent/test_agent_time.py b/src/agent/test_agent/test_agent_time.py index 73c392a87..7ec1b0aca 100644 --- a/src/agent/test_agent/test_agent_time.py +++ b/src/agent/test_agent/test_agent_time.py @@ -5,7 +5,7 @@ def test_time_get_time_min_from_dt_WorksCorrectly(): g_lw = AgentUnit(_desc="src") - g_lw.set_time_hreg_tools(c400_count=6) + g_lw.set_time_hreg_ideas(c400_count=6) assert g_lw.get_time_min_from_dt(dt=datetime(2000, 1, 1, 0, 0)) assert g_lw.get_time_min_from_dt(dt=datetime(1, 1, 1, 0, 0)) == 527040 assert g_lw.get_time_min_from_dt(dt=datetime(1, 1, 2, 0, 0)) == 527040 + 1440 @@ -16,7 +16,7 @@ def test_time_get_time_min_from_dt_WorksCorrectly(): def test_get_time_400YearCycle_from_min_WorksCorrectly(): g_lw = AgentUnit(_desc="src") - g_lw.set_time_hreg_tools(c400_count=6) + g_lw.set_time_hreg_ideas(c400_count=6) assert g_lw.get_time_c400_from_min(min=0)[0] == 0 assert g_lw.get_time_c400_from_min(min=210379680)[0] == 1 assert g_lw.get_time_c400_from_min(min=210379681)[0] == 1 @@ -25,7 +25,7 @@ def test_get_time_400YearCycle_from_min_WorksCorrectly(): def test_get_time_c400year_from_min_WorksCorrectly(): g_lw = AgentUnit(_desc="src") - g_lw.set_time_hreg_tools(c400_count=6) + g_lw.set_time_hreg_ideas(c400_count=6) assert g_lw.get_time_c400yr_from_min(min=0)[0] == 0 assert g_lw.get_time_c400yr_from_min(min=1)[0] == 0 assert g_lw.get_time_c400yr_from_min(min=1)[2] == 1 @@ -52,7 +52,7 @@ def _check_time_conversion_works_with_random_inputs(ax: AgentUnit): def test_get_time_dt_from_min_WorksCorrectly(): g_lw = AgentUnit(_desc="src") - g_lw.set_time_hreg_tools(c400_count=6) + g_lw.set_time_hreg_ideas(c400_count=6) assert g_lw.get_time_dt_from_min(min=5000000) # assert g_lw.get_time_dt_from_min( # min=g_lw.get_time_min_from_dt(dt=datetime(2000, 1, 1, 0, 0)) @@ -101,13 +101,13 @@ def test_get_time_dt_from_min_WorksCorrectly(): def test_get_time_(): # Given g_lw = AgentUnit(_desc="src") - g_lw.set_time_hreg_tools(c400_count=6) + g_lw.set_time_hreg_ideas(c400_count=6) - tool_list = g_lw.get_tool_list() - # for tool_x in tool_list: - # if tool_x._desc in ["min2010", "years"]: + idea_list = g_lw.get_idea_list() + # for idea_x in idea_list: + # if idea_x._desc in ["min2010", "years"]: # print( - # f"{tool_x._walk=} \t{tool_x._desc=} {tool_x._begin=} {tool_x._close=} {tool_x._addin=}" + # f"{idea_x._walk=} \t{idea_x._desc=} {idea_x._begin=} {idea_x._close=} {idea_x._addin=}" # ) # When @@ -116,20 +116,20 @@ def test_get_time_(): ) # Then - assert g_lw._toolroot._acptfactunits[f"{g_lw._desc},time,jajatime"] + assert g_lw._idearoot._acptfactunits[f"{g_lw._desc},time,jajatime"] assert ( - g_lw._toolroot._acptfactunits[f"{g_lw._desc},time,jajatime"].open == 1051898400 + g_lw._idearoot._acptfactunits[f"{g_lw._desc},time,jajatime"].open == 1051898400 ) # - 1440 assert ( - g_lw._toolroot._acptfactunits[f"{g_lw._desc},time,jajatime"].nigh == 1053934800 + g_lw._idearoot._acptfactunits[f"{g_lw._desc},time,jajatime"].nigh == 1053934800 ) # - 1440 # def test_time_hreg_set_exists(): # g_lw = AgentUnit(_desc="src") -# g_lw.set_time_hreg_tools(c400_count=6) -# tool_x = g_lw.get_tool_kid(road="src,hreg") -# assert tool_x != None +# g_lw.set_time_hreg_ideas(c400_count=6) +# idea_x = g_lw.get_idea_kid(road="src,hreg") +# assert idea_x != None # assert g_lw._kids["hreg"] # for kid in g_lw._kids["hreg"]._kids.values(): # print(f"hreg kid= {kid._desc=}") @@ -137,7 +137,7 @@ def test_get_time_(): # assert len(g_lw._kids["hreg"]._kids) > 0 -# def test_time_hreg_set_creates_tool(): +# def test_time_hreg_set_creates_idea(): # g_lw = examples.get_agent_base_time_example() # hreg_name = "hreg" @@ -145,18 +145,18 @@ def test_get_time_(): # g_lw._kids[hreg_name] # assert str(excinfo.value) == f"'{hreg_name}'" # print(f"added {hreg_name}") -# g_lw.set_time_hreg_tools(c400_count=6) -# hreg_tool = g_lw._kids[hreg_name] -# assert hreg_tool != None -# assert hreg_tool._begin == 0 -# assert hreg_tool._close == 1262278080 +# g_lw.set_time_hreg_ideas(c400_count=6) +# hreg_idea = g_lw._kids[hreg_name] +# assert hreg_idea != None +# assert hreg_idea._begin == 0 +# assert hreg_idea._close == 1262278080 -# def test_time_hreg_set_CorrectlyCreatesWeekdayTool(): +# def test_time_hreg_set_CorrectlyCreatesWeekdayIdea(): # g_lw = examples.get_agent_base_time_example() -# g_lw.set_time_hreg_tools(c400_count=6) +# g_lw.set_time_hreg_ideas(c400_count=6) # weekday_name = "weekday" -# weekday = g_lw.get_tool_kid(road=f"src,hreg,{weekday_name}") +# weekday = g_lw.get_idea_kid(road=f"src,hreg,{weekday_name}") # assert weekday != None # assert weekday._begin == 0 # assert weekday._close == 7 @@ -172,12 +172,12 @@ def test_get_time_(): # def test_time_hreg_set_CorrectlyCreates400YearCycleCount(): # g_lw = examples.get_agent_base_time_example() # c400_count = 6 -# g_lw.set_time_hreg_tools(c400_count=c400_count) +# g_lw.set_time_hreg_ideas(c400_count=c400_count) # timetech_name = "400 year cycle" # timetech_road = f"src,hreg,{timetech_name}" # print(f"{timetech_road=}") -# timetech = g_lw.get_tool_kid(road=timetech_road) +# timetech = g_lw.get_idea_kid(road=timetech_road) # assert timetech != None # assert timetech._begin == 0 # assert timetech._close == c400_count @@ -186,117 +186,117 @@ def test_get_time_(): # def test_time_hreg_set_CorrectlyCreates400YearCycleYears(): # h_lw = examples.get_agent_base_time_example() # c400_count = 6 -# h_lw.set_time_hreg_tools(c400_count=c400_count) +# h_lw.set_time_hreg_ideas(c400_count=c400_count) # hy400_name = "cycle400year_years" # hy400_road = f"src,hreg,{hy400_name}" # print(f"{hy400_road=}") -# hy400_tool = h_lw.get_tool_kid(road=hy400_road) -# assert hy400_tool != None -# assert hy400_tool._begin is None -# assert hy400_tool._close is None -# assert hy400_tool.divisor == 400 +# hy400_idea = h_lw.get_idea_kid(road=hy400_road) +# assert hy400_idea != None +# assert hy400_idea._begin is None +# assert hy400_idea._close is None +# assert hy400_idea.divisor == 400 # hy400c1_name = "100yr regular" # hy400c1_road = f"{hy400_road},{hy400c1_name}" # print(f"{hy400c1_road=}") -# hy400c1_tool = hy400_tool._kids[hy400c1_name] -# assert hy400c1_tool != None -# assert hy400c1_tool._begin == 0 -# assert hy400c1_tool._close == 100 -# assert hy400c1_tool.divisor is None +# hy400c1_idea = hy400_idea._kids[hy400c1_name] +# assert hy400c1_idea != None +# assert hy400c1_idea._begin == 0 +# assert hy400c1_idea._close == 100 +# assert hy400c1_idea.divisor is None # hy400c14y_name = "regular 4yr" # hy400c14y_road = f"{hy400c1_road},{hy400c14y_name}" # print(f"{hy400c14y_road=}") -# hy400c14y_tool = hy400c1_tool._kids[hy400c14y_name] -# assert hy400c14y_tool != None -# assert hy400c14y_tool._begin is None -# assert hy400c14y_tool._close is None -# assert hy400c14y_tool.divisor == 4 +# hy400c14y_idea = hy400c1_idea._kids[hy400c14y_name] +# assert hy400c14y_idea != None +# assert hy400c14y_idea._begin is None +# assert hy400c14y_idea._close is None +# assert hy400c14y_idea.divisor == 4 # hy400c3_name = "300yr range" # hy400c3_road = f"{hy400_road},{hy400c3_name}" # print(f"{hy400c3_road=}") -# hy400c3_tool = hy400_tool._kids[hy400c3_name] -# assert hy400c3_tool != None -# assert hy400c3_tool._begin == 100 -# assert hy400c3_tool._close == 400 -# assert hy400c3_tool.divisor is None +# hy400c3_idea = hy400_idea._kids[hy400c3_name] +# assert hy400c3_idea != None +# assert hy400c3_idea._begin == 100 +# assert hy400c3_idea._close == 400 +# assert hy400c3_idea.divisor is None # hy400c3c1_name = "100yr no century leap" # hy400c3c1_road = f"{hy400c3_road},{hy400c3c1_name}" # print(f"{hy400c3c1_road=}") -# hy400c3c1_tool = hy400c3_tool._kids[hy400c3c1_name] -# assert hy400c3c1_tool != None -# assert hy400c3c1_tool._begin is None -# assert hy400c3c1_tool._close is None -# assert hy400c3c1_tool.divisor == 100 +# hy400c3c1_idea = hy400c3_idea._kids[hy400c3c1_name] +# assert hy400c3c1_idea != None +# assert hy400c3c1_idea._begin is None +# assert hy400c3c1_idea._close is None +# assert hy400c3c1_idea.divisor == 100 # hy400c3c14y_name = "4yr no leap" # hy400c3c14y_road = f"{hy400c3c1_road},{hy400c3c14y_name}" # print(f"{hy400c3c14y_road=}") -# hy400c3c14y_tool = hy400c3c1_tool._kids[hy400c3c14y_name] -# assert hy400c3c14y_tool != None -# assert hy400c3c14y_tool._begin == 0 -# assert hy400c3c14y_tool._close == 4 -# assert hy400c3c14y_tool.divisor is None +# hy400c3c14y_idea = hy400c3c1_idea._kids[hy400c3c14y_name] +# assert hy400c3c14y_idea != None +# assert hy400c3c14y_idea._begin == 0 +# assert hy400c3c14y_idea._close == 4 +# assert hy400c3c14y_idea.divisor is None # hy400c3c196_name = "96yr range" # hy400c3c196_road = f"{hy400c3c1_road},{hy400c3c196_name}" # print(f"{hy400c3c196_road=}") -# hy400c3c196_tool = hy400c3c1_tool._kids[hy400c3c196_name] -# assert hy400c3c196_tool != None -# assert hy400c3c196_tool._begin == 4 -# assert hy400c3c196_tool._close == 100 -# assert hy400c3c196_tool.divisor is None +# hy400c3c196_idea = hy400c3c1_idea._kids[hy400c3c196_name] +# assert hy400c3c196_idea != None +# assert hy400c3c196_idea._begin == 4 +# assert hy400c3c196_idea._close == 100 +# assert hy400c3c196_idea.divisor is None # hy400c3c196ry_name = "regular 4yr" # hy400c3c196ry_road = f"{hy400c3c196_road},{hy400c3c196ry_name}" # print(f"{hy400c3c196ry_road=}") -# hy400c3c196ry_tool = hy400c3c196_tool._kids[hy400c3c196ry_name] -# assert hy400c3c196ry_tool != None -# assert hy400c3c196ry_tool._begin is None -# assert hy400c3c196ry_tool._close is None -# assert hy400c3c196ry_tool.divisor == 4 +# hy400c3c196ry_idea = hy400c3c196_idea._kids[hy400c3c196ry_name] +# assert hy400c3c196ry_idea != None +# assert hy400c3c196ry_idea._begin is None +# assert hy400c3c196ry_idea._close is None +# assert hy400c3c196ry_idea.divisor == 4 # def test_time_hreg_set_CorrectlyCreates400YearCycleYears(): # h_lw = examples.get_agent_base_time_example() # c400_count = 6 -# h_lw.set_time_hreg_tools(c400_count=c400_count) +# h_lw.set_time_hreg_ideas(c400_count=c400_count) # hy400_name = "cycle400year_days" # hy400_road = f"src,hreg,{hy400_name}" # print(f"{hy400_road=}") -# hy400_tool = h_lw.get_tool_kid(road=hy400_road) -# assert hy400_tool != None -# assert hy400_tool._begin is None -# assert hy400_tool._close is None -# assert hy400_tool.divisor == 146097 +# hy400_idea = h_lw.get_idea_kid(road=hy400_road) +# assert hy400_idea != None +# assert hy400_idea._begin is None +# assert hy400_idea._close is None +# assert hy400_idea.divisor == 146097 # def test_time_hreg_set_CorrectlyCreatesDayRange(): # g_lw = examples.get_agent_base_time_example() -# g_lw.set_time_hreg_tools(c400_count=6) -# timetech = g_lw.get_tool_kid(road="src,hreg,day_range") +# g_lw.set_time_hreg_ideas(c400_count=6) +# timetech = g_lw.get_idea_kid(road="src,hreg,day_range") # assert timetech != None # assert timetech._begin == 0 # assert timetech._close == 876582 # x_lw = AgentUnit() -# g_lw.get_tool_kid(road={"src,hreg,weekday"}) +# g_lw.get_idea_kid(road={"src,hreg,weekday"}) # wed_sufffact_x = sufffactunit_shop(need=wednesday_road) # work_wk_required = RequiredUnit(base=weekday_road, sufffacts={wed_sufffact.need: wed_sufffact}) # print(f"{type(work_wk_required.base)=}") # print(f"{work_wk_required.base=}") -# agent_x.edit_tool_attr(road=work_road, required=work_wk_required) -# work_tool = agent_x._kids["work"] -# assert work_tool._requiredunits != None -# print(work_tool._requiredunits) -# assert work_tool._requiredunits[weekday_road] != None -# assert work_tool._requiredunits[weekday_road] == work_wk_required +# agent_x.edit_idea_attr(road=work_road, required=work_wk_required) +# work_idea = agent_x._kids["work"] +# assert work_idea._requiredunits != None +# print(work_idea._requiredunits) +# assert work_idea._requiredunits[weekday_road] != None +# assert work_idea._requiredunits[weekday_road] == work_wk_required # g_lw = examples.get_agent_gregorian_years() @@ -305,7 +305,7 @@ def test_get_jajatime_repeating_readable_text_correctlyText(): # GIVEN src_text = "src" cx = AgentUnit(_desc=src_text) - cx.set_time_hreg_tools(c400_count=7) + cx.set_time_hreg_ideas(c400_count=7) # WHEN / THEN print("ReturnsDailyText") diff --git a/src/agent/test_agent/test_agent_tool_crud.py b/src/agent/test_agent/test_agent_tool_crud.py deleted file mode 100644 index 92353fb93..000000000 --- a/src/agent/test_agent/test_agent_tool_crud.py +++ /dev/null @@ -1,535 +0,0 @@ -from src.agent.examples.example_agents import get_agent_with_4_levels -from src.agent.tool import ToolKid -from src.agent.required import RequiredUnit, acptfactunit_shop -from src.agent.agent import AgentUnit -from src.agent.group import grouplink_shop -from pytest import raises as pytest_raises -from src.agent.road import Road - - -def test_root_has_kids(): - # GIVEN - agent_x = AgentUnit(_desc="prom") - toolroot_x = agent_x._toolroot - tool1 = ToolKid(_weight=30, _desc="work") - tool2 = ToolKid(_weight=40, _desc="ulty") - - # WHEN - agent_x.add_tool(tool_kid=tool1, walk=agent_x._desc) - agent_x.add_tool(tool_kid=tool2, walk=agent_x._desc) - - # THEN - assert toolroot_x._weight == 1 - assert toolroot_x._kids - assert len(toolroot_x._kids) == 2 - - -def test_kid_can_have_kids(): - # GIVEN/WHEN - agent_x = get_agent_with_4_levels() - - # THEN - assert agent_x._weight == 10 - assert agent_x._toolroot._kids - print(f"{len(agent_x._toolroot._kids)=} {agent_x._toolroot._walk=}") - assert agent_x.get_level_count(level=0) == 1 - weekdays_kids = agent_x._toolroot._kids["weekdays"]._kids - weekdays_len = len(weekdays_kids) - print(f"{weekdays_len=} {agent_x._toolroot._walk=}") - # for tool in weekdays_kids.values(): - # print(f"{tool._desc=}") - assert agent_x.get_node_count() == 17 - assert agent_x.get_level_count(level=1) == 4 - assert agent_x.get_level_count(level=2) == 10 - assert agent_x.get_level_count(level=3) == 2 - - -def test_agent_add_tool_CanAddKidToRootTool(): - # GIVEN - agent_x = get_agent_with_4_levels() - assert agent_x.get_node_count() == 17 - assert agent_x.get_level_count(level=1) == 4 - - new_tool_parent_road = agent_x._desc - new_tool = ToolKid(_weight=40, _desc="new_tool") - - # WHEN - agent_x.add_tool(tool_kid=new_tool, walk=new_tool_parent_road) - - # THEN - print(f"{(agent_x._desc == new_tool_parent_road[0])=}") - print(f"{(len(new_tool_parent_road) == 1)=}") - assert agent_x.get_node_count() == 18 - assert agent_x.get_level_count(level=1) == 5 - - -def test_agent_add_tool_CanAddKidToKidTool(): - # GIVEN - agent_x = get_agent_with_4_levels() - assert agent_x.get_node_count() == 17 - assert agent_x.get_level_count(level=2) == 10 - - new_tool_parent_road = f"{agent_x._desc},work" - new_tool = ToolKid(_weight=40, _desc="new_york") - - # WHEN - agent_x.add_tool(tool_kid=new_tool, walk=new_tool_parent_road) - - # THEN - # print(f"{(agent_x._desc == new_tool_parent_road[0])=}") - # print(agent_x._toolroot._kids["work"]) - # print(f"{(len(new_tool_parent_road) == 1)=}") - assert agent_x.get_node_count() == 18 - assert agent_x.get_level_count(level=2) == 11 - assert ( - agent_x._toolroot._kids["work"]._kids["new_york"]._walk - == f"{agent_x._desc},work" - ) - agent_x._toolroot._kids["work"]._kids["new_york"].set_road(parent_road="testing") - assert agent_x._toolroot._kids["work"]._kids["new_york"]._walk == "testing" - assert agent_x.get_agenda_items - - -def test_agent_add_tool_CanAddKidToGrandkidTool(): - # GIVEN - agent_x = get_agent_with_4_levels() - assert agent_x.get_node_count() == 17 - assert agent_x.get_level_count(level=3) == 2 - new_tool_parent_road = f"{agent_x._desc},weekdays,Wednesday" - new_tool = ToolKid(_weight=40, _desc="new_tool") - - # WHEN - agent_x.add_tool(tool_kid=new_tool, walk=new_tool_parent_road) - - # THEN - print(f"{(agent_x._desc == new_tool_parent_road[0])=}") - print(agent_x._toolroot._kids["work"]) - print(f"{(len(new_tool_parent_road) == 1)=}") - assert agent_x.get_node_count() == 18 - assert agent_x.get_level_count(level=3) == 3 - - -def test_agent_add_tool_CanCreateRoadToGrandkidTool(): - # GIVEN - agent_x = get_agent_with_4_levels() - assert agent_x.get_node_count() == 17 - assert agent_x.get_level_count(level=3) == 2 - new_tool_parent_road = f"{agent_x._desc},ww2,battles,coralsea" - new_tool = ToolKid(_weight=40, _desc="USS Saratoga") - - # WHEN - agent_x.add_tool(tool_kid=new_tool, walk=new_tool_parent_road) - - # THEN - print(agent_x._toolroot._kids["ww2"]) - print(f"{(len(new_tool_parent_road) == 1)=}") - assert agent_x._toolroot._kids["ww2"]._desc == "ww2" - assert agent_x._toolroot._kids["ww2"]._kids["battles"]._desc == "battles" - assert agent_x.get_node_count() == 21 - assert agent_x.get_level_count(level=3) == 3 - - -def test_agent_add_tool_creates_requireds_tools(): - # GIVEN - agent_x = get_agent_with_4_levels() - assert agent_x.get_node_count() == 17 - assert agent_x.get_level_count(level=3) == 2 - src_text = agent_x._toolroot._desc - new_tool_parent_road = f"{src_text},work,cleaning" - clean_cookery_text = "clean_cookery" - clean_cookery_tool = ToolKid(_weight=40, _desc=clean_cookery_text, promise=True) - - buildings_text = "buildings" - buildings_road = Road(f"{src_text},{buildings_text}") - cookery_room_text = "cookery" - cookery_room_road = Road(f"{src_text},{buildings_text},{cookery_room_text}") - cookery_dirty_text = "dirty" - cookery_dirty_road = Road(f"{cookery_room_road},{cookery_dirty_text}") - required_x = RequiredUnit(base=cookery_room_road, sufffacts={}) - required_x.set_sufffact(sufffact=cookery_dirty_road) - clean_cookery_tool.set_required_unit(required=required_x) - - assert agent_x._toolroot._kids.get(buildings_text) is None - - # WHEN - agent_x.add_tool( - tool_kid=clean_cookery_tool, - walk=new_tool_parent_road, - create_missing_tools_groups=True, - ) - - # THEN - print(f"{(len(new_tool_parent_road) == 1)=}") - # for tool_kid in agent_x._toolroot._kids.values(): - # print(f"{tool_kid._desc=}") - assert agent_x._toolroot._kids.get(buildings_text) != None - assert agent_x.get_tool_kid(road=buildings_road) != None - assert agent_x.get_tool_kid(road=cookery_dirty_road) != None - assert agent_x.get_node_count() == 22 - assert agent_x.get_level_count(level=3) == 4 - - -def test_agent_toolroot_is_heir_CorrectlyChecksLineage(): - agent_x = get_agent_with_4_levels() - sunday_road = f"{agent_x._desc},weekdays,Sunday" - weekday_road = f"{agent_x._desc},weekdays" - assert agent_x._toolroot.is_heir(src=weekday_road, heir=weekday_road) - assert agent_x._toolroot.is_heir(src=weekday_road, heir=sunday_road) - assert agent_x._toolroot.is_heir(src=sunday_road, heir=weekday_road) == False - - -def test_agent_del_tool_kid_ToolLevel0CannotBeDeleted(): - # Given - agent_x = get_agent_with_4_levels() - root_road = f"{agent_x._desc}" - - # When/Then - with pytest_raises(Exception) as excinfo: - agent_x.del_tool_kid(road=root_road) - assert str(excinfo.value) == "Object cannot delete itself" - - -def test_agent_del_tool_kid_ToolLevel1CanBeDeleted_ChildrenDeleted(): - # Given - agent_x = get_agent_with_4_levels() - weekdays_road = f"{agent_x._desc},weekdays" - sunday_road = f"{agent_x._desc},weekdays,Sunday" - assert agent_x.get_tool_kid(road=weekdays_road) - assert agent_x.get_tool_kid(road=sunday_road) - - # When - agent_x.del_tool_kid(road=weekdays_road) - - # Then - with pytest_raises(Exception) as excinfo: - agent_x.get_tool_kid(road=weekdays_road) - assert ( - str(excinfo.value) - == f"Getting tool_desc='weekdays' failed no item at '{weekdays_road}'" - ) - new_sunday_road = f"{agent_x._desc},Sunday" - with pytest_raises(Exception) as excinfo: - agent_x.get_tool_kid(road=new_sunday_road) - assert ( - str(excinfo.value) - == f"Getting tool_desc='Sunday' failed no item at '{new_sunday_road}'" - ) - - -def test_agent_del_tool_kid_ToolLevel1CanBeDeleted_ChildrenInherited(): - # Given - agent_x = get_agent_with_4_levels() - weekdays_road = f"{agent_x._desc},weekdays" - old_sunday_road = f"{agent_x._desc},weekdays,Sunday" - assert agent_x.get_tool_kid(road=old_sunday_road) - - # When - agent_x.del_tool_kid(road=weekdays_road, del_children=False) - - # Then - with pytest_raises(Exception) as excinfo: - agent_x.get_tool_kid(road=old_sunday_road) - assert ( - str(excinfo.value) - == f"Getting tool_desc='Sunday' failed no item at '{old_sunday_road}'" - ) - new_sunday_road = f"{agent_x._desc},Sunday" - assert agent_x.get_tool_kid(road=new_sunday_road) - new_sunday_tool = agent_x.get_tool_kid(road=new_sunday_road) - assert new_sunday_tool._walk == f"{agent_x._desc}" - - -def test_agent_del_tool_kid_ToolLevel2CanBeDeleted_ChildrenDeleted(): - # Given - agent_x = get_agent_with_4_levels() - monday_road = f"{agent_x._desc},weekdays,Monday" - assert agent_x.get_tool_kid(road=monday_road) - - # When - agent_x.del_tool_kid(road=monday_road) - - # Then - with pytest_raises(Exception) as excinfo: - agent_x.get_tool_kid(road=monday_road) - assert ( - str(excinfo.value) - == f"Getting tool_desc='Monday' failed no item at '{monday_road}'" - ) - - -def test_agent_del_tool_kid_ToolLevelNCanBeDeleted_ChildrenDeleted(): - # Given - agent_x = get_agent_with_4_levels() - states = "nation-state" - USA = "USA" - Texas = "Texas" - texas_road = f"{agent_x._desc},{states},{USA},{Texas}" - assert agent_x.get_tool_kid(road=texas_road) - - # When - agent_x.del_tool_kid(road=texas_road) - - # Then - with pytest_raises(Exception) as excinfo: - agent_x.get_tool_kid(road=texas_road) - assert ( - str(excinfo.value) - == f"Getting tool_desc='Texas' failed no item at '{texas_road}'" - ) - - -def test_agent_edit_tool_attr_IsAbleToEditAnyAncestor_Tool(): - agent_x = get_agent_with_4_levels() - work_text = "work" - work_road = f"{agent_x._desc},{work_text}" - print(f"{work_road=}") - current_weight = agent_x._toolroot._kids[work_text]._weight - assert current_weight == 30 - agent_x.edit_tool_attr(road=work_road, weight=23) - new_weight = agent_x._toolroot._kids[work_text]._weight - assert new_weight == 23 - - # uid: int = None, - agent_x._toolroot._kids[work_text]._uid = 34 - uid_curr = agent_x._toolroot._kids[work_text]._uid - assert uid_curr == 34 - agent_x.edit_tool_attr(road=work_road, uid=23) - uid_new = agent_x._toolroot._kids[work_text]._uid - assert uid_new == 23 - - # begin: float = None, - # close: float = None, - agent_x._toolroot._kids[work_text]._begin = 39 - begin_curr = agent_x._toolroot._kids[work_text]._begin - assert begin_curr == 39 - agent_x._toolroot._kids[work_text]._close = 43 - close_curr = agent_x._toolroot._kids[work_text]._close - assert close_curr == 43 - agent_x.edit_tool_attr(road=work_road, begin=25, close=29) - assert agent_x._toolroot._kids[work_text]._begin == 25 - assert agent_x._toolroot._kids[work_text]._close == 29 - - # acptfactunit: acptfactunit_shop = None, - # agent_x._toolroot._kids[work_text]._acptfactunits = None - assert agent_x._toolroot._kids[work_text]._acptfactunits is None - acptfact_road = "src,weekdays,Sunday" - acptfactunit_x = acptfactunit_shop(base=acptfact_road, pick=acptfact_road) - - work_acptfactunits = agent_x._toolroot._kids[work_text]._acptfactunits - print(f"{work_acptfactunits=}") - agent_x.edit_tool_attr(road=work_road, acptfactunit=acptfactunit_x) - work_acptfactunits = agent_x._toolroot._kids[work_text]._acptfactunits - print(f"{work_acptfactunits=}") - assert agent_x._toolroot._kids[work_text]._acptfactunits == { - acptfactunit_x.base: acptfactunit_x - } - - # _descendant_promise_count: int = None, - agent_x._toolroot._kids[work_text]._descendant_promise_count = 81 - _descendant_promise_count_curr = agent_x._toolroot._kids[ - work_text - ]._descendant_promise_count - assert _descendant_promise_count_curr == 81 - agent_x.edit_tool_attr(road=work_road, descendant_promise_count=67) - _descendant_promise_count_new = agent_x._toolroot._kids[ - work_text - ]._descendant_promise_count - assert _descendant_promise_count_new == 67 - - # _all_member_credit: bool = None, - agent_x._toolroot._kids[work_text]._all_member_credit = 74 - _all_member_credit_curr = agent_x._toolroot._kids[work_text]._all_member_credit - assert _all_member_credit_curr == 74 - agent_x.edit_tool_attr(road=work_road, all_member_credit=59) - _all_member_credit_new = agent_x._toolroot._kids[work_text]._all_member_credit - assert _all_member_credit_new == 59 - - # _all_member_debt: bool = None, - agent_x._toolroot._kids[work_text]._all_member_debt = 74 - _all_member_debt_curr = agent_x._toolroot._kids[work_text]._all_member_debt - assert _all_member_debt_curr == 74 - agent_x.edit_tool_attr(road=work_road, all_member_debt=59) - _all_member_debt_new = agent_x._toolroot._kids[work_text]._all_member_debt - assert _all_member_debt_new == 59 - - # _grouplink: dict = None, - agent_x._toolroot._kids[work_text]._grouplinks = { - "fun": grouplink_shop(name="fun", creditor_weight=1, debtor_weight=7) - } - _grouplinks = agent_x._toolroot._kids[work_text]._grouplinks - assert _grouplinks == { - "fun": grouplink_shop(name="fun", creditor_weight=1, debtor_weight=7) - } - agent_x.edit_tool_attr( - road=work_road, - grouplink=grouplink_shop(name="fun", creditor_weight=4, debtor_weight=8), - ) - assert agent_x._toolroot._kids[work_text]._grouplinks == { - "fun": grouplink_shop(name="fun", creditor_weight=4, debtor_weight=8) - } - - # _is_expanded: dict = None, - agent_x._toolroot._kids[work_text]._is_expanded = "what" - _is_expanded = agent_x._toolroot._kids[work_text]._is_expanded - assert _is_expanded == "what" - agent_x.edit_tool_attr(road=work_road, is_expanded=True) - assert agent_x._toolroot._kids[work_text]._is_expanded == True - - # promise: dict = None, - agent_x._toolroot._kids[work_text].promise = "funfun3" - action = agent_x._toolroot._kids[work_text].promise - assert action == "funfun3" - agent_x.edit_tool_attr(road=work_road, promise=True) - assert agent_x._toolroot._kids[work_text].promise == True - - # _problem_bool - agent_x._toolroot._kids[work_text]._problem_bool = "heat2" - _problem_bool = agent_x._toolroot._kids[work_text]._problem_bool - assert _problem_bool == "heat2" - agent_x.edit_tool_attr(road=work_road, problem_bool=True) - assert agent_x._toolroot._kids[work_text]._problem_bool == True - - # _special_road: dict = None, - agent_x._toolroot._kids[work_text]._special_road = "fun3rol" - special_road = agent_x._toolroot._kids[work_text]._special_road - assert special_road == "fun3rol" - agent_x.edit_tool_attr(road=work_road, special_road="my,work,end") - assert agent_x._toolroot._kids[work_text]._special_road == "my,work,end" - - -def test_agent_edit_tool_attr_agentIsAbleToEdit_on_meld_weight_action_AnyToolIfInvaildThrowsError(): - agent_x = get_agent_with_4_levels() - work_road = f"{agent_x._desc},work" - - # When/Then - with pytest_raises(Exception) as excinfo: - agent_x.edit_tool_attr(road=work_road, on_meld_weight_action="yahoo9") - assert ( - str(excinfo.value) - == "ToolCore unit 'work' cannot have on_meld_weight_action 'yahoo9'." - ) - - -def test_agent_edit_tool_attr_agentIsAbleToEditDenomAnyToolIfInvaildDenomThrowsError(): - src = "src" - agent_x = AgentUnit(_desc=src) - # When/Then - with pytest_raises(Exception) as excinfo: - agent_x.edit_tool_attr(road="", denom=46) - assert str(excinfo.value) == "Root Tool cannot have numor denom reest." - - work = "work" - w_road = f"{src},{work}" - work_tool = ToolKid(_desc=work) - agent_x.add_tool(work_tool, walk=src) - clean = "clean" - clean_tool = ToolKid(_desc=clean) - c_road = f"{w_road},{clean}" - agent_x.add_tool(clean_tool, walk=w_road) - - # When/Then - with pytest_raises(Exception) as excinfo: - agent_x.edit_tool_attr(road=c_road, denom=46) - assert ( - str(excinfo.value) - == "Tool cannot edit numor=1/denom/reest of 'src,work,clean' if parent 'src,work' or toolcore._numeric_road does not have begin/close range" - ) - - # Given - agent_x.edit_tool_attr(road=w_road, begin=44, close=110) - agent_x.edit_tool_attr(road=c_road, denom=11) - clean_tool = agent_x.get_tool_kid(road=c_road) - assert clean_tool._begin == 4 - assert clean_tool._close == 10 - - -def test_agent_edit_tool_attr_agentIsAbleToEditDenomAnyToolInvaildDenomThrowsError(): - # Given - src = "src" - agent_x = AgentUnit(_desc=src) - work = "work" - w_road = f"{src},{work}" - work_tool = ToolKid(_desc=work, _begin=8, _close=14) - agent_x.add_tool(work_tool, walk=src) - - clean = "clean" - clean_tool = ToolKid(_desc=clean, _denom=1) - c_road = f"{w_road},{clean}" - agent_x.add_tool(clean_tool, walk=w_road) - - clean_tool = agent_x.get_tool_kid(road=c_road) - - day = "day_range" - day_tool = ToolKid(_desc=day, _begin=44, _close=110) - day_road = f"{src},{day}" - agent_x.add_tool(day_tool, walk=src) - - # When/Then - with pytest_raises(Exception) as excinfo: - agent_x.edit_tool_attr(road=c_road, numeric_road=day_road) - assert ( - str(excinfo.value) - == "Tool has begin-close range parent, cannot have numeric_road" - ) - - agent_x.edit_tool_attr(road=w_road, numeric_road=day_road) - - -def test_agent_edit_tool_attr_agentWhenParentAndNumeric_roadBothHaveRangeThrowError(): - # Given - src = "src" - agent_x = AgentUnit(_desc=src) - work = "work" - w_road = f"{src},{work}" - work_tool = ToolKid(_desc=work) - agent_x.add_tool(work_tool, walk=src) - day = "day_range" - day_tool = ToolKid(_desc=day, _begin=44, _close=110) - day_road = f"{src},{day}" - agent_x.add_tool(day_tool, walk=src) - - work_tool2 = agent_x.get_tool_kid(road=w_road) - assert work_tool2._begin is None - assert work_tool2._close is None - - with pytest_raises(Exception) as excinfo: - agent_x.edit_tool_attr(road=w_road, denom=11) - assert ( - str(excinfo.value) - == "Tool cannot edit numor=1/denom/reest of 'src,work' if parent 'src' or toolcore._numeric_road does not have begin/close range" - ) - - # When - agent_x.edit_tool_attr(road=w_road, numeric_road=day_road) - - # Then - work_tool3 = agent_x.get_tool_kid(road=w_road) - assert work_tool3._addin is None - assert work_tool3._numor is None - assert work_tool3._denom is None - assert work_tool3._reest is None - assert work_tool3._begin == 44 - assert work_tool3._close == 110 - agent_x.edit_tool_attr(road=w_road, denom=11, numeric_road=day_road) - assert work_tool3._begin == 4 - assert work_tool3._close == 10 - assert work_tool3._numor == 1 - assert work_tool3._denom == 11 - assert work_tool3._reest == False - assert work_tool3._addin == 0 - - -def test_agent_add_tool_MustReorderKidsDictToBeAlphabetical(): - # Given - src_text = "src" - ax = AgentUnit(_desc=src_text) - work_text = "work" - ax.add_tool(ToolKid(_desc=work_text), walk=src_text) - swim_text = "swim" - ax.add_tool(ToolKid(_desc=swim_text), walk=src_text) - - # WHEN - tool_list = list(ax._toolroot._kids.values()) - - # THEN - assert tool_list[0]._desc == swim_text diff --git a/src/agent/test_agent/test_agent_tool_tree.py b/src/agent/test_agent/test_agent_tool_tree.py deleted file mode 100644 index a2bafca75..000000000 --- a/src/agent/test_agent/test_agent_tool_tree.py +++ /dev/null @@ -1,465 +0,0 @@ -from src.agent.examples.example_agents import ( - get_agent_with_4_levels as example_agents_get_agent_with_4_levels, -) -from src.agent.member import MemberName -from src.agent.tool import ToolKid -from src.agent.agent import AgentUnit -from src.agent.group import Groupline, GroupLink -from pytest import raises as pytest_raises - - -def test_set_agent_metrics_CorrectlyClearsDescendantAttributes(): - agent_x = example_agents_get_agent_with_4_levels() - - # tool "src,weekdays,Sunday" - # tool "src,weekdays,Monday" - # tool "src,weekdays,Tuesday" - # tool "src,weekdays,Wednesday" - # tool "src,weekdays,Thursday" - # tool "src,weekdays,Friday" - # tool "src,weekdays,Saturday" - # tool "src,weekdays" - # tool "src,nation-state,USA,Texas" - # tool "src,nation-state,USA,Oregon" - # tool "src,nation-state,USA" - # tool "src,nation-state,France" - # tool "src,nation-state,Brazil" - # tool "src,nation-state" - # tool "work" # , promise=True) - # tool "feed cat" # , promise=True) - # tool "src" - - # test root init status: - yrx = agent_x._toolroot - assert yrx._descendant_promise_count is None - assert yrx._all_member_credit is None - assert yrx._all_member_debt is None - assert yrx._kids["work"]._descendant_promise_count is None - assert yrx._kids["work"]._all_member_credit is None - assert yrx._kids["work"]._all_member_debt is None - assert yrx._kids["weekdays"]._kids["Monday"]._descendant_promise_count is None - assert yrx._kids["weekdays"]._kids["Monday"]._all_member_credit is None - assert yrx._kids["weekdays"]._kids["Monday"]._all_member_debt is None - - yrx._descendant_promise_count = -2 - yrx._all_member_credit = -2 - yrx._all_member_debt = -2 - yrx._kids["work"]._descendant_promise_count = -2 - yrx._kids["work"]._all_member_credit = -2 - yrx._kids["work"]._all_member_debt = -2 - yrx._kids["weekdays"]._kids["Monday"]._descendant_promise_count = -2 - yrx._kids["weekdays"]._kids["Monday"]._all_member_credit = -2 - yrx._kids["weekdays"]._kids["Monday"]._all_member_debt = -2 - - assert yrx._descendant_promise_count == -2 - assert yrx._all_member_credit == -2 - assert yrx._all_member_debt == -2 - assert yrx._kids["work"]._descendant_promise_count == -2 - assert yrx._kids["work"]._all_member_credit == -2 - assert yrx._kids["work"]._all_member_debt == -2 - assert yrx._kids["weekdays"]._kids["Monday"]._descendant_promise_count == -2 - assert yrx._kids["weekdays"]._kids["Monday"]._all_member_credit == -2 - assert yrx._kids["weekdays"]._kids["Monday"]._all_member_debt == -2 - - agent_x.set_agent_metrics() - - assert yrx._descendant_promise_count == 2 - assert yrx._kids["work"]._descendant_promise_count == 0 - assert yrx._kids["weekdays"]._kids["Monday"]._descendant_promise_count == 0 - - assert yrx._kids["weekdays"]._kids["Monday"]._all_member_credit == True - assert yrx._kids["weekdays"]._kids["Monday"]._all_member_debt == True - assert yrx._kids["work"]._all_member_credit == True - assert yrx._kids["work"]._all_member_debt == True - assert yrx._all_member_credit == True - assert yrx._all_member_debt == True - - -def test_get_tool_kid_CorrectlyReturnsTool(): - lw_x = example_agents_get_agent_with_4_levels() - - brazil = "src,nation-state,Brazil" - tool_kid = lw_x.get_tool_kid(road=brazil) - assert tool_kid != None - assert tool_kid._desc == "Brazil" - - weekdays = "src,weekdays" - tool_kid = lw_x.get_tool_kid(road=weekdays) - assert tool_kid != None - assert tool_kid._desc == "weekdays" - - # src = "src" - # with pytest.raises(Exception) as excinfo: - # lw_x.get_tool_kid(road=src) - # assert str(excinfo.value) == f"Cannot return root '{src}'" - src = "src" - tool_root = lw_x.get_tool_kid(road=src) - assert tool_root != None - assert tool_root._desc == src - - wrong_road = "src,bobdylan" - with pytest_raises(Exception) as excinfo: - lw_x.get_tool_kid(road=wrong_road) - assert ( - str(excinfo.value) - == f"Getting tool_desc='bobdylan' failed no item at '{wrong_road}'" - ) - - -def test_set_agent_metrics_RootOnlyCorrectlySetsDescendantAttributes(): - lw_x = AgentUnit(_desc="src") - assert lw_x._toolroot._descendant_promise_count is None - assert lw_x._toolroot._all_member_credit is None - assert lw_x._toolroot._all_member_debt is None - - lw_x.set_agent_metrics() - assert lw_x._toolroot._descendant_promise_count == 0 - assert lw_x._toolroot._all_member_credit == True - assert lw_x._toolroot._all_member_debt == True - - -def test_set_agent_metrics_NLevelCorrectlySetsDescendantAttributes_1(): - lw_x = example_agents_get_agent_with_4_levels() - x_tool = ToolKid(_desc="email", promise=True) - lw_x.add_tool(tool_kid=x_tool, walk="src,work") - - # tool "src,weekdays,Sunday" - # tool "src,weekdays,Monday" - # tool "src,weekdays,Tuesday" - # tool "src,weekdays,Wednesday" - # tool "src,weekdays,Thursday" - # tool "src,weekdays,Friday" - # tool "src,weekdays,Saturday" - # tool "src,weekdays" - # tool "src,nation-state,USA,Texas" - # tool "src,nation-state,USA,Oregon" - # tool "src,nation-state,USA" - # tool "src,nation-state,France" - # tool "src,nation-state,Brazil" - # tool "src,nation-state" - # tool "work" # , promise=True) - # tool "feed cat" # , promise=True) - # tool "src" - - # test root init status: - assert lw_x._toolroot._descendant_promise_count is None - assert lw_x._toolroot._all_member_credit is None - assert lw_x._toolroot._all_member_debt is None - assert lw_x._toolroot._kids["work"]._descendant_promise_count is None - assert lw_x._toolroot._kids["work"]._all_member_credit is None - assert lw_x._toolroot._kids["work"]._all_member_debt is None - assert ( - lw_x._toolroot._kids["weekdays"]._kids["Monday"]._descendant_promise_count - is None - ) - assert lw_x._toolroot._kids["weekdays"]._kids["Monday"]._all_member_credit is None - assert lw_x._toolroot._kids["weekdays"]._kids["Monday"]._all_member_debt is None - - lw_x.set_agent_metrics() - assert lw_x._toolroot._descendant_promise_count == 3 - assert lw_x._toolroot._kids["work"]._descendant_promise_count == 1 - assert lw_x._toolroot._kids["work"]._kids["email"]._descendant_promise_count == 0 - assert ( - lw_x._toolroot._kids["weekdays"]._kids["Monday"]._descendant_promise_count == 0 - ) - assert lw_x._toolroot._all_member_credit == True - assert lw_x._toolroot._all_member_debt == True - assert lw_x._toolroot._kids["work"]._all_member_credit == True - assert lw_x._toolroot._kids["work"]._all_member_debt == True - assert lw_x._toolroot._kids["weekdays"]._kids["Monday"]._all_member_credit == True - assert lw_x._toolroot._kids["weekdays"]._kids["Monday"]._all_member_debt == True - - -def test_set_agent_metrics_NLevelCorrectlySetsDescendantAttributes_2(): - lw_x = example_agents_get_agent_with_4_levels() - x1_tool = ToolKid(_desc="email", promise=True) - lw_x.add_tool(tool_kid=x1_tool, walk="src,work") - x2_tool = ToolKid(_desc="sweep", promise=True) - lw_x.add_tool(tool_kid=x2_tool, walk="src,work") - - lw_x.add_memberunit(name="sandy") - x_grouplink = GroupLink(name="sandy") - lw_x._toolroot._kids["work"]._kids["email"].set_grouplink(grouplink=x_grouplink) - # print(lw_x._kids["work"]._kids["email"]) - # print(lw_x._kids["work"]._kids["email"]._grouplink) - lw_x.set_agent_metrics() - # print(lw_x._kids["work"]._kids["email"]) - # print(lw_x._kids["work"]._kids["email"]._grouplink) - - assert lw_x._toolroot._all_member_credit == False - assert lw_x._toolroot._all_member_debt == False - assert lw_x._toolroot._kids["work"]._all_member_credit == False - assert lw_x._toolroot._kids["work"]._all_member_debt == False - assert lw_x._toolroot._kids["work"]._kids["email"]._all_member_credit == False - assert lw_x._toolroot._kids["work"]._kids["email"]._all_member_debt == False - assert lw_x._toolroot._kids["work"]._kids["sweep"]._all_member_credit == True - assert lw_x._toolroot._kids["work"]._kids["sweep"]._all_member_debt == True - assert lw_x._toolroot._kids["weekdays"]._all_member_credit == True - assert lw_x._toolroot._kids["weekdays"]._all_member_debt == True - assert lw_x._toolroot._kids["weekdays"]._kids["Monday"]._all_member_credit == True - assert lw_x._toolroot._kids["weekdays"]._kids["Monday"]._all_member_debt == True - assert lw_x._toolroot._kids["weekdays"]._kids["Tuesday"]._all_member_credit == True - assert lw_x._toolroot._kids["weekdays"]._kids["Tuesday"]._all_member_debt == True - - -def test_TreeTraverseSetsClearsGrouplineestorsCorrectly(): - # sourcery skip: simplify-empty-collection-comparison - agent_x = example_agents_get_agent_with_4_levels() - agent_x.set_agent_metrics() - # tool tree has no grouplinks - assert agent_x._toolroot._grouplines == {} - agent_x._toolroot._grouplines = {1: "testtest"} - assert agent_x._toolroot._grouplines != {} - agent_x.set_agent_metrics() - assert agent_x._toolroot._grouplines == {} - - # test for level 1 and level n - agent_x._toolroot._kids["work"]._grouplines = {1: "testtest"} - assert agent_x._toolroot._kids["work"]._grouplines != {} - agent_x.set_agent_metrics() - assert agent_x._toolroot._kids["work"]._grouplines == {} - - -def test_TreeTraverseSetsGrouplineestorFromRootCorrectly(): - # GIVEN - a_x = example_agents_get_agent_with_4_levels() - a_x.set_agent_metrics() - # tool tree has no grouplinks - assert a_x._toolroot._grouplines == {} - sandy_text = "sandy" - sandy_grouplink = GroupLink(name=sandy_text) - a_x.add_memberunit(name=sandy_text) - a_x._toolroot.set_grouplink(grouplink=sandy_grouplink) - # tool tree has grouplines - assert a_x._toolroot._groupheirs.get(sandy_text) is None - - # WHEN - a_x.set_agent_metrics() - - # THEN - assert a_x._toolroot._groupheirs.get(sandy_text) != None - assert a_x._toolroot._groupheirs.get(sandy_text).name == sandy_text - assert a_x._toolroot._grouplines != {} - root_tool = a_x.get_tool_kid(road=f"{a_x._toolroot._desc}") - sandy_groupline = a_x._toolroot._grouplines.get(sandy_text) - print(f"{sandy_groupline._agent_credit=} {root_tool._agent_importance=} ") - print(f" {sandy_groupline._agent_debt=} {root_tool._agent_importance=} ") - sum_x = 0 - cat_road = "src,feed cat" - cat_tool = a_x.get_tool_kid(cat_road) - week_road = "src,weekdays" - week_tool = a_x.get_tool_kid(week_road) - work_road = "src,work" - work_tool = a_x.get_tool_kid(work_road) - nation_road = "src,nation-state" - nation_tool = a_x.get_tool_kid(nation_road) - sum_x = cat_tool._agent_importance - print(f"{cat_tool._agent_importance=} {sum_x} ") - sum_x += week_tool._agent_importance - print(f"{week_tool._agent_importance=} {sum_x} ") - sum_x += work_tool._agent_importance - print(f"{work_tool._agent_importance=} {sum_x} ") - sum_x += nation_tool._agent_importance - print(f"{nation_tool._agent_importance=} {sum_x} ") - assert sum_x >= 1.0 - assert sum_x < 1.00000000001 - - # for kid_tool in root_tool._kids.values(): - # sum_x += kid_tool._agent_importance - # print(f" {kid_tool._agent_importance=} {sum_x=} {kid_tool.get_road()=}") - assert round(sandy_groupline._agent_credit, 15) == 1 - assert round(sandy_groupline._agent_debt, 15) == 1 - x_groupline = Groupline( - name=sandy_text, - _agent_credit=0.9999999999999998, - _agent_debt=0.9999999999999998, - ) - assert a_x._toolroot._grouplines == {x_groupline.name: x_groupline} - - -def test_TreeTraverseSetsGrouplineestorFromNonRootCorrectly(): - lw_x = example_agents_get_agent_with_4_levels() - lw_x.set_agent_metrics() - # tool tree has no grouplinks - assert lw_x._toolroot._grouplines == {} - lw_x.add_memberunit(name="sandy") - x_grouplink = GroupLink(name="sandy") - lw_x._toolroot._kids["work"].set_grouplink(grouplink=x_grouplink) - - # tool tree has grouplinks - lw_x.set_agent_metrics() - assert lw_x._toolroot._grouplines != {} - x_groupline = Groupline( - name="sandy", _agent_credit=0.23076923076923078, _agent_debt=0.23076923076923078 - ) - assert lw_x._toolroot._grouplines == {x_groupline.name: x_groupline} - assert lw_x._toolroot._kids["work"]._grouplines != {} - assert lw_x._toolroot._kids["work"]._grouplines == {x_groupline.name: x_groupline} - - -def test_agent4member_Exists(): - agent_x = example_agents_get_agent_with_4_levels() - x1_tool = ToolKid(_desc="email", promise=True) - agent_x.add_tool(tool_kid=x1_tool, walk="src,work") - x2_tool = ToolKid(_desc="sweep", promise=True) - agent_x.add_tool(tool_kid=x2_tool, walk="src,work") - - sandy_name = MemberName("sandy") - agent_x.add_memberunit(name=sandy_name) - x_grouplink = GroupLink(name=sandy_name) - yrx = agent_x._toolroot - yrx._kids["work"]._kids["email"].set_grouplink(grouplink=x_grouplink) - sandy_agent4member = agent_x.get_agent4member( - acptfacts=None, member_name=sandy_name - ) - assert sandy_agent4member - assert str(type(sandy_agent4member)).find(".agent.AgentUnit'>") - assert sandy_agent4member._desc == sandy_name - - -def test_agent4member_hasCorrectLevel1StructureNoGrouplessBranches(): - agent_x = example_agents_get_agent_with_4_levels() - x1_tool = ToolKid(_desc="email", promise=True) - agent_x.add_tool(tool_kid=x1_tool, walk="src,work") - x2_tool = ToolKid(_desc="sweep", promise=True) - agent_x.add_tool(tool_kid=x2_tool, walk="src,work") - - billy_name = MemberName("billy") - agent_x.add_memberunit(name=billy_name) - billy_bl = GroupLink(name=billy_name) - yrx = agent_x._toolroot - yrx._kids["weekdays"].set_grouplink(grouplink=billy_bl) - yrx._kids["feed cat"].set_grouplink(grouplink=billy_bl) - yrx._kids["nation-state"].set_grouplink(grouplink=billy_bl) - - sandy_name = MemberName("sandy") - agent_x.add_memberunit(name=sandy_name) - sandy_bl = GroupLink(name=sandy_name) - yrx._kids["work"]._kids["email"].set_grouplink(grouplink=sandy_bl) - - sandy_agent4member = agent_x.get_agent4member( - acptfacts=None, member_name=sandy_name - ) - assert len(sandy_agent4member._toolroot._kids) > 0 - print(f"{len(sandy_agent4member._toolroot._kids)=}") - assert ( - str(type(sandy_agent4member._toolroot._kids.get("work"))).find( - ".tool.ToolKid'>" - ) - > 0 - ) - assert sandy_agent4member._toolroot._kids.get("feed cat") is None - assert sandy_agent4member._toolroot._agent_importance == 1 - y4a_work = sandy_agent4member._toolroot._kids.get("work") - assert y4a_work._agent_importance == yrx._kids["work"]._agent_importance - assert sandy_agent4member._toolroot._kids.get("__other__") != None - y4a_others = sandy_agent4member._toolroot._kids.get("__other__") - others_agent_importance = yrx._kids["weekdays"]._agent_importance - others_agent_importance += yrx._kids["feed cat"]._agent_importance - others_agent_importance += yrx._kids["nation-state"]._agent_importance - print(f"{others_agent_importance=}") - assert round(y4a_others._agent_importance, 15) == round(others_agent_importance, 15) - - -def test_agent_get_orderd_node_list_WorksCorrectly(): - lw_x = example_agents_get_agent_with_4_levels() - assert lw_x.get_tool_tree_ordered_road_list() - ordered_node_list = lw_x.get_tool_tree_ordered_road_list() - # for node in ordered_node_list: - # print(f"{node}") - assert len(ordered_node_list) == 17 - assert lw_x.get_tool_tree_ordered_road_list()[0] == "src" - assert lw_x.get_tool_tree_ordered_road_list()[8] == "src,weekdays" - - lw_y = AgentUnit(_desc="MyAgent") - assert lw_y.get_tool_tree_ordered_road_list()[0] == "MyAgent" - - -def test_agent_get_orderd_node_list_CorrectlyFiltersRangedToolRoads(): - src = "src" - agent_x = AgentUnit(_desc=src) - time = "timeline" - agent_x.add_tool(ToolKid(_desc=time, _begin=0, _close=700), walk=src) - t_road = f"{src},{time}" - week = "weeks" - agent_x.add_tool(ToolKid(_desc=week, _denom=7), walk=t_road) - - assert len(agent_x.get_tool_tree_ordered_road_list()) == 3 - assert len(agent_x.get_tool_tree_ordered_road_list(no_range_descendents=True)) == 2 - - -def test_agent_get_heir_road_list_returnsCorrectList(): - lw_x = example_agents_get_agent_with_4_levels() - weekdays = "src,weekdays" - assert lw_x.get_heir_road_list(src_road=weekdays) - heir_node_road_list = lw_x.get_heir_road_list(src_road=weekdays) - # for node in heir_node_road_list: - # print(f"{node}") - assert len(heir_node_road_list) == 8 - assert heir_node_road_list[0] == weekdays - assert heir_node_road_list[3] == f"{weekdays},Saturday" - assert heir_node_road_list[4] == f"{weekdays},Sunday" - - -# def test_agent4member_hasCorrectLevel1StructureWithGrouplessBranches_2(): -# lw_desc = "src" -# lw_x = AgentUnit(_desc=lw_desc) -# lw_x.add_tool(tool_kid=ToolKid(_desc="A", _weight=7), walk="src") -# lw_x.add_tool(tool_kid=ToolKid(_desc="C", _weight=3), walk="src,A") -# lw_x.add_tool(tool_kid=ToolKid(_desc="E", _weight=7), walk="src,A,C") -# lw_x.add_tool(tool_kid=ToolKid(_desc="D", _weight=7), walk="src,A,C") -# lw_x.add_tool(tool_kid=ToolKid(_desc="B", _weight=13), walk="src") -# lw_x.add_tool(tool_kid=ToolKid(_desc="F", _weight=23), walk="src") -# lw_x.add_tool(tool_kid=ToolKid(_desc="G", _weight=57), walk="src") -# lw_x.add_tool(tool_kid=ToolKid(_desc="I"), walk="src,G") -# lw_x.add_tool(tool_kid=ToolKid(_desc="H"), walk="src,G") -# lw_x.add_tool(tool_kid=ToolKid(_desc="J"), walk="src,G,I") -# lw_x.add_tool(tool_kid=ToolKid(_desc="K"), walk="src,G,I") -# lw_x.add_tool(tool_kid=ToolKid(_desc="M"), walk="src,G,H") - -# billy_name = MemberName("billy") -# lw_x.add_memberunit(name=billy_name) -# billy_bl = GroupLink(name=billy_name) -# lw_x.edit_tool_attr(road="src,G", grouplink=billy_bl) -# lw_x.edit_tool_attr(road="src,G,H,M", grouplink=billy_bl) - -# sandy_name = MemberName("sandy") -# lw_x.add_memberunit(name=sandy_name) -# sandy_bl = GroupLink(name=sandy_name) -# lw_x.edit_tool_attr(road="src,A", grouplink=sandy_bl) -# lw_x.edit_tool_attr(road="src,B", grouplink=sandy_bl) -# lw_x.edit_tool_attr(road="src,A,C,E", grouplink=sandy_bl) - -# # expected sandy -# exp_sandy = AgentUnit(_desc=lw_desc) -# exp_sandy.add_tool(tool_kid=ToolKid(_desc="A", _agent_importance=0.07), walk="src") -# exp_sandy.add_tool(tool_kid=ToolKid(_desc="C", _agent_importance=0.07), walk="src,A") -# exp_sandy.add_tool(tool_kid=ToolKid(_desc="E", _agent_importance=0.5), walk="src,A,C") -# exp_sandy.add_tool(tool_kid=ToolKid(_desc="B", _agent_importance=0.13), walk="src") - -# # generated sandy -# gen_sandy = lw_x.get_agent4member(acptfacts=None, member_name=sandy_name) - -# # confirm generated sandy is correct -# assert gen_sandy.get_tool_kid(road="src,A")._agent_importance == 0.07 -# assert gen_sandy.get_tool_kid(road="src,A,C")._agent_importance == 0.07 -# assert gen_sandy.get_tool_kid(road="src,A,C,E")._agent_importance == 0.5 -# assert gen_sandy.get_tool_kid(road="src,B")._agent_importance == 0.13 -# assert ( -# gen_sandy.get_tool_kid(road="src,A")._agent_importance -# == exp_sandy.get_tool_kid(road="src,A")._agent_importance -# ) -# assert ( -# gen_sandy.get_tool_kid(road="src,A,C")._agent_importance -# == exp_sandy.get_tool_kid(road="src,A,C")._agent_importance -# ) -# assert ( -# gen_sandy.get_tool_kid(road="src,A,C,E")._agent_importance -# == exp_sandy.get_tool_kid(road="src,A,C,E")._agent_importance -# ) -# assert ( -# gen_sandy.get_tool_kid(road="src,B")._agent_importance -# == exp_sandy.get_tool_kid(road="src,B")._agent_importance -# ) -# gen_sandy_list = gen_sandy.get_tool_list() -# assert len(gen_sandy_list) == 5 diff --git a/src/agent/test_agent/test_agent_tree_metrics.py b/src/agent/test_agent/test_agent_tree_metrics.py index 273aeb42a..06cb05a37 100644 --- a/src/agent/test_agent/test_agent_tree_metrics.py +++ b/src/agent/test_agent/test_agent_tree_metrics.py @@ -1,7 +1,7 @@ from src.agent.examples.example_agents import agent_v001, get_agent_with_4_levels from src.agent.agent import AgentUnit from src.agent.tree_metrics import TreeMetrics -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid def test_agent_get_tree_metrics_exists(): @@ -20,7 +20,7 @@ def test_agent_get_tree_metrics_exists(): assert sx_tree_metrics.grouplinks_metrics != None -def test_agent_get_tree_metrics_get_tool_uid_max_correctlyGetsMaxToolUID(): +def test_agent_get_tree_metrics_get_idea_uid_max_correctlyGetsMaxIdeaUID(): # GIVEN sx = agent_v001() @@ -29,10 +29,10 @@ def test_agent_get_tree_metrics_get_tool_uid_max_correctlyGetsMaxToolUID(): # THEN assert tree_metrics_x.uid_max == 279 - assert sx.get_tool_uid_max() == 279 + assert sx.get_idea_uid_max() == 279 -def test_agent_get_tree_metrics_all_tool_uids_are_unique_IsCorrectBoolean(): +def test_agent_get_tree_metrics_all_idea_uids_are_unique_IsCorrectBoolean(): # GIVEN sx = agent_v001() @@ -40,26 +40,26 @@ def test_agent_get_tree_metrics_all_tool_uids_are_unique_IsCorrectBoolean(): tree_metrics_x = sx.get_tree_metrics() # THEN - assert tree_metrics_x.all_tool_uids_are_unique == False + assert tree_metrics_x.all_idea_uids_are_unique == False assert len(tree_metrics_x.uid_dict) == 219 -def test_agent_get_tree_set_all_tool_uids_unique(): +def test_agent_get_tree_set_all_idea_uids_unique(): # GIVEN sx = agent_v001() tree_metrics_before = sx.get_tree_metrics() assert len(tree_metrics_before.uid_dict) == 219 # WHEN - sx.set_all_tool_uids_unique() + sx.set_all_idea_uids_unique() # THEN tree_metrics_after = sx.get_tree_metrics() # for uid, uid_count in tree_metrics_after.uid_dict.items(): - # # print(f"{uid=} {uid_count=} {len(sx.get_tool_list())=}") + # # print(f"{uid=} {uid_count=} {len(sx.get_idea_list())=}") # print(f"{uid=} {uid_count=} ") assert len(tree_metrics_after.uid_dict) == 253 - assert tree_metrics_after.all_tool_uids_are_unique == True + assert tree_metrics_after.all_idea_uids_are_unique == True def test_agent_agent_get_tree_metrics_assigns_uids_correctly(): @@ -69,48 +69,48 @@ def test_agent_agent_get_tree_metrics_assigns_uids_correctly(): sx = AgentUnit(_desc=src_text) swim_text = "swim" walk_text = "walk" - sx.add_tool(tool_kid=ToolKid(_desc=swim_text, _uid=None), walk=src_road) - sx.add_tool(tool_kid=ToolKid(_desc=walk_text, _uid=2), walk=src_road) - assert sx.get_tool_kid(road=f"{src_road},{swim_text}")._uid is None + sx.add_idea(idea_kid=IdeaKid(_desc=swim_text, _uid=None), walk=src_road) + sx.add_idea(idea_kid=IdeaKid(_desc=walk_text, _uid=2), walk=src_road) + assert sx.get_idea_kid(road=f"{src_road},{swim_text}")._uid is None - sx.set_all_tool_uids_unique() + sx.set_all_idea_uids_unique() # THEN - assert sx.get_tool_kid(road=f"{src_road},{swim_text}")._uid != None + assert sx.get_idea_kid(road=f"{src_road},{swim_text}")._uid != None -def test_agent_get_tree_metrics_ReturnsAccurateActionToolCount(): +def test_agent_get_tree_metrics_ReturnsAccurateActionIdeaCount(): # GIVEN cx = agent_v001() tree_metrics_before = cx.get_tree_metrics() assert tree_metrics_before.bond_promise_count == 69 # WHEN - cx.add_tool(tool_kid=ToolKid(_desc="clean", promise=True), walk=f"{cx._desc}") + cx.add_idea(idea_kid=IdeaKid(_desc="clean", promise=True), walk=f"{cx._desc}") # THEN tree_metrics_after = cx.get_tree_metrics() assert tree_metrics_after.bond_promise_count == 70 -def test_agent_get_tree_metrics_ReturnsANoneActionToolRoad(): +def test_agent_get_tree_metrics_ReturnsANoneActionIdeaRoad(): # GIVEN src = "src" cx = AgentUnit(_weight=10, _desc=src) weekdays = "weekdays" - tool_kid_weekdays = ToolKid(_weight=40, _desc=weekdays) - cx.add_tool(tool_kid=tool_kid_weekdays, walk=f"{src}") + idea_kid_weekdays = IdeaKid(_weight=40, _desc=weekdays) + cx.add_idea(idea_kid=idea_kid_weekdays, walk=f"{src}") tree_metrics_before = cx.get_tree_metrics() # WHEN/THEN - assert tree_metrics_before.an_promise_tool_road is None + assert tree_metrics_before.an_promise_idea_road is None -def test_agent_get_tree_metrics_ReturnsAnActionToolRoad(): +def test_agent_get_tree_metrics_ReturnsAnActionIdeaRoad(): # GIVEN cx = agent_v001() tree_metrics_before = cx.get_tree_metrics() # WHEN/THEN assert ( - tree_metrics_before.an_promise_tool_road + tree_metrics_before.an_promise_idea_road == "TlME,ACME,ACME Employee Responsiblities,Know Abuse Prevention and Reporting guildlines,Take Fall 2021 training" ) diff --git a/src/agent/tree_metrics.py b/src/agent/tree_metrics.py index 79b94aa63..b63460f98 100644 --- a/src/agent/tree_metrics.py +++ b/src/agent/tree_metrics.py @@ -11,9 +11,9 @@ class TreeMetrics: grouplinks_metrics: dict[GroupName:GroupMetrics] = None uid_max: int = None uid_dict: dict[int:int] = None - all_tool_uids_are_unique: bool = None + all_idea_uids_are_unique: bool = None bond_promise_count: int = None - an_promise_tool_road: Road = None + an_promise_idea_road: Road = None def __init__(self): if self.nodeCount is None: @@ -26,7 +26,7 @@ def __init__(self): if self.uid_max is None: self.uid_max = 0 self.set_uid_dict_emtpy_if_null() - self.all_tool_uids_are_unique = True + self.all_idea_uids_are_unique = True def set_grouplinks_empty_if_null(self): if self.grouplinks_metrics is None: @@ -39,23 +39,23 @@ def evaluate_node( grouplinks: dict[GroupName:GroupLink], uid: int, promise: bool, - tool_road: Road, + idea_road: Road, ): self.nodeCount += 1 - self.evaluate_action(promise=promise, tool_road=tool_road) + self.evaluate_action(promise=promise, idea_road=idea_road) self.evaluate_level(level=level) self.evaluate_requiredunits(requireds=requireds) self.evaluate_grouplinks(grouplinks=grouplinks) self.evaluate_uid_max(uid=uid) - def evaluate_action(self, promise: bool, tool_road: Road): + def evaluate_action(self, promise: bool, idea_road: Road): if self.bond_promise_count is None and promise: self.bond_promise_count = 1 elif self.bond_promise_count != None and promise: self.bond_promise_count += 1 if promise: - self.an_promise_tool_road = tool_road + self.an_promise_idea_road = idea_road def evaluate_level(self, level): if self.levelCount.get(level) is None: @@ -91,4 +91,4 @@ def evaluate_uid_max(self, uid): self.uid_dict[uid] = 1 else: self.uid_dict[uid] += 1 - self.all_tool_uids_are_unique = False + self.all_idea_uids_are_unique = False diff --git a/src/agent/x_func.py b/src/agent/x_func.py index 1e4f8b39c..634e46be2 100644 --- a/src/agent/x_func.py +++ b/src/agent/x_func.py @@ -130,101 +130,101 @@ def x_get_dict(json_x: str) -> dict: # class YR: def from_list_get_active_status( - road: Road, tool_list: list, asse_bool: bool = None + road: Road, idea_list: list, asse_bool: bool = None ) -> bool: active_status = None - temp_tool = None + temp_idea = None active_true_count = 0 active_false_count = 0 - for tool in tool_list: - if tool.get_road() == road: - temp_tool = tool + for idea in idea_list: + if idea.get_road() == road: + temp_idea = idea print( - f"searched for ToolKid {temp_tool.get_road()} found {temp_tool._active_status=}" + f"searched for IdeaKid {temp_idea.get_road()} found {temp_idea._active_status=}" ) - if tool._active_status: + if idea._active_status: active_true_count += 1 - elif tool._active_status == False: + elif idea._active_status == False: active_false_count += 1 - active_status = temp_tool._active_status + active_status = temp_idea._active_status print( - f"Set Active_status: {tool._desc=} {active_status} {active_true_count=} {active_false_count=}" + f"Set Active_status: {idea._desc=} {active_status} {active_true_count=} {active_false_count=}" ) if asse_bool in {True, False}: if active_status != asse_bool: - yr_tale(temp_tool) + yr_tale(temp_idea) assert active_status == asse_bool else: - yr_tale(temp_tool) + yr_tale(temp_idea) return active_status -def yr_print_tool_base_info(tool, filter: bool): - for l in tool._requiredheirs.values(): +def yr_print_idea_base_info(idea, filter: bool): + for l in idea._requiredheirs.values(): if l._status == filter: print( f" RequiredHeir '{l.base}' Base LH:{l._status} W:{len(l.sufffacts)}" # \t_task {l._task}" ) - if str(type(tool)).find(".tool.ToolKid'>") > 0: + if str(type(idea)).find(".idea.IdeaKid'>") > 0: yr_print_acptfact( lh_base=l.base, lh_status=l._status, sufffacts=l.sufffacts, - acptfactheirs=tool._acptfactheirs, + acptfactheirs=idea._acptfactheirs, ) -def yr_tale(tool): - str1 = f"'{yr_d(tool._walk)}' tool" - str2 = f" has RequiredU:{yr_x(tool._requiredunits)} LH:{yr_x(tool._requiredheirs)}" - str3 = f" {str(type(tool))}" +def yr_tale(idea): + str1 = f"'{yr_d(idea._walk)}' idea" + str2 = f" has RequiredU:{yr_x(idea._requiredunits)} LH:{yr_x(idea._requiredheirs)}" + str3 = f" {str(type(idea))}" str4 = " " - if str(type(tool)).find(".tool.ToolKid'>") > 0: - str3 = f" AcptFacts:{yr_x(tool._acptfactheirs)} Status: {tool._active_status}" + if str(type(idea)).find(".idea.IdeaKid'>") > 0: + str3 = f" AcptFacts:{yr_x(idea._acptfactheirs)} Status: {idea._active_status}" print(f"\n{str1}{str2}{str3}") hh_wo_matched_required = [] - for hh in tool._acptfactheirs.values(): + for hh in idea._acptfactheirs.values(): hh_wo_matched_required = [] try: - tool._requiredheirs[hh.base] + idea._requiredheirs[hh.base] except Exception: hh_wo_matched_required.append(hh.base) for base in hh_wo_matched_required: - print(f"AcptFacts that don't matter to this Tool: {base}") + print(f"AcptFacts that don't matter to this Idea: {base}") - # if tool._requiredunits != None: - # for lu in tool._requiredunits.values(): + # if idea._requiredunits != None: + # for lu in idea._requiredunits.values(): # print(f" RequiredUnit '{lu.base}' sufffacts: {len(lu.sufffacts)} ") - if tool._requiredheirs != None: + if idea._requiredheirs != None: filter_x = True - yr_print_tool_base_info(tool=tool, filter=True) + yr_print_idea_base_info(idea=idea, filter=True) filter_x = False print("\nRequireds that failed:") - for l in tool._requiredheirs.values(): + for l in idea._requiredheirs.values(): if l._status == filter_x: print( f" RequiredHeir '{l.base}' Base LH:{l._status} W:{len(l.sufffacts)}" # \t_task {l._task}" ) - if str(type(tool)).find(".tool.ToolKid'>") > 0: + if str(type(idea)).find(".idea.IdeaKid'>") > 0: yr_print_acptfact( lh_base=l.base, lh_status=l._status, sufffacts=l.sufffacts, - acptfactheirs=tool._acptfactheirs, + acptfactheirs=idea._acptfactheirs, ) print("") - # print(tool._acptfactheirs) - # print(f"{(tool._acptfactheirs != None)=}") - # print(f"{len(tool._acptfactheirs)=} ") + # print(idea._acptfactheirs) + # print(f"{(idea._acptfactheirs != None)=}") + # print(f"{len(idea._acptfactheirs)=} ") print("") diff --git a/src/pyqt5_kit/pyqt_func.py b/src/pyqt5_kit/pyqt_func.py index 914b4abff..a863bd03d 100644 --- a/src/pyqt5_kit/pyqt_func.py +++ b/src/pyqt5_kit/pyqt_func.py @@ -1,5 +1,5 @@ from src.agent.agent import AgentUnit -from src.agent.tool import ToolCore +from src.agent.idea import IdeaCore from PyQt5.QtWidgets import QTreeWidgetItem from src.agent.road import get_terminus_node_from_road from dataclasses import dataclass @@ -11,7 +11,7 @@ class InvalidPyQtException(Exception): @dataclass class PYQTTreeHolder: - toolcore: ToolCore + ideacore: IdeaCore yo_action_flag: str yo_agenda_flag: str yo_complete_flag: str @@ -31,7 +31,7 @@ class PYQTTreeHolder: def get_pyqttree( - toolroot: ToolCore, + idearoot: IdeaCore, root_percent_flag: bool = None, yo2bd_count_flag: bool = None, yo2bd_view_bd_flag: bool = None, @@ -50,7 +50,7 @@ def get_pyqttree( src_agent: AgentUnit = None, ) -> QTreeWidgetItem: pyqttree_holder = PYQTTreeHolder( - toolcore=toolroot, + ideacore=idearoot, yo_action_flag=yo_action_flag, yo_agenda_flag=yo_agenda_flag, yo_complete_flag=yo_complete_flag, @@ -75,30 +75,30 @@ def get_pyqttree( def _create_node(pth: PYQTTreeHolder) -> QTreeWidgetItem: treenode_label = _create_treenode_label(pth) item = QTreeWidgetItem([treenode_label]) - item.setData(2, 10, pth.toolcore._desc) - item.setData(2, 11, pth.toolcore._walk) - # item.setData(2, 12, toolcore._weight) - # item.setData(2, 13, toolcore._begin) - # item.setData(2, 14, toolcore._close) - item.setData(2, 20, pth.toolcore._is_expanded) - if pth.toolcore._requiredunits is None: + item.setData(2, 10, pth.ideacore._desc) + item.setData(2, 11, pth.ideacore._walk) + # item.setData(2, 12, ideacore._weight) + # item.setData(2, 13, ideacore._begin) + # item.setData(2, 14, ideacore._close) + item.setData(2, 20, pth.ideacore._is_expanded) + if pth.ideacore._requiredunits is None: item.setData(2, 21, 0) else: - item.setData(2, 21, len(pth.toolcore._requiredunits)) - if pth.toolcore._kids is None: - raise InvalidPyQtException(f"Tool {pth.toolcore._desc} has null kids.") - - sort_tools_list = list(pth.toolcore._kids.values()) - # print(f"{len(sort_tools_list)=}") - # print(f"{type(sort_tools_list)=}") - # print(f"{len(unsorted_tools_list.sort(key=lambda x: x._desc, reverse=False))=}") - sort_tools_list.sort(key=lambda x: x._desc.lower(), reverse=False) - # print(f"{len(sorted_tools_list)=}") - - for kid_tool in sort_tools_list: - # for kid_tool in sort_tools_list.sort(key=lambda x: x._agent_importance, reverse=True): + item.setData(2, 21, len(pth.ideacore._requiredunits)) + if pth.ideacore._kids is None: + raise InvalidPyQtException(f"Idea {pth.ideacore._desc} has null kids.") + + sort_ideas_list = list(pth.ideacore._kids.values()) + # print(f"{len(sort_ideas_list)=}") + # print(f"{type(sort_ideas_list)=}") + # print(f"{len(unsorted_ideas_list.sort(key=lambda x: x._desc, reverse=False))=}") + sort_ideas_list.sort(key=lambda x: x._desc.lower(), reverse=False) + # print(f"{len(sorted_ideas_list)=}") + + for kid_idea in sort_ideas_list: + # for kid_idea in sort_ideas_list.sort(key=lambda x: x._agent_importance, reverse=True): child_pth = PYQTTreeHolder( - toolcore=kid_tool, + ideacore=kid_idea, yo_action_flag=pth.yo_action_flag, yo_agenda_flag=pth.yo_agenda_flag, yo_complete_flag=pth.yo_complete_flag, @@ -174,16 +174,16 @@ def lw_diplay(agent_importance: float): def _get_treenode_label_required_count(treenode_label, pth: PYQTTreeHolder) -> str: sufffact_count = sum( required.get_sufffacts_count() - for required in pth.toolcore._requiredunits.values() + for required in pth.ideacore._requiredunits.values() ) - required_count = len(pth.toolcore._requiredunits) + required_count = len(pth.ideacore._requiredunits) if required_count != 0: - treenode_label += f" (lim {len(pth.toolcore._requiredunits)}/c{sufffact_count})" + treenode_label += f" (lim {len(pth.ideacore._requiredunits)}/c{sufffact_count})" return treenode_label def _get_treenode_label_required_view(treenode_label, pth: PYQTTreeHolder) -> str: - requiredheir = pth.toolcore._requiredheirs.get(pth.required_view_name) + requiredheir = pth.ideacore._requiredheirs.get(pth.required_view_name) if requiredheir != None: # treenode_label += f"{get_terminus_node_from_road(requiredheir.base)}" grabed_sufffact = None @@ -196,9 +196,9 @@ def _get_treenode_label_required_view(treenode_label, pth: PYQTTreeHolder) -> st def _get_treenode_label_acptfactheir_view(treenode_label, pth: PYQTTreeHolder) -> str: - acptfactheir = pth.toolcore._acptfactheirs.get(pth.required_view_name) + acptfactheir = pth.ideacore._acptfactheirs.get(pth.required_view_name) if acptfactheir != None: - time_road = f"{pth.src_agent._toolroot._desc},time,jajatime" + time_road = f"{pth.src_agent._idearoot._desc},time,jajatime" if ( acptfactheir.base == time_road and acptfactheir.open != None @@ -222,35 +222,35 @@ def _get_treenode_label_acptfactheir_view(treenode_label, pth: PYQTTreeHolder) - def _create_treenode_label(pth: PYQTTreeHolder): - treenode_label = pth.toolcore._desc + treenode_label = pth.ideacore._desc if pth.root_percent_flag: - treenode_label += f" ({lw_diplay(pth.toolcore._agent_importance)})" + treenode_label += f" ({lw_diplay(pth.ideacore._agent_importance)})" elif pth.yo2bd_count_flag: - treenode_label += f" ({len(pth.toolcore._grouplinks)})" + treenode_label += f" ({len(pth.ideacore._grouplinks)})" elif pth.required_count_flag: treenode_label = _get_treenode_label_required_count(treenode_label, pth) elif pth.required_view_flag: treenode_label = _get_treenode_label_required_view(treenode_label, pth) - elif pth.acptfactheir_view_flag and pth.toolcore._walk != "": + elif pth.acptfactheir_view_flag and pth.ideacore._walk != "": treenode_label = _get_treenode_label_acptfactheir_view(treenode_label, pth) - elif pth.yo_action_flag and pth.toolcore.promise: - treenode_label += " (task)" if pth.toolcore._task else " (state)" + elif pth.yo_action_flag and pth.ideacore.promise: + treenode_label += " (task)" if pth.ideacore._task else " (state)" elif pth.yo_acptfactunit_count_flag: - treenode_label += f" ({len(pth.toolcore._acptfactunits)})" - elif pth.yo_acptfactheir_count_flag and pth.toolcore._walk != "": - treenode_label += f" ({len(pth.toolcore._acptfactheirs)})" + treenode_label += f" ({len(pth.ideacore._acptfactunits)})" + elif pth.yo_acptfactheir_count_flag and pth.ideacore._walk != "": + treenode_label += f" ({len(pth.ideacore._acptfactheirs)})" - if pth.requiredheir_count_flag and pth.toolcore._walk not in (None, ""): + if pth.requiredheir_count_flag and pth.ideacore._walk not in (None, ""): # requiredunit_count = sum( # str(type(requiredheir)) == "" - # for requiredheir in pth.toolcore._requiredheirs.values() + # for requiredheir in pth.ideacore._requiredheirs.values() # ) - treenode_label += f" (RequiredHeirs {len(pth.toolcore._requiredheirs)})" + treenode_label += f" (RequiredHeirs {len(pth.ideacore._requiredheirs)})" if pth.yo_acptfactunit_time_flag: - time_road = f"{pth.src_agent._toolroot._desc},time,jajatime" - acptfactunit_time_obj = pth.toolcore._acptfactunits.get(time_road) + time_road = f"{pth.src_agent._idearoot._desc},time,jajatime" + acptfactunit_time_obj = pth.ideacore._acptfactunits.get(time_road) if acptfactunit_time_obj != None: hc_open_str = pth.src_agent.get_jajatime_readable_one_time_event( jajatime_min=acptfactunit_time_obj.open diff --git a/src/system/bank_sqlstr.py b/src/system/bank_sqlstr.py index cf4945e0e..80cda664c 100644 --- a/src/system/bank_sqlstr.py +++ b/src/system/bank_sqlstr.py @@ -450,19 +450,19 @@ def get_river_ledger_unit( ) -def get_tool_catalog_table_create_sqlstr() -> str: +def get_idea_catalog_table_create_sqlstr() -> str: return """ - CREATE TABLE IF NOT EXISTS tool_catalog ( + CREATE TABLE IF NOT EXISTS idea_catalog ( agent_name VARCHAR(255) NOT NULL - , tool_road VARCHAR(1000) NOT NULL + , idea_road VARCHAR(1000) NOT NULL ) ; """ -def get_tool_catalog_table_count(db_conn: Connection, agent_name: str) -> str: +def get_idea_catalog_table_count(db_conn: Connection, agent_name: str) -> str: sqlstr = f""" - {get_table_count_sqlstr("tool_catalog")} WHERE agent_name = '{agent_name}' + {get_table_count_sqlstr("idea_catalog")} WHERE agent_name = '{agent_name}' ; """ results = db_conn.execute(sqlstr) @@ -473,39 +473,39 @@ def get_tool_catalog_table_count(db_conn: Connection, agent_name: str) -> str: @dataclass -class ToolCatalog: +class IdeaCatalog: agent_name: str - tool_road: str + idea_road: str -def get_tool_catalog_table_insert_sqlstr( - tool_catalog: ToolCatalog, +def get_idea_catalog_table_insert_sqlstr( + idea_catalog: IdeaCatalog, ) -> str: - # return f"""INSERT INTO tool_catalog (agent_name, tool_road) VALUES ('{tool_catalog.agent_name}', '{tool_catalog.tool_road}');""" + # return f"""INSERT INTO idea_catalog (agent_name, idea_road) VALUES ('{idea_catalog.agent_name}', '{idea_catalog.idea_road}');""" return f""" - INSERT INTO tool_catalog ( + INSERT INTO idea_catalog ( agent_name - , tool_road + , idea_road ) VALUES ( - '{tool_catalog.agent_name}' - , '{get_road_without_root_node(tool_catalog.tool_road)}' + '{idea_catalog.agent_name}' + , '{get_road_without_root_node(idea_catalog.idea_road)}' ) ; """ -def get_tool_catalog_dict(db_conn: Connection, search_road: Road = None): +def get_idea_catalog_dict(db_conn: Connection, search_road: Road = None): if search_road is None: where_clause = "" else: search_road_without_root_node = get_road_without_root_node(search_road) - where_clause = f"WHERE tool_road = '{search_road_without_root_node}'" + where_clause = f"WHERE idea_road = '{search_road_without_root_node}'" sqlstr = f""" SELECT agent_name - , tool_road - FROM tool_catalog + , idea_road + FROM idea_catalog {where_clause} ; """ @@ -513,9 +513,9 @@ def get_tool_catalog_dict(db_conn: Connection, search_road: Road = None): dict_x = {} for row in results.fetchall(): - tool_catalog_x = ToolCatalog(agent_name=row[0], tool_road=row[1]) - dict_key = f"{tool_catalog_x.agent_name} {tool_catalog_x.tool_road}" - dict_x[dict_key] = tool_catalog_x + idea_catalog_x = IdeaCatalog(agent_name=row[0], idea_road=row[1]) + dict_key = f"{idea_catalog_x.agent_name} {idea_catalog_x.idea_road}" + dict_x[dict_key] = idea_catalog_x return dict_x @@ -643,7 +643,7 @@ def get_groupunit_catalog_dict(db_conn: Connection) -> dict[str:GroupUnitCatalog def get_create_table_if_not_exist_sqlstrs() -> list[str]: list_x = [get_agent_table_create_sqlstr()] list_x.append(get_acptfact_catalog_table_create_sqlstr()) - list_x.append(get_tool_catalog_table_create_sqlstr()) + list_x.append(get_idea_catalog_table_create_sqlstr()) list_x.append(get_ledger_table_create_sqlstr()) list_x.append(get_river_flow_table_create_sqlstr()) list_x.append(get_river_bucket_table_create_sqlstr()) diff --git a/src/system/examples/example_persons.py b/src/system/examples/example_persons.py index 3cef4e0b8..3f3cd896a 100644 --- a/src/system/examples/example_persons.py +++ b/src/system/examples/example_persons.py @@ -1,5 +1,5 @@ from src.agent.agent import AgentUnit -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from src.system.person import personunit_shop from src.agent.required import Road from random import randrange @@ -17,8 +17,8 @@ def get_Jnode2node_agent(): src_road = Road(f"{src_text}") agent_x = AgentUnit(_desc=src_text) a_text = "A" - tool_a = ToolKid(_desc=a_text) - agent_x.add_tool(tool_kid=tool_a, walk=src_road) + idea_a = IdeaKid(_desc=a_text) + agent_x.add_idea(idea_kid=idea_a, walk=src_road) agent_x.set_agent_metrics() return agent_x @@ -28,8 +28,8 @@ def get_2node_agent(): src_road = Road(f"{src_text}") b_text = "B" agent_x = AgentUnit(_desc=src_text) - tool_b = ToolKid(_desc=b_text) - agent_x.add_tool(tool_kid=tool_b, walk=src_road) + idea_b = IdeaKid(_desc=b_text) + agent_x.add_idea(idea_kid=idea_b, walk=src_road) agent_x.set_agent_metrics() return agent_x @@ -39,11 +39,11 @@ def get_3node_agent(): a_road = Road(a_text) agent_x = AgentUnit(_desc=a_text) b_text = "B" - tool_b = ToolKid(_desc=b_text) + idea_b = IdeaKid(_desc=b_text) c_text = "C" - tool_c = ToolKid(_desc=c_text) - agent_x.add_tool(tool_kid=tool_b, walk=a_road) - agent_x.add_tool(tool_kid=tool_c, walk=a_road) + idea_c = IdeaKid(_desc=c_text) + agent_x.add_idea(idea_kid=idea_b, walk=a_road) + agent_x.add_idea(idea_kid=idea_c, walk=a_road) agent_x.set_agent_metrics() return agent_x @@ -53,95 +53,95 @@ def get_3node_D_E_F_agent(): a_road = Road(a_text) agent_x = AgentUnit(_desc=a_text) b_text = "E" - tool_b = ToolKid(_desc=b_text) + idea_b = IdeaKid(_desc=b_text) c_text = "F" - tool_c = ToolKid(_desc=c_text) - agent_x.add_tool(tool_kid=tool_b, walk=a_road) - agent_x.add_tool(tool_kid=tool_c, walk=a_road) + idea_c = IdeaKid(_desc=c_text) + agent_x.add_idea(idea_kid=idea_b, walk=a_road) + agent_x.add_idea(idea_kid=idea_c, walk=a_road) agent_x.set_agent_metrics() return agent_x def get_6node_agent(): agent_x = AgentUnit(_desc="A") - tool_b = ToolKid(_desc="B") - tool_c = ToolKid(_desc="C") - tool_d = ToolKid(_desc="D") - tool_e = ToolKid(_desc="E") - tool_f = ToolKid(_desc="F") - agent_x.add_tool(tool_kid=tool_b, walk="A") - agent_x.add_tool(tool_kid=tool_c, walk="A") - agent_x.add_tool(tool_kid=tool_d, walk="A,C") - agent_x.add_tool(tool_kid=tool_e, walk="A,C") - agent_x.add_tool(tool_kid=tool_f, walk="A,C") + idea_b = IdeaKid(_desc="B") + idea_c = IdeaKid(_desc="C") + idea_d = IdeaKid(_desc="D") + idea_e = IdeaKid(_desc="E") + idea_f = IdeaKid(_desc="F") + agent_x.add_idea(idea_kid=idea_b, walk="A") + agent_x.add_idea(idea_kid=idea_c, walk="A") + agent_x.add_idea(idea_kid=idea_d, walk="A,C") + agent_x.add_idea(idea_kid=idea_e, walk="A,C") + agent_x.add_idea(idea_kid=idea_f, walk="A,C") agent_x.set_agent_metrics() return agent_x def get_7nodeInsertH_agent(): agent_x = AgentUnit(_desc="A") - tool_b = ToolKid(_desc="B") - tool_c = ToolKid(_desc="C") - tool_h = ToolKid(_desc="H") - tool_d = ToolKid(_desc="D") - tool_e = ToolKid(_desc="E") - tool_f = ToolKid(_desc="F") - agent_x.add_tool(tool_kid=tool_b, walk="A") - agent_x.add_tool(tool_kid=tool_c, walk="A") - agent_x.add_tool(tool_kid=tool_e, walk="A,C") - agent_x.add_tool(tool_kid=tool_f, walk="A,C") - agent_x.add_tool(tool_kid=tool_h, walk="A,C") - agent_x.add_tool(tool_kid=tool_d, walk="A,C,H") + idea_b = IdeaKid(_desc="B") + idea_c = IdeaKid(_desc="C") + idea_h = IdeaKid(_desc="H") + idea_d = IdeaKid(_desc="D") + idea_e = IdeaKid(_desc="E") + idea_f = IdeaKid(_desc="F") + agent_x.add_idea(idea_kid=idea_b, walk="A") + agent_x.add_idea(idea_kid=idea_c, walk="A") + agent_x.add_idea(idea_kid=idea_e, walk="A,C") + agent_x.add_idea(idea_kid=idea_f, walk="A,C") + agent_x.add_idea(idea_kid=idea_h, walk="A,C") + agent_x.add_idea(idea_kid=idea_d, walk="A,C,H") agent_x.set_agent_metrics() return agent_x def get_5nodeHG_agent(): agent_x = AgentUnit(_desc="A") - tool_b = ToolKid(_desc="B") - tool_c = ToolKid(_desc="C") - tool_h = ToolKid(_desc="H") - tool_g = ToolKid(_desc="G") - agent_x.add_tool(tool_kid=tool_b, walk="A") - agent_x.add_tool(tool_kid=tool_c, walk="A") - agent_x.add_tool(tool_kid=tool_h, walk="A,C") - agent_x.add_tool(tool_kid=tool_g, walk="A,C") + idea_b = IdeaKid(_desc="B") + idea_c = IdeaKid(_desc="C") + idea_h = IdeaKid(_desc="H") + idea_g = IdeaKid(_desc="G") + agent_x.add_idea(idea_kid=idea_b, walk="A") + agent_x.add_idea(idea_kid=idea_c, walk="A") + agent_x.add_idea(idea_kid=idea_h, walk="A,C") + agent_x.add_idea(idea_kid=idea_g, walk="A,C") agent_x.set_agent_metrics() return agent_x def get_7nodeJRoot_agent(): agent_x = AgentUnit(_desc="J") - tool_a = ToolKid(_desc="A") - tool_b = ToolKid(_desc="B") - tool_c = ToolKid(_desc="C") - tool_d = ToolKid(_desc="D") - tool_e = ToolKid(_desc="E") - tool_f = ToolKid(_desc="F") - agent_x.add_tool(tool_kid=tool_a, walk="J") - agent_x.add_tool(tool_kid=tool_b, walk="J,A") - agent_x.add_tool(tool_kid=tool_c, walk="J,A") - agent_x.add_tool(tool_kid=tool_d, walk="J,A,C") - agent_x.add_tool(tool_kid=tool_e, walk="J,A,C") - agent_x.add_tool(tool_kid=tool_f, walk="J,A,C") + idea_a = IdeaKid(_desc="A") + idea_b = IdeaKid(_desc="B") + idea_c = IdeaKid(_desc="C") + idea_d = IdeaKid(_desc="D") + idea_e = IdeaKid(_desc="E") + idea_f = IdeaKid(_desc="F") + agent_x.add_idea(idea_kid=idea_a, walk="J") + agent_x.add_idea(idea_kid=idea_b, walk="J,A") + agent_x.add_idea(idea_kid=idea_c, walk="J,A") + agent_x.add_idea(idea_kid=idea_d, walk="J,A,C") + agent_x.add_idea(idea_kid=idea_e, walk="J,A,C") + agent_x.add_idea(idea_kid=idea_f, walk="J,A,C") agent_x.set_agent_metrics() return agent_x def get_7nodeJRootWithH_agent(): agent_x = AgentUnit(_desc="J") - tool_a = ToolKid(_desc="A") - tool_b = ToolKid(_desc="B") - tool_c = ToolKid(_desc="C") - tool_e = ToolKid(_desc="E") - tool_f = ToolKid(_desc="F") - tool_h = ToolKid(_desc="H") - agent_x.add_tool(tool_kid=tool_a, walk="J") - agent_x.add_tool(tool_kid=tool_b, walk="J,A") - agent_x.add_tool(tool_kid=tool_c, walk="J,A") - agent_x.add_tool(tool_kid=tool_e, walk="J,A,C") - agent_x.add_tool(tool_kid=tool_f, walk="J,A,C") - agent_x.add_tool(tool_kid=tool_h, walk="J,A,C") + idea_a = IdeaKid(_desc="A") + idea_b = IdeaKid(_desc="B") + idea_c = IdeaKid(_desc="C") + idea_e = IdeaKid(_desc="E") + idea_f = IdeaKid(_desc="F") + idea_h = IdeaKid(_desc="H") + agent_x.add_idea(idea_kid=idea_a, walk="J") + agent_x.add_idea(idea_kid=idea_b, walk="J,A") + agent_x.add_idea(idea_kid=idea_c, walk="J,A") + agent_x.add_idea(idea_kid=idea_e, walk="J,A,C") + agent_x.add_idea(idea_kid=idea_f, walk="J,A,C") + agent_x.add_idea(idea_kid=idea_h, walk="J,A,C") agent_x.set_agent_metrics() return agent_x @@ -162,14 +162,14 @@ def get_agent_2CleanNodesRandomWeights(_desc: str = None): desc_text = _desc if _desc != None else "ernie" agent_x = AgentUnit(_desc=desc_text) casa_text = "casa" - agent_x.add_tool(tool_kid=ToolKid(_desc=casa_text), walk="") + agent_x.add_idea(idea_kid=IdeaKid(_desc=casa_text), walk="") casa_road = Road(f"{desc_text},{casa_text}") cookery_text = "clean cookery" bedroom_text = "clean bedroom" - cookery_tool = ToolKid(_desc=cookery_text, _weight=randrange(1, 50), promise=True) - bedroom_tool = ToolKid(_desc=bedroom_text, _weight=randrange(1, 50), promise=True) - agent_x.add_tool(tool_kid=cookery_tool, walk=casa_road) - agent_x.add_tool(tool_kid=bedroom_tool, walk=casa_road) + cookery_idea = IdeaKid(_desc=cookery_text, _weight=randrange(1, 50), promise=True) + bedroom_idea = IdeaKid(_desc=bedroom_text, _weight=randrange(1, 50), promise=True) + agent_x.add_idea(idea_kid=cookery_idea, walk=casa_road) + agent_x.add_idea(idea_kid=bedroom_idea, walk=casa_road) agent_x.set_agent_metrics() return agent_x @@ -178,16 +178,16 @@ def get_agent_3CleanNodesRandomWeights(_desc: str = None): desc_text = _desc if _desc != None else "ernie" agent_x = AgentUnit(_desc=desc_text) casa_text = "casa" - agent_x.add_tool(tool_kid=ToolKid(_desc=casa_text), walk="") + agent_x.add_idea(idea_kid=IdeaKid(_desc=casa_text), walk="") casa_road = Road(f"{desc_text},{casa_text}") cookery_text = "clean cookery" bedroom_text = "clean bedroom" hallway_text = "clean hallway" - cookery_tool = ToolKid(_desc=cookery_text, _weight=randrange(1, 50), promise=True) - bedroom_tool = ToolKid(_desc=bedroom_text, _weight=randrange(1, 50), promise=True) - hallway_tool = ToolKid(_desc=hallway_text, _weight=randrange(1, 50), promise=True) - agent_x.add_tool(tool_kid=cookery_tool, walk=casa_road) - agent_x.add_tool(tool_kid=bedroom_tool, walk=casa_road) - agent_x.add_tool(tool_kid=hallway_tool, walk=casa_road) + cookery_idea = IdeaKid(_desc=cookery_text, _weight=randrange(1, 50), promise=True) + bedroom_idea = IdeaKid(_desc=bedroom_text, _weight=randrange(1, 50), promise=True) + hallway_idea = IdeaKid(_desc=hallway_text, _weight=randrange(1, 50), promise=True) + agent_x.add_idea(idea_kid=cookery_idea, walk=casa_road) + agent_x.add_idea(idea_kid=bedroom_idea, walk=casa_road) + agent_x.add_idea(idea_kid=hallway_idea, walk=casa_road) agent_x.set_agent_metrics() return agent_x diff --git a/src/system/person.py b/src/system/person.py index 873a06b6d..f90efca24 100644 --- a/src/system/person.py +++ b/src/system/person.py @@ -9,7 +9,7 @@ get_dict_of_agent_from_dict, get_meld_of_agent_files, ) -from src.agent.tool import ToolRoot +from src.agent.idea import IdeaRoot from src.agent.road import Road from src.agent.agent import AgentUnit, get_from_json as agentunit_get_from_json from src.agent.x_func import ( @@ -245,7 +245,7 @@ def get_starting_digest_agent(self) -> AgentUnit: ct = x_func_open_file(self._person_dir, "starting_digest_agent.json") cx = agentunit_get_from_json(lw_json=ct) empty_cx = self._get_empty_starting_digest_agent() - cx.agent_and_toolroot_desc_edit(new_desc=empty_cx._desc) + cx.agent_and_idearoot_desc_edit(new_desc=empty_cx._desc) cx.set_agent_metrics() except Exception: cx = self._get_empty_starting_digest_agent() diff --git a/src/system/system.py b/src/system/system.py index e17455958..9dba7489e 100644 --- a/src/system/system.py +++ b/src/system/system.py @@ -30,9 +30,9 @@ RiverLedgerUnit, RiverFlowUnit, RiverTmemberUnit, - ToolCatalog, - get_tool_catalog_table_insert_sqlstr, - get_tool_catalog_dict, + IdeaCatalog, + get_idea_catalog_table_insert_sqlstr, + get_idea_catalog_dict, AcptFactCatalog, get_acptfact_catalog_table_insert_sqlstr, GroupUnitCatalog, @@ -54,12 +54,12 @@ def set_agent_attr_defined_by_system(self, agent_name: str): for groupunit_x in agent_obj._groups.values(): if groupunit_x._memberlinks_set_by_system_road != None: groupunit_x.clear_memberlinks() - ic = get_tool_catalog_dict( + ic = get_idea_catalog_dict( self.get_bank_conn(), groupunit_x._memberlinks_set_by_system_road ) - for tool_catalog in ic.values(): - if agent_name != tool_catalog.agent_name: - memberlink_x = memberlink_shop(name=tool_catalog.agent_name) + for idea_catalog in ic.values(): + if agent_name != idea_catalog.agent_name: + memberlink_x = memberlink_shop(name=idea_catalog.agent_name) groupunit_x.set_memberlink(memberlink_x) self.save_agentunit_obj_to_agents_dir(agent_obj) @@ -187,7 +187,7 @@ def _bank_populate_agents_data(self): self._bank_insert_agentunit(agentunit_x) self._bank_insert_memberunit(agentunit_x) self._bank_insert_groupunit(agentunit_x) - self._bank_insert_toolunit(agentunit_x) + self._bank_insert_ideaunit(agentunit_x) self._bank_insert_acptfact(agentunit_x) def _bank_insert_agentunit(self, agentunit_x: AgentUnit): @@ -214,18 +214,18 @@ def _bank_insert_groupunit(self, agentunit_x: AgentUnit): sqlstr = get_groupunit_catalog_table_insert_sqlstr(groupunit_catalog_x) cur.execute(sqlstr) - def _bank_insert_toolunit(self, agentunit_x: AgentUnit): + def _bank_insert_ideaunit(self, agentunit_x: AgentUnit): with self.get_bank_conn() as bank_conn: cur = bank_conn.cursor() - for tool_x in agentunit_x._tool_dict.values(): - tool_catalog_x = ToolCatalog(agentunit_x._desc, tool_x.get_road()) - sqlstr = get_tool_catalog_table_insert_sqlstr(tool_catalog_x) + for idea_x in agentunit_x._idea_dict.values(): + idea_catalog_x = IdeaCatalog(agentunit_x._desc, idea_x.get_road()) + sqlstr = get_idea_catalog_table_insert_sqlstr(idea_catalog_x) cur.execute(sqlstr) def _bank_insert_acptfact(self, agentunit_x: AgentUnit): with self.get_bank_conn() as bank_conn: cur = bank_conn.cursor() - for acptfact_x in agentunit_x._toolroot._acptfactunits.values(): + for acptfact_x in agentunit_x._idearoot._acptfactunits.values(): acptfact_catalog_x = AcptFactCatalog( agent_name=agentunit_x._desc, base=acptfact_x.base, @@ -379,7 +379,7 @@ def set_ignore_agent_file(self, person_name: str, agent_obj: AgentUnit): def rename_agent_in_agents_dir(self, old_desc: str, new_desc: str): agent_x = self.get_agent_from_agents_dir(_desc=old_desc) - agent_x.agent_and_toolroot_desc_edit(new_desc=new_desc) + agent_x.agent_and_idearoot_desc_edit(new_desc=new_desc) self.save_agentunit_obj_to_agents_dir(agent_x=agent_x) self.del_agentunit_from_agents_dir(agent_x_desc=old_desc) diff --git a/src/system/test_person/test_person_.py b/src/system/test_person/test_person_.py index e4a627afc..035bb11ae 100644 --- a/src/system/test_person/test_person_.py +++ b/src/system/test_person/test_person_.py @@ -1,6 +1,6 @@ from src.system.person import personunit_shop from src.agent.agent import AgentUnit -from src.agent.tool import ToolRoot +from src.agent.idea import IdeaRoot import src.system.examples.example_persons as example_persons from src.system.examples.person_env_kit import ( person_dir_setup_cleanup, @@ -24,24 +24,24 @@ def test_personunit_exists(person_dir_setup_cleanup): assert px.name == person_text assert px._src_agentlinks == {} assert px._auto_dest_agent_to_public_agent - # assert px._re_toolroot != None - # assert str(type(px._re_toolroot)).find(".tool.ToolRoot'>") > 0 - # assert px._re_toolroot._desc == person_text - # assert px._re_toolroot._weight == 1 - - # assert px._re_toolroot._uid == -1 - # assert px._re_toolroot._begin is None - # assert px._re_toolroot._close is None - # assert px._re_toolroot._addin is None - # assert px._re_toolroot._denom is None - # assert px._re_toolroot._numor is None - # assert px._re_toolroot._reest is None - # assert px._re_toolroot._special_road is None - # assert px._re_toolroot._numeric_road is None - # assert px._re_toolroot.promise == False - # assert px._re_toolroot._all_member_credit is None - # assert px._re_toolroot._all_member_debt is None - # assert px._re_toolroot._is_expanded == True + # assert px._re_idearoot != None + # assert str(type(px._re_idearoot)).find(".idea.IdeaRoot'>") > 0 + # assert px._re_idearoot._desc == person_text + # assert px._re_idearoot._weight == 1 + + # assert px._re_idearoot._uid == -1 + # assert px._re_idearoot._begin is None + # assert px._re_idearoot._close is None + # assert px._re_idearoot._addin is None + # assert px._re_idearoot._denom is None + # assert px._re_idearoot._numor is None + # assert px._re_idearoot._reest is None + # assert px._re_idearoot._special_road is None + # assert px._re_idearoot._numeric_road is None + # assert px._re_idearoot.promise == False + # assert px._re_idearoot._all_member_credit is None + # assert px._re_idearoot._all_member_debt is None + # assert px._re_idearoot._is_expanded == True assert px._dest_agent != None assert px._person_dir != None assert px._person_agents_dir != None diff --git a/src/system/test_person/test_person_agentlink.py b/src/system/test_person/test_person_agentlink.py index 856f7fa3f..c3fe37294 100644 --- a/src/system/test_person/test_person_agentlink.py +++ b/src/system/test_person/test_person_agentlink.py @@ -220,7 +220,7 @@ def test_personunit_refresh_agentlinks_CorrectlyPullsAllPublicAgents( e1.save_agentunit_obj_to_agents_dir(agent_x=old_steve_agent) px.receive_src_agentunit_obj(agent_x=ernie_agent) px.receive_src_agentunit_obj(agent_x=old_steve_agent) - assert len(px.get_dest_agent_from_digest_agent_files().get_tool_list()) == 4 + assert len(px.get_dest_agent_from_digest_agent_files().get_idea_list()) == 4 new_steve_agent = example_persons.get_agent_3CleanNodesRandomWeights(_desc="steve") e1.save_agentunit_obj_to_agents_dir(agent_x=new_steve_agent) print(f"{env_dir=} {px._public_agents_dir=}") @@ -234,4 +234,4 @@ def test_personunit_refresh_agentlinks_CorrectlyPullsAllPublicAgents( px.receive_all_src_agentunit_files() # THEN - assert len(px.get_dest_agent_from_digest_agent_files().get_tool_list()) == 5 + assert len(px.get_dest_agent_from_digest_agent_files().get_idea_list()) == 5 diff --git a/src/system/test_person/test_person_digest.py b/src/system/test_person/test_person_digest.py index ff1e2ecd6..b3d3736c5 100644 --- a/src/system/test_person/test_person_digest.py +++ b/src/system/test_person/test_person_digest.py @@ -53,22 +53,22 @@ def test_personget_starting_digest_agent_WhenStartingAgentFileDoesNotExists( # THEN x_agent = AgentUnit(_desc=p_name) x_agent.set_agent_metrics() - # x_toolroot = ToolRoot(_desc=p_name, _walk="") - # x_toolroot.set_grouplines_empty_if_null() - # x_toolroot.set_kids_empty_if_null() - # x_toolroot.set_grouplink_empty_if_null() - # x_toolroot.set_groupheir_empty_if_null() - # x_toolroot.set_requiredunits_empty_if_null() - # x_toolroot.set_requiredheirs_empty_if_null() - # x_toolroot._agent_importance = 1 - # x_toolroot._level = 0 - # x_toolroot._ancestor_promise_count = 0 - # x_toolroot._descendant_promise_count = 0 - # x_toolroot._all_member_credit = True - # x_toolroot._all_member_debt = True - - assert starting_dest_agent._toolroot == x_agent._toolroot - assert starting_dest_agent._toolroot._acptfactunits == {} + # x_idearoot = IdeaRoot(_desc=p_name, _walk="") + # x_idearoot.set_grouplines_empty_if_null() + # x_idearoot.set_kids_empty_if_null() + # x_idearoot.set_grouplink_empty_if_null() + # x_idearoot.set_groupheir_empty_if_null() + # x_idearoot.set_requiredunits_empty_if_null() + # x_idearoot.set_requiredheirs_empty_if_null() + # x_idearoot._agent_importance = 1 + # x_idearoot._level = 0 + # x_idearoot._ancestor_promise_count = 0 + # x_idearoot._descendant_promise_count = 0 + # x_idearoot._all_member_credit = True + # x_idearoot._all_member_debt = True + + assert starting_dest_agent._idearoot == x_agent._idearoot + assert starting_dest_agent._idearoot._acptfactunits == {} assert starting_dest_agent._members == {} assert starting_dest_agent._groups == {} @@ -88,12 +88,12 @@ def test_person_get_starting_digest_agent_WhenStartingAgentFileExists( # THEN x_agent = example_agents_get_agent_with_4_levels() - x_agent.agent_and_toolroot_desc_edit(new_desc=p_name) + x_agent.agent_and_idearoot_desc_edit(new_desc=p_name) x_agent.set_agent_metrics() - assert starting_dest_agent._toolroot._kids == x_agent._toolroot._kids - assert starting_dest_agent._toolroot == x_agent._toolroot - assert starting_dest_agent._toolroot._acptfactunits == {} + assert starting_dest_agent._idearoot._kids == x_agent._idearoot._kids + assert starting_dest_agent._idearoot == x_agent._idearoot + assert starting_dest_agent._idearoot._acptfactunits == {} assert starting_dest_agent._members == {} assert starting_dest_agent._groups == {} assert starting_dest_agent._desc == px.name @@ -190,7 +190,7 @@ def test_person_get_dest_agent_from_digest_agent_files_withEmptyDigestDict( sx_output_before = px.get_dest_agent_from_digest_agent_files() assert str(type(sx_output_before)).find(".agent.AgentUnit'>") assert sx_output_before._desc == person_name_x - assert sx_output_before._toolroot._desc == person_name_x + assert sx_output_before._idearoot._desc == person_name_x # px.set_digested_agent(agent_x=AgentUnit(_desc="digested1")) # WHEN @@ -198,24 +198,24 @@ def test_person_get_dest_agent_from_digest_agent_files_withEmptyDigestDict( # THEN person_agent_x = AgentUnit(_desc=person_name_x, _weight=0.0) - person_agent_x._toolroot._walk = "" + person_agent_x._idearoot._walk = "" person_agent_x.set_agent_metrics() # person_agent_x.set_members_empty_if_null() # person_agent_x.set_groupunits_empty_if_null() # person_agent_x._set_acptfacts_empty_if_null() - # person_agent_x._toolroot.set_grouplink_empty_if_null() - # person_agent_x._toolroot.set_requiredunits_empty_if_null() - # person_agent_x._toolroot.set_acptfactunits_empty_if_null() - # person_agent_x._toolroot.set_kids_empty_if_null() + # person_agent_x._idearoot.set_grouplink_empty_if_null() + # person_agent_x._idearoot.set_requiredunits_empty_if_null() + # person_agent_x._idearoot.set_acptfactunits_empty_if_null() + # person_agent_x._idearoot.set_kids_empty_if_null() assert str(type(sx_output_after)).find(".agent.AgentUnit'>") assert sx_output_after._weight == person_agent_x._weight - assert sx_output_after._toolroot._walk == person_agent_x._toolroot._walk + assert sx_output_after._idearoot._walk == person_agent_x._idearoot._walk assert ( - sx_output_after._toolroot._acptfactunits - == person_agent_x._toolroot._acptfactunits + sx_output_after._idearoot._acptfactunits + == person_agent_x._idearoot._acptfactunits ) - assert sx_output_after._toolroot == person_agent_x._toolroot + assert sx_output_after._idearoot == person_agent_x._idearoot def test_person_get_dest_agent_from_digest_agent_files_with1DigestedAgent( @@ -229,7 +229,7 @@ def test_person_get_dest_agent_from_digest_agent_files_with1DigestedAgent( sx_output_old = px.get_dest_agent_from_digest_agent_files() assert str(type(sx_output_old)).find(".agent.AgentUnit'>") assert sx_output_old._desc == person_name_x - assert sx_output_old._toolroot._desc == person_name_x + assert sx_output_old._idearoot._desc == person_name_x input_agent = example_persons.get_2node_agent() px.receive_src_agentunit_obj(agent_x=input_agent, link_type="blind_trust") @@ -242,16 +242,16 @@ def test_person_get_dest_agent_from_digest_agent_files_with1DigestedAgent( input_agent.make_meldable(px.get_starting_digest_agent()) assert sx_output_new._weight == 0 assert sx_output_new._weight != input_agent._weight - assert sx_output_new._toolroot._walk == input_agent._toolroot._walk + assert sx_output_new._idearoot._walk == input_agent._idearoot._walk assert ( - sx_output_new._toolroot._acptfactunits == input_agent._toolroot._acptfactunits + sx_output_new._idearoot._acptfactunits == input_agent._idearoot._acptfactunits ) - assert sx_output_new._toolroot._kids == input_agent._toolroot._kids + assert sx_output_new._idearoot._kids == input_agent._idearoot._kids assert ( - sx_output_new._toolroot._kids_total_weight - == input_agent._toolroot._kids_total_weight + sx_output_new._idearoot._kids_total_weight + == input_agent._idearoot._kids_total_weight ) - assert sx_output_new._toolroot == input_agent._toolroot + assert sx_output_new._idearoot == input_agent._idearoot assert sx_output_new._desc != input_agent._desc assert sx_output_new != input_agent @@ -279,12 +279,12 @@ def test_person_get_dest_agent_from_digest_agent_files_with1DigestedAgent( # yaya_text = "yaya" # yaya_road = Road(f"{src1},{yaya_text}") -# s1.add_tool(tool_kid=ToolKid(_desc=yaya_text), walk=src1_road) +# s1.add_idea(idea_kid=IdeaKid(_desc=yaya_text), walk=src1_road) # s1.set_acptfact(base=yaya_road, acptfact=yaya_road) # assert s1._groups.get(swim_text).name == swim_text # assert s1._members.get(ceci_text).name == ceci_text -# assert s1._toolroot._desc == src1 +# assert s1._idearoot._desc == src1 # assert s1._acptfacts.get(yaya_road).base == yaya_road # # WHEN @@ -298,10 +298,10 @@ def test_person_get_dest_agent_from_digest_agent_files_with1DigestedAgent( # assert sx_output_new._groups == s1._groups # assert sx_output_new._weight == s1._weight # assert sx_output_new._weight == s1._weight -# assert sx_output_new._toolroot._walk == s1._toolroot._walk -# assert sx_output_new._toolroot._acptfactunits == s1._toolroot._acptfactunits -# assert sx_output_new._toolroot._kids == s1._toolroot._kids -# assert sx_output_new._toolroot._kids_total_weight == s1._toolroot._kids_total_weight -# assert sx_output_new._toolroot == s1._toolroot +# assert sx_output_new._idearoot._walk == s1._idearoot._walk +# assert sx_output_new._idearoot._acptfactunits == s1._idearoot._acptfactunits +# assert sx_output_new._idearoot._kids == s1._idearoot._kids +# assert sx_output_new._idearoot._kids_total_weight == s1._idearoot._kids_total_weight +# assert sx_output_new._idearoot == s1._idearoot # assert sx_output_new._desc != s1._desc # assert sx_output_new != s1 diff --git a/src/system/test_system/test_bank_sqlstr.py b/src/system/test_system/test_bank_sqlstr.py index 04f409b3d..41ad06648 100644 --- a/src/system/test_system/test_bank_sqlstr.py +++ b/src/system/test_system/test_bank_sqlstr.py @@ -20,10 +20,10 @@ RiverLedgerUnit, RiverFlowUnit, get_river_ledger_unit, - get_tool_catalog_table_count, - ToolCatalog, - get_tool_catalog_table_insert_sqlstr, - get_tool_catalog_dict, + get_idea_catalog_table_count, + IdeaCatalog, + get_idea_catalog_table_insert_sqlstr, + get_idea_catalog_dict, get_acptfact_catalog_table_count, AcptFactCatalog, get_acptfact_catalog_table_insert_sqlstr, @@ -549,7 +549,7 @@ def test_get_river_bucket_table_insert_sqlstr_CorrectlyPopulatesTable01( # assert value.curr_close in [0.1, 1.0] -def test_system_get_tool_catalog_table_insert_sqlstr_CorrectlyPopulatesTable01( +def test_system_get_idea_catalog_table_insert_sqlstr_CorrectlyPopulatesTable01( env_dir_setup_cleanup, ): # GIVEN @@ -559,21 +559,21 @@ def test_system_get_tool_catalog_table_insert_sqlstr_CorrectlyPopulatesTable01( bob_text = "bob" with e1.get_bank_conn() as bank_conn: - assert get_tool_catalog_table_count(bank_conn, bob_text) == 0 + assert get_idea_catalog_table_count(bank_conn, bob_text) == 0 # WHEN water_road = "src,elements,water" - water_tool_catalog = ToolCatalog(agent_name=bob_text, tool_road=water_road) - water_insert_sqlstr = get_tool_catalog_table_insert_sqlstr(water_tool_catalog) + water_idea_catalog = IdeaCatalog(agent_name=bob_text, idea_road=water_road) + water_insert_sqlstr = get_idea_catalog_table_insert_sqlstr(water_idea_catalog) with e1.get_bank_conn() as bank_conn: print(water_insert_sqlstr) bank_conn.execute(water_insert_sqlstr) # THEN - assert get_tool_catalog_table_count(bank_conn, bob_text) == 1 + assert get_idea_catalog_table_count(bank_conn, bob_text) == 1 -def test_refresh_bank_metrics_Populates_tool_catalog_table(env_dir_setup_cleanup): +def test_refresh_bank_metrics_Populates_idea_catalog_table(env_dir_setup_cleanup): # GIVEN Create example system with 4 Persons, each with 3 Memberunits = 12 ledger rows e1 = SystemUnit(name=get_temp_env_name(), systems_dir=get_test_systems_dir()) e1.create_dirs_if_null(in_memory_bank=True) @@ -585,27 +585,27 @@ def test_refresh_bank_metrics_Populates_tool_catalog_table(env_dir_setup_cleanup bob_agent = get_3node_agent() tim_agent = get_6node_agent() sal_agent = get_agent_3CleanNodesRandomWeights() - bob_agent.agent_and_toolroot_desc_edit(new_desc=bob_text) - tim_agent.agent_and_toolroot_desc_edit(new_desc=tim_text) - sal_agent.agent_and_toolroot_desc_edit(new_desc=sal_text) + bob_agent.agent_and_idearoot_desc_edit(new_desc=bob_text) + tim_agent.agent_and_idearoot_desc_edit(new_desc=tim_text) + sal_agent.agent_and_idearoot_desc_edit(new_desc=sal_text) e1.save_agentunit_obj_to_agents_dir(agent_x=bob_agent) e1.save_agentunit_obj_to_agents_dir(agent_x=tim_agent) e1.save_agentunit_obj_to_agents_dir(agent_x=sal_agent) with e1.get_bank_conn() as bank_conn: - assert get_tool_catalog_table_count(bank_conn, bob_text) == 0 + assert get_idea_catalog_table_count(bank_conn, bob_text) == 0 # WHEN e1.refresh_bank_metrics() # THEN with e1.get_bank_conn() as bank_conn: - assert get_tool_catalog_table_count(bank_conn, bob_text) == 3 - assert get_tool_catalog_table_count(bank_conn, tim_text) == 6 - assert get_tool_catalog_table_count(bank_conn, sal_text) == 5 + assert get_idea_catalog_table_count(bank_conn, bob_text) == 3 + assert get_idea_catalog_table_count(bank_conn, tim_text) == 6 + assert get_idea_catalog_table_count(bank_conn, sal_text) == 5 -def test_system_get_tool_catalog_dict_ReturnsCorrectData(env_dir_setup_cleanup): +def test_system_get_idea_catalog_dict_ReturnsCorrectData(env_dir_setup_cleanup): # GIVEN e1 = SystemUnit(name=get_temp_env_name(), systems_dir=get_test_systems_dir()) e1.create_dirs_if_null(in_memory_bank=True) @@ -619,28 +619,28 @@ def test_system_get_tool_catalog_dict_ReturnsCorrectData(env_dir_setup_cleanup): tim_agent = get_6node_agent() sal_agent = get_agent_3CleanNodesRandomWeights() elu_agent = get_6node_agent() - bob_agent.agent_and_toolroot_desc_edit(new_desc=bob_text) - tim_agent.agent_and_toolroot_desc_edit(new_desc=tim_text) - sal_agent.agent_and_toolroot_desc_edit(new_desc=sal_text) - elu_agent.agent_and_toolroot_desc_edit(new_desc=elu_text) + bob_agent.agent_and_idearoot_desc_edit(new_desc=bob_text) + tim_agent.agent_and_idearoot_desc_edit(new_desc=tim_text) + sal_agent.agent_and_idearoot_desc_edit(new_desc=sal_text) + elu_agent.agent_and_idearoot_desc_edit(new_desc=elu_text) e1.save_agentunit_obj_to_agents_dir(agent_x=bob_agent) e1.save_agentunit_obj_to_agents_dir(agent_x=tim_agent) e1.save_agentunit_obj_to_agents_dir(agent_x=sal_agent) e1.save_agentunit_obj_to_agents_dir(agent_x=elu_agent) e1.refresh_bank_metrics() - i_count_sqlstr = get_table_count_sqlstr("tool_catalog") + i_count_sqlstr = get_table_count_sqlstr("idea_catalog") with e1.get_bank_conn() as bank_conn: print(f"{i_count_sqlstr=}") assert get_single_result_back(e1.get_bank_conn(), i_count_sqlstr) == 20 # WHEN / THEN - assert len(get_tool_catalog_dict(e1.get_bank_conn())) == 20 + assert len(get_idea_catalog_dict(e1.get_bank_conn())) == 20 b_road = "src,B" - assert len(get_tool_catalog_dict(e1.get_bank_conn(), b_road)) == 3 + assert len(get_idea_catalog_dict(e1.get_bank_conn(), b_road)) == 3 ce_road = "src,C,E" - assert len(get_tool_catalog_dict(e1.get_bank_conn(), ce_road)) == 2 + assert len(get_idea_catalog_dict(e1.get_bank_conn(), ce_road)) == 2 src_road = "src" - assert len(get_tool_catalog_dict(e1.get_bank_conn(), src_road)) == 4 + assert len(get_idea_catalog_dict(e1.get_bank_conn(), src_road)) == 4 def test_system_get_acptfact_catalog_table_insert_sqlstr_CorrectlyPopulatesTable01( @@ -685,17 +685,17 @@ def test_refresh_bank_metrics_Populates_acptfact_catalog_table( bob_agent = get_3node_agent() tim_agent = get_6node_agent() sal_agent = get_agent_3CleanNodesRandomWeights() - bob_agent.agent_and_toolroot_desc_edit(new_desc=bob_text) - tim_agent.agent_and_toolroot_desc_edit(new_desc=tim_text) - sal_agent.agent_and_toolroot_desc_edit(new_desc=sal_text) + bob_agent.agent_and_idearoot_desc_edit(new_desc=bob_text) + tim_agent.agent_and_idearoot_desc_edit(new_desc=tim_text) + sal_agent.agent_and_idearoot_desc_edit(new_desc=sal_text) c_text = "C" c_road = f"{tim_agent._desc},{c_text}" f_text = "F" f_road = f"{c_road},{f_text}" b_text = "B" b_road = f"{tim_agent._desc},{b_text}" - # for tool_x in tim_agent._tool_dict.values(): - # print(f"{f_road=} {tool_x.get_road()=}") + # for idea_x in tim_agent._idea_dict.values(): + # print(f"{f_road=} {idea_x.get_road()=}") tim_agent.set_acptfact(base=c_road, pick=f_road) bob_agent.set_acptfact(base=c_road, pick=f_road) diff --git a/src/system/test_system/test_system_agent.py b/src/system/test_system/test_system_agent.py index 4c6a0d278..7b36615d7 100644 --- a/src/system/test_system/test_system_agent.py +++ b/src/system/test_system/test_system_agent.py @@ -65,7 +65,7 @@ def test_system_get_agents_dir_list_of_obj_CreatesAgentFilesList( assert ex.get_agents_dir_file_names_list()[0] == f"{sx1_obj._desc}.json" assert ex.get_agents_dir_list_of_obj()[0]._desc == sx1_obj._desc assert ex.get_agents_dir_list_of_obj()[0] == sx1_obj - assert ex.get_agents_dir_list_of_obj()[1]._toolroot == sx2_obj._toolroot + assert ex.get_agents_dir_list_of_obj()[1]._idearoot == sx2_obj._idearoot assert ex.get_agents_dir_list_of_obj()[1] == sx2_obj assert ex.get_agents_dir_list_of_obj()[2] == sx3_obj @@ -136,9 +136,9 @@ def test_personunit_refresh_agentlinks_CorrectlyPullsAllPublicAgents( px_jessi.receive_src_agentunit_obj(agent_x=old_steve_cx) # px_steve.receive_src_agentunit_obj(agent_x=ernie_agent) # px_steve.receive_src_agentunit_obj(agent_x=jessi_agent) - assert len(px_ernie.get_dest_agent_from_digest_agent_files().get_tool_list()) == 4 - assert len(px_jessi.get_dest_agent_from_digest_agent_files().get_tool_list()) == 4 - # assert len(px_steve.get_dest_agent_from_digest_agent_files().get_tool_list()) == 4 + assert len(px_ernie.get_dest_agent_from_digest_agent_files().get_idea_list()) == 4 + assert len(px_jessi.get_dest_agent_from_digest_agent_files().get_idea_list()) == 4 + # assert len(px_steve.get_dest_agent_from_digest_agent_files().get_idea_list()) == 4 new_steve_agent = example_persons.get_agent_3CleanNodesRandomWeights(_desc="steve") e1.save_agentunit_obj_to_agents_dir(agent_x=new_steve_agent) # print(f"{env_dir=} {px._public_agents_dir=}") @@ -152,5 +152,5 @@ def test_personunit_refresh_agentlinks_CorrectlyPullsAllPublicAgents( e1.reload_all_persons_src_agentunits() # THEN - assert len(px_ernie.get_dest_agent_from_digest_agent_files().get_tool_list()) == 5 - assert len(px_jessi.get_dest_agent_from_digest_agent_files().get_tool_list()) == 5 + assert len(px_ernie.get_dest_agent_from_digest_agent_files().get_idea_list()) == 5 + assert len(px_jessi.get_dest_agent_from_digest_agent_files().get_idea_list()) == 5 diff --git a/src/system/test_system/test_system_bank.py b/src/system/test_system/test_system_bank.py index f56f1d8a9..2287278b5 100644 --- a/src/system/test_system/test_system_bank.py +++ b/src/system/test_system/test_system_bank.py @@ -1,6 +1,6 @@ from src.system.system import SystemUnit from src.agent.agent import AgentUnit -from src.agent.tool import ToolKid +from src.agent.idea import IdeaKid from src.agent.group import groupunit_shop from src.agent.member import memberlink_shop from src.agent.x_func import delete_dir as x_func_delete_dir @@ -111,7 +111,7 @@ def test_system_create_dirs_if_null_CorrectlyCreatesDBTables(env_dir_setup_clean 2: "river_tmember", 3: "river_flow", 4: "river_bucket", - 5: "tool_catalog", + 5: "idea_catalog", 6: "acptfact_catalog", 7: "groupunit_catalog", } @@ -311,7 +311,7 @@ def test_system_set_agent_attr_defined_by_system_CorrectlyPopulatesAgent_Groupun e1.create_dirs_if_null(in_memory_bank=True) # create 4 agents, 1 with group "swimming expert" linked to 1 member - # two others have tool "src,sports,swimming" + # two others have idea "src,sports,swimming" # run set_bank_metrics # assert # _memberlinks_set_by_system_road @@ -336,9 +336,9 @@ def test_system_set_agent_attr_defined_by_system_CorrectlyPopulatesAgent_Groupun bob_sports_road = f"{bob_agent._desc},{sports_text}" tom_sports_road = f"{tom_agent._desc},{sports_text}" - sal_agent.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=sal_sports_road) - bob_agent.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=bob_sports_road) - tom_agent.add_tool(tool_kid=ToolKid(_desc=swim_text), walk=tom_sports_road) + sal_agent.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=sal_sports_road) + bob_agent.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=bob_sports_road) + tom_agent.add_idea(idea_kid=IdeaKid(_desc=swim_text), walk=tom_sports_road) sal_agent.add_memberunit(name=bob_text, creditor_weight=2, debtor_weight=2) diff --git a/src/system/test_system/test_system_person_dest_agent.py b/src/system/test_system/test_system_person_dest_agent.py index 2e6a72495..7e08b1d0d 100644 --- a/src/system/test_system/test_system_person_dest_agent.py +++ b/src/system/test_system/test_system_person_dest_agent.py @@ -46,37 +46,37 @@ def test_system_get_person_dest_agent_from_digest_agent_files_ReturnsCorrectAgen input_agent.make_meldable(person_x_obj.get_starting_digest_agent()) # print(f"After meldable= {person_x_obj._src_agentlinks} ") - dest_agent_d_tool = dest_agent.get_tool_kid(road="A,C,D") - print(f" {dest_agent_d_tool._weight=} {len(input_agent._toolroot._kids)=} ") + dest_agent_d_idea = dest_agent.get_idea_kid(road="A,C,D") + print(f" {dest_agent_d_idea._weight=} {len(input_agent._idearoot._kids)=} ") assert dest_agent != None - assert len(input_agent._toolroot._kids) == 2 - # tool_a = dest_agent.get_tool_kid(road="A") - # tool_b = dest_agent.get_tool_kid(road="B") - # for tool_kid_x1 in input_agent._toolroot._kids.values(): - # print(f"{tool_kid_x1._desc=}") - # dest_agent_counterpart_x1 = dest_agent._toolroot._kids.get(tool_kid_x1._desc) - # for tool_kid_x2 in tool_kid_x1._kids.values(): + assert len(input_agent._idearoot._kids) == 2 + # idea_a = dest_agent.get_idea_kid(road="A") + # idea_b = dest_agent.get_idea_kid(road="B") + # for idea_kid_x1 in input_agent._idearoot._kids.values(): + # print(f"{idea_kid_x1._desc=}") + # dest_agent_counterpart_x1 = dest_agent._idearoot._kids.get(idea_kid_x1._desc) + # for idea_kid_x2 in idea_kid_x1._kids.values(): # dest_agent_counterpart_x2 = dest_agent_counterpart_x1._kids.get( - # tool_kid_x2._desc + # idea_kid_x2._desc # ) # print( - # f"{tool_kid_x2._desc=} {tool_kid_x2._weight=} {dest_agent_counterpart_x2._weight=}" + # f"{idea_kid_x2._desc=} {idea_kid_x2._weight=} {dest_agent_counterpart_x2._weight=}" # ) - # # assert dest_agent_counterpart_x2 == tool_kid_x2 - # assert dest_agent_counterpart_x2._desc == tool_kid_x2._desc + # # assert dest_agent_counterpart_x2 == idea_kid_x2 + # assert dest_agent_counterpart_x2._desc == idea_kid_x2._desc # print( - # f"{tool_kid_x1._desc=} {tool_kid_x1._weight=} {dest_agent_counterpart_x1._weight=}" + # f"{idea_kid_x1._desc=} {idea_kid_x1._weight=} {dest_agent_counterpart_x1._weight=}" # ) - # assert dest_agent_counterpart_x1._desc == tool_kid_x1._desc - # assert dest_agent._toolroot._kids == input_agent._toolroot._kids - assert dest_agent._toolroot._acptfactunits == {} - assert dest_agent._toolroot._acptfactunits == input_agent._toolroot._acptfactunits + # assert dest_agent_counterpart_x1._desc == idea_kid_x1._desc + # assert dest_agent._idearoot._kids == input_agent._idearoot._kids + assert dest_agent._idearoot._acptfactunits == {} + assert dest_agent._idearoot._acptfactunits == input_agent._idearoot._acptfactunits assert dest_agent._members == {} assert dest_agent._members == input_agent._members assert dest_agent._groups == {} assert dest_agent._groups == input_agent._groups - assert dest_agent._toolroot == input_agent._toolroot + assert dest_agent._idearoot == input_agent._idearoot def test_system_get_person_dest_agent_from_digest_agent_files_ReturnsCorrectAgentObjScenario2( @@ -108,33 +108,33 @@ def test_system_get_person_dest_agent_from_digest_agent_files_ReturnsCorrectAgen agent1.make_meldable(person_x_obj.get_starting_digest_agent()) # print(f"After meldable= {person_x_obj._src_agentlinks} ") - dest_agent_d_tool = dest_agent.get_tool_kid(road="A,C,D") - print(f" {dest_agent_d_tool._weight=} ") + dest_agent_d_idea = dest_agent.get_idea_kid(road="A,C,D") + print(f" {dest_agent_d_idea._weight=} ") assert dest_agent != None - # for tool_kid_x1 in agent1._toolroot._kids.values(): - # dest_agent_counterpart_x1 = dest_agent._toolroot._kids.get(tool_kid_x1._desc) - # for tool_kid_x2 in tool_kid_x1._kids.values(): + # for idea_kid_x1 in agent1._idearoot._kids.values(): + # dest_agent_counterpart_x1 = dest_agent._idearoot._kids.get(idea_kid_x1._desc) + # for idea_kid_x2 in idea_kid_x1._kids.values(): # dest_agent_counterpart_x2 = dest_agent_counterpart_x1._kids.get( - # tool_kid_x2._desc + # idea_kid_x2._desc # ) # print( - # f"{tool_kid_x2._desc=} {tool_kid_x2._weight=} {dest_agent_counterpart_x2._weight=}" + # f"{idea_kid_x2._desc=} {idea_kid_x2._weight=} {dest_agent_counterpart_x2._weight=}" # ) - # # assert dest_agent_counterpart_x2 == tool_kid_x2 - # assert dest_agent_counterpart_x2._desc == tool_kid_x2._desc + # # assert dest_agent_counterpart_x2 == idea_kid_x2 + # assert dest_agent_counterpart_x2._desc == idea_kid_x2._desc # print( - # f"{tool_kid_x1._desc=} {tool_kid_x1._weight=} {dest_agent_counterpart_x1._weight=}" + # f"{idea_kid_x1._desc=} {idea_kid_x1._weight=} {dest_agent_counterpart_x1._weight=}" # ) - # assert dest_agent_counterpart_x1._desc == tool_kid_x1._desc - # assert dest_agent._toolroot._kids == agent1._toolroot._kids - assert len(dest_agent._toolroot._acptfactunits) == 9 - assert len(dest_agent._toolroot._acptfactunits) == len( - agent2._toolroot._acptfactunits + # assert dest_agent_counterpart_x1._desc == idea_kid_x1._desc + # assert dest_agent._idearoot._kids == agent1._idearoot._kids + assert len(dest_agent._idearoot._acptfactunits) == 9 + assert len(dest_agent._idearoot._acptfactunits) == len( + agent2._idearoot._acptfactunits ) assert len(dest_agent._members) == 22 assert len(dest_agent._members) == len(agent2._members) assert len(dest_agent._groups) == 34 assert len(dest_agent._groups) == len(agent2._groups) - assert dest_agent._toolroot != agent1._toolroot - assert dest_agent._toolroot != agent2._toolroot + assert dest_agent._idearoot != agent1._idearoot + assert dest_agent._idearoot != agent2._idearoot diff --git a/src/system/test_system/test_system_person_task_received.py b/src/system/test_system/test_system_person_task_received.py index 73eda5689..675493b4f 100644 --- a/src/system/test_system/test_system_person_task_received.py +++ b/src/system/test_system/test_system_person_task_received.py @@ -32,9 +32,9 @@ def test_system_person1_set_laundry_fact_create_person2_laundry_task( # wx_path = f"{e1.get_persons_dir()}/{timmy_text}" - # person1 has necessary tools for laundry basket full != True or Not True + # person1 has necessary ideas for laundry basket full != True or Not True - # Have person2 receive laundry tool and status from person1 + # Have person2 receive laundry idea and status from person1 # confirm person1 laundry_full == False # confirm person2 agenda is empty diff --git a/ui/EditAcptFactTimeUI.py b/ui/EditAcptFactTimeUI.py index 4fd67567d..972e15959 100644 --- a/ui/EditAcptFactTimeUI.py +++ b/ui/EditAcptFactTimeUI.py @@ -130,7 +130,7 @@ def retranslateUi(self, Form): Form.setWindowTitle(_translate("Form", "Form")) self.label.setText( _translate( - "Form", "Reset Current Date for entire toolunit (American calendar)" + "Form", "Reset Current Date for entire ideaunit (American calendar)" ) ) self.label_2.setText(_translate("Form", "Year")) @@ -142,7 +142,7 @@ def retranslateUi(self, Form): self.label_11.setText(_translate("Form", "Day")) self.label_14.setText( _translate( - "Form", "Reset Previous Date for entire toolunit (American calendar)" + "Form", "Reset Previous Date for entire ideaunit (American calendar)" ) ) self.label_15.setText(_translate("Form", "Year")) diff --git a/ui/EditAcptFactTimeUI.ui b/ui/EditAcptFactTimeUI.ui index dfa2f8d7a..ad15ae100 100644 --- a/ui/EditAcptFactTimeUI.ui +++ b/ui/EditAcptFactTimeUI.ui @@ -33,7 +33,7 @@ - Reset Current Date for entire toolunit (American calendar) + Reset Current Date for entire ideaunit (American calendar) @@ -213,7 +213,7 @@ - Reset Previous Date for entire toolunit (American calendar) + Reset Previous Date for entire ideaunit (American calendar) diff --git a/ui/EditToolUI.py b/ui/EditIdeaUI.py similarity index 75% rename from ui/EditToolUI.py rename to ui/EditIdeaUI.py index 7dc89960f..c112471c1 100644 --- a/ui/EditToolUI.py +++ b/ui/EditIdeaUI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'ui\EditToolUI.ui' +# Form implementation generated from reading ui file 'ui\EditIdeaUI.ui' # # Created by: PyQt5 UI code generator 5.15.9 # diff --git a/ui/EditToolUnitUI.py b/ui/EditIdeaUnitUI.py similarity index 94% rename from ui/EditToolUnitUI.py rename to ui/EditIdeaUnitUI.py index eb002e471..ecb46ac91 100644 --- a/ui/EditToolUnitUI.py +++ b/ui/EditIdeaUnitUI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'ui\EditToolUnitUI.ui' +# Form implementation generated from reading ui file 'ui\EditIdeaUnitUI.ui' # # Created by: PyQt5 UI code generator 5.15.9 # @@ -58,10 +58,10 @@ def setupUi(self, Form): font.setPointSize(10) self.label_parent_id.setFont(font) self.label_parent_id.setObjectName("label_parent_id") - self.basetoolunit = QtWidgets.QTreeWidget(Form) - self.basetoolunit.setGeometry(QtCore.QRect(10, 110, 551, 721)) - self.basetoolunit.setIndentation(15) - self.basetoolunit.setObjectName("basetoolunit") + self.baseideaunit = QtWidgets.QTreeWidget(Form) + self.baseideaunit.setGeometry(QtCore.QRect(10, 110, 551, 721)) + self.baseideaunit.setIndentation(15) + self.baseideaunit.setObjectName("baseideaunit") self.submit_node_delete = QtWidgets.QPushButton(Form) self.submit_node_delete.setGeometry(QtCore.QRect(1080, 800, 91, 26)) self.submit_node_delete.setObjectName("submit_node_delete") @@ -74,38 +74,38 @@ def setupUi(self, Form): self.quit_button = QtWidgets.QPushButton(Form) self.quit_button.setGeometry(QtCore.QRect(1340, 20, 91, 31)) self.quit_button.setObjectName("quit_button") - self.tool2group_table = QtWidgets.QTableWidget(Form) - self.tool2group_table.setGeometry(QtCore.QRect(1050, 80, 381, 191)) + self.idea2group_table = QtWidgets.QTableWidget(Form) + self.idea2group_table.setGeometry(QtCore.QRect(1050, 80, 381, 191)) font = QtGui.QFont() font.setPointSize(8) - self.tool2group_table.setFont(font) - self.tool2group_table.setObjectName("tool2group_table") - self.tool2group_table.setColumnCount(3) - self.tool2group_table.setRowCount(0) + self.idea2group_table.setFont(font) + self.idea2group_table.setObjectName("idea2group_table") + self.idea2group_table.setColumnCount(3) + self.idea2group_table.setRowCount(0) item = QtWidgets.QTableWidgetItem() - self.tool2group_table.setHorizontalHeaderItem(0, item) + self.idea2group_table.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() - self.tool2group_table.setHorizontalHeaderItem(1, item) + self.idea2group_table.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() - self.tool2group_table.setHorizontalHeaderItem(2, item) - self.tool2group_delete_button = QtWidgets.QPushButton(Form) - self.tool2group_delete_button.setGeometry(QtCore.QRect(1440, 80, 131, 28)) + self.idea2group_table.setHorizontalHeaderItem(2, item) + self.idea2group_delete_button = QtWidgets.QPushButton(Form) + self.idea2group_delete_button.setGeometry(QtCore.QRect(1440, 80, 131, 28)) font = QtGui.QFont() font.setPointSize(8) - self.tool2group_delete_button.setFont(font) - self.tool2group_delete_button.setObjectName("tool2group_delete_button") - self.tool2group_insert_button = QtWidgets.QPushButton(Form) - self.tool2group_insert_button.setGeometry(QtCore.QRect(1050, 50, 141, 28)) + self.idea2group_delete_button.setFont(font) + self.idea2group_delete_button.setObjectName("idea2group_delete_button") + self.idea2group_insert_button = QtWidgets.QPushButton(Form) + self.idea2group_insert_button.setGeometry(QtCore.QRect(1050, 50, 141, 28)) font = QtGui.QFont() font.setPointSize(8) - self.tool2group_insert_button.setFont(font) - self.tool2group_insert_button.setObjectName("tool2group_insert_button") - self.tool2group_insert_combo = QtWidgets.QComboBox(Form) - self.tool2group_insert_combo.setGeometry(QtCore.QRect(1200, 50, 231, 26)) + self.idea2group_insert_button.setFont(font) + self.idea2group_insert_button.setObjectName("idea2group_insert_button") + self.idea2group_insert_combo = QtWidgets.QComboBox(Form) + self.idea2group_insert_combo.setGeometry(QtCore.QRect(1200, 50, 231, 26)) font = QtGui.QFont() font.setPointSize(8) - self.tool2group_insert_combo.setFont(font) - self.tool2group_insert_combo.setObjectName("tool2group_insert_combo") + self.idea2group_insert_combo.setFont(font) + self.idea2group_insert_combo.setObjectName("idea2group_insert_combo") self.cb_rootrank = QtWidgets.QCheckBox(Form) self.cb_rootrank.setGeometry(QtCore.QRect(100, 20, 100, 20)) self.cb_rootrank.setObjectName("cb_rootrank") @@ -639,25 +639,25 @@ def setupUi(self, Form): def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Form")) - self.label_14.setText(_translate("Form", "Tools: Edit or Add Children ")) + self.label_14.setText(_translate("Form", "Ideas: Edit or Add Children ")) self.label_1.setText(_translate("Form", "Description")) self.label_4.setText(_translate("Form", "Weight")) self.submit_child_insert.setText(_translate("Form", "Add Child")) self.submit_node_update.setText(_translate("Form", "Update Node")) self.label_parent_id.setText(_translate("Form", "Current Node ID:")) - self.basetoolunit.headerItem().setText(0, _translate("Form", "toolunit")) + self.baseideaunit.headerItem().setText(0, _translate("Form", "ideaunit")) self.submit_node_delete.setText(_translate("Form", "Delete Node")) self.refresh_button.setText(_translate("Form", "Refresh")) self.close_button.setText(_translate("Form", "Close")) self.quit_button.setText(_translate("Form", "Quit App")) - item = self.tool2group_table.horizontalHeaderItem(0) + item = self.idea2group_table.horizontalHeaderItem(0) item.setText(_translate("Form", "Group_ID")) - item = self.tool2group_table.horizontalHeaderItem(1) + item = self.idea2group_table.horizontalHeaderItem(1) item.setText(_translate("Form", "Group")) - item = self.tool2group_table.horizontalHeaderItem(2) + item = self.idea2group_table.horizontalHeaderItem(2) item.setText(_translate("Form", "Member Count")) - self.tool2group_delete_button.setText(_translate("Form", "De-link Group")) - self.tool2group_insert_button.setText(_translate("Form", "Add Group to Tool")) + self.idea2group_delete_button.setText(_translate("Form", "De-link Group")) + self.idea2group_insert_button.setText(_translate("Form", "Add Group to Idea")) self.cb_rootrank.setText(_translate("Form", "root rank")) self.cb_yo_id.setText(_translate("Form", "uid")) self.cb_yo2bd_count.setText(_translate("Form", "Group count")) @@ -765,4 +765,4 @@ def retranslateUi(self, Form): item.setText(_translate("Form", "SuffFact_status")) item = self.requiredheir_table.horizontalHeaderItem(10) item.setText(_translate("Form", "11")) - self.submit_duty_insert.setText(_translate("Form", "Add Duty child tool")) + self.submit_duty_insert.setText(_translate("Form", "Add Duty child idea")) diff --git a/ui/EditToolUnitUI.ui b/ui/EditIdeaUnitUI.ui similarity index 98% rename from ui/EditToolUnitUI.ui rename to ui/EditIdeaUnitUI.ui index 07f22d17b..59a5d7740 100644 --- a/ui/EditToolUnitUI.ui +++ b/ui/EditIdeaUnitUI.ui @@ -34,7 +34,7 @@ - Tools: Edit or Add Children + Ideas: Edit or Add Children @@ -147,7 +147,7 @@ Current Node ID: - + 10 @@ -161,7 +161,7 @@ - toolunit + ideaunit @@ -217,7 +217,7 @@ Quit App - + 1050 @@ -247,7 +247,7 @@ - + 1440 @@ -265,7 +265,7 @@ De-link Group - + 1050 @@ -280,10 +280,10 @@ - Add Group to Tool + Add Group to Idea - + 1200 @@ -1827,7 +1827,7 @@ - Add Duty child tool + Add Duty child idea diff --git a/ui/EditMainUI.py b/ui/EditMainUI.py index 072803343..e13977e8d 100644 --- a/ui/EditMainUI.py +++ b/ui/EditMainUI.py @@ -21,10 +21,10 @@ def setupUi(self, Form): self.refresh_button = QtWidgets.QPushButton(Form) self.refresh_button.setGeometry(QtCore.QRect(670, 20, 161, 31)) self.refresh_button.setObjectName("refresh_button") - self.basetoolunit = QtWidgets.QTreeWidget(Form) - self.basetoolunit.setGeometry(QtCore.QRect(10, 60, 400, 630)) - self.basetoolunit.setObjectName("basetoolunit") - self.basetoolunit.headerItem().setText(0, "1") + self.baseideaunit = QtWidgets.QTreeWidget(Form) + self.baseideaunit.setGeometry(QtCore.QRect(10, 60, 400, 630)) + self.baseideaunit.setObjectName("baseideaunit") + self.baseideaunit.headerItem().setText(0, "1") self.close_button = QtWidgets.QPushButton(Form) self.close_button.setGeometry(QtCore.QRect(890, 20, 93, 28)) self.close_button.setObjectName("close_button") diff --git a/ui/EditMainUI.ui b/ui/EditMainUI.ui index 9fa85125d..7a045769f 100644 --- a/ui/EditMainUI.ui +++ b/ui/EditMainUI.ui @@ -36,7 +36,7 @@ Refresh All - + 10 diff --git a/ui/EditProblemUI.py b/ui/EditProblemUI.py index 9eb953f2e..71a19f18a 100644 --- a/ui/EditProblemUI.py +++ b/ui/EditProblemUI.py @@ -144,10 +144,10 @@ def setupUi(self, Form): self.action3_text = QtWidgets.QLineEdit(Form) self.action3_text.setGeometry(QtCore.QRect(80, 640, 391, 31)) self.action3_text.setObjectName("action3_text") - self.basetoolunit = QtWidgets.QTreeWidget(Form) - self.basetoolunit.setGeometry(QtCore.QRect(1420, 50, 411, 631)) - self.basetoolunit.setIndentation(15) - self.basetoolunit.setObjectName("basetoolunit") + self.baseideaunit = QtWidgets.QTreeWidget(Form) + self.baseideaunit.setGeometry(QtCore.QRect(1420, 50, 411, 631)) + self.baseideaunit.setIndentation(15) + self.baseideaunit.setObjectName("baseideaunit") self.refresh_button = QtWidgets.QPushButton(Form) self.refresh_button.setGeometry(QtCore.QRect(1220, 10, 171, 31)) self.refresh_button.setObjectName("refresh_button") @@ -202,7 +202,7 @@ def retranslateUi(self, Form): self.label_12.setText(_translate("Form", "3.")) self.label_13.setText(_translate("Form", "2.")) self.label_14.setText(_translate("Form", "1.")) - self.basetoolunit.headerItem().setText(0, _translate("Form", "toolunit")) + self.baseideaunit.headerItem().setText(0, _translate("Form", "ideaunit")) self.refresh_button.setText(_translate("Form", "Refresh All")) self.load_problem_button.setText(_translate("Form", "Load Problem")) self.view_problems_cb.setText(_translate("Form", "view only problems")) diff --git a/ui/EditProblemUI.ui b/ui/EditProblemUI.ui index 6f4bc48f2..6e9910751 100644 --- a/ui/EditProblemUI.ui +++ b/ui/EditProblemUI.ui @@ -464,7 +464,7 @@ - + 1420 @@ -478,7 +478,7 @@ - toolunit + ideaunit diff --git a/ui/MainWindow.py b/ui/MainWindow.py index 7fd31541c..3d49e2a10 100644 --- a/ui/MainWindow.py +++ b/ui/MainWindow.py @@ -376,7 +376,7 @@ def retranslateUi(self, MainWindow): self.label_agenda_agent_importance_header2.setText( _translate("MainWindow", "weight:") ) - self.label_agenda_road_data.setText(_translate("MainWindow", "Tool_id:")) + self.label_agenda_road_data.setText(_translate("MainWindow", "Idea_id:")) self.label_agenda_family_data.setText(_translate("MainWindow", "Agenda")) self.label_agenda_agent_importance_data.setText( _translate("MainWindow", "weight:") @@ -394,7 +394,7 @@ def retranslateUi(self, MainWindow): item = self.agenda_states.horizontalHeaderItem(2) item.setText(_translate("MainWindow", "agent_importance")) item = self.agenda_states.horizontalHeaderItem(3) - item.setText(_translate("MainWindow", "tool_road")) + item.setText(_translate("MainWindow", "idea_road")) item = self.agenda_states.horizontalHeaderItem(4) item.setText(_translate("MainWindow", "branch_percent")) item = self.agenda_states.horizontalHeaderItem(5) diff --git a/ui/MainWindow.ui b/ui/MainWindow.ui index 276c8b293..8377365ac 100644 --- a/ui/MainWindow.ui +++ b/ui/MainWindow.ui @@ -498,7 +498,7 @@ - Tool_id: + Idea_id: @@ -658,7 +658,7 @@ - tool_road + idea_road diff --git a/ui/SystemMainUI.py b/ui/SystemMainUI.py index ea3ab27db..72c08f24b 100644 --- a/ui/SystemMainUI.py +++ b/ui/SystemMainUI.py @@ -231,20 +231,20 @@ def setupUi(self, MainWindow): self.w_groups_table.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.w_groups_table.setHorizontalHeaderItem(2, item) - self.w_tools_table = QtWidgets.QTableWidget(self.centralwidget) - self.w_tools_table.setGeometry(QtCore.QRect(600, 10, 391, 681)) + self.w_ideas_table = QtWidgets.QTableWidget(self.centralwidget) + self.w_ideas_table.setGeometry(QtCore.QRect(600, 10, 391, 681)) font = QtGui.QFont() font.setPointSize(8) - self.w_tools_table.setFont(font) - self.w_tools_table.setObjectName("w_tools_table") - self.w_tools_table.setColumnCount(3) - self.w_tools_table.setRowCount(0) + self.w_ideas_table.setFont(font) + self.w_ideas_table.setObjectName("w_ideas_table") + self.w_ideas_table.setColumnCount(3) + self.w_ideas_table.setRowCount(0) item = QtWidgets.QTableWidgetItem() - self.w_tools_table.setHorizontalHeaderItem(0, item) + self.w_ideas_table.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() - self.w_tools_table.setHorizontalHeaderItem(1, item) + self.w_ideas_table.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() - self.w_tools_table.setHorizontalHeaderItem(2, item) + self.w_ideas_table.setHorizontalHeaderItem(2, item) self.w_acptfacts_table = QtWidgets.QTableWidget(self.centralwidget) self.w_acptfacts_table.setGeometry(QtCore.QRect(1180, 10, 371, 241)) font = QtGui.QFont() @@ -452,10 +452,10 @@ def retranslateUi(self, MainWindow): item.setText(_translate("MainWindow", "Persons Groups")) item = self.w_groups_table.horizontalHeaderItem(1) item.setText(_translate("MainWindow", "New Column")) - item = self.w_tools_table.horizontalHeaderItem(0) - item.setText(_translate("MainWindow", "Person Tools")) - item = self.w_tools_table.horizontalHeaderItem(1) - item.setText(_translate("MainWindow", "Tool walk")) + item = self.w_ideas_table.horizontalHeaderItem(0) + item.setText(_translate("MainWindow", "Person Ideas")) + item = self.w_ideas_table.horizontalHeaderItem(1) + item.setText(_translate("MainWindow", "Idea walk")) item = self.w_acptfacts_table.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "AcptFacts Base")) item = self.w_acptfacts_table.horizontalHeaderItem(1) diff --git a/ui/systemMainUI.ui b/ui/systemMainUI.ui index be5cd6179..9a24db07c 100644 --- a/ui/systemMainUI.ui +++ b/ui/systemMainUI.ui @@ -562,7 +562,7 @@ - + 600 @@ -578,12 +578,12 @@ - Person Tools + Person Ideas - Tool walk + Idea walk diff --git a/ui/ui_EditAcptFactTimeUI.py b/ui/ui_EditAcptFactTimeUI.py index a6e8f5bdc..59b426c9a 100644 --- a/ui/ui_EditAcptFactTimeUI.py +++ b/ui/ui_EditAcptFactTimeUI.py @@ -187,7 +187,7 @@ def retranslateUi(self, Form): Form.setWindowTitle(_translate("Form", "Form")) self.label.setText( _translate( - "Form", "Reset Current Date for entire toolunit (American calendar)" + "Form", "Reset Current Date for entire ideaunit (American calendar)" ) ) self.label_2.setText(_translate("Form", "Year")) @@ -200,7 +200,7 @@ def retranslateUi(self, Form): ) self.label_7.setText( _translate( - "Form", "Reset Current Date for entire toolunit (My Day Listing)" + "Form", "Reset Current Date for entire ideaunit (My Day Listing)" ) ) self.label_8.setText(_translate("Form", "Day ID")) @@ -210,7 +210,7 @@ def retranslateUi(self, Form): self.label_9.setText(_translate("Form", "Day_Min ID")) self.label_10.setText( _translate( - "Form", "Reset Previous Date for entire toolunit (My Day Listing)" + "Form", "Reset Previous Date for entire ideaunit (My Day Listing)" ) ) self.prev_local_update.setText( @@ -224,7 +224,7 @@ def retranslateUi(self, Form): self.label_12.setText(_translate("Form", "Day ID")) self.label_14.setText( _translate( - "Form", "Reset Previous Date for entire toolunit (American calendar)" + "Form", "Reset Previous Date for entire ideaunit (American calendar)" ) ) self.label_15.setText(_translate("Form", "Year")) diff --git a/ui/ui_EditMainUI.py b/ui/ui_EditMainUI.py index 37d0939b6..f33ef3e04 100644 --- a/ui/ui_EditMainUI.py +++ b/ui/ui_EditMainUI.py @@ -21,10 +21,10 @@ def setupUi(self, Form): self.refresh_button = QtWidgets.QPushButton(Form) self.refresh_button.setGeometry(QtCore.QRect(670, 20, 161, 31)) self.refresh_button.setObjectName("refresh_button") - self.basetoolunit = QtWidgets.QTreeWidget(Form) - self.basetoolunit.setGeometry(QtCore.QRect(10, 60, 400, 630)) - self.basetoolunit.setObjectName("basetoolunit") - self.basetoolunit.headerItem().setText(0, "1") + self.baseideaunit = QtWidgets.QTreeWidget(Form) + self.baseideaunit.setGeometry(QtCore.QRect(10, 60, 400, 630)) + self.baseideaunit.setObjectName("baseideaunit") + self.baseideaunit.headerItem().setText(0, "1") self.close_button = QtWidgets.QPushButton(Form) self.close_button.setGeometry(QtCore.QRect(890, 20, 93, 28)) self.close_button.setObjectName("close_button") diff --git a/ui/ui_EditProblemUI.py b/ui/ui_EditProblemUI.py index d16c40dbf..f1c3dc40b 100644 --- a/ui/ui_EditProblemUI.py +++ b/ui/ui_EditProblemUI.py @@ -144,10 +144,10 @@ def setupUi(self, Form): self.action3_text = QtWidgets.QLineEdit(Form) self.action3_text.setGeometry(QtCore.QRect(80, 640, 391, 31)) self.action3_text.setObjectName("action3_text") - self.basetoolunit = QtWidgets.QTreeWidget(Form) - self.basetoolunit.setGeometry(QtCore.QRect(1420, 50, 411, 631)) - self.basetoolunit.setIndentation(15) - self.basetoolunit.setObjectName("basetoolunit") + self.baseideaunit = QtWidgets.QTreeWidget(Form) + self.baseideaunit.setGeometry(QtCore.QRect(1420, 50, 411, 631)) + self.baseideaunit.setIndentation(15) + self.baseideaunit.setObjectName("baseideaunit") self.refresh_button = QtWidgets.QPushButton(Form) self.refresh_button.setGeometry(QtCore.QRect(1220, 10, 171, 31)) self.refresh_button.setObjectName("refresh_button") @@ -202,7 +202,7 @@ def retranslateUi(self, Form): self.label_12.setText(_translate("Form", "3.")) self.label_13.setText(_translate("Form", "2.")) self.label_14.setText(_translate("Form", "1.")) - self.basetoolunit.headerItem().setText(0, _translate("Form", "toolunit")) + self.baseideaunit.headerItem().setText(0, _translate("Form", "ideaunit")) self.refresh_button.setText(_translate("Form", "Refresh All")) self.load_problem_button.setText(_translate("Form", "Load Problem")) self.view_problems_cb.setText(_translate("Form", "view only problems")) diff --git a/ui/ui_EditYokeunitRootDatesUI.py b/ui/ui_EditYokeunitRootDatesUI.py index 65a2775cb..5e11c4099 100644 --- a/ui/ui_EditYokeunitRootDatesUI.py +++ b/ui/ui_EditYokeunitRootDatesUI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'ui\EditToolunitRootDatesUI.ui' +# Form implementation generated from reading ui file 'ui\EditIdeaunitRootDatesUI.ui' # # Created by: PyQt5 UI code generator 5.15.4 # @@ -187,7 +187,7 @@ def retranslateUi(self, Form): Form.setWindowTitle(_translate("Form", "Form")) self.label.setText( _translate( - "Form", "Reset Current Date for entire toolunit (American calendar)" + "Form", "Reset Current Date for entire ideaunit (American calendar)" ) ) self.label_2.setText(_translate("Form", "Year")) @@ -200,7 +200,7 @@ def retranslateUi(self, Form): ) self.label_7.setText( _translate( - "Form", "Reset Current Date for entire toolunit (My Day Listing)" + "Form", "Reset Current Date for entire ideaunit (My Day Listing)" ) ) self.label_8.setText(_translate("Form", "Day ID")) @@ -210,7 +210,7 @@ def retranslateUi(self, Form): self.label_9.setText(_translate("Form", "Day_Min ID")) self.label_10.setText( _translate( - "Form", "Reset Previous Date for entire toolunit (My Day Listing)" + "Form", "Reset Previous Date for entire ideaunit (My Day Listing)" ) ) self.prev_local_update.setText( @@ -224,7 +224,7 @@ def retranslateUi(self, Form): self.label_12.setText(_translate("Form", "Day ID")) self.label_14.setText( _translate( - "Form", "Reset Previous Date for entire toolunit (American calendar)" + "Form", "Reset Previous Date for entire ideaunit (American calendar)" ) ) self.label_15.setText(_translate("Form", "Year")) diff --git a/ui/ui_EditYokeunitUI.py b/ui/ui_EditYokeunitUI.py index dd8e72041..0bbf44926 100644 --- a/ui/ui_EditYokeunitUI.py +++ b/ui/ui_EditYokeunitUI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'c:\dev\reddibrush\ui\EditToolunitUI.ui' +# Form implementation generated from reading ui file 'c:\dev\reddibrush\ui\EditIdeaunitUI.ui' # # Created by: PyQt5 UI code generator 5.15.4 # @@ -58,10 +58,10 @@ def setupUi(self, Form): font.setPointSize(10) self.label_parent_id.setFont(font) self.label_parent_id.setObjectName("label_parent_id") - self.basetoolunit = QtWidgets.QTreeWidget(Form) - self.basetoolunit.setGeometry(QtCore.QRect(10, 110, 551, 721)) - self.basetoolunit.setIndentation(15) - self.basetoolunit.setObjectName("basetoolunit") + self.baseideaunit = QtWidgets.QTreeWidget(Form) + self.baseideaunit.setGeometry(QtCore.QRect(10, 110, 551, 721)) + self.baseideaunit.setIndentation(15) + self.baseideaunit.setObjectName("baseideaunit") self.submit_node_delete = QtWidgets.QPushButton(Form) self.submit_node_delete.setGeometry(QtCore.QRect(1080, 800, 91, 26)) self.submit_node_delete.setObjectName("submit_node_delete") @@ -74,38 +74,38 @@ def setupUi(self, Form): self.quit_button = QtWidgets.QPushButton(Form) self.quit_button.setGeometry(QtCore.QRect(1340, 20, 91, 31)) self.quit_button.setObjectName("quit_button") - self.tool2group_table = QtWidgets.QTableWidget(Form) - self.tool2group_table.setGeometry(QtCore.QRect(1050, 80, 381, 191)) + self.idea2group_table = QtWidgets.QTableWidget(Form) + self.idea2group_table.setGeometry(QtCore.QRect(1050, 80, 381, 191)) font = QtGui.QFont() font.setPointSize(8) - self.tool2group_table.setFont(font) - self.tool2group_table.setObjectName("tool2group_table") - self.tool2group_table.setColumnCount(3) - self.tool2group_table.setRowCount(0) + self.idea2group_table.setFont(font) + self.idea2group_table.setObjectName("idea2group_table") + self.idea2group_table.setColumnCount(3) + self.idea2group_table.setRowCount(0) item = QtWidgets.QTableWidgetItem() - self.tool2group_table.setHorizontalHeaderItem(0, item) + self.idea2group_table.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() - self.tool2group_table.setHorizontalHeaderItem(1, item) + self.idea2group_table.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() - self.tool2group_table.setHorizontalHeaderItem(2, item) - self.tool2group_delete_button = QtWidgets.QPushButton(Form) - self.tool2group_delete_button.setGeometry(QtCore.QRect(1440, 80, 131, 28)) + self.idea2group_table.setHorizontalHeaderItem(2, item) + self.idea2group_delete_button = QtWidgets.QPushButton(Form) + self.idea2group_delete_button.setGeometry(QtCore.QRect(1440, 80, 131, 28)) font = QtGui.QFont() font.setPointSize(8) - self.tool2group_delete_button.setFont(font) - self.tool2group_delete_button.setObjectName("tool2group_delete_button") - self.tool2group_insert_button = QtWidgets.QPushButton(Form) - self.tool2group_insert_button.setGeometry(QtCore.QRect(1050, 50, 141, 28)) + self.idea2group_delete_button.setFont(font) + self.idea2group_delete_button.setObjectName("idea2group_delete_button") + self.idea2group_insert_button = QtWidgets.QPushButton(Form) + self.idea2group_insert_button.setGeometry(QtCore.QRect(1050, 50, 141, 28)) font = QtGui.QFont() font.setPointSize(8) - self.tool2group_insert_button.setFont(font) - self.tool2group_insert_button.setObjectName("tool2group_insert_button") - self.tool2group_insert_combo = QtWidgets.QComboBox(Form) - self.tool2group_insert_combo.setGeometry(QtCore.QRect(1200, 50, 231, 26)) + self.idea2group_insert_button.setFont(font) + self.idea2group_insert_button.setObjectName("idea2group_insert_button") + self.idea2group_insert_combo = QtWidgets.QComboBox(Form) + self.idea2group_insert_combo.setGeometry(QtCore.QRect(1200, 50, 231, 26)) font = QtGui.QFont() font.setPointSize(8) - self.tool2group_insert_combo.setFont(font) - self.tool2group_insert_combo.setObjectName("tool2group_insert_combo") + self.idea2group_insert_combo.setFont(font) + self.idea2group_insert_combo.setObjectName("idea2group_insert_combo") self.cb_rootrank = QtWidgets.QCheckBox(Form) self.cb_rootrank.setGeometry(QtCore.QRect(100, 20, 100, 20)) self.cb_rootrank.setObjectName("cb_rootrank") @@ -583,25 +583,25 @@ def setupUi(self, Form): def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Form")) - self.label_14.setText(_translate("Form", "Tools: Edit or Add Children ")) + self.label_14.setText(_translate("Form", "Ideas: Edit or Add Children ")) self.label_1.setText(_translate("Form", "Description")) self.label_4.setText(_translate("Form", "Weight")) self.submit_child_insert.setText(_translate("Form", "Add Child")) self.submit_node_update.setText(_translate("Form", "Update Node")) self.label_parent_id.setText(_translate("Form", "Current Node ID:")) - self.basetoolunit.headerItem().setText(0, _translate("Form", "toolunit")) + self.baseideaunit.headerItem().setText(0, _translate("Form", "ideaunit")) self.submit_node_delete.setText(_translate("Form", "Delete Node")) self.refresh_button.setText(_translate("Form", "Refresh")) self.close_button.setText(_translate("Form", "Close")) self.quit_button.setText(_translate("Form", "Quit App")) - item = self.tool2group_table.horizontalHeaderItem(0) + item = self.idea2group_table.horizontalHeaderItem(0) item.setText(_translate("Form", "Group_ID")) - item = self.tool2group_table.horizontalHeaderItem(1) + item = self.idea2group_table.horizontalHeaderItem(1) item.setText(_translate("Form", "Group")) - item = self.tool2group_table.horizontalHeaderItem(2) + item = self.idea2group_table.horizontalHeaderItem(2) item.setText(_translate("Form", "Member Count")) - self.tool2group_delete_button.setText(_translate("Form", "De-link Group")) - self.tool2group_insert_button.setText(_translate("Form", "Add Group to Tool")) + self.idea2group_delete_button.setText(_translate("Form", "De-link Group")) + self.idea2group_insert_button.setText(_translate("Form", "Add Group to Idea")) self.cb_rootrank.setText(_translate("Form", "root rank")) self.cb_yo_id.setText(_translate("Form", "uid")) self.cb_yo2bd_count.setText(_translate("Form", "Group count")) @@ -640,7 +640,7 @@ def retranslateUi(self, Form): item.setText(_translate("Form", "Limt_status")) item = self.required_table.horizontalHeaderItem(9) item.setText(_translate("Form", "SuffFact_status")) - self.cb_acptfact_count.setText(_translate("Form", "Tool Required")) + self.cb_acptfact_count.setText(_translate("Form", "Idea Required")) self.cb_required_count.setText(_translate("Form", "Required Count")) self.cb_required_view.setText(_translate("Form", "Required:")) self.prom_label_03.setText(_translate("Form", "AcptFact")) diff --git a/ui/ui_ToolunitMainUI.py b/ui/ui_IdeaunitMainUI.py similarity index 84% rename from ui/ui_ToolunitMainUI.py rename to ui/ui_IdeaunitMainUI.py index 5a2a5ee89..307debdbf 100644 --- a/ui/ui_ToolunitMainUI.py +++ b/ui/ui_IdeaunitMainUI.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'ui\ToolunitMainUI.ui' +# Form implementation generated from reading ui file 'ui\IdeaunitMainUI.ui' # # Created by: PyQt5 UI code generator 5.15.4 # @@ -21,10 +21,10 @@ def setupUi(self, Form): self.refresh_button = QtWidgets.QPushButton(Form) self.refresh_button.setGeometry(QtCore.QRect(670, 20, 161, 31)) self.refresh_button.setObjectName("refresh_button") - self.basetoolunit = QtWidgets.QTreeWidget(Form) - self.basetoolunit.setGeometry(QtCore.QRect(10, 60, 400, 630)) - self.basetoolunit.setObjectName("basetoolunit") - self.basetoolunit.headerItem().setText(0, "1") + self.baseideaunit = QtWidgets.QTreeWidget(Form) + self.baseideaunit.setGeometry(QtCore.QRect(10, 60, 400, 630)) + self.baseideaunit.setObjectName("baseideaunit") + self.baseideaunit.headerItem().setText(0, "1") self.close_button = QtWidgets.QPushButton(Form) self.close_button.setGeometry(QtCore.QRect(890, 20, 93, 28)) self.close_button.setObjectName("close_button") diff --git a/ui/ui_MainWindow.py b/ui/ui_MainWindow.py index 72d7ce118..9398108bd 100644 --- a/ui/ui_MainWindow.py +++ b/ui/ui_MainWindow.py @@ -417,7 +417,7 @@ def retranslateUi(self, MainWindow): self.label_agenda_agent_importance_header2.setText( _translate("MainWindow", "weight:") ) - self.label_agenda_road_data.setText(_translate("MainWindow", "Tool_id:")) + self.label_agenda_road_data.setText(_translate("MainWindow", "Idea_id:")) self.label_agenda_family_data.setText(_translate("MainWindow", "Agenda")) self.label_agenda_agent_importance_data.setText( _translate("MainWindow", "weight:") @@ -435,7 +435,7 @@ def retranslateUi(self, MainWindow): item = self.agenda_states.horizontalHeaderItem(2) item.setText(_translate("MainWindow", "agent_importance")) item = self.agenda_states.horizontalHeaderItem(3) - item.setText(_translate("MainWindow", "tool_road")) + item.setText(_translate("MainWindow", "idea_road")) item = self.agenda_states.horizontalHeaderItem(4) item.setText(_translate("MainWindow", "branch_percent")) item = self.agenda_states.horizontalHeaderItem(5) diff --git a/ui/ui_SystemMainUI.py b/ui/ui_SystemMainUI.py index 56beb98c1..5f6e536d1 100644 --- a/ui/ui_SystemMainUI.py +++ b/ui/ui_SystemMainUI.py @@ -164,17 +164,17 @@ def setupUi(self, MainWindow): self.w_groups_table.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.w_groups_table.setHorizontalHeaderItem(1, item) - self.w_tools_table = QtWidgets.QTableWidget(self.centralwidget) - self.w_tools_table.setGeometry(QtCore.QRect(900, 10, 231, 681)) - self.w_tools_table.setObjectName("w_tools_table") - self.w_tools_table.setColumnCount(3) - self.w_tools_table.setRowCount(0) + self.w_ideas_table = QtWidgets.QTableWidget(self.centralwidget) + self.w_ideas_table.setGeometry(QtCore.QRect(900, 10, 231, 681)) + self.w_ideas_table.setObjectName("w_ideas_table") + self.w_ideas_table.setColumnCount(3) + self.w_ideas_table.setRowCount(0) item = QtWidgets.QTableWidgetItem() - self.w_tools_table.setHorizontalHeaderItem(0, item) + self.w_ideas_table.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() - self.w_tools_table.setHorizontalHeaderItem(1, item) + self.w_ideas_table.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() - self.w_tools_table.setHorizontalHeaderItem(2, item) + self.w_ideas_table.setHorizontalHeaderItem(2, item) self.w_acptfacts_table = QtWidgets.QTableWidget(self.centralwidget) self.w_acptfacts_table.setGeometry(QtCore.QRect(1320, 10, 171, 241)) self.w_acptfacts_table.setObjectName("w_acptfacts_table") @@ -263,10 +263,10 @@ def retranslateUi(self, MainWindow): item.setText(_translate("MainWindow", "Persons Members")) item = self.w_groups_table.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "Persons Groups")) - item = self.w_tools_table.horizontalHeaderItem(0) - item.setText(_translate("MainWindow", "Person Tools")) - item = self.w_tools_table.horizontalHeaderItem(1) - item.setText(_translate("MainWindow", "Tool walk")) + item = self.w_ideas_table.horizontalHeaderItem(0) + item.setText(_translate("MainWindow", "Person Ideas")) + item = self.w_ideas_table.horizontalHeaderItem(1) + item.setText(_translate("MainWindow", "Idea walk")) item = self.w_acptfacts_table.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "Persons AcptFacts")) self.menubar.setAccessibleName(_translate("MainWindow", "File")) diff --git a/ui/ui_main_window.py b/ui/ui_main_window.py index c283e770c..c280ef28c 100644 --- a/ui/ui_main_window.py +++ b/ui/ui_main_window.py @@ -183,12 +183,12 @@ def setupUi(self, MainWindow): font.setPointSize(12) self.label_agenda_family_header1.setFont(font) self.label_agenda_family_header1.setObjectName("label_agenda_family_header1") - self.label_agenda_tool_id_header = QtWidgets.QLabel(self.centralwidget) - self.label_agenda_tool_id_header.setGeometry(QtCore.QRect(30, 750, 71, 41)) + self.label_agenda_idea_id_header = QtWidgets.QLabel(self.centralwidget) + self.label_agenda_idea_id_header.setGeometry(QtCore.QRect(30, 750, 71, 41)) font = QtGui.QFont() font.setPointSize(12) - self.label_agenda_tool_id_header.setFont(font) - self.label_agenda_tool_id_header.setObjectName("label_agenda_tool_id_header") + self.label_agenda_idea_id_header.setFont(font) + self.label_agenda_idea_id_header.setObjectName("label_agenda_idea_id_header") self.label_agenda_description_data = QtWidgets.QLabel(self.centralwidget) self.label_agenda_description_data.setGeometry(QtCore.QRect(80, 350, 681, 71)) font = QtGui.QFont() @@ -217,14 +217,14 @@ def setupUi(self, MainWindow): self.label_agenda_agent_importance_header2.setObjectName( "label_agenda_agent_importance_header2" ) - self.label_agenda_tool_id_data = QtWidgets.QLabel(self.centralwidget) - self.label_agenda_tool_id_data.setGeometry(QtCore.QRect(130, 750, 221, 41)) + self.label_agenda_idea_id_data = QtWidgets.QLabel(self.centralwidget) + self.label_agenda_idea_id_data.setGeometry(QtCore.QRect(130, 750, 221, 41)) font = QtGui.QFont() font.setPointSize(22) font.setBold(True) font.setWeight(75) - self.label_agenda_tool_id_data.setFont(font) - self.label_agenda_tool_id_data.setObjectName("label_agenda_tool_id_data") + self.label_agenda_idea_id_data.setFont(font) + self.label_agenda_idea_id_data.setObjectName("label_agenda_idea_id_data") self.label_agenda_family_data = QtWidgets.QLabel(self.centralwidget) self.label_agenda_family_data.setGeometry(QtCore.QRect(130, 710, 221, 31)) font = QtGui.QFont() @@ -436,12 +436,12 @@ def retranslateUi(self, MainWindow): _translate("MainWindow", "root_relative") ) self.label_agenda_family_header1.setText(_translate("MainWindow", "Agenda")) - self.label_agenda_tool_id_header.setText(_translate("MainWindow", "Tool_id:")) + self.label_agenda_idea_id_header.setText(_translate("MainWindow", "Idea_id:")) self.label_agenda_family_header2.setText(_translate("MainWindow", "Family:")) self.label_agenda_agent_importance_header2.setText( _translate("MainWindow", "weight:") ) - self.label_agenda_tool_id_data.setText(_translate("MainWindow", "Tool_id:")) + self.label_agenda_idea_id_data.setText(_translate("MainWindow", "Idea_id:")) self.label_agenda_family_data.setText(_translate("MainWindow", "Agenda")) self.label_agenda_agent_importance_data.setText( _translate("MainWindow", "weight:")