From 30678928c1746176de9923025b012c370fd28e0a Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Fri, 17 Jul 2020 21:03:14 +0530 Subject: flake8 compliant and visual indent --- src/createKicadLibrary.py | 13 +++++++------ src/ghdlserver/ghdlserver.c | 6 +++--- src/model_generation.py | 22 +++++++++++++--------- src/outitf.c | 5 +++-- 4 files changed, 26 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/createKicadLibrary.py b/src/createKicadLibrary.py index 2b3e7d7..d7a39d1 100644 --- a/src/createKicadLibrary.py +++ b/src/createKicadLibrary.py @@ -16,7 +16,8 @@ class AutoSchematic(QtGui.QWidget): if os.name == 'nt': eSim_src = Appconfig.src_home inst_dir = eSim_src.replace('\eSim', '') - self.kicad_nghdl_lib = inst_dir + '/KiCad/share/kicad/library/eSim_Nghdl.lib' + self.kicad_nghdl_lib = \ + inst_dir + '/KiCad/share/kicad/library/eSim_Nghdl.lib' else: self.kicad_nghdl_lib = '/usr/share/kicad/library/eSim_Nghdl.lib' self.parser = Appconfig.parser_nghdl @@ -82,17 +83,17 @@ class AutoSchematic(QtGui.QWidget): ET.SubElement(root, "type").text = "Nghdl" ET.SubElement(root, "node_number").text = str(len(self.portInfo)) ET.SubElement(root, "title").text = ( - "Add parameters for " + str(self.modelname)) + "Add parameters for " + str(self.modelname)) ET.SubElement(root, "split").text = self.splitText param = ET.SubElement(root, "param") ET.SubElement(param, "rise_delay", default="1.0e-9").text = ( - "Enter Rise Delay (default=1.0e-9)") + "Enter Rise Delay (default=1.0e-9)") ET.SubElement(param, "fall_delay", default="1.0e-9").text = ( - "Enter Fall Delay (default=1.0e-9)") + "Enter Fall Delay (default=1.0e-9)") ET.SubElement(param, "input_load", default="1.0e-12").text = ( - "Enter Input Load (default=1.0e-12)") + "Enter Input Load (default=1.0e-12)") ET.SubElement(param, "instance_id", default="1").text = ( - "Enter Instance ID (Between 0-99)") + "Enter Instance ID (Between 0-99)") tree = ET.ElementTree(root) tree.write(str(self.modelname) + '.xml') print("Leaving the directory ", xmlDestination) diff --git a/src/ghdlserver/ghdlserver.c b/src/ghdlserver/ghdlserver.c index 410a2ff..f2b632d 100644 --- a/src/ghdlserver/ghdlserver.c +++ b/src/ghdlserver/ghdlserver.c @@ -10,9 +10,9 @@ ************************************************************************************ ************************************************************************************ * 08.Nov.2019 - Rahul Paknikar - Switched to blocking sockets from non-blocking - * - Close previous used socket to prevent from - * generating too many socket descriptors - * - Enabled SO_REUSEPORT, SO_DONTROUTE socket options + * - Close previous used socket to prevent from + * generating too many socket descriptors + * - Enabled SO_REUSEPORT, SO_DONTROUTE socket options * 5.July.2019 - Rahul Paknikar - Added loop to send all port values for * a given event. ************************************************************************************ diff --git a/src/model_generation.py b/src/model_generation.py index 7baecc1..f19a5c9 100644 --- a/src/model_generation.py +++ b/src/model_generation.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import re import os from configparser import SafeConfigParser @@ -289,11 +287,13 @@ class ModelGeneration: if os.name == 'nt': client_setup_ip += ''' - sprintf(ip_filename, "C:/Windows/Temp/NGHDL_COMMON_IP_%d.txt", getpid()); + sprintf(ip_filename, ''' \ + '''"C:/Windows/Temp/NGHDL_COMMON_IP_%d.txt", getpid()); ''' else: client_setup_ip += ''' - sprintf(ip_filename, "/tmp/NGHDL_COMMON_IP_%d.txt", getpid()); + sprintf(ip_filename, "/tmp/NGHDL_COMMON_IP_%d.txt",''' \ + ''' getpid()); ''' client_setup_ip += ''' @@ -495,8 +495,8 @@ class ModelGeneration: \t\t\telse if(*key_iter=='1')\n\t\t\t{\n\ \t\t\t\t_op_" + item.split(':')[0] + "[Ii]=ONE;\n\ \t\t\t}\n\t\t\telse\n\t\t\t{\n\ - \t\t\t\tfprintf(log_client,\"Unknown value return from server \\n\");\n\ - \t\t\t\tprintf(\"Client-Unknown value return \\n\");\n\t\t\t}\n\n\ + \t\t\t\tfprintf(log_client,\"Unknown value return from server \\n\");\ + \n\t\t\t\tprintf(\"Client-Unknown value return \\n\");\n\t\t\t}\n\n\ \t\t\tif(ANALYSIS == DC)\n\t\t\t{\n\ \t\t\t\tOUTPUT_STATE(" + item.split(':')[0] + "[Ii]) = _op_" + item.split(':')[0] + "[Ii];\n\ \t\t\t}\n\t\t\telse if(_op_" + item.split(':')[0] + "[Ii] != _op_" + item.split(':')[0] + "_old[Ii])\n\ @@ -555,8 +555,11 @@ class ModelGeneration: self.digital_home = self.parser.get('NGSPICE', 'DIGITAL_MODEL') self.msys_home = self.parser.get('COMPILER', 'MSYS_HOME') cmd_str2 = "\\'start_server.sh %d %s\\'" + "\\" + "\"" - cmd_str1 = os.path.normpath("\"cd " + self.digital_home + "/" + self.fname.split( - '.')[0] + "/DUTghdl/ && " + self.msys_home + "/bash.exe -c ") + cmd_str1 = os.path.normpath( + "\"cd " + self.digital_home + "/" + + self.fname.split('.')[0] + "/DUTghdl/ && " + + self.msys_home + "/bash.exe -c " + ) cmd_str1 = cmd_str1.replace("\\", "/") cfunc.write('\t\tsnprintf(command,1024, "start /min cmd /c ' + '\\' + cmd_str1 + cmd_str2 + ' &", sock_port, my_ip);') @@ -1072,7 +1075,8 @@ class ModelGeneration: if os.name == 'nt': start_server.write("ghdl -e -Wl,ghdlserver.o " + - "-Wl,libws2_32.a " + self.fname.split('.')[0] + "_tb &&\n") + "-Wl,libws2_32.a " + + self.fname.split('.')[0] + "_tb &&\n") start_server.write("./"+self.fname.split('.')[0]+"_tb.exe") else: start_server.write("ghdl -e -Wl,ghdlserver.o " + diff --git a/src/outitf.c b/src/outitf.c index fe60f7a..9b913ae 100644 --- a/src/outitf.c +++ b/src/outitf.c @@ -21,9 +21,9 @@ Modified: 2000 AlansFixes, 2013/2015 patch by Krzysztof Blaszkowski #include "ngspice/ngspice.h" -/*05.June.2020 - BM - Added follwing includes for Windows OS */ +/*05.June.2020 - BM - Added follwing includes for Win OS */ #ifdef _WIN32 - #undef BOOLEAN /* Undefine it due to conflicting definitions in Windows OS */ + #undef BOOLEAN /* Undefine it due to conflicting definitions in Win OS */ #include #include @@ -211,6 +211,7 @@ static void close_server() #ifdef _WIN32 WSACleanup(); #endif + fclose(fptr); remove(ip_filename); } -- cgit