def printState( node, schedule ): if node.type() in [ 'Task' ]: st = Plan.project().data( node, 'Status', 'EditRole', schedule ) print "%-30s %-20s %20s" % ( Plan.project().data( node, 'Name', 'DisplayRole', schedule ), Plan.project().data( node, 'Status', 'DisplayRole', schedule ), state( int( st ) ) )
def showDataSelectionDialog(self, Plan ): tabledialog = self.forms.createDialog("Property List") tabledialog.setButtons("Ok|Cancel") tabledialog.setFaceType("List") #Auto Plain List Tree Tabbed schedulepage = tabledialog.addPage(T.i18n("Schedules"),T.i18n("Select schedule")) schedulewidget = Plan.createScheduleListView(schedulepage) sourcepage = tabledialog.addPage(T.i18n("Data"),T.i18n("Select data")) sourcewidget = Plan.createDataQueryView(sourcepage) savepage = tabledialog.addPage(T.i18n("Save"), T.i18n("Export ods file"),"document-save") self.savewidget = self.forms.createFileWidget(savepage, "kfiledialog:///csvexportsave") self.savewidget.setMode("Saving") self.savewidget.setFilter("*.csv|%(1)s\n*|%(2)s" % { '1' : T.i18n("Spreadsheet"), '2' : T.i18n("All Files") } ) if tabledialog.exec_loop(): schedule = schedulewidget.currentSchedule() props = sourcewidget.selectedProperties() #print "props: ", props ot = sourcewidget.objectType() #print "objectType: ", ot filename = self.savewidget.selectedFile() return [ot, schedule, props, sourcewidget.includeHeaders(), filename ] return None
def start(self): writer = Sheets.writer() Sheets.map().insertSheet("S1") currentSheet = Sheets.map().sheetByIndex(0) if not currentSheet: raise Exception, T.i18n("No current sheet.") if not writer.setSheet(currentSheet): raise Exception, T.i18n("Invalid sheet '%1' defined.", [currentSheet]) if not writer.setCell("A1"): raise Exception, T.i18n("Could not select cell 'A1'") proj = Plan.project() data = self.showDataSelectionDialog( writer, Plan ) if data is None: return if len(data) == 0: raise Exception, T.i18n("No data to export") filename = data[4] if not filename: raise Exception, T.i18n("You must select a file to write to") self.writeToSheets(writer, proj, data) if not Sheets.saveUrl(filename): raise Exception, T.i18n("Could not write to file:\n%1", [filename]) self.forms.showMessageBox("Information", T.i18n("Information"), T.i18n("Data saved to file:\n%1", [filename]))
def start(self): writer = Sheets.writer() Sheets.map().insertSheet("S1") currentSheet = Sheets.map().sheetByIndex(0) if not currentSheet: raise Exception, T.i18n("No current sheet.") if not writer.setSheet(currentSheet): raise Exception, T.i18n("Invalid sheet '%1' defined.", [currentSheet]) if not writer.setCell("A1"): raise Exception, T.i18n("Could not select cell 'A1'") proj = Plan.project() data = self.showDataSelectionDialog(writer, Plan) if data is None: return if len(data) == 0: raise Exception, T.i18n("No data to export") filename = data[4] if not filename: raise Exception, T.i18n("You must select a file to write to") self.writeToSheets(writer, proj, data) if not Sheets.saveUrl(filename): raise Exception, T.i18n("Could not write to file:\n%1", [filename]) self.forms.showMessageBox( "Information", T.i18n("Information"), T.i18n("Data saved to file:\n%1", [filename]))
def __init__(self, scriptaction): self.scriptaction = scriptaction self.proj = Plan.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog(T.i18n("Task Import")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed openpage = self.dialog.addPage(T.i18n("Open"), T.i18n("Tables Tasks"), "document-open") self.openwidget = self.forms.createFileWidget( openpage, "kfiledialog:///tablestaskimportopen") self.openwidget.setMode("Opening") self.openwidget.setFilter("*.ods|%(1)s\n*|%(2)s" % { '1': T.i18n("Tables"), '2': T.i18n("All Files") }) if self.dialog.exec_loop(): try: Plan.beginCommand(T.i18nc("(qtundoformat)", "Import tasks")) self.doImport(self.proj) Plan.endCommand() except: Plan.revertCommand() # in case partly loaded self.forms.showMessageBox( "Error", T.i18n("Error"), "%s" % "".join( traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
def __init__(self, scriptaction): self.scriptaction = scriptaction self.proj = Plan.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog(T.i18n("Resources Import")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed #TODO add options page ( import Calendars? Select calendars, Select resources... ) openpage = self.dialog.addPage(T.i18n("Open"),T.i18n("Plan Resources"),"document-open") self.openwidget = self.forms.createFileWidget(openpage, "kfiledialog:///kplatresourcesimportopen") self.openwidget.setMode("Opening") self.openwidget.setFilter("*.plan|%(1)s\n*|%(2)s" % { '1' : T.i18n("Plan"), '2' : T.i18n("All Files") } ) if self.dialog.exec_loop(): try: Plan.beginCommand( T.i18nc( "(qtundo_format )", "Import resources" ) ) self.doImport( self.proj ) Plan.endCommand() except: Plan.revertCommand() # play safe in case parts where loaded self.forms.showMessageBox("Error", T.i18n("Error"), "%s" % "".join( traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) ))
def doImport(self, project): filename = self.openwidget.selectedFile() if not os.path.isfile(filename): raise Exception, T.i18n("No file selected") Other = Plan.openDocument("Other", filename) if Other is None: self.forms.showMessageBox( "Sorry", T.i18n("Error"), T.i18n("Could not open document: %1", [filename])) return otherproj = Other.project() if otherproj is None: self.forms.showMessageBox("Sorry", T.i18n("Error"), T.i18n("No project to import from")) return if project.id() == otherproj.id(): self.forms.showMessageBox( "Sorry", T.i18n("Error"), T.i18n("Project identities are identical")) return for ci in range(otherproj.calendarCount()): self.doImportCalendar(project, otherproj.calendarAt(ci)) defcal = otherproj.defaultCalendar() if defcal is not None: dc = project.findCalendar(defcal.id()) if dc is not None: project.setDefaultCalendar(dc) for gi in range(otherproj.resourceGroupCount()): othergroup = otherproj.resourceGroupAt(gi) gr = project.findResourceGroup(othergroup.id()) if gr is None: gr = project.createResourceGroup(othergroup) if gr is None: self.forms.showMessageBox( "Sorry", T.i18n("Error"), T.i18n("Unable to create copy of resource group: %1", [othergroup.name()])) return for ri in range(othergroup.resourceCount()): otherresource = othergroup.resourceAt(ri) if otherresource is None: self.forms.showMessageBox( "Sorry", T.i18n("Error"), T.i18n("No resource to copy from")) return self.doImportResource(project, gr, otherresource)
def plan(): # create an ReedsShepp State space space = ob.ReedsSheppStateSpace(5) # set lower and upper bounds bounds = ob.RealVectorBounds(2) bounds.setLow(0) bounds.setHigh(100) space.setBounds(bounds) # create a simple setup object ss = og.SimpleSetup(space) ss.setStateValidityChecker(ob.StateValidityCheckerFn(isStateValid)) start = ob.State(space) start[0] = 10. start[1] = 90. goal = ob.State(space) goal[0] = 90. goal[1] = 10. ss.setStartAndGoalStates(start, goal, .05) # set the planner planner = RRT_Connect(ss.getSpaceInformation()) ss.setPlanner(planner) result = ss.solve(100.0) if result: if result.getStatus() == ob.PlannerStatus.APPROXIMATE_SOLUTION: print("Solution is approximate") # try to shorten the path # ss.simplifySolution() # print the simplified path path = ss.getSolutionPath() path.interpolate(100) #print(path.printAsMatrix()) path = path.printAsMatrix() plt.plot(start[0], start[1], 'g*') plt.plot(goal[0], goal[1], 'y*') Plan.plot_path(path, 'b-', 0, 100) plt.show()
def reproduce(self): for i in range(self.nb_reproduction): ' on prend une partie mère et une partie père pour reformer un plan' new_plan = Plan() mother = self.roulette_wheel_selection() father = self.roulette_wheel_selection() new_plan.create_from_parents(copy.deepcopy(mother), copy.deepcopy(father)) new_plan.correct_placement() self.list_plans.append(new_plan)
def __init__(self, scriptaction): self.scriptaction = scriptaction self.currentpath = self.scriptaction.currentPath() self.proj = Plan.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog(i18n("Busy Information Export")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed datapage = self.dialog.addPage(i18n("Schedules"), i18n("Export Selected Schedule"), "document-export") self.scheduleview = Plan.createScheduleListView(datapage) savepage = self.dialog.addPage(i18n("Save"), i18n("Export Busy Info File"), "document-save") self.savewidget = self.forms.createFileWidget( savepage, "kfiledialog:///kplatobusyinfoexportsave") self.savewidget.setMode("Saving") self.savewidget.setFilter("*.rbi|%(1)s\n*|%(2)s" % { '1': i18n("Resource Busy Information"), '2': i18n("All Files") }) if self.dialog.exec_loop(): try: self.doExport(self.proj) except: self.forms.showMessageBox( "Error", i18n("Error"), "%s" % "".join( traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
def __init__(self, scriptaction): self.scriptaction = scriptaction self.currentpath = self.scriptaction.currentPath() self.proj = Plan.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog(i18n("Busy Information Export")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed datapage = self.dialog.addPage(i18n("Schedules"),i18n("Export Selected Schedule"),"document-export") self.scheduleview = Plan.createScheduleListView(datapage) savepage = self.dialog.addPage(i18n("Save"),i18n("Export Busy Info File"),"document-save") self.savewidget = self.forms.createFileWidget(savepage, "kfiledialog:///kplatobusyinfoexportsave") self.savewidget.setMode("Saving") self.savewidget.setFilter("*.rbi|%(1)s\n*|%(2)s" % { '1' : i18n("Resource Busy Information"), '2' : i18n("All Files") } ) if self.dialog.exec_loop(): try: self.doExport( self.proj ) except: self.forms.showMessageBox("Error", i18n("Error"), "%s" % "".join( traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) ))
def get_output(self, packet): Data.process(self, packet) Plan.state(self) if self.state == "kickoff": Exec.kickoff(self) elif self.state == "plan": Plan.targets(self) Plan.path(self) self.plan_pads = [] Plan.convboost(self) #self.send_quick_chat(QuickChats.CHAT_EVERYONE, QuickChats.Reactions_Calculated) self.state = "exec" elif self.state == "exec": Exec.path(self) if len(self.guides) < 4 or dist2d(self.player.pos, self.guides[0]) > 200.0: self.state = "plan" #finding the size of the Rocket League window def callback(hwnd, win_rect): if "Rocket League" in win32gui.GetWindowText(hwnd): rect = win32gui.GetWindowRect(hwnd) win_rect[0] = rect[0] win_rect[1] = rect[1] win_rect[2] = rect[2] - rect[0] win_rect[3] = rect[3] - rect[1] self.RLwindow = [0] * 4 win32gui.EnumWindows(callback, self.RLwindow) #Rendering Render.path(self) Render.debug(self) Render.targets(self) Render.turn_circles(self) return self
def start(self): proj = Plan.project() data = self.showDataSelectionDialog( Plan ) if data is None: return if len(data) == 0: raise Exception, T.i18n("No data to export") filename = data[4] if not filename: raise Exception, T.i18n("You must select a file to write to") file = open(filename,'w') writer = csv.writer(file) self.write2csv(writer, proj, data) file.close() self.forms.showMessageBox("Information", T.i18n("Information"), T.i18n("Data saved to file:\n%1", [filename]))
def doImport( self, project ): filename = self.openwidget.selectedFile() if not os.path.isfile(filename): raise Exception, T.i18n("No file selected") Other = Plan.openDocument("Other", filename) if Other is None: self.forms.showMessageBox("Sorry", T.i18n("Error"), T.i18n("Could not open document: %1", [filename])) return otherproj = Other.project() if otherproj is None: self.forms.showMessageBox("Sorry", T.i18n("Error"), T.i18n("No project to import from")) return if project.id() == otherproj.id(): self.forms.showMessageBox("Sorry", T.i18n("Error"), T.i18n("Project identities are identical")) return for ci in range( otherproj.calendarCount() ): self.doImportCalendar( project, otherproj.calendarAt( ci ) ) defcal = otherproj.defaultCalendar() if defcal is not None: dc = project.findCalendar( defcal.id() ) if dc is not None: project.setDefaultCalendar( dc ) for gi in range( otherproj.resourceGroupCount() ): othergroup = otherproj.resourceGroupAt( gi ) gr = project.findResourceGroup( othergroup.id() ) if gr is None: gr = project.createResourceGroup( othergroup ) if gr is None: self.forms.showMessageBox("Sorry", T.i18n("Error"), T.i18n("Unable to create copy of resource group: %1", [othergroup.name()])) return for ri in range( othergroup.resourceCount() ): otherresource = othergroup.resourceAt( ri ) if otherresource is None: self.forms.showMessageBox("Sorry", T.i18n("Error"), T.i18n("No resource to copy from")) return self.doImportResource( project, gr, otherresource )
def pentest(): # while True: # print("test") # time.sleep(1) while True: with open(f"./Data/scanlist.json", "r") as r: data = json.load(r) for k, v in data.items(): if v["report"]: save_name = util.escapeurl(args.url) argsdict = { "url": v["url"], "save": save_name, "file": False, "lhost": args.lhost } if not argsdict["file"]: scan = Scan.scanner(dict) argsdict["file"] = scan.scan() data = Data_processing.data_processing(argsdict["file"]) exploit = Plan.Attacker(dict) exploit.start()
def macheMakroPlan(self): machbareBedarfe = [] for stadt in self.spielfeld.staedte: for bedarf in stadt.bedarfe: if self.bedarfMachbar(bedarf): machbareBedarfe.append(bedarf) plaene = [] for bedarf in machbareBedarfe: # print(bedarf, "(machbar)") for route in self.moeglicheRouten(bedarf): plan = Plan.Plan(self.spielfeld, route) plaene.append(plan) plaene.sort(key=lambda plan: plan.heuristischeBewertung(), reverse=True) if len(plaene) > 0: if self.debug: print("Makroplan für Spieler", self.spieler.name, ":", plaene[0]) return plaene[0] return None
def __init__(self, scriptaction): self.scriptaction = scriptaction self.proj = Plan.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog(T.i18n("Task Import")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed openpage = self.dialog.addPage(T.i18n("Open"),T.i18n("Tables Tasks"),"document-open") self.openwidget = self.forms.createFileWidget(openpage, "kfiledialog:///tablestaskimportopen") self.openwidget.setMode("Opening") self.openwidget.setFilter("*.ods|%(1)s\n*|%(2)s" % { '1' : T.i18n("Tables"), '2' : T.i18n("All Files") } ) if self.dialog.exec_loop(): try: Plan.beginCommand( T.i18nc( "(qtundoformat)", "Import tasks" ) ) self.doImport( self.proj ) Plan.endCommand() except: Plan.revertCommand() # in case partly loaded self.forms.showMessageBox("Error", T.i18n("Error"), "%s" % "".join( traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) ))
def __init__(self, scriptaction): self.scriptaction = scriptaction self.currentpath = self.scriptaction.currentPath() self.proj = Plan.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog( T.i18n("Busy Information Import")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed openpage = self.dialog.addPage(T.i18n("Open"), T.i18n("Import Busy Info File"), "document-open") self.openwidget = self.forms.createFileWidget( openpage, "kfiledialog:///kplatobusyinfoimportopen") self.openwidget.setMode("Opening") self.openwidget.setFilter("*.rbi|%(1)s\n*|%(2)s" % { '1': T.i18n("Resource Busy Information"), '2': T.i18n("All Files") }) if self.dialog.exec_loop(): try: Plan.beginCommand( T.i18nc("(qtundo_format)", "Import resource busy information")) self.doImport(self.proj) Plan.endCommand() except: Plan.revertCommand() self.forms.showMessageBox( "Error", T.i18n("Error"), "%s" % "".join( traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
def __init__(self, scriptaction): self.scriptaction = scriptaction self.currentpath = self.scriptaction.currentPath() self.proj = Plan.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog(T.i18n("Busy Information Import")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed openpage = self.dialog.addPage(T.i18n("Open"), T.i18n("Import Busy Info File"),"document-open") self.openwidget = self.forms.createFileWidget(openpage, "kfiledialog:///kplatobusyinfoimportopen") self.openwidget.setMode("Opening") self.openwidget.setFilter("*.rbi|%(1)s\n*|%(2)s" % { '1' : T.i18n("Resource Busy Information"), '2' : T.i18n("All Files") } ) if self.dialog.exec_loop(): try: Plan.beginCommand( T.i18nc("(qtundo_format)", "Import resource busy information") ) self.doImport( self.proj ) Plan.endCommand() except: Plan.revertCommand() self.forms.showMessageBox("Error", T.i18n("Error"), "%s" % "".join( traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) ))
def __init__(self, scriptaction): self.scriptaction = scriptaction self.proj = Plan.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog(T.i18n("Resources Import")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed #TODO add options page ( import Calendars? Select calendars, Select resources... ) openpage = self.dialog.addPage(T.i18n("Open"), T.i18n("Plan Resources"), "document-open") self.openwidget = self.forms.createFileWidget( openpage, "kfiledialog:///kplatresourcesimportopen") self.openwidget.setMode("Opening") self.openwidget.setFilter("*.plan|%(1)s\n*|%(2)s" % { '1': T.i18n("Plan"), '2': T.i18n("All Files") }) if self.dialog.exec_loop(): try: Plan.beginCommand( T.i18nc("(qtundo_format )", "Import resources")) self.doImport(self.proj) Plan.endCommand() except: Plan.revertCommand() # play safe in case parts where loaded self.forms.showMessageBox( "Error", T.i18n("Error"), "%s" % "".join( traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
def printGroup(group, props): for prop in props: print "%-25s" % (Plan.project().data(group, prop)), print for i in range(group.resourceCount()): printResource(group.resourceAt(i), props)
#Robo Main Robo=True from Scanner import * from Encoder import * import Kompass from Karte import * from Plan import * from Motor import * karte=Karte() navigation=Navigation() scanner=Scanner() plan=Plan(karte,navigation) encoder=Encoder() motor=Motor() ThreadScanAllTime=Thread(target=scanner.runAllTime, args=(1,)) ThreadScanAllTime.daemon=True ThreadScanAllTime.start() ThreadEncoder=Thread(target=encoder.runAllTime,args=()) ThreadEncoder.daemon=True ThreadEncoder.start() while Robo==True: obstacles=scanner.getNewDistValues() karte.updateObstacles(obstacles)
def printBusyinfo(res, lst): name = Plan.project().data(res, 'Name') for interval in lst: print "%-20s %-30s %-30s %8s" % (name, interval[0], interval[1], interval[2]) name = ""
#!/usr/bin/env kross # -*- coding: utf-8 -*- import traceback import Kross import Plan import TestResult TestResult.setResult( True ) asserttext1 = "Test of property '{0}' failed:\n Expected: '{2}'\n Result: '{1}'" asserttext2 = "Failed to set property '{0}' to '{1}'. Result: {2}" try: project = Plan.project() assert project is not None account = project.createAccount( 0 ) assert account is not None, "Could not create account" property = 'Name' data = "Account name" res = project.setData(account, property, data) text = asserttext2.format(property, data, res) assert res == 'Success', text property = 'Description' data = "Account description" res = project.setData(account, property, data) text = asserttext2.format(property, data, res) assert res == 'Success', text
#!/usr/bin/env kross # -*- coding: utf-8 -*- import os, datetime, sys, traceback, pickle import Kross, Plan T = Kross.module("kdetranslation") # TODO some ui Plan.beginCommand(T.i18nc("(qtundoformat)", "Clear all external appointments")) Plan.project().clearExternalAppointments() Plan.endCommand()
def printNode( node, props, schedule, types = None ): if types is None or node.type() in types: for prop in props: print "%-25s" % ( Plan.project().data( node, prop[0], prop[1], schedule ) ), print
import Kompass from Karte import * from Plan import * from Motor import * from Grid import * import sys import atexit count = 1 speed = 0 steer = 0 encoder = Encoder() navigation = Navigation() scanner = Scanner() karte = Karte(encoder) plan = Plan() kreis = 0 motor = Motor() grid = Grid(50, 50) grid.setZielInGrid(15, 49) grid.setStartInGrid(15, 1) karte.setRoboPosZero(150, 150) def cleaning(): """Do cleanup at end, command are visVersa""" motor.setCommand(0, 0) atexit.register(cleaning)
def printState(node, schedule): if node.type() in ['Task']: st = Plan.project().data(node, 'Status', 'EditRole', schedule) print "%-30s %-20s %20s" % (Plan.project().data( node, 'Name', 'DisplayRole', schedule), Plan.project().data( node, 'Status', 'DisplayRole', schedule), state(int(st)))
def __init__(self, scriptaction): proj = Plan.project() self.check( proj)
#!/usr/bin/env kross # -*- coding: utf-8 -*- import os, datetime, sys, traceback, pickle import Kross, Plan T = Kross.module("kdetranslation") #TODO some ui Plan.beginCommand(T.i18nc("(qtundoformat)", "Clear all external appointments")) Plan.project().clearExternalAppointments() Plan.endCommand()
import atexit import os import profile from Loggerli import * count=1 speed=0 steer=0 timer=0 deltaL=0 deltaR=0 encoder=Encoder() navigation=Navigation() scanner=Scanner() karte=Karte(encoder) plan=Plan() motor_pwm=MotorPWM() grid=Grid(220,220) logic=Logic() manuell=Manuell() json=Json() weggeber=Weggeber(motor_pwm) loops =0 grid.setZielInGrid(900,900) grid.setStartInGrid(0,0) karte.setRoboPosZero(0,0) logic.setGlobalZiel(0,0) ziellist =[[2800,0],[2800,2800],[0,2800],[0,0]] plan.init_generator_ziel(ziellist) filename_enviroment = "Weg"
import atexit import os import profile count=1 speed=0 steer=0 timer=0 deltaL=0 deltaR=0 encoder=Encoder() navigation=Navigation() scanner=Scanner() karte=Karte(encoder) plan=Plan() kreis=0 motor=Motor() grid=Grid(50,50) logic=Logic() manuell=Manuell() json=Json() weggeber=Weggeber() grid.setZielInGrid(35,20) grid.setStartInGrid(1,1) karte.setRoboPosZero(0,0) plan.setGlobalZiel(150,0) def cleaning(): """Do cleanup at end, command are visVersa"""
#!/usr/bin/env kross # -*- coding: utf-8 -*- import traceback import Kross import Plan import TestResult TestResult.setResult(True) asserttext = "Test of property '{0}' failed:\n Expected: '{2}'\n Result: '{1}'" asserttext2 = "Failed to set property '{0}' to '{1}'. Result: {2}" try: project = Plan.project() assert project is not None account = project.createAccount(0) assert account is not None, "Could not create account" property = 'Name' data = "Account name" before = account.name() Plan.beginCommand("Set data") res = project.setData(account, property, data) text = asserttext2.format(property, data, res) assert res == 'Success', text result = account.name() text = asserttext.format(property, result, data) assert result == data, text Plan.revertCommand() result = account.name()
def _useAttributes( self, attributes ): if "avatar_url" in attributes: # pragma no branch assert attributes[ "avatar_url" ] is None or isinstance( attributes[ "avatar_url" ], ( str, unicode ) ), attributes[ "avatar_url" ] self._avatar_url = attributes[ "avatar_url" ] if "bio" in attributes: # pragma no branch assert attributes[ "bio" ] is None or isinstance( attributes[ "bio" ], ( str, unicode ) ), attributes[ "bio" ] self._bio = attributes[ "bio" ] if "blog" in attributes: # pragma no branch assert attributes[ "blog" ] is None or isinstance( attributes[ "blog" ], ( str, unicode ) ), attributes[ "blog" ] self._blog = attributes[ "blog" ] if "collaborators" in attributes: # pragma no branch assert attributes[ "collaborators" ] is None or isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ] self._collaborators = attributes[ "collaborators" ] if "company" in attributes: # pragma no branch assert attributes[ "company" ] is None or isinstance( attributes[ "company" ], ( str, unicode ) ), attributes[ "company" ] self._company = attributes[ "company" ] if "contributions" in attributes: # pragma no branch assert attributes[ "contributions" ] is None or isinstance( attributes[ "contributions" ], int ), attributes[ "contributions" ] self._contributions = attributes[ "contributions" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) if "disk_usage" in attributes: # pragma no branch assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ] self._disk_usage = attributes[ "disk_usage" ] if "email" in attributes: # pragma no branch assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ] self._email = attributes[ "email" ] if "followers" in attributes: # pragma no branch assert attributes[ "followers" ] is None or isinstance( attributes[ "followers" ], int ), attributes[ "followers" ] self._followers = attributes[ "followers" ] if "following" in attributes: # pragma no branch assert attributes[ "following" ] is None or isinstance( attributes[ "following" ], int ), attributes[ "following" ] self._following = attributes[ "following" ] if "gravatar_id" in attributes: # pragma no branch assert attributes[ "gravatar_id" ] is None or isinstance( attributes[ "gravatar_id" ], ( str, unicode ) ), attributes[ "gravatar_id" ] self._gravatar_id = attributes[ "gravatar_id" ] if "hireable" in attributes: # pragma no branch assert attributes[ "hireable" ] is None or isinstance( attributes[ "hireable" ], bool ), attributes[ "hireable" ] self._hireable = attributes[ "hireable" ] if "html_url" in attributes: # pragma no branch assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] self._html_url = attributes[ "html_url" ] if "id" in attributes: # pragma no branch assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] self._id = attributes[ "id" ] if "location" in attributes: # pragma no branch assert attributes[ "location" ] is None or isinstance( attributes[ "location" ], ( str, unicode ) ), attributes[ "location" ] self._location = attributes[ "location" ] if "login" in attributes: # pragma no branch assert attributes[ "login" ] is None or isinstance( attributes[ "login" ], ( str, unicode ) ), attributes[ "login" ] self._login = attributes[ "login" ] if "name" in attributes: # pragma no branch assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] self._name = attributes[ "name" ] if "owned_private_repos" in attributes: # pragma no branch assert attributes[ "owned_private_repos" ] is None or isinstance( attributes[ "owned_private_repos" ], int ), attributes[ "owned_private_repos" ] self._owned_private_repos = attributes[ "owned_private_repos" ] if "plan" in attributes: # pragma no branch assert attributes[ "plan" ] is None or isinstance( attributes[ "plan" ], dict ), attributes[ "plan" ] self._plan = None if attributes[ "plan" ] is None else Plan.Plan( self._requester, attributes[ "plan" ], completed = False ) if "private_gists" in attributes: # pragma no branch assert attributes[ "private_gists" ] is None or isinstance( attributes[ "private_gists" ], int ), attributes[ "private_gists" ] self._private_gists = attributes[ "private_gists" ] if "public_gists" in attributes: # pragma no branch assert attributes[ "public_gists" ] is None or isinstance( attributes[ "public_gists" ], int ), attributes[ "public_gists" ] self._public_gists = attributes[ "public_gists" ] if "public_repos" in attributes: # pragma no branch assert attributes[ "public_repos" ] is None or isinstance( attributes[ "public_repos" ], int ), attributes[ "public_repos" ] self._public_repos = attributes[ "public_repos" ] if "total_private_repos" in attributes: # pragma no branch assert attributes[ "total_private_repos" ] is None or isinstance( attributes[ "total_private_repos" ], int ), attributes[ "total_private_repos" ] self._total_private_repos = attributes[ "total_private_repos" ] if "type" in attributes: # pragma no branch assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ] self._type = attributes[ "type" ] if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ]
def printBusyinfo( res, lst ): name = Plan.project().data( res, 'Name' ) for interval in lst: print "%-20s %-30s %-30s %8s" % ( name, interval[0], interval[1], interval[2] ) name = ""
parser.add_argument('--file', '-F', help='Start to exploit with existing scan results', default=False) parser.add_argument('--lhost', '-L', required=True, help='Set the local host for exploit') args = parser.parse_args() save_name = util.escapeurl(args.url) argsdict = { "url": args.url, "save": save_name, "cookie": args.cookie, "include": args.include, "exclude": args.exclude, "file": args.file, "lhost": args.lhost } print(framworkascii) # print(argsdict) if not argsdict["file"]: scan = Scan.scanner(argsdict) argsdict["file"] = scan.scan() data = Data_processing.data_processing(argsdict["file"]) exploit = Plan.Attacker(argsdict) exploit.start()
# We're planning in [0,N]x[0,N], a subset of R^2. space = ob.RealVectorStateSpace(2) # Set the bound of space to be in [0,N]. space.setBounds(0.0, N) # Set our robot's starting state to be random start = ob.State(space) start[0], start[1] = random.randint(0, N / 2), random.randint(0, N / 2) while not isStateValid(start): start[0], start[1] = random.randint(0, N / 2), random.randint(0, N / 2) # Set our robot's goal state to be random goal = ob.State(space) goal[0], goal[1] = random.randint(N / 2, N), random.randint(N / 2, N) while not isStateValid(goal): goal[0], goal[1] = random.randint(N / 2, N), random.randint(N / 2, N) Path = plan(5, 'RRT', 'path.txt', space, start, goal) Plan.plot_path(Path, 'ro-', 0, N) Path = plan(600, 'Astar', 'path2.txt', space, start, goal) if Path: Plan.plot_path(Path, 'bo-', 0, N) plt.plot(start[0], start[1], 'g*') plt.plot(goal[0], goal[1], 'y*') plt.legend(('RRT', 'A*')) circle1 = plt.Circle(center, radius, color='k') plt.gcf().gca().add_artist(circle1) plt.show()
def printTaskEffortCost( parent ): for i in range( parent.childCount() ): node = parent.childAt( i ) name = Plan.project().data( node, 'Name' ) printEffortCost( name, node.plannedEffortCostPrDay( "2007-09-12", "2007-09-18", sid ) )
for interval in lst: print "%-20s %-30s %-30s %8s %s" % ( name, interval[0], interval[1], interval[2], interval[3] ) name = "" def printProjectCalendars( proj ): for c in range( proj.calendarCount() ): printChildCalendars( proj.calendarAt ( c ) ) def printChildCalendars( calendar ): print calendar.name() for c in range( calendar.childCount() ): printChildCalendars( calendar.childAt ( c ) ) #------------------------ proj = Plan.project() sid = -1; # get a schedule id if proj.scheduleCount() > 0: sid = proj.scheduleAt( 0 ).id() print "Using schedule id: %-3s" % ( sid ) print nodeprops = [['NodeWBSCode', 'DisplayRole'], ['NodeName', 'DisplayRole'], ['NodeType', 'DisplayRole'], ['NodeResponsible', 'DisplayRole'], ['NodeStatus', 'EditRole'] ] print "Print tasks and milestones in arbitrary order:" # print the localized headers ### for prop in nodeprops: ### print "%-25s" % (proj.nodeHeaderData( prop ) ), ### print
print "%-35s %s" % ("Identity", "Name") for c in projects: print "%-35s %s" % (c[0], c[1]) def printTaskEffortCost(parent): for i in range(parent.childCount()): node = parent.childAt(i) name = Plan.project().data(node, 'Name') printEffortCost( name, node.plannedEffortCostPrDay("2007-09-12", "2007-09-18", sid)) #------------------------ proj = Plan.project() sid = -1 # get a schedule id if proj.scheduleCount() > 0: sid = proj.scheduleAt(0).id() print "Using schedule id: %-3s" % (sid) print nodeprops = [['WBSCode', 'DisplayRole'], ['Name', 'DisplayRole'], ['Type', 'DisplayRole'], ['Responsible', 'DisplayRole'], ['Status', 'EditRole']] print "Print tasks and milestones in arbitrary order:" # print the localized headers for prop in nodeprops:
def printResource( resource, props ): for prop in props: print "%-25s" % ( Plan.project().data( resource, prop ) ), print
def printTaskEffortCost(parent): for i in range(parent.childCount()): node = parent.childAt(i) name = Plan.project().data(node, 'Name') printEffortCost( name, node.plannedEffortCostPrDay("2007-09-12", "2007-09-18", sid))
def printGroup( group, props ): for prop in props: print "%-25s" % ( Plan.project().data( group, prop ) ), print for i in range( group.resourceCount() ): printResource( group.resourceAt( i ), props )
def printNode(node, props, schedule, types=None): if types is None or node.type() in types: for prop in props: print "%-25s" % (Plan.project().data(node, prop[0], prop[1], schedule)), print
import Kompass from Karte import * from Plan import * from Motor import * from Grid import * import sys import atexit count=1 speed=0 steer=0 encoder=Encoder() navigation=Navigation() scanner=Scanner() karte=Karte(encoder) plan=Plan() kreis=0 motor=Motor() grid=Grid(50,50) grid.setZielInGrid(15,49) grid.setStartInGrid(15,1) karte.setRoboPosZero(150,150) def cleaning(): """Do cleanup at end, command are visVersa""" motor.setCommand(0,0) atexit.register(cleaning) ThreadScanAllTime=Thread(target=scanner.runAllTime, args=(1,))
def printResource(resource, props): for prop in props: print "%-25s" % (Plan.project().data(resource, prop)), print
def __init__(self, app=None, plan=None, *args, **kwargs): super().__init__(*args, **kwargs) self.plan = ResearchPlan.Plan() self._init_gui()
#!/usr/bin/env kross # -*- coding: utf-8 -*- import traceback import Kross import Plan import TestResult TestResult.setResult( True ) asserttext = "Test of property '{0}' failed:\n Expected: '{2}'\n Result: '{1}'" asserttext2 = "Failed to set property '{0}' to '{1}'. Result: {2}" try: project = Plan.project() assert project is not None property = 'Name' data = "Project name" before = project.name() Plan.beginCommand( "Set data" ); res = project.setData(project, property, data) text = asserttext2.format(property, data, res) assert res == 'Success', text result = project.name() text = asserttext.format(property, result, data) assert result == data, text Plan.revertCommand() result = project.name() text = asserttext.format(property, result, before) assert result == before, text
if len(projects) % 2 == 1: print "Illegal id/name pair in list: %s" % projects return print "%-35s %s" % ( "Identity", "Name" ) for c in projects: print "%-35s %s" % ( c[0], c[1] ) def printTaskEffortCost( parent ): for i in range( parent.childCount() ): node = parent.childAt( i ) name = Plan.project().data( node, 'Name' ) printEffortCost( name, node.plannedEffortCostPrDay( "2007-09-12", "2007-09-18", sid ) ) #------------------------ proj = Plan.project() sid = -1; # get a schedule id if proj.scheduleCount() > 0: sid = proj.scheduleAt( 0 ).id() print "Using schedule id: %-3s" % ( sid ) print nodeprops = [['WBSCode', 'DisplayRole'], ['Name', 'DisplayRole'], ['Type', 'DisplayRole'], ['Responsible', 'DisplayRole'], ['Status', 'EditRole'] ] print "Print tasks and milestones in arbitrary order:" # print the localized headers for prop in nodeprops: print "%-25s" % (proj.taskHeaderData( prop ) ), print