def _test_remote(): pdb.set_trace() # Set up debug. verbosity = 1 error_queue = Queue.Queue() debug_queue = Queue.Queue() debugger = debug.Debug(verbosity, debug_queue, error_queue) # Set up remote. remote = Remote(debug_queue, error_queue) # Grab the initial remote data so we know it is initialized. while True: try: time.sleep(0.1) remote_input = remote.get_input() print(remote_input) except Queue.Empty: pass try: debugger.debug() except debug.Error as e: e.print_error() except KeyboardInterrupt: sys.exit(0)
def __init__(self, fullpath): self.dbg = debug.Debug() self.comm = common.Common() self.recordfile = fullpath self.user_id_list = [] self.user_id_list_commit_idx = 0 self.setpath(fullpath)
def _test_controller(): pdb.set_trace() # Set up debug. verbosity = 1 error_queue = Queue.Queue() debug_queue = Queue.Queue() debugger = debug.Debug(verbosity, debug_queue, error_queue) # Set up controller controller = Controller(debug_queue, error_queue) cmd_default = { 'X': 0.0, 'Y': 0.0, 'R': 0.0, 'C': 0, 'T': False, 'L': False, 'S': False } cmd = cmd_default.copy() cmd['T'] = True cmd_json = json.dumps(cmd) cmd_queue.put(cmd_json) time.sleep(2) cmd = cmd_default.copy() cmd['L'] = True cmd_json = json.dumps(cmd) cmd_queue.put(cmd_json)
def _test_get_image(): # Set up debug. verbosity = 1 error_queue = Queue.Queue() debug_queue = Queue.Queue() debugger = debug.Debug(verbosity, debug_queue, error_queue) # Make sure the images look right. image_queue = Queue.Queue(maxsize=1) camera_address = 'tcp://192.168.1.1:5555' camera = Camera(debug_queue, error_queue, camera_address, image_queue) camera.daemon = True camera.start() try: i = 0 while True: debugger.debug() image = image_queue.get(block=True) cv2.imshow('image', image) key = cv2.waitKey(1) & 0xff if key == ord('q'): break elif key == ord('s'): cv2.imwrite('image_%s.png' % str(i), image) i += 1 debugger.debug() except debug.Error as e: e.print_error() except KeyboardInterrupt: sys.exit(0)
def __init__(self, max_steps=1000000, thread=None): """Initalizes new Interpreter.""" self.current_pixel = None self.dp = 0 self.cc = 0 self.switch_cc = True self.step = 0 #0 for just moved into color block, 1 for moved to edge self.times_stopped = 0 self.max_steps = max_steps self.current_step = 0 self.stack = [] self.color_blocks = {} self.finished = False self.thread = thread self.debug = debug.Debug(False) #Indexed by hue and light change self.operations = { (1, 0): ("Add", self.op_add), (2, 0): ("Divide", self.op_divide), (3, 0): ("Greater", self.op_greater), (4, 0): ("Duplicate", self.op_duplicate), (5, 0): ("IN(char)", self.op_in_char), (0, 1): ("Push", self.op_push), (1, 1): ("Subtract", self.op_subtract), (2, 1): ("Mod", self.op_mod), (3, 1): ("Pointer", self.op_pointer), (4, 1): ("Roll", self.op_roll), (5, 1): ("OUT(Number)", self.op_out_number), (0, 2): ("Pop", self.op_pop), (1, 2): ("Multiply", self.op_multiply), (2, 2): ("Not", self.op_not), (3, 2): ("Switch", self.op_switch), (4, 2): ("IN(Number)", self.op_in_number), (5, 2): ("OUT(Char)", self.op_out_char), }
def __init__(self, webster, viewport_num=2): #local variables self.tier = 1 self.debug = bug.Debug() self.webster = webster self.web = w.Web(tier=self.tier, webster=self.webster, debug=self.debug)
def __init__(self, ident): self.dbg = debug.Debug() self.com = common.Common() self.gbl = common_var self.ident = ident new_name = re.sub(r'[^0-9A-Za-z]', '_', ident) self.uixml = "ui_" + str(new_name) + ".xml" #ui控件文件名称 self.adbpath = self.gbl.path_adb #adb软件路径 self.uixml_tmp = os.path.join(self.gbl.path_tmp, self.uixml) #ui控件全路径 self.uixml_tmp2 = "/sdcard/" + self.uixml #终端里的 ui控件全路径 self.dy_packet = "com.ss.android.ugc.aweme" #抖音包名称 self.dy_activity = ".splash.SplashActivity" #抖音active名称(软件启动时使用)
def __init__(self): self.ClassDebug = debug.Debug() self.Debug = self.ClassDebug.Debug self.Debug('INFO', 'Initiate') self.LogicTest = 0 self.HandleCFG = handleCFG.HandleCFG(self) self.ClassDebug.SetFile(self.Config['General']['FileDebugLog']) self.SpringUnitsync = springUnitsync.SpringUnitsync(self) self.HandleDB = handleDB.HandleDB(self) self.Hosts = {} self.Start()
def __init__(self, args): self.gui = args.gui self.verbosity = args.verbosity self.debug_queue = Queue.Queue() self.error_queue = Queue.Queue() self.debugger = debug.Debug(self.verbosity, self.debug_queue, self.error_queue) if args.command == 'train': self.train(args) elif args.command == 'test': self.test(args) elif args.command == 'exec': self.execute(args) elif args.command == 'annotate': self.annotate(args)
def __init__(self): super(Server, self).__init__('server.pid') self.ClassDebug = debug.Debug() self.Debug = self.ClassDebug.Debug self.Debug("Initiate") self.LoadCFG = loadCFG.LoadCFG(self) try: self.Unitsync = __import__('pyunitsync') except: import unitsync self.Unitsync = unitsync.Unitsync(self.Config['UnitsyncPath']) self.Unitsync.Init(True, 1) self.LoadMaps() self.LoadMods() self.Master = master.Master(self) self.Hosts = {}
def run(self): """运行Python脚本""" # 把运行键停用,避免多次运行 self.A_run.setEnabled(False) self.msg('') self.repaint() self.textEdit.setText('') error = '' self.debuger = debug.Debug(self.os, self.textEdit, self.tmp, self.statusBar) # 建立临时文件夹作为工作目录 if not Path(self.tmp).is_dir(): os.mkdir(self.tmp) if self.file_name == '': # 如果是作为临时文件运行 temp_file = open(tempfile.mktemp(dir=self.tmp, suffix='.py'), encoding='UTF-8', mode='w') temp_file.write(self.editor.text()) temp_file.close() error = self.debuger.start(temp_file.name) os.remove(temp_file.name) else: # 如果是打开的文件,那么运行之前会保存一遍 self.save_file() error = self.debuger.start(self.file_name) self.add_log('调试完毕!') self.statusBar.showMessage('调试完毕!', 2000) if error: self.add_log(error) self.statusBar.showMessage('运行出错!', 2000) # 调出输出栏 if not self.A_info_bar.isChecked(): self.dockWidget.setVisible(True) self.A_info_bar.toggle() self.dockWidget.repaint() self.A_run.setEnabled(True)
def _test_receiver(): pdb.set_trace() # Set up debug. verbosity = 1 error_queue = Queue.Queue() debug_queue = Queue.Queue() debugger = debug.Debug(verbosity, debug_queue, error_queue) # Set up receiver. receiver = Receiver(debug_queue, error_queue) try: while True: debugger.debug() navdata = receiver.get_navdata() pprint.pprint(navdata) except debug.Error as e: e.print_error() except KeyboardInterrupt: sys.exit(0)
def __init__(self, terminal_name): self.terminal_name = terminal_name self.gbl = common_var self.com = common.Common() self.status = self.gbl.SS_IDLE self.dbg = debug.Debug() self.adb = AdbDyCtrl(terminal_name) self.xaf = xml_sax.xml_attrs_finder() self.gaxis = self.gbl.get_axis(terminal_name) self.dbg.printlog("trace", self.gaxis) log_fullpath = os.path.join(self.gbl.log_path, self.format_name(terminal_name) + '.log') self.dbg.printlog("trace", log_fullpath) self.log = douyin_log.class_store_log(log_fullpath) #环境信息 evironment = { "status": self.gbl.SS_IDLE, #当前状态 "page": self.gbl.PAGE_FCS, #当前页 "action": "initiong", #当前行为描述 "vedio": "000", #当前操作的视频id "user": "******", #当前操作的用户 "max": -1 } #坐标信息 self.vdoaxis = { "vdo_search_axis": [], #焦点页视频搜索搜索关键字和坐标 "vdo_first_axis": [], #第一个视频 "vdo_main_axis": [], #主视频区坐标, 开始和暂停 "vdo_stop_axis": [], #主视频区坐标, 开始和暂停 "vdo_comment_axis": [], #评论按钮 "vdo_cmmt_content_axis": [], #评论区坐标 "vdo_cmmt_user_axis": [], #评论窗口用户头像坐标列表 "vdo_cmmt_vdo_axis": [], #评论页的视频页 "vdo_user_more_axis": [], #用户页更多 "vdo_user_back_to_cmmt_axis": [], #用户信息主页返回 "vdo_user_info_back_axis": [], #用户信息发送页返回 "vdo_user_sendkey_axis": [], #用户页发送私信按钮 "vdo_user_sendcont_axis": [], #用户页发送私信消息框 "vdo_user_send_axis": [], #用户页发送私信发送按钮 }
def _initDebugger(self, debugFlags): if not debugFlags: debugFlags = [] self._debug = debug.Debug(debugFlags, showFlags=False) self.printf = self._debug.show self.debugFlags = self._debug.debugFlags if debugFlags: self._debug.colors["auth"] = debug.colorYellow self._debug.colors["bind"] = debug.colorBrown self._debug.colors["dispatcher"] = debug.colorGreen self._debug.colors["roster"] = debug.colorMagenta self._debug.colors["socket"] = debug.colorBrightRed self._debug.colors["tls"] = debug.colorBrightRed self._debug.colors["ok"] = debug.colorBrightCyan self._debug.colors["got"] = debug.colorBlue self._debug.colors["sent"] = debug.colorBrown self._debug.colors["stop"] = debug.colorDarkGray self._debug.colors["warn"] = debug.colorYellow self._debug.colors["error"] = debug.colorRed self._debug.colors["start"] = debug.colorDarkGray
def __init__(self, tier, desktop): #set variables self.desktop = desktop self.width, self.height = self.get_window_dimensions() self.useragent = self.get_user_agent() self.debug = debug.Debug() self.tier = tier #set browser settings self.profile = self.get_profile() #initiate driver self.driver = webdriver.Firefox(self.profile) self.driver.set_window_size(self.width, self.height) #user log to verify window dimensions implicitly size = self.driver.get_window_size() if self.debug: firefox_settings_dictionary = { "Browser Specifications": "Driver", "profile": self.profile, } self.debug.press(feed=firefox_settings_dictionary, tier=self.tier)
ДАННЫМИ, СТАВШИМИ НЕПРАВИЛЬНЫМИ, ИЛИ ПОТЕРЯМИ ПРИНЕСЕННЫМИ ИЗ-ЗА ВАС ИЛИ ТРЕТЬИХ ЛИЦ, ИЛИ ОТКАЗОМ ПРОГРАММЫ РАБОТАТЬ СОВМЕСТНО С ДРУГИМИ ПРОГРАММАМИ), ДАЖЕ ЕСЛИ ТАКОЙ ВЛАДЕЛЕЦ ИЛИ ДРУГОЕ ЛИЦО БЫЛИ ИЗВЕЩЕНЫ О ВОЗМОЖНОСТИ ТАКИХ УБЫТКОВ. ''' version = 'wrx100-2.0' import MOD import sys import config CONFIG = config.Config() CONFIG.read() import debug DEBUG = debug.Debug(CONFIG) import utils UTILS = utils.Utils(CONFIG, DEBUG) import serial SERIAL = serial.Serial(CONFIG, DEBUG) import gsm GSM = gsm.GSM(CONFIG, DEBUG, SERIAL) # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = C_SCFG1 = 'AT#SCFG=1,1,' + CONFIG.get('TCP_MAX_LENGTH') + ',90,30,2\r' # AT КОМАНДА НАСТРОЙКИ СОКЕТА №1,"2" - data sending timeout; after this period data are sent also if they’re less than max packet size. C_SCFGEXT1 = 'AT#SCFGEXT=1,1,0,0,0,0\r' # COKET1, SRING + DATA SIZE, receive in TEXT, keepalive off, autoreceive off, send in TEXT C_SCFG2 = 'AT#SCFG=2,1,' + CONFIG.get('TCP_MAX_LENGTH') + ',120,30,2\r' # AT КОМАНДА НАСТРОЙКИ СОКЕТА №2 - Сокет для определения точного времени 15 сек на попытку подключенния
def __init__(self): self.dbg = debug.Debug() self.parser = xml.sax.make_parser() # 创建一个 XMLReader self.parser.setFeature(xml.sax.handler.feature_namespaces, 0) # 关闭命名空间 self.xmlsax = xml_sax_handler() self.parser.setContentHandler(self.xmlsax) # 重写 ContexHandler
Also if this not set it will not save the results') parser.add_argument('--simul_time', type=float, default=20.0, help='The simulation time in seconds every run gets before resulting in failure (default=%(default)d)') parser.add_argument('--human_length', type=int, default=160, help='This will give the length of the human that is used in the simulator in cm. (default=%(default)d)') parser.add_argument('--human_mass', type=int, default=55, help='This will give the weight of the human that is used in the simulator in kg (default=%(default)d)') parser.add_argument('-d', '--debug_view', action='store_true', help='Turn on the visuals using pygame.') parser.add_argument('-s', action='store_true', help='Run the simulation only once, do not save the results.') args = parser.parse_args() functionlist = [] simul = sim.simulator(args.file, args.simul_time, args.human_length, args.human_mass) if args.debug_view: import debug deb = debug.Debug(simul) functionlist.append(deb.step_draw) if args.r is "": args.r = 'results/' + args.file.split('/')[-1][:-4] + '.res' if not args.s: multirun(args.r, simul, functionlist, iterations=args.t) else: run(simul, functionlist)
#!/usr/bin/python import string, sys, debug from card import * from socket import socket, AF_INET, SOCK_STREAM from time import sleep debug = debug.Debug() # # Oh Hell Client class # # Attributes: # name # name of player # # buffer # buffer of messages from server # # socket # socket for connection to server # # players # list of players (Player objects) # # cardList # list of cards held by player # # trump # trump for hand #
#!/usr/bin/python3 from flask import Flask from flask_restful import Api, Resource, reqparse, fields, request from flask_cors import CORS from connect import Connect import os, pandas, debug app = Flask(__name__) api = Api(app) CORS(app) debugger = debug.Debug() author_fields = { 'author': fields.String } class AddBook(Resource): def __init__(self): self.connection = Connect( 'ora-scsp.srv.mst.edu', 1521, os.environ['DBEAVER_USERNAME'], os.environ['DBEAVER_PASSWORD'], 'scsp.mst.edu' ) self.connection.establish_connection() def post(self): req = { 'author':request.args.get("author"),
import debug d = debug.Debug() def sayFoo(): print("Foo") def sayBar(): print("Bar") def sayBaz(): print("Baz") '''long_string="I did a science project for this article and watched Bird Box, and I have to say I thought it was a mediocre or even below-average film. If I were rating it out of 10, I’d give it a 6. " long_string+="The pacing was all over the place, the dialogue was laughable (the film features the “joke” “We are making the end of the world … great again! Yoooooooo!” Seriously. I think the dialogue is so bad " long_string+="that A.I. must have written it.), and the plot of the film was predicated on stupid characters doing stupid things. So as not to be too negative, I will concede that Sandra Bullock had an excellent" long_string+='performance, and John Malkovich did an excellent job of being a surrogate of my voice in the movie when he asked a character who committed an egregiously stupid act, “Are you a simpleton?"\n' long_string+="Now, you may be thinking, “Geez, Tucker, you know, maybe you don’t speak for everyone when it comes to watching movies,” and you’d be right. I don’t, nor do I claim to do so. Consider though that the " long_string+="film boasts a Metacritic score of 52 out of 100 and an audience score on Rotten Tomatoes of 65 percent. Those aren’t stellar enough numbers to equate to 45 million views (Netflix considers those views " long_string+="to be accounts that watched at least 70 percent of the movie). And yet, here we are in a post-Bird Box world.\n" long_string+="So how did Netflix pull off the greatest heist of the 21st century? How did they steal two hours from 45 million viewers (3,750,000 days worth of viewing time!!) despite putting out a mediocre movie?" long_string+=" This is what we keep stressing about great social media presence: it works, and if you do it the right way, it can be free. A significant number of those views came from people simply seeking to " long_string+=" understand the context of the memes they kept seeing on twitter. Even if the memes originated from less than legitimate accounts, they resulted in millions of legitimate views. That’s" dictionary1={ 'phone':"iphoneXS", 'number':"111-111-1111", 'long string':long_string,
import argparse parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", help="path to config file [bitcoin.conf]", default="bitcoin.conf") return parser.parse_args() def InitializeState(): args = ParseArguments() import config cfg = config.Config(args.config) url = cfg.GetRPCURL() import rpc handle = rpc.BitcoinRPCHandle(url) import state return state.State(handle) if __name__ == '__main__': state = InitializeState() import debug debug.Debug(state)
def main(): #debug init d = debug.Debug() logging.info('Remy has been started') # QT Application qapp = QtGui.QApplication(sys.argv) qapp.setQuitOnLastWindowClosed(False) # check dir exists. If it doesn't exist - make path = os.path.expanduser('~/.reminder/') if not os.path.exists(os.path.expanduser(path)): os.makedirs(path) #~ debug.log('Dir {} has been made'.format(path)) # TMP shutil.copy( os.path.expanduser('~/Dropbox/Reminder/dictionaries/people.json'), '{}dictionary.json'.format(path)) # a database connection db_connect = DBconnect() # create widgets new_notification_widget = NewNotificationWidget() main_window = MainWindowWidget(db_connect) #create a notitifction container notifications = Notifications_container(db_connect) # a dictionary updater dic_upd = DictionaryUpdater(db_connect) # get all actual notifications from DB and create notification objects notification_array_tmp = [] #~ for row in #~ notification_array_tmp.append(row) #~ for row in db_connect.getAllCurrentNotifications(): logging.info('MAIN: Get a notification from db: {}'.format(row)) secs_to_event = QtCore.QDateTime.currentDateTime().secsTo( QtCore.QDateTime.fromString(row[2], 'yyyy-MM-dd hh:mm:ss')) logging.info( 'MAIN: Add a new notification: id = {} secs_to_event = {} text = {}' .format(row[0], secs_to_event, row[1])) notifications.addNewNotification(row[0], secs_to_event, row[1]) ######################################## # CONNECTIONS ######################################## # tray buttons main_window.tray.main_window.triggered.connect(main_window.show) main_window.tray.new_button.triggered.connect( new_notification_widget.showWidget) main_window.tray.exit_button.triggered.connect(QtGui.qApp.quit) # a new notifcation button from mainWidget main_window.newButtonClicked.connect(new_notification_widget.showWidget) # a table ha been changed db_connect.table_changed.connect(main_window.paintTable) # add a notification new_notification_widget.addNewNotificaion.connect( db_connect.addNotification) db_connect.add_notification.connect(notifications.addNewNotification) # delete a notification main_window.deleteNotification.connect(db_connect.deleteNotificationByVal) notifications.done.connect(db_connect.deleteNotificationById) db_connect.delete_notification.connect(notifications.deleteNotification) # update a dictionary file #~ db_connect.table_changed.connect(dic_upd.updateFile) sys.exit(qapp.exec_())
# TODO([email protected]): type check command line arguments. try: page = int(sys.argv[0]) zip_code = int(sys.argv[1]) is_debug = int(sys.argv[2]) if not isinstance(page, int): raise TypeError if not isinstance(zip_code, int): raise TypeError if not isinstance(is_debug, int): raise TypeError except TypeError: raise TypeError # crawl crawler = crawler.Crawler(page, zip_code, {}, debug.Debug(1)) uris = asyncio.get_event_loop().run_until_complete(crawler.crawl()) debug.Debug(1).console(uris) # parse parsers = list() formatter = formatter.Formatter() dataset = list() for uri in uris: parsers.append(psr.Psr(uri, parse_rule)) for parser in parsers: data = asyncio.get_event_loop().run_until_complete(parser.parse()) formatted = formatter.format(data) dataset.append(formatter.flatten(data))
def thread1(name, delay): time.sleep(delay) print("thread-1 start") run = AdbDyThreadMain(name) run.ss_run_proc() def thread2(name, delay): time.sleep(delay) print("thread-2 start") run = AdbDyThreadMain(name) run.ss_run_proc() if (__name__ == "__main__"): """ ident = "xx" adb = AdbDyCtrl(ident) ret = adb.adb_input("你好") print(ret) """ dbg = debug.Debug() dbg.printlog("trace", common_var.termianl_info[0]) _thread.start_new_thread(thread1, (common_var.termianl_info[0]['name'], 1)) #dbg.printlog("trace", common_var.termianl_info[1]) #_thread.start_new_thread(thread2, (common_var.termianl_info[1]['name'], 2))
gameMode, gameType, gameSubType, mapId, str(date)]) mssql.bulk_insert("INSERT INTO {db}.dbo.RecentMatchAnalysis (gameId, summonerId, championId, team, win, " "gameMode, gameType, gameSubType, mapId, date) VALUES " "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" "".format(db=mssql.db), match_summary) mssql.insert("INSERT INTO {db}.dbo.RecentMatchJSON (summonerId, date, json) VALUES (?, ?, ?)" "".format(db=mssql.db), [id, datetime.now(), json.dumps(games["games"])]) <<<<<<< HEAD:Sandbox/riot_lib.py dbg = Debugger.Debug(Debugger.WARNING) get_summoner_match_data("i n u s e") #get_summoner_match_data(45911151) ''' CREATE A TABLE FOR SUMMONERS SUMMONERID LAST_UPDATE LAST_SEEN DIVISION SUBMIT SUMMONERS FROM ALL MATCHES INTO THE SUMMONER TABLE '''
def __init__(self): self.dbg = debug.Debug() self.dbg.printlog("info", platform.system() + ',', "version:" + platform.python_version())