rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
{'H2': [segment(11.0, 15)], 'H1': [segment(5.0, 9.0)]} | {'H2': [segment(6.0, 15)], 'H1': [segment(0.0, 9.0)]} | def popitem(*args): raise NotImplementedError | 8e48b6075bb8a5cd31c1c0ad7f6050e789bbb144 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/8e48b6075bb8a5cd31c1c0ad7f6050e789bbb144/segments.py |
working copy of a segmentlist object. The first is to initialize a new object from an existing one with | copy of a segmentlist object. The first is to initialize a new object from an existing one with >>> old = segmentlistdict() | def copy(self): """ Return a copy of the segmentlistdict object. The return value is a new object with a new offsets attribute, with references to the original keys, and shallow copies of the segment lists. Modifications made to the offset dictionary or segmentlists in the object returned by this method will not affect the original, but without using much memory until such modifications are made. | 8e48b6075bb8a5cd31c1c0ad7f6050e789bbb144 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/8e48b6075bb8a5cd31c1c0ad7f6050e789bbb144/segments.py |
This creates a working copy of the dictionary, but not of its contents. That is, this creates new with references to the segmentlists in old, so changes to the segmentlists in either new or old are reflected in both. The second method is | This creates a copy of the dictionary, but not of its contents. That is, this creates new with references to the segmentlists in old, therefore changes to the segmentlists in either new or old are reflected in both. The second method is | def copy(self): """ Return a copy of the segmentlistdict object. The return value is a new object with a new offsets attribute, with references to the original keys, and shallow copies of the segment lists. Modifications made to the offset dictionary or segmentlists in the object returned by this method will not affect the original, but without using much memory until such modifications are made. | 8e48b6075bb8a5cd31c1c0ad7f6050e789bbb144 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/8e48b6075bb8a5cd31c1c0ad7f6050e789bbb144/segments.py |
This creates a working copy of the dictionary and of the | This creates a copy of the dictionary and of the | def copy(self): """ Return a copy of the segmentlistdict object. The return value is a new object with a new offsets attribute, with references to the original keys, and shallow copies of the segment lists. Modifications made to the offset dictionary or segmentlists in the object returned by this method will not affect the original, but without using much memory until such modifications are made. | 8e48b6075bb8a5cd31c1c0ad7f6050e789bbb144 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/8e48b6075bb8a5cd31c1c0ad7f6050e789bbb144/segments.py |
self.name_output_file = job.tag_base + "-" + str(time) + ".tgz" | self.name_output_file = job.tag_base + "-" + repr(time) + ".tgz" | def __init__(self, dag, job, cp, opts, time, ifo, p_nodes=[], type="ht", variety="fg"): | 6a0d2205ec2f7140b459b78cf45c546500409709 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/6a0d2205ec2f7140b459b78cf45c546500409709/stfu_pipe.py |
a minimum threshold of min_threshold in the most sensitive one, for a source | a minimum threshold of min_threshold in the least sensitive one, for a source | def detector_thresholds(min_threshold, ifos, RA, dec, gps_time, sensitivities=None): """ Return a dictionary of sensitivity thresholds for each detector, based on a minimum threshold of min_threshold in the most sensitive one, for a source at position (RA,dec) specified in radians at time gps_time. Specifying a dictionary of sensitivities allows one to weight also by the relative SNR of a reference system in each detector to handle different noise curves. """ # Recurse if multiple RA, dec and GPS times are specified if type(gps_time)!=float or type(RA)!=float or type(dec)!=float: assert len(gps_time)==len(RA),len(gps_time)==len(dec) return map(lambda (a,b,c): detector_threshold(min_threshold,ifos,a,b,c,sensitivities), zip(RA,dec,gps_time)) from pylal import antenna # Sensitivies specifies relative SNRs of a reference signal (BNS) if sensitivities is None: sensitivities={} for det in ifos: sensitivies[det]=1.0 else: assert len(ifos)==len(sensitivites) # Normalise sensitivities minsens=min(sensitivities.values()) for det in ifos: sensitivities[det]/=minsens resps={} threshs={} # Make a dictionary of average responses for det in ifos: resps[det]=antenna.response(gps_time,RA,dec,0,0,'radians',det)[2] worst_resp=min(resps.values()) # Assuming that lowest threshold is in worst detector, return thresholds for det in ifos: threshs[det]=min_threshold*(resps[det]/worst_resp)*sensitivities[det] return threshs | 81fa541cb286c29af6357c97e64fb609c8050da9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/81fa541cb286c29af6357c97e64fb609c8050da9/grbsummary.py |
def New(Type, columns = None): | def New(Type, columns = None, **kwargs): | def New(Type, columns = None): """ Convenience function for constructing pre-defined LSC tables. The optional columns argument is a list of the names of the columns the table should be constructed with. If columns = None, then the table is constructed with all valid columns included (pass columns = [] to create a table with no columns). Example: >>> tbl = New(ProcessTable) >>> tbl.write() """ new = Type(sax.xmlreader.AttributesImpl({u"Name": Type.tableName})) colnamefmt = u":".join(Type.tableName.split(":")[:-1]) + u":%s" if columns is not None: for key in columns: if key not in new.validcolumns: raise ligolw.ElementError, "invalid Column '%s' for Table '%s'" % (key, new.tableName) new.appendChild(table.Column(sax.xmlreader.AttributesImpl({u"Name": colnamefmt % key, u"Type": new.validcolumns[key]}))) else: for key, value in new.validcolumns.items(): new.appendChild(table.Column(sax.xmlreader.AttributesImpl({u"Name": colnamefmt % key, u"Type": value}))) new._end_of_columns() new.appendChild(table.TableStream(sax.xmlreader.AttributesImpl({u"Name": Type.tableName}))) return new | b7911df0228672c2c788b9d67a03d14a75d99b68 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/b7911df0228672c2c788b9d67a03d14a75d99b68/lsctables.py |
new = Type(sax.xmlreader.AttributesImpl({u"Name": Type.tableName})) | new = Type(sax.xmlreader.AttributesImpl({u"Name": Type.tableName}), **kwargs) | def New(Type, columns = None): """ Convenience function for constructing pre-defined LSC tables. The optional columns argument is a list of the names of the columns the table should be constructed with. If columns = None, then the table is constructed with all valid columns included (pass columns = [] to create a table with no columns). Example: >>> tbl = New(ProcessTable) >>> tbl.write() """ new = Type(sax.xmlreader.AttributesImpl({u"Name": Type.tableName})) colnamefmt = u":".join(Type.tableName.split(":")[:-1]) + u":%s" if columns is not None: for key in columns: if key not in new.validcolumns: raise ligolw.ElementError, "invalid Column '%s' for Table '%s'" % (key, new.tableName) new.appendChild(table.Column(sax.xmlreader.AttributesImpl({u"Name": colnamefmt % key, u"Type": new.validcolumns[key]}))) else: for key, value in new.validcolumns.items(): new.appendChild(table.Column(sax.xmlreader.AttributesImpl({u"Name": colnamefmt % key, u"Type": value}))) new._end_of_columns() new.appendChild(table.TableStream(sax.xmlreader.AttributesImpl({u"Name": Type.tableName}))) return new | b7911df0228672c2c788b9d67a03d14a75d99b68 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/b7911df0228672c2c788b9d67a03d14a75d99b68/lsctables.py |
if program_name == "thinca": | if program_name == "thinca": | def get_segments(connection, xmldoc, program_name): seglists = segments.segmentlistdict() if program_name == "thinca": seglists = db_thinca_rings.get_thinca_zero_lag_segments(connection, program_name) if program_name == "gstlal_inspiral" or program_name == "lalapps_ring": seglists = llwapp.segmentlistdict_fromsearchsummary(xmldoc, program_name).coalesce() return seglists | 467bb49d7b49200eba6a86b26772b07c1c9a7ac0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/467bb49d7b49200eba6a86b26772b07c1c9a7ac0/farutils.py |
if program_name == "thinca": | if program_name == "thinca": | def get_background_livetime_by_slide(connection, program_name, seglists, veto_segments=None, verbose = False): if program_name == "thinca": return background_livetime_ring_by_slide(connection, program_name, seglists, veto_segments, verbose) if program_name == "gstlal_inspiral": return background_livetime_nonring_by_slide(connection, seglists, veto_segments, verbose) | 467bb49d7b49200eba6a86b26772b07c1c9a7ac0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/467bb49d7b49200eba6a86b26772b07c1c9a7ac0/farutils.py |
infile = '%s/%s.in' % (src_dir, basename) | infile = '%s.in' % basename | def generate_git_version_info(): # info object info = git_info() git_path = check_call_out(('which', 'git')) # determine basic info about the commit # %H -- full git hash id # %ct -- commit time # %an, %ae -- author name, email # %cn, %ce -- committer name, email git_id, git_udate, git_author_name, git_author_email, \ git_committer_name, git_committer_email = \ check_call_out((git_path, 'log', '-1', '--pretty=format:%H,%ct,%an,%ae,%cn,%ce')).split(",") git_date = time.strftime('%Y-%m-%d %H:%M:%S +0000', time.gmtime(float(git_udate))) git_author = '%s <%s>' % (git_author_name, git_author_email) git_committer = '%s <%s>' % (git_committer_name, git_committer_email) # determine branch branch_match = check_call_out((git_path, 'rev-parse', '--symbolic-full-name', 'HEAD')) if branch_match == "HEAD": git_branch = None else: git_branch = os.path.basename(branch_match) # determine tag status, git_tag = call_out((git_path, 'describe', '--exact-match', '--tags', git_id)) if status != 0: git_tag = None # refresh index check_call_out((git_path, 'update-index', '-q', '--refresh')) # check working copy for changes status_output = subprocess.call((git_path, 'diff-files', '--quiet')) if status_output != 0: git_status = 'UNCLEAN: Modified working tree' else: # check index for changes status_output = subprocess.call((git_path, 'diff-index', '--cached', '--quiet', 'HEAD')) if status_output != 0: git_status = 'UNCLEAN: Modified index' else: git_status = 'CLEAN: All modifications committed' # determine version strings info.id = git_id info.date = git_date info.branch = git_branch info.tag = git_tag info.author = git_author info.committer = git_committer info.status = git_status return info | ef6699d85dbb8efec59f6d7a740308a16375520b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/ef6699d85dbb8efec59f6d7a740308a16375520b/generate_vcs_info.py |
if paramnames(parnum)=='mchirp': return inj.mchirp if paramname(parnum)=='eta': return inj.eta if paramname(parnum)=='time': return inj.get_end() if paramname(parnum)=='phi0': return inj.phi0 if paramname(parnum)=='dist': return inj.distance if paramname(parnum)=='RA': return inj.longitude if paramname(parnum)=='dec': return inj.latitude if paramname(parnum)=='psi': return inj.polarization if paramname(parnum)=='iota': return inj.inclination | if paramnames[parnum]=='mchirp': return inj.mchirp if paramnames[parnum]=='eta': return inj.eta if paramnames[parnum]=='time': return inj.get_end() if paramnames[parnum]=='phi0': return inj.phi0 if paramnames[parnum]=='dist': return inj.distance if paramnames[parnum]=='RA': return inj.longitude if paramnames[parnum]=='dec': return inj.latitude if paramnames[parnum]=='psi': return inj.polarization if paramnames[parnum]=='iota': return inj.inclination | def getinjpar(inj,parnum): if paramnames(parnum)=='mchirp': return inj.mchirp if paramname(parnum)=='eta': return inj.eta if paramname(parnum)=='time': return inj.get_end() if paramname(parnum)=='phi0': return inj.phi0 if paramname(parnum)=='dist': return inj.distance if paramname(parnum)=='RA': return inj.longitude if paramname(parnum)=='dec': return inj.latitude if paramname(parnum)=='psi': return inj.polarization if paramname(parnum)=='iota': return inj.inclination return None | 50b7ece49c798f0c0a51eadae38e35a1dfb1d927 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/50b7ece49c798f0c0a51eadae38e35a1dfb1d927/cbcBayesSkyRes.py |
if injection and getinjpar(injection,paramnames.index('mchirp'))<max(pos[:,paranmanes.index('mchirp')]) and getinjpar(injection,paramnames.index('mchirp'))>min(pos[:,paramnames.index('mchirp')]) and getinjpar(injection,paramnames.index('eta'))>min(pos[:,paramnames.index('eta')]) and getinjpar(injection,paramnames.index('eta'))<max(pos[:,paramnames.index('eta')]): | if injection and getinjpar(injection,paramnames.index('mchirp'))<max(pos[:,paramnames.index('mchirp')]) and getinjpar(injection,paramnames.index('mchirp'))>min(pos[:,paramnames.index('mchirp')]) and getinjpar(injection,paramnames.index('eta'))>min(pos[:,paramnames.index('eta')]) and getinjpar(injection,paramnames.index('eta'))<max(pos[:,paramnames.index('eta')]): | def plot2Dkernel(xdat,ydat,Nx,Ny): xax=linspace(min(xdat),max(xdat),Nx) yax=linspace(min(ydat),max(ydat),Ny) x,y=numpy.meshgrid(xax,yax) samp=array([xdat,ydat]) kde=stats.kde.gaussian_kde(samp) grid_coords = numpy.append(x.reshape(-1,1),y.reshape(-1,1),axis=1) z = kde(grid_coords.T) z = z.reshape(Nx,Ny) asp=xax.ptp()/yax.ptp() | 50b7ece49c798f0c0a51eadae38e35a1dfb1d927 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/50b7ece49c798f0c0a51eadae38e35a1dfb1d927/cbcBayesSkyRes.py |
for (frac,size) in skyreses: htmlfile.write('<tr><td>%f</td>%f</td></tr>'%(frac,size)) | for (frac,skysize) in skyreses: htmlfile.write('<tr><td>%f</td>%f</td></tr>'%(frac,skysize)) | def plot2Dkernel(xdat,ydat,Nx,Ny): xax=linspace(min(xdat),max(xdat),Nx) yax=linspace(min(ydat),max(ydat),Ny) x,y=numpy.meshgrid(xax,yax) samp=array([xdat,ydat]) kde=stats.kde.gaussian_kde(samp) grid_coords = numpy.append(x.reshape(-1,1),y.reshape(-1,1),axis=1) z = kde(grid_coords.T) z = z.reshape(Nx,Ny) asp=xax.ptp()/yax.ptp() | 647ad923ab86edfe537f5abc2b4402de62356695 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/647ad923ab86edfe537f5abc2b4402de62356695/OddsPostProc.py |
segment_definer AS x WHERE x.name = segment_definer.name )\ | segment_definer AS x, segment AS y \ WHERE x.name = segment_definer.name AND \ x.segment_def_id = y.segment_def_id AND \ y.segment_def_cdb = x.creator_db AND \ NOT (y.start_time > %s OR %s > y.end_time) ) \ | def getSciSegs(ifo=None, gpsStart=None, gpsStop=None, cut=bool(False), serverURL=None, segName="DMT-SCIENCE", seglenmin=None, segpading=0 | 5270539576c4e2945cb782583298d134a1f2c06b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/5270539576c4e2945cb782583298d134a1f2c06b/fu_utils.py |
sqlQuery=query01%(segName,ifo,gpsStop,gpsStart) | sqlQuery=query01%(segName,ifo,gpsStop,gpsStart,gpsStop,gpsStart) | def getSciSegs(ifo=None, gpsStart=None, gpsStop=None, cut=bool(False), serverURL=None, segName="DMT-SCIENCE", seglenmin=None, segpading=0 | 5270539576c4e2945cb782583298d134a1f2c06b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/5270539576c4e2945cb782583298d134a1f2c06b/fu_utils.py |
(home_dirs()+"/romain/followupbackgrounds/omega/VSR2a/background/background_931035296_935798415.cache",931035296,935798415,"V1") | (home_dirs()+"/romain/followupbackgrounds/omega/VSR2a/background/background_931035296_935798415.cache",931035296,935798415,"V1"), | def figure_out_cache(time,ifo): cacheList=( (home_dirs()+"/romain/followupbackgrounds/omega/S5/background/background_815155213_875232014.cache",815155213,875232014,"H1H2L1"), (home_dirs()+"/romain/followupbackgrounds/omega/S6a/background/background_931035296_935798415.cache",931035296,935798415,"H1L1"), (home_dirs()+"/romain/followupbackgrounds/omega/S6b/background/background_937800015_944587815.cache",935798415,944587815,"H1L1"), (home_dirs()+"/romain/followupbackgrounds/omega/S6b/background/background_944587815_947260815.cache",944587815,999999999,"H1L1"), (home_dirs()+"/romain/followupbackgrounds/omega/VSR2a/background/background_931035296_935798415.cache",931035296,935798415,"V1") (home_dirs()+"/romain/followupbackgrounds/omega/VSR2b/background/background_937800015_947260815.cache",935798415,999999999,"V1") ) foundCache = "" for cacheFile,start,stop,ifos in cacheList: if ((start<=time) and (time<stop) and ifo in ifos): foundCache = cacheFile break if 'phy.syr.edu' in get_hostname(): foundCache = foundCache.replace("romain","rgouaty") if foundCache == "": print ifo, time, " not found in method stfu_pipe.figure_out_cache" else: if not os.path.isfile(foundCache): print "file " + foundCache + " not found" foundCache = "" return foundCache | e2df3d907fc79585abd65c0605de1e63db5a8b07 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/e2df3d907fc79585abd65c0605de1e63db5a8b07/stfu_pipe.py |
os.path.join("bin","cbcBayesPostProc.py") | os.path.join("bin","cbcBayesPostProc.py") | def run(self): # remove the automatically generated user env scripts for script in ["pylal-user-env.sh", "pylal-user-env.csh"]: log.info("removing " + script ) try: os.unlink(os.path.join("etc", script)) except: pass | e1cc8c3a3ccb5ac0f287429b4a4089ef7d6834ae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/e1cc8c3a3ccb5ac0f287429b4a4089ef7d6834ae/setup.py |
self.add_var_arg(p_nodes[1].name_output_file) | self.add_var_arg(p_nodes[1].outputFileName) | def __init__(self, dag, job, cp, opts, ifo, time, p_nodes=[], type=""): | 861e37c73755058b7941a8b8bfc36024be47a7bd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/861e37c73755058b7941a8b8bfc36024be47a7bd/stfu_pipe.py |
self.add_var_opt('server','ldr-bologna.phys.uwm.edu') if not(cp.has_option('fu-remote-jobs','remote-jobs') and job.name in cp.get('fu-remote-jobs','remote-jobs') and cp.has_option('fu-remote-jobs','remote-ifos') and ifo in cp.get('fu-remote-jobs','remote-ifos')) or if opts.do_remoteScans: | self.add_var_arg('--server ldr-bologna.phys.uwm.edu') if not(cp.has_option('fu-remote-jobs','remote-jobs') and job.name in cp.get('fu-remote-jobs','remote-jobs') and cp.has_option('fu-remote-jobs','remote-ifos') and ifo in cp.get('fu-remote-jobs','remote-ifos')) or opts.do_remoteScans: | def __init__(self, dag, job, cp, opts, ifo, sngl=None, qscan=False, trigger_time=None, data_type="hoft", p_nodes=[]): | 861e37c73755058b7941a8b8bfc36024be47a7bd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/861e37c73755058b7941a8b8bfc36024be47a7bd/stfu_pipe.py |
one of the segments in self. If self has length n, then if item is a scalar or a segment this operation is O(log n), if it is a segmentlist of m segments this operation is O(m | the segments in self. If self has length n, then if item is a scalar or a segment this operation is O(log n), if item is a segmentlist of m segments this operation is O(m | def __contains__(self, item): """ Returns True if the given object is wholly contained within one of the segments in self. If self has length n, then if item is a scalar or a segment this operation is O(log n), if it is a segmentlist of m segments this operation is O(m log n). | 666812caa6aac59ffb0e844aa826a1ba2e4d9b91 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/666812caa6aac59ffb0e844aa826a1ba2e4d9b91/segments.py |
oldVal=None | def __init__(self,cp,block_id,dagDir,channel=''): self.dagDirectory=dagDir self.__executable = cp.get('condor','clustertool') self.__universe= cp .get('condor','clustertool_universe') pipeline.CondorDAGJob.__init__(self,self.__universe,self.__executable) pipeline.AnalysisJob.__init__(self,cp) self.add_condor_cmd('getenv','True') self.block_id=blockID=block_id #layerID='RESULTS_'+str(blockID) layerID='RESULTS_'+channel+'_'+str(blockID) #Do not set channel name information here. This puts all #threshold output files into same place self.initialDir=layerPath=determineLayerPath(cp,blockID,layerID) blockPath=determineBlockPath(cp,blockID,channel) #Setup needed directories for this job to write in! buildDir(blockPath) buildDir(layerPath) buildDir(blockPath+'/logs') self.set_stdout_file(os.path.normpath(blockPath+'/logs/tracksearchThreshold-$(cluster)-$(process).out')) self.set_stderr_file(os.path.normpath(blockPath+'/logs/tracksearchThreshold-$(cluster)-$(process).err')) filename="/tracksearchThreshold--"+str(channel)+".sub" self.set_sub_file(os.path.normpath(self.dagDirectory+filename)) #Load in the cluster configuration sections! #Add the candidateUtils.py equivalent library to dag for proper #execution! self.candUtil=str(cp.get('pylibraryfiles','pyutilfile')) if ((self.__universe == 'scheduler') or (self.__universe == 'local')): self.add_condor_cmd('environment','PYTHONPATH=$PYTHONPATH:'+os.path.abspath(os.path.dirname(self.candUtil))) else: self.add_condor_cmd('should_transfer_files','yes') self.add_condor_cmd('when_to_transfer_output','on_exit') self.add_condor_cmd('transfer_input_files',self.candUtil) self.add_condor_cmd('initialdir',self.initialDir) #Setp escaping possible quotes in threshold string! optionTextList=[str('expression-threshold'),str('percentile-cut')] for optionText in optionTextList: oldVal=None if cp.has_option('candidatethreshold',optionText): oldVal=cp.get('candidatethreshold',optionText) newVal=str(oldVal) #New shell escape for latest condor 7.2.4 if newVal.__contains__('"'): newVal=str(newVal).replace('"','""') cp.set('candidatethreshold',optionText,newVal) for sec in ['candidatethreshold']: self.add_ini_opts(cp,sec) if oldVal != None: cp.set('candidatethreshold',optionText,oldVal) | 2bf156950a8e87899e02d51b15c066f02356afbf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/2bf156950a8e87899e02d51b15c066f02356afbf/tracksearch.py |
|
for sec in ['candidatethreshold']: self.add_ini_opts(cp,sec) | oldValList.append((optionText,oldVal)) for sec in ['candidatethreshold']: self.add_ini_opts(cp,sec) for myOpt,oldVal in oldValList: | def __init__(self,cp,block_id,dagDir,channel=''): self.dagDirectory=dagDir self.__executable = cp.get('condor','clustertool') self.__universe= cp .get('condor','clustertool_universe') pipeline.CondorDAGJob.__init__(self,self.__universe,self.__executable) pipeline.AnalysisJob.__init__(self,cp) self.add_condor_cmd('getenv','True') self.block_id=blockID=block_id #layerID='RESULTS_'+str(blockID) layerID='RESULTS_'+channel+'_'+str(blockID) #Do not set channel name information here. This puts all #threshold output files into same place self.initialDir=layerPath=determineLayerPath(cp,blockID,layerID) blockPath=determineBlockPath(cp,blockID,channel) #Setup needed directories for this job to write in! buildDir(blockPath) buildDir(layerPath) buildDir(blockPath+'/logs') self.set_stdout_file(os.path.normpath(blockPath+'/logs/tracksearchThreshold-$(cluster)-$(process).out')) self.set_stderr_file(os.path.normpath(blockPath+'/logs/tracksearchThreshold-$(cluster)-$(process).err')) filename="/tracksearchThreshold--"+str(channel)+".sub" self.set_sub_file(os.path.normpath(self.dagDirectory+filename)) #Load in the cluster configuration sections! #Add the candidateUtils.py equivalent library to dag for proper #execution! self.candUtil=str(cp.get('pylibraryfiles','pyutilfile')) if ((self.__universe == 'scheduler') or (self.__universe == 'local')): self.add_condor_cmd('environment','PYTHONPATH=$PYTHONPATH:'+os.path.abspath(os.path.dirname(self.candUtil))) else: self.add_condor_cmd('should_transfer_files','yes') self.add_condor_cmd('when_to_transfer_output','on_exit') self.add_condor_cmd('transfer_input_files',self.candUtil) self.add_condor_cmd('initialdir',self.initialDir) #Setp escaping possible quotes in threshold string! optionTextList=[str('expression-threshold'),str('percentile-cut')] for optionText in optionTextList: oldVal=None if cp.has_option('candidatethreshold',optionText): oldVal=cp.get('candidatethreshold',optionText) newVal=str(oldVal) #New shell escape for latest condor 7.2.4 if newVal.__contains__('"'): newVal=str(newVal).replace('"','""') cp.set('candidatethreshold',optionText,newVal) for sec in ['candidatethreshold']: self.add_ini_opts(cp,sec) if oldVal != None: cp.set('candidatethreshold',optionText,oldVal) | 2bf156950a8e87899e02d51b15c066f02356afbf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/2bf156950a8e87899e02d51b15c066f02356afbf/tracksearch.py |
cp.set('candidatethreshold',optionText,oldVal) | cp.set('candidatethreshold',myOpt,oldVal) | def __init__(self,cp,block_id,dagDir,channel=''): self.dagDirectory=dagDir self.__executable = cp.get('condor','clustertool') self.__universe= cp .get('condor','clustertool_universe') pipeline.CondorDAGJob.__init__(self,self.__universe,self.__executable) pipeline.AnalysisJob.__init__(self,cp) self.add_condor_cmd('getenv','True') self.block_id=blockID=block_id #layerID='RESULTS_'+str(blockID) layerID='RESULTS_'+channel+'_'+str(blockID) #Do not set channel name information here. This puts all #threshold output files into same place self.initialDir=layerPath=determineLayerPath(cp,blockID,layerID) blockPath=determineBlockPath(cp,blockID,channel) #Setup needed directories for this job to write in! buildDir(blockPath) buildDir(layerPath) buildDir(blockPath+'/logs') self.set_stdout_file(os.path.normpath(blockPath+'/logs/tracksearchThreshold-$(cluster)-$(process).out')) self.set_stderr_file(os.path.normpath(blockPath+'/logs/tracksearchThreshold-$(cluster)-$(process).err')) filename="/tracksearchThreshold--"+str(channel)+".sub" self.set_sub_file(os.path.normpath(self.dagDirectory+filename)) #Load in the cluster configuration sections! #Add the candidateUtils.py equivalent library to dag for proper #execution! self.candUtil=str(cp.get('pylibraryfiles','pyutilfile')) if ((self.__universe == 'scheduler') or (self.__universe == 'local')): self.add_condor_cmd('environment','PYTHONPATH=$PYTHONPATH:'+os.path.abspath(os.path.dirname(self.candUtil))) else: self.add_condor_cmd('should_transfer_files','yes') self.add_condor_cmd('when_to_transfer_output','on_exit') self.add_condor_cmd('transfer_input_files',self.candUtil) self.add_condor_cmd('initialdir',self.initialDir) #Setp escaping possible quotes in threshold string! optionTextList=[str('expression-threshold'),str('percentile-cut')] for optionText in optionTextList: oldVal=None if cp.has_option('candidatethreshold',optionText): oldVal=cp.get('candidatethreshold',optionText) newVal=str(oldVal) #New shell escape for latest condor 7.2.4 if newVal.__contains__('"'): newVal=str(newVal).replace('"','""') cp.set('candidatethreshold',optionText,newVal) for sec in ['candidatethreshold']: self.add_ini_opts(cp,sec) if oldVal != None: cp.set('candidatethreshold',optionText,oldVal) | 2bf156950a8e87899e02d51b15c066f02356afbf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/2bf156950a8e87899e02d51b15c066f02356afbf/tracksearch.py |
for x in self.ifos: if x not in self.__backgroundPickle__.keys(): sys.stderr.write("Could not either open or save DQ \ background in %s.\n"%(self.__backgroundPickle__)) self.__backgroundResults__=list() self.__backgroundTimesDict__=dict() self.__backgroundDict__=dict() self.__haveBackgroundDict__=bool(False) return | if not self.__haveBackgroundDict__: sys.stderr.write("Could not either open or save DQ \ background in %s no background data available!\n"%(self.__backgroundPickle__)) self.__backgroundResults__=list() self.__backgroundTimesDict__=dict() self.__backgroundDict__=dict() self.__haveBackgroundDict__=bool(False) return | def estimateDQbackground(self): """ This method looks at the self.resultlist inside the instance. Using this and 1000 generated time stamp it tabulates a ranking of flag prevelance, binomial probability 'p' """ if len(self.resultList) < 1: self.__backgroundResults__=list() self.__backgroundTimesDict__=dict() self.__backgroundDict__=dict() self.__haveBackgroundDict__=bool(False) return #Create DQ background, specify pickle locale to try and load first #Determine which IFOs from DQ listing uniqIfos=list() for ifo,b,c,d,e,f in self.resultList: if ifo not in uniqIfos: uniqIfos.append(ifo) ifoEpochList=[(x,getRunEpoch(self.triggerTime,x)) for x in self.ifos] self.createDQbackground(ifoEpochList,self.__backgroundPickle__) for x in self.ifos: if x not in self.__backgroundPickle__.keys(): sys.stderr.write("Could not either open or save DQ \ | 94dbbcc188e5f8f0fa5a09c0af0988c2f139c5c4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/94dbbcc188e5f8f0fa5a09c0af0988c2f139c5c4/fu_utils.py |
... self.items = [] | ... self.items = {} ... self.next_id = 1 | ... def __init__(self): | 11b478972152a15fce1de03ba52e6a7774bb2569 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10444/11b478972152a15fce1de03ba52e6a7774bb2569/add.py |
... self.items.append(MockBooking(**kwargs)) | ... booking_id = str(self.next_id) ... self.next_id += 1 ... self.items[booking_id] = MockBooking(**kwargs) ... return booking_id | ... def invokeFactory(self, type, **kwargs): | 11b478972152a15fce1de03ba52e6a7774bb2569 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10444/11b478972152a15fce1de03ba52e6a7774bb2569/add.py |
... return [x.id for x in self.items] | ... return self.items.keys() ... def get(self, id): ... return self.items.get(id) | ... def objectIds(self): | 11b478972152a15fce1de03ba52e6a7774bb2569 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10444/11b478972152a15fce1de03ba52e6a7774bb2569/add.py |
>>> booking = context.items[0] | >>> booking = context.get('1') | ... def objectIds(self): | 11b478972152a15fce1de03ba52e6a7774bb2569 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10444/11b478972152a15fce1de03ba52e6a7774bb2569/add.py |
>>> booking = context.items[-1] | >>> booking = context.get('2') | ... def objectIds(self): | 11b478972152a15fce1de03ba52e6a7774bb2569 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10444/11b478972152a15fce1de03ba52e6a7774bb2569/add.py |
>>> booking = context.items[-1] | >>> booking = context.get('3') | ... def objectIds(self): | 11b478972152a15fce1de03ba52e6a7774bb2569 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10444/11b478972152a15fce1de03ba52e6a7774bb2569/add.py |
>>> booking = context.items[-1] | >>> booking = context.get('4') | ... def objectIds(self): | 11b478972152a15fce1de03ba52e6a7774bb2569 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10444/11b478972152a15fce1de03ba52e6a7774bb2569/add.py |
context.invokeFactory('Booking', id=str(idx), title=title, hours=hours, minutes=minutes, description=description, bookingDate=day) | booking_id = context.invokeFactory( 'Booking', id=str(idx), title=title, hours=hours, minutes=minutes, description=description, bookingDate=day) obj = context.get(booking_id) obj.unmarkCreationFlag() | ... def objectIds(self): | 11b478972152a15fce1de03ba52e6a7774bb2569 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10444/11b478972152a15fce1de03ba52e6a7774bb2569/add.py |
u = User.objects.get(id=int(id)) | try: u = User.objects.get(id=int(id)) except User.DoesNotExist: continue | def member_list(request, eid=None): if 'event' in request.REQUEST: return HttpResponseRedirect('/member_list/%s/' % request.REQUEST['event']) if request.method == 'POST': if not request.user.profile.is_admin: message(request, 'Error: you are not an administrator!') return HttpResponseRedirect('/member_list') action = request.POST['action'] if request.POST.get('eid','') != "-1": e = Event.objects.get(id=int(request.POST['eid'])) if e.is_team: t = Team(event=e, chapter=request.chapter) new_members = [] message(request, 'A new %s team was created.' % e.name) else: e = None for key, val in request.POST.items(): if key.startswith('id_'): # For each id field, check to see if the id has changed, and save if it has trash, id = key.split('_') u = User.objects.get(id=int(id)) if u.profile.indi_id != val: u.profile.indi_id = val u.profile.save() if key.startswith('edit_'): # For user checkboxes, perform the action selected on the selected users trash, id = key.split('_') u = User.objects.get(id=int(id)) if action == 'promote': u.profile.is_admin = True u.profile.is_member = True u.profile.save() message(request, '%s promoted to administrator.' % name(u)) log(request, 'user_edit', '%s promoted %s to an administrator.' % (name(request.user), name(u)), u) elif action == 'demote': if u == request.user: message(request, 'Error: you cannot demote yourself.') return HttpResponseRedirect('/member_list') u.profile.is_admin = False u.profile.is_member = True u.profile.save() message(request, '%s changed to normal member.' % name(u)) log(request, 'user_edit', '%s changed %s to a regular member.' % (name(request.user), name(u)), u) elif action == 'advisor': u.profile.is_admin = True u.profile.is_member = False u.profile.save() message(request, '%s changed to advisor.' % name(u)) log(request, 'user_edit', '%s changed %s to an advisor.' % (name(request.user), name(u)), u) elif action == 'delete': if u == request.user: message(request, 'Error: you cannot delete yourself.') return HttpResponseRedirect('/member_list') message(request, '%s deleted.' % name(u)) log(request, 'user_delete', "%s deleted %s's account." % (name(request.user), name(u))) u.delete() elif request.POST.get('eid','') != "-1": #u = User.objects.get(id=int(request.GET['uid'])) #e = Event.objects.get(id=int(request.POST['eid'])) if e.is_team: new_members.append(u) message(request, '%s was added to the new team.' % name(u)) else: u.events.add(e) message(request, '%s has been added to %s\'s events.' % (e.name, name(u))) log(request, 'event_add', '%s added %s to %s\'s events.' % (name(request.user), e.name, name(u)), affected=u) else: pass if e and e.is_team == True: t.captain = new_members[0] message(request, '%s was selected to be the team captain.' % name(t.captain)) t.save() for member in new_members: t.members.add(member) if request.GET.get('action') and request.user.profile.is_admin: action = request.GET.get('action') if action == 'remove_event': u = User.objects.get(id=int(request.GET['uid'])) e = Event.objects.get(id=int(request.GET['eid'])) u.events.remove(e) message(request, '%s has been removed from %s\'s events.' % (e.name, name(u))) log(request, 'event_remove', '%s removed %s from %s\'s events.' % (name(request.user), e.name, name(u)), affected=u) if eid is not None: e = Event.objects.get(id=eid) members = e.entrants else: members = User.objects.all() members = members.filter(profile__chapter=request.chapter, is_superuser=False) members = members.order_by('-profile__is_member', '-profile__is_admin', 'last_name') return render_template('member_list.mako',request, members=members, selected_event = eid, events=request.chapter.get_events(), ) | b4995c23e284aaa8116244499b1b1957f83aaa3f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12766/b4995c23e284aaa8116244499b1b1957f83aaa3f/views_lists.py |
return render_template('errors/404.mako', request, parent='../base.mako' if request.user else '../layout.mako') | return render_template('errors/404.mako', request, parent='../base.mako' if request.user.is_authenticated() else '../layout.mako') | def custom404(request): print request.user return render_template('errors/404.mako', request, parent='../base.mako' if request.user else '../layout.mako') | dacd5c84720d9ff48e37aa603bb803175874007d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12766/dacd5c84720d9ff48e37aa603bb803175874007d/views.py |
return render_template('errors/500.mako', request, parent='../base.mako' if request.user else '../layout.mako') | return render_template('errors/500.mako', request, parent='../base.mako' if request.user.is_authenticated() else '../layout.mako') | def custom500(request): return render_template('errors/500.mako', request, parent='../base.mako' if request.user else '../layout.mako') | dacd5c84720d9ff48e37aa603bb803175874007d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12766/dacd5c84720d9ff48e37aa603bb803175874007d/views.py |
for event in chapter.calendar_events.filter(date__gte=datetime.date.today()): | for event in (chapter.link or chapter).calendar_events.filter(date__gte=datetime.date.today()): | def calendar(request): if 'chapter' not in request.GET: return HttpResponse('No chapter specified.') chapter = Chapter.objects.get(id=int(request.GET['chapter'])) if 'key' not in request.GET or chapter.calendar_key != request.GET['key']: return HttpResponse('Invalid key specified.') cal = vobject.iCalendar() cal.add('method').value = 'PUBLISH' # IE/Outlook needs this for event in chapter.calendar_events.filter(date__gte=datetime.date.today()): vevent = cal.add('vevent') vevent.add('summary').value = event.name vevent.add('dtstart').value = event.date icalstream = cal.serialize() response = HttpResponse(icalstream)#, mimetype='text/calendar') response['Filename'] = 'calendar.ics' # IE needs this response['Content-Disposition'] = 'attachment; filename=calendar.ics' return response | 47a01ebe595204dc02fe03fce7b07fe49d64a469 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12766/47a01ebe595204dc02fe03fce7b07fe49d64a469/views.py |
confirm_password = request.POST['password'] | confirm_password = request.POST['confirm_password'] | def reset_password(request): if request.method == 'POST': if 'username' in request.POST: try: user = User.objects.get(Q(username=request.POST['username']) | Q(email=request.POST['username'])) except User.DoesNotExist: return render_template('registration/request_reset.mako', request, error_msg='Unknown username or email address') t = get_template('email/reset_password.mako') body = t.render(name=user.first_name, chapter=user.profile.chapter.name, uid=user.id, token=get_token(user)) try: send_mail('TSAEvents Password Reset', body, '%s TSA <[email protected]>' % user.profile.chapter.name, [user.email], fail_silently=False) except SMTPException: return render_template('registration/request_reset.mako', request, error_msg='Unable to send email. Contact server administrator.') return render_template('registration/request_reset.mako', request, success_msg='Further instructions have been sent to your email address.') if 'password' in request.POST: uid = int(request.POST['user']) auth = request.POST.get('auth','') user = User.objects.get(id=uid) if not verify_token(user, auth): return render_template('registration/request_reset.mako', request, error_msg='Invalid authentication token. Try re-sending the email.') password = request.POST['password'] confirm_password = request.POST['password'] if password != confirm_password: return render_template('registration/perform_reset.mako', reques, user=uid, auth=auth , error_msg='Error: passwords do not match.') user.set_password(password) user = authenticate(username=user.username, password=password) login(request, user) message(request, 'New password set. You have been automatically logged in.') return HttpResponseRedirect('/') elif 'user' in request.GET: uid = int(request.GET['user']) auth = request.GET.get('auth','') user = User.objects.get(id=uid) if verify_token(user, auth): return render_template('registration/perform_reset.mako', request, uid=uid, auth=auth ) else: return render_template('registration/request_reset.mako', request, error_msg='Invalid authentication token. Try re-sending the email.') return render_template('registration/request_reset.mako', request) | a0e6cd19fffc087a4e2af8b8504533f834e90341 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12766/a0e6cd19fffc087a4e2af8b8504533f834e90341/views.py |
return render_template('registration/perform_reset.mako', reques, user=uid, auth=auth , error_msg='Error: passwords do not match.') | return render_template('registration/perform_reset.mako', request, user=uid, auth=auth , error_msg='Error: passwords do not match.') | def reset_password(request): if request.method == 'POST': if 'username' in request.POST: try: user = User.objects.get(Q(username=request.POST['username']) | Q(email=request.POST['username'])) except User.DoesNotExist: return render_template('registration/request_reset.mako', request, error_msg='Unknown username or email address') t = get_template('email/reset_password.mako') body = t.render(name=user.first_name, chapter=user.profile.chapter.name, uid=user.id, token=get_token(user)) try: send_mail('TSAEvents Password Reset', body, '%s TSA <[email protected]>' % user.profile.chapter.name, [user.email], fail_silently=False) except SMTPException: return render_template('registration/request_reset.mako', request, error_msg='Unable to send email. Contact server administrator.') return render_template('registration/request_reset.mako', request, success_msg='Further instructions have been sent to your email address.') if 'password' in request.POST: uid = int(request.POST['user']) auth = request.POST.get('auth','') user = User.objects.get(id=uid) if not verify_token(user, auth): return render_template('registration/request_reset.mako', request, error_msg='Invalid authentication token. Try re-sending the email.') password = request.POST['password'] confirm_password = request.POST['password'] if password != confirm_password: return render_template('registration/perform_reset.mako', reques, user=uid, auth=auth , error_msg='Error: passwords do not match.') user.set_password(password) user = authenticate(username=user.username, password=password) login(request, user) message(request, 'New password set. You have been automatically logged in.') return HttpResponseRedirect('/') elif 'user' in request.GET: uid = int(request.GET['user']) auth = request.GET.get('auth','') user = User.objects.get(id=uid) if verify_token(user, auth): return render_template('registration/perform_reset.mako', request, uid=uid, auth=auth ) else: return render_template('registration/request_reset.mako', request, error_msg='Invalid authentication token. Try re-sending the email.') return render_template('registration/request_reset.mako', request) | a0e6cd19fffc087a4e2af8b8504533f834e90341 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12766/a0e6cd19fffc087a4e2af8b8504533f834e90341/views.py |
return render_template('registration/perform_reset.mako', request, user=uid, auth=auth ) | return render_template('registration/perform_reset.mako', request, uid=uid, auth=auth ) | def reset_password(request): if request.method == 'POST': if 'username' in request.POST: try: user = User.objects.get(Q(username=request.POST['username']) | Q(email=request.POST['username'])) except User.DoesNotExist: return render_template('registration/request_reset.mako', request, error_msg='Unknown username or email address') t = get_template('email/reset_password.mako') body = t.render(name=user.first_name, chapter=user.profile.chapter.name, uid=user.id, token=get_token(user)) try: send_mail('TSAEvents Password Reset', body, '%s TSA <[email protected]>' % user.profile.chapter.name, [user.email], fail_silently=False) except SMTPException: return render_template('registration/request_reset.mako', request, error_msg='Unable to send email. Contact server administrator.') return render_template('registration/request_reset.mako', request, success_msg='Further instructions have been sent to your email address.') if 'password' in request.POST: uid = int(request.POST['user']) auth = request.POST.get('auth','') user = User.objects.get(id=uid) if not verify_token(user, auth): return render_template('registration/request_reset.mako', request, error_msg='Invalid authentication token. Try re-sending the email.') password = request.POST['password'] confirm_password = request.POST['password'] if password != confirm_password: return render_template('registration/perform_reset.mako', reques, user=uid, auth=auth , error_msg='Error: passwords do not match.') user.set_password(password) user = authenticate(username=user.username, password=password) login(request, user) message(request, 'New password set. You have been automatically logged in.') return HttpResponseRedirect('/') elif 'user' in request.GET: uid = int(request.GET['user']) auth = request.GET.get('auth','') user = User.objects.get(id=uid) if verify_token(user, auth): return render_template('registration/perform_reset.mako', request, user=uid, auth=auth ) else: return render_template('registration/request_reset.mako', request, error_msg='Invalid authentication token. Try re-sending the email.') return render_template('registration/request_reset.mako', request) | dd9530eaab13e607db23122a3f3aab12c8f6c2d3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12766/dd9530eaab13e607db23122a3f3aab12c8f6c2d3/views.py |
gtk.main() | if _main_loop: _main_loop.run() else: gtk.main() | def run(self): self.success = False self._timeout_count = 0 | 4d402ab8b98837e718d887827d3d5e283cd599e1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/4d402ab8b98837e718d887827d3d5e283cd599e1/waiters.py |
if gtk.main_level(): gtk.main_quit() | if _main_loop: _main_loop.quit() else: if gtk.main_level(): gtk.main_quit() | def _timeout_cb(self): if self.success: # dispose of previous waiters. return False self._timeout_count += 1 self.poll() if self._timeout_count >= self.timeout or self.success: try: if gtk.main_level(): gtk.main_quit() except RuntimeError: # In Mandriva RuntimeError exception is thrown # If, gtk.main was already quit pass return False return True | 4d402ab8b98837e718d887827d3d5e283cd599e1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/4d402ab8b98837e718d887827d3d5e283cd599e1/waiters.py |
if gtk.main_level(): gtk.main_quit() | if _main_loop: _main_loop.quit() else: if gtk.main_level(): gtk.main_quit() | def _event_cb(self, event): self.event_cb(event) if self.success: try: if gtk.main_level(): gtk.main_quit() except RuntimeError: # In Mandriva RuntimeError exception is thrown # If, gtk.main was already quit pass | 4d402ab8b98837e718d887827d3d5e283cd599e1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/4d402ab8b98837e718d887827d3d5e283cd599e1/waiters.py |
''' | """ | def generatemouseevent(self, x, y, eventType = 'b1c'): ''' Generate mouse event on x, y co-ordinates. @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: int @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy @type object_name: int | 2840728a35706bfd7cd3e236c75533448a30fc1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/2840728a35706bfd7cd3e236c75533448a30fc1d/mouse.py |
''' | """ | def generatemouseevent(self, x, y, eventType = 'b1c'): ''' Generate mouse event on x, y co-ordinates. @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: int @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy @type object_name: int | 2840728a35706bfd7cd3e236c75533448a30fc1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/2840728a35706bfd7cd3e236c75533448a30fc1d/mouse.py |
''' | """ | def mouseleftclick(self, window_name, object_name): ''' Mouse left click on an object. @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy @type object_name: string | 2840728a35706bfd7cd3e236c75533448a30fc1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/2840728a35706bfd7cd3e236c75533448a30fc1d/mouse.py |
''' | """ | def mouseleftclick(self, window_name, object_name): ''' Mouse left click on an object. @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy @type object_name: string | 2840728a35706bfd7cd3e236c75533448a30fc1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/2840728a35706bfd7cd3e236c75533448a30fc1d/mouse.py |
''' | """ | def mousemove(self, window_name, object_name): ''' Mouse move on an object. @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy @type object_name: string | 2840728a35706bfd7cd3e236c75533448a30fc1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/2840728a35706bfd7cd3e236c75533448a30fc1d/mouse.py |
''' | """ | def mousemove(self, window_name, object_name): ''' Mouse move on an object. @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy @type object_name: string | 2840728a35706bfd7cd3e236c75533448a30fc1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/2840728a35706bfd7cd3e236c75533448a30fc1d/mouse.py |
''' | """ | def mouserightclick(self, window_name, object_name): ''' Mouse right click on an object. @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy @type object_name: string | 2840728a35706bfd7cd3e236c75533448a30fc1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/2840728a35706bfd7cd3e236c75533448a30fc1d/mouse.py |
''' | """ | def mouserightclick(self, window_name, object_name): ''' Mouse right click on an object. @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy @type object_name: string | 2840728a35706bfd7cd3e236c75533448a30fc1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/2840728a35706bfd7cd3e236c75533448a30fc1d/mouse.py |
''' | """ | def doubleclick(self, window_name, object_name): ''' Double click on the object @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy @type object_name: string | 2840728a35706bfd7cd3e236c75533448a30fc1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/2840728a35706bfd7cd3e236c75533448a30fc1d/mouse.py |
''' | """ | def doubleclick(self, window_name, object_name): ''' Double click on the object @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. Or menu heirarchy @type object_name: string | 2840728a35706bfd7cd3e236c75533448a30fc1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/2840728a35706bfd7cd3e236c75533448a30fc1d/mouse.py |
def __call__(self, *args, **kwargs): logger.debug('%s(%s)' % \ (self.__name, ', '.join(map(repr, args)+['%s=%s' % (k, repr(v)) for k, v in kwargs.items()]))) args += (kwargs,) return self.__send(self.__name, args) | c979caa406fcc3b264af368e618797bca44baac4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/c979caa406fcc3b264af368e618797bca44baac4/client.py |
||
if cls._isRemoteMethod(d[attr]) and cls._isRelevant(d[attr]): | if cls._isRemoteMethod(d[attr]): | def __new__(cls, *args, **kwargs): if not cls._generated: cls._generated = True d = ldtp.__dict__ cls._wrapped_methods =[] for attr in d: if cls._isRemoteMethod(d[attr]) and cls._isRelevant(d[attr]): setted = attr if hasattr(cls, attr): setted = "_remote_"+setted cls._wrapped_methods.append(setted) setattr(cls, setted, d[attr]) return object.__new__(cls) | 013692654065af9a83de517d76b3e3ef6da24f65 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/013692654065af9a83de517d76b3e3ef6da24f65/_context.py |
def getchild(self, child_name='', role=''): matches = self._remote_getchild(child_name, role, True) if matches: if role: return [Component(self._window_name, matches[0])] else: return Component(self._window_name, matches[0]) else: return None | def getchild(self, child_name='', role=''): # TODO: Bad API choice. Inconsistent, should return object or list, # not both. UPDATE: Only returns first match. matches = self._remote_getchild(child_name, role, True) if matches: if role: return [Component(self._window_name, matches[0])] else: return Component(self._window_name, matches[0]) else: return None | 013692654065af9a83de517d76b3e3ef6da24f65 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/013692654065af9a83de517d76b3e3ef6da24f65/_context.py |
|
def _isRelevant(cls, obj): args = cls._listArgs(obj) return len(args) >= 2 and \ 'window_name' == args[0] and 'object_name' == args[1] | 013692654065af9a83de517d76b3e3ef6da24f65 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/013692654065af9a83de517d76b3e3ef6da24f65/_context.py |
||
self._callback = {} | def __init__(self): lazy_load = True self._states = {} self._state_names = {} self._callback = {} self._window_uptime = {} self._callback_event = [] self._get_all_state_names() self._handle_table_cell = False self._desktop = pyatspi.Registry.getDesktop(0) if Utils.cached_apps is None: pyatspi.Registry.registerEventListener( self._on_window_event, 'window') Utils.cached_apps = list() if lazy_load: for app in self._desktop: if app is None: continue self.cached_apps.append(app) | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
|
for app in list(self.cached_apps): | for app in self.cached_apps: | def _list_apps(self): for app in list(self.cached_apps): if not app: continue yield app | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
for app in list(self.cached_apps): | for app in self.cached_apps: | def _list_guis(self): for app in list(self.cached_apps): if not app: continue try: for gui in app: if not gui: continue yield gui except LookupError: self.cached_apps.remove(app) | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
try: if acc.name == name: | if acc.name == name: return 1 _ldtpize_accessible_name = self._ldtpize_accessible(acc) _object_name = u'%s%s' % (_ldtpize_accessible_name[0], _ldtpize_accessible_name[1]) if _object_name == name: return 1 if self._glob_match(name, acc.name): return 1 if self._glob_match(name, _object_name): return 1 role = acc.getRole() if role == pyatspi.ROLE_FRAME or role == pyatspi.ROLE_DIALOG or \ role == pyatspi.ROLE_WINDOW or \ role == pyatspi.ROLE_FONT_CHOOSER or \ role == pyatspi.ROLE_FILE_CHOOSER or \ role == pyatspi.ROLE_ALERT or \ role == pyatspi.ROLE_COLOR_CHOOSER: strip = '( |\n)' else: strip = '( |:|\.|_|\n)' _tmp_name = re.sub(strip, '', name) if self._glob_match(_tmp_name, _object_name): return 1 if self._glob_match(_tmp_name, _ldtpize_accessible_name[1]): return 1 return 0 def _match_name_to_appmap(self, name, acc): if self._glob_match(name, acc['key']): return 1 if self._glob_match(name, acc['obj_index']): return 1 if self._glob_match(name, acc['label_by']): return 1 if self._glob_match(name, acc['label']): return 1 obj_name = u'%s' % re.sub(' ', '', name) role = acc['class'] if role == 'frame' or role == 'dialog' or \ role == 'window' or \ role == 'font_chooser' or \ role == 'file_chooser' or \ role == 'alert' or \ role == 'color_chooser': strip = '( |\n)' else: strip = '( |:|\.|_|\n)' obj_name = re.sub(strip, '', name) if acc['label_by']: _tmp_name = re.sub(strip, '', acc['label_by']) if self._glob_match(obj_name, _tmp_name): | def _match_name_to_acc(self, name, acc): try: if acc.name == name: return 1 _ldtpize_accessible_name = self._ldtpize_accessible(acc) _object_name = u'%s%s' % (_ldtpize_accessible_name[0], _ldtpize_accessible_name[1]) if _object_name == name: return 1 if self._glob_match(name, acc.name): return 1 if self._glob_match(name, _object_name): return 1 role = acc.getRole() if role == pyatspi.ROLE_FRAME or role == pyatspi.ROLE_DIALOG or \ role == pyatspi.ROLE_WINDOW or \ role == pyatspi.ROLE_FONT_CHOOSER or \ role == pyatspi.ROLE_FILE_CHOOSER or \ role == pyatspi.ROLE_ALERT or \ role == pyatspi.ROLE_COLOR_CHOOSER: strip = '( |\n)' else: strip = '( |:|\.|_|\n)' _tmp_name = re.sub(strip, '', name) if self._glob_match(_tmp_name, _object_name): return 1 if self._glob_match(_tmp_name, _ldtpize_accessible_name[1]): return 1 except: pass return 0 | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
_ldtpize_accessible_name = self._ldtpize_accessible(acc) _object_name = u'%s%s' % (_ldtpize_accessible_name[0], _ldtpize_accessible_name[1]) if _object_name == name: | if acc['label']: _tmp_name = re.sub(strip, '', acc['label']) if self._glob_match(obj_name, _tmp_name): | def _match_name_to_acc(self, name, acc): try: if acc.name == name: return 1 _ldtpize_accessible_name = self._ldtpize_accessible(acc) _object_name = u'%s%s' % (_ldtpize_accessible_name[0], _ldtpize_accessible_name[1]) if _object_name == name: return 1 if self._glob_match(name, acc.name): return 1 if self._glob_match(name, _object_name): return 1 role = acc.getRole() if role == pyatspi.ROLE_FRAME or role == pyatspi.ROLE_DIALOG or \ role == pyatspi.ROLE_WINDOW or \ role == pyatspi.ROLE_FONT_CHOOSER or \ role == pyatspi.ROLE_FILE_CHOOSER or \ role == pyatspi.ROLE_ALERT or \ role == pyatspi.ROLE_COLOR_CHOOSER: strip = '( |\n)' else: strip = '( |:|\.|_|\n)' _tmp_name = re.sub(strip, '', name) if self._glob_match(_tmp_name, _object_name): return 1 if self._glob_match(_tmp_name, _ldtpize_accessible_name[1]): return 1 except: pass return 0 | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
if self._glob_match(name, acc.name): return 1 if self._glob_match(name, _object_name): return 1 role = acc.getRole() if role == pyatspi.ROLE_FRAME or role == pyatspi.ROLE_DIALOG or \ role == pyatspi.ROLE_WINDOW or \ role == pyatspi.ROLE_FONT_CHOOSER or \ role == pyatspi.ROLE_FILE_CHOOSER or \ role == pyatspi.ROLE_ALERT or \ role == pyatspi.ROLE_COLOR_CHOOSER: strip = '( |\n)' else: strip = '( |:|\.|_|\n)' _tmp_name = re.sub(strip, '', name) if self._glob_match(_tmp_name, _object_name): return 1 if self._glob_match(_tmp_name, _ldtpize_accessible_name[1]): return 1 except: pass return 0 def _match_name_to_appmap(self, name, appmap_name): """ Required when object name has empty label """ if name == appmap_name: return 1 if self._glob_match(name, appmap_name): | if self._glob_match(obj_name, acc['key']): | def _match_name_to_acc(self, name, acc): try: if acc.name == name: return 1 _ldtpize_accessible_name = self._ldtpize_accessible(acc) _object_name = u'%s%s' % (_ldtpize_accessible_name[0], _ldtpize_accessible_name[1]) if _object_name == name: return 1 if self._glob_match(name, acc.name): return 1 if self._glob_match(name, _object_name): return 1 role = acc.getRole() if role == pyatspi.ROLE_FRAME or role == pyatspi.ROLE_DIALOG or \ role == pyatspi.ROLE_WINDOW or \ role == pyatspi.ROLE_FONT_CHOOSER or \ role == pyatspi.ROLE_FILE_CHOOSER or \ role == pyatspi.ROLE_ALERT or \ role == pyatspi.ROLE_COLOR_CHOOSER: strip = '( |\n)' else: strip = '( |:|\.|_|\n)' _tmp_name = re.sub(strip, '', name) if self._glob_match(_tmp_name, _object_name): return 1 if self._glob_match(_tmp_name, _ldtpize_accessible_name[1]): return 1 except: pass return 0 | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
if child and child.getRole() == pyatspi.ROLE_TABLE_CELL and \ | if child.getRole() == pyatspi.ROLE_TABLE_CELL and \ | def _list_objects(self, obj): if obj: yield obj for child in obj: if child and child.getRole() == pyatspi.ROLE_TABLE_CELL and \ not self._handle_table_cell: # In OO.o navigating table cells consumes more time # and resource break for c in self._list_objects(child): yield c | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
def _list_objects(self, obj): if obj: yield obj for child in obj: if child and child.getRole() == pyatspi.ROLE_TABLE_CELL and \ not self._handle_table_cell: # In OO.o navigating table cells consumes more time # and resource break for c in self._list_objects(child): yield c | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
||
try: if obj: for child in obj: if not child: continue if child.childCount > 0: child_obj = self._get_combo_child_object_type(child) if child_obj: return child_obj if child.getRole() == pyatspi.ROLE_LIST: return child elif child.getRole() == pyatspi.ROLE_MENU: return child except: pass return None | if obj: for child in obj: if not child: continue if child.childCount > 0: child_obj = self._get_combo_child_object_type(child) if child_obj: return child_obj if child.getRole() == pyatspi.ROLE_LIST: return child elif child.getRole() == pyatspi.ROLE_MENU: return child | def _get_combo_child_object_type(self, obj): """ This function will check for all levels and returns the first matching LIST / MENU type """ try: if obj: for child in obj: if not child: continue if child.childCount > 0: child_obj = self._get_combo_child_object_type(child) if child_obj: return child_obj if child.getRole() == pyatspi.ROLE_LIST: return child elif child.getRole() == pyatspi.ROLE_MENU: return child except: pass return None | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
try: if obj and role_type: for child in obj: if not child: continue if child.childCount > 0: child_obj = self._get_child_object_type(child, role_type) if child_obj: return child_obj if child.getRole() == role_type: return child except: pass return None def _appmap_pairs(self, gui): ldtpized_list = [] ldtpized_obj_index = {} for obj in self._list_objects(gui): abbrev_role, abbrev_name = self._ldtpize_accessible(obj) if abbrev_role in ldtpized_obj_index: ldtpized_obj_index[abbrev_role] += 1 else: ldtpized_obj_index[abbrev_role] = 0 if abbrev_name == '': ldtpized_name_base = abbrev_role ldtpized_name = u'%s%d' % (ldtpized_name_base, ldtpized_obj_index[abbrev_role]) else: ldtpized_name_base = u'%s%s' % (abbrev_role, abbrev_name) ldtpized_name = ldtpized_name_base i = 1 while ldtpized_name in ldtpized_list: ldtpized_name = u'%s%d' % (ldtpized_name_base, i) i += 1 ldtpized_list.append(ldtpized_name) yield ldtpized_name, obj, u'%s ldtpized_obj_index[abbrev_role]) | if obj and role_type: for child in obj: if not child: continue if child.childCount > 0: child_obj = self._get_child_object_type(child, role_type) if child_obj: return child_obj if child.getRole() == role_type: return child def _add_appmap_data(self, obj, parent): abbrev_role, abbrev_name = self._ldtpize_accessible(obj) if abbrev_role in self.ldtpized_obj_index: self.ldtpized_obj_index[abbrev_role] += 1 else: self.ldtpized_obj_index[abbrev_role] = 0 if abbrev_name == '': ldtpized_name_base = abbrev_role ldtpized_name = u'%s%d' % (ldtpized_name_base, self.ldtpized_obj_index[abbrev_role]) else: ldtpized_name_base = u'%s%s' % (abbrev_role, abbrev_name) ldtpized_name = ldtpized_name_base i = 0 while ldtpized_name in self.ldtpized_list: i += 1 ldtpized_name = u'%s%d' % (ldtpized_name_base, i) if parent in self.ldtpized_list: self.ldtpized_list[parent]['children'].append(ldtpized_name) self.ldtpized_list[ldtpized_name] = {'key' : ldtpized_name, 'parent' : parent, 'class' : obj.getRoleName().replace(' ', '_'), 'child_index' : obj.getIndexInParent(), 'children' : [], 'obj_index' : '%s self.ldtpized_obj_index[abbrev_role]), 'label' : obj.name, 'label_by' : '', 'description' : obj.description } return ldtpized_name def _populate_appmap(self, obj, parent, child_index): if obj: if child_index != -1: parent = self._add_appmap_data(obj, parent) for child in obj: if not child: continue if child.getRole() == pyatspi.ROLE_TABLE_CELL: break self._populate_appmap(child, parent, child.getIndexInParent()) def _appmap_pairs(self, gui, force_remap = False): self.ldtpized_list = {} self.ldtpized_obj_index = {} if not force_remap: for key in self._appmap.keys(): if self._match_name_to_acc(key, gui): return self._appmap[key] abbrev_role, abbrev_name = self._ldtpize_accessible(gui) _window_name = u'%s%s' % (abbrev_role, abbrev_name) abbrev_role, abbrev_name = self._ldtpize_accessible(gui.parent) _parent = abbrev_name self._populate_appmap(gui, _parent, gui.getIndexInParent()) self._appmap[_window_name] = self.ldtpized_list return self.ldtpized_list | def _get_child_object_type(self, obj, role_type): """ This function will check for all levels and returns the first matching role_type """ try: if obj and role_type: for child in obj: if not child: continue if child.childCount > 0: child_obj = self._get_child_object_type(child, role_type) if child_obj: return child_obj if child.getRole() == role_type: return child except: pass return None | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
if not re.search('^mnu', _menu_hierarchy[0]): _menu_hierarchy[0] = 'mnu%s' % _menu_hierarchy[0] | def _get_menu_hierarchy(self, window_name, object_name): _menu_hierarchy = re.split(';', object_name) # Get handle of menu obj = self._get_object(window_name, _menu_hierarchy[0]) # Navigate all sub-menu under a menu for _menu in _menu_hierarchy[1:]: _flag = False for _child in self._list_objects(obj): if obj == _child: # if the given object and child object matches continue if self._match_name_to_acc(_menu, _child): obj = _child _flag = True break if not _flag: raise LdtpServerException ( "Menu item %s doesn't exist in hierarchy" % _menu) return obj | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
|
def _get_menu_hierarchy(self, window_name, object_name): _menu_hierarchy = re.split(';', object_name) # Get handle of menu obj = self._get_object(window_name, _menu_hierarchy[0]) # Navigate all sub-menu under a menu for _menu in _menu_hierarchy[1:]: _flag = False for _child in self._list_objects(obj): if obj == _child: # if the given object and child object matches continue if self._match_name_to_acc(_menu, _child): obj = _child _flag = True break if not _flag: raise LdtpServerException ( "Menu item %s doesn't exist in hierarchy" % _menu) return obj | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
||
_flag = True | def _get_menu_hierarchy(self, window_name, object_name): _menu_hierarchy = re.split(';', object_name) # Get handle of menu obj = self._get_object(window_name, _menu_hierarchy[0]) # Navigate all sub-menu under a menu for _menu in _menu_hierarchy[1:]: _flag = False for _child in self._list_objects(obj): if obj == _child: # if the given object and child object matches continue if self._match_name_to_acc(_menu, _child): obj = _child _flag = True break if not _flag: raise LdtpServerException ( "Menu item %s doesn't exist in hierarchy" % _menu) return obj | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
|
"Menu item %s doesn't exist in hierarchy" % _menu) | 'Menu item "%s" doesn\'t exist in hierarchy' % _menu) | def _get_menu_hierarchy(self, window_name, object_name): _menu_hierarchy = re.split(';', object_name) # Get handle of menu obj = self._get_object(window_name, _menu_hierarchy[0]) # Navigate all sub-menu under a menu for _menu in _menu_hierarchy[1:]: _flag = False for _child in self._list_objects(obj): if obj == _child: # if the given object and child object matches continue if self._match_name_to_acc(_menu, _child): obj = _child _flag = True break if not _flag: raise LdtpServerException ( "Menu item %s doesn't exist in hierarchy" % _menu) return obj | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
raise LdtpServerException('Object does not have a "click" action') | raise LdtpServerException('Object does not have a "%s" action' % action) def _get_object_in_window(self, appmap, obj_name): for name in appmap.keys(): obj = appmap[name] if self._match_name_to_appmap(obj_name, obj): return obj return None | def _click_object(self, obj, action = 'click'): try: iaction = obj.queryAction() except NotImplementedError: raise LdtpServerException( 'Object does not have an Action interface') else: for i in xrange(iaction.nActions): if re.match(action, iaction.getName(i)): iaction.doAction(i) return raise LdtpServerException('Object does not have a "click" action') | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
def _get_object_info(self, window_name, obj_name): | def _get_object(self, window_name, obj_name): | def _get_object_info(self, window_name, obj_name): _window_handle = self._get_window_handle(window_name) if not _window_handle: raise LdtpServerException('Unable to find window "%s"' % \ window_name) for name, obj, obj_index in self._appmap_pairs(_window_handle): if self._glob_match(obj_name, obj_index) or \ self._match_name_to_acc(obj_name, obj) or \ self._match_name_to_appmap(obj_name, name): return name, obj, obj_index raise LdtpServerException( 'Unable to find object name "%s" in application map' % obj_name) | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
for name, obj, obj_index in self._appmap_pairs(_window_handle): if self._glob_match(obj_name, obj_index) or \ self._match_name_to_acc(obj_name, obj) or \ self._match_name_to_appmap(obj_name, name): return name, obj, obj_index raise LdtpServerException( 'Unable to find object name "%s" in application map' % obj_name) def _get_object(self, window_name, obj_name): name, obj, obj_index = self._get_object_info(window_name, obj_name) | appmap = self._appmap_pairs(_window_handle) obj = self._get_object_in_window(appmap, obj_name) if not obj: appmap = self._appmap_pairs(_window_handle, force_remap = True) obj = self._get_object_in_window(appmap, obj_name) if not obj: raise LdtpServerException( 'Unable to find object name "%s" in application map' % obj_name) def _traverse_parent(gui, window_name, obj, parent_list): if obj and window_name: parent = obj['parent'] if parent not in appmap: return parent_list parent_list.append(parent) if self._match_name_to_acc(parent, gui): return parent_list return _traverse_parent(gui, window_name, appmap[parent], parent_list) _parent_list = _traverse_parent(_window_handle, window_name, obj, []) if not _parent_list: raise LdtpServerException( 'Unable to find object name "%s" in application map' % obj_name) _parent_list.reverse() key = obj['key'] if key: _parent_list.append(key) obj = _window_handle for key in _parent_list[1:]: if key in appmap and obj: obj = obj.getChildAtIndex(appmap[key]['child_index']) | def _get_object_info(self, window_name, obj_name): _window_handle = self._get_window_handle(window_name) if not _window_handle: raise LdtpServerException('Unable to find window "%s"' % \ window_name) for name, obj, obj_index in self._appmap_pairs(_window_handle): if self._glob_match(obj_name, obj_index) or \ self._match_name_to_acc(obj_name, obj) or \ self._match_name_to_appmap(obj_name, name): return name, obj, obj_index raise LdtpServerException( 'Unable to find object name "%s" in application map' % obj_name) | 43924f2ba30b8adb9b55c5c34c99a33f800d4022 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/43924f2ba30b8adb9b55c5c34c99a33f800d4022/utils.py |
else: self._ldtp_debug = None | def __init__(self): lazy_load = True self._states = {} self._appmap = {} self._callback = {} self._state_names = {} self._window_uptime = {} self._callback_event = [] self._get_all_state_names() self._handle_table_cell = False self._desktop = pyatspi.Registry.getDesktop(0) if Utils.cached_apps is None: pyatspi.Registry.registerEventListener( self._on_window_event, 'window') # Above window event doesn't get called for # 'window:destroy', so registering it individually pyatspi.Registry.registerEventListener( self._on_window_event, 'window:destroy') # Notify on any changes in all windows, based on this info, # its decided, whether force_remap is required or not pyatspi.Registry.registerEventListener(self._obj_changed, 'object:children-changed') pyatspi.Registry.registerEventListener( self._obj_changed, 'object:property-change:accessible-name') | 93dd62f57f43d2f663068965a392eaeb5ede0885 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/93dd62f57f43d2f663068965a392eaeb5ede0885/utils.py |
|
@param cmdline: Command line string to execute. @type cmdline: string | @param cmd: Command line string to execute. @type cmd: string | def launchapp(self, cmd, args = [], delay = 0, env = 1): ''' Launch application. | 63b3f38be85054613367cd3a1154ef29e47f8c4c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/63b3f38be85054613367cd3a1154ef29e47f8c4c/core.py |
return bool(re_match(glob_trans(pattern), string, re.M | re.U | re.L)) | return bool(re_match(glob_trans(pattern), string, re.M | re.U | re.L)) | def _glob_match(self, pattern, string): return bool(re_match(glob_trans(pattern), string, re.M | re.U | re.L)) | 5f6c08007b6636c30e4c66eeb6619c1ab4f6b2ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/5f6c08007b6636c30e4c66eeb6619c1ab4f6b2ba/utils.py |
print 'obj', obj | def _get_menu_hierarchy(self, window_name, object_name): _menu_hierarchy = re.split(';', object_name) if not re.search('^mnu', _menu_hierarchy[0]): _menu_hierarchy[0] = 'mnu%s' % _menu_hierarchy[0] obj = self._get_object(window_name, _menu_hierarchy[0]) for _menu in _menu_hierarchy[1:]: _flag = False print 'obj', obj for _child in self._list_objects(obj): print '_child', _child if obj == _child: # if the given object and child object matches continue if self._match_name_to_acc(_menu, _child): _flag = True obj = _child break if not _flag: raise LdtpServerException ( 'Menu item "%s" doesn\'t exist in hierarchy' % _menu) return obj | 5f6c08007b6636c30e4c66eeb6619c1ab4f6b2ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/5f6c08007b6636c30e4c66eeb6619c1ab4f6b2ba/utils.py |
|
print '_child', _child | def _get_menu_hierarchy(self, window_name, object_name): _menu_hierarchy = re.split(';', object_name) if not re.search('^mnu', _menu_hierarchy[0]): _menu_hierarchy[0] = 'mnu%s' % _menu_hierarchy[0] obj = self._get_object(window_name, _menu_hierarchy[0]) for _menu in _menu_hierarchy[1:]: _flag = False print 'obj', obj for _child in self._list_objects(obj): print '_child', _child if obj == _child: # if the given object and child object matches continue if self._match_name_to_acc(_menu, _child): _flag = True obj = _child break if not _flag: raise LdtpServerException ( 'Menu item "%s" doesn\'t exist in hierarchy' % _menu) return obj | 5f6c08007b6636c30e4c66eeb6619c1ab4f6b2ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/5f6c08007b6636c30e4c66eeb6619c1ab4f6b2ba/utils.py |
|
def _click_object(self, obj, action = 'click'): | def _click_object(self, obj, action = '(click|press|activate)'): | def _click_object(self, obj, action = 'click'): try: iaction = obj.queryAction() except NotImplementedError: raise LdtpServerException( 'Object does not have an Action interface') else: for i in xrange(iaction.nActions): if re.match(action, iaction.getName(i)): iaction.doAction(i) return raise LdtpServerException('Object does not have a "%s" action' % action) | 5f6c08007b6636c30e4c66eeb6619c1ab4f6b2ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/5f6c08007b6636c30e4c66eeb6619c1ab4f6b2ba/utils.py |
def getchild(self, child_name='', role=''): matches = self._remote_getchild(child_name, role, True) if matches: if role: return [Component(self._window_name, matches[0])] else: return Component(self._window_name, matches[0]) else: return None | def getchild(self, child_name='', role=''): # TODO: Bad API choice. Inconsistent, should return object or list, # not both. UPDATE: Only returns first match. matches = self._remote_getchild(child_name, role, True) if matches: if role: return [Component(self._window_name, matches[0])] else: return Component(self._window_name, matches[0]) else: return None | 0936f4c7f51025878b4179a91a1228b7017de700 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/0936f4c7f51025878b4179a91a1228b7017de700/_context.py |
|
''' | """ | def imagecapture(self, window_name = None, x = 0, y = 0, width = None, height = None): ''' Captures screenshot of the whole desktop or given window @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param x: x co-ordinate value @type x: int @param y: y co-ordinate value @type y: int @param width: width co-ordinate value @type width: int @param height: height co-ordinate value @type height: int | ddd66535b2683d07d3c03ce8033c90bfd83df55a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/ddd66535b2683d07d3c03ce8033c90bfd83df55a/generic.py |
''' | """ | def imagecapture(self, window_name = None, x = 0, y = 0, width = None, height = None): ''' Captures screenshot of the whole desktop or given window @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param x: x co-ordinate value @type x: int @param y: y co-ordinate value @type y: int @param width: width co-ordinate value @type width: int @param height: height co-ordinate value @type height: int | ddd66535b2683d07d3c03ce8033c90bfd83df55a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/ddd66535b2683d07d3c03ce8033c90bfd83df55a/generic.py |
def _ebRender(self, failure): '''Custom error render method (used by our XMLRPC objects)''' if isinstance(failure.value, xmlrpclib.Fault): return failure.value | if not _ldtp_debug: def _ebRender(self, failure): '''Custom error render method (used by our XMLRPC objects)''' if isinstance(failure.value, xmlrpclib.Fault): return failure.value | def _ebRender(self, failure): '''Custom error render method (used by our XMLRPC objects)''' if isinstance(failure.value, xmlrpclib.Fault): return failure.value | 89607e76b487ccd2061e9e6cfc039823fcdd8e82 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/89607e76b487ccd2061e9e6cfc039823fcdd8e82/xmlrpc_daemon.py |
if hasattr(failure, 'getErrorMessage'): value = failure.getErrorMessage() else: value = 'error' | if hasattr(failure, 'getErrorMessage'): value = failure.getErrorMessage() else: value = 'error' | def _ebRender(self, failure): '''Custom error render method (used by our XMLRPC objects)''' if isinstance(failure.value, xmlrpclib.Fault): return failure.value | 89607e76b487ccd2061e9e6cfc039823fcdd8e82 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/89607e76b487ccd2061e9e6cfc039823fcdd8e82/xmlrpc_daemon.py |
return xmlrpclib.Fault(self.FAILURE, value) | return xmlrpclib.Fault(self.FAILURE, value) | def _ebRender(self, failure): '''Custom error render method (used by our XMLRPC objects)''' if isinstance(failure.value, xmlrpclib.Fault): return failure.value | 89607e76b487ccd2061e9e6cfc039823fcdd8e82 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/89607e76b487ccd2061e9e6cfc039823fcdd8e82/xmlrpc_daemon.py |
x, y, resolution2, resolution1 = bb.x, bb.y, bb.height, bb.width | x, y, height, width = bb.x, bb.y, bb.height, bb.width | def imagecapture(self, window_name = None, x = 0, y = 0, width = None, height = None): ''' Captures screenshot of the whole desktop or given window @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param x: x co-ordinate value @type x: int @param y: y co-ordinate value @type y: int @param width: width co-ordinate value @type width: int @param height: height co-ordinate value @type height: int | ff746be08b5d982d2599f56ebe1f94cbebc66c8f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/ff746be08b5d982d2599f56ebe1f94cbebc66c8f/generic.py |
@return: list of integers on success. | @return: list of string on success | def getallstates(self, window_name, object_name): ''' Get all states of given object @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. @type object_name: string | 93e2a5d5bedc2d2efc547a12fe735701c82228f7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/93e2a5d5bedc2d2efc547a12fe735701c82228f7/core.py |
_obj_states.append(state.real) | _obj_states.append(self._state_names[state.real]) | def getallstates(self, window_name, object_name): ''' Get all states of given object @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. @type object_name: string | 93e2a5d5bedc2d2efc547a12fe735701c82228f7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/93e2a5d5bedc2d2efc547a12fe735701c82228f7/core.py |
_state = obj.getState() _obj_state = _state.getStates() | _state_inst = obj.getState() _obj_state = _state_inst.getStates() | def hasstate(self, window_name, object_name, state): ''' has state @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. @type object_name: string | 93e2a5d5bedc2d2efc547a12fe735701c82228f7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/93e2a5d5bedc2d2efc547a12fe735701c82228f7/core.py |
print "ldtpd exited!" | if _ldtp_debug: print "ldtpd exited!" | def _handle_signal(self, signum, frame): if os.environ.has_key('LDTP_DEBUG'): if signum == signal.SIGCHLD: print "ldtpd exited!" elif signum == signal.SIGUSR1: print "SIGUSR1 received. ldtpd ready for requests." elif signum == signal.SIGALRM: print "SIGALRM received. Timeout waiting for SIGUSR1." | 7fc4e329b2fb61c2e3a4520c94120c45bcc72810 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/7fc4e329b2fb61c2e3a4520c94120c45bcc72810/client.py |
print "SIGUSR1 received. ldtpd ready for requests." | if _ldtp_debug: print "SIGUSR1 received. ldtpd ready for requests." | def _handle_signal(self, signum, frame): if os.environ.has_key('LDTP_DEBUG'): if signum == signal.SIGCHLD: print "ldtpd exited!" elif signum == signal.SIGUSR1: print "SIGUSR1 received. ldtpd ready for requests." elif signum == signal.SIGALRM: print "SIGALRM received. Timeout waiting for SIGUSR1." | 7fc4e329b2fb61c2e3a4520c94120c45bcc72810 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/7fc4e329b2fb61c2e3a4520c94120c45bcc72810/client.py |
print "SIGALRM received. Timeout waiting for SIGUSR1." | if _ldtp_debug: print "SIGALRM received. Timeout waiting for SIGUSR1." | def _handle_signal(self, signum, frame): if os.environ.has_key('LDTP_DEBUG'): if signum == signal.SIGCHLD: print "ldtpd exited!" elif signum == signal.SIGUSR1: print "SIGUSR1 received. ldtpd ready for requests." elif signum == signal.SIGALRM: print "SIGALRM received. Timeout waiting for SIGUSR1." | 7fc4e329b2fb61c2e3a4520c94120c45bcc72810 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/7fc4e329b2fb61c2e3a4520c94120c45bcc72810/client.py |
self._daemon = subprocess.Popen( ['python', '-c', 'import ldtpd; ldtpd.main()'], close_fds = True) | self._daemon = os.spawnlp(os.P_NOWAIT, 'python', 'python', '-c', 'import ldtpd; ldtpd.main()') | def _spawn_daemon(self): self._daemon = subprocess.Popen( ['python', '-c', 'import ldtpd; ldtpd.main()'], close_fds = True) | 6a274309339d6d3c366fca4e15b281d9b9132e78 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/6a274309339d6d3c366fca4e15b281d9b9132e78/client.py |
self._daemon.kill() | os.kill(self._daemon, 9) | def kill_daemon(self): try: self._daemon.kill() except AttributeError: pass | 6a274309339d6d3c366fca4e15b281d9b9132e78 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/6a274309339d6d3c366fca4e15b281d9b9132e78/client.py |
raise LdtpServerException('Could not find a child.') | if child_name: _name = 'name "%s" ' % child_name if role: _role = 'role "%s" ' % role if parent: _parent = 'parent "%s"' % parent exception = 'Could not find a child %s%s%s' % (_name, _role, _parent) raise LdtpServerException(exception) | def _get_all_children_under_obj(obj, child_list): if role and obj['class'] == role: child_list.append(obj['key']) elif child_name and self._match_name_to_appmap(child_name, obj): child_list.append(obj['key']) if obj: children = obj['children'] if not children: return child_list for child in children: return _get_all_children_under_obj( \ appmap[child], child_list) | 59d960e05a787b32fb46726d225f7cb5c7ce7e4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/59d960e05a787b32fb46726d225f7cb5c7ce7e4a/core.py |
raise LdtpServerException('Could not find a child.') | if child_name: _name = 'name "%s" ' % child_name if role: _role = 'role "%s" ' % role if parent: _parent = 'parent "%s"' % parent exception = 'Could not find a child %s%s%s' % (_name, _role, _parent) raise LdtpServerException(exception) | def _get_all_children_under_obj(obj, child_list): if role and obj['class'] == role: child_list.append(obj['key']) elif child_name and self._match_name_to_appmap(child_name, obj): child_list.append(obj['key']) if obj: children = obj['children'] if not children: return child_list for child in children: return _get_all_children_under_obj( \ appmap[child], child_list) | 59d960e05a787b32fb46726d225f7cb5c7ce7e4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/59d960e05a787b32fb46726d225f7cb5c7ce7e4a/core.py |
if child_obj: return child_obj | if child_obj: return child_obj | def _get_child_object_type(self, obj, role_type): """ This function will check for all levels and returns the first matching role_type """ try: if obj and role_type: for child in obj: if not child: continue if child.childCount > 0: child_obj = self._get_child_object_type(child, role_type) if child_obj: return child_obj if child.getRole() == role_type: return child except: pass return None | 915f62d5410c1f3cad3555e5ba795ed43c4d929b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/915f62d5410c1f3cad3555e5ba795ed43c4d929b/utils.py |
@rtype: string | @rtype: list | def getcpustat(self, process_name): """ get CPU stat for the give process name | 9cd025e9ee04c34cacf9c2d8f53a1a30827bb71d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/9cd025e9ee04c34cacf9c2d8f53a1a30827bb71d/core.py |
if _object_name == name: | if _object_name == name: | def _match_name_to_acc(self, name, acc): if acc.name == name: return 1 _ldtpize_accessible_name = self._ldtpize_accessible(acc) _object_name = u'%s%s' % (_ldtpize_accessible_name[0], _ldtpize_accessible_name[1]) if _object_name == name: return 1 if self._glob_match(name, acc.name): return 1 if self._glob_match(name, _object_name): return 1 role = acc.getRole() if role == pyatspi.ROLE_FRAME or role == pyatspi.ROLE_DIALOG or \ role == pyatspi.ROLE_WINDOW or \ role == pyatspi.ROLE_FONT_CHOOSER or \ role == pyatspi.ROLE_FILE_CHOOSER or \ role == pyatspi.ROLE_ALERT or \ role == pyatspi.ROLE_COLOR_CHOOSER: strip = '( |\n)' else: strip = '( |:|\.|_|\n)' _tmp_name = re.sub(strip, '', name) if self._glob_match(_tmp_name, _object_name): return 1 if self._glob_match(_tmp_name, _ldtpize_accessible_name[1]): return 1 return 0 | e03e56a3772febd94e812dda3639ae19433f4b0d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11266/e03e56a3772febd94e812dda3639ae19433f4b0d/utils.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.