def test_decrement(self): code = [ self.controller.set_num(0, 1), self.controller.increment_num(0, -1) ] debugger = Debugger(self.controller, ''.join(code)) debugger.exec_commands(10000000) self.assertTrue(debugger.execution_completed) self.assertEqual(debugger.get_vmc_value(0), 0)
def test_add_neg_to_pos(self): code = [ self.controller.set_num(0, -2), self.controller.set_num(4, 4), self.controller.add_num(0, 4) ] debugger = Debugger(self.controller, ''.join(code)) debugger.exec_commands(10000000) self.assertTrue(debugger.execution_completed) self.assertEqual(debugger.get_vmc_value(0), 2)
def test_if_else_true(self): test_code = [] test_code.append(self.controller.set_byte(0, 12)) if_code, temps = self.controller.if_else_byte_if(0) test_code.append(if_code) test_code.append(self.controller.set_num(4, 12345)) if_code, temps = self.controller.if_else_byte_else(0, temps) test_code.append(if_code) test_code.append(self.controller.set_num(4, 54321)) test_code.append(self.controller.if_else_byte_end(0, temps)) debugger = Debugger(self.controller, ''.join(test_code)) debugger.exec_commands(100000) self.assertTrue(debugger.execution_completed) self.assertEqual(debugger.get_vmc_value(4), 12345)
def __init__(self, database, user, password, host="127.0.0.1", port="5432"): self.conn = psycopg2.connect(database=database, user=user, password=password, host=host, port=port) self.cur = self.conn.cursor() # conn = psycopg2.connect("dbname = "+database+", user = "******", password = "******", host = "+host+", port = "+port) Debugger.printD("DB : init : database " + database + " connected successfully...")
def test(): from Debugger import Debugger import time debugger = Debugger('test-case/case01') t = time.time() for j in range(23): current_instruction = debugger.get_current_instruction() print current_instruction i = Instruction(current_instruction) #print '='*80 tmp = i.get_dict_dst_src() for k in tmp: print '\t', k, "<-----", tmp[k] ## 1.44 f = i.function if f: tmp = f.get_dict_dst_src() for k in tmp: print '\t', k, "<-----", tmp[k] ## 1.44 if i.is_need_input(): debugger.step("aaaa") else: debugger.step() print time.time() - t
def main(): print(sys.argv) path = os.path.join(os.getcwd(), "Roms", sys.argv[1]) if "debug" in sys.argv: interpreter = Interpreter(path, True) Debugger(interpreter).execute() else: interpreter = Interpreter(path, False) while True: interpreter.tick()
def test_store(self): code = [self.controller.set_num(self.controller.offset_reg[0], 6)] code += [self.controller.set_byte(self.controller.offset_reg[2], 1)] code += [ self.controller.while_byte_start(self.controller.offset_reg[2]) ] code += [ self.controller.store_memory(self.controller.offset_reg[1], self.controller.offset_reg[1]) ] code += [ self.controller.increment_num(self.controller.offset_reg[1], 2) ] code += [ self.controller.equal_num(self.controller.offset_reg[1], self.controller.offset_reg[0], self.controller.offset_reg[2]) ] code += [ self.controller.increment_byte(self.controller.offset_reg[2], -1) ] code += [self.controller.while_byte_end(self.controller.offset_reg[2])] code += [self.controller.set_num(self.controller.offset_reg[0], 1)] code += [self.controller.set_byte(self.controller.offset_reg[2], 1)] code += [ self.controller.increment_num(self.controller.offset_reg[1], -1) ] code += [ self.controller.while_byte_start(self.controller.offset_reg[2]) ] code += [ self.controller.store_memory(self.controller.offset_reg[1], self.controller.offset_reg[1]) ] code += [ self.controller.increment_num(self.controller.offset_reg[1], -2) ] code += [ self.controller.equal_num(self.controller.offset_reg[1], self.controller.offset_reg[0], self.controller.offset_reg[2]) ] code += [ self.controller.increment_byte(self.controller.offset_reg[2], -1) ] code += [self.controller.while_byte_end(self.controller.offset_reg[2])] debugger = Debugger(self.controller, ''.join(code)) debugger.exec_commands(100000000) self.assertTrue(debugger.execution_completed) for i in range(0, 6, 2): self.assertEqual(debugger.get_memory(i), i) self.assertEqual(debugger.get_memory(6), 0) self.assertEqual(debugger.get_memory(1), 0) for i in range(5, 1, -2): self.assertEqual(debugger.get_memory(i), i)
def test(): ## this test is out of date debug = Debugger('../test-case/case01') print 1, debug._Debugger__prompt eip = Register('eip') eax = Register('eax') a = eax b = set(tuple(eax)) print "==>", a print "==>", b #rbx = Register('rbx') ah = Register('ah') bl = Register('bl') ax = Register('ax') #axy = Register('axy') print eip print "size:", eip.get_size() print "value:", hex(eip.get_value()) debug.step() print "value:", hex(eip.get_value()) print "runtime value:", hex(eip.get_runtime_value()) print hex(1 + eip - 3 * ax * 2) print "test ok!!!"
def debug(self, params=None, cont_if_running=0, cont_always=0, temp_breakpoint=None): if self.savedAs: debugger = self.editor.debugger if not debugger: from Debugger import Debugger filename = self.assertLocalFile(self.filename) debugger = Debugger.DebuggerFrame(self.editor, filename) debugger.setDebugClient() if params is not None: # pass [] to clear parameters debugger.setParams(params) self.editor.debugger = debugger debugger.Show() debugger.initSashes() debugger.ensureRunning(cont_if_running, cont_always, temp_breakpoint)
def test_set_copy(self): test_code = self.controller.set_num(4, 54321) \ + self.controller.set_num(0, 12345) \ + self.controller.set_num(8, -1) \ + self.controller.copy_num(0, 4) debugger = Debugger(self.controller, test_code) debugger.exec_commands(100000) self.assertTrue(debugger.execution_completed) self.assertEqual(debugger.get_vmc_value(0), 12345) self.assertEqual(debugger.get_vmc_value(4), 12345) self.assertEqual( debugger.get_vmc_value(8), self.controller.cell_range**self.controller.num_size - 1)
def handle_birth_conflicts(self, birth_givers): # Handling conflicts in birth Map = [[0 for i in range(self.nb_cols)] for j in range(self.nb_lines)] leftovers = [] newborns = [] for agent in birth_givers: for newborn in agent.newborns: # newborn like ((x,y), state) newborns.append([agent] + newborn) for newborn in newborns: # newborn like [agent, (x,y), state] x, y = newborn[1] if not Map[x][y]: # If no one wants this case, take it Map[x][y] = newborn else: # If the case is taken, take it if you're stronger D.print("The case I want :[{} {}] is taken !!".format(x, y), lvl=11, exclusive=True) D.print(" I'm a {} in case {} {} against a {} in case {} {}.\n"\ " My sum is {}, my vars {}\n"\ " Its sum is {}, its vars {}".format( newborn[0].state, newborn[0].x, newborn[0].y, Map[x][y][0].state, Map[x][y][0].x, Map[x][y][0].y, sum([var[0] for var in newborn[0].vars.values()]),newborn[0].vars, sum([var[0] for var in Map[x][y][0].vars.values()]),Map[x][y][0].vars ),lvl=11,exclusive=True) if newborn[0] > Map[x][y][0]: leftovers.append(Map[x][y][0]) Map[x][y] = newborn else: # If you're not, you're left over leftovers.append(newborn[0]) birth_givers = [] for line in Map: for element in line: if element: # [agent, (x,y), state] agent, (x, y), state = element self.add_agent(agent.__class__(state, x, y)) D.print( ' <> Agent at [{} {}] was not challenged when infanting at [{} {}]' .format(agent.x, agent.y, x, y), lvl=11, exclusive=True) for agent in leftovers: if agent.try_birthing(self.__cells, self.fields, *self.size): birth_givers.append(agent) if birth_givers: self.handle_birth_conflicts(birth_givers)
def test_sequential_basic_blocks(self): code = [ self.controller.opening_code(), self.controller.basic_block_start(), self.controller.set_num(self.controller.offset_reg[0], 12345), self.controller.basic_block_goto_next(), self.controller.basic_block_start(), self.controller.set_num(self.controller.offset_reg[1], 54321), self.controller.basic_block_goto_next(), self.controller.closing_code() ] debugger = Debugger(self.controller, ''.join(code)) debugger.exec_commands(100000000) self.assertTrue(debugger.execution_completed) self.assertEqual(debugger.get_vmc_value(self.controller.offset_reg[0]), 12345) self.assertEqual(debugger.get_vmc_value(self.controller.offset_reg[1]), 54321)
def get_consumers_n_lag_by_topic(self, topic_name): lag = self.get("/topicconsumerslag/" + topic_name) Debugger.printD("API : get_consumers_n_lag_by_topic : lag : " + str(type(lag.json())) + " " + str(lag.json())) return lag.json()
def __init__(self): super().__init__() self.debugger = Debugger() self.file_name = None self.setWindowTitle('Python Debugger') self.textEdit = QTextEdit() scroll_bar = QScrollArea(self) self.textEdit.setFrameShape(QFrame.StyledPanel) self.console = QLabel() self.console.setWordWrap(True) self.console.setFixedSize(400, 1200) self.breakpoints_map = BPMap() self.breakpoints_map.setFixedSize(25, 1200) self.breakpoints_map.setFrameShape(QFrame.StyledPanel) self.console.setFrameShape(QFrame.StyledPanel) scroll_bar.setWidget(self.breakpoints_map) self.textEdit.setVerticalScrollBar(scroll_bar.verticalScrollBar()) self.breakpoint_image = QImage() self.breakpoint_image.load('breakpoint.png') self.splitter = QSplitter(Qt.Horizontal) self.splitter.addWidget(self.breakpoints_map) self.splitter.addWidget(self.textEdit) self.splitter.addWidget(self.console) self.setCentralWidget(self.splitter) self.file = None exit_action = QAction(QIcon('exit.png'), 'Exit', self) exit_action.setShortcut('Ctrl+Q') exit_action.setStatusTip('Exit application') exit_action.triggered.connect(self.exit) open_file_action = QAction(QIcon('open.png'), 'Open file', self) open_file_action.setShortcut('Ctrl+O') open_file_action.setStatusTip('Open python file') open_file_action.triggered.connect(self.show_dialog) set_bp_action = QAction(QIcon('breakpoint.png'), 'set_bp', self) set_bp_action.setShortcut('Ctrl+R') set_bp_action.setStatusTip(r'install\uninstall bp') set_bp_action.triggered.connect(self.show_bp_dialog) start_debug = QAction(QIcon('de bug.png'), 'Debug', self) start_debug.setShortcut('Ctrl+S') start_debug.setStatusTip('Start debugging') start_debug.triggered.connect(self.start_debugging) continue_debug = QAction(QIcon('debug.png'), 'Continue', self) continue_debug.setShortcut('Ctrl+D') continue_debug.setStatusTip('Continue debugging') continue_debug.triggered.connect(self.continue_debugging) break_action = QAction(QIcon('open.png'), 'Stop Debug', self) break_action.setShortcut('Ctrl+B') break_action.setStatusTip('Stop debug process') menu_Bar = self.menuBar() self.menu = menu_Bar.addMenu('Menu') self.menu.addAction(exit_action) self.menu.addAction(open_file_action) self.menu.addAction(set_bp_action) self.menu.addAction(start_debug) self.menu.addAction(continue_debug) self.timer = QBasicTimer() self.timer.start(20, self) self.showFullScreen()
class View(QMainWindow): def __init__(self): super().__init__() self.debugger = Debugger() self.file_name = None self.setWindowTitle('Python Debugger') self.textEdit = QTextEdit() scroll_bar = QScrollArea(self) self.textEdit.setFrameShape(QFrame.StyledPanel) self.console = QLabel() self.console.setWordWrap(True) self.console.setFixedSize(400, 1200) self.breakpoints_map = BPMap() self.breakpoints_map.setFixedSize(25, 1200) self.breakpoints_map.setFrameShape(QFrame.StyledPanel) self.console.setFrameShape(QFrame.StyledPanel) scroll_bar.setWidget(self.breakpoints_map) self.textEdit.setVerticalScrollBar(scroll_bar.verticalScrollBar()) self.breakpoint_image = QImage() self.breakpoint_image.load('breakpoint.png') self.splitter = QSplitter(Qt.Horizontal) self.splitter.addWidget(self.breakpoints_map) self.splitter.addWidget(self.textEdit) self.splitter.addWidget(self.console) self.setCentralWidget(self.splitter) self.file = None exit_action = QAction(QIcon('exit.png'), 'Exit', self) exit_action.setShortcut('Ctrl+Q') exit_action.setStatusTip('Exit application') exit_action.triggered.connect(self.exit) open_file_action = QAction(QIcon('open.png'), 'Open file', self) open_file_action.setShortcut('Ctrl+O') open_file_action.setStatusTip('Open python file') open_file_action.triggered.connect(self.show_dialog) set_bp_action = QAction(QIcon('breakpoint.png'), 'set_bp', self) set_bp_action.setShortcut('Ctrl+R') set_bp_action.setStatusTip(r'install\uninstall bp') set_bp_action.triggered.connect(self.show_bp_dialog) start_debug = QAction(QIcon('de bug.png'), 'Debug', self) start_debug.setShortcut('Ctrl+S') start_debug.setStatusTip('Start debugging') start_debug.triggered.connect(self.start_debugging) continue_debug = QAction(QIcon('debug.png'), 'Continue', self) continue_debug.setShortcut('Ctrl+D') continue_debug.setStatusTip('Continue debugging') continue_debug.triggered.connect(self.continue_debugging) break_action = QAction(QIcon('open.png'), 'Stop Debug', self) break_action.setShortcut('Ctrl+B') break_action.setStatusTip('Stop debug process') menu_Bar = self.menuBar() self.menu = menu_Bar.addMenu('Menu') self.menu.addAction(exit_action) self.menu.addAction(open_file_action) self.menu.addAction(set_bp_action) self.menu.addAction(start_debug) self.menu.addAction(continue_debug) self.timer = QBasicTimer() self.timer.start(20, self) self.showFullScreen() def show_dialog(self): self.file_name, ok = QFileDialog.getOpenFileName(self, 'Open file', '/home') if not ok: return self.file = open(self.file_name, 'r') with self.file: self.text = self.file.read() self.textEdit.setText(self.text) self.textEdit.selectAll() self.textEdit.setAlignment(Qt.AlignLeft) self.textEdit.setFontPointSize(13) self.breakpoints_map.line_count = self.text.count('\n') + 5 def start_debugging(self): if self.file is None: return self.wait_event = threading.Event() self.print_event = threading.Event() self.text = self.textEdit.toPlainText() self.breakpoints_map.line_count = self.text.count('\n') + 5 self.debug = threading.Thread(target=self.debugger.open, args=(self.text, self.file_name, self.wait_event, self.print_event)) self.console_update = threading.Thread(target=self.update_console) self.debug.start() self.console_update.start() self.wait_event.set() def update_console(self): if not self.debug.isAlive: self.console.setText('') while self.debug.isAlive: self.print_event.wait() self.print_event.clear() result = 'Line Number: {}\n'.format(self.debugger.last_line) self.breakpoints_map.last_line = self.debugger.last_line for name in self.debugger.watch.keys(): result += name + '\n' for value in self.debugger.watch[name]: result += '\t' + value + '\n' result += '\n\nCall Stack:\n' for function in self.debugger.call_stack: result += '\t'+ function + '\n' self.console.setText(result) def continue_debugging(self): self.wait_event.set() self.print_event.clear() def show_bp_dialog(self): if self.file_name is None: return number, ok = QInputDialog.getText(self, 'install breakpoint', 'Select line number') if ok: self.debugger.set_breakpoint(int(number)) self.breakpoints_map.breakpoints = self.debugger.breakpoints def exit(self): if self.file is not None: self.file.close() self.close() def keyPressEvent(self, event): if event.key() == Qt.Key_F2: self.debugger.step_into = True self.continue_debugging() if event.key() == Qt.Key_Escape: if self.file_name is not None: self.file.close() self.close()
def get_current_topics(self): self.current_topics = self.client.topics Debugger.printD("Metric : get_current_topics : " + str(type(self.current_topics)))
def create_client(self, host, port): self.client = KafkaClient(hosts=host + ':' + port) Debugger.printD("Metric : create_client : Client " + host + ':' + port + "created Successfully")
def __init__(self): # api = flask.Flask(__name__) Debugger.printD("API : api created successfully...")
def install(theLine: str): ''' Install A Specified Package(s) ''' decoded = theLine.split(" ") package_name = decoded[0] package_version = decoded[1] package_type = decoded[2] linux_compat = decoded[3] win_compat = decoded[4] dar_compat = decoded[5] if platform == 'linux' and linux_compat == 1: password = getpass('Enter your password: '******'Installing {package_name}...', max=100) if package_type == 'p': script = f'sudo -S apt-get install -y {package_name}={package_version}' elif package_type == 'a': script = f'sudo -S snap install --classic {package_name}={package_version}' # sudo requires the flag '-S' in order to take input from stdin for _ in range(1, 75): time.sleep(0.01) installer_progress.next() proc = Popen(script.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE) # Popen only accepts byte-arrays so you must encode the string output, error = proc.communicate(password.encode()) if proc.returncode != 0: click.echo( click.style('❎ Installation Failed... ❎', fg='red', blink=True, bold=True)) debug = click.prompt( 'Would you like us to debug the failed installation?[y/n]') if debug == 'y': debugger = Debugger() debugger.debug(password, error) logs = click.prompt('Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = error.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return else: logs = click.prompt('Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = output.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return click.echo( click.style( f'\n\n 🎉 Successfully Installed {package_name}! 🎉 \n', fg='green', bold=True)) testing_bar = IncrementalBar('Testing package...', max=100) for _ in range(1, 21): time.sleep(0.002) testing_bar.next() if package_type == 'p': test_script = f'{package_name} --version' proc = Popen(test_script.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE) for _ in range(22, 101): time.sleep(0.002) testing_bar.next() except subprocess.CalledProcessError as e: click.echo(e.output) click.echo('An Error Occured During Installation...', err=True) elif platform == 'win32' and win_compat == 1: installer_progress = Spinner(message=f'Installing {package_name}...', max=100) try: for _ in range(1, 75): time.sleep(0.01) installer_progress.next() run(f"choco install {package_name} --version {package_version}", stdout=PIPE, stderr=PIPE) # first time for _ in range(1, 25): time.sleep(0.01) installer_progress.next() # Haven't implemented debug because .run() doesn't offer # communicate() function click.echo( click.style( f'\n\n 🎉 Successfully Installed {package_name}! 🎉 \n', fg='green', bold=True)) if package_type == 'p': testing_bar = IncrementalBar('Testing package...', max=100) test_script = f"{package_name} --version" tests_passed = [ f'{c.devpackages_windows[package_name]} Version' ] # this condition will be true for all application package stuff for _ in range(1, 64): time.sleep(0.002) testing_bar.next() run(test_script, stdout=PIPE, stderr=PIPE) for _ in range(64, 101): time.sleep(0.002) testing_bar.next() click.echo('\n') for test in tests_passed: click.echo( click.style(f'Test Passed: {test} ✅\n', fg='green')) elif package_type == 'a': click.echo('\n') click.echo( click.style(f'Test Passed: {package_name} Launch ✅\n', fg='green')) return except Exception as e: click.echo(e) click.echo('An Error Occured During Installation...', err=True) elif platform == 'darwin' and dar_compat == 1: try: installer_progress = Spinner( message=f'Installing {package_name}...', max=100) # sudo requires the flag '-S' in order to take input from stdin if package_type == 'a': script = f"brew install {package_name}" test_script = f"{package_name} --version" tests_passed = [f'{c.devpackages_macos[package_name]} Version'] elif package_type == 'p': script = f"brew cask install {package_name}" test_script = "" tests_passed = [] for _ in range(1, 75): time.sleep(0.01) installer_progress.next() proc = Popen(script.split(), stdout=PIPE, stdin=PIPE, stderr=PIPE) # Popen only accepts byte-arrays so you must encode the string output, error = proc.communicate(password.encode()) if proc.returncode != 0: click.echo( click.style('❎ Installation Failed... ❎', fg='red', blink=True, bold=True)) debug = click.prompt( 'Would you like us to debug the failed installation?[y/n]') if debug == 'y': debugger = Debugger() debugger.debug(password, error) logs = click.prompt('Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = error.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return else: logs = click.prompt('Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = output.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return click.echo( click.style( f'\n\n 🎉 Successfully Installed {package_name}! 🎉 \n', fg='green', bold=True)) # Testing the successful installation of the package testing_bar = IncrementalBar('Testing package...', max=100) if tests_passed == [] and test_script == '': click.echo('\n') click.echo( click.style(f'Test Passed: {package_name} Launch ✅\n', fg='green')) return for _ in range(1, 21): time.sleep(0.002) testing_bar.next() for _ in range(21, 60): time.sleep(0.002) testing_bar.next() proc = Popen(test_script.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE) for _ in range(60, 101): time.sleep(0.002) testing_bar.next() click.echo('\n') for test in tests_passed: click.echo(click.style(f'Test Passed: {test} ✅\n', fg='green')) except subprocess.CalledProcessError as e: click.echo(e.output) click.echo('An Error Occured During Installation...', err=True)
def get_all_consumers(self): cons = self.get("/topicconsumers") Debugger.printD("API : get_all_consumers : lag : " + str(type(cons.json())) + " " + str(cons.json())) return cons.json()
if __package__ is None or __package__ == "": from Debugger import Debugger # minor dependency else: from .Debugger import Debugger # minor dependency if __package__ is None or __package__ == "": from bookutils import next_inputs else: from .bookutils import next_inputs if __name__ == "__main__": next_inputs(['print', 'quit']) if __name__ == "__main__": with ExpectError(AssertionError): with Debugger(): string_error(**string_error_args) # ### Reducing other Collections if __name__ == "__main__": print('\n### Reducing other Collections') def list_error(l1, l2, maxlen): assert len(l1) < len(l2) < maxlen, "invalid string length" if __name__ == "__main__": with DeltaDebugger() as dd: list_error(l1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], l2=[1, 2, 3], maxlen=5)
######################### def enum(**enums): return type('Enum', (), enums) ######################### comm = MPI.COMM_WORLD if len(sys.argv) < 3: comm.Abort() N = int(sys.argv[1]) iterations = int(sys.argv[2]) # debug = True debugger = Debugger(on=False, cell=False, table=False, program_info=False, history=True) rank = comm.Get_rank() processes = comm.Get_size() if N % processes != 0: print("Error - cannot partition the problem") comm.Abort() rows = int(N / processes) mapper = Mapper(N, rank, rows, debugger) table = Tab(N, rank, rows, mapper, debugger) initial_rank = int(processes / 2) debugger.print_program_info("initial_rank = " + str(initial_rank)) if rank == initial_rank:
def __init__(self, database, user, password): super().__init__(database, user, password) # dict self.topics = self.get_all_topics() Debugger.printD("PandaDB : init : current topics in db : " + str(self.topics))
def install_task(self, package_name: str, script: str, password: str, test_script: str, tests_passed): def get_key(val, dictionary): for key, value in dictionary.items(): if val == value: return key def subprocess_cmd(command): process = subprocess.Popen(command, stdout=subprocess.PIPE, stdin=PIPE, stderr=PIPE) proc_stdout = process.communicate()[0].strip() decoded = proc_stdout.decode("utf-8") version_tag = decoded.split("\n")[1] # using [1:] might be useful in some scenario where the # version has multiple colons in it. cleaned_version = version_tag.split(": ")[1] return cleaned_version if platform == 'linux': try: installer_progress = Spinner( message=f'Installing {package_name}...', max=100) # sudo requires the flag '-S' in order to take input from stdin for _ in range(1, 75): time.sleep(0.01) installer_progress.next() proc = Popen(script.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE) # Popen only accepts byte-arrays so you must encode the string output, error = proc.communicate(password.encode()) if proc.returncode != 0: click.echo( click.style('❎ Installation Failed... ❎', fg='red', blink=True, bold=True)) debug = click.prompt( 'Would you like us to debug the failed installation?[y/n]' ) if debug == 'y': debugger = Debugger() debugger.debug(password, error) logs = click.prompt( 'Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = error.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return else: logs = click.prompt( 'Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = output.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return click.echo( click.style( f'\n\n 🎉 Successfully Installed {package_name}! 🎉 \n', fg='green', bold=True)) package_type = None if 'sudo -S apt-get' in script: package_type = 'p' elif 'sudo -S snap' in script: package_type = 'a' # Testing the successful installation of the package testing_bar = IncrementalBar('Testing package...', max=100) if tests_passed == [] and test_script == '': if package_type == 'a': file_exists = False if isfile(f'/home/{getuser()}/config.tcc'): file_exists = True if file_exists: with open(f'/home/{getuser()}/config.tcc', 'r') as file: lines = file.readlines() line_exists = False for line in lines: if get_key(package_name, applications_linux) in line: line_exists = True with open(f'/home/{getuser()}/config.tcc', 'a+') as file: if line_exists == False: file.write( f'{get_key(package_name, applications_linux)} None {package_type} \n' ) elif file_exists == False: with open(f'/home/{getuser()}/config.tcc', 'w+') as file: lines = file.readlines() line_exists = False for line in lines: if get_key(package_name, applications_linux) in line: line_exists = True with open(f'/home/{getuser()}/config.tcc', 'a+') as file: if line_exists == False: file.write( f'{get_key(package_name, applications_linux)} None {package_type} \n' ) click.echo('\n') click.echo( click.style(f'Test Passed: {package_name} Launch ✅\n', fg='green')) return for _ in range(1, 21): time.sleep(0.002) testing_bar.next() for _ in range(21, 60): time.sleep(0.002) testing_bar.next() proc = Popen(test_script.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE) package_type = None if 'sudo -S apt-get' in script: package_type = 'p' elif 'sudo -S snap' in script: package_type = 'a' return 'Key doesn\'t exist' if package_type == 'p': file_exists = False if isfile(f'/home/{getuser()}/config.tcc'): file_exists = True package_version = subprocess_cmd( f'apt show {get_key(package_name, devpackages_linux)}'. split()) if file_exists: with open(f'/home/{getuser()}/config.tcc', 'r') as file: lines = file.readlines() line_exists = False for line in lines: if get_key(package_name, devpackages_linux) in line: line_exists = True with open(f'/home/{getuser()}/config.tcc', 'a+') as file: if line_exists == False: file.write( f'{get_key(package_name, devpackages_linux)} {package_version} {package_type} \n' ) elif file_exists == False: with open(f'/home/{getuser()}/config.tcc', 'w+') as file: lines = file.readlines() line_exists = False for line in lines: if get_key(package_name, devpackages_linux) in line: line_exists = True with open(f'/home/{getuser()}/config.tcc', 'a+') as file: if line_exists == False: file.write( f'{get_key(package_name, devpackages_linux)} {package_version} {package_type} \n' ) for _ in range(60, 101): time.sleep(0.002) testing_bar.next() click.echo('\n') for test in tests_passed: click.echo( click.style(f'Test Passed: {test} ✅\n', fg='green')) except subprocess.CalledProcessError as e: click.echo(e.output) click.echo('An Error Occured During Installation...', err=True) if platform == 'win32': try: installer_progress = Spinner( message=f'Installing {package_name}...', max=100) for _ in range(1, 75): time.sleep(0.01) installer_progress.next() run(script, stdout=PIPE, stderr=PIPE) # first time for _ in range(1, 25): time.sleep(0.01) installer_progress.next() # Haven't implemented debug because .run() doesn't offer # communicate() function click.echo( click.style( f'\n\n 🎉 Successfully Installed {package_name}! 🎉 \n', fg='green', bold=True)) testing_bar = IncrementalBar('Testing package...', max=100) # the order of these lines below doesn't make sense. # even with that fake thing. # this condition will be true for all application package stuff if tests_passed == [] and test_script == '': click.echo('\n') click.echo( click.style(f'Test Passed: {package_name} Launch ✅\n', fg='green')) return # everything clear up to here.. for _ in range(1, 64): time.sleep(0.002) testing_bar.next() #now this line below... takes a test_script... run(test_script, stdout=PIPE, stderr=PIPE ) # this should either return emtpy stuff or some stuff. for _ in range(1, 36): time.sleep(0.002) testing_bar.next() click.echo('\n') for test in tests_passed: click.echo( click.style(f'Test Passed: {test} ✅\n', fg='green')) return except Exception as e: click.echo(e) click.echo('An Error Occured During Installation...', err=True) if platform == 'darwin': try: installer_progress = Spinner( message=f'Installing {package_name}...', max=100) # sudo requires the flag '-S' in order to take input from stdin for _ in range(1, 75): time.sleep(0.01) installer_progress.next() proc = Popen(script.split(), stdout=PIPE, stdin=PIPE, stderr=PIPE) # Popen only accepts byte-arrays so you must encode the string output, error = proc.communicate(password.encode()) if proc.returncode != 0: click.echo( click.style('❎ Installation Failed... ❎', fg='red', blink=True, bold=True)) debug = click.prompt( 'Would you like us to debug the failed installation?[y/n]' ) if debug == 'y': debugger = Debugger() debugger.debug(password, error) logs = click.prompt( 'Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = error.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return else: logs = click.prompt( 'Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = output.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return click.echo( click.style( f'\n\n 🎉 Successfully Installed {package_name}! 🎉 \n', fg='green', bold=True)) package_type = None if 'brew install' in script: package_type = 'p' elif 'brew cask install' in script: package_type = 'a' # Testing the successful installation of the package testing_bar = IncrementalBar('Testing package...', max=100) if tests_passed == [] and test_script == '': if package_type == 'a': file_exists = False if isfile(f'/Users/{getuser()}/config.tcc'): file_exists = True if file_exists: with open(f'/Users/{getuser()}/config.tcc', 'r') as file: lines = file.readlines() line_exists = False for line in lines: if get_key(package_name, applications_linux) in line: line_exists = True with open(f'/Users/{getuser()}/config.tcc', 'a+') as file: if line_exists == False: file.write( f'{get_key(package_name, applications_linux)} None {package_type} \n' ) elif file_exists == False: with open(f'/Users/{getuser()}/config.tcc', 'w+') as file: lines = file.readlines() line_exists = False for line in lines: if get_key(package_name, applications_linux) in line: line_exists = True with open(f'/Users/{getuser()}/config.tcc', 'a+') as file: if line_exists == False: file.write( f'{get_key(package_name, applications_linux)} None {package_type} \n' ) click.echo('\n') click.echo( click.style(f'Test Passed: {package_name} Launch ✅\n', fg='green')) return for _ in range(1, 21): time.sleep(0.002) testing_bar.next() for _ in range(21, 60): time.sleep(0.002) testing_bar.next() proc = Popen(test_script.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE) package_type = None if 'brew install' in script: package_type = 'p' elif 'brew cask install' in script: package_type = 'a' if package_type == 'p': file_exists = False if isfile(f'/Users/{getuser()}/config.tcc'): file_exists = True package_version = subprocess_cmd( f'apt show {get_key(package_name, devpackages_linux)}'. split()) if file_exists: with open(f'/Users/{getuser()}/config.tcc', 'r') as file: lines = file.readlines() line_exists = False for line in lines: if get_key(package_name, devpackages_linux) in line: line_exists = True with open(f'/Users/{getuser()}/config.tcc', 'a+') as file: if line_exists == False: file.write( f'{get_key(package_name, devpackages_linux)} {package_version} {package_type} \n' ) elif file_exists == False: with open(f'/Users/{getuser()}/config.tcc', 'w+') as file: lines = file.readlines() line_exists = False for line in lines: if get_key(package_name, devpackages_linux) in line: line_exists = True with open(f'/Users/{getuser()}/config.tcc', 'a+') as file: if line_exists == False: file.write( f'{get_key(package_name, devpackages_linux)} {package_version} {package_type} \n' ) for _ in range(60, 101): time.sleep(0.002) testing_bar.next() click.echo('\n') for test in tests_passed: click.echo( click.style(f'Test Passed: {test} ✅\n', fg='green')) except subprocess.CalledProcessError as e: click.echo(e.output) click.echo('An Error Occured During Installation...', err=True)
Mass=7.342e+22, scaler=Universe.scaler, name="Ay", Color=Elements.WavelengthToRgb(520)) #TestObj3 = Elements.NCS_Particle(screen,pos=(Universe.scaler.ConvertPixel(152100000000),0),Radius=696392000,Mass=1.9885e+30,scaler=Universe.scaler) TestObj4 = Elements.NCS_Particle( screen, pos=(0, -Universe.scaler.ConvertPixel(6371000 + 403000)), Radius=100, Mass=419725, scaler=Universe.scaler, name="ISS", Color=Elements.WavelengthToRgb(480)) Universe.FocusCenter = [0, -6371000 - 340000 ] #Universe.FocusCenter = [152100000000,0] Debug = Debugger(screen) TestObj2.Vector.x = 1022 # CreateOrbitSpeed(7.342e+22,100400000) TestObj2.Vector.y = 0 # CreateOrbitSpeed(7.342e+22,100400000) #TestObj.Vector.y=29.78*1000 TestObj4.Vector.x = 7.67e+3 #CreateOrbitSpeed(7.342e+22,6711000)*7.2 Universe.AddObject(TestObj) Universe.AddObject(TestObj2) Universe.AddObject(TestObj4) #Universe.AddObject(TestObj3) print("Universe created. %sx%s" % (wh)) bg = pygame.transform.scale(pygame.image.load("nebula.jpg"), (wh[0], wh[1])) da = None dd = None Focus = None Universe.UpdateFocus() for item in Universe.Objs:
from random import sample from numpy import random from Counter import Counter from DQNModels import DQN import tensorflow as tf import argparse from queue import PriorityQueue from Plotter import Plot from collections import defaultdict import cv2 import numpy as np from gym import wrappers, logger #import pybulletgym import gym e, d = exec, Debugger() e(d.gIS()) parser = argparse.ArgumentParser() parser.add_argument('--epsilon', type=float, default=0.05) parser.add_argument('--alpha', type=float, default=0.1) parser.add_argument('--gamma', type=float, default=0.99) parser.add_argument('--visual', type=bool, default=False) parser.add_argument('--nEpisodes', type=int, default=600) parser.add_argument('--nplanning', type=int, default=10) parser.add_argument('--greedy', type=bool, default=False) parser.add_argument('--epsilonStrat', type=int, default=5) parser.add_argument('--learner', type=int, default=1) parser.add_argument('--showTrial', type=bool, default=True) parser.add_argument('--randomReset', type=bool, default=False) parser.add_argument('--theta', type=float, default=.01) parser.add_argument('--ntrajectories', type=int, default=1)
def __init__(self): self.panda_db = PandaDB(DATABASE, USER, PASSWORD) Debugger.printD("DUMPER : init : DUMPER created successfully...") self.api = API() self.topics = self.api.get_topics() Debugger.printD("DUMPER : init : self.topics " + str(self.topics))
def install_task(self, package_name: str, script: str, password: str, test_script: str, tests_passed): def get_key(val, dictionary): for key, value in dictionary.items(): if val == value: return key return -1 def getWinVer(output: str, name: str): lines = output.split('\n') for line in lines: line = line.split() version = line[1] package_name = line[0] if name == package_name: final = version return final return def subprocess_cmd(command): process = subprocess.Popen( command, stdout=subprocess.PIPE, stdin=PIPE, stderr=PIPE) proc_stdout = process.communicate()[0].strip() decoded = proc_stdout.decode("utf-8") version_tag = decoded.split("\n")[1] # using [1:] might be useful in some scenario where the # version has multiple colons in it. cleaned_version = version_tag.split(": ")[1] return cleaned_version def parse(string): var1 = string.split(": ") if len(var1[1]) > 7: var2 = var1[1].split(" ") return var2[1] else: var2 = var1[1].split("\n") return var2[0] if platform == 'linux': try: installer_progress = Spinner( message=f'Installing {package_name}...', max=100) # sudo requires the flag '-S' in order to take input from stdin for _ in range(1, 75): time.sleep(0.01) installer_progress.next() proc = Popen( script.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE) # Popen only accepts byte-arrays so you must encode the string output, error = proc.communicate(password.encode()) if proc.returncode != 0: click.echo( click.style( '❎ Installation Failed... ❎', fg='red', blink=True, bold=True)) debug = click.prompt( 'Would you like us to debug the failed installation?[y/n]') if debug == 'y': debugger = Debugger() debugger.debug(password, error) logs = click.prompt( 'Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = error.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return else: logs = click.prompt( 'Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = output.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return click.echo( click.style( f'\n\n 🎉 Successfully Installed {package_name}! 🎉 \n', fg='green', bold=True)) package_type = None if 'sudo -S apt-get' in script: package_type = 'p' elif 'sudo -S snap' in script: package_type = 'a' # Testing the successful installation of the package testing_bar = IncrementalBar('Testing package...', max=100) if tests_passed == [] and test_script == '': if package_type == 'a': if isfile(f'/home/{getuser()}/config.tcc'): with open(f'/home/{getuser()}/config.tcc', 'r') as file: lines = file.readlines() package_exists = False for line in lines: if get_key(package_name, applications_linux) in line: package_exists = True # The order for the package compatiblity numbers is # Linux, Windows, MacOS if package_exists == False: with open(f'/home/{getuser()}/config.tcc', 'a+') as file: file.write( f'{get_key(package_name, applications_linux)} None {package_type} 1 {0 if get_key(package_name, applications_windows)==-1 else 1} {0 if get_key(package_name, applications_macos)==-1 else 1}\n') click.echo('\n') click.echo( click.style( f'Test Passed: {package_name} Launch ✅\n', fg='green')) return for _ in range(1, 21): time.sleep(0.002) testing_bar.next() for _ in range(21, 60): time.sleep(0.002) testing_bar.next() proc = Popen( test_script.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE) package_type = None if 'sudo -S apt-get' in script: package_type = 'p' elif 'sudo -S snap' in script: package_type = 'a' if package_type == 'p': file_exists = False if isfile(f'/home/{getuser()}/config.tcc'): file_exists = True package_version = subprocess_cmd( f'apt show {get_key(package_name, devpackages_linux)}'.split()) if file_exists: with open(f'/home/{getuser()}/config.tcc', 'r') as file: lines = file.readlines() package_exists = False for line in lines: if get_key(package_name, devpackages_linux) in line: package_exists = True if package_exists == False: with open(f'/home/{getuser()}/config.tcc', 'a+') as file: file.write( f'{get_key(package_name, devpackages_linux)} {package_version} {package_type} 1 {0 if get_key(package_name, devpackages_windows)==-1 else 1} {0 if get_key(package_name, devpackages_macos)==-1 else 1}\n') for _ in range(60, 101): time.sleep(0.002) testing_bar.next() click.echo('\n') for test in tests_passed: click.echo( click.style( f'Test Passed: {test} ✅\n', fg='green')) except subprocess.CalledProcessError as e: click.echo(e.output) click.echo('An Error Occured During Installation...', err=True) elif platform == 'win32': try: installer_progress = Spinner( message=f'Installing {package_name}...', max=100) for _ in range(1, 75): time.sleep(0.01) installer_progress.next() run(script, stdout=PIPE, stderr=PIPE) # first time for _ in range(1, 25): time.sleep(0.01) installer_progress.next() click.echo( click.style( f'\n\n 🎉 Successfully Installed {package_name}! 🎉 \n', fg='green', bold=True)) testing_bar = IncrementalBar('Testing package...', max=100) # this condition will be true for all applications if tests_passed == [] and test_script == '': # Dont run any tests, just exit click.echo('\n') click.echo( click.style( f'Test Passed: {package_name} Launch ✅\n', fg='green')) return for _ in range(1, 64): time.sleep(0.002) testing_bar.next() run(test_script, stdout=PIPE, stderr=PIPE) in_app = get_key(package_name, applications_windows) in_dev = get_key(package_name, devpackages_windows) w_version = subprocess.Popen( "clist -l", stdin=PIPE, stderr=PIPE, stdout=PIPE) output = w_version.communicate()[0].decode() package_exists = False with open(os.path.join("C:\\Turbocharge", "config.tcc"), 'r') as f: lines = f.readlines() for i in range(len(lines)): if (str(in_app) in lines[i]) or (str(in_dev) in lines[i]): package_exists = True break if not package_exists: if in_app != -1: version = getWinVer(output, in_app) with open(os.path.join("C:", "Turbocharge", "config.tcc"), 'a+') as f: f.write( f'{in_app} {version} a {0 if get_key(package_name, applications_windows)==-1 else 1} 1 {0 if get_key(package_name, applications_macos)==-1 else 1}\n') elif in_dev != -1: version = getWinVer(output, in_dev) with open(os.path.join("C:", "Turbocharge", "config.tcc"), 'a+') as f: f.write( f'{in_dev} {version} p {0 if get_key(package_name, devpackages_windows)==-1 else 1} 1 {0 if get_key(package_name, devpackages_macos)==-1 else 1}\n') for _ in range(64, 101): time.sleep(0.002) testing_bar.next() click.echo('\n') for test in tests_passed: click.echo( click.style( f'Test Passed: {test} ✅\n', fg='green')) return except Exception as e: click.echo(e) click.echo('An Error Occured During Installation...', err=True) if platform == 'darwin': try: installer_progress = Spinner( message=f'Installing {package_name}...', max=100) # sudo requires the flag '-S' in order to take input from stdin for _ in range(1, 75): time.sleep(0.01) installer_progress.next() proc = Popen( script.split(), stdout=PIPE, stdin=PIPE, stderr=PIPE) # Popen only accepts byte-arrays so you must encode the string output, error = proc.communicate(password.encode()) if proc.returncode != 0: click.echo( click.style( '❎ Installation Failed... ❎', fg='red', blink=True, bold=True)) debug = click.prompt( 'Would you like us to debug the failed installation?[y/n]') if debug == 'y': debugger = Debugger() debugger.debug(password, error) logs = click.prompt( 'Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = error.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return else: logs = click.prompt( 'Would you like to see the logs?[y/n]', type=str) if logs == 'y': final_output = output.decode('utf-8') if final_output == '': click.echo('There were no logs found...') return else: click.echo(final_output) return return click.echo( click.style( f'\n\n 🎉 Successfully Installed {package_name}! 🎉 \n', fg='green', bold=True)) package_type = None if 'brew install' in script: package_type = 'p' elif 'brew cask install' in script: package_type = 'a' # Testing the successful installation of the package testing_bar = IncrementalBar('Testing package...', max=100) if tests_passed == [] and test_script == '': if package_type == 'a': file_exists = False if isfile(f'/Users/{getuser()}/config.tcc'): file_exists = True if file_exists: with open(f'/Users/{getuser()}/config.tcc', 'r') as file: lines = file.readlines() package_exists = False for line in lines: if get_key(package_name, applications_macos) in line: package_exists = True # The order for the package compatiblity numbers is # Linux, Windows, MacOS if package_exists == False: with open(f'/Users/{getuser()}/config.tcc', 'a+') as file: file.write( f'{get_key(package_name, applications_macos)} None {package_type} {0 if get_key(package_name, applications_linux)==-1 else 1} {0 if get_key(package_name, applications_windows)==-1 else 1} 1\n') click.echo('\n') click.echo( click.style( f'Test Passed: {package_name} Launch ✅\n', fg='green')) return for _ in range(1, 21): time.sleep(0.002) testing_bar.next() for _ in range(21, 60): time.sleep(0.002) testing_bar.next() proc = Popen( test_script.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE) package_type = None if 'brew install' in script: package_type = 'p' elif 'brew cask install' in script: package_type = 'a' if package_type == 'p': file_exists = False if isfile(f'/Users/{getuser()}/config.tcc'): file_exists = True proc = Popen(f'brew info {package_name}'.split( ), stdin=PIPE, stdout=PIPE, stderr=PIPE) stdout = proc.communicate() parsing = stdout[0].decode('utf-8') package_version = parse(parsing) if file_exists: with open(f'/Users/{getuser()}/config.tcc', 'r') as file: lines = file.readlines() line_exists = False for line in lines: if get_key(package_name, devpackages_macos) in line: line_exists = True # TODO : Implement versioning for macOS with open(f'/Users/{getuser()}/config.tcc', 'a+') as file: if line_exists == False: file.write( f'{get_key(package_name, applications_macos)} None {package_type} {0 if get_key(package_name, devpackages_linux)==-1 else 1} {0 if get_key(package_name, devpackages_windows)==-1 else 1} 1\n') for _ in range(60, 101): time.sleep(0.002) testing_bar.next() click.echo('\n') for test in tests_passed: click.echo( click.style( f'Test Passed: {test} ✅\n', fg='green')) except subprocess.CalledProcessError as e: click.echo(e.output) click.echo('An Error Occured During Installation...', err=True)
from Pong import Pong from SerialHandler import SerialHandler from Debugger import Debugger ser = SerialHandler('/dev/ttyAMA0', 115200) debugger = Debugger() game = Pong(ser, debugger) try: game.start(32, 30) except KeyboardInterrupt: game.cleanup()
def handle_movements(self, moving): """ Handles the movement interactions """ D.print('Called me with moving : {}'.format(moving), lvl=13, exclusive=True) new_map = [[0 for i in range(self.nb_cols)] for j in range(self.nb_lines)] leftovers = [] for agent in moving: a, b = agent.move D.print(" Agent at pos {} {} wants to move to {} {}".format( agent.x, agent.y, a, b), lvl=13, exclusive=True) D.print(" -> on the map, this cell is : <{}>".format(self[a, b]), lvl=13, exclusive=True) if not self[a, b]: # Moving to an empty cell in real world if new_map[a][b] and agent > new_map[a][b]: # case wanted D.print( 'Conflict over the cell {} {}\n Stronger agent (winning):\n--------------------' .format(a, b), lvl=17, exclusive=True) agent.informations() D.print('--------------------', lvl=17, exclusive=True) D.print(' Weaker agent (loosing):\n--------------------'. format(a, b), lvl=17, exclusive=True) new_map[a][b].informations() D.print('--------------------', lvl=17, exclusive=True) leftovers.append(new_map[a][b]) new_map[a][b] = agent # I'm stronger, taking the place elif new_map[a][b]: # I'm weaker D.print( 'Conflict over the cell {} {}\n Stronger agent (winning):\n--------------------' .format(a, b), lvl=17, exclusive=True) new_map[a][b].informations() D.print('--------------------', lvl=17, exclusive=True) D.print(' Weaker agent (loosing):\n--------------------'. format(a, b), lvl=17, exclusive=True) agent.informations() D.print('--------------------', lvl=17, exclusive=True) leftovers.append(agent) else: new_map[a][b] = agent elif agent > self[a, b]: # The real world cell is not empty for var in agent.vars.keys(): if var in self[a, b].vars.keys(): agent.vars[var][0] += self[a, b].vars[var][0] self[a, b].vars[var][0] = 0 else: for var in self[a, b].vars.keys(): if var in agent.vars.keys(): self[a, b].vars[var][0] += agent.vars[var][0] agent.vars[var][0] = 0 for i in range(self.nb_lines): for j in range(self.nb_cols): if new_map[i][j]: self[new_map[i][j].pos] = '' self[new_map[i][j].move] = new_map[i][j] new_map[i][j].pos = new_map[i][j].move if leftovers: self.handle_movements(leftovers)
def get_topic_info(self, topic_name): topic_info = self.get("/topic/" + topic_name) Debugger.printD("API : get_topic_info : info : " + str(type(topic_info.json())) + " " + str(topic_info.json())) return topic_info.json()