class Example(Frame): def __init__(self): super().__init__() self.initUI() self.manage=Manage() def initUI(self): self.master.title("Simple") self.pack(fill=BOTH, expand=1) butt=Button(self,text="确认",command=self.onclick).pack(side="bottom") self.path=StringVar() entryPath=Entry(self,textvariable=self.path).pack(fill='both',side='top') self.idtext=StringVar() entryId=Entry(self,textvariable=self.idtext).pack() self.idtext.set("input file id") self.newName=StringVar() entryNewName=Entry(self,textvariable=self.newName).pack() self.newName.set('input new name') def onclick(self): print('butt clicked') path=self.path.get() id=self.idtext.get() name=self.newName.get() print(path+'\n'+self.idtext.get()+'\n'+self.newName.get()) self.manage.fileManage(path,id,name)
def __init__(self): self.wordSegmentor = wordSegment() # 生成 分词器 self.sentFilter = sentenceFilter() # 生成 过滤器 self.NLUModel = NLU() # 生成 对话理解器 self.dialogueManager = Manage() # 生成 对话管理器 self.Interactor = InteractWithKB() # 生成 知识交互器 self.answerGenerator = AnswerGenerator() # 生成 回答产生器 self.isFirst = True # 是一轮对话的开始 self.isShow = "0" # 0表示不显示图,1表示显示图
def get_files(): data = request.get_json() status = {"status": "Error", "files": [], "msg": "未知错误"} status_code = 500 if data and token_verify(data["token"]): status["status"] = "Success" status_code = 200 m = Manage(POST_PATH) status["files"] = m.all_file_info() del status["msg"] return jsonify(status), status_code return jsonify(status), status_code
def brick_coin(cls): '''make brick, coin''' flag = 0 for k in BRICK_LIST: POLY.print_poly(k, k.xps, k.yps) if PERSON.xpos == 18 and PERSON.ypos >= 345 and PERSON.ypos <= 347 and flag == 0: PERSON.sym = 'M' try: sound = open('smb_powerup.wav', 'r') os.system('aplay -q ./smb_powerup.wav&') except: pass BRICK_LIST.append(Brick(14, 345, '*', 3)) flag = 1 # print(PERSON.xpos,PERSON.ypos,k.xps,k.yps) if PERSON.xpos == k.xps + 4 and PERSON.ypos >= k.yps and PERSON.ypos <= k.yps + 2: if k.coin != '*' and k.coin != 0: k.coin -= 1 try: sound = open('smb_coin.wav', 'r') os.system('aplay -q ./smb_coin.wav&') except: pass Manage.coinscollect() Manage.changescore('coin') else: try: sound = open('smb_bump.wav', 'r') os.system('aplay -q ./smb_bump.wav&') except: pass if k.coin == 0: BRICK_LIST.remove(k) try: sound = open('smb_breakblock.wav', 'r') os.system('aplay -q ./smb_breakblock.wav&') except: pass Manage.changescore('brick') for k in COIN_LIST: # k.print_coin(k.x,k.y) POLY.print_poly(k, k.xps, k.yps) if PERSON.xpos == k.xps and PERSON.ypos == k.yps: try: sound = open('smb_coin.wav', 'r') os.system('aplay -q ./smb_coin.wav&') except: pass Manage.coinscollect() COIN_LIST.remove(k) Manage.changescore('coin')
def make_flag(cls): '''make end flag''' # FLAG.print_FLAGag(FLAG.x) POLY.print_poly(FLAG, FLAG.xps) if PERSON.ypos == 504: if FLAG.first == 0: try: sound = open('smb_flagpole.wav', 'r') os.system('aplay -q ./smb_flagpole.wav&') except: pass FLAG.first = PERSON.xpos - 1 # print(FLAG.first) # FLAG.move(FLAG.first) POLY.move_poly(FLAG, FLAG.first) Manage.changescore('enemy1')
def set_up(self): for table in self.tables: self.data[table] = [] # 加载汇率 self.val_rates = Manage.val_rate self.rmb_rates = Manage.rmb_rate self.openids = Manage.filter_openid(self.history) # 新用户入库 self.alluser = LoadAllUser(self)
def delete(): data = request.get_json() status = {"status": "Error", "msg": "未知错误"} status_code = 500 if data is None: status["msg"] = "参数错误" status_code = 400 elif {"token", "filename"}.difference(set(data.keys())): status["msg"] = "缺少以下参数:{}".format(", ".join({"token", "filename"}.difference(set(data.keys())))) status_code = 400 elif not token_verify(data["token"]): status["msg"] = "无效token" status_code = 401 else: m = Manage(POST_PATH) s, msg = m.del_file(filename=data["filename"], local_git_path=LOCAL_GIT_PATH) threading.Thread(target=deploy, args=[]).start() if s: status["status"] = "Success" status["msg"] = msg status_code = 200 logger.info(status["msg"]) return jsonify(status), status_code
def __init__(self): wx.Frame.__init__(self, None, -1, "Budget ver. 1.0", size=(1100, 650)) self.Centre(wx.BOTH) panel = wx.Panel(self, -1) notebook = wx.Notebook(panel) notebook.AddPage(Expenses(notebook), "Expenses") notebook.AddPage(Income(notebook), "Income") notebook.AddPage(Transfer(notebook), "Transfer") notebook.AddPage(Accounts(notebook), "Accounts") notebook.AddPage(Analysis(notebook), "Analysis") notebook.AddPage(Manage(notebook), "Manage") sizer = wx.BoxSizer() sizer.Add(notebook, 1, wx.EXPAND) panel.SetSizer(sizer)
def enemy(cls, lgt): '''make enemy bullets''' # for bullets for k in BULLET_LIST: BOARD.mat[k.xps][k.yps] = k.sym if time.time() - k.tym > 0.1: k.tym = time.time() if BOARD.checkstar(k.xps, k.yps + 1) is 1 or k.yps > lgt + 80: BULLET_LIST.remove(k) else: k.yps += k.vel if k.xps >= 22 and k.xps <= 25 and k.yps == BOSS.y and BOSS.Health >= 0: Manage.bosslife() BULLET_LIST.remove(k) BOSS.Health -= 1 if BOSS.Health >= 0: if time.time() - BOSS.bosstime > 1: BOSS.bosstime = time.time() BOSS.x = random.randint(22, 25) BOSS.y = random.randint(460, 470) BOSS_BULLET.append(Bullet(BOSS.x - 2, BOSS.y, -1, BOSS_B)) prob = random.randint(1, 100) if prob < 20: BOSS_BULLET.append(Bullet(BOSS.x - 3, BOSS.y, -1, BOSS_B)) if prob < 10: BOSS_BULLET.append(Bullet(BOSS.x - 1, BOSS.y, -1, BOSS_B)) if prob == 2: BOSS_BULLET.append(Bullet(BOSS.x, BOSS.y, -1, BOSS_B)) if PERSON.xpos <= 25 and PERSON.xpos >= 22 and PERSON.ypos >= BOSS.y \ and PERSON.ypos <= BOSS.y + 5: Manage.changelives() zps = 0 for i, j in CHECKPOINT: if j >= PERSON.ypos and i is not None: PERSON.xpos = CHECKPOINT[zps - 1][0] PERSON.ypos = CHECKPOINT[zps - 1][1] break zps += 1 for k in BOSS_BULLET: if (k.xps >= PERSON.xpos - 1 and k.xps <= PERSON.xpos or k.xps + 1 == PERSON.xpos) and ( k.yps >= PERSON.ypos - 1 and k.yps <= PERSON.ypos): Manage.changelives() BOSS_BULLET.remove(k) for k in BOSS_BULLET: BOARD.mat[k.xps][k.yps] = k.sym if time.time() - k.tym > 0.1: k.tym = time.time() if BOARD.checkstar(k.xps, k.yps - 1) is 1 or k.yps < lgt: BOSS_BULLET.remove(k) else: k.yps += k.vel # BOSS.print_boss(BOSS.x,BOSS.y) POLY.print_poly(BOSS, BOSS.x, BOSS.y) # print(lgt) for k in ELIST: if k.type == "enemy1": flagvar = False if time.time() - k.tym > 0.5: k.tym = time.time() if k.yps >= lgt and k.yps <= lgt + 80: # k.move(None) POLY.move_poly(k) if (PERSON.xpos == k.xps and PERSON.ypos == k.yps): Manage.changelives() flagvar = True zps = 0 for i, j in CHECKPOINT: if j >= PERSON.ypos: PERSON.xpos = CHECKPOINT[zps - 1][0] PERSON.ypos = CHECKPOINT[zps - 1][1] break zps += 1 if PERSON.xpos + \ 1 == k.xps and (PERSON.ypos - 1 == k.yps or PERSON.ypos == k.yps): try: sound = open('smb_stomp.wav', 'r') os.system('aplay -q ./smb_stomp.wav&') except: pass Manage.enemykill() Manage.changescore(k.type) PERSON.xpos -= 2 ELIST.remove(k) if lgt > 100: if PERSON.xpos == k.xps: if k.vel > 0 and PERSON.ypos < k.yps - 4: k.vel = -k.vel if k.vel < 0 and PERSON.ypos > k.yps + 4: k.vel = -k.vel if k.xps == 26: BOARD.mat[k.xps][k.yps] = ' ' ELIST.remove(k) # k.print_enemy(k.xps,k.yps) POLY.print_poly(k, k.xps, k.yps) if flagvar: return PERSON.ypos - 10 if k.type == "enemy2": # TURTLE ENEMY flagvar = False if time.time() - k.tym > 5 and k.sym == ' ': k.tym = time.time() k.sym = '^' k.vel = random.randrange(-1, 2, 2) if k.yps >= lgt and k.yps <= lgt + 80: # k.move() POLY.move_poly(k) if PERSON.xpos == k.xps and PERSON.ypos + \ 1 == k.yps and k.sym == ' ' and k.vel == 0: try: sound = open('smb_kick.wav', 'r') os.system('aplay -q ./smb_kick.wav&') except: pass k.vel = 1 if PERSON.xpos == k.xps and PERSON.ypos - \ 2 == k.yps and k.sym == ' ' and k.vel == 0: try: sound = open('smb_kick.wav', 'r') os.system('aplay -q ./smb_kick.wav&') except: pass k.vel = -1 # enemy-enemy collision if k.sym == ' ' and k.vel != 0 and time.time() - k.tym > 0.1: k.tym = time.time() if k.yps >= lgt and k.yps <= lgt + 80: POLY.move_poly(k) for enmy in ELIST: if (enmy.xps == k.xps and enmy.yps == k.yps and k != enmy): try: sound = open('smb_stomp.wav', 'r') os.system('aplay -q ./smb_stomp.wav&') except: pass Manage.enemykill() Manage.changescore(enmy.type) ELIST.remove(enmy) if time.time() - k.tym > 0.5 and k.sym == '^': k.tym = time.time() if k.yps >= lgt and k.yps <= lgt + 80: POLY.move_poly(k) if (PERSON.xpos == k.xps and (PERSON.ypos == k.yps or PERSON.ypos - 1 == k.yps) and k.vel != 0): Manage.changelives() flagvar = True zps = 0 for i, j in CHECKPOINT: if j >= PERSON.ypos: PERSON.xpos = CHECKPOINT[zps - 1][0] PERSON.ypos = CHECKPOINT[zps - 1][1] break zps += 1 if (PERSON.xpos + 2 == k.xps and (PERSON.ypos == k.yps or PERSON.ypos - 1 == k.yps) and k.sym == '^'): k.sym = ' ' k.tym = time.time() PERSON.xpos -= 2 k.vel = 0 if (PERSON.xpos + 1 == k.xps and (PERSON.ypos == k.yps or PERSON.ypos - 1 == k.yps) and k.sym == ' '): try: sound = open('smb_stomp.wav', 'r') os.system('aplay -q ./smb_stomp.wav&') except: pass Manage.enemykill() Manage.changescore(k.type) PERSON.xpos -= 2 ELIST.remove(k) if lgt > 100: if PERSON.xpos == k.xps and k.sym == '^': if k.vel > 0 and PERSON.ypos < k.yps - 4: k.vel = -k.vel if k.vel < 0 and PERSON.ypos > k.yps + 4: k.vel = -k.vel if k.xps == 26: BOARD.mat[k.xps][k.yps] = ' ' ELIST.remove(k) # k.print_enemy(k.xps,k.yps,k.sym) POLY.print_poly(k, k.xps, k.yps) if flagvar: return PERSON.ypos - 10 return lgt
def manage_basico(self): m = Manage('www.google.com.ar'); m.manage_inicial();
def run_manage(): source_type = "mysql" Manage.run_from_muiltiprocess(source_type)
from manage import Manage from person import Person class Deportament: def __init__(self, *args): self.args = args def showAll(self): for obj in self.args: print(obj) def giveRaise(self, procent): for obj in self.args: obj.giveraise(procent) if __name__ == "__main__": d1 = Person('Nikita Didenko', 'Developers', 3000) d2 = Person('Andrey Didenko', 'Developers', 300) d3 = Person('Elena Didenko', 'Developers', 200) d4 = Manage('Katy Didenko', 100) my_Family = Deportament(d1, d2, d3, d4) my_Family.giveRaise(10) my_Family.showAll()
from flask import Flask, Response, render_template, request, session, url_for, redirect, send_from_directory from manage import Manage import json, os, time, sys from conf import * from result_transform import transform_result ServerManage = Manage(file_config, sql_config) app = Flask(app_config["app_name"], template_folder=app_config["template_path"], static_folder=app_config["static_path"]) app.config["ALLOWED_IMGS "] = set(app_config["img_type"]) app.config["ALLOWED_VIDEOS "] = set(app_config["video_type"]) app.config['SECRET_KEY'] = os.urandom(24) app.config['MIN_CONTENT_LENGTH'] = 1024 sys.path.insert(0, app_config["root_path"]) ############################################################### ############################################################### # 验证文件格式 def allowed_img(filename): if "." in filename: L = filename.split(".") n = len(L) if L[n - 1] in app.config["ALLOWED_IMGS "]: return True return False def allowed_video(filename): if "." in filename:
def __init__(self): super().__init__() self.initUI() self.manage=Manage()
''' The Bomb Class The bomb class does not inherit any other class, it creates a bomb, keeps count of bombs and their positions, explosion, and then clears that explosion. ''' from check import checkboard from board import Board from enemy import Enemy from manage import Manage # An instance of manage to keep # count of time, score and lives. MANAGEINSTANCE = Manage() class Bomb: '''Bomb class has all bomb functions.''' # Arrays for x,y coordinates of Bombs Bomba = [] Bombb = [] # the explosion function to explode bombs. # Dealt individually for 4 positions around a coordinate. def explosion(self, alpha, beta): '''Deals with explosion of bomb''' # For the oroginal position. for j in range(0, 4): Board.board[(beta + 1) * 2][(alpha + 1) * 4 + j] = 'e'
class dialogServer(object): def __init__(self): self.wordSegmentor = wordSegment() # 生成 分词器 self.sentFilter = sentenceFilter() # 生成 过滤器 self.NLUModel = NLU() # 生成 对话理解器 self.dialogueManager = Manage() # 生成 对话管理器 self.Interactor = InteractWithKB() # 生成 知识交互器 self.answerGenerator = AnswerGenerator() # 生成 回答产生器 self.isFirst = True # 是一轮对话的开始 self.isShow = "0" # 0表示不显示图,1表示显示图 def setIsShow(self, intent): if intent == "query_location": self.isShow = "1" else: self.isShow = "0" def dialogComplete(self): pass # 这里是 对话完成后,将一些状态置0 def processSentecne(self, input_x): sentCuted = self.wordSegmentor.cut_sentence(input_x) # 分词 self.sentFilter.filtSent(sentCuted) # 过滤器处理句子 if self.wordSegmentor.hasSentence == True: # 保证有内容 # 过滤器先放上吧 # if self.sentFilter.state == True: if True == True: # 说明是任务相关的句子 sentence, intent, slot = self.NLUModel.nluSentence( sentCuted) # 理解句子 if self.isFirst == True: # 表明是新一轮开始 self.strCode = self.dialogueManager.firstmanage( intent, slot, sentence) if self.dialogueManager.state == 2: # 只有是完成状态才会产生答案 ans = self.Interactor.information_to_answer( sentence, self.dialogueManager.intentHold, self.dialogueManager.slotStrHold, self.dialogueManager.slotDictHold) input_x = self.dialogueManager.newSentence() answerSentence = self.answerGenerator.generateAnswer( input_x, ans, self.dialogueManager.intentHold, self.dialogueManager.slotStrHold) # 这里应该有归零操作,将一些状态置为初始状态,可是是哪些状态置0呢???值得思考 self.isFirst = True self.setIsShow(self.dialogueManager.intentHold) return answerSentence elif self.dialogueManager.state == 1: # 开启多轮对话状态 querySentence = self.dialogueManager.querySentence( intent, self.strCode) # 产生问句 self.isFirst = False self.isShow = "0" return querySentence elif self.dialogueManager.state == 3: # 处于多轮对话中 print("3333slot", slot) print("33333sentence", sentence) self.dialogueManager.informationFuse( self.dialogueManager.intentHold, slot, sentence) # 将新旧信息融合 # strCode = dialogueManager.calState(intent,dialogueManager.slotStrHold) self.dialogueManager.str2State( self.dialogueManager.intentHold, self.dialogueManager.slotStrHold) # 改变对话管理器状态 self.dialogueManager.buildSlotDict( self.dialogueManager.intentHold, slot, sentence) if self.dialogueManager.state != 2: print("不等于2222 ", self.dialogueManager.state) querySentence = self.dialogueManager.querySentence( self.dialogueManager.intentHold, self.dialogueManager.slotStrHold) # 产生问句 self.isFirst = False self.isShow = "0" return querySentence else: # 完成状态 print("这里!!!!!") ans = self.Interactor.information_to_answer( sentence, self.dialogueManager.intentHold, self.dialogueManager.slotStrHold, self.dialogueManager.slotDictHold) input_x = self.dialogueManager.newSentence() print("完成状态", self.dialogueManager.slotStrHold) answerSentence = self.answerGenerator.generateAnswer( input_x, ans, self.dialogueManager.intentHold, self.dialogueManager.slotStrHold) print("self.dialogueManager.answerState", self.dialogueManager.answerState) print("完成状态", answerSentence) self.isFirst = True self.setIsShow(self.dialogueManager.intentHold) return answerSentence else: return "您说的句子我暂时无法处理,请点击结束对话,将问题汇报给管理员" else: return "请输入内容"
from flask import Flask, render_template import data from manage import Manage manage = Manage() app = Flask(__name__) @app.context_processor def inject_stage_and_region(): return dict(departures=data.departures) @app.route('/') @app.route('/index') def index(): return render_template('index.html', tours=data.tours) @app.route('/from/<direction>') def direction(direction): return render_template('direction.html', departure=manage.depart_city(direction), direction=direction) @app.route('/tour/<id>') def tour(id): return render_template('tour.html', tour=data.tours.get(int(id)))
'''main mario file''' import os from polymorph import POLY from board import BOARD from scene import Scene from person import PERSON, CHECKPOINT from manage import Manage SCENE = Scene() M = Manage() i = 0 MID = 0 TIMER = 0 os.system('aplay -q ./mario-theme.wav&') while i <= BOARD.width - 80: if PERSON.xpos == 25 and PERSON.ypos == 504: break os.system("clear") M.printhead() SCENE.make_cm(i) SCENE.make_pps() SCENE.brick_coin() SCENE.moving_bar() SCENE.make_flag() i = SCENE.enemy(i) # PERSON.print_mario(PERSON.xpos,PERSON.ypos) POLY.print_poly(PERSON, PERSON.xpos, PERSON.ypos) # BOARD.print_board(i,i+80) POLY.print_poly(BOARD, i, i + 80) # PERSON.move(i) POLY.move_poly(PERSON, i)
from deportament import Deportament from manage import Manage from person import Person bob = Person('Bob Smit', 'dev', 3000) lot = Person('Lot Smit', 'dev', 3000) gut = Manage('Gut Smit', 300) develop = Deportament(bob, lot, gut) import shelve db = shelve.open('Person_Develop') for obj in bob, lot, gut: db[obj.name] = obj db.close() if __name__ == "__main__": db = shelve.open('Person_Develop') print(db['Bob Smit']) def vglub(element, count=3): print('.' * count, element) count += 3 for key in element.__bases__: vglub(key, count)
def rebuild(): manage = Manage(app) manage.reset_local_persistence() manage.build_clean_persistence() manage.populate_persistence()
import click from flask import Flask import random import utils import models import actions from manage import Manage import logging from datetime import datetime app = Flask(__name__) manage = Manage(app) if not manage.check_persistence_exists(): manage.build_clean_persistence() manage.populate_persistence() ### NON OPEN ACTIVE BOOKING API ENDPOINT ### @app.route("/", methods=["GET"]) def index(): return utils.error_response('nothing_to_see_here') ### OPEN ACTIVE BOOKING API ENDPOINTS ### ### GET functions ###
import csv, datetime from manage import Manage as mng # reader = mng.getData('https://bx.in.th/api/')['1'] # print(reader) BTC = mng.getData('https://bx.in.th/api/')['1'] lastPrice = float(BTC['last_price']) with open('wallet.csv') as csvfile: reader = list(csv.reader(csvfile)) print('youy credits: {:,} {}'.format(float(reader[3][1]), reader[3][0])) buy = input('how much BTC you want to but?: ') print('connecting...') if float(buy) <= float(reader[3][1]): t = datetime.datetime.now().strftime('%H:%M:%S') reader[3][1] = float(reader[3][1]) - float(buy) reader[4][1] = float(buy) / lastPrice reader[0][1] = t print('your credits: {:,} {}'.format(float(reader[3][1]), reader[3][0])) print('you are received: {:,} {}'.format(float(reader[4][1]), reader[4][0])) else: print('not enough credit or wrong input!') print(reader)
def main(): wordSegmentor = wordSegment() # 生成 分词器 sentFilter = sentenceFilter() # 生成 过滤器 NLUModel = NLU() # 生成 对话理解器 dialogueManager = Manage() # 生成 对话管理器 Interactor = InteractWithKB() # 生成 知识交互器 answerGenerator = AnswerGenerator() # 生成 回答产生器 # input_x = "刘通是谁的学生" # input_x = "介绍一下邓华老师" # input_x = "邓华老师的研究方向是什么" input_x = "介绍一下机电工程学院" i = 0 # data = loadFile() print() print("输入的句子是",input_x) sentCuted = wordSegmentor.cut_sentence(input_x) # sentFilter.filtSent(sentCuted) # 先不加过滤器 # try: if wordSegmentor.hasSentence == True: # 保证有内容 if True == True: # 保证是任务相关的句子 i+=1 print("这是第",i,"句话") # input_x = "王老师的办公室在哪" # input_x = "王恒升老师的办公室在哪" # intent = "query_location" # slot = ["first_name","teacher","o","room","o","o"] # slot = ["name","teacher","o","room","o","o"] # sentence = ["王","老师","的","办公室","在","哪里"] # sentence = ["王恒升","老师","的","办公室","在","哪里"] # sentFilter.filtSent(sentCuted) # print("sentCuted",sentCuted) sentence,intent,slot = NLUModel.nluSentence(sentCuted) print("intent = ",intent) strCode = dialogueManager.firstmanage(intent,slot,sentence) # print("strCode",strCode) for _ in range(5): if dialogueManager.state == 2: # 只有是完成状态才会产生答案 print("-----单轮对话----") # print("strCode",strCode) print("sentence",sentence) print("dialogueManager.intentHold",dialogueManager.intentHold) print("dialogueManager.slotStrHold",dialogueManager.slotStrHold) print("dialogueManager.slotDictHold",dialogueManager.slotDictHold) ans = Interactor.information_to_answer(sentence, dialogueManager.intentHold, dialogueManager.slotStrHold, dialogueManager.slotDictHold) # print("myManager.state",dialogueManager.state) # print("Interactor.interactState",Interactor.interactState) print("ans",ans) input_x = dialogueManager.newSentence() print("newSentence",input_x) answerSentence = answerGenerator.generateAnswer(input_x,ans,intent,dialogueManager.answerState) print("answerSentence",answerSentence) print("----- 单轮结束-------") print() elif dialogueManager.state == 1: # 开启多轮对话 print("----开启多轮对话----") querySentence = dialogueManager.querySentence(intent,strCode) # 产生问句 print("querySentence",querySentence) elif dialogueManager.state == 3: # 处于多轮对话中 print("-----处于多轮对话中-----") # intent_new = "query_location" # slot_new = ["name"] # sentence_new = ["王恒升"] # input_x = "询问一个老师的办公室" input_x = input("请输入句子:--- ") print("dialogueManager.slotStrHold",dialogueManager.slotStrHold) sentCuted = wordSegmentor.cut_sentence(input_x) sentence_new,intent_new,slot_new = NLUModel.nluSentence(sentCuted) print("intent_new",intent_new) dialogueManager.informationFuse(dialogueManager.intentHold,slot_new,sentence_new) # 将新旧信息融合 # strCode = dialogueManager.calState(intent,dialogueManager.slotStrHold) dialogueManager.str2State(dialogueManager.intentHold,dialogueManager.slotStrHold) # 确定对话管理器状态 dialogueManager.buildSlotDict(dialogueManager.intentHold,slot_new,sentence_new) print("ialogueManager.state==3",dialogueManager.state) # 不一定产生问句啊,有可能是完成状态,就不需要产生问句了 if dialogueManager.state==3: print("sentence_new333 ",sentence_new) print("dialogueManager.slotStrHold333 ",dialogueManager.slotStrHold) querySentence = dialogueManager.querySentence(dialogueManager.intentHold,dialogueManager.slotStrHold) # 产生问句 print("querySentence333 ",querySentence) print("---------多轮对话中(结束)---------------------------------") else: print("您的请求不在本系统支持范围内") else: print("请输入内容")
def main(): try: manage = Manage() manage.start() except Exception as e: print('pool run error.', e)
''' The run file # Instances of classes created here # for running the application.''' import os from bomberman import Bomberman from manage import Manage # TEST is an object of Bomberman TEST = Bomberman() # TEST1 is an object of Manage TEST1 = Manage() # the initial Welcome Print. print("") print("Welcome, to this rendition of Bomberman!") print("") print("Press 'Enter' to start playing.") TAKENINPUT = input() # This generates bricks on the board TEST.generatebricks() # This generates enemies on the board TEST.generateenemies() # This generates the bomberman TEST.generatebomberman() i = 0 while True: os.system("tput reset")
# -*- encoding:gbk -*- from process.video_process import VideoProcess from process.image_process import ImageProcess from model.face_recognize_easy import EasyDist from model.face_recognize_sgd import SgdDist import numpy,os,json,time from multiprocessing import Process,Manager,Lock,Pool,freeze_support from manage import Manage from conf import * ServerManage = Manage(file_config,sql_config) global Model,Ip,Vp hist = compute_config["hist"] process_num = compute_config["process_num"] Model = SgdDist(model_config["recognize_model_path"]) Ip = ImageProcess( face_detect_filename=model_config["face_detect_path"], face_vec_filename=model_config["face_vec_path"] ) Vp = VideoProcess(model_config["ffmpge_path"]) url = "%s:%d"%(app_config["host"],app_config["port"]) +"/imgs/result?t=%s&hist=%s&videoname=%s" def get_feature_spark(imgs_path,hist,feature_path): command = "spark-submit %s %s %s %s"%(model_config["spark_model_path"], imgs_path, hist, feature_path ) os.popen(command)
import json, csv, os, requests import datetime, time from manage import Manage as mng kw = ['secondary_currency', 'last_price', 'change'] r = mng.getData('https://bx.in.th/api/') BTC = r['1'] previous = float(BTC[kw[1]]) reader = mng.checkWallet('wallet.csv') print('-----------------------------') text = 'initialize' for i in range(10): text = text + '.' print(text, end='\r') time.sleep(0.5) while True: BTC = mng.getData('https://bx.in.th/api/')['1'] #print('-----------------------------') t = datetime.datetime.now().strftime('%H:%M:%S') #for i in r.items(): #print('time: {} | {} | last price : {:.2f} | change: {}%'.format(t, i[1][kw[0]], i[1][kw[1]], i[1][kw[2]])) print('-----------------------------') #print('time: {} | {} | last price : {:.2f} | change: {}%'.format(t, BTC[kw[0]], BTC[kw[1]], BTC[kw[2]]), end='\r') print('time: {} | {} | last price : {:.2f} | change: {}%'.format( t, BTC[kw[0]], BTC[kw[1]], BTC[kw[2]])) print('-----------------------------') if float(BTC[kw[1]]) > previous: print('price up!') elif float(BTC[kw[1]]) == previous: print('same!')