def init_ui(self): # Sending mainWindow obj to initialize components # No need to store the objs because they're just init helper # Use parent-child relationship to access between classes self.menu = menu.menu(self) tool.tool(self) status.status(self) self.central = central.central(self)
def mainMenu1(): save = scripts.savePull() var1 = save[0] var6 = save[5] scripts.screenClear() scripts.versionHeader() scripts.invDisplay() if var6 == 0: print( textwrap.fill( 'You are Liam. An astronaut by trade, you took a bad turn on the Space Belt and landed on a strange planet. You awaken, laying in a field of grass. You see hills, a cave, and strange flora.', 75)) if var6 == 1: print( textwrap.fill( "You're covered in the blood of the innocent reptilian man that you killed. The sky rumbles.", 75)) print('\nHILL [1]') print('CAVE [2]') print('TOOL [3]') if var1 == 0: print('QUIT [4]') if var1 == 1: print('SOUND [4] <--') if var1 == 1: print('QUIT [5]') while True: try: choose = int(input('\nACTION >> ')) if choose == 1: hill.hill() if choose == 2: cave.cave() if choose == 3: tool.tool() if choose == 4: if var1 == 0: scripts.quitHandler() if var1 == 1: ch1end.ch1End() if choose == 5: if var1 == 1: scripts.quitHandler() if var1 == 0: scripts.inpErrorHandler() if choose > 5 or choose < 0: scripts.inpErrorHandler() mainMenu1() except ValueError: scripts.inpErrorHandler() mainMenu1()
def setUp(self, islocal=0): self.api = API2(islocal) self.t = tool() self.login_param, self.deviceid = runconfig.RunConfig().get_login( islocal) self.t.get_login_header(self.api, self.deviceid, self.login_param) self.ecode = errorCodeConst()
def __init__(self, islocal=0): self.api = API2(islocal) self.casedb = DBManual() self.t = tool() self.login_param, self.deviceid = runconfig.RunConfig().get_login( islocal) self.t.get_login_header(self.api, self.deviceId, self.login_param) self.sql = """update login_case set args=%s, response=%s,result=%s,test_time=%s WHERE case_no = %s"""
def __init__(self, islocal=0): self.api = API2(islocal) self.casedb = DBManual() # self.sql = """update user_interactive_case set args=%s,response=%s,result=%s,test_time=%s WHERE case_no = %s""" self.t = tool() self.login_param, self.deviceid = runconfig.RunConfig().get_login(islocal) self.ecode = errorCodeConst() self.pwd = base64.b64encode("888888")
def __init__(self, islocal=0): self.api = API2(islocal) self.casedb = DBManual(islocal) self.sql = """update user_case set args=%s, response= %s,result= %s,test_time= %s WHERE case_no = %s""" self.t = tool() # self.deviceid = "c37c6b3c-10cc-411d-abfe-200135522e6d" self.login_param, self.deviceid = runconfig.RunConfig().get_login( islocal) self.t.get_login_header(self.api, self.deviceid, self.login_param) self.ecode = errorCodeConst()
def getContent(self, pageCode): # 匹配当前所在页内的内容 pattern = re.compile('<div id="post_content_.*?>(.*?)</div>') # 得到与之匹配的内容 items = re.findall(pattern, pageCode) # 循环输出所得的内容 for item in items: result = tool().change(item) print(result) # 在文件中写入爬取下的内容 self.file.write(result)
def __init__(self, islocal=0): self.api = API2(islocal) self.casedb = DBManual() self.sql = """update other_case set args=%s,response=%s,result=%s,test_time=%s WHERE case_no = %s""" self.t = tool() self.login_param, self.deviceid = runconfig.RunConfig().get_login(islocal) self.login_param2 = { "phoneNumber": "18782943852", "password": "******", "platform": "iOS", "clientVersion": "2.0", "machineId": 100001 } self.t.get_login_header(self.api, self.deviceid, self.login_param) self.ecode = errorCodeConst()
def __init__(self): # folder Path self.folderPath = None # logFilePath self.logFilePath = None # tool self.tool = tool.tool() # code Number self.codeNumber = None # Initialization folder # 解压文件的路径 self.decompression_file_path = None # file path list self.pathList = [] # code file all lines self.code_all_lines = 0 # code file type self.codeFileTypeList = ["html", "css", "js", "py", "php"] self.ignorefile = [ "txt", ] self.decompression_E = ['zip', 'tar'] self.emptydir = []
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis import tool as tool import numpy as np from sklearn.externals import joblib SIZE = 828 IMAGE_SIZE = 224 NUM_CHANNEL = 1 LABEL = 6 BASE_DIVIDE = 128 ACCELERATION_FACTOR = 256 FEATURE = 5 FILENAME = "/home/elvis/work/ML/tensorflow/separa/lda_svm.txt" util = tool.tool() data, label = tool.parse_data(SIZE, IMAGE_SIZE, NUM_CHANNEL, LABEL) data, label = tool.alignment_data(data=data, label=label, LABEL=LABEL, BASE_DIVIDE=BASE_DIVIDE) data = tool.min_max_normalization(data) np.set_printoptions(threshold='nan') label = np.argmax(label, 1) SIZE = label.shape[0] data = np.reshape(data, [SIZE, data.shape[1]**2]) TRAIN_SIZE = SIZE - ACCELERATION_FACTOR EVAL_SIZE = SIZE - TRAIN_SIZE train_data, train_label, eval_data, eval_label = tool.random_sample(data, label, ACCELERATION_FACTOR, LABEL)
# coding=UTF-8 import numpy as np from tool import tool if __name__ == '__main__': # hmw1 tool = tool() x = np.array([[0.707, 0.707], [0, 1], [-0.643, 0.766], [-1, 0], [-0.707, -0.707]]) # w1=[1,0],w2=[0,-1] w = np.array([[1., 0.], [0., -1.]]) # 这种形式采用矩阵内积 tool.iteration = 0 tool.dot1 = (0, 0.6) # 描述学习率函数 # 归一化 input_nor = np.empty(shape=(0, len(x[0]))) for i in range(len(x)): input_nor = np.append(input_nor, [tool.Normalize(x[i])], axis=0) w_nor = np.empty(shape=(0, len(w))) for i in range(len(w[0])): w_nor = np.append(w_nor, [tool.Normalize(w[i])], axis=0) for i in range(len(x)): dis = tool.Euclidean(input_nor[i], w_nor) data, inde = tool.find_winner(dis) w[inde] = tool.WTA(x[i], w[inde], 0, 0) print(w)
def __init__(self): self.app_root = os.path.dirname(__file__) self.templates_root = os.path.join(self.app_root, 'templates') self.render = web.template.render(self.templates_root) self.tool = tool.tool() self.db = database.database()
MixerChannel(mapping="chrome", midi={ 2: "level", 50: "mute", 34: "solo", }), MixerChannel(mapping="edge", midi={ 2: "level", 50: "mute", 34: "solo", }), MixerChannel(mapping="spotify", midi={ 3: "level", 51: "mute", 35: "solo", }), MixerChannel(mapping="discord", midi={ 7: "level", 55: "mute", 39: "solo", }), MixerChannel(mapping="media_play_pause", midi={41: "keyboard"}), MixerChannel(mapping="media_previous", midi={43: "keyboard"}), MixerChannel(mapping="media_next", midi={44: "keyboard"}), ] tool(channels)
import tool import re,requests tool=tool.tool() # bugku-秋名山老司机 # url='http://123.206.87.240:8002/qiumingshan/' # tool=tool.tool() # for i in range(5): # data=tool.get_webs(url,True) # data={ # 'value':eval(re.findall('([0-9\+\-\*\/]+)=',data)[0]) # } # _=tool.get_post(url,'post',data,True) # print(_) # bugku-速度要快 # url='http://123.206.87.240:8002/web6/' # tool=tool.tool() # for i in range(2): # data=tool.bm_base64_decode(tool.get_webs(url,True).headers['flag']) # data=re.findall(': ([0-9A-Za-z\=]+)',str(data))[0] # data=tool.bm_base64_decode(data)[2] # data={ # 'margin':data # } # data=tool.get_post(url,'post',data,True) # print(data)
def __init__(self, islocal=0): self.api = API2(islocal) self.casedb = DBManual() self.t = tool() self.sql = """update register_case set response=%s,result=%s,test_time=%s WHERE case_no = %s"""