[TCT][Tool][Non-ACR] Minor bug fixes 02/310902/2
authorUtkarsh Tiwari <utk.tiwari@samsung.com>
Thu, 9 May 2024 09:27:32 +0000 (14:57 +0530)
committerUtkarsh Tiwari <utk.tiwari@samsung.com>
Thu, 9 May 2024 09:48:49 +0000 (15:18 +0530)
Change-Id: Ib455f16d54d4c217e627a81a8e18f1d00a7a8b87
Signed-off-by: Utkarsh Tiwari <utk.tiwari@samsung.com>
tool/TC_Assistant_Tool/Ko_Lang_Support/eng_ko_replies.csv
tool/TC_Assistant_Tool/Module_Header_Mapping.csv
tool/TC_Assistant_Tool/data_TCT.json
tool/TC_Assistant_Tool/enum_finder.py
tool/TC_Assistant_Tool/tct_assistance.py
tool/TC_Assistant_Tool/template_tc.py
tool/TC_Assistant_Tool/validate_api.py

index f67652a5b33dc4ded735a56d5a20d29dcf53c7d3..cc61c74edfdb4b9acca7332ce30a5f12bcc272ef 100644 (file)
@@ -63,3 +63,4 @@ translate_56,You can't go back at this stage. Please write the appropriate input
 translate_57,Please select numbers for the corresponding stage you want to go to:\n,다음 단계로 이동할 해당 단계를 선택하십시오:\n
 translate_58,"If you wish to EXIT, Please type Exit","만약 종료하고 싶으시다면, 'Exit'라고 입력해주세요"
 translate_59,Invalid Input. Please try writing again,잘못된 입력입니다. 다시 작성해보세요
+Translate_60,Module name found,
index 31c835b920c91d540a4fe6961efcde4101afdb28..83d124175763aad80e392530f537b84c3dcaa07c 100644 (file)
@@ -120,22 +120,3 @@ widget_viewer_evas,widget_service/widget_errno.h,widget_service/widget_service.h
 wifi-direct,wifi-direct/wifi-direct.h,,,,,,,,,,,,,,,,,,,,,
 wifi-manager,network/wifi-manager.h,,,,,,,,,,,,,,,,,,,,,
 yaca,linux/stddef.h,yaca/yaca_crypto.h,yaca/yaca_error.h,yaca/yaca_key.h,yaca/yaca_sign.h,yaca/yaca_encrypt.h,yaca/yaca_digest.h,yaca/yaca_simple.h,yaca/yaca_types.h,yaca/yaca_rsa.h,yaca/yaca_seal.h,yaca/yaca_sign.h,yaca/yaca_simple.h,,,,,,,,,
-lang2,location/locations.h\r
-lang3,location/locations.h\r
-testone,location/locations.h\r
-testtwo,location/locations.h\r
-testhree,location/locations.h\r
-testfour,location/locations.h\r
-qwerty1,location/locations.h\r
-qwerty2,location/locations.h\r
-qwerty6,location/locations.h\r
-qwerty7,media/media_streamer.h\r
-newmodule,location/locations.h\r
-newmodule1,location/locations.h\r
-newmodule3,location/locations.h\r
-newmodule5,location/locations.h\r
-alarm_new,appfw/app_alarm.h\r
-media_new,media/media_streamer.h\r
-media_new,media/media_streamer.h\r
-media_new2,media/media_streamer.h\r
-test_new,location/locations.h\r
index 8b387dbe03962786e1db18f377f0c04c6c42d24e..44fc33e10f07cfe838b4523274d6337441ea3b15 100644 (file)
       "tag": "removeapi",\r
       "patterns": ["Remove Deprecated APIs"],\r
       "responses": [\r
-        "Please enter the list of deprecated APIs which you want to be removed in the format of DELETE: API_NAME_1, API_NAME_2, API_NAME_3, etc.\n\n[ To navigate, please type 'Back' ]"\r
+        "Please enter the list of deprecated APIs which you want to be removed in the format of DELETE: API_NAME_1, API_NAME_2, API_NAME_3, etc. \n\n[ To navigate, please type 'Back' ]"\r
       ]\r
     },\r
     {\r
index 466d2590fe0c0707e3636ce82a05422ace5002a6..e2ab8bdaa23c61feb10959302d9a339f6a028e2a 100644 (file)
@@ -62,5 +62,6 @@ def enum_finder(API, ROOTSTRAPS_DIR, header_files_dict, params):
     for key,val in enums_param_value_dict.items():
         if "=" in val:
             enums_param_value_dict[key]=((val.split('=')[0])).strip()
+
     return enums_param_value_dict
 
index bf837c19715198d54aff9d3297024eaf990f345e..fb83e3a38db02fa417dfd1a361c7581459e32bd4 100644 (file)
@@ -293,8 +293,6 @@ def get_response(message):
     log_info_save_processing(logger, "Importing data_TCT.json file")\r
 \r
     try:\r
-        # f = open("data_TCT.json")\r
-        # data = json.load(f)\r
         if radio_var.get() == 2:\r
             f = open("Ko_Lang_Support/data_TCT_KOR.json")\r
         else:\r
@@ -310,9 +308,6 @@ def get_response(message):
             intent="prepostinfo"\r
         else:\r
             intent = get_prediction(message)\r
-            print("message ", message)\r
-            print("intent ", intent)\r
-            print("previous intent", previous_intent)\r
         log_info_save(logger, "Intent", intent)\r
     except:\r
         log_create(logger, "Error occurred in get_prediction function")\r
@@ -329,7 +324,7 @@ def get_response(message):
         if message == '1' or message == '2' or message == '3' or message == '4' or message == '5' or message == '6' or message == "exit" or message == "EXIT" or message == "Exit":\r
             if previous_intent == "goback":\r
                 if message == '1':\r
-                    msg = "greetings"\r
+                    msg = "hi"\r
                 if message == '2':\r
                     if new_module == True:\r
                         msg = "newmodule"\r
@@ -367,7 +362,6 @@ def get_response(message):
             get_response(msg)\r
 \r
         elif message == 'a' or message == 'b' or message == 'c' or message == 'd' or message == 'e' or message == '' or message == "exit" or message == "EXIT" or message == "Exit":\r
-            # if previous_intent == "entry":\r
             previous_intent = "supportsys"\r
             if message == 'a':\r
                 msg = "Build Issue"\r
@@ -451,10 +445,8 @@ def get_response(message):
 \r
             elif previous_intent == "inputremovalapi":\r
                 if message.lower() == "yes":\r
-                    # MODULE_NAME = module_name.lower()\r
                     CURRENT_PATH = get_current_dir_path()\r
                     TC_DIR_PATH = CURRENT_PATH + r'src/utc/'\r
-                    # REMOVE_TC_LIST, NOT_FOUND_API_LIST = deprecated_api_removal(MODULE_NAME, remove_api_names, TC_DIR_PATH)\r
                     delete_apis_from_header_files(MODULE_NAME, '', TC_DIR_PATH, REMOVE_TC_LIST)\r
                     result = "Above mentioned TCs have been removed successfully. Type 'EXIT' to close the tool."\r
                 elif message.lower() == "no":\r
@@ -462,9 +454,7 @@ def get_response(message):
 \r
             #ask a question to execute or not\r
             elif previous_intent == 'executetc':\r
-                print("inside elif executetc ", message.lower())\r
                 if message.lower() == 'yes':\r
-                    print("inside elif executetc yes")\r
                     intent = 'launchtctmgr'\r
                 elif message.lower() == "no":\r
                     result = get_en_or_ko_replies('translate_13', radio_var.get())\r
@@ -509,7 +499,6 @@ def get_response(message):
                     result = get_en_or_ko_replies('translate_16', radio_var.get())\r
                     previous_intent = 'modulename'\r
             else:\r
-                # previous_intent = 'modulename'\r
                 module_name_suggested = module_autocorrect(module_name)\r
                 if module_name_suggested == True:\r
                     last_stage_index = 1\r
@@ -596,7 +585,6 @@ def get_response(message):
                             return result_next\r
 \r
                     api_return_values = get_api_return_values()\r
-                    # print("api_return_values", api_return_values)\r
                     api_params = get_api_parameters(API_NAMES)\r
                     for k, v in api_return_values.items():\r
                         for i in API_NAMES:\r
@@ -657,7 +645,6 @@ def get_response(message):
 \r
                 if last_char == '"' or last_char =="'":\r
                     feature_name = feature_name.replace(last_char,"",1)\r
-            ## print("feature name2")\r
                 feature_name = feature_name.strip()\r
 \r
 \r
@@ -665,20 +652,7 @@ def get_response(message):
 \r
             elif feature_name == "" and previous_intent == 'goback':\r
                 previous_intent = 'featureinfo'\r
-                # print("feature_name,sfsadf",feature_name, previous_intent)\r
-                first_char = feature_name[0]\r
-                last_char = feature_name[len(feature_name)-1]\r
-\r
-                if first_char == '"' or first_char =="'":\r
-                    feature_name = feature_name.replace(first_char,"",1)\r
-            ## print("feature name1", feature_name)\r
-\r
-                if last_char == '"' or last_char =="'":\r
-                    feature_name = feature_name.replace(last_char,"",1)\r
-            ## print("feature name2")\r
                 feature_name = feature_name.strip()\r
-\r
-\r
                 result = get_en_or_ko_replies('translate_31', radio_var.get())\r
 \r
             else:\r
@@ -690,7 +664,6 @@ def get_response(message):
 \r
             header_files_dict = get_header_files(MODULE_NAME)\r
             pre_post_api_names = message\r
-            ## print("pre post details---------------", pre_post_api_names)\r
             NEGATIVE_TC_COUNT = 10\r
             last_stage_index = 4\r
 \r
@@ -706,8 +679,6 @@ def get_response(message):
                         for API_IDX in range(1, len(API_NAMES)):\r
                             get_pre_post_api_list = get_pre_post_api_list_info(API_NAMES[API_IDX], MODULE_NAME, API_IDX , pre_post_api_names)\r
                             API_NAMES_LIST += get_pre_post_api_list[API_NAMES[API_IDX]]['Pre'] + get_pre_post_api_list[API_NAMES[API_IDX]]['Post']\r
-                            # print("API_NAMES_LIST",API_NAMES_LIST)\r
-                        # get_response('Pre:')\r
 \r
                     else:\r
                         if (CURR_API_IND+1)<len(API_NAMES):\r
@@ -715,7 +686,6 @@ def get_response(message):
                                     + get_en_or_ko_replies('translate_35', radio_var.get())  +  f"{API_NAMES[CURR_API_IND+1]}" + get_en_or_ko_replies('translate_36', radio_var.get())\r
                         else:\r
                             result = get_en_or_ko_replies('translate_37', radio_var.get()) + f"{API_NAMES[CURR_API_IND]}"\r
-                #if CURR_API_IND + 1 < len(API_NAMES):\r
 \r
                 if all_pre_post_api_skip == True:\r
                     CURR_API_IND = len(API_NAMES)\r
@@ -727,7 +697,6 @@ def get_response(message):
                 if CURR_API_IND == len(API_NAMES):\r
                     if check_if_pre_post_api_exist:\r
                         get_all_api_list = get_api_return_values()\r
-                        # get_all_agrs_list = get_api_parameters(API_NAMES + get_pre_post_api_list[API_NAMES[CURR_API_IND]]['Pre'] + get_pre_post_api_list[API_NAMES[CURR_API_IND]]['Post'])\r
                         get_all_agrs_list = get_api_parameters(API_NAMES + API_NAMES_LIST)\r
                         PRE_POST_API_ARGS_LIST = get_all_agrs_list\r
                         ROOTSTRAPS_DIR = get_latest_rootstrap()\r
@@ -743,7 +712,7 @@ def get_response(message):
                             post_apis = PRE_POST_API_LIST['Post']\r
 \r
 \r
-                            if len(pre_apis) != 0:\r
+                            if len(pre_apis) > 0:\r
                                 for pre_api in pre_apis:\r
                                     api_params_pre = PRE_POST_API_ARGS_LIST[pre_api]\r
                                     enum = enum_finder(pre_api, ROOTSTRAPS_DIR, header_files_dict, api_params_pre)\r
@@ -751,7 +720,7 @@ def get_response(message):
                                         enum_dict_pre_post[pre_api] = enum\r
                                     else:\r
                                         enum_dict_pre_post[pre_api] = {}\r
-                            if len(post_apis) != 0:\r
+                            if len(post_apis) > 0:\r
                                 for post_api in post_apis:\r
                                     api_params_post = PRE_POST_API_ARGS_LIST[post_api]\r
                                     enum = enum_finder(post_api, ROOTSTRAPS_DIR, header_files_dict, api_params_post)\r
@@ -765,7 +734,6 @@ def get_response(message):
                             HEADER_FILE_CONTAINED_FOLDER = HEADER_FILE_CONTAINED_FOLDER.replace('-','_')\r
 \r
                             get_tc_template_code = tc_code_write1(get_all_api_list, MODULE_NAME, API_NAMES[API_IDX], PRE_POST_API_LIST, PRE_POST_API_ARGS_LIST, FUNC_API_ALL_ARGS[API_IDX], HEADER_FILE_CONTAINED_FOLDER, enum_dict, enum_dict_pre_post, feature_name, callback_duplicate_check)\r
-                            ## print("get_tc_template_code",get_tc_template_code)\r
                             appended_code = appended_code + "\n" + get_tc_template_code\r
 \r
                             if len(TARGET_API_INPUT_PARAMS_LIST) > 0:\r
@@ -815,13 +783,10 @@ def get_response(message):
             file_name = file_name.strip()\r
 \r
             previous_intent = 'tcwritelocation'\r
-            # global input_params\r
             last_stage_index = 6\r
-            # print("WRITE_NEGATIVE_TC_USER_INPUT",WRITE_NEGATIVE_TC_USER_INPUT)\r
 \r
             if file_name != "":\r
                 if check_if_file_name_exists(file_name, TC_WRITE_DIR, MODULE_NAME):\r
-                    #inp_params=ret_input_params()\r
                     with open(TC_WRITE_DIR + "/" + MODULE_NAME + "/" + f"{file_name}", "a") as myfile:\r
                         if WRITE_NEGATIVE_TC_USER_INPUT:\r
                             myfile.write(get_negative_tc_template_code)\r
@@ -871,7 +836,7 @@ def get_response(message):
 \r
         elif intent == 'removeapi':\r
             previous_intent = 'removeapi'\r
-            result = "Please provide module name for which you want to remove TCs in the form of \nModule name: NAME_OF_THE_MAIL\n\n[ To navigate, please type 'Back' ]"\r
+            result = "Please provide module name for which you want to remove TCs in the form of \nModule name: NAME_OF_THE_MODULE\n\n[ To navigate, please type 'Back' ]"\r
 \r
         elif intent == 'inputremovalapi':\r
             previous_intent = 'inputremovalapi'\r
@@ -880,7 +845,6 @@ def get_response(message):
             MODULE_NAME = module_name.lower()\r
             CURRENT_PATH = get_current_dir_path()\r
             TC_DIR_PATH = CURRENT_PATH + r'src/utc/'\r
-            # print("Above mentioned APIs will be removed" + "\n\n" + deprecated_api_removal(MODULE_NAME, remove_api_names))\r
             REMOVE_TC_LIST, NOT_FOUND_API_LIST = deprecated_api_removal(MODULE_NAME, remove_api_names, TC_DIR_PATH)\r
             REMOVE_TC_LIST_NUMBERED = ""\r
             NOT_FOUND_API_LIST_NUMBERED = ""\r
@@ -920,7 +884,6 @@ def get_response(message):
             if (arch_value == "armv7l" or arch_value == "x86" or arch_value == "x64" or arch_value == "aarch64") and (profile_value == "tv" or profile_value == "tizeniot"):\r
                 bar(get_en_or_ko_replies('translate_49', radio_var.get()))\r
                 output_build = tpk_build_install("build", "utc", MODULE_NAME, build_params[1], build_params[0])\r
-                # time.sleep(3)\r
                 if output_build.find("CREATION  SUCCESSFUL") != -1:\r
                     if previous_intent == 'executetc':\r
                         style.configure("text.Horizontal.TProgressbar", text="",background="lightgray",foreground="lightgray", font=("Malgun Gothic", 10, 'bold'))\r
@@ -933,7 +896,6 @@ def get_response(message):
                 result = get_en_or_ko_replies('translate_53', radio_var.get())\r
 \r
         if intent == "launchtctmgr":\r
-            print("inside launchtctmgr intent")\r
             bar("Installing...")\r
             execute_params = get_build_parameters(execute_tc_params_text)\r
             output_execute = tpk_build_install("install", "utc", MODULE_NAME, execute_params[1], execute_params[0])\r
@@ -948,7 +910,6 @@ def get_response(message):
         elif intent == "buildlogdebug":\r
             build_log = message\r
             print("BUILD LOG ", build_log)\r
-            print("^^^^^^^^^^^^^^^^^^^^^^^^")\r
             print(build_log_debug(build_log))\r
             build_fail_reason = build_log_debug(build_log)\r
             result = build_fail_reason + get_en_or_ko_replies('translate_55', radio_var.get())\r
@@ -989,7 +950,6 @@ log_info_save_processing(logger, "TC Assistant tool launched successfully..!!")
 # GUI with tkinter\r
 \r
 def copy_text(res):\r
-    # base.withdraw()\r
     base.clipboard_clear()\r
     base.clipboard_append(res)\r
     base.update()\r
@@ -1069,7 +1029,6 @@ def send(event=None):
             ChatLog.insert(END, '\n')\r
             ChatLog.config(state=NORMAL)\r
             ChatLog.yview(END)\r
-            #time.sleep(2)\r
             base.after(1000,base.quit)\r
         else:\r
             try:\r
@@ -1090,7 +1049,6 @@ def send(event=None):
             ChatLog.insert(END, '\n')\r
             ChatLog.config(state=NORMAL)\r
             ChatLog.yview(END)\r
-            #time.sleep(2)\r
             base.after(1000,base.quit)\r
         elif msg.lower() != 'exit' and res != 'exit':\r
             Bot = customtkinter.CTkLabel(ChatLog,text="Assistant: "+res, fg_color='#C0C0C0',corner_radius=10,text_color='black', justify='left', padx=10, pady=5,font=("Malgun Gothic", 13 ),wraplength=500, cursor="hand1")\r
@@ -1105,11 +1063,9 @@ def send(event=None):
         Bot.bind("<Button-1>", lambda e:copy_text(res))\r
 \r
         ChatLog.config(state=DISABLED)\r
-        # ChatLog.yview(END)\r
 \r
 \r
 def helpText():\r
-    # subprocess.call([opener, '/home/sri/tctapi/7.0/api/tool/TC_Assistant/HELP_TEXT.txt'])\r
     #Creates a Button to Open the Toplevel Window which opens a popup to display all the instructions\r
     top= customtkinter.CTkToplevel(base)\r
     top.geometry("700x720")\r
@@ -1136,8 +1092,6 @@ def on_closing():
 \r
 def radiobutton_event():\r
     print("radiobutton toggled, current value:", radio_var.get())\r
-    # child_info = base.winfo_children()\r
-    # print(child_info)\r
     print("ChatLog.winfo_children()", ChatLog.winfo_children())\r
     for child in ChatLog.winfo_children():\r
         if child.widgetName == "frame":\r
@@ -1148,14 +1102,12 @@ def radiobutton_event():
         welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n"\r
         welcomeText = translate_to_ko(welcomeText)\r
         Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10,font=("Malgun Gothic", 13),wraplength=500, cursor="hand2")\r
-        # ChatLog.insert('end', '\n ')\r
         ChatLog.window_create('end', window=Bot_ko)\r
         ChatLog.insert(END, '\n')\r
     elif radio_var.get() == 1:\r
         Bot.destroy()\r
         welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n"\r
         Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10,font=("Malgun Gothic", 13),wraplength=500, cursor="hand2")\r
-        # ChatLog.insert('end', '\n ')\r
         ChatLog.window_create('end', window=Bot_ko)\r
         ChatLog.insert(END, '\n')\r
     return radio_var.get()\r
@@ -1167,7 +1119,6 @@ base.title("TC Assistant")
 base.call('wm', 'iconphoto', base._w, ImageTk.PhotoImage(file=CURRENT_PATH_IMG + '/logo1.png', master = base))\r
 base.geometry("600x800")\r
 base.resizable(width=FALSE, height=FALSE)\r
-# base.eval('tk::PlaceWindow . center')\r
 base.grid_rowconfigure(0, weight=1)\r
 base.grid_columnconfigure(0, weight=1)\r
 center(base)\r
@@ -1184,7 +1135,6 @@ Bot = customtkinter.CTkLabel(ChatLog,text="Assistant: "+welcomeText, justify='le
 ChatLog.insert('end', '\n ')\r
 ChatLog.window_create('end', window=Bot)\r
 ChatLog.insert(END, '\n')\r
-# Bot.after(1, Bot.destroy())\r
 \r
 \r
 ChatLog.config(state=DISABLED)\r
@@ -1199,7 +1149,7 @@ EntryBox = customtkinter.CTkTextbox(base, corner_radius=10, fg_color="#d3d3d3",t
 EntryBox.focus_set()\r
 EntryBox.pack()\r
 \r
-copyrightText = customtkinter.CTkLabel(base,text='Copyright (c) 2023 Samsung Electronics Co., Ltd.',justify='right',padx=4)\r
+copyrightText = customtkinter.CTkLabel(base,text='Copyright (c) 2024 Samsung Electronics Co., Ltd.',justify='right',padx=4)\r
 \r
 helpButton = customtkinter.CTkButton(base,text='Help',width=115,fg_color='#757575',hover_color="#343434",text_color='white',command= helpText)\r
 englishButton = customtkinter.CTkButton(base,text='En',width=35,fg_color='#757575',hover_color="#343434",text_color='white',command= helpText)\r
@@ -1227,5 +1177,4 @@ base.protocol("WM_DELETE_WINDOW", on_closing)
 base.bind_all("<MouseWheel>", _on_mousewheel)\r
 EntryBox.bind("<Control-Key-a>", select_all)\r
 EntryBox.bind("<Control-Key-A>", select_all)\r
-# base.bind('<Control-c>', quit)\r
 base.mainloop()\r
index e7b5de1634f489a76cc40e6e824511fe4e93b4d0..48cbbdb4479d2d62eabf9d16389a82f12be74ac6 100644 (file)
@@ -344,7 +344,7 @@ def tc_code_init(MODULE_NAME, file_name,header_files_dict):
 
     tc_init0 = (
         "/**\n"
-        "* Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved\n"
+        "* Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\n"
         "*\n"
         '* Licensed under the Apache License, Version 2.0 (the "License");\n'
         "* you may not use this file except in compliance with the License.\n"
index 68270232d26795aa3071fdcad34cb7f7046f603b..f2af9595ccd2eee1d406c693ae05e21f1de600c9 100644 (file)
@@ -31,7 +31,7 @@ def check_api_in_module(HEADER_FILE_NAME, API_SEARCH):
         updated_line_multiple=''\r
         for line_no, line in enumerate(file_one):\r
             line = line.strip()\r
-            if (line.find(API_SEARCH + "(") != -1 or line.find(API_SEARCH + " (") != -1) and line[:1] != '*':\r
+            if (line.find(API_SEARCH + "(") != -1 or line.find(API_SEARCH + " (") != -1) and line[:1] != '*' and "/*" not in line and line[:1] != 'm':\r
                 found_api = True\r
                 updated_line  = line.strip()\r
 \r
@@ -72,7 +72,7 @@ def validate_api(API_NAMES, MODULE_NAME):
     DIR = get_latest_rootstrap()\r
     # based on module name we get from the arguments we have to get header files in the form of dictionary\r
     header_files_dict = get_header_files(MODULE_NAME)\r
-    if(len(API_NAMES) == 0):\r
+    if len(API_NAMES) == 0:\r
         return True\r
     # for ever file in the dictionary we have to check if all the api names provided by the user exists or not\r
     # we will take api names one by one and check in all the files if it exists or not\r