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 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 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 makeNewProject(path): newProject = Project(path) newProject.generateTemplate() newProjectConfigFile = ProjectConfigFile.createNewConfigFile() newProjectConfigFile.setProjectConfigDefaults() newProjectActivityFile = ActivityFile.createNewActivity(f'Created new project at {newProject.projectPath}') newProject.beginSession()
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 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 main(): p = Project() # p.download_data() # p.load_data_to_hdfs() # p.load_data_to_hive() p.MLP_classifier()
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 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 iter_projects(projects): res = [] for project in projects: try: print("working on %s" % project[0]) p = Project(project[0], project[1], project[2]) print(" - CREATED AT: " + str(p.created_at)) p.set_language_data() print(" - LANGUAGES\n " + str(p.languages)) p.set_contrib_data() print(" - CONTRIBUTORS\n " + str(p.contributors)) p.set_openhub_data() print(" - OPENHUB\n " + str(p.openhub)) p.set_issue_data() print(" - ISSUES\n " + str(p.issues)) if (len(OUTPUT_CSV_PATH) > 1): p.generate_csv_line(OUTPUT_CSV_PATH) res.append(p) except Exception as e: print( " ERROR - error while analyzing project -= %s/%s =- \n" % (project[1], project[2])) print(e.__str__()) print("FINISHED RUN") return res
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 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 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 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 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 main(project_name_param_, assets_param, assets_out_of_scope): project_name = project_name_param_ project = Project(project_name) assets = assets_param project.set_assets(assets) project.save_project() scan_instance = Scan(project) scan_instance.save_scan() for asset in assets: asset_instance = Asset(scan_instance, asset) asset_subdomains = asset_instance.get_subdomains() asset_id = asset_instance.save_asset() for subdomain in asset_subdomains: subdomain_instance = Subdomain(asset_id, subdomain, assets_out_of_scope) subdomain_links = subdomain_instance.parse_links() subdomain_id = subdomain_instance.save_subdomain() for link in subdomain_links: if link in assets_out_of_scope: continue link_instance = Link(subdomain_id, link) link_instance.process_link() link_id = link_instance.save_link() forms = link_instance.forms for form_index in range(len(forms)): form = forms[form_index] form_instance = Form(link_id, form, form_index) form_instance.save_form()
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 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 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 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 __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()
def test_initial_tweet_percentages(self): mock_db = riak.RiakClient() mock_bucket = mock_db.bucket("message") project = Project("Sample", [ "test1", "test2", ], mock_bucket) self.assertEqual(project.keyword_counts["test1"], 100) self.assertEqual(project.keyword_counts["test2"], 100)
def openFile(self): # Use the stock Qt dialog to look for VTK files. filename, _ = QtGui.QFileDialog.getOpenFileName( self.ui, 'Open file', os.curdir, "*.project") if filename != "": self.project_filename = filename # Do something with the new database self.project = Project(self.project_filename)
class QueryA(): 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_traffic\n") timing = Timing(outFilePath) startTime = timing.startTime() # Start measuring time # Create a dataframe from a file inputTable_1 = 'newColpvr_2016-01-01_366d_11rows' predScan_left = None selScan_left = ScanSelect(inputTable_1, predScan_left, filePath, typeOfData) outputScan_left = selScan_left.execute() # Find Accuracy score for each row accuracyAttr = "Accuracy" if (typeOfData != 'Categorical'): accInputExpr_6 = AccuracyExpression(outputScan_left, "Class5Volume", "+", "Class6Volume") accInputExpr_5 = AccuracyExpression(outputScan_left, "Class4Volume", "+", accInputExpr_6) accInputExpr_4 = AccuracyExpression(outputScan_left, "Class3Volume", "+", accInputExpr_5) accInputExpr_3 = AccuracyExpression(outputScan_left, "Class2Volume", "+", accInputExpr_4) accInputExpr_2 = AccuracyExpression(outputScan_left, "Class1Volume", "+", accInputExpr_3) accInputExpr_1 = AccuracyExpression(outputScan_left, "Volume", "=", accInputExpr_2) accuracyOp = Accuracy(outputScan_left, accuracyAttr, accInputExpr_1) else: accInputExpr_1 = AccuracyExpression(outputScan_left, "Volume", "=", "Class2Volume") accuracyOp = Accuracy(outputScan_left, accuracyAttr, accInputExpr_1) outputAccuracy = accuracyOp.execute() # Select columns from the dataframe if (typeOfData != 'Categorical'): attrList = ["Sdate", "LaneNumber", "Accuracy_score"] else: attrList = ["Sdate", "Accuracy_score"] proj = Project(outputAccuracy, attrList) outputFinal = proj.execute() # Uncomment to print final output ''' n = len(outputFinal.index) print(outputFinal.head(n).to_string()) print("Project Output= ") print(n) ''' stopTime = timing.stopTime() # Stop measuring time timing.durationTime(stopTime, startTime)
class QueryT(): 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("QueryT_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, filePath, typeOfData) outputScan_left = selScan_left.execute() # Create a dataframe from a file inputTable_2 = "statusTimelinessQR_11rows" predScan_right = None selScan_right = ScanSelect(inputTable_2, predScan_right, filePath, typeOfData) outputScan_right = selScan_right.execute() # Join two dataframes predJoin = ("statusTimeliness_id", "=", "statusTimeliness_qid") join_1 = Join(outputScan_left, outputScan_right, predJoin) outputJoin_1 = join_1.execute() # Find Timeliness score for each row timelinessAttr = "timeliness" timeliness = Timeliness(outputJoin_1, timelinessAttr) outputTimeliness = timeliness.execute() #Select columns from the dataframe attrList = ["statusTimeliness_qid", "timeliness_score"] proj = Project(outputTimeliness, attrList) outputFinal = proj.execute() nrows = outputFinal.count() # Uncomment to print final output ''' n = len(outputFinal.index) print(outputFinal.head(n).to_string()) print("Project Output= ") print(n) ''' nrows = outputFinal.count() stopTime = timing.stopTime() # Stop measuring time timing.durationTime(stopTime, startTime)
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 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 main(): """Determine arguments and pass arguments to compiler""" _options = namedtuple( 'ProjectOptions', 'game_type input_path disable_anonymizer disable_bsarch disable_indexer' ) _options.disable_anonymizer = _args.disable_anonymizer _options.disable_bsarch = _args.disable_bsarch _options.disable_indexer = _args.disable_indexer _options.game_type = GameType.from_str(_args.game) _options.input_path = _args.input _project = Project(_options) time_elapsed = TimeElapsed() ppj = PapyrusProject(_project) # the index is used to exclude unchanged scripts from compilation absolute_script_paths = ppj.get_script_paths(absolute_paths=True) file_name, file_extension = os.path.splitext( os.path.basename(ppj.input_path)) project_index = Index(file_name, absolute_script_paths) ppj.compile_custom(project_index, time_elapsed) no_scripts_modified = False missing_scripts_found = False if _options.disable_indexer: pex_paths = ppj.get_script_paths_compiled() else: pex_paths, validation_states = ppj.validate_project( project_index, time_elapsed) no_scripts_modified = len( validation_states ) == 1 and ValidationState.FILE_NOT_MODIFIED in validation_states missing_scripts_found = ValidationState.FILE_NOT_EXIST in validation_states if _options.disable_anonymizer: log.warn('Anonymization disabled by user.') elif no_scripts_modified: log.error( 'Cannot anonymize compiled scripts because no source scripts were modified' ) else: ppj.anonymize_scripts(pex_paths, ppj.output_path) if missing_scripts_found: log.error('Cannot pack archive because there are missing scripts') else: ppj.pack_archive() time_elapsed.print()
def process(self): id = randint(self.firstSession, self.lastSession) if id not in self.sessions: self.sessions.add(id) sql = "SELECT DISTINCT project_id FROM master_events WHERE session_id=%s AND project_id IS NOT NULL" self.cursor.execute(sql, id) projectsResult = self.cursor.fetchall() if len(projectsResult) > 0: for projectResult in projectsResult: project = Project(-1, id, projectResult['project_id']) self.nextBlock.process(project)