bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def dump_dict_index(index): file_path = os.path.join(dest_dir, dict_prefix, '%s.json' % files[index]) f = open(file_path, 'wb') json.dump(indexed_phrases, f, indent=(2 if options.pretty else None)) if options.verbose: print >> sys.stderr, '%d phrases of index %s written to %s.' % (indexed_phrase_count, index, file_path...
def dump_dict_index(index): file_path = os.path.join(dest_dir, dict_prefix, '%s.json' % files[index]) f = open(file_path, 'wb') json.dump(indexed_phrases, f, indent=(2 if options.pretty else None)) if options.verbose: print >> sys.stderr, '%d phrases of index %s written to %s.' % (indexed_phrase_count, index, file_path...
477,100
def to_js_regex(r): p = r.split(None, 1) if len(p) < 2: return r p[1] = back_ref.sub(ur'$\1', back_ref_g.sub(ur'$\1', p[1])) return u' '.join(p)
def to_js_regex(r): p = r.split(None, 1) if len(p) < 2: return r p[1] = back_ref.sub(ur'$\1', back_ref_g.sub(ur'$\1', p[1])) return u' '.join(p)
477,101
def apply_alternative_rule(d, r): for x in d.keys(): if not r[0].search(x): continue y = transform(x, r) if y == x: continue if y not in d: d[y] = d[x] elif self.__report_errors: raise SpellingCollisionError('AlternativeRule', (x, d[x], y, d[y])) return d
def apply_alternative_rule(d, r): for x in d.keys(): if not r[0].search(x): continue y = transform(x, r) if y == x: continue if y not in d: d[y] = d[x] elif self.__report_errors: raise SpellingCollisionError('AlternativeRule', (x, d[x], y, d[y])) return d
477,102
def debug (*what): print >> sys.stderr, '[DEBUG]: ', ' '.join (map (unicode, what))
def debug (*what): print >> sys.stderr, '[DEBUG]: ', ' '.join (map (unicode, what))
477,103
def debug(*what): print >> sys.stderr, '[DEBUG]: ', ' '.join(map(unicode, what))
def debug(*what): print >> sys.stderr, '[DEBUG]: ', ' '.join(map(unicode, what))
477,104
def to_js_regex(r): p = r.split(None, 1) if len(p) < 2: return r p[1] = back_ref.sub(ur'$\1', back_ref_g.sub(ur'$\1', p[1])) return u' '.join(p)
def to_js_regex(r): p = r.split(None, 1) if len(p) < 2: return r p[1] = back_ref.sub(ur'$\1', back_ref_g.sub(ur'$\1', p[1])) return u' '.join(p)
477,105
def debug(*what): print >> sys.stderr, u'[DEBUG]: ', u' '.join(map(unicode, what))
def debug(*what): print >> sys.stderr, u'[DEBUG]: ', u' '.join(map(unicode, what))
477,106
def apply_alternative_rule(d, r): for x in d.keys(): if not r[0].search(x): continue y = transform(x, r) if y == x: continue if y not in d: d[y] = d[x] elif self.__report_errors: raise SpellingCollisionError('AlternativeRule', (x, d[x], y, d[y])) return d
def apply_alternative_rule(d, r): for x in d.keys(): if not r[0].search(x): continue y = transform(x, r) if y == x: continue if y not in d: d[y] = d[x] elif self.__report_errors: raise SpellingCollisionError('AlternativeRule', (x, d[x], y, d[y])) return d
477,107
def apply_alternative_rule(d, r): for x in d.keys(): if not r[0].search(x): continue y = transform(x, r) if y == x: continue if y not in d: d[y] = d[x] elif self.__report_errors: raise SpellingCollisionError('AlternativeRule', (x, d[x], y, d[y])) return d
def apply_alternative_rule(d, r): for x in d.keys(): if not r[0].search(x): continue y = transform(x, r) if y == x: continue if y not in d: d[y] = d[x] elif self.__report_errors: raise SpellingCollisionError('AlternativeRule', (x, d[x], y, d[y])) return d
477,108
def multiline_text(line1,line2,line3="",line4=""): string = "#scale[.8]{#splitline{#splitline{%s}{%s}}{#splitline{%s}{%s}}}" %(line1,line2,line3,line4) return string
def multiline_text(line1,line2,line3="",line4=""): string = "#scale[.8]{#splitline{#splitline{%s}{%s}}{#splitline{%s}{%s}}}" %(line1,line2,line3,line4) return string
477,109
def wait_msg_from(self, timeout): endtime = time.time() + timeout msg = "" src_addr = None while time.time() < endtime: readset = select([self.sock], [], [], timeout) if len(readset) < 1 or not self.sock in readset[0]: if len(readset) < 1: print "select() returns " + str(len(readset)) elif not self.sock in readset[0]: ...
def wait_msg_from(self, timeout): endtime = time.time() + timeout msg = "" src_addr = None while time.time() < endtime: readset = select([self.sock], [], [], timeout) if len(readset[0]) < 1 or not self.sock in readset[0]: if len(readset[0]) < 1: print "select() timeout" elif not self.sock in readset[0]: print "select()...
477,110
def test_func(test): pjsua = test.process[0] dlg = sip.Dialog("127.0.0.1", pjsua.inst_param.sip_port, local_port=srv_port, tcp=cfg_file.recvfrom_cfg.tcp) last_cseq = 0 last_method = "" for t in cfg_file.recvfrom_cfg.transaction: # Print transaction title if t.title != "": dlg.trace(t.title) # Run command and expect pa...
def test_func(test): pjsua = test.process[0] dlg = sip.Dialog("127.0.0.1", pjsua.inst_param.sip_port, local_port=srv_port, tcp=cfg_file.recvfrom_cfg.tcp) last_cseq = 0 last_method = "" for t in cfg_file.recvfrom_cfg.transaction: # Print transaction title if t.title != "": dlg.trace(t.title) # Run command and expect pa...
477,111
def test_func(test): pjsua = test.process[0] dlg = sip.Dialog("127.0.0.1", pjsua.inst_param.sip_port, local_port=srv_port, tcp=cfg_file.recvfrom_cfg.tcp) last_cseq = 0 last_method = "" for t in cfg_file.recvfrom_cfg.transaction: # Print transaction title if t.title != "": dlg.trace(t.title) # Run command and expect pa...
def test_func(test): pjsua = test.process[0] dlg = sip.Dialog("127.0.0.1", pjsua.inst_param.sip_port, local_port=srv_port, tcp=cfg_file.recvfrom_cfg.tcp) last_cseq = 0 last_method = "" for t in cfg_file.recvfrom_cfg.transaction: # Print transaction title if t.title != "": dlg.trace(t.title) # Run command and expect pa...
477,112
def wait_msg_from(self, timeout): endtime = time.time() + timeout msg = "" src_addr = None while time.time() < endtime: readset = select([self.sock], [], [], timeout) if len(readset[0]) < 1 or not self.sock in readset[0]: if len(readset[0]) < 1: print "select() timeout" elif not self.sock in readset[0]: print "select()...
def wait_msg_from(self, timeout): endtime = time.time() + timeout msg = "" src_addr = None while time.time() < endtime: readset = select([self.sock], [], [], 1) if len(readset[0]) < 1 or not self.sock in readset[0]: if len(readset[0]) < 1: print "select() timeout" elif not self.sock in readset[0]: print "select() alien...
477,113
def wait_msg_from(self, timeout): endtime = time.time() + timeout msg = "" src_addr = None while time.time() < endtime: readset = select([self.sock], [], [], timeout) if len(readset[0]) < 1 or not self.sock in readset[0]: if len(readset[0]) < 1: print "select() timeout" elif not self.sock in readset[0]: print "select()...
def wait_msg_from(self, timeout): endtime = time.time() + timeout msg = "" src_addr = None while time.time() < endtime: readset = select([self.sock], [], [], timeout) if len(readset[0]) < 1 or not self.sock in readset[0]: if len(readset[0]) < 1: print "select() timeout (will wait for " + str(int(endtime - time.time()))...
477,114
def __init__(self, title, resp_code, check_cseq=True, include=[], exclude=[], cmds=[], resp_hdr=[], resp_body=None, expect=""): self.title = title self.cmds = cmds self.include = include self.exclude = exclude self.resp_code = resp_code self.resp_hdr = resp_hdr self.resp_body = resp_body self.expect = expect
def __init__(self, title, resp_code, check_cseq=True, include=[], exclude=[], cmds=[], resp_hdr=[], resp_body=None, expect=""): self.title = title self.cmds = cmds self.include = include self.exclude = exclude self.resp_code = resp_code self.resp_hdr = resp_hdr self.body = resp_body self.expect = expect
477,115
def usage(): print """Periodically monitor working directory for Continuous and Nightly builds
def usage(): print """Periodically monitor working directory for Continuous and Nightly builds
477,116
def writeWord(self, w): print "<<< " + w self.writeLen(len(w)) self.writeStr(w)
def writeWord(self, w): if self.DEBUG: print "<<< " + w self.writeLen(len(w)) self.writeStr(w)
477,117
def readWord(self): ret = self.readStr(self.readLen()) print ">>> " + ret return ret
def readWord(self): ret = self.readStr(self.readLen()) if self.DEBUG: print ">>> " + ret return ret
477,118
def run_interpreter(self): import select, sys inputsentence = []
defrun_interpreter(self):importselect,sysinputsentence=[]
477,119
def test_unauthenticated(self): ''' unauthenticated users do not have the necessary permissions to view the review list ''' self.browser.open('http://nohost/plone/full_review_list') self.assertTrue('Please log in' in self.browser.contents)
def test_unauthenticated(self): ''' unauthenticated users do not have the necessary permissions to view the review list ''' self.browser.open('http://nohost/plone/full_review_list') self.assertTrue('Please log in' in self.browser.contents)
477,120
def addable_types(self, include=None): """Return menu item entries in a TAL-friendly form.
def addable_types(self, include=None): """Return menu item entries in a TAL-friendly form.
477,121
def addable_types(self, include=None): """Return menu item entries in a TAL-friendly form.
def addable_types(self, include=None): """Return menu item entries in a TAL-friendly form.
477,122
def add_context(self): context_state = getMultiAdapter((self.context, self.request), name='plone_context_state') return context_state.folder()
def add_context(self): context_state = getMultiAdapter((self.context, self.request), name='plone_context_state') return context_state.folder()
477,123
def __init__(self, context, request): self.context = context self.request = request
def __init__(self, context, request): self.context = context self.request = request
477,124
def __call__(self): response = self.request.response response.setHeader('Content-Type', 'application/xml+epub') response.setHeader('Content-Disposition', 'attachment; filename=%s.epub' % self.context.id)
def __call__(self): response = self.request.response response.setHeader('Content-Type', 'application/xml+epub') response.setHeader('Content-Disposition', 'attachment; filename=%s.epub' % self.context.id)
477,125
def __call__(self): response = self.request.response response.setHeader('Content-Type', 'application/xml+epub') response.setHeader('Content-Disposition', 'attachment; filename=%s.epub' % self.context.id)
def __call__(self): response = self.request.response response.setHeader('Content-Type', 'application/xml+epub') response.setHeader('Content-Disposition', 'attachment; filename=%s.epub' % self.context.id)
477,126
def importFile(self, epubFile): zipFile = ZipFile(epubFile, 'r') epub = EpubFile(zipFile)
def importFile(self, epubFile): zipFile = ZipFile(epubFile, 'r') epub = EpubFile(zipFile)
477,127
def __call__(self): response = self.request.response response.setHeader('Content-Type', 'application/xml+epub') response.setHeader('Content-Disposition', 'attachment; filename=%s.epub' % self.context.id)
def __call__(self): response = self.request.response response.setHeader('Content-Type', 'application/xml+epub') response.setHeader('Content-Disposition', 'attachment; filename=%s.epub' % self.context.id)
477,128
def chapters(self): guide = self.rootFile.find('guide') if guide == None: return []
def chapters(self): guide = self.rootFile.find('guide') if guide == None: return []
477,129
def setMultipart(self, multipart=True): """Enable multipart data transfer, required for file uploads.""" if not canupload and multipart: raise APIError("The poster package is required for multipart support") self.multipart = multipart if multipart: (datagen, headers) = multipart_encode(self.data) self.headers.pop('Cont...
def setMultipart(self, multipart=True): """Enable multipart data transfer, required for file uploads.""" if not canupload and multipart: raise APIError("The poster package is required for multipart support") self.multipart = multipart if multipart: (datagen, headers) = multipart_encode(self.data) self.headers.pop('Cont...
477,130
def changeParam(self, param, value): """Change or add a parameter after making the request object Simply changing self.data won't work as it needs to update other things.
def changeParam(self, param, value): """Change or add a parameter after making the request object Simply changing self.data won't work as it needs to update other things.
477,131
def listFromTitles(site, titles, check=True, followRedir=False): """Create a list of page objects from a list of titles check and followRedir have the same meaning as in page.Page """ ret = [] if not check: for title in titles: title = page.Page(site, title=title, check=False) ret.append(title) else: querylist = [] l...
def listFromTitles(site, titles, check=True, followRedir=False): """Create a list of page objects from a list of titles check and followRedir have the same meaning as in page.Page """ ret = [] if not check: for title in titles: title = page.Page(site, title=title, check=False) ret.append(title) else: querylist = [] l...
477,132
def logout(self): params = { 'action': 'logout' } if self.maxlag < 120: params['maxlag'] = 120 cookiefile = self.cookiepath + str(hash(self.username+' - '+self.apibase))+'.cookies' try: os.remove(cookiefile) except: pass req = api.APIRequest(self, params, write=True) # action=logout returns absolutely nothing, which js...
def logout(self): params = { 'action': 'logout' } if self.maxlag < 120: params['maxlag'] = 120 cookiefile = self.cookiepath + str(hash(self.username+' - '+self.apibase))+'.cookies' try: os.remove(cookiefile) except: pass req = api.APIRequest(self, params, write=True) # action=logout returns absolutely nothing, which js...
477,133
def __eq__(self, other): if not isinstance(other, User): return False if self.name == other.name and self.site == other.wiki: return True return False
def __eq__(self, other): if not isinstance(other, User): return False if self.name == other.name and self.site == other.site: return True return False
477,134
def __ne__(self, other): if not isinstance(other, User): return True if self.name == other.name and self.site == other.wiki: return False return True
def __ne__(self, other): if not isinstance(other, User): return True if self.name == other.name and self.site == other.site: return False return True
477,135
def download(self, width=False, height=False, location=False): """Download the image to a local file width/height - set width OR height of the downloaded image location - set the filename to save to. If not set, the page title minus the namespace prefix will be used and saved to the current directory """ if self.page...
def download(self, width=False, height=False, location=False): """Download the image to a local file width/height - set width OR height of the downloaded image location - set the filename to save to. If not set, the page title minus the namespace prefix will be used and saved to the current directory """ if self.page...
477,136
def login(self, username, password=False, remember=False, force=False, verify=True, domain=None): """Login to the site remember - saves cookies to a file - the filename will be: hash(username - apibase).cookies the cookies will be saved in the current directory, change cookiepath to use a different location force - fo...
def login(self, username, password=False, remember=False, force=False, verify=True, domain=None): """Login to the site remember - saves cookies to a file - the filename will be: hash(username - apibase).cookies the cookies will be saved in the current directory, change cookiepath to use a different location force - fo...
477,137
def setSiteinfo(self): """Retrieves basic siteinfo Called when constructing, or after login if the first call failed """ params = {'action':'query', 'meta':'siteinfo', 'siprop':'general|namespaces|namespacealiases', } if self.maxlag < 120: params['maxlag'] = 120 req = api.APIRequest(self, params) info = req.query() s...
def setSiteinfo(self): """Retrieves basic siteinfo Called when constructing, or after login if the first call failed """ params = {'action':'query', 'meta':'siteinfo', 'siprop':'general|namespaces|namespacealiases', } if self.maxlag < 120: params['maxlag'] = 120 req = api.APIRequest(self, params) info = req.query() s...
477,138
def setSiteinfo(self): """Retrieves basic siteinfo Called when constructing, or after login if the first call failed """ params = {'action':'query', 'meta':'siteinfo', 'siprop':'general|namespaces|namespacealiases', } if self.maxlag < 120: params['maxlag'] = 120 req = api.APIRequest(self, params) info = req.query() s...
def setSiteinfo(self): """Retrieves basic siteinfo Called when constructing, or after login if the first call failed """ params = {'action':'query', 'meta':'siteinfo', 'siprop':'general|namespaces|namespacealiases', } if self.maxlag < 120: params['maxlag'] = 120 req = api.APIRequest(self, params) info = req.query() s...
477,139
def __parseJSON(self, data): maxlag = True while maxlag: try: maxlag = False parsed = json.loads(data.read()) content = None if isinstance(parsed, dict): content = APIResult(parsed) content.response = self.response.items() elif isinstance(parsed, list): content = APIListResult(parsed) content.response = self.response.i...
def __parseJSON(self, data): maxlag = True while maxlag: try: maxlag = False parsed = json.loads(data.read()) content = None if isinstance(parsed, dict): content = APIResult(parsed) content.response = self.response.items() elif isinstance(parsed, list): content = APIListResult(parsed) content.response = self.response.i...
477,140
def __parseJSON(self, data): maxlag = True while maxlag: try: maxlag = False content = APIResult(json.loads(data.read())) content.response = self.response.items() if 'error' in content: error = content['error']['code'] if error == "maxlag": lagtime = int(re.search("(\d+) seconds", content['error']['info']).group(1)) if...
def __parseJSON(self, data): maxlag = True while maxlag: try: maxlag = False parsed = json.loads(data.read()) content = None if isinstance(parsed, dict): content = APIResult(parsed) content.response = self.response.items() elif isinstance(parsed, list): content = APIListResult(parsed) content.response = self.response.i...
477,141
def GetConfig( self ):
def GetConfig( self ):
477,142
def GetConfig( self ):
def GetConfig( self ):
477,143
def addPoiToDatabase( self,entry ):
def addPoiToDatabase( self,entry ):
477,144
def addPoiToDatabase( self,entry ):
defaddPoiToDatabase(self,entry):
477,145
def addPoiToDatabase( self,entry ):
def addPoiToDatabase( self,entry ):
477,146
def IsPtMount(self, mountPoint):
def IsPtMount(self, mountPoint):
477,147
def GetPtWithSize( self, type = None, ptMount = None ):
def GetPtWithSize( self, type = None, ptMount = None ):
477,148
def GetPtWithSize( self, type = None, ptMount = None ):
def GetPtWithSize( self, type = None, ptMount = None ):
477,149
def FramePoi( self, notebook ):
def FramePoi( self, notebook ):
477,150
def UMount(self, mountPoint):
def UMount(self, mountPoint):
477,151
def addPoiToTomtom( self,entry ):
def addPoiToTomtom( self,entry ):
477,152
def delPoiOnTomtom( self,entry ):
def delPoiOnTomtom( self,entry ):
477,153
def BackupRestoreGPS( self, widget, type ):
def BackupRestoreGPS( self, widget, type ):
477,154
def BackupRestoreGPS( self, widget, type ):
def BackupRestoreGPS( self, widget, type ):
477,155
def addPoiToDatabase( self,entry ):
def addPoiToDatabase( self,entry ):
477,156
def addPoiToDatabase( self,entry ):
defaddPoiToDatabase(self,entry):
477,157
def main(): # option parser usage = 'peakzilla [OPTIONS] IP_ALIGNMENT CONTROL_ALIGNMENT > RESULTS' parser = OptionParser(usage=usage) parser.add_option("-s", "--fragment_size",\ type = "int", dest="fragment_size", default="200",\ help = "fragment size in bp used to define the upper limit of peak size for modeling: def...
def main(): # option parser usage = 'peakzilla [OPTIONS] IP_ALIGNMENT CONTROL_ALIGNMENT > RESULTS' parser = OptionParser(usage=usage) parser.add_option("-s", "--fragment_size",\ type = "int", dest="fragment_size", default="200",\ help = "fragment size in bp used to define the upper limit of peak size for modeling: def...
477,158
def main(): # option parser usage = 'peakzilla [OPTIONS] IP_ALIGNMENT CONTROL_ALIGNMENT > RESULTS' parser = OptionParser(usage=usage) parser.add_option("-s", "--fragment_size",\ type = "int", dest="fragment_size", default="200",\ help = "fragment size in bp used to define the upper limit of peak size for modeling: def...
def main(): # option parser usage = 'peakzilla [OPTIONS] chip.bed control.bed > results.tsv' parser = OptionParser(usage=usage) parser.add_option("-s", "--fragment_size",\ type = "int", dest="fragment_size", default="200",\ help = "fragment size in bp used to define the upper limit of peak size for modeling: default=2...
477,159
def build(self): # for all chromosomes look for shifted peaks for chrom in self.tags.get_chrom_names(): plus_peaks = self.find_simple_peaks(chrom, '+') minus_peaks = self.find_simple_peaks(chrom, '-') self.determine_shifts(plus_peaks, minus_peaks) # calculate the meidan peak_shift self.peak_shift = int(median(self.peak...
def build(self): # for all chromosomes look for shifted peaks for chrom in self.tags.get_chrom_names(): plus_peaks = self.find_simple_peaks(chrom, '+') minus_peaks = self.find_simple_peaks(chrom, '-') self.determine_shifts(plus_peaks, minus_peaks) # calculate the meidan peak_shift self.peak_shift = int(median(self.peak...
477,160
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
477,161
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
477,162
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
477,163
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
477,164
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
477,165
def load_lists(force=False): """Load ignore and filtered word lists""" debug_print('Loading ignore list') if not IGNORE_LIST or force is True: global IGNORE_LIST IGNORE_LIST = [ line.lower().strip() for line in open(settings.ignore_list) ] debug_print('Loading filtered word list') if not FILTER_WORDS or force is True:...
def load_lists(force=False): """Load ignore and filtered word lists""" debug_print('Loading ignore list') if not IGNORE_LIST or force is True: IGNORE_LIST = [ line.lower().strip() for line in open(settings.ignore_list) ] debug_print('Loading filtered word list') if not FILTER_WORDS or force is True: global FILTER_WORD...
477,166
def load_lists(force=False): """Load ignore and filtered word lists""" debug_print('Loading ignore list') if not IGNORE_LIST or force is True: global IGNORE_LIST IGNORE_LIST = [ line.lower().strip() for line in open(settings.ignore_list) ] debug_print('Loading filtered word list') if not FILTER_WORDS or force is True:...
def load_lists(force=False): """Load ignore and filtered word lists""" debug_print('Loading ignore list') if not IGNORE_LIST or force is True: global IGNORE_LIST IGNORE_LIST = [ line.lower().strip() for line in open(settings.ignore_list) ] debug_print('Loading filtered word list') if not FILTER_WORDS or force is True:...
477,167
def main(): auth = tweepy.BasicAuthHandler(username=settings.username, password=settings.password) api = tweepy.API(auth_handler=auth, secure=True, retry_count=3) last_id = get_last_id(settings.lastid) debug_print('Loading friends list') friends = api.friends_ids() debug_print('Friend list loaded, size: %d' % len(fri...
def main(): auth = tweepy.BasicAuthHandler(username=settings.username, password=settings.password) api = tweepy.API(auth_handler=auth, secure=True, retry_count=3) last_id = get_last_id(settings.lastid) debug_print('Loading friends list') friends = api.friends_ids() debug_print('Friend list loaded, size: %d' % len(fri...
477,168
def save_id(statefile,id): """Save last status ID to a file""" last_id = get_last_id(statefile) if last_id < id: f = open(statefile,'w') f.write(str(id)) # no trailing newline f.close() # Don't need to do anything if for some reason the ID got smaller
defelse: debug_print('Received smaller ID, not saving. Old: %d, New: %s' % ( last_id, id)) save_id(statefile,id):else: debug_print('Received smaller ID, not saving. Old: %d, New: %s' % ( last_id, id)) """Saveelse: debug_print('Received smaller ID, not saving. Old: %d, New: %s' % ( last_id, id)) lastelse: debug_print('R...
477,169
def main_func(): options = _parse_options() if options.message_filter: from utils import MessageMap MessageMap.set_filter(options.message_filter) os.chdir(options.root) try: run_proxy(options) except KeyboardInterrupt: # todo: shut down the open connections cleanly pass """ import cProfile, sys p=open("profile", "w") s...
def main_func(): options = _parse_options() if options.message_filter: from utils import MessageMap MessageMap.set_filter(options.message_filter) os.chdir(options.root) try: run_proxy(options) except KeyboardInterrupt: # todo: shut down the open connections cleanlyfor fd, obj in asyncore.socket_map.items(): obj.close()...
477,170
def handle_scope_message(self, msg): msg = '["%s",%s,%s,%s,%s]' % ( msg[1], # service msg[2], # command msg[4], # status msg[5], # tag msg[8], # payload ) if self.debug: pretty_print("send to client:", msg, self.debug_format, self.debug_format_payload) self.send_message(msg)
def handle_scope_message(self, msg): message = '["%s",%s,%s,%s,%s]' % ( msg[1], # service msg[2], # command msg[4], # status msg[5], # tag msg[8], # payload ) if self.debug: pretty_print("send to client:", msg, self.debug_format, self.debug_format_payload) self.send_message(msg)
477,171
def handle_scope_message(self, msg): msg = '["%s",%s,%s,%s,%s]' % ( msg[1], # service msg[2], # command msg[4], # status msg[5], # tag msg[8], # payload ) if self.debug: pretty_print("send to client:", msg, self.debug_format, self.debug_format_payload) self.send_message(msg)
def handle_scope_message(self, msg): msg = '["%s",%s,%s,%s,%s]' % ( msg[1], # service msg[2], # command msg[4], # status msg[5], # tag msg[8], # payload ) if self.debug: pretty_print("send to client:", msg, self.debug_format, self.debug_format_payload) self.send_message(msg)
477,172
def _get_number(self, in_str): n = int(''.join([i for i in in_str if i.isdigit()])) / in_str.count(' ') return ''.join([chr((n >> 8 * (3 - i)) & 0xff) for i in range(4)]) # throws DeprecationWarning: struct integer overflow masking is deprecated # for e.g. 2621808669 with Python 2.6.5 # return pack("!i", n & 0xffffffff...
def _get_number(self, in_str): n = int(''.join([i for i in in_str if i.isdigit()])) / in_str.count(' ') return ''.join([chr((n >> 8 * (3 - i)) & 0xff) for i in range(4)]) # throws DeprecationWarning: struct integer overflow masking is deprecated # for e.g. 2621808669 with Python 2.6.5 # return pack("!i", n & 0xffffffff...
477,173
def pretty_print_payload_item(indent, name, definition, item): if item and "message" in definition: print "%s%s:" % (indent * INDENT, name) pretty_print_payload(item, definition["message"], indent=indent+1) else: value = item if "enum" in definition: value = "%s (%s)" % (definition['enum']['numbers'][item], item) elif ...
def pretty_print_payload_item(indent, name, definition, item): if item and "message" in definition: print "%s%s:" % (indent * INDENT, name) pretty_print_payload(item, definition["message"], indent=indent+1) else: value = item if "enum" in definition: value = "%s (%s)" % (definition['enum']['numbers'][item], item) elif ...
477,174
def check_is_cgi(self, system_path, handler=".cgi"): # system path of the cgi script self.cgi_script = "" self.SCRIPT_NAME = "" self.PATH_INFO = "" if handler in system_path: script_path = system_path[0:system_path.find(handler) + len(handler)] if isfile(script_path): self.cgi_script = script_path pos = self.REQUEST_UR...
def check_is_cgi(self, system_path, handler=".cgi"): # system path of the cgi script self.cgi_script = "" self.SCRIPT_NAME = "" self.PATH_INFO = "" if handler in system_path: script_path = system_path[0:system_path.find(handler) + len(handler)] if isfile(script_path): self.cgi_script = script_path pos = self.REQUEST_UR...
477,175
def read_headers(self): raw_parsed_headers = parse_headers(self.in_buffer) if raw_parsed_headers: # to dispatch any hanging timeout response self.flush() headers_raw, first_line, self.headers, self.in_buffer = raw_parsed_headers method, path, protocol = first_line.split(BLANK, 2) self.REQUEST_URI = path path = path.lst...
def read_headers(self): raw_parsed_headers = parse_headers(self.in_buffer) if raw_parsed_headers: # to dispatch any hanging timeout response self.flush() (headers_raw, first_line, self.headers, self.in_buffer) = raw_parsed_headers method, path, protocol = first_line.split(BLANK, 2) self.REQUEST_URI = path path = path.l...
477,176
def read_headers(self): raw_parsed_headers = parse_headers(self.in_buffer) if raw_parsed_headers: # to dispatch any hanging timeout response self.flush() headers_raw, first_line, self.headers, self.in_buffer = raw_parsed_headers method, path, protocol = first_line.split(BLANK, 2) self.REQUEST_URI = path path = path.lst...
def read_headers(self): raw_parsed_headers = parse_headers(self.in_buffer) if raw_parsed_headers: # to dispatch any hanging timeout response self.flush() headers_raw, first_line, self.headers, self.in_buffer = raw_parsed_headers method, path, protocol = first_line.split(BLANK, 2) self.REQUEST_URI = path path = path.lst...
477,177
def handle_cgi(self): import subprocess is_failed = False remote_addr, remote_port = self.socket.getpeername() cwd = os.getcwd() environ = { # os "COMSPEC": os.environ["COMSPEC"], "PATH": os.environ["PATH"], "PATHEXT": os.environ["PATHEXT"], "SYSTEMROOT": os.environ["SYSTEMROOT"], "WINDIR": os.environ["WINDIR"], # serv...
def handle_cgi(self): import subprocess is_failed = False remote_addr, remote_port = self.socket.getpeername() cwd = os.getcwd() environ = { # os "COMSPEC": os.environ["COMSPEC"], "PATH": os.environ["PATH"], "PATHEXT": os.environ["PATHEXT"], "SYSTEMROOT": os.environ["SYSTEMROOT"], "WINDIR": os.environ["WINDIR"], # serv...
477,178
def handle_cgi(self): import subprocess is_failed = False remote_addr, remote_port = self.socket.getpeername() cwd = os.getcwd() environ = { # os "COMSPEC": os.environ["COMSPEC"], "PATH": os.environ["PATH"], "PATHEXT": os.environ["PATHEXT"], "SYSTEMROOT": os.environ["SYSTEMROOT"], "WINDIR": os.environ["WINDIR"], # serv...
def handle_cgi(self): import subprocess is_failed = False remote_addr, remote_port = self.socket.getpeername() cwd = os.getcwd() environ = { # os "COMSPEC": os.environ["COMSPEC"], "PATH": os.environ["PATH"], "PATHEXT": os.environ["PATHEXT"], "SYSTEMROOT": os.environ["SYSTEMROOT"], "WINDIR": os.environ["WINDIR"], # serv...
477,179
def handle_cgi(self): import subprocess is_failed = False remote_addr, remote_port = self.socket.getpeername() cwd = os.getcwd() environ = { # os "COMSPEC": os.environ["COMSPEC"], "PATH": os.environ["PATH"], "PATHEXT": os.environ["PATHEXT"], "SYSTEMROOT": os.environ["SYSTEMROOT"], "WINDIR": os.environ["WINDIR"], # serv...
def handle_cgi(self): import subprocess is_failed = False remote_addr, remote_port = self.socket.getpeername() cwd = os.getcwd() environ = { # os "COMSPEC": os.environ["COMSPEC"], "PATH": os.environ["PATH"], "PATHEXT": os.environ["PATHEXT"], "SYSTEMROOT": os.environ["SYSTEMROOT"], "WINDIR": os.environ["WINDIR"], # serv...
477,180
def __call__(self, context, rule, event): obj = context if IObjectEvent.providedBy(event): obj = event.object uid_method = getattr(obj, 'UID', None) if uid_method is not None: uid = uid_method() else: uid = '/'.join(context.getPhysicalPath()) if (uid, rule.__name__,) in self.executed: return False else: self.executed....
def __call__(self, context, rule, event): obj = context if IObjectEvent.providedBy(event): obj = event.object uid_method = getattr(obj, 'UID', None) if uid_method is not None: uid = uid_method() else: uid = '/'.join(context.getPhysicalPath()) if (uid, rule.__name__,) in self.executed: return False else: self.executed....
477,181
def close(event): """Close the event processing when the request ends """ if hasattr(_status, 'rule_filter'): _status.rule_filter.reset() if hasattr(_status, 'delayed_events'): _status.delayed_events = {}
def close(event): """Close the event processing when the request ends """ if hasattr(_status, 'rule_filter'): _status.rule_filter.reset() if hasattr(_status, 'delayed_events'): _status.delayed_events = {}
477,182
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
477,183
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
477,184
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
477,185
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
477,186
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
477,187
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
477,188
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
477,189
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
477,190
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
477,191
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
def execute(context, event): """Execute all rules relative to the context, and bubble as appropriate. """ # Do nothing if there is no rule storage or it is not active storage = queryUtility(IRuleStorage) if storage is None or not storage.active: return init() rule_filter = _status.rule_filter # Stop if someone else...
477,192
def added(event): """When an object is added, execute rules assigned to its new parent. There is special handling for Archetypes objects. """ if is_portal_factory(event.object): return # The object added event executes too early for Archetypes objects. # We need to delay execution until we receive a subsequent IObjec...
def added(event): """When an object is added, execute rules assigned to its new parent. There is special handling for Archetypes objects. """ if is_portal_factory(event.object): return # The object added event executes too early for Archetypes objects. # We need to delay execution until we receive a subsequent IObjec...
477,193
def added(event): """When an object is added, execute rules assigned to its new parent. There is special handling for Archetypes objects. """ if is_portal_factory(event.object): return # The object added event executes too early for Archetypes objects. # We need to delay execution until we receive a subsequent IObjec...
def added(event): """When an object is added, execute rules assigned to its new parent. There is special handling for Archetypes objects. """ if is_portal_factory(event.object): return # The object added event executes too early for Archetypes objects. # We need to delay execution until we receive a subsequent IObjec...
477,194
def archetypes_initialized(event): """Pick up the delayed IObjectAddedEvent when an Archetypes object is initialised. """ if is_portal_factory(event.object): return if not IBaseObject.providedBy(event.object): return init() delayed_event = _status.delayed_events.get(IObjectInitializedEvent, None) if delayed_event is ...
def archetypes_initialized(event): """Pick up the delayed IObjectAddedEvent when an Archetypes object is initialised. """ if is_portal_factory(event.object): return if not IBaseObject.providedBy(event.object): return init() delayed_event = _status.delayed_events.get(IObjectInitializedEvent, None) if delayed_event is ...
477,195
def archetypes_initialized(event): """Pick up the delayed IObjectAddedEvent when an Archetypes object is initialised. """ if is_portal_factory(event.object): return if not IBaseObject.providedBy(event.object): return init() delayed_event = _status.delayed_events.get(IObjectInitializedEvent, None) if delayed_event is ...
def archetypes_initialized(event): """Pick up the delayed IObjectAddedEvent when an Archetypes object is initialised. """ if is_portal_factory(event.object): return if not IBaseObject.providedBy(event.object): return init() delayed_event = _status.delayed_events.get(IObjectInitializedEvent, None) if delayed_event is ...
477,196
def removed(event): """When an IObjectRemevedEvent was received, execute rules assigned to its previous parent. """ if is_portal_factory(event.object): return execute(event.oldParent, event)
def removed(event): """When an IObjectRemevedEvent was received, execute rules assigned to its previous parent. """ if is_portal_factory(event.object): return execute(event.oldParent, event)
477,197
def removed(event): """When an IObjectRemevedEvent was received, execute rules assigned to its previous parent. """ if is_portal_factory(event.object): return execute(event.oldParent, event)
def removed(event): """When an IObjectRemevedEvent was received, execute rules assigned to its previous parent. """ if is_portal_factory(event.object): return execute(event.oldParent, event)
477,198
def removed(event): """When an IObjectRemevedEvent was received, execute rules assigned to its previous parent. """ if is_portal_factory(event.object): return execute(event.oldParent, event)
def removed(event): """When an IObjectRemevedEvent was received, execute rules assigned to its previous parent. """ if is_portal_factory(event.object): return execute(event.oldParent, event)
477,199