rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
info.append("Rule url query changed") | info.append(i18n._("Rule url query changed")) | def _form_rule_urlparts (form): scheme = getval(form, 'rule_urlscheme').strip() if scheme!=currule.scheme: currule.scheme = scheme info.append("Rule url scheme changed") host = getval(form, 'rule_urlhost').strip() if host!=currule.host: currule.host = host info.append("Rule url host changed") port = getval(form, 'rule_... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
info.append("Rule url fragment changed") | info.append(i18n._("Rule url fragment changed")) | def _form_rule_urlparts (form): scheme = getval(form, 'rule_urlscheme').strip() if scheme!=currule.scheme: currule.scheme = scheme info.append("Rule url scheme changed") host = getval(form, 'rule_urlhost').strip() if host!=currule.host: currule.host = host info.append("Rule url host changed") port = getval(form, 'rule_... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
info.append("Rule blocked url changed") | info.append(i18n._("Rule blocked url changed")) | def _form_apply_block (form): _form_rule_urlparts(form) url = getval(form, 'rule_blockedurl').strip() if url!=currule.url: currule.url = url info.append("Rule blocked url changed") | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
error.append("Empty header rule name") | error.append(i18n._("Empty header rule name")) | def _form_apply_header (form): _form_rule_matchurl(form) name = getval(form, 'rule_headername').strip() if not name: error.append("Empty header rule name") elif name!=currule.name: currule.name = name info.append("Rule header name changed") value = getval(form, 'rule_headervalue').strip() if value!=currule.value: curru... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
info.append("Rule header name changed") | info.append(i18n._("Rule header name changed")) | def _form_apply_header (form): _form_rule_matchurl(form) name = getval(form, 'rule_headername').strip() if not name: error.append("Empty header rule name") elif name!=currule.name: currule.name = name info.append("Rule header name changed") value = getval(form, 'rule_headervalue').strip() if value!=currule.value: curru... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
info.append("Rule header value changed") | info.append(i18n._("Rule header value changed")) | def _form_apply_header (form): _form_rule_matchurl(form) name = getval(form, 'rule_headername').strip() if not name: error.append("Empty header rule name") elif name!=currule.name: currule.name = name info.append("Rule header name changed") value = getval(form, 'rule_headervalue').strip() if value!=currule.value: curru... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
error.append("Invalid image width value") | error.append(i18n._("Invalid image width value")) | def _form_apply_image (form): _form_rule_matchurl(form) width = getval(form, 'rule_imgwidth').strip() try: width = int(width) except ValueError: error.append("Invalid image width value") return if width!=currule.width: currule.width = width info.append("Rule image width changed") height = getval(form, 'rule_imgheight')... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
info.append("Rule image width changed") | info.append(i18n._("Rule image width changed")) | def _form_apply_image (form): _form_rule_matchurl(form) width = getval(form, 'rule_imgwidth').strip() try: width = int(width) except ValueError: error.append("Invalid image width value") return if width!=currule.width: currule.width = width info.append("Rule image width changed") height = getval(form, 'rule_imgheight')... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
error.append("Invalid image height value") | error.append(i18n._("Invalid image height value")) | def _form_apply_image (form): _form_rule_matchurl(form) width = getval(form, 'rule_imgwidth').strip() try: width = int(width) except ValueError: error.append("Invalid image width value") return if width!=currule.width: currule.width = width info.append("Rule image width changed") height = getval(form, 'rule_imgheight')... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
info.append("Rule image height changed") | info.append(i18n._("Rule image height changed")) | def _form_apply_image (form): _form_rule_matchurl(form) width = getval(form, 'rule_imgwidth').strip() try: width = int(width) except ValueError: error.append("Invalid image width value") return if width!=currule.width: currule.width = width info.append("Rule image width changed") height = getval(form, 'rule_imgheight')... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
print "XXX apply pics" | for service in pics_services: if form.has_key("service_%s"%service): if not currule.ratings.has_key(service): currule.ratings[service] = {} for category in pics_categories[service]: currule.ratings[service][category] = 0 info.append(i18n._("PICS service %s enabled") % \ pics_data[service]['name']) else: if currule.rat... | def _form_apply_pics (form): _form_rule_matchurl(form) print "XXX apply pics" | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
info.append("Rule replace search changed") | info.append(i18n._("Rule replace search changed")) | def _form_apply_replace (form): _form_rule_matchurl(form) # note: do not strip() the search and replace form values search = getval(form, 'rule_search') if search!=currule.search: currule.search = search info.append("Rule replace search changed") replace = getval(form, 'rule_replace') if replace!=currule.replace: curru... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
info.append("Rule replacement changed") | info.append(i18n._("Rule replacement changed")) | def _form_apply_replace (form): _form_rule_matchurl(form) # note: do not strip() the search and replace form values search = getval(form, 'rule_search') if search!=currule.search: currule.search = search info.append("Rule replace search changed") replace = getval(form, 'rule_replace') if replace!=currule.replace: curru... | 9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py |
extra = self.persistent and "persistent " or "" | extra = "" if self.persistent: extra += "persistent " if self.server: extra += "server " | def __repr__ (self): """object representation""" extra = self.persistent and "persistent " or "" if self.request: try: extra += self.request.split()[1] except IndexError: extra += '???'+self.request else: extra += 'being read' return '<%s:%-8s %s>' % ('client', self.state, extra) | c655251e572c1483c9eddcf47154d37c9b2b2b3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c655251e572c1483c9eddcf47154d37c9b2b2b3f/HttpClient.py |
assert self.server, "%s server_content(%s) had no server" % \ | assert self.server, "%s server_content(%r) had no server" % \ | def server_content (self, data): """The server received some content. Write it to the client.""" assert self.server, "%s server_content(%s) had no server" % \ (self, data) if data: self.write(data) | c655251e572c1483c9eddcf47154d37c9b2b2b3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c655251e572c1483c9eddcf47154d37c9b2b2b3f/HttpClient.py |
super(HttpClient, self).handle_close() | def handle_close (self): """The client closed the connection, so cancel the server connection""" wc.log.debug(wc.LOG_PROXY, '%s handle_close', self) self.send_buffer = '' super(HttpClient, self).handle_close() if self.server: self.server.client_abort() self.server = None # If there isn't a server, then it's in the proc... | c655251e572c1483c9eddcf47154d37c9b2b2b3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c655251e572c1483c9eddcf47154d37c9b2b2b3f/HttpClient.py | |
self.headers['Host'] += "%s:%d\r"%(hostname, port) | self.headers['Host'] = "%s:%d\r"%(hostname, port) | def __init__ (self, client, request, headers, content, nofilter, compress, mime=None): self.client = client self.server = None self.request = request self.headers = headers self.compress = compress self.content = content self.nofilter = nofilter self.mime = mime debug(PROXY, "ClientServer: %s", `self.request`) self.met... | 140536392c8e5b764276cf8ac697eef3c0a0d619 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/140536392c8e5b764276cf8ac697eef3c0a0d619/ClientServerMatchmaker.py |
data = pickle.load(fp) | rating_cache = pickle.load(fp) | def rating_cache_load (): """load cached rating data from disk or return an empty cache if no cached data is found""" if os.path.isfile(rating_cachefile): fp = file(rating_cachefile) data = pickle.load(fp) fp.close() # remove invalid entries for url in data: if not is_valid_url(url): error(FILTER, "Invalid rating url %... | 7e8ebb1042a9a299bddc2caa164084fc236849d3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/7e8ebb1042a9a299bddc2caa164084fc236849d3/Rating.py |
for url in data: | toremove = [] for url in rating_cache: | def rating_cache_load (): """load cached rating data from disk or return an empty cache if no cached data is found""" if os.path.isfile(rating_cachefile): fp = file(rating_cachefile) data = pickle.load(fp) fp.close() # remove invalid entries for url in data: if not is_valid_url(url): error(FILTER, "Invalid rating url %... | 7e8ebb1042a9a299bddc2caa164084fc236849d3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/7e8ebb1042a9a299bddc2caa164084fc236849d3/Rating.py |
del data[url] return data return {} | toremove.append(url) if toremove: for url in toremove: del rating_cache[url] rating_cache_write() | def rating_cache_load (): """load cached rating data from disk or return an empty cache if no cached data is found""" if os.path.isfile(rating_cachefile): fp = file(rating_cachefile) data = pickle.load(fp) fp.close() # remove invalid entries for url in data: if not is_valid_url(url): error(FILTER, "Invalid rating url %... | 7e8ebb1042a9a299bddc2caa164084fc236849d3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/7e8ebb1042a9a299bddc2caa164084fc236849d3/Rating.py |
rating_cache = rating_cache_load() | rating_cache = {} rating_cache_load() | def rating_cache_load (): """load cached rating data from disk or return an empty cache if no cached data is found""" if os.path.isfile(rating_cachefile): fp = file(rating_cachefile) data = pickle.load(fp) fp.close() # remove invalid entries for url in data: if not is_valid_url(url): error(FILTER, "Invalid rating url %... | 7e8ebb1042a9a299bddc2caa164084fc236849d3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/7e8ebb1042a9a299bddc2caa164084fc236849d3/Rating.py |
_attrs = {} | _attrs = wc.containers.ListDict() | def dict_attrs (attrs): _attrs = {} for name in attrs.getQNames(): _attrs[name] = attrs.getValueByQName(name) return _attrs | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
self.prefixuri = {} self.uriprefix = {} | self.ns_current = [] self.ns_stack = [] | def __init__ (self, xmlrules, htmlrules, url, localhost): """ Init rules and buffers. """ # filter rules self.xmlrules = xmlrules self.htmlrules = htmlrules self.url = url # XML namespaces {name -> uri} and {uri -> name} self.prefixuri = {} self.uriprefix = {} # already filtered XML data self.outbuf = StringIO() self.t... | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
print "XXX setDocumentLocator", locator | print >>sys.stderr, "XXX setDocumentLocator", locator | def setDocumentLocator (self, locator): print "XXX setDocumentLocator", locator | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
self.prefixuri[prefix] = uri self.uriprefix[uri] = prefix | ns = (prefix, uri) self.ns_stack.append(ns) self.ns_current.append(ns) | def startPrefixMapping (self, prefix, uri): self.prefixuri[prefix] = uri self.uriprefix[uri] = prefix | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
if prefix in self.prefixuri: uri = self.prefixuri[prefix] del self.uriprefix[uri] del self.prefixuri[prefix] else: self.error("Removing unknown prefix mapping %r" % prefix) | if not self.ns_stack or self.ns_stack[-1][0] != prefix: self.error("Removing unknown prefix mapping (%r)" % prefix) del self.ns_stack[-1] def find_namespace (self, uri): for prefix, nsuri in reversed(self.ns_stack): if nsuri == uri: return (prefix, uri) return None | def endPrefixMapping (self, prefix): if prefix in self.prefixuri: uri = self.prefixuri[prefix] del self.uriprefix[uri] del self.prefixuri[prefix] else: self.error("Removing unknown prefix mapping %r" % prefix) | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
if not self.stack: for prefix, uri in self.prefixuri.items(): if prefix: attrs[u"xmlns:%s" % prefix] = uri else: attrs[u"xmlns"] = uri | for prefix, uri in self.ns_current: if prefix: attrs["xmlns:%s" % prefix] = uri else: attrs["xmlns"] = uri self.ns_current = [] | def startElement (self, name, attrs): attrs = dict_attrs(attrs) if not self.stack: for prefix, uri in self.prefixuri.items(): if prefix: attrs[u"xmlns:%s" % prefix] = uri else: attrs[u"xmlns"] = uri self.stack.append((wc.filter.xmlfilt.STARTTAG, name, attrs)) item = [wc.filter.xmlfilt.STARTTAG, name, attrs] self.tagbuf... | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
if name[0]: ns = self.uriprefix[name[0]] if ns: name = u"%s:%s" % (ns, name[1]) else: name = name[1] else: name = name[1] self.startElement(name, attrs) | tag = name[1] namespace = self.find_namespace(name[0]) if namespace and namespace[0]: tag = u"%s:%s" % (namespace[0], name[1]) self.startElement(tag, attrs) | def startElementNS (self, name, qname, attrs): if name[0]: ns = self.uriprefix[name[0]] if ns: name = u"%s:%s" % (ns, name[1]) else: name = name[1] else: name = name[1] self.startElement(name, attrs) | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
if name[0]: ns = self.uriprefix[name[0]] if ns: name = u"%s:%s" % (ns, name[1]) else: name = name[1] else: name = name[1] self.endElement(name) | tag = name[1] namespace = self.find_namespace(name[0]) if namespace and namespace[0]: tag = u"%s:%s" % (namespace[0], name[1]) self.endElement(tag) | def endElementNS (self, name, qname): if name[0]: ns = self.uriprefix[name[0]] if ns: name = u"%s:%s" % (ns, name[1]) else: name = name[1] else: name = name[1] self.endElement(name) | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
print "XXX skippedEntity", name | print >>sys.stderr, "XXX skippedEntity", name | def skippedEntity (self, name): print "XXX skippedEntity", name | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
print "XXX notationDecl", name, publicId, systemId | print >>sys.stderr, "XXX notationDecl", name, publicId, systemId | def notationDecl (self, name, publicId, systemId): print "XXX notationDecl", name, publicId, systemId | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
print "XXX unparsedEntityDecl", name, publicId, systemId, ndata | print >>sys.stderr, "XXX unparsedEntityDecl", name, publicId, systemId, ndata | def unparsedEntityDecl (self, name, publicId, systemId, ndata): print "XXX unparsedEntityDecl", name, publicId, systemId, ndata | 857bd7fe261ab64e4383a47818282d5ebf04d521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/857bd7fe261ab64e4383a47818282d5ebf04d521/XmlFilter.py |
if not path: | if not path or path=='/': | def norm_url (url): """replace empty paths with / and normalize them""" urlparts = list(urlparse.urlparse(url)) path = urlparts[2] if not path: urlparts[2] = '/' else: # XXX only windows and posix?? # collapse redundant path segments urlparts[2] = os.path.normpath(path).replace('\\', '/') if path.endswith('/'): urlpart... | c3741560c4d8e9a1e9ed66791ebf54daf97a8304 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c3741560c4d8e9a1e9ed66791ebf54daf97a8304/__init__.py |
if not self.mimelist: return True | def applies_to_mime (self, mime): if mime is None: return False if not self.mimelist: return True for ro in self.mimelist: if ro.match(mime): return True return False | a7dbef7ad9d066cf9150c0fe2e5334acbc8da6a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a7dbef7ad9d066cf9150c0fe2e5334acbc8da6a1/Filter.py | |
import profile, wc | import profile | def _main (): """USAGE: test/run.sh test/pconfig.py""" from test import initlog initlog("test/logging.conf") import profile, wc profile.run("config = wc.Configuration()", "filter.prof") | 1ac3c917328f6ecd7569d4d170f8caa9d98bb786 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1ac3c917328f6ecd7569d4d170f8caa9d98bb786/pconfig.py |
os.makedirs(os.path.dirname("downloads/"+target)) | d = os.path.dirname("downloads/"+target) if not os.path.isdir(d): os.makedirs(d) | def geturl (basedir, file, fun, saveas=None): if saveas is not None: target = saveas else: target = file if os.path.exists("downloads/"+target): print "downloads/%s already exists"%target else: print "downloading", basedir+file os.makedirs(os.path.dirname("downloads/"+target)) urldata = urllib2.urlopen(basedir+file) f ... | 60d821f8ef04bd2a2d54c47e96ab940718ee837e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/60d821f8ef04bd2a2d54c47e96ab940718ee837e/bl2wc.py |
def download_and_merge (): """Download all available filters and merge them""" # remove old files if not os.path.isdir("downloads"): os.mkdir("downloads") # from Pl Baltzersen and Lars Erik Hland (Squidguard guys) geturl("ftp://ftp.teledanmark.no/pub/www/proxy/squidGuard/contrib/", "blacklists.tar.gz", blacklist) # fro... | 60d821f8ef04bd2a2d54c47e96ab940718ee837e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/60d821f8ef04bd2a2d54c47e96ab940718ee837e/bl2wc.py | ||
print "remove old data..." | print "remove old extracted data..." | def remove_old_data (): print "remove old data..." for d in ("extracted", "config/blacklists_new"): if os.path.isdir(d): rm_rf(d) | 60d821f8ef04bd2a2d54c47e96ab940718ee837e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/60d821f8ef04bd2a2d54c47e96ab940718ee837e/bl2wc.py |
print "read data..." read_blacklists("config/blacklists") | def remove_old_data (): print "remove old data..." for d in ("extracted", "config/blacklists_new"): if os.path.isdir(d): rm_rf(d) | 60d821f8ef04bd2a2d54c47e96ab940718ee837e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/60d821f8ef04bd2a2d54c47e96ab940718ee837e/bl2wc.py | |
auth = ",".join(creds['NTLM'][0]) | attrs = { 'host': creds['NTLM'][0]['host'], 'domain': creds['NTLM'][0]['domain'], 'type': NTLMSSP_CHALLENGE, } auth = ",".join(get_challenges(**attrs)) | def process_headers (self): """read and filter client request headers""" # Two newlines ends headers i = self.recv_buffer.find('\r\n\r\n') if i < 0: return i += 4 # Skip over newline terminator # the first 2 chars are the newline of request fp = StringIO(self.read(i)[2:]) msg = WcMessage(fp) # put unparsed data (if any... | bd57a71e39bdc45616b60f85eb4436633616e9f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/bd57a71e39bdc45616b60f85eb4436633616e9f6/HttpClient.py |
raise RatingParseError("Invalid rating url %s." % repr(url)) | raise wc.filter.rating.RatingParseError( "Invalid rating url %s." % repr(url)) | def check_url (self, url): if not wc.url.is_safe_url(url): raise RatingParseError("Invalid rating url %s." % repr(url)) | c16007cebba66e664dc7c8f5ce082b318acf3e04 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/c16007cebba66e664dc7c8f5ce082b318acf3e04/__init__.py |
self.ratings = [] | self.ratings = {} for category in wc.filter.rating.categories: self.ratings[category.name] = None | def __init__ (self, sid=None, titles=None, descriptions=None, disable=0, matchurls=None, nomatchurls=None): super(RatingRule, self).__init__(sid=sid, titles=titles, descriptions=descriptions, disable=disable, matchurls=matchurls, nomatchurls=nomatchurls) # list of RuleRating objects self.ratings = [] self.url = "" | 74071104b3b4ec9e2f6f86e5670b15b0cd8256aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/74071104b3b4ec9e2f6f86e5670b15b0cd8256aa/RatingRule.py |
self.ratings.append((self._category, self._data)) | self.ratings[self._category] = self._data | def end_data (self, name): super(RatingRule, self).end_data(name) if name == 'category': assert self._category self.ratings.append((self._category, self._data)) pass elif name == 'url': self.url = self._data | 74071104b3b4ec9e2f6f86e5670b15b0cd8256aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/74071104b3b4ec9e2f6f86e5670b15b0cd8256aa/RatingRule.py |
if mime is not None and not attrs['mime'].startswith(mime): | origmime = attrs['mime'] if mime is not None and origmime is not None and \ not origmime.startswith(mime): | def recognize (self, buf, attrs): # note: recognizing a mime type fixes exploits like # CVE-2002-0025 and CVE-2002-0024 wc.log.debug(wc.LOG_FILTER, "MIME recognize %d bytes of data", buf.tell()) try: mime = wc.magic.classify(buf) wc.log.debug(wc.LOG_FILTER, "MIME recognized %r", mime) if mime is not None and not attrs[... | bffc3d94a89ba5dab90f82581015bc299bcb8c9a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/bffc3d94a89ba5dab90f82581015bc299bcb8c9a/MimeRecognizer.py |
attrs['mime'], mime, attrs['url']) | origmime, mime, attrs['url']) | def recognize (self, buf, attrs): # note: recognizing a mime type fixes exploits like # CVE-2002-0025 and CVE-2002-0024 wc.log.debug(wc.LOG_FILTER, "MIME recognize %d bytes of data", buf.tell()) try: mime = wc.magic.classify(buf) wc.log.debug(wc.LOG_FILTER, "MIME recognized %r", mime) if mime is not None and not attrs[... | bffc3d94a89ba5dab90f82581015bc299bcb8c9a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/bffc3d94a89ba5dab90f82581015bc299bcb8c9a/MimeRecognizer.py |
self['noproxyfor'] = [{}, [], {}] self['allowedhosts'] = [{}, [], {}] | self['noproxyfor'] = None self['allowedhosts'] = None | def reset (self): """Reset to default values""" self['port'] = 8080 self['proxyuser'] = "" self['proxypass'] = "" self['parentproxy'] = "" self['parentproxyport'] = 3128 self['parentproxyuser'] = "" self['parentproxypass'] = "" self['logfile'] = "" self['strict_whitelist'] = 0 self['debuglevel'] = 0 self['rules'] = [] ... | debb93f19cf19cd5dab31f1908adbf5719ed3aff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/debb93f19cf19cd5dab31f1908adbf5719ed3aff/__init__.py |
if self.config['noproxyfor']: | if self.config['noproxyfor'] is not None: | def start_element (self, name, attrs): if name=='webcleaner': for key,val in attrs.items(): self.config[str(key)] = unxmlify(val) for key in ('port','parentproxyport', 'debuglevel','colorize','showerrors', 'strict_whitelist'): self.config[key] = int(self.config[key]) for key in ('version', 'parentproxy', 'logfile', 'pr... | debb93f19cf19cd5dab31f1908adbf5719ed3aff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/debb93f19cf19cd5dab31f1908adbf5719ed3aff/__init__.py |
if self.config['allowedhosts']: | else: self.config['noproxyfor'] = [{}, [], {}] if self.config['allowedhosts'] is not None: | def start_element (self, name, attrs): if name=='webcleaner': for key,val in attrs.items(): self.config[str(key)] = unxmlify(val) for key in ('port','parentproxyport', 'debuglevel','colorize','showerrors', 'strict_whitelist'): self.config[key] = int(self.config[key]) for key in ('version', 'parentproxy', 'logfile', 'pr... | debb93f19cf19cd5dab31f1908adbf5719ed3aff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/debb93f19cf19cd5dab31f1908adbf5719ed3aff/__init__.py |
if not attrs.has_key('buffer') or attrs['buffer'].closed: | if not attrs.has_key('buffer'): return data if attrs['blocked']: return '' if attrs['buffer'].closed: | def filter (self, data, **attrs): if not attrs.has_key('buffer') or attrs['buffer'].closed: # we do not block this image # or we do not have enough buffer data yet return data buf = attrs['buffer'] buf.write(data) if buf.tell() > self.min_bufsize: if self.check_sizes(buf, attrs['sizes']): # size is ok data = buf.getval... | 72714c58e80b29c39b013302bb6cfbff331129c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/72714c58e80b29c39b013302bb6cfbff331129c8/ImageSize.py |
if self.check_sizes(buf, attrs['sizes']): data = buf.getvalue() buf.close() return data | attrs['blocked'] = not self.check_sizes(buf, attrs['sizes'], attrs['url']) data = buf.getvalue() buf.close() if attrs['blocked']: return self.blockdata return data | def filter (self, data, **attrs): if not attrs.has_key('buffer') or attrs['buffer'].closed: # we do not block this image # or we do not have enough buffer data yet return data buf = attrs['buffer'] buf.write(data) if buf.tell() > self.min_bufsize: if self.check_sizes(buf, attrs['sizes']): # size is ok data = buf.getval... | 72714c58e80b29c39b013302bb6cfbff331129c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/72714c58e80b29c39b013302bb6cfbff331129c8/ImageSize.py |
if not attrs.has_key('buffer') or attrs['buffer'].closed: | if not attrs.has_key('buffer'): return data if attrs['blocked']: return '' if attrs['buffer'].closed: | def finish (self, data, **attrs): if not attrs.has_key('buffer') or attrs['buffer'].closed: # we do not block this image return data buf = attrs['buffer'] buf.write(data) if self.check_sizes(buf, attrs['sizes']): # size is ok data = buf.getvalue() buf.close() return data return '' | 72714c58e80b29c39b013302bb6cfbff331129c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/72714c58e80b29c39b013302bb6cfbff331129c8/ImageSize.py |
if self.check_sizes(buf, attrs['sizes']): data = buf.getvalue() buf.close() return data return '' | attrs['blocked'] = not self.check_sizes(buf, attrs['sizes'], attrs['url']) data = buf.getvalue() buf.close() if attrs['blocked']: return self.blockdata return data | def finish (self, data, **attrs): if not attrs.has_key('buffer') or attrs['buffer'].closed: # we do not block this image return data buf = attrs['buffer'] buf.write(data) if self.check_sizes(buf, attrs['sizes']): # size is ok data = buf.getvalue() buf.close() return data return '' | 72714c58e80b29c39b013302bb6cfbff331129c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/72714c58e80b29c39b013302bb6cfbff331129c8/ImageSize.py |
def check_sizes (self, buf, sizes): | def check_sizes (self, buf, sizes, url): | def check_sizes (self, buf, sizes): try: buf.seek(0) img = Image.open(buf, 'r') for size, formats in sizes: if size==img.size: # size matches, look for format restriction if not formats: return False elif img.format.lower() in formats: return False except IOError: exception(FILTER, "Could not get image size") return Tr... | 72714c58e80b29c39b013302bb6cfbff331129c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/72714c58e80b29c39b013302bb6cfbff331129c8/ImageSize.py |
exception(FILTER, "Could not get image size") | exception(FILTER, "Could not get image size from %s", url) | def check_sizes (self, buf, sizes): try: buf.seek(0) img = Image.open(buf, 'r') for size, formats in sizes: if size==img.size: # size matches, look for format restriction if not formats: return False elif img.format.lower() in formats: return False except IOError: exception(FILTER, "Could not get image size") return Tr... | 72714c58e80b29c39b013302bb6cfbff331129c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/72714c58e80b29c39b013302bb6cfbff331129c8/ImageSize.py |
replace = re.sub(r"\$(\d)", r"\\1", replace) | replace = re.sub(r"\${?(\d)}?", r"\\\1", replace) | def convert_adzapper_replace (replace): # replace Perl back references with Python ones replace = re.sub(r"\$(\d)", r"\\1", replace) return replace | cb2de53ccf7be4fdcca417a1378aa5d6b82bfeb5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/cb2de53ccf7be4fdcca417a1378aa5d6b82bfeb5/adzap2wc.py |
wc.log.info(wc.LOG_PROXY, '%s connect timed out', self) | wc.log.debug(wc.LOG_PROXY, '%s connect timed out', self) | def check_connect (self, addr): """ Check if the connection is etablished. See also http://cr.yp.to/docs/connect.html and connect(2) manpage. """ wc.log.debug(wc.LOG_PROXY, '%s check connect', self) self.connect_checks += 1 if self.connect_checks >= 50: wc.log.info(wc.LOG_PROXY, '%s connect timed out', self) self.handl... | 6b697860f21470721bdef592b80b16057859fbe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/6b697860f21470721bdef592b80b16057859fbe3/Dispatcher.py |
os.system('invoke-rc.d webcleaner start') | from wc import daemon daemon.start(parent_exit=0) | def onCmdProxyStart (self, sender, sel, ptr): os.system('invoke-rc.d webcleaner start') debug(GUI, "webcleaner start") return 1 | 34a16f60bd5fc16a4e6a0a8726e745436071942b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/34a16f60bd5fc16a4e6a0a8726e745436071942b/ConfWindow.py |
os.system('invoke-rc.d webcleaner stop') | from wc import daemon daemon.stop() | def onCmdProxyStop (self, sender, sel, ptr): os.system('invoke-rc.d webcleaner stop') debug(GUI, "webcleaner stop") return 1 | 34a16f60bd5fc16a4e6a0a8726e745436071942b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/34a16f60bd5fc16a4e6a0a8726e745436071942b/ConfWindow.py |
os.system('invoke-rc.d webcleaner restart') | from wc import daemon daemon.restart(parent_exit=0) | def onCmdProxyRestart (self, sender, sel, ptr): os.system('invoke-rc.d webcleaner restart') debug(GUI, "webcleaner restart") return 1 | 34a16f60bd5fc16a4e6a0a8726e745436071942b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/34a16f60bd5fc16a4e6a0a8726e745436071942b/ConfWindow.py |
os.system('invoke-rc.d webcleaner reload') | from wc import daemon daemon.reload() | def onCmdProxyReload (self, sender, sel, ptr): os.system('invoke-rc.d webcleaner reload') debug(GUI, "webcleaner reload") return 1 | 34a16f60bd5fc16a4e6a0a8726e745436071942b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/34a16f60bd5fc16a4e6a0a8726e745436071942b/ConfWindow.py |
self.assertEqual(rating_range("1"), None) | def test_rating_range (self): """ Test range parsing. """ # rating_range (range) rating_range = wc.filter.rating.category.intrange_from_string self.assertEqual(rating_range(""), (None, None)) self.assertEqual(rating_range("-"), (None, None)) self.assertEqual(rating_range("1"), (1, None)) self.assertEqual(rating_range("... | 8e5e096ddbd68d7224e626a98927d7b6a9ee4e01 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/8e5e096ddbd68d7224e626a98927d7b6a9ee4e01/test_rating.py | |
self.js_script = '' | self.js_script = u'' | def __init__ (self, url, opts): # True if javascript has to be filtered self.javascript = opts['javascript'] self.level = opts.get('level', 0) self.comments = opts['comments'] self.url = url or "unknown" self.js_src = False self.js_script = '' # HttpProxyClient object used in background downloads, # has self.jsScriptDa... | b1dda6c5bb0d6477a864e1272a9bb9f4dbc578bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b1dda6c5bb0d6477a864e1272a9bb9f4dbc578bd/JSFilter.py |
data = self.js_htmlparser.getoutput() | data = unicode(self.js_htmlparser.getoutput()) | def js_end_script (self, item): """</script> was encountered""" wc.log.debug(wc.LOG_JS, "%s js_end_script %s", self, item) self.htmlparser.debugbuf(wc.LOG_JS) if len(self.htmlparser.tagbuf) < 2: assert False, "parser %s must have script start and content " \ "tags in tag buffer" % self.htmlparser if self.js_output: try... | b1dda6c5bb0d6477a864e1272a9bb9f4dbc578bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b1dda6c5bb0d6477a864e1272a9bb9f4dbc578bd/JSFilter.py |
"\n<!--\n%s\n//-->\n" % wc.js.escape_js(script) | u"\n<!--\n%s\n//-->\n" % wc.js.escape_js(script) | def js_end_element (self, item): """parse generated html for scripts""" wc.log.debug(wc.LOG_JS, "%s js_end_element buf %r", self, self.htmlparser.tagbuf) if len(self.htmlparser.tagbuf)<2: # syntax error, ignore wc.log.warn(wc.LOG_JS, "JS syntax error, self.tagbuf %r", self.htmlparser.tagbuf) return if self.js_src: wc.l... | b1dda6c5bb0d6477a864e1272a9bb9f4dbc578bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b1dda6c5bb0d6477a864e1272a9bb9f4dbc578bd/JSFilter.py |
[wc.filter.rules.RewriteRule.ENDTAG, "script"]) | [wc.filter.rules.RewriteRule.ENDTAG, u"script"]) | def jsScriptData (self, data, url, ver): """Callback for loading <script src=""> data in the background If downloading is finished, data is None""" assert self.htmlparser.state[0] == 'wait', "non-wait state" wc.log.debug(wc.LOG_JS, "%s jsScriptData %r", self, data) if data is None: if not self.js_script: wc.log.warn(wc... | b1dda6c5bb0d6477a864e1272a9bb9f4dbc578bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b1dda6c5bb0d6477a864e1272a9bb9f4dbc578bd/JSFilter.py |
self.connected = False make_timer(secs, self.set_readable) def set_readable (self): self.connected = True | oldstate, self.state = self.state, 'client' make_timer(secs, lambda: self.set_readable(oldstate)) def set_readable (self, state): self.state = state | def set_unreadable (self, secs): self.connected = False make_timer(secs, self.set_readable) | a9c024aeb6ca3f50e5f1bc772b7942c7d2b134e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a9c024aeb6ca3f50e5f1bc772b7942c7d2b134e6/HttpServer.py |
""" Return the line number of s[index]. Lines are assumed to be separated by the ASCII character '\\n'. | r""" Return the line number of s[index] or zero on errors. Lines are assumed to be separated by the ASCII character '\n'. | def get_line_number (s, index): """ Return the line number of s[index]. Lines are assumed to be separated by the ASCII character '\\n'. """ i = 0 if index < 0: index = 0 line = 1 while i < index: if s[i] == '\n': line += 1 i += 1 return line | 6a7182b694d0cd19ace64929bd8408e6fb5ec8b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/6a7182b694d0cd19ace64929bd8408e6fb5ec8b3/strformat.py |
index = 0 | return 0 | def get_line_number (s, index): """ Return the line number of s[index]. Lines are assumed to be separated by the ASCII character '\\n'. """ i = 0 if index < 0: index = 0 line = 1 while i < index: if s[i] == '\n': line += 1 i += 1 return line | 6a7182b694d0cd19ace64929bd8408e6fb5ec8b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/6a7182b694d0cd19ace64929bd8408e6fb5ec8b3/strformat.py |
return u"%.2f GB" | return u"%.2f GB" % b | def strsize (b): """ Return human representation of bytes b. A negative number of bytes raises a value error. """ if b < 0: raise ValueError("Invalid negative byte number") if b == 1: return u"%d Byte" % b if b < 1024: return u"%d Bytes" % b b /= 1024.0 if b < 1024: return u"%.2f kB" % b b /= 1024.0 if b < 1024: return... | 6a7182b694d0cd19ace64929bd8408e6fb5ec8b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/6a7182b694d0cd19ace64929bd8408e6fb5ec8b3/strformat.py |
if duration > 60: duration = duration / 60 | if duration >= 60: duration /= 60 | def strduration (duration): """ Return translated and formatted time duration. """ name = _("seconds") if duration > 60: duration = duration / 60 name = _("minutes") if duration > 60: duration = duration / 60 name = _("hours") return u" %.3f %s" % (duration, name) | 6a7182b694d0cd19ace64929bd8408e6fb5ec8b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/6a7182b694d0cd19ace64929bd8408e6fb5ec8b3/strformat.py |
if duration > 60: duration = duration / 60 | if duration >= 60: duration /= 60 | def strduration (duration): """ Return translated and formatted time duration. """ name = _("seconds") if duration > 60: duration = duration / 60 name = _("minutes") if duration > 60: duration = duration / 60 name = _("hours") return u" %.3f %s" % (duration, name) | 6a7182b694d0cd19ace64929bd8408e6fb5ec8b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/6a7182b694d0cd19ace64929bd8408e6fb5ec8b3/strformat.py |
return u" %.3f %s" % (duration, name) | return u"%.3f %s" % (duration, name) | def strduration (duration): """ Return translated and formatted time duration. """ name = _("seconds") if duration > 60: duration = duration / 60 name = _("minutes") if duration > 60: duration = duration / 60 name = _("hours") return u" %.3f %s" % (duration, name) | 6a7182b694d0cd19ace64929bd8408e6fb5ec8b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/6a7182b694d0cd19ace64929bd8408e6fb5ec8b3/strformat.py |
def get_exe_bytes (self): if win_cross_compiling: bv = "7.1" directory = os.path.dirname(distutils.command.__file__) filename = os.path.join(directory, "wininst-%s.exe" % bv) return open(filename, "rb").read() return super(MyBdistWininst, self).get_exe_bytes() | 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") | 8cbd1610653b77a702d0f8dbe7117e465feccf29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/8cbd1610653b77a702d0f8dbe7117e465feccf29/setup.py | |
libraries.append("python%d.%d" % tuple(sys.version_info[0:2])) | libraries.append("python%s" % get_python_version()) | 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") | 8cbd1610653b77a702d0f8dbe7117e465feccf29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/8cbd1610653b77a702d0f8dbe7117e465feccf29/setup.py |
if service in blurb: | if blurb.find(service) != -1: | def check_pics (rule, labellist): """parse and check pics labels according to given PicsRule return None if no rating is exceeded return non-empty match message if some rating exceeds the configured rating level """ last = 0 for mo in ratings(labellist): rating = mo.group('rating') debug(NIGHTMARE, "PICS rating", ratin... | 1516e6655fe9b5bb49225eb1f12a9288177c4bb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1516e6655fe9b5bb49225eb1f12a9288177c4bb0/PICS.py |
sdata['name'], rule.options[service]) | sdata['name'], rule.ratings[service]) | def check_pics (rule, labellist): """parse and check pics labels according to given PicsRule return None if no rating is exceeded return non-empty match message if some rating exceeds the configured rating level """ last = 0 for mo in ratings(labellist): rating = mo.group('rating') debug(NIGHTMARE, "PICS rating", ratin... | 1516e6655fe9b5bb49225eb1f12a9288177c4bb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1516e6655fe9b5bb49225eb1f12a9288177c4bb0/PICS.py |
for category, value in options: | for category, value in options.items(): | def check_service (rating, categories, name, options): """find given categories in rating and compare the according option value with the rating value. If one of the ratings exceed its option value, return a non-empty message, else return None. """ for category, value in options: category_label = categories[category] m... | 1516e6655fe9b5bb49225eb1f12a9288177c4bb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1516e6655fe9b5bb49225eb1f12a9288177c4bb0/PICS.py |
def check_pics_option (rating, category_label, option, category) { | def check_pics_option (rating, category_label, option, category): | def check_pics_option (rating, category_label, option, category) { """find the given label in rating and compare the value with option. If the rating exceeds the option, a non-empty message is returned, else None""" mo = re.search(r'%s\s+(?P<val>\d+)'%category_label, rating) if not mo: # label not found return None # g... | 1516e6655fe9b5bb49225eb1f12a9288177c4bb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1516e6655fe9b5bb49225eb1f12a9288177c4bb0/PICS.py |
class MyInstall (install): | class MyInstall (install, object): | def p (path): """norm a path name to platform specific notation""" return os.path.normpath(path) | f4449716a250bb47d6d865c0f80d2ced279bbd0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/f4449716a250bb47d6d865c0f80d2ced279bbd0a/setup.py |
if os.name=="nt": self.install_nt_service() def state_nt_service (self, name): import win32serviceutil return win32serviceutil.QueryServiceStatus(name)[1] def install_nt_service (self): from wc import win32start, AppName, Configuration import win32serviceutil oldargs = sys.argv sys.argv = ['webcleaner', 'install'... | 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 val =... | f4449716a250bb47d6d865c0f80d2ced279bbd0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/f4449716a250bb47d6d865c0f80d2ced279bbd0a/setup.py | |
scripts = ['webcleaner'], | scripts = scripts, | 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) | f4449716a250bb47d6d865c0f80d2ced279bbd0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/f4449716a250bb47d6d865c0f80d2ced279bbd0a/setup.py |
self.assertEqual(data, unchunker.decode(s)) | self.assertEqual(data, unchunker.process(s)) | def testUnchunk (self): unchunker = wc.proxy.decoder.UnchunkStream.UnchunkStream() data = "a"*0x30 s = "000000000030\r\n%s\r\n0\r\n\r\n" % data self.assertEqual(data, unchunker.decode(s)) | 48c8a31670cffbae884c5c1ce662c851ad249fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/48c8a31670cffbae884c5c1ce662c851ad249fb9/test_unchunk.py |
if _rating_delete(url): | try: del rating_store[url] rating_store.write() | def _form_delete (): global url if _rating_delete(url): info['ratingdeleted'] = True else: error['ratingdeleted'] = True | ed0cb748778a86c3afc9c838eeebee993fcf208d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/ed0cb748778a86c3afc9c838eeebee993fcf208d/rating_html.py |
else: | except: | def _form_delete (): global url if _rating_delete(url): info['ratingdeleted'] = True else: error['ratingdeleted'] = True | ed0cb748778a86c3afc9c838eeebee993fcf208d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/ed0cb748778a86c3afc9c838eeebee993fcf208d/rating_html.py |
generic = form.has_key('generic'): | generic = form.has_key('generic') | def _form_generic (form): """Check generic validity""" global generic generic = form.has_key('generic'): return True | 961cc704e12d7a79f53cb3e7e34f814d6004bc34 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/961cc704e12d7a79f53cb3e7e34f814d6004bc34/rating_html.py |
self._key = _winreg.OpenKey(key, sub_key) | self._key = OpenKey(key, sub_key) | def __init__ (self, key, sub_key): self._key = _winreg.OpenKey(key, sub_key) self.closed = False | 904d09594ad9da039c218c4b0c554983804ecbe9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/904d09594ad9da039c218c4b0c554983804ecbe9/winreg.py |
val = _winreg.QueryValueEx(self._key, key) | val = QueryValueEx(self._key, key) | def __getitem__ (self, key): if type(key) != StringType: raise TypeError, "key type must be string" try: val = _winreg.QueryValueEx(self._key, key) except WindowsError: raise IndexError, "subkey %s not found"%key return val[0] | 904d09594ad9da039c218c4b0c554983804ecbe9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/904d09594ad9da039c218c4b0c554983804ecbe9/winreg.py |
keys.append(key_handle(self._key, _winreg.EnumKey(self._key, i))) | keys.append(key_handle(self._key, EnumKey(self._key, i))) | def subkeys (self): """get the list of subkeys as key_handle objects""" i = 0 keys = [] while 1: try: #print repr(EnumKey(self._key, i)) keys.append(key_handle(self._key, _winreg.EnumKey(self._key, i))) except EnvironmentError: break i += 1 return keys | 904d09594ad9da039c218c4b0c554983804ecbe9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/904d09594ad9da039c218c4b0c554983804ecbe9/winreg.py |
return _winreg.QueryInfoKey(self._key)[0] | return QueryInfoKey(self._key)[0] | def __len__ (self): return _winreg.QueryInfoKey(self._key)[0] | 904d09594ad9da039c218c4b0c554983804ecbe9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/904d09594ad9da039c218c4b0c554983804ecbe9/winreg.py |
_winreg.SetValueEx(self._key, key, value[0], value[1]) | SetValueEx(self._key, key, value[0], value[1]) | def __setitem__ (self, key, value): """Set a registry key value. key is the key name, value is a tuple (type, val). For available types see the _winreg module documentation.""" key = self.__getitem__(key) _winreg.SetValueEx(self._key, key, value[0], value[1]) | 904d09594ad9da039c218c4b0c554983804ecbe9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/904d09594ad9da039c218c4b0c554983804ecbe9/winreg.py |
_winreg.CloseKey(self._key) | CloseKey(self._key) | def close (self): _winreg.CloseKey(self._key) self.closed = True | 904d09594ad9da039c218c4b0c554983804ecbe9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/904d09594ad9da039c218c4b0c554983804ecbe9/winreg.py |
FXButton(f, i18n._("Add\tAdd hostname and networks that are not filtered.\nNetworks can be either in a.b.d.c/n or a.b.c.d/e.f.g.h format."), None, self, ConfWindow.ID_NOPROXYFOR_ADD) FXButton(f, i18n._("Edit"), None, self, ConfWindow.ID_NOPROXYFOR_EDIT) FXButton(f, i18n._("Remove"), None, self, ConfWindow.ID_NOPROXYFOR... | FXButton(f, i18n._("Add\tAdd hostname and networks that are not filtered.\nNetworks can be either in a.b.d.c/n or a.b.c.d/e.f.g.h format."), None, self, ConfWindow.ID_NOFILTERHOSTS_ADD) FXButton(f, i18n._("Edit"), None, self, ConfWindow.ID_NOFILTERHOSTS_EDIT) FXButton(f, i18n._("Remove"), None, self, ConfWindow.ID_NOFI... | def proxySettings (self, tabbook): """generate the proxy setting tab""" FXTabItem(tabbook, i18n._("P&roxy Settings"), None) proxy = FXVerticalFrame(tabbook, FRAME_THICK|FRAME_RAISED) proxy_top = FXHorizontalFrame(proxy, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_SIDE_TOP) | 51e89f1b5e55281c10087ddcb6212bfe31fdd6fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/51e89f1b5e55281c10087ddcb6212bfe31fdd6fd/ConfWindow.py |
def onUpdFilterHosts (self, sender, sel, ptr): | def onUpdNoFilterHosts (self, sender, sel, ptr): | def onUpdFilterHosts (self, sender, sel, ptr): i = self.nofilterlist.getCurrentItem() if i<0: sender.disable() elif self.nofilterlist.isItemSelected(i): sender.enable() else: sender.disable() return 1 | 51e89f1b5e55281c10087ddcb6212bfe31fdd6fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/51e89f1b5e55281c10087ddcb6212bfe31fdd6fd/ConfWindow.py |
self.nofilterhosts = ip.strhosts2map(self.nofilterhosts) self.allowedhosts = ip.strhosts2map(self.allowedhosts) | self.nofilterhosts = ip.map2hosts(self.nofilterhosts) self.allowedhosts = ip.map2hosts(self.allowedhosts) | def readconfig (self): """read the configuration from disc""" debug(GUI, "reading config") self.config = Configuration() for key in ['version','port','parentproxy','parentproxyport', | 51e89f1b5e55281c10087ddcb6212bfe31fdd6fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/51e89f1b5e55281c10087ddcb6212bfe31fdd6fd/ConfWindow.py |
hosts = sort_seq(ip.map2hosts(self.nofilterhosts)) | hosts = sort_seq(self.nofilterhosts) | def toxml (self): s = """<?xml version="1.0"?> | 51e89f1b5e55281c10087ddcb6212bfe31fdd6fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/51e89f1b5e55281c10087ddcb6212bfe31fdd6fd/ConfWindow.py |
hosts = sort_seq(ip.map2hosts(self.allowedhosts)) | hosts = sort_seq(self.allowedhosts) | def toxml (self): s = """<?xml version="1.0"?> | 51e89f1b5e55281c10087ddcb6212bfe31fdd6fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/51e89f1b5e55281c10087ddcb6212bfe31fdd6fd/ConfWindow.py |
import wc.proxy wc.proxy.mainloop(handle=handle) | from wc.proxy import mainloop mainloop(handle=handle) | def startfunc (handle=None): # init logging initlog(os.path.join(ConfigDir, "logging.conf")) # we run single-threaded, decrease check interval sys.setcheckinterval(500) # support reload on posix systems if os.name=='posix': import signal signal.signal(signal.SIGHUP, reload_config) # drop privileges os.chdir("/") # for ... | 09d34b2013625880a2844d7df875a1768b7a4212 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/09d34b2013625880a2844d7df875a1768b7a4212/__init__.py |
p.parse(file(filename)) | p.parse(file(filename), self) | def read_filterconf (self): """read filter rules""" # filter configuration for filename in filterconf_files(): p = ZapperParser(filename) p.parse(file(filename)) self['folderrules'].append(p.folder) self.sort() | 09d34b2013625880a2844d7df875a1768b7a4212 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/09d34b2013625880a2844d7df875a1768b7a4212/__init__.py |
def parse (self, fp): | def parse (self, fp, _config): self.config = _config | def parse (self, fp): debug(WC, "Parsing %s", self.filename) try: self.p.ParseFile(fp) except xml.parsers.expat.ExpatError: error(WC, "Error parsing %s", self.filename) raise | 09d34b2013625880a2844d7df875a1768b7a4212 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/09d34b2013625880a2844d7df875a1768b7a4212/__init__.py |
self.config = _config super(WConfigParser, self).parse(fp) | super(WConfigParser, self).parse(fp, _config) | def parse (self, fp, _config): self.config = _config super(WConfigParser, self).parse(fp) self.config['configfile'] = self.filename self.config['filters'].sort() | 09d34b2013625880a2844d7df875a1768b7a4212 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/09d34b2013625880a2844d7df875a1768b7a4212/__init__.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.