def New(self): self.project = Project() self.canvas.setData(self.project.resources) self.virtualLinksEditor.setProject(self.project) self.dataFlowsEditor.setProject(self.project) self.projectFile = None self.setWindowTitle(self.tr("Untitled") + " - " + self.basename)
def guiInfo(self, workspace_name, path, project_name, desc, layout, getter): project = Project() if (workspace_name != None): if (path != None): w1.setPath(path) w1.setName(workspace_name) Workspace.current = w1 else: print("Invalid1") return elif (project_name != None): if (desc != None): project.setName(project_name) project.setDesc(desc) project.createProject() Project.current = project else: project.loadProject(project_name) return #elif(layout != None): # Project.getLayout() else: if (getter == 0): print "check " + w1.getPath() elif (getter == 1): w1.getName() elif (getter == 2): a = w1.get_projects_lists() return a #elif(getter == 3): # Project.getDesc() else: print("Invalid3") return
def test_addTwoFilesAddsOnlyNewIncludesTwoObjectFile(self): p = Project(None, None, None) parser = CompilerParser(None) ret = ['system/media/audio/include', 'hardware/libhardware/include', 'hardware/libhardware_legacy/include', 'hardware/ril/include', 'libnativehelper/include', 'frameworks/native/include', 'frameworks/native/opengl/include', 'frameworks/av/include', 'frameworks/base/include', 'out/target/product/maxwell10/obj/include', 'device/fsl/common/kernel-headers', 'bionic/libc/arch-arm/include', 'bionic/libc/include', 'bionic/libc/kernel/uapi', 'bionic/libc/kernel/common', 'bionic/libc/kernel/uapi/asm-arm', 'bionic/libm/include', 'bionic/libm/include/arm'] p.addFile(parser.parseLine(object1)) p.addFile(parser.parseLine(object2)) self.assertEqual(ret, p.globalSystemIncludes) self.assertEqual(1, len(p.objectFiles)) self.assertTrue('bionic/libm/include/arm2' in p.objectFiles[0].systemIncludes)
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "At the start of your turn, trash a card from your hand." self.name = "Cathedral" self.cost = 3
def adminProjectsMoveSprintsPost(handler, id, p_newproject, p_sprintid = None): handler.title('Move Sprints') requirePriv(handler, 'Admin') project = Project.load(int(id)) if not project: ErrorBox.die('Invalid Project', "No project with ID <b>%d</b>" % int(id)) p_newproject = to_int(p_newproject, 'newproject', ErrorBox.die) target = Project.load(p_newproject) if not p_sprintid: delay(handler, WarningBox("No sprints to move", close = True)) redirect("/admin/projects/%d" % project.id) sprintids = [to_int(id, 'sprintid', ErrorBox.die) for id in p_sprintid] sprints = [Sprint.load(id) for id in sprintids] if not all(sprints): ErrorBox.die("Invalid sprint ID(s)") for sprint in sprints: sprint.project = target sprint.save() delay(handler, SuccessBox("%s moved" % pluralize(len(sprints), 'sprint', 'sprints'), close = True)) redirect("/admin/projects/%d" % project.id)
def main(): p = Project() # p.download_data() # p.load_data_to_hdfs() # p.load_data_to_hive() p.MLP_classifier()
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "At the start of your turn, +1 Action." self.name = "Barracks" self.cost = 6
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "At the end of your Buy phase, if you didn't buy any cards, +1 Coffers and +1 Villager." self.name = "Exploration" self.cost = 4
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "When another player gains a Victory card, +1 Card." self.name = "Road Network" self.cost = 5
def test_getGradle(self): p = Project(26, 22, "../../") self.assertEqual("""apply plugin: 'com.android.application' android { compileSdkVersion 26 defaultConfig { minSdkVersion 22 targetSdkVersion 22 externalNativeBuild { cmake { cppFlags "-std=c++11" arguments "-DAOSP=../../" } } } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' } } externalNativeBuild { cmake { path "CMakeLists.txt" } } }""", p.getGradle())
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "At the start of your turn, +1 Card, then put a card from your hand onto your deck." self.name = "City Gate" self.cost = 3
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "When you gain an Action card, +1 Villager." self.name = "Academy" self.cost = 5
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "The first time you gain an Action card in each of your turns, you may set it aside. If you do, play it." self.name = "Innovation" self.cost = 6
def get_project_and_check_arguments(argv, script_name, num_times_negative_data_is_taken=None): if len(argv) not in [2, 3]: sys.exit("Usage: python3 " + script_name + " <project_name_PWM_name> [<k=None> or <normal_sigma] \n") k = None sigma = None is_normal_distribution = False project_name = argv[1] if len(argv) == 3: if argv[2].isdigit(): k = int(argv[2]) print("k = ", k) else: is_normal_distribution = bool(argv[2]) # this is True sigma = int(argv[2].split("_")[1]) base_path_projects = base_path[:-len("CNN/")] if k: project = Project(project_name, base_path_projects, k=k) else: project = Project( project_name, base_path_projects, normal_distribution=is_normal_distribution, sigma=sigma, num_times_negative_data_is_taken=num_times_negative_data_is_taken) return project
def find_public_methods(): """ retrieves all public methods of class """ try: fname=lisp.buffer_file_name() print "remember:" + lisp.buffer_name() os.environ['BUFFER'] = lisp.buffer_name() project = Project(fname) thing, start = thing_at_point(RIGHT3, LEFT3) thing = thing.replace(".","") print "thing:"+thing pos = lisp.point() type, foundpos = project.find_declaration_type(thing, fname, pos) typefile = project.find_file_for_thing(type, fname) c = Class(project, typefile) public_methods = c.list_all_public() if (len(public_methods) == 0): lisp.message("No public methods found") else: ready_output() lisp.insert("\n") for item in public_methods: lisp.insert(item) lisp.insert("\n") except Exception, e: lisp.message(e)
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "At the start of your turn, you may discard a Victory card for +2 Cards." self.name = "Crop Rotation" self.cost = 6
def find_imports(): print "test hello" fname=lisp.buffer_file_name() print "remember:" + lisp.buffer_name() os.environ['BUFFER'] = lisp.buffer_name() remember_where = lisp.point() try: fname=lisp.buffer_file_name() project = Project(fname) thing, start = thing_at_point_regex("\W", "\W") print "thing:"+thing imports = project.find_file_for_import(thing) if (len(imports) > 1): ready_output() lisp.insert("\n") for item in imports: lisp.insert(item) lisp.insert("\n") elif (len(imports) == 1): put_import(fname, imports[0]) elif (len(imports) == 0): lisp.message("No import found for " + imports[0]) lisp.goto_char(remember_where) except Exception, e: lisp.message(e)
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "When you shuffle, you may pick one of the cards to go on top." self.name = "Star Chart" self.cost = 3
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "At the start of your turn, reveal the top card of your deck. If it's an Action, play it." self.name = "Piazza" self.cost = 5
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "The first time you play an Action card during each of your turns, play it again afterward." self.name = "Citadel" self.cost = 8
def test_calculate_new_keywords(self): mock_db = riak.RiakClient() mock_bucket = mock_db.bucket("message") project = Project("Sample", ["test1", "test2", ], mock_bucket) def sample_algorithm(keyword_counts, total): return [k for (k,v) in keyword_counts.iteritems() if v / total >= 1] self.assertEqual(project.calculate_new_keywords(sample_algorithm), ["test1", "test2",])
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "When you gain a Treasure, +1 Coffers." self.name = "Guildhall" self.cost = 5
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "At the end of your Buy phase, you may pay 1 Coin for +1 Coffers." self.name = "Pageant" self.cost = 3
def newProject( choice ): if ( choice == '1' or choice == 'cablebay') : project = Project() project.name = Constant.CableBay else : myprint( 'no such project, system exit' ) exit() return project
def __init__(self): Project.__init__(self) self.cardtype = 'project' self.base = 'renaissance' self.desc = "At the start of your turn, add a token here, or remove your tokens here for +1 Card each." self.name = "Sinister Plot" self.cost = 4 self._token = defaultdict(int)
def adminProjectsManage(handler, id): handler.title('Manage Project') requirePriv(handler, 'Admin') project = Project.load(int(id)) if not project: ErrorBox.die('Invalid Project', "No project with ID <b>%d</b>" % int(id)) undelay(handler) sprints = project.getSprints() otherProjects = sorted((p for p in Project.loadAll() if p != project), key = lambda p: p.name) for sprint in sprints: if 'deleted' in sprint.flags: print "<form method=\"post\" action=\"/admin/projects/%d/cancel-deletion/%d\">" % (project.id, sprint.id) print WarningBox("%s is flagged for deletion during nightly cleanup. %s" % (sprint.link(handler.session['user']), Button('Cancel').mini().post())) print "</form>" print "<a name=\"sprints\"></a>" print "<h3>Sprints</h3>" if len(sprints) > 0: print "<form method=\"post\" action=\"/admin/projects/%d/sprints\">" % project.id for sprint in sprints: print "<input type=\"checkbox\" name=\"sprintid[]\" value=\"%d\"> %s<br>" % (sprint.id, sprint.link(handler.session['user'])) print "<br>" print "Move to project: <select name=\"newproject\">" for p in otherProjects: print "<option value=\"%d\">%s</option>" % (p.id, p.safe.name) print "</select>" print Button('Move').post('move').positive() print "<br><br>" print "Delete sprints (irreversible once finalized):" print Button('Delete').post('delete').negative() print "</form>" else: print "No sprints" print "<a name=\"rename\"></a>" print "<h3>Rename</h3>" print "<form method=\"post\" action=\"/admin/projects/%d/edit\">" % project.id print "Name: <input type=\"text\" name=\"name\" value=\"%s\">" % project.safe.name print Button('Rename', type = 'submit').positive() print "</form>" print "<a name=\"delete\"></a>" print "<h3>Delete</h3>" print "<form method=\"post\" action=\"/admin/projects/%d/delete\">" % project.id if len(project.getSprints()) > 0: if len(otherProjects) > 0: print "Delete <b>%s</b> and move all sprints to <select name=\"newproject\">" % project.safe.name for p in otherProjects: print "<option value=\"%d\">%s</option>" % (p.id, p.safe.name) print "</select>" print Button('Delete', type = 'submit').negative() else: print "Unable to remove the only project if it has sprints" else: print Button("Delete %s" % project.safe.name, type = 'submit').negative() print "</form><br>"
def val_transform(arch: str): if arch == "resnet": return T.Compose([ T.Resize((Project().input_width, Project().input_height)), T.Grayscale(), T.ToTensor() ]) elif arch == "xception": return T.Compose([T.Resize((129, 129)), T.Grayscale(), T.ToTensor()])
def create_a_project(): global project_counter_id if not "name" in request.json: abort(400) project_counter_id += 1 name = request.json.get("name") project = Project(project_counter_id, name) projects.append(project) projects_json = [project.to_json() for project in projects] return jsonify({"projects": projects_json})
def openProject(self, pathToProject): try: project = Project() project.open(pathToProject) except ProjectOpenError: logging.error("Can't open project " + pathToProject) raise Exception("Can't open project " + pathToProject) self._currentProject = project
def find_file_at_symbol(): """ finds file at point """ fname=lisp.buffer_file_name() a = Project(fname) thing, start = thing_at_point(RIGHT1, LEFT1) file = a.find_file_for_thing(thing, fname) lisp.message(file) lisp.find_file(file)
def readFile(self, file): # open file f = open(file, "r") # create project obj p = Project() # for each line in the file for line in f.readlines(): # split by the ":" split = line.split(":") # assign attributes if split[0] == "ProjectName": p.projectName = split[1] elif split[0] == "LastWorkedOn": p.lastWorkedOn = split[1] elif split[0] == "Path": p.projectPath = split[1] p.gitLog = self.getLogFile(p.projectPath) elif split[0] == "Description": p.projectDescription = split[1] elif split[0] == "WhereDidILeaveIt": p.whereDidILeaveIt = split[1] elif split[0] == "NextSteps": p.nextSteps = split[1] # close the file! f.close() # return created project return p
def goto_definition(): """ go to definition/declaration of the pointer we are looking at """ fname=lisp.buffer_file_name() a = Project(fname) thing, start = thing_at_point(RIGHT1, LEFT1) lisp.message(thing) pos = lisp.point() type, pos = a.find_declaration_type(thing, fname, pos) lisp.goto_char(pos)
def get_project(self, project_key, username): with dbapi2.connect(self.dbfile) as connection: cursor = connection.cursor() query = "SELECT number_of_project,project_weight,project_score1,project_score2,is_important FROM projects WHERE (id = %s AND username=%s)" cursor.execute(query, (project_key, username)) number_of_project, project_weight, project_score1, project_score2, is_important = cursor.fetchone( ) project_ = Project(number_of_project, project_weight, is_important, project_key) project_.project_score[0] = project_score1 project_.project_score[1] = project_score2 return project_
def addProject(self, name, projectDir): newProject = Project() newProject.setName(name) newProject.setDir(projectDir) topItem = QtWidgets.QTreeWidgetItem(self.projectsTreeWidget) topItem.setText(0, newProject.getName()) topItem.setText(1, newProject.getDir()) newProject.setQtTopItem(topItem) self.projectMap[name] = newProject return self.projectMap[name]
def adminProjectsPost(handler, p_name): handler.title('Project Management') requirePriv(handler, 'Admin') if Project.load(name = p_name): ErrorBox.die('Add Project', "There is already a project named <b>%s</b>" % stripTags(p_name)) project = Project(p_name) project.save() delay(handler, SuccessBox("Added project <b>%s</b>" % stripTags(p_name), close = True)) Event.newProject(handler, project) redirect('/')
def analyse(): data = request.get_json() git_url = data['git_repo'] project_id = str(uuid.uuid1()) repo_dir = "./projects/" + project_id Repo.clone_from(git_url, repo_dir) project = Project(repo_dir) project.analyse() result = Result(project) output = json.dumps(result.__dict__) return output
def find_descendants(): """ retrieves descendants of class at point by running a Unix find. simple huh? """ fname=lisp.buffer_file_name() a = Project(fname) thing, start = thing_at_point(RIGHT1, LEFT1) descs = a.find_all_descendants(thing) ready_output() for item in descs: lisp.insert(item)
def OpenProjectFromFile(self, name): loadProject = Project() #try: loadProject.Load(name) #except: # TODO: proper exceptioning # QMessageBox.critical(self, self.tr("An error occured"), self.tr("File is not a valid project file: ") + name) # return self.project = loadProject self.projectFile = name self.canvas.setData(self.project.resources) self.setWindowTitle(self.project.name + " - " + self.basename)
def addNewProject(self, projectName, productName, creator, comments): if projectName: self.project = Project(Project_Name=projectName, Product_Name=productName, Creator=creator, Comments=comments) self.root.title("CECS 543 Metrics Suite - " + projectName) else: self.project = Project(Project_Name="untitled", Product_Name=productName, Creator=creator, Comments=comments) self.root.title("CECS 543 Metrics Suite - " + "untitled")
def __init__(self): super(self.__class__, self).__init__() self.setupUi(self) fileMenu = self.actionImport_SnP newProject = self.actionNew_Project #Initialize sample sample Table self.sampleTable.setColumnCount(4) self.sampleTable.setHorizontalHeaderLabels( [None, "Name", "Date", "Limit"]) self.sampleTable.setSortingEnabled(True) self.sampleTable.setContextMenuPolicy(self.CustomContextMenu) self.sampleTable.customContextMenuRequested.connect( self.tableContextMenu) self.selected = [] #Initialize Tab widget for sample info #self.sampleTable.customContextMenuRequested.connect(self.tableContextMenu) #New Project self.Project = Project() #Initialize plot parameters self.activeParameter = "Main" #We want the the first sample tab to display to be the Main tab. nav = NavigationToolbar( self.graphicsView, self ) #Sets up the menu at the bottom of the GUI which lets us interact with the matplotlib plots self.verticalLayout_3.addWidget(nav) #Here, we process any arguments that might be sent the program from outside of the interface. #In other words, when ever a user right click on an SNP files, rather than opening them in Notepad, it would be opened in this interface. arguments = sys.argv[1:] if len(arguments): self.Project.importSNP(arguments) self.displaySamplesInTable() self.comm = Communication() self.settings = Settings() self.threadpool = QtCore.QThreadPool() self.poolMutex = QtCore.QMutex() self.paramWidgetList = [] # Comment out this line to get messanges to appear in terminal instead of in app. self.setupConsole()
def newSprint(handler, project): id = int(project) handler.title('New Sprint') requirePriv(handler, 'User') project = Project.load(id) if not project: ErrorBox.die('Invalid project', "No project with ID <b>%d</b>" % id) sprints = project.getSprints() print "<style type=\"text/css\">" print "table.list td.right > * {width: 400px;}" print "table.list td.right button {width: 200px;}" # Half of the above value print "#select-members {padding-right: 5px;}" print "</style>" print "<script src=\"/static/sprints-new.js\" type=\"text/javascript\"></script>" print InfoBox('', id = 'post-status') print "<form method=\"post\" action=\"/sprints/new\">" print "<table class=\"list\">" print "<tr><td class=\"left\">Project:</td><td class=\"right\">" print "<select id=\"select-project\" name=\"project\">" for thisProject in Project.loadAll(): print "<option value=\"%d\"%s>%s</option>" % (thisProject.id, ' selected' if thisProject == project else '', thisProject.safe.name) print "</select>" print "</td></tr>" print "<tr><td class=\"left\">Name:</td><td class=\"right\"><input type=\"text\" name=\"name\" class=\"defaultfocus\"></td></tr>" print "<tr><td class=\"left\">Planning:</td><td class=\"right\"><input type=\"text\" name=\"start\" class=\"date\" value=\"%s\"></td></tr>" % Weekday.today().strftime('%m/%d/%Y') print "<tr><td class=\"left\">Wrapup:</td><td class=\"right\"><input type=\"text\" name=\"end\" class=\"date\"></td></tr>" print "<tr><td class=\"left no-bump\">Members:</td><td class=\"right\">" print "<select name=\"members[]\" id=\"select-members\" multiple>" # Default to last sprint's members members = {handler.session['user']} if sprints: members |= sprints[-1].members for user in sorted(User.loadAll()): if user.hasPrivilege('User'): print "<option value=\"%d\"%s>%s</option>" % (user.id, ' selected' if user in members else '', user.safe.username) print "</select>" print "</td></tr>" print "<tr><td class=\"left no-bump\">Options:</td><td class=\"right\">" print "<div><input type=\"checkbox\" name=\"private\" id=\"flag-private\"><label for=\"flag-private\">Private – Only sprint members can view tasks</label></div>" print "<div><input type=\"checkbox\" name=\"hidden\" id=\"flag-hidden\"><label for=\"flag-hidden\">Hidden – Only sprint members can see the sprint</label></div>" print "</td></tr>" print "<tr><td class=\"left\"> </td><td class=\"right\">" print Button('Save', id = 'save-button', type = 'button').positive() print Button('Cancel', id = 'cancel-button', type = 'button').negative() print "</td></tr>" print "</table>" print "</form>"
class Parser: ''' Class to parse our file, it will check our file ''' def __init__(self): ''' Constructor for the class ''' self._project = Project() def error_message(self, msg='unknown error', code_error=84): ''' Write an error message on stderr and exit the program with code 84 :param msg: message we will display on our stderr :param code_error: code error we will use to exit ''' sys.stderr.write(msg + '\n') sys.exit(code_error) def _parseLine(self, line): ''' we will parse the line if we have a correct line and add into our project if any error -> print on stderr + exit with code 84 :param line: line we will parse :return: ''' tokens = line.split(';') if len(tokens) < 3: self.error_message('error: [%s]: you must specify at least 3 elements' % (line)) elif int(tokens[2]) and int(tokens[2]) < 0: self.error_message('error: [%s]: time must be >= 0' % (line)) self._project.addTask(tokens[0]) self._project.addDesc(tokens[0], tokens[1]) self._project.addTime(tokens[0], tokens[2]) if len(tokens) > 3: self._project.addListPrerequis(tokens[0], tokens[3:]) def parseFile(self, file): ''' Try to open our file and call _parseLine to check each line if any error -> print on stderr + exit with code 84 :param file: filepath like './bonus/test/test1' ''' try: with open(file, 'r') as f: data = f.readlines() lines = [x.rstrip('\n').decode('latin-1') for x in data] for x in lines: self._parseLine(x) except IOError as e: self.error_message('error: [%s]: %s' % (file, e.strerror)) except BaseException: self.error_message('error: [%s]: Unknown error' % file) def getProject(self): ''' get tasks from our project generated from our file (from our scrip from our directory etc...) :return: tasks (dictionnary) ''' return self._project
def run(): project_loader = Project(names_folder, data_folder) while input("Press any key to continue or 'q' to quit: ") != 'q': print(page_break + "\nCurrent projects are: " + str(project_loader.project_names)) menu_choice = input("\n1. Open project" + "\n2. Make project" + "\n3. Clear data\n" + page_break + "\nWhat would you like to do: ") if menu_choice == '1': project_loader.open_project(input(page_break +"\nEnter project ID: ")) print(page_break) elif menu_choice == '2': project_loader.make_project(input(page_break + "\nName of project: "), int(input("Number of directories: "))) print(page_break) elif menu_choice == '3': print(page_break) project_loader.clear_data() print(page_break) elif menu_choice == 'q': break else: print("Command not recognised.") print(page_break)
def __init__(self, prj: Project): self.project = prj self.compiler_path = prj.get_compiler_path() self.game_path = prj.get_game_path() self.game_type = prj.options.game_type self.input_path = prj.options.input_path self.root_node = etree.parse( prj.options.input_path, etree.XMLParser(remove_blank_text=True)).getroot() self.output_path = self.root_node.get('Output') self.flags_path = self.root_node.get('Flags') self.use_bsarch = self.root_node.get('CreateArchive') self.use_anonymizer = self.root_node.get('Anonymize')
def editProject(self): """ Update a project with new specified values. """ selectedProject = self.comboBoxProjectEdit.itemData( self.comboBoxProjectEdit.currentIndex()) if selectedProject is None: return newName = self.lineEditProjectEditName.text() if len(newName) == 0: return newDescription = self.lineEditProjectEditDescription.text() updatedProject = Project(selectedProject.id, newName, newDescription) Globals.db.updateProject(updatedProject) # Also update all comboboxes that manage projects self.populateProjects(keepCurrentIndex=True) MainTab.MainTab.populateProjects(keepCurrentIndex=True) # If the current project has been edited # --> Re-set it as the current project if Globals.project is not None and selectedProject.id == Globals.project.id: MainTab.MainTab.setProject()
class QueryA(): sc = SparkContext() sqlContext = SQLContext(sc) logger = sc._jvm.org.apache.log4j logger.LogManager.getLogger("org"). setLevel( logger.Level.ERROR ) logger.LogManager.getLogger("akka").setLevel( logger.Level.ERROR ) filePath=sys.argv[1] # Path for the files outFilePath=sys.argv[2] # Path for the output file typeOfData=sys.argv[3] # Type of dataset with open(outFilePath, "a") as myfile: # Open output file myfile.write("QueryA_business\n") timing = Timing(outFilePath) startTime = timing.startTime() # Start measuring time # Create a dataframe from a file inputTable_1 = 'orderT_11rows' predScan_left = None selScan_left = ScanSelect(inputTable_1, predScan_left,sqlContext,filePath,typeOfData) outputScan_left = selScan_left.execute() # Find Accuracy score for each row accuracyAttr = "Accuracy" accInputExpr = AccuracyExpression(outputScan_left,"ship_date",">","submit_date") accuracyOp = Accuracy(outputScan_left, accuracyAttr, accInputExpr) outputAccuracy = accuracyOp.execute() # Select columns from the dataframe attrList = ["order_no","Accuracy_score"] proj = Project(outputAccuracy, attrList) outputFinal = proj.execute() nrows = outputFinal.count() stopTime = timing.stopTime()# Stop measuring time timing.durationTime(stopTime, startTime)
def start(): from Project import Project import Record project = Project() record = Record.Record() Proxy.begin_catch( #callback = record.add_hit, callback=callback, filter=lambda x: True, hittype=HitData, ) proxy = Proxy.thread_start() while True: c = raw_input('Enter stop to stop > ') if c == 'stop': break Proxy.stop() proxy.join() print 'Recording finished' print
def __init__(self): wx.Frame.__init__(self, None, -1, "PyLoad", size=(800, 600)) self.InitProject() self.project = Project() self.reportPath = 'reports/last-report.db' self.report = Report(self.reportPath) # set self.report to None if you don't want to generate report #self.report = None self.path = None self.nb = NoteBook(self, -1, self.project, self.report) self.InitIcons() self.UseMenuBar() self.UseToolBar() self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(EVT_PLAY_STOPPED, self.OnPlayStopped) register_changed_callback(self.SetChanged) #TODO: put in tabs' constructors self.nb.recordTab.tree.project = self.project self.nb.editTab.specialsPanel.project = self.project self.proxy = None
def process(self): sql = """SELECT DISTINCT m.project_id FROM (select @experiment:="%s") unused, master_events m INNER JOIN sessions_for_experiment s ON m.session_id=s.id INNER JOIN sessions ses ON ses.id=s.id WHERE ses.created_at BETWEEN %s AND %s AND project_id IS NOT NULL""" data = (self.expId, self.start, self.end) print(sql % data) projects = set() with self.cursor as c: c.execute(sql, data) results = c.fetchall() print(results) if len(results) > 0: for result in results: print(".") if result['project_id'] not in projects: projects.add(result['project_id']) print("FOUND project %s" % (result['project_id'])) project = Project(-1, -1, result['project_id']) self.nextBlock.process(project) else: print("no results")
def findActiveSprint(handler, project = None, search = None): handler.title('Active Sprint') requirePriv(handler, 'User') if project: projectid = int(project) project = Project.load(projectid) if not project: ErrorBox.die('Load project', "No project with ID <b>%d</b>" % projectid) url = "/sprints/%d" if search: url += "?search=%s" % search sprints = Sprint.loadAllActive(handler.session['user'], project) sprints = filter(lambda sprint: sprint.canView(handler.session['user']), sprints) for case in switch(len(sprints)): if case(0): ErrorBox.die('Active sprint', 'No active sprints found') break if case(1): redirect(url % sprints[0].id) break if case(): print "You are active in multiple sprints%s:<br><br>" % (" in the %s project" % project.safe.name if project else '') for sprint in sprints: print "<a href=\"%s\">%s</a><br>" % (url % sprint.id, sprint.safe.name) break
def check_arguments(): if len(sys.argv) not in [2, 3]: sys.exit("Usage: python3 straw_man_model.py <project_name_PWM_name> [<k=None> or <normal_distribution_string>] \n") k = None is_normal_distribution = False project_name = sys.argv[1] if len(sys.argv) == 3: if sys.argv[2].isdigit(): k = int(sys.argv[2]) print("k = ", k) else: is_normal_distribution = bool(sys.argv[2]) # this is True if k: project = Project(project_name, base_path, k=k) else: project = Project(project_name, base_path, normal_distribution=is_normal_distribution) return project
def test_calculate_new_keywords(self): mock_db = riak.RiakClient() mock_bucket = mock_db.bucket("message") project = Project("Sample", [ "test1", "test2", ], mock_bucket) def sample_algorithm(keyword_counts, total): return [ k for (k, v) in keyword_counts.iteritems() if v / total >= 1 ] self.assertEqual(project.calculate_new_keywords(sample_algorithm), [ "test1", "test2", ])
def create_object(self, node_type): """ Returns an empty object of the node_type provided. It must be a valid object, or else an exception is raised. Args: node_type (str): The type of object desired. Returns: A object of the specified type. """ self.logger.debug("In create_object. Type: %s" % node_type) node = None if node_type == "project": from Project import Project self.logger.debug("Creating a Project.") node = Project() elif node_type == "visit": from Visit import Visit self.logger.debug("Creating a Visit.") node = Visit() elif node_type == "subject": from Subject import Subject self.logger.debug("Creating a Subject.") node = Subject() elif node_type == "sample": from Sample import Sample self.logger.debug("Creating a Sample.") node = Sample() elif node_type == "study": from Study import Study self.logger.debug("Creating a Study.") node = Study() elif node_type == "wgs_dna_prep": from WgsDnaPrep import WgsDnaPrep self.logger.debug("Creating a WgsDnaPrep.") node = WgsDnaPrep() elif node_type == "16s_dna_prep": from SixteenSDnaPrep import SixteenSDnaPrep self.logger.debug("Creating a SixteenSDnaPrep.") node = SixteenSDnaPrep() elif node_type == "16s_raw_seq_set": from SixteenSRawSeqSet import SixteenSRawSeqSet self.logger.debug("Creating a SixteenSRawSeqSet.") node = SixteenSRawSeqSet() elif node_type == "wgs_raw_seq_set": from WgsRawSeqSet import WgsRawSeqSet self.logger.debug("Creating a WgsRawSeqSet.") node = WgsRawSeqSet() elif node_type == "16s_trimmed_seq_set": from SixteenSTrimmedSeqSet import SixteenSTrimmedSeqSet self.logger.debug("Creating a SixteenSTrimmedSeqSet.") node = SixteenSTrimmedSeqSet() else: raise ValueError("Invalid node type specified: %" % node_type) return node
def initial(self): self.TaskList.clear() #普通任务列表 self.DefaultDirectory = "" #默认文件路径 self.table_style = 0 #表格视图关联数据类型标识 self.ProjectList.clear() #项目列表 self.listTable.clear() #表格视图关联列表 self.progressBar.setValue(0) if self.boolStyle: self.DefaultDirectory = "E:\MY DOCUMENTS\PyQtTask Files" else: self.DefaultDirectory = QFileDialog.getExistingDirectory( self, '设置默认文件夹', "/home", ) taskFilePath = self.DefaultDirectory + "\\OptionFiles\\TaskData.xlsx" tasklist_wb = TaskEXECL() tasklist_wb.read_task_list(taskFilePath, self.TaskList) #导入Task信息 pjDirectory = self.DefaultDirectory + "\\ProjectFiles" pjFileList = os.listdir(pjDirectory) for pjFileName in pjFileList: pj = Project() #pj.filepath = pjDirectory + "/" + pjFileName pj.projectfile.initial(pjDirectory, pjFileName) pjFileNameList = pjFileName.split(".") pj.name = pjFileNameList[0] pj.read_project_EXCEL() pj.caculate_percentage() self.ProjectList.append(pj) self.initial_TreeWidget() #初始化树控件
def __init__(self, parent): wx.Frame.__init__(self, parent) self.menu_bar = PygorPro_MenuBar(self) self.SetMenuBar(self.menu_bar) self.history = HistoryFrame(self) self.project = Project() self.history.log_new_project()