rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
def doit (self, data, **args): # note: data is the complete request method, url, httpver = data.split() debug(FILTER, "block filter working on url %s", `url`) if self.allowed(url): return data blocked = self.strict_whitelist or self.blocked(url) if blocked: debug(FILTER, "blocked url %s", url) if isinstance(blocked, ba... | f32d2a1749d0cb0f35bb52a4e34151db130f20f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/f32d2a1749d0cb0f35bb52a4e34151db130f20f9/Blocker.py | ||
self.log.debug("Translating %s" % `args`) | self.log.debug("Translating %s with %s", `args`, str(self.translator)) | def cmdOutput (self, command, args): if self.translator is not None and self.translateContent: self.log.debug("Translating %s" % `args`) self.file.write(self.translator.gettext(args) % \ self.context.getVariableMap()) else: self.file.write (args) self.programCounter += 1 | a5dff201b5de3e3d868820f8e7fb21352e41b115 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a5dff201b5de3e3d868820f8e7fb21352e41b115/simpleTAL.py |
self.log.debug("Translating %s" % `result.value()`) | self.log.debug("Translating %s with %s", `result.value()`, str(self.translator)) | def cmdI18nTranslate (self, command, args): """ args: translation string, translation args, endTagSymbol Translate tag content. If the translation string is an empty string, the translate message id is the tag content. Otherwise, the value of the tag content is the message id. """ # an empty string means use tag conten... | a5dff201b5de3e3d868820f8e7fb21352e41b115 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a5dff201b5de3e3d868820f8e7fb21352e41b115/simpleTAL.py |
self.log.debug("Translating %s" % `attExpr`) | self.log.debug("Translating %s with %s", `attExpr`, str(self.translator)) | def cmdI18nAttributes (self, command, args): | a5dff201b5de3e3d868820f8e7fb21352e41b115 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a5dff201b5de3e3d868820f8e7fb21352e41b115/simpleTAL.py |
def _write_color_nt (text, color): | def _write_color_nt (fp, text, color): | def _write_color_nt (text, color): """ Assumes WConio has been imported at module level. """ oldcolor = WConio.gettextinfo()[4] oldtextcolor = oldcolor & 0x000F if ";" in color: control, color = color.split(";", 1) WConio.textcolor(WConioColor.get(color, oldtextcolor)) fp.write(text) WConio.textattr(oldcolor) | 292f5558bbe7787693abe785856c8661334aa8a3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/292f5558bbe7787693abe785856c8661334aa8a3/ansicolor.py |
logging.getLogger(log).debug(msg, *args) | def debug (log, msg, *args): #logging.getLogger(log).debug("collected %d"%gc.collect()) #logging.getLogger(log).debug("objects %d"%len(gc.get_objects())) #logging.getLogger(log).debug("garbage %d"%len(gc.garbage)) #logging.getLogger(log).debug("Mem: %s"%usedmemory()) logging.getLogger(log).debug(msg, *args) | 5e8de8438c790e00672673c046e23ae8471afdc8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/5e8de8438c790e00672673c046e23ae8471afdc8/log.py | |
"""<img>""" % tag) | """<img>""") | def testImgWidthHeight (self): for tag in ("width", "height"): self.filt("""<img %s="9999">""" % tag, """<img %s="9999">""" % tag) self.filt("""<img %s="12345">""" % tag, """<img>""" % tag) | 9d5125261945b583474a09f0393996cca18f2d8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d5125261945b583474a09f0393996cca18f2d8f/test_rewriter.py |
JSFilter(self.url, **opts) | return JSFilter(self.url, opts) | def new_instance (self, **opts): JSFilter(self.url, **opts) | 74fe2f9efe34e5b50273ff87179196fa6b117cb7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/74fe2f9efe34e5b50273ff87179196fa6b117cb7/JSFilter.py |
super(SetList), self).__setitem__(key, value) | super(SetList, self).__setitem__(key, value) | def __setitem__ (self, key, value): if value not in self: super(SetList), self).__setitem__(key, value) | 911540c3370237a5aad9b9a94470472f2b0592c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/911540c3370237a5aad9b9a94470472f2b0592c3/containers.py |
def do_install (): """ Install shortcuts and NT service. """ fix_configdata() import wc wc.init_i18n() install_shortcuts() install_certificates() install_service() restart_service() open_browser_config() | def fix_install_path (line): """ Replace placeholders written by bdist_wininst with those specified in win_path_scheme. """ key, eq, val = line.split() # unescape string (do not use eval()) val = val[1:-1].replace("\\\\", "\\") for d in win_path_scheme.keys(): # look for placeholders to replace oldpath, newpath = win_p... | 7cbac3bde56dcd51807f4ea80d77e1716d38a2e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/7cbac3bde56dcd51807f4ea80d77e1716d38a2e7/install-webcleaner.py | |
def state_nt_service (name): """ Return status of NT service. """ try: return win32serviceutil.QueryServiceStatus(name)[1] except pywintypes.error, msg: print _("Service status error: %s") % str(msg) return None def install_service (): """ Install WebCleaner as NT service. """ import wc import wc.win32start oldargs =... | def install_adminpassword (): """ Ask for admin password if not already set. """ if has_adminpassword(): return import wc import Tkinter as tk root = init_tk() import tkSimpleDialog class PasswordDialog (tkSimpleDialog.Dialog): """ Admin password dialog. """ def body(self, master): d = {"appname": wc.AppName} msg = ... | def state_nt_service (name): """ Return status of NT service. """ try: return win32serviceutil.QueryServiceStatus(name)[1] except pywintypes.error, msg: print _("Service status error: %s") % str(msg) return None | 7cbac3bde56dcd51807f4ea80d77e1716d38a2e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/7cbac3bde56dcd51807f4ea80d77e1716d38a2e7/install-webcleaner.py |
""" Open the WebCleaner administration web interface. """ | def open_browser_config (): # sleep a while to let the proxy start... import wc import wc.configuration state = state_nt_service(wc.AppName) while state==win32service.SERVICE_START_PENDING: time.sleep(1) state = state_nt_service(wc.AppName) time.sleep(3) # open configuration config = wc.configuration.init() config_url ... | 7cbac3bde56dcd51807f4ea80d77e1716d38a2e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/7cbac3bde56dcd51807f4ea80d77e1716d38a2e7/install-webcleaner.py | |
from Tkinter import tkMessageBox answer = tkMessageBox.askyesno(_("Purge local config"), _("""Do you want to remove your local filter rules? They can be re-used in other installations of %s, but are useless otherwise.""")) | init_tk() import tkMessageBox answer = tkMessageBox.askyesno(_("%s config purge") % wc.AppName, _("""There are local filter rules in the configuration directory. Do you want to remove them? They can be re-used in other installations of %s, but are useless otherwise.""") % wc.AppName) | def purge_tempfiles (): """ Ask if user wants to purge local config files. """ files = glob.glob(os.path.join(wc.ConfigDir, "local_*.zap")) if not files: return from Tkinter import tkMessageBox answer = tkMessageBox.askyesno(_("Purge local config"), _("""Do you want to remove your local filter rules? | 7cbac3bde56dcd51807f4ea80d77e1716d38a2e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/7cbac3bde56dcd51807f4ea80d77e1716d38a2e7/install-webcleaner.py |
print _("Could not remove %r: %s") % (fname, str(msg)) | print _("Could not remove file %r: %s") % (fname, str(msg)) def is_empty_dir (name): """ Check if given name is a non-empty directory. """ return os.path.isdir(name) and not os.listdir(name) def remove_empty_directories (dname): """ Remove empty directory structure. """ try: if is_empty_dir(dname): os.rmdir(dname) ... | def remove_file (fname): """ Remove a single file if it exists. Errors are printed to stdout. """ if os.path.exists(fname): try: os.remove(fname) except OSError, msg: print _("Could not remove %r: %s") % (fname, str(msg)) | 7cbac3bde56dcd51807f4ea80d77e1716d38a2e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/7cbac3bde56dcd51807f4ea80d77e1716d38a2e7/install-webcleaner.py |
se_offset_abs = "^\(([0\\\][xX][\dA-Fa-f]+|[0\\\][0-7]*|\d+)" \ "(\.[bslBSL])*\)" se_offset_add = "^\(([0\\\][xX][\dA-Fa-f]+|[0\\\][0-7]*|\d+)" \ "(\.[bslBSL])*([-+])([0\\\][xX][\dA-Fa-f]+|[0\\\][0-7]*|\d+)\)" | se_offset_abs = re.compile( r"^\(([0\\\][xX][\dA-Fa-f]+|[0\\\][0-7]*|\d+)" \ r"(\.[bslBSL])*\)").match se_offset_add = re.compile( r"^\(([0\\\][xX][\dA-Fa-f]+|[0\\\][0-7]*|\d+)" \ r"(\.[bslBSL])*([-+])([0\\\][xX][\dA-Fa-f]+|[0\\\][0-7]*|\d+)\)").match | def dump (o, f): """pickle object o to file f""" cPickle.dump(o, f, pickle.HIGHEST_PROTOCOL) | f71dd792b3cd7b971abd17643d3a4ef8a134fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/f71dd792b3cd7b971abd17643d3a4ef8a134fcf8/__init__.py |
match_abs = re.compile(self.se_offset_abs).match(text) match_add = re.compile(self.se_offset_add).match(text) | match_abs = self.se_offset_abs(text) match_add = self.se_offset_add(text) | def _offset (self, text): direct = self._direct_offset(text) offset_type = 'l' offset_delta = 0L offset_relatif = 0L | f71dd792b3cd7b971abd17643d3a4ef8a134fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/f71dd792b3cd7b971abd17643d3a4ef8a134fcf8/__init__.py |
if line and not line.startswith(' part = self._split(line) while len(part) < 4: part.append('\b') level = self._level(part[0]) offset_string = self._strip_start('&', part[0][level:]) (direct, offset_type, offset_delta, offset_relatif) = \ self._offset(offset_string) (oper, mask, rest) = self._oper_mask(par... | if not line or line.startswith(' continue part = self._split(line) while len(part) < 4: part.append(r'\b') level = self._level(part[0]) offset_string = self._strip_start('&', part[0][level:]) (direct, offset_type, offset_delta, offset_relatif) = \ self._offset(offset_string) (oper, mask, rest) = self._oper... | def read_magic (self, magic_file): self.magic = [] | f71dd792b3cd7b971abd17643d3a4ef8a134fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/f71dd792b3cd7b971abd17643d3a4ef8a134fcf8/__init__.py |
value = 0 | value = data | def _convert (self, kind, endian, data): # Can raise StandardError and IOError value = 0 | f71dd792b3cd7b971abd17643d3a4ef8a134fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/f71dd792b3cd7b971abd17643d3a4ef8a134fcf8/__init__.py |
s = u'<Rule %s sid="%s"' % (self.get_name(), | s = u'<%s sid="%s"' % (self.get_name(), | def toxml (self): """Rule data as XML for storing, must be overridden in subclass""" s = u'<Rule %s sid="%s"' % (self.get_name(), wc.XmlUtils.xmlquoteattr(self.sid)) if self.disable: s += u' disable="%d"' % self.disable return s | e792f72e34ca8bd6a676d9c6181d84a193371e94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/e792f72e34ca8bd6a676d9c6181d84a193371e94/Rule.py |
self.filt("""<frameset><frame src="aaa"><embed name="sp", style><applet hspace="file:\\">""", """<frameset><frame src="aaa"><embed name="sp", style><applet>""") | self.filt("""<frameset><frame src="aaa"><embed name="sp" style><applet hspace="file:\\\\">""", """<frameset><frame src="aaa"><embed name="sp" style><applet>""") | def testAppletHspace (self): self.filt("""<frameset><frame src="aaa"><embed name="sp", style><applet hspace="file:\\">""", """<frameset><frame src="aaa"><embed name="sp", style><applet>""") | c57f671115f51744639ece8a11d7eae0f46e0a45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c57f671115f51744639ece8a11d7eae0f46e0a45/test_rewriter.py |
self.jsScript(script, ver) return 1 | return self.jsScript(script, ver) | def jsScriptSrc (self, url, language): if not url: return url = urlparse.urljoin(self.url, url) #debug(HURT_ME_PLENTY, "jsScriptSrc", url, language) try: script = urlutils.open_url(url).read() except: print >>sys.stderr, "exception fetching script url", `url` return if not script: return ver = 0.0 if language: mo = re.... | 3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5/Rewriter.py |
"""execute given script with javascript version ver""" | """execute given script with javascript version ver return True if the script generates any output, else False""" | def jsScript (self, script, ver): """execute given script with javascript version ver""" #debug(HURT_ME_PLENTY, "jsScript", script, ver) self.jsEnv.attachListener(self) self.jsfilter = HtmlFilter(self.rules, self.url, comments=self.comments, javascript=self.javascript) self.jsEnv.executeScript(script, ver) self.jsEnv.d... | 3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5/Rewriter.py |
self.jsfilter.flush() self.data.append(self.jsfilter.flushbuf()) self.buffer += self.jsfilter.buffer self.rulestack += self.jsfilter.rulestack | if self.output_counter: self.jsfilter.flush() self.data.append(self.jsfilter.flushbuf()) self.buffer += self.jsfilter.buffer self.rulestack += self.jsfilter.rulestack | def jsScript (self, script, ver): """execute given script with javascript version ver""" #debug(HURT_ME_PLENTY, "jsScript", script, ver) self.jsEnv.attachListener(self) self.jsfilter = HtmlFilter(self.rules, self.url, comments=self.comments, javascript=self.javascript) self.jsEnv.executeScript(script, ver) self.jsEnv.d... | 3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5/Rewriter.py |
if not filtered and self.javascript and tag=='script': self.jsEndElement(tag) | if not filtered and self.javascript and tag=='script' and \ self.jsEndElement(tag): del self.buffer[-1] del self.buffer[-1] | def endElement (self, tag): """We know the following: if a rule matches, it must be the one on the top of the stack. So we look only at the top rule. | 3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5/Rewriter.py |
"""parse generated html for scripts""" if not self.buffer: print >>sys.stderr, "empty buffer on </script>" | """parse generated html for scripts return True if the script generates any output, else False""" if len(self.buffer)<2: | def jsEndElement (self, tag): """parse generated html for scripts""" if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return if self.buffer[-1][0]!=DATA: print >>sys.stderr, "missing data for </script>", self.buffer[-1:] return script = self.buffer[-1][1].strip() del self.buffer[-1] if not (self.buff... | 3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5/Rewriter.py |
del self.buffer[-1] if not (self.buffer and self.buffer[-1][0]==STARTTAG and \ self.buffer[-1][1]=='script'): | if not (self.buffer[-2][0]==STARTTAG and \ self.buffer[-2][1]=='script'): | def jsEndElement (self, tag): """parse generated html for scripts""" if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return if self.buffer[-1][0]!=DATA: print >>sys.stderr, "missing data for </script>", self.buffer[-1:] return script = self.buffer[-1][1].strip() del self.buffer[-1] if not (self.buff... | 3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5/Rewriter.py |
del self.buffer[-1] | def jsEndElement (self, tag): """parse generated html for scripts""" if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return if self.buffer[-1][0]!=DATA: print >>sys.stderr, "missing data for </script>", self.buffer[-1:] return script = self.buffer[-1][1].strip() del self.buffer[-1] if not (self.buff... | 3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5/Rewriter.py | |
script = script[4:].strip() | i = script.index('\n') if i==-1: script = script[4:] else: script = script[(i+1):] if script.endswith("-->"): script = script[:-3] | def jsEndElement (self, tag): """parse generated html for scripts""" if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return if self.buffer[-1][0]!=DATA: print >>sys.stderr, "missing data for </script>", self.buffer[-1:] return script = self.buffer[-1][1].strip() del self.buffer[-1] if not (self.buff... | 3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5/Rewriter.py |
self.jsScript(script, 0.0) | return self.jsScript(script, 0.0) | def jsEndElement (self, tag): """parse generated html for scripts""" if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return if self.buffer[-1][0]!=DATA: print >>sys.stderr, "missing data for </script>", self.buffer[-1:] return script = self.buffer[-1][1].strip() del self.buffer[-1] if not (self.buff... | 3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/3065d1c6c10f0c7943a3e34722dcd91e9c5a16f5/Rewriter.py |
if data: p.feed(data) | if data: p.feed(data) | def finish (self, data, **attrs): if not attrs.has_key('filter'): return data p = attrs['filter'] if data: p.feed(data) p.flush() p.buf2data() return p.flushbuf() | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py |
"""The parser has the rules, a data buffer and a rule stack.""" | """The parser has the rules, a data buffer and a rule stack. States: parse => default parsing state, no background fetching wait => Fetching additionally data in the background. Feeding new data in wait state raises a FilterException. When finished, the buffers look like data [---------|--------][-------][---------... | def _buf2data (buf, outbuf): """Append all tags of the buffer to the data""" for item in buf: if item[0]==DATA: outbuf.write(item[1]) elif item[0]==STARTTAG: s = "<"+item[1] for name,val in item[2].items(): s += ' %s'%name if val: s += "=%s"%val outbuf.write(s+">") elif item[0]==ENDTAG: outbuf.write("</%s>"%item[1]) el... | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py |
data = "%s%s%s" % (self.waitbuf.getvalue(), self.inbuf.getvalue(), data) | data = "%s%s" % (self.waitbuf.getvalue(), self.inbuf.getvalue(), ) | def feed (self, data): if self.state=='parse': if self.waited: data = "%s%s%s" % (self.waitbuf.getvalue(), self.inbuf.getvalue(), data) self.inbuf.close() self.waitbuf.close() self.inbuf = StringIO() self.waitbuf = StringIO() self.waited = 0 HtmlParser.feed(self, data) else: self.inbuf.write(data) | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py |
debug(NIGHTMARE, "Filter: matched rule %s on tag %s" % (`rule.title`, `tag`)) | debug(NIGHTMARE, "HtmlFilter: matched rule %s on tag %s" % (`rule.title`, `tag`)) | def startElement (self, tag, attrs): """We get a new start tag. New rules could be appended to the pending rules. No rules can be removed from the list.""" # default data item = [STARTTAG, tag, attrs] if self.state=='wait': return _buf2data([item], self.waitbuf) rulelist = [] filtered = 0 # look for filter rules which ... | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py |
debug(NIGHTMARE, "Filter: put on buffer") | debug(NIGHTMARE, "HtmlFilter: put on buffer") | def startElement (self, tag, attrs): """We get a new start tag. New rules could be appended to the pending rules. No rules can be removed from the list.""" # default data item = [STARTTAG, tag, attrs] if self.state=='wait': return _buf2data([item], self.waitbuf) rulelist = [] filtered = 0 # look for filter rules which ... | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py |
def startElement (self, tag, attrs): """We get a new start tag. New rules could be appended to the pending rules. No rules can be removed from the list.""" # default data item = [STARTTAG, tag, attrs] if self.state=='wait': return _buf2data([item], self.waitbuf) rulelist = [] filtered = 0 # look for filter rules which ... | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py | ||
if not self.rulestack and \ (not self.javascript or tag!='script'): | if not self.rulestack and not self.javascript: | def startElement (self, tag, attrs): """We get a new start tag. New rules could be appended to the pending rules. No rules can be removed from the list.""" # default data item = [STARTTAG, tag, attrs] if self.state=='wait': return _buf2data([item], self.waitbuf) rulelist = [] filtered = 0 # look for filter rules which ... | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py |
filtered = 1 | filtered = "True" | def endElement (self, tag): """We know the following: if a rule matches, it must be the one on the top of the stack. So we look only at the top rule. | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py |
self.buf.append((ENDTAG, tag)) | self.buf.append(item) | def endElement (self, tag): """We know the following: if a rule matches, it must be the one on the top of the stack. So we look only at the top rule. | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py |
self.jsScriptSrc(url, lang) self.buf.append((STARTTAG, tag, attrs)) | return self.jsScriptSrc(url, lang) self.buf.append([STARTTAG, tag, attrs]) | def jsStartElement (self, tag, attrs): """Check popups for onmouseout and onmouseover. Inline extern javascript sources (only in the same domain)""" changed = 0 for name in ('onmouseover', 'onmouseout'): if attrs.has_key(name) and self.jsPopup(attrs, name): del attrs[name] changed = 1 if tag=='form': name = attrs.get('... | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py |
ClientServerMatchmaker(clien t, | ClientServerMatchmaker(client, | def jsScriptSrc (self, url, language): assert self.state=='parse' ver = 0.0 if language: mo = re.search(r'(?i)javascript(?P<num>\d\.\d)', language) if mo: ver = float(mo.group('num')) url = urlparse.urljoin(self.url, url) debug(HURT_ME_PLENTY, "JS: jsScriptSrc", url, ver) self.script = '' self.state = 'wait' client = H... | 963fe71cee0c18f8415eff13338f105ff2d99ae1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/963fe71cee0c18f8415eff13338f105ff2d99ae1/Rewriter.py |
val = "^%s$" % val | val = "^(%s)$" % val | def compileRegex (obj, attr, fullmatch=False, flags=0): """ Regex-compile object attribute into <attr>_ro. """ if hasattr(obj, attr): val = getattr(obj, attr) if val: if fullmatch: val = "^%s$" % val setattr(obj, attr+"_ro", re.compile(val, flags)) | 705c01f39b9ae5c98cd2a5b9eaef5a8821a0fd6a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/705c01f39b9ae5c98cd2a5b9eaef5a8821a0fd6a/Rule.py |
self.assertEquals(linkcheck.strformat.unquote(""), "") self.assertEquals(linkcheck.strformat.unquote(None), None) self.assertEquals(linkcheck.strformat.unquote("'"), "'") self.assertEquals(linkcheck.strformat.unquote("\""), "\"") self.assertEquals(linkcheck.strformat.unquote("\"\""), "") self.assertEquals(linkcheck.str... | self.assertEquals(wc.strformat.unquote(""), "") self.assertEquals(wc.strformat.unquote(None), None) self.assertEquals(wc.strformat.unquote("'"), "'") self.assertEquals(wc.strformat.unquote("\""), "\"") self.assertEquals(wc.strformat.unquote("\"\""), "") self.assertEquals(wc.strformat.unquote("''"), "") self.assertEqual... | def test_unquote (self): """test quote stripping""" self.assertEquals(linkcheck.strformat.unquote(""), "") self.assertEquals(linkcheck.strformat.unquote(None), None) self.assertEquals(linkcheck.strformat.unquote("'"), "'") self.assertEquals(linkcheck.strformat.unquote("\""), "\"") self.assertEquals(linkcheck.strformat.... | 4a23be976d9b50896ccaccc02ae89f5ca6c9f960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/4a23be976d9b50896ccaccc02ae89f5ca6c9f960/test_strformat.py |
self.assertEquals(linkcheck.strformat.unquote("'a\""), "a") self.assertEquals(linkcheck.strformat.unquote("\"a'"), "a") | self.assertEquals(wc.strformat.unquote("'a\""), "a") self.assertEquals(wc.strformat.unquote("\"a'"), "a") | def test_unquote (self): """test quote stripping""" self.assertEquals(linkcheck.strformat.unquote(""), "") self.assertEquals(linkcheck.strformat.unquote(None), None) self.assertEquals(linkcheck.strformat.unquote("'"), "'") self.assertEquals(linkcheck.strformat.unquote("\""), "\"") self.assertEquals(linkcheck.strformat.... | 4a23be976d9b50896ccaccc02ae89f5ca6c9f960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/4a23be976d9b50896ccaccc02ae89f5ca6c9f960/test_strformat.py |
self.assertEquals(linkcheck.strformat.wrap(s, -1), s) self.assertEquals(linkcheck.strformat.wrap(s, 0), s) | self.assertEquals(wc.strformat.wrap(s, -1), s) self.assertEquals(wc.strformat.wrap(s, 0), s) | def test_wrap (self): """test line wrapping""" s = "11%(sep)s22%(sep)s33%(sep)s44%(sep)s55" % {'sep': os.linesep} # testing width <= 0 self.assertEquals(linkcheck.strformat.wrap(s, -1), s) self.assertEquals(linkcheck.strformat.wrap(s, 0), s) s2 = "11 22%(sep)s33 44%(sep)s55" % {'sep': os.linesep} # splitting lines self... | 4a23be976d9b50896ccaccc02ae89f5ca6c9f960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/4a23be976d9b50896ccaccc02ae89f5ca6c9f960/test_strformat.py |
self.assertEquals(linkcheck.strformat.wrap(s2, 2), s) | self.assertEquals(wc.strformat.wrap(s2, 2), s) | def test_wrap (self): """test line wrapping""" s = "11%(sep)s22%(sep)s33%(sep)s44%(sep)s55" % {'sep': os.linesep} # testing width <= 0 self.assertEquals(linkcheck.strformat.wrap(s, -1), s) self.assertEquals(linkcheck.strformat.wrap(s, 0), s) s2 = "11 22%(sep)s33 44%(sep)s55" % {'sep': os.linesep} # splitting lines self... | 4a23be976d9b50896ccaccc02ae89f5ca6c9f960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/4a23be976d9b50896ccaccc02ae89f5ca6c9f960/test_strformat.py |
self.assertEquals(linkcheck.strformat.wrap(s, 5), s2) | self.assertEquals(wc.strformat.wrap(s, 5), s2) | def test_wrap (self): """test line wrapping""" s = "11%(sep)s22%(sep)s33%(sep)s44%(sep)s55" % {'sep': os.linesep} # testing width <= 0 self.assertEquals(linkcheck.strformat.wrap(s, -1), s) self.assertEquals(linkcheck.strformat.wrap(s, 0), s) s2 = "11 22%(sep)s33 44%(sep)s55" % {'sep': os.linesep} # splitting lines self... | 4a23be976d9b50896ccaccc02ae89f5ca6c9f960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/4a23be976d9b50896ccaccc02ae89f5ca6c9f960/test_strformat.py |
self.assertEquals(linkcheck.strformat.remove_markup("<a>"), "") self.assertEquals(linkcheck.strformat.remove_markup("<>"), "") self.assertEquals(linkcheck.strformat.remove_markup("<<>"), "") self.assertEquals(linkcheck.strformat.remove_markup("a < b"), "a < b") | self.assertEquals(wc.strformat.remove_markup("<a>"), "") self.assertEquals(wc.strformat.remove_markup("<>"), "") self.assertEquals(wc.strformat.remove_markup("<<>"), "") self.assertEquals(wc.strformat.remove_markup("a < b"), "a < b") | def test_remove_markup (self): """test markup removing""" self.assertEquals(linkcheck.strformat.remove_markup("<a>"), "") self.assertEquals(linkcheck.strformat.remove_markup("<>"), "") self.assertEquals(linkcheck.strformat.remove_markup("<<>"), "") self.assertEquals(linkcheck.strformat.remove_markup("a < b"), "a < b") | 4a23be976d9b50896ccaccc02ae89f5ca6c9f960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/4a23be976d9b50896ccaccc02ae89f5ca6c9f960/test_strformat.py |
self.assertRaises(ValueError, linkcheck.strformat.strsize, -1) self.assertEquals(linkcheck.strformat.strsize(0), "0 Bytes") self.assertEquals(linkcheck.strformat.strsize(1), "1 Byte") self.assertEquals(linkcheck.strformat.strsize(2), "2 Bytes") self.assertEquals(linkcheck.strformat.strsize(1023), "1023 Bytes") self.ass... | self.assertRaises(ValueError, wc.strformat.strsize, -1) self.assertEquals(wc.strformat.strsize(0), "0 Bytes") self.assertEquals(wc.strformat.strsize(1), "1 Byte") self.assertEquals(wc.strformat.strsize(2), "2 Bytes") self.assertEquals(wc.strformat.strsize(1023), "1023 Bytes") self.assertEquals(wc.strformat.strsize(1024... | def test_strsize (self): """test byte size strings""" self.assertRaises(ValueError, linkcheck.strformat.strsize, -1) self.assertEquals(linkcheck.strformat.strsize(0), "0 Bytes") self.assertEquals(linkcheck.strformat.strsize(1), "1 Byte") self.assertEquals(linkcheck.strformat.strsize(2), "2 Bytes") self.assertEquals(lin... | 4a23be976d9b50896ccaccc02ae89f5ca6c9f960 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/4a23be976d9b50896ccaccc02ae89f5ca6c9f960/test_strformat.py |
raise RatingParseError(i18n._(",alformed rating line %r")%line) | raise RatingParseError(i18n._("malformed rating line %r")%line) | def rating_parse (data, debug=0): """parse given rating data, throws ParseError on error""" categories = {} for line in data.splitlines(): if debug: debug(RATING, "Read line %r", line) try: category, value = line.split(None, 1) except ValueError, msg: raise RatingParseError(i18n._(",alformed rating line %r")%line) cate... | 95214b3a2be0a4d0f8bc15494a0109270a3be776 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/95214b3a2be0a4d0f8bc15494a0109270a3be776/Rating.py |
self._debug(ALWAYS, "self.inbuf", `self.inbuf.getvalue()`) | def feed (self, data): """feed some data to the parser""" if self.state=='parse': # look if we must replay something if self.waited: self.waited = 0 waitbuf, self.waitbuf = self.waitbuf, [] self.replay(waitbuf) if self.state!='parse': self._debug(ALWAYS, "self.inbuf", `self.inbuf.getvalue()`) return data = self.inbuf.g... | d4fce7e0af88a8a5a2d9abb289283697c880aa94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/d4fce7e0af88a8a5a2d9abb289283697c880aa94/HtmlParser.py | |
self.handleError() | self.handleError(record) | def emit (self, record): """ A little more verbose emit function. """ try: msg = self.format(record) self.stream.write("%s\n" % msg) self.flush() except: print >>sys.stderr, "Could not format record", record self.handleError() | 5cd49b18dc1167723f4244fbf8c71130b9ecfa73 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/5cd49b18dc1167723f4244fbf8c71130b9ecfa73/log.py |
categories[cat][type] = gzip.GzipFile(fname, 'wb') | categories[cat][ftype] = gzip.GzipFile(fname, 'wb') | def open_files (directory): for cat in categories.keys(): if cat=='kids_and_teens': d='whitelists' else: d='blacklists' basedir = "%s/%s/%s" % (directory, d, cat) if not os.path.isdir(basedir): os.makedirs(basedir) for ftype in categories[cat].keys(): if ftype=="expressions": continue fname = "%s/%s.gz" % (basedir, fty... | 82972525a8431813b7a7a283ac425d1bab740300 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/82972525a8431813b7a7a283ac425d1bab740300/bl2wc.py |
scripts = ['webcleaner', 'webcleanerconf', 'wcheaders'] | scripts = ['webcleaner', 'webcleanerconf', 'wcheaders'], | def create_batch_file(self, directory, data, filename): filename = os.path.join(directory, filename) # write the batch file util.execute(write_file, (filename, data), "creating %s" % filename, self.verbose>=1, self.dry_run) | a6fe0eab568a121d891c5e05b6628b402c768f60 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a6fe0eab568a121d891c5e05b6628b402c768f60/setup.py |
"charset": ConfigCharset, "title_en": xmlify("%s %s" % (ftype.capitalize(), cat)), "title_de": xmlify("%s %s" % (transtypes[ftype]['de'].capitalize(), | "charset": wc.ConfigCharset, "title_en": wc.XmlUtils.xmlquote("%s %s" % (ftype.capitalize(), cat)), "title_de": wc.XmlUtils.xmlquote("%s %s" % (transtypes[ftype]['de'].capitalize(), | def write_folder (cat, ftype, data, f): print "write", cat, "folder" d = { "charset": ConfigCharset, "title_en": xmlify("%s %s" % (ftype.capitalize(), cat)), "title_de": xmlify("%s %s" % (transtypes[ftype]['de'].capitalize(), transcats[cat]['de'].capitalize())), "desc_en": xmlify("Automatically generated on %s" % date)... | ea210123cf99e19e452cf01342949f702e718584 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/ea210123cf99e19e452cf01342949f702e718584/bl2wc.py |
"desc_en": xmlify("Automatically generated on %s" % date), "desc_de": xmlify("Automatisch generiert am %s" % date), | "desc_en": wc.XmlUtils.xmlquote("Automatically generated on %s" % date), "desc_de": wc.XmlUtils.xmlquote("Automatisch generiert am %s" % date), | def write_folder (cat, ftype, data, f): print "write", cat, "folder" d = { "charset": ConfigCharset, "title_en": xmlify("%s %s" % (ftype.capitalize(), cat)), "title_de": xmlify("%s %s" % (transtypes[ftype]['de'].capitalize(), transcats[cat]['de'].capitalize())), "desc_en": xmlify("Automatically generated on %s" % date)... | ea210123cf99e19e452cf01342949f702e718584 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/ea210123cf99e19e452cf01342949f702e718584/bl2wc.py |
d['path'] = xmlify(expr) | d['path'] = wc.XmlUtils.xmlquote(expr) | def write_expressions (cat, b, ftype, f): d = { 'title_en': "%s expression filter"%cat.capitalize(), 'title_de': "%s Ausdruckfilter"%transcats[cat]['de'].capitalize(), 'desc_en': """Automatically generated, you should not edit this filter. | ea210123cf99e19e452cf01342949f702e718584 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/ea210123cf99e19e452cf01342949f702e718584/bl2wc.py |
f = TarFile.gzopen(source) | f = tarfile.TarFile.gzopen(source) | def blacklist (fname): source = os.path.join("downloads", fname) # extract tar if fname.endswith(".tar.gz"): print "extracting archive..." d = os.path.join("extracted", fname[:-7]) f = TarFile.gzopen(source) for m in f: a, b = os.path.split(m.name) a = os.path.basename(a) if b in myfiles and a in mycats: print m.name f... | ea210123cf99e19e452cf01342949f702e718584 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/ea210123cf99e19e452cf01342949f702e718584/bl2wc.py |
webbrowser.open(config_url) | webbrowser.open(url) | def open_browser (url): print _("Opening proxy configuration interface...") # the windows webbrowser.open func raises an exception for http:// # urls, but works nevertheless. Just ignore the error. try: webbrowser.open(config_url) except WindowsError, msg: print _("Could not open webbrowser: %r") % str(msg) | f94fbfa074359d0fba5a7f515afd4d800c3b6eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/f94fbfa074359d0fba5a7f515afd4d800c3b6eaf/install-webcleaner.py |
scripts = ['webcleaner', 'webcleaner-certificates'] | def create_batch_file (self, directory, data, filename): filename = os.path.join(directory, filename) # write the batch file util.execute(write_file, (filename, data), "creating %s" % filename, self.verbose>=1, self.dry_run) | bd30da30bdd53933fa759d9ba107108ee6d7e0eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/bd30da30bdd53933fa759d9ba107108ee6d7e0eb/setup.py | |
scripts.append('webcleaner-service') | def create_batch_file (self, directory, data, filename): filename = os.path.join(directory, filename) # write the batch file util.execute(write_file, (filename, data), "creating %s" % filename, self.verbose>=1, self.dry_run) | bd30da30bdd53933fa759d9ba107108ee6d7e0eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/bd30da30bdd53933fa759d9ba107108ee6d7e0eb/setup.py | |
scripts = scripts, | scripts = ['webcleaner', 'webcleaner-certificates'], | def create_batch_file (self, directory, data, filename): filename = os.path.join(directory, filename) # write the batch file util.execute(write_file, (filename, data), "creating %s" % filename, self.verbose>=1, self.dry_run) | bd30da30bdd53933fa759d9ba107108ee6d7e0eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/bd30da30bdd53933fa759d9ba107108ee6d7e0eb/setup.py |
def filter (self, data, url): | def filter (self, data, url, rules): encoding = "UTF8" self.parser.encoding = encoding data = data.encode(encoding) self.rules = rules | def filter (self, data, url): self.url = url self.parser.feed(data) self.parser.flush() self.parser.reset() self.valid = True self.stack = [] data = self.outbuf.getvalue() self.outbuf.close() self.outbuf = StringIO() return data | a7d64b9a3c3e6a8d17da2470e8d1a16a5f926407 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a7d64b9a3c3e6a8d17da2470e8d1a16a5f926407/RssHtmlFilter.py |
self.valid = True self.stack = [] | def filter (self, data, url): self.url = url self.parser.feed(data) self.parser.flush() self.parser.reset() self.valid = True self.stack = [] data = self.outbuf.getvalue() self.outbuf.close() self.outbuf = StringIO() return data | a7d64b9a3c3e6a8d17da2470e8d1a16a5f926407 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a7d64b9a3c3e6a8d17da2470e8d1a16a5f926407/RssHtmlFilter.py | |
self.outbuf = StringIO() | self.reset() | def filter (self, data, url): self.url = url self.parser.feed(data) self.parser.flush() self.parser.reset() self.valid = True self.stack = [] data = self.outbuf.getvalue() self.outbuf.close() self.outbuf = StringIO() return data | a7d64b9a3c3e6a8d17da2470e8d1a16a5f926407 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a7d64b9a3c3e6a8d17da2470e8d1a16a5f926407/RssHtmlFilter.py |
tag = wc.filter.HtmlTags.check_spelling(tag, self.url) | tag = wc.filter.html.check_spelling(tag, self.url) | def _start_element (self, tag, attrs, startend): tag = wc.filter.HtmlTags.check_spelling(tag, self.url) self.stack.append(tag) if not self.valid: return if tag in rss_allowed: self.outbuf.write(u"<%s" % tag) if attrs: quote = wc.HtmlParser.htmllib.quote_attrval for attr in attrs: if attr in rss_allowed[tag]: val = attr... | a7d64b9a3c3e6a8d17da2470e8d1a16a5f926407 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a7d64b9a3c3e6a8d17da2470e8d1a16a5f926407/RssHtmlFilter.py |
if err in (errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK): | if err in (errno.EINPROGRESS, errno.EWOULDBLOCK): | def connect (self, addr): wc.log.debug(wc.LOG_PROXY, '%s connecting', self) self.connected = False err = self.socket.connect_ex(addr) if err != 0: strerr = errno.errorcode[err] wc.log.debug(wc.LOG_PROXY, '%s connection error %s', self, strerr) # XXX Should interpret Winsock return values if err in (errno.EINPROGRESS, e... | 85dbeb116b4d37d1b8b35f2a3b5ddeb3f4fac34b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/85dbeb116b4d37d1b8b35f2a3b5ddeb3f4fac34b/Dispatcher.py |
See also http://cr.yp.to/docs/connect.html | See also http://cr.yp.to/docs/connect.html and connect(2) manpage. | def check_connect (self, addr): """ Check if the connection is etablished. See also http://cr.yp.to/docs/connect.html """ wc.log.debug(wc.LOG_PROXY, '%s check connect', self) err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) if err == 0: self.addr = addr self.connected = True wc.log.debug(wc.LOG_PROXY, '... | 85dbeb116b4d37d1b8b35f2a3b5ddeb3f4fac34b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/85dbeb116b4d37d1b8b35f2a3b5ddeb3f4fac34b/Dispatcher.py |
elif err in (errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK): | elif err in (errno.EINPROGRESS, errno.EWOULDBLOCK): | def check_connect (self, addr): """ Check if the connection is etablished. See also http://cr.yp.to/docs/connect.html """ wc.log.debug(wc.LOG_PROXY, '%s check connect', self) err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) if err == 0: self.addr = addr self.connected = True wc.log.debug(wc.LOG_PROXY, '... | 85dbeb116b4d37d1b8b35f2a3b5ddeb3f4fac34b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/85dbeb116b4d37d1b8b35f2a3b5ddeb3f4fac34b/Dispatcher.py |
return self.enclosed_ro.match(data) | return self.enclosed_ro.search(data) | def match_complete (self, pos, tagbuf): """ We know that the tag (and tag attributes) match. Now match the enclosing block. Return True on a match. """ if not self.enclosed: # no enclosed expression => match return True # put buf items together for matching items = tagbuf[pos:] data = wc.filter.html.tagbuf2data(items, ... | 7dd938cf2887c827895292966733d8e0500470da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/7dd938cf2887c827895292966733d8e0500470da/HtmlrewriteRule.py |
data += "0000000000%d\r\n" % len(body) | data += "0000000000%s\r\n" % hex(self.body_length)[2:] | def do_GET (self): """send chunk data""" body = random_chars(self.body_length) data = 'HTTP/1.1 200 OK\r\n' data += "Date: %s\r\n" % self.date_time_string() data += "Transfer-Encoding: chunked\r\n" data += "Connection: close\r\n" data += "\r\n" data += "0000000000%d\r\n" % len(body) data += "%s\r\n" % body data += "0\r... | 8c928c4cff6d8d86f79d5f024b821246d9b4020b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/8c928c4cff6d8d86f79d5f024b821246d9b4020b/TestChunkedEncoding.py |
wc.proxy.make_timer(1, reload_config) | global pending_reload if not pending_reload: pending_reload = True wc.proxy.make_timer(1, reload_config) | def sighup_reload_config (signum, frame): """store timer for reloading configuration data""" wc.proxy.make_timer(1, reload_config) | 8ecb2c0b01971497ebdc1b9b0f7c0cf611eb483f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/8ecb2c0b01971497ebdc1b9b0f7c0cf611eb483f/configuration.py |
p.debug(1) | def _main (args): """USAGE: test/run.sh test/parsefile.py test.html""" if len(args) < 1: print _main.__doc__ sys.exit(1) from wc.HtmlParser.htmllib import HtmlPrinter, HtmlPrettyPrinter if args[0] == "-p": klass = HtmlPrettyPrinter filename = args[1] else: klass = HtmlPrinter filename = args[0] if filename == '-': f = ... | 0027f5525ab1582347585e15daf358926f5d68d3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/0027f5525ab1582347585e15daf358926f5d68d3/parsefile.py | |
version = "0.51", | version = "0.52", | def create_batch_file(self, directory, data, filename): filename = os.path.join(directory, filename) # write the batch file util.execute(write_file, (filename, data), "creating %s" % filename, self.verbose>=1, self.dry_run) | afddd5dd8a0038b1afbf3aecb72e9530ebec3b27 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/afddd5dd8a0038b1afbf3aecb72e9530ebec3b27/setup.py |
('share/webcleaner/config/blacklists/audio-video', ['config/blacklists/audio-video/urls.gz', 'config/blacklists/audio-video/domains.gz']), ('share/webcleaner/config/blacklists/drugs', ['config/blacklists/drugs/urls.gz', 'config/blacklists/drugs/domains.gz']), ('share/webcleaner/config/blacklists/gambling', ['config/bla... | def create_batch_file(self, directory, data, filename): filename = os.path.join(directory, filename) # write the batch file util.execute(write_file, (filename, data), "creating %s" % filename, self.verbose>=1, self.dry_run) | afddd5dd8a0038b1afbf3aecb72e9530ebec3b27 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/afddd5dd8a0038b1afbf3aecb72e9530ebec3b27/setup.py | |
['config/blacklists/violence/urls.gz', 'config/blacklists/violence/domains.gz']), ('share/webcleaner/config/blacklists/warez', ['config/blacklists/warez/urls.gz', 'config/blacklists/warez/domains.gz']), | ['config/blacklists/violence/domains.gz']), | def create_batch_file(self, directory, data, filename): filename = os.path.join(directory, filename) # write the batch file util.execute(write_file, (filename, data), "creating %s" % filename, self.verbose>=1, self.dry_run) | afddd5dd8a0038b1afbf3aecb72e9530ebec3b27 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/afddd5dd8a0038b1afbf3aecb72e9530ebec3b27/setup.py |
i = src.find('.') | i = src.rfind('.') | def scan_start_tag (self, tag, attrs, htmlfilter): if tag=="input" and attrs.has_key('type'): # prevent IE crash bug on empty type attribute if not attrs['type']: warn(FILTER, "%s\n Detected and prevented IE <input type> crash bug", str(htmlfilter)) del attrs['type'] elif tag=="fieldset" and attrs.has_key('style'): # p... | 739a6c7412b347e19930646a0c5ace06b38dedbc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/739a6c7412b347e19930646a0c5ace06b38dedbc/HtmlSecurity.py |
if not scanner.infected and data: | buf = attrs['virus_buf'] if data: | def filter (self, data, **attrs): if not attrs.has_key('scanner'): return data scanner = attrs['scanner'] if not scanner.infected and data: scanner.scan(data) if not scanner.infected: return data for msg in scanner.infected: warn(FILTER, "Found virus %r in %r", msg, attrs['url']) return "" | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py |
if not scanner.infected: return data for msg in scanner.infected: warn(FILTER, "Found virus %r in %r", msg, attrs['url']) | buf.write(data) | def filter (self, data, **attrs): if not attrs.has_key('scanner'): return data scanner = attrs['scanner'] if not scanner.infected and data: scanner.scan(data) if not scanner.infected: return data for msg in scanner.infected: warn(FILTER, "Found virus %r in %r", msg, attrs['url']) return "" | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py |
if not scanner.infected and data: | buf = attrs['virus_buf'] if data: | def finish (self, data, **attrs): if not attrs.has_key('scanner'): return data scanner = attrs['scanner'] if not scanner.infected and data: scanner.scan(data) scanner.close() for msg in scanner.errors: warn(FILTER, "Virus scanner error %r", msg) if not scanner.infected: return data for msg in scanner.infected: warn(FIL... | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py |
d['scanner'] = ClamdScanner() | d['scanner'] = ClamdScanner(get_clamav_conf()) d['virus_buf'] = StringIO() | def getAttrs (self, url, headers): d = super(VirusFilter, self).getAttrs(url, headers) # weed out the rules that don't apply to this url rules = [ rule for rule in self.rules if rule.appliesTo(url) ] if not rules: return d d['scanner'] = ClamdScanner() return d | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py |
def __init__ (self): """initialize clamd daemon process connection""" | def __init__ (self, clamav_conf): """initialize clamd daemon process sockets""" | def __init__ (self): """initialize clamd daemon process connection""" self.infected = [] self.errors = [] self.sock, host = clamav_conf.new_connection() self.wsock = clamav_conf.new_scansock(self.sock, host) | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py |
self.sock, host = clamav_conf.new_connection() self.wsock = clamav_conf.new_scansock(self.sock, host) | self.clamav_conf = clamav_conf self.sock, host = self.clamav_conf.new_connection() self.wsock = self.clamav_conf.new_scansock(self.sock, host) | def __init__ (self): """initialize clamd daemon process connection""" self.infected = [] self.errors = [] self.sock, host = clamav_conf.new_connection() self.wsock = clamav_conf.new_scansock(self.sock, host) | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py |
"""scan given data for viruses, add results to infected and errors attributes""" | """scan given data for viruses""" | def scan (self, data): """scan given data for viruses, add results to infected and errors attributes""" self.wsock.sendall(data) data = self.sock.recv(RECV_BUFSIZE) while data: if "FOUND\n" in data: self.infected.append(data) if "ERROR\n" in data: self.errors.append(data) data = self.sock.recv(RECV_BUFSIZE) | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py |
def close (self): """close clamd daemon connection""" | def scan (self, data): """scan given data for viruses, add results to infected and errors attributes""" self.wsock.sendall(data) data = self.sock.recv(RECV_BUFSIZE) while data: if "FOUND\n" in data: self.infected.append(data) if "ERROR\n" in data: self.errors.append(data) data = self.sock.recv(RECV_BUFSIZE) | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py | |
clamav_conf = None | _clamav_conf = None | def close (self): """close clamd daemon connection""" self.sock.close() | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py |
global clamav_conf | global _clamav_conf | def init_clamav_conf (): global clamav_conf from wc import config clamav_conf = ClamavConfig(config['clamavconf']) | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py |
clamav_conf = ClamavConfig(config['clamavconf']) | _clamav_conf = ClamavConfig(config['clamavconf']) def get_clamav_conf (): return _clamav_conf | def init_clamav_conf (): global clamav_conf from wc import config clamav_conf = ClamavConfig(config['clamavconf']) | c1d07a5dae765cc144bb6ec68299de892bfde3ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c1d07a5dae765cc144bb6ec68299de892bfde3ff/VirusFilter.py |
warndate = split_quoted_string(warning) | warndate, warning = split_quoted_string(warning) | def parse_http_warning (warning): """ Grammar for a warning: Warning = "Warning" ":" 1#warning-value warning-value = warn-code SP warn-agent SP warn-text [SP warn-date] warn-code = 3DIGIT warn-agent = ( host [ ":" port ] ) | pseudonym ; the name or pseudonym of the server adding ; the Warning header, for use in deb... | d37315516802ca4f51749ab61aab4c86f0ed5afe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/d37315516802ca4f51749ab61aab4c86f0ed5afe/__init__.py |
the win_cross_compiling flag""" | the win_compiling flag""" | def cnormpath (path): """norm a path name to platform specific notation, but honoring the win_cross_compiling flag""" path = normpath(path) if win_cross_compiling: # replace slashes with backslashes path = path.replace("/", "\\") return path | 44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33/setup.py |
if win_cross_compiling: | if win_compiling: | def cnormpath (path): """norm a path name to platform specific notation, but honoring the win_cross_compiling flag""" path = normpath(path) if win_cross_compiling: # replace slashes with backslashes path = path.replace("/", "\\") return path | 44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33/setup.py |
if win_cross_compiling and d in win_path_scheme: | if win_compiling and d in win_path_scheme: | def run (self): super(MyInstall, self).run() # we have to write a configuration file because we need the # <install_data> directory (and other stuff like author, url, ...) data = [] for d in ['purelib', 'platlib', 'lib', 'headers', 'scripts', 'data']: attr = 'install_%s'%d if self.root: # cut off root path prefix cutof... | 44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33/setup.py |
oldpath = "/%s" % oldpath | oldpath = "%s%s" % (os.sep, oldpath) | def run (self): super(MyInstall, self).run() # we have to write a configuration file because we need the # <install_data> directory (and other stuff like author, url, ...) data = [] for d in ['purelib', 'platlib', 'lib', 'headers', 'scripts', 'data']: attr = 'install_%s'%d if self.root: # cut off root path prefix cutof... | 44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33/setup.py |
if (sys.platform != "win32" and not win_cross_compiling and | if (sys.platform != "win32" and not win_compiling and | def run (self): if (sys.platform != "win32" and not win_cross_compiling and (self.distribution.has_ext_modules() or self.distribution.has_c_libraries())): raise DistutilsPlatformError \ ("distribution contains extensions and/or C libraries; " "must be compiled on a Windows 32 platform") | 44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33/setup.py |
if win_cross_compiling: | if win_compiling: | def get_exe_bytes (self): if win_cross_compiling: # wininst.exe is in the same directory as bdist_wininst # XXX for python2.4, use wininst-X.Y.exe directory = os.path.dirname(distutils.command.__file__) filename = os.path.join(directory, "wininst.exe") return open(filename, "rb").read() return super(MyBdistWininst, sel... | 44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33/setup.py |
if win_cross_compiling: | if win_compiling: | def get_exe_bytes (self): if win_cross_compiling: # wininst.exe is in the same directory as bdist_wininst # XXX for python2.4, use wininst-X.Y.exe directory = os.path.dirname(distutils.command.__file__) filename = os.path.join(directory, "wininst.exe") return open(filename, "rb").read() return super(MyBdistWininst, sel... | 44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33/setup.py |
if os.name=='nt': extensions.append(Extension('wc.js.jslib', sources=['wc/js/jslib.c'], define_macros = [('WIN32', None), ('XP_WIN', None), ('EXPORT_JS_API', None)], include_dirs = include_dirs + ['libjs'], extra_compile_args = extra_compile_args, extra_objects = ['libjs/.libs/libjs.a'], library_dirs = library_dirs, ... | if win_compiling: define_macros = [('WIN32', None), ('XP_WIN', None), ('EXPORT_JS_API', None), ] | def get_exe_bytes (self): if win_cross_compiling: # wininst.exe is in the same directory as bdist_wininst # XXX for python2.4, use wininst-X.Y.exe directory = os.path.dirname(distutils.command.__file__) filename = os.path.join(directory, "wininst.exe") return open(filename, "rb").read() return super(MyBdistWininst, sel... | 44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33/setup.py |
if win_cross_compiling: define_macros = [('WIN32', None), ('XP_WIN', None), ('EXPORT_JS_API', None), ] else: define_macros = [] extensions.append(Extension('wc.js.jslib', sources=['wc/js/jslib.c'], include_dirs = include_dirs + ['libjs'], define_macros = define_macros, extra_compile_args = extra_compile_args, extra_obj... | define_macros = [] extensions.append(Extension('wc.js.jslib', sources=['wc/js/jslib.c'], include_dirs = include_dirs + ['libjs'], define_macros = define_macros, extra_compile_args = extra_compile_args, extra_objects = ['libjs/.libs/libjs.a'], library_dirs = library_dirs, libraries = libraries, )) | def get_exe_bytes (self): if win_cross_compiling: # wininst.exe is in the same directory as bdist_wininst # XXX for python2.4, use wininst-X.Y.exe directory = os.path.dirname(distutils.command.__file__) filename = os.path.join(directory, "wininst.exe") return open(filename, "rb").read() return super(MyBdistWininst, sel... | 44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33/setup.py |
if os.name=='nt' or win_cross_compiling: | if win_compiling: | def get_exe_bytes (self): if win_cross_compiling: # wininst.exe is in the same directory as bdist_wininst # XXX for python2.4, use wininst-X.Y.exe directory = os.path.dirname(distutils.command.__file__) filename = os.path.join(directory, "wininst.exe") return open(filename, "rb").read() return super(MyBdistWininst, sel... | 44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/44ccc6339c9b7b06a9beaa414a5ef9dd982bdb33/setup.py |
s += '\n '.join(asyncore.socket_map.values()) | s += '\n '.join(map(str, asyncore.socket_map.values())) | def text_status (): data = { 'uptime': format_seconds(time.time() - config['starttime']), 'valid': config['requests']['valid'], 'error': config['requests']['error'], 'blocked': config['requests']['blocked'], } s = STATUS_TEMPLATE % data s += '\n '.join(asyncore.socket_map.values()) s += ']\n\ndnscache: %s... | 751a0b59d658a7b7ad11b3f98d5c3fd31d4d64c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/751a0b59d658a7b7ad11b3f98d5c3fd31d4d64c5/__init__.py |
self._debug("self.outbuf %r", self.outbuf.getvalue()) self._debug("self.tagbuf %r", self.tagbuf) self._debug("self.waitbuf %r", self.waitbuf) self._debug("self.inbuf %r", self.inbuf.getvalue()) | debug(FILTER, "self.outbuf %r", self.outbuf.getvalue()) debug(FILTER, "self.tagbuf %r", self.tagbuf) debug(FILTER, "self.waitbuf %r", self.waitbuf) debug(FILTER, "self.inbuf %r", self.inbuf.getvalue()) | def _debugbuf (self): """print debugging information about data buffer status""" self._debug("self.outbuf %r", self.outbuf.getvalue()) self._debug("self.tagbuf %r", self.tagbuf) self._debug("self.waitbuf %r", self.waitbuf) self._debug("self.inbuf %r", self.inbuf.getvalue()) | 2fa8ed0461f00a71a3050e53a4866d6d407b1e52 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/2fa8ed0461f00a71a3050e53a4866d6d407b1e52/HtmlParser.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.