bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def jsProcessData (self, data): """process data produced by document.write() JavaScript""" self._debug(NIGHTMARE, "JS: document.write", `data`) self.js_output += 1 # parse recursively self.js_html.feed(data) | def jsProcessData (self, data): """process data produced by document.write() JavaScript""" self.js_output += 1 # parse recursively self.js_html.feed(data) | 16,500 |
def jsProcessPopup (self): """process javascript popup""" self._debug(NIGHTMARE, "JS: popup") self.js_popup += 1 | def jsProcessPopup (self): """process javascript popup""" self.js_popup += 1 | 16,501 |
def buf_append_data (self, data): """we have to make sure that we have no two following DATA things in the tag buffer. Why? To be 100% sure that an ENCLOSED match really matches enclosed data. """ self._debug(NIGHTMARE, "buf_append_data") if data[0]==DATA and self.buf and self.buf[-1][0]==DATA: self.buf[-1][1] += data[... | def buf_append_data (self, data): """we have to make sure that we have no two following DATA things in the tag buffer. Why? To be 100% sure that an ENCLOSED match really matches enclosed data. """ if data[0]==DATA and self.buf and self.buf[-1][0]==DATA: self.buf[-1][1] += data[1] else: self.buf.append(data) | 16,502 |
def flushbuf (self): """clear and return the output buffer""" self._debug(NIGHTMARE, "flushbuf") data = self.outbuf.getvalue() self.outbuf.close() self.outbuf = StringIO() return data | def flushbuf (self): """clear and return the output buffer""" data = self.outbuf.getvalue() self.outbuf.close() self.outbuf = StringIO() return data | 16,503 |
def _debugbuf (self): """print debugging information about data buffer status""" self._debug(NIGHTMARE, "self.outbuf", `self.outbuf.getvalue()`) self._debug(NIGHTMARE, "self.buf", `self.buf`) self._debug(NIGHTMARE, "self.waitbuf", `self.waitbuf`) self._debug(NIGHTMARE, "self.inbuf", `self.inbuf.getvalue()`) | def _debugbuf (self): """print debugging information about data buffer status""" self._debug(NIGHTMARE, "self.outbuf", `self.outbuf.getvalue()`) self._debug(NIGHTMARE, "self.buf", `self.buf`) self._debug(NIGHTMARE, "self.waitbuf", `self.waitbuf`) self._debug(NIGHTMARE, "self.inbuf", `self.inbuf.getvalue()`) | 16,504 |
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': return data = self.inbuf.getvalue() + data self.inbuf.close() self.inbuf = StringIO()... | 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': return data = self.inbuf.getvalue() + data self.inbuf.close() self.inbuf = StringIO()... | 16,505 |
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': return data = self.inbuf.getvalue() + data self.inbuf.close() self.inbuf = StringIO()... | 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': return data = self.inbuf.getvalue() + data self.inbuf.close() self.inbuf = StringIO()... | 16,506 |
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': return data = self.inbuf.getvalue() + data self.inbuf.close() self.inbuf = StringIO()... | 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': return data = self.inbuf.getvalue() + data self.inbuf.close() self.inbuf = StringIO()... | 16,507 |
def flush (self): self._debug(HURT_ME_PLENTY, "flush") # flushing in wait state raises a filter exception if self.state=='wait': raise FilterWait("HtmlParser[%d]: waiting for data"%self.level) self.parser.flush() | def flush (self): # flushing in wait state raises a filter exception if self.state=='wait': raise FilterWait("HtmlParser[%d]: waiting for data"%self.level) self.parser.flush() | 16,508 |
def replay (self, waitbuf): """call the handler functions again with buffer data""" self._debug(NIGHTMARE, "replay", waitbuf) for item in waitbuf: if item[0]==DATA: self._data(item[1]) elif item[0]==STARTTAG: self.startElement(item[1], item[2]) elif item[0]==ENDTAG: self.endElement(item[1]) elif item[0]==COMMENT: self.... | def replay (self, waitbuf): """call the handler functions again with buffer data""" for item in waitbuf: if item[0]==DATA: self._data(item[1]) elif item[0]==STARTTAG: self.startElement(item[1], item[2]) elif item[0]==ENDTAG: self.endElement(item[1]) elif item[0]==COMMENT: self.comment(item[1]) | 16,509 |
def cdata (self, data): """character data""" self._debug(NIGHTMARE, "cdata", `data`) return self._data(data) | def cdata (self, data): """character data""" return self._data(data) | 16,510 |
def characters (self, data): """characters""" self._debug(NIGHTMARE, "characters", `data`) return self._data(data) | def characters (self, data): """characters""" return self._data(data) | 16,511 |
def comment (self, data): """a comment; accept only non-empty comments""" self._debug(NIGHTMARE, "comment", `data`) item = [COMMENT, data] if self.state=='wait': return self.waitbuf.append(item) if self.comments and data: self.buf.append(item) | def comment (self, data): """a comment; accept only non-empty comments""" item = [COMMENT, data] if self.state=='wait': return self.waitbuf.append(item) if self.comments and data: self.buf.append(item) | 16,512 |
def doctype (self, data): self._debug(NIGHTMARE, "doctype", `data`) return self._data("<!DOCTYPE%s>"%data) | def doctype (self, data): return self._data("<!DOCTYPE%s>"%data) | 16,513 |
def pi (self, data): self._debug(NIGHTMARE, "pi", `data`) return self._data("<?%s?>"%data) | def pi (self, data): return self._data("<?%s?>"%data) | 16,514 |
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 self._debug(NIGHTMARE, "startElement", `tag`) tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state=='wait': return self.wa... | 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 tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state=='wait': return self.waitbuf.append(item) rulelist = [] filtered = 0... | 16,515 |
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 self._debug(NIGHTMARE, "startElement", `tag`) tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state=='wait': return self.wa... | 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 self._debug(NIGHTMARE, "startElement", `tag`) tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state=='wait': return self.wa... | 16,516 |
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 self._debug(NIGHTMARE, "startElement", `tag`) tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state=='wait': return self.wa... | 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 self._debug(NIGHTMARE, "startElement", `tag`) tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state=='wait': return self.wa... | 16,517 |
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. | 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. | 16,518 |
def jsStartElement (self, tag, attrs): """Check popups for onmouseout and onmouseover. Inline extern javascript sources""" changed = 0 self.js_src = None self.js_output = 0 self.js_popup = 0 for name in ('onmouseover', 'onmouseout'): if attrs.has_key(name) and self.jsPopup(attrs, name): self._debug(NIGHTMARE, "JS: del"... | def jsStartElement (self, tag, attrs): """Check popups for onmouseout and onmouseover. Inline extern javascript sources""" changed = 0 self.js_src = None self.js_output = 0 self.js_popup = 0 for name in ('onmouseover', 'onmouseout'): if attrs.has_key(name) and self.jsPopup(attrs, name): del attrs[name] changed = 1 if ... | 16,519 |
def jsPopup (self, attrs, name): """check if attrs[name] javascript opens a popup window""" self._debug(NIGHTMARE, "JS: jsPopup") val = resolve_html_entities(attrs[name]) if not val: return self.js_env.attachListener(self) try: self.js_env.executeScriptAsFunction(val, 0.0) except jslib.error, msg: pass self.js_env.deta... | def jsPopup (self, attrs, name): """check if attrs[name] javascript opens a popup window""" val = resolve_html_entities(attrs[name]) if not val: return self.js_env.attachListener(self) try: self.js_env.executeScriptAsFunction(val, 0.0) except jslib.error, msg: pass self.js_env.detachListener(self) res = self.js_popup ... | 16,520 |
def jsForm (self, name, action, target): """when hitting a (named) form, notify the JS engine about that""" if not name: return self._debug(HURT_ME_PLENTY, "jsForm", `name`, `action`, `target`) self.js_env.addForm(name, action, target) | def jsForm (self, name, action, target): """when hitting a (named) form, notify the JS engine about that""" if not name: return self.js_env.addForm(name, action, target) | 16,521 |
def jsScriptData (self, data, url, ver): """Callback for loading <script src=""> data in the background If downloading is finished, data is None""" assert self.state=='wait' if data is None: if not self.js_script: print >> sys.stderr, "HtmlParser[%d]: empty JS src"%self.level, url else: self.buf.append([STARTTAG, "scri... | def jsScriptData (self, data, url, ver): """Callback for loading <script src=""> data in the background If downloading is finished, data is None""" assert self.state=='wait' if data is None: if not self.js_script: print >> sys.stderr, "HtmlParser[%d]: empty JS src"%self.level, url else: self.buf.append([STARTTAG, "scri... | 16,522 |
def jsScriptData (self, data, url, ver): """Callback for loading <script src=""> data in the background If downloading is finished, data is None""" assert self.state=='wait' if data is None: if not self.js_script: print >> sys.stderr, "HtmlParser[%d]: empty JS src"%self.level, url else: self.buf.append([STARTTAG, "scri... | def jsScriptData (self, data, url, ver): """Callback for loading <script src=""> data in the background If downloading is finished, data is None""" assert self.state=='wait' if data is None: if not self.js_script: print >> sys.stderr, "HtmlParser[%d]: empty JS src"%self.level, url else: self.buf.append([STARTTAG, "scri... | 16,523 |
def jsScriptSrc (self, url, language): """Start a background download for <script src=""> tags""" 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) self._debug(HURT_ME_PLENTY, "JS jsScrip... | def jsScriptSrc (self, url, language): """Start a background download for <script src=""> tags""" 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) if _has_ws(url): print >> sys.stderr, ... | 16,524 |
def jsScript (self, script, ver, item): """execute given script with javascript version ver""" self._debug(NIGHTMARE, "JS: jsScript", ver, `script`) assert self.state == 'parse' assert len(self.buf) >= 2 self.js_output = 0 self.js_env.attachListener(self) # start recursive html filter (used by jsProcessData) self.js_ht... | def jsScript (self, script, ver, item): """execute given script with javascript version ver""" assert self.state == 'parse' assert len(self.buf) >= 2 self.js_output = 0 self.js_env.attachListener(self) # start recursive html filter (used by jsProcessData) self.js_html = FilterHtmlParser(self.rules, self.pics, self.url... | 16,525 |
def jsEndScript (self, item): self._debug(NIGHTMARE, "JS: endScript") assert len(self.buf) >= 2 if self.js_output: try: self.js_html.feed('') self.js_html.flush() except FilterWait: self.state = 'wait' self.waited = 'True' make_timer(0.1, lambda : self.jsEndScript(item)) return self.js_html._debugbuf() assert not self.... | def jsEndScript (self, item): assert len(self.buf) >= 2 if self.js_output: try: self.js_html.feed('') self.js_html.flush() except FilterWait: self.state = 'wait' self.waited = 'True' make_timer(0.1, lambda : self.jsEndScript(item)) return self.js_html._debugbuf() assert not self.js_html.inbuf.getvalue() assert not sel... | 16,526 |
def jsEndScript (self, item): self._debug(NIGHTMARE, "JS: endScript") assert len(self.buf) >= 2 if self.js_output: try: self.js_html.feed('') self.js_html.flush() except FilterWait: self.state = 'wait' self.waited = 'True' make_timer(0.1, lambda : self.jsEndScript(item)) return self.js_html._debugbuf() assert not self.... | def jsEndScript (self, item): self._debug(NIGHTMARE, "JS: endScript") assert len(self.buf) >= 2 if self.js_output: try: self.js_html.feed('') self.js_html.flush() except FilterWait: self.state = 'wait' self.waited = 'True' make_timer(0.1, lambda : self.jsEndScript(item)) return self.js_html._debugbuf() assert not self.... | 16,527 |
def __init__ (self, socket, addr): Connection.__init__(self, socket) self.addr = addr self.state = 'request' self.server = None self.request = '' self.headers = None self.bytes_remaining = None # for content only self.content = '' if self.addr[0] not in config['allowed_hosts']: self.close() | def __init__ (self, socket, addr): Connection.__init__(self, socket) self.addr = addr self.state = 'request' self.server = None self.request = '' self.headers = None self.bytes_remaining = None # for content only self.content = '' if not config['allowedhosts'].has_key(self.addr[0]): self.close() | 16,528 |
def __init__ (self, sid=None, titles=None, descriptions=None, disable=0, tag=u"a", attrs=None, enclosed=u"", part=wc.filter.html.COMPLETE, replacement=u""): """ Initialize rule data. """ super(HtmlrewriteRule, self).__init__(sid=sid, titles=titles, descriptions=descriptions, disable=disable) self.tag = tag self.tag_ro ... | def __init__ (self, sid=None, titles=None, descriptions=None, disable=0, tag=u"a", attrs=None, enclosed=u"", part=wc.filter.html.COMPLETE, replacement=u""): """ Initialize rule data. """ super(HtmlrewriteRule, self).__init__(sid=sid, titles=titles, descriptions=descriptions, disable=disable) self.tag = tag self.tag_ro ... | 16,529 |
def matches_starttag (self): """ See if this rule matches start tags. """ if self.tag in NO_CLOSE_TAGS: return True return self.part not in [ wc.filter.html.ENCLOSED, wc.filter.html.COMPLETE, ] | def matches_starttag (self): """ See if this rule matches start tags. """ for tag in NO_CLOSE_TAGS: if self.match_tag(tag): return True return self.part not in [ wc.filter.html.ENCLOSED, wc.filter.html.COMPLETE, ] | 16,530 |
def matches_endtag (self): """ See if this rule matches end tags. """ if self.tag in NO_CLOSE_TAGS: return False return self.part not in [ wc.filter.html.ATTR, wc.filter.html.ATTRVAL, wc.filter.html.ATTRNAME, ] | def matches_endtag (self): """ See if this rule matches end tags. """ for tag in NO_CLOSE_TAGS: if self.match_tag(tag): return False return self.part not in [ wc.filter.html.ATTR, wc.filter.html.ATTRVAL, wc.filter.html.ATTRNAME, ] | 16,531 |
def XtestScriptSrc1 (self): self.filt( | def testScriptSrc1 (self): self.filt( | 16,532 |
def XtestScriptSrc2 (self): self.filt( | def testScriptSrc2 (self): self.filt( | 16,533 |
def XtestScriptSrc3 (self): """missing </script>""" self.filt( | def testScriptSrc3 (self): """missing </script>""" self.filt( | 16,534 |
def parse_headers (): headers = [] try: s = get_data("/headers/") #debug(BRING_IT_ON, "headers data", s) except (IOError, ValueError): print >> sys.stderr, _("WebCleaner is not running") return headers if s=="-": return headers lines = s.split("\n") for l in lines: print "line", `l` # strip off paranthesis l = l[1:-1] ... | def parse_headers (): headers = [] try: s = get_data("/headers/") #debug(BRING_IT_ON, "headers data", s) except (IOError, ValueError): print >> sys.stderr, _("WebCleaner is not running") return headers if s=="-": return headers lines = s.split("\n") for l in lines: # strip off paranthesis l = l[1:-1] # split into three... | 16,535 |
def processData (self, data): print >>sys.stderr, "JS:", data # XXX parse recursively | def processData (self, data): print >>sys.stderr, "JS:", data # XXX parse recursively | 16,536 |
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. | 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. | 16,537 |
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. | 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. | 16,538 |
def jsEndElement (self, tag): """parse generated html for scripts""" if tag!='script': return if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return last = self.buffer[-1] if last[0]!=DATA: print >>sys.stderr, "missing body for </script>", last return script = last[1].strip() if script.startswith("<... | def jsEndElement (self, tag): """parse generated html for scripts""" if len(self.buffer)<2: print >>sys.stderr, "short buffer on </script>", self.buffer return last = self.buffer[-1] if last[0]!=DATA: print >>sys.stderr, "missing body for </script>", last return script = last[1].strip() if script.startswith("<!--"): sc... | 16,539 |
def jsEndElement (self, tag): """parse generated html for scripts""" if tag!='script': return if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return last = self.buffer[-1] if last[0]!=DATA: print >>sys.stderr, "missing body for </script>", last return script = last[1].strip() if script.startswith("<... | def jsEndElement (self, tag): """parse generated html for scripts""" if tag!='script': return if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return if self.buffer[-1][0]!=DATA or self.buffer[-2][0]!=STARTTAG: print >>sys.stderr, "missing tags for </script>", self.buffer[-2:] return script = last[1]... | 16,540 |
def jsEndElement (self, tag): """parse generated html for scripts""" if tag!='script': return if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return last = self.buffer[-1] if last[0]!=DATA: print >>sys.stderr, "missing body for </script>", last return script = last[1].strip() if script.startswith("<... | def jsEndElement (self, tag): """parse generated html for scripts""" if tag!='script': return if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return last = self.buffer[-1] if last[0]!=DATA: print >>sys.stderr, "missing body for </script>", last return script = self.buffer[-1][1].strip() self.buffer[... | 16,541 |
def jsEndElement (self, tag): """parse generated html for scripts""" if tag!='script': return if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return last = self.buffer[-1] if last[0]!=DATA: print >>sys.stderr, "missing body for </script>", last return script = last[1].strip() if script.startswith("<... | def jsEndElement (self, tag): """parse generated html for scripts""" if tag!='script': return if not self.buffer: print >>sys.stderr, "empty buffer on </script>" return last = self.buffer[-1] if last[0]!=DATA: print >>sys.stderr, "missing body for </script>", last return script = last[1].strip() if script.startswith("<... | 16,542 |
def finish (self, data, attrs): """ Feed image data to buffer, then convert it and return result. """ if self.init_image_reducer: self.set_ctype_header(attrs) self.init_image_reducer = False if not attrs.has_key('imgreducer_buf'): return data p = attrs['imgreducer_buf'] if data: p.write(data) p.seek(0) try: img = Image... | def finish (self, data, attrs): """ Feed image data to buffer, then convert it and return result. """ if self.init_image_reducer: self.set_ctype_header(attrs) self.init_image_reducer = False if not attrs.has_key('imgreducer_buf'): return data p = attrs['imgreducer_buf'] if data: p.write(data) p.seek(0) try: img = Image... | 16,543 |
def finish (self, data, attrs): """ Feed image data to buffer, then convert it and return result. """ if self.init_image_reducer: self.set_ctype_header(attrs) self.init_image_reducer = False if not attrs.has_key('imgreducer_buf'): return data p = attrs['imgreducer_buf'] if data: p.write(data) p.seek(0) try: img = Image... | def finish (self, data, attrs): """ Feed image data to buffer, then convert it and return result. """ if self.init_image_reducer: self.set_ctype_header(attrs) self.init_image_reducer = False if not attrs.has_key('imgreducer_buf'): return data p = attrs['imgreducer_buf'] if data: p.write(data) p.seek(0) try: img = Image... | 16,544 |
def get_attrs (self, url, localhost, stages, headers): """ Initialize image reducer buffer and flags. """ if not self.applies_to_stages(stages): return {} # don't filter tiny images d = super(ImageReducer, self).get_attrs(url, localhost, stages, headers) # weed out the rules that don't apply to this url rules = [ rule ... | def get_attrs (self, url, localhost, stages, headers): """ Initialize image reducer buffer and flags. """ if not self.applies_to_stages(stages): return {} # don't filter tiny images d = super(ImageReducer, self).get_attrs(url, localhost, stages, headers) # weed out the rules that don't apply to this url rules = [ rule ... | 16,545 |
def get_attrs (self, url, localhost, stages, headers): """ Initialize image reducer buffer and flags. """ if not self.applies_to_stages(stages): return {} # don't filter tiny images d = super(ImageReducer, self).get_attrs(url, localhost, stages, headers) # weed out the rules that don't apply to this url rules = [ rule ... | def get_attrs (self, url, localhost, stages, headers): """ Initialize image reducer buffer and flags. """ if not self.applies_to_stages(stages): return {} # don't filter tiny images d = super(ImageReducer, self).get_attrs(url, localhost, stages, headers) # weed out the rules that don't apply to this url rules = [ rule ... | 16,546 |
def construct_request_data (self, request): """ Construct valid HTTP request data string. """ lines = [] version = "HTTP/%d.%d" % request.version lines.append("%s %s %s" % (request.method, request.uri, version)) lines.extend(request.headers) # an empty line ends the headers lines.extend(("", "")) data = "\r\n".join(lin... | def construct_request_data (self, request): """ Construct valid HTTP request data string. """ lines = [] version = "HTTP/%d.%d" % request.version lines.append("%s %s %s" % (request.method, request.uri, version)) lines.extend(request.headers) # an empty line ends the headers lines.extend(("", "")) data = "\r\n".join(lin... | 16,547 |
def get_localaddrs (): """all active interfaces' ip addresses""" addrs = sets.Set() try: # search interfaces key = wc.winreg.key_handle(wc.winreg.HKEY_LOCAL_MACHINE, r"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces") for subkey in key.subkeys(): if subkey.get('EnableDHCP')==1: ip = subkey.get('DhcpIPAddr... | def get_localaddrs (): """all active interfaces' ip addresses""" addrs = sets.Set() try: # search interfaces key = wc.winreg.key_handle(wc.winreg.HKEY_LOCAL_MACHINE, r"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces") for subkey in key.subkeys(): if subkey.get('EnableDHCP'): ip = subkey.get('DhcpIPAddress... | 16,548 |
def get_localaddrs (): """all active interfaces' ip addresses""" addrs = sets.Set() try: # search interfaces key = wc.winreg.key_handle(wc.winreg.HKEY_LOCAL_MACHINE, r"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces") for subkey in key.subkeys(): if subkey.get('EnableDHCP')==1: ip = subkey.get('DhcpIPAddr... | def get_localaddrs (): """all active interfaces' ip addresses""" addrs = sets.Set() try: # search interfaces key = wc.winreg.key_handle(wc.winreg.HKEY_LOCAL_MACHINE, r"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces") for subkey in key.subkeys(): if subkey.get('EnableDHCP')==1: ip = subkey.get('DhcpIPAddr... | 16,549 |
def _main (): """USAGE: test/run.sh test/parsefile.py test.html""" import sys if len(sys.argv)!=2: print _main.__doc__ sys.exit(1) if sys.argv[1]=='-': f = sys.stdin else: f = file(sys.argv[1]) from wc.parser.htmllib import HtmlPrinter from wc.parser import htmlsax p = htmlsax.parser(HtmlPrinter()) p.debug(1) size = 10... | def _main (): """USAGE: test/run.sh test/parsefile.py test.html""" import sys if len(sys.argv)!=2: print _main.__doc__ sys.exit(1) if sys.argv[1]=='-': f = sys.stdin else: f = file(sys.argv[1]) from wc.parser.htmllib import HtmlPrinter from wc.parser import htmlsax p = htmlsax.parser(HtmlPrinter()) size = 1024 #size =... | 16,550 |
def fname (name): return os.path.join("wc", "dns", "tests", name) | def fname (name): return os.path.join("wc", "dns", "tests", name) | 16,551 |
def __init__ (self, client, url, form, protocol, status=200, msg=i18n._('Ok'), context={}, headers={'Content-Type': 'text/html'}): self.client = client # we pretend to be the server self.connected = True try: lang = i18n.get_headers_lang(headers) # get the template filename path, dirs, lang = get_template_url(url, lang... | def __init__ (self, client, url, form, protocol, status=200, msg=i18n._('Ok'), context={}, headers={'Content-Type': 'text/html'}): self.client = client # we pretend to be the server self.connected = True try: lang = i18n.get_headers_lang(headers) # get the template filename path, dirs, lang = get_template_url(url, lang... | 16,552 |
def iswritable (fname): """return True if given file is writable""" if os.path.isdir(fname) or os.path.islink(fname): return False try: if os.path.exists(fname): open(fname, 'a').close() return True else: open(fname, 'w').close() os.remove(fname) return True except IOError: pass return False | def iswritable (fname): """return True if given file is writable""" if os.path.isdir(fname) or os.path.islink(fname): return False try: if os.path.exists(fname): open(fname, 'a').close() return True else: open(fname, 'w').close() os.remove(fname) return True except IOError: pass return False | 16,553 |
def _broken (): p = HtmlPrinter() p.feed("""<a b="c"><""") p.feed("""d>""") | def _broken (): p = HtmlPrinter() s = """<h1>bla</h1>""" for c in s: p.feed(c) p.flush() | 16,554 |
def rating_range (value): """parse value as range; return tuple (rmin, rmax) or None on error""" mo = _range_re.match(value) if not mo: return None return (mo.group(1), mo.group(2)) | def rating_range (value): """parse value as range; return tuple (rmin, rmax) or None on error""" mo = _range_re.match(value) if not mo: return None return (mo.group(1), mo.group(2)) | 16,555 |
def server_response (self, response, statuscode, headers): """the server got a response""" # Okay, transfer control over to the real client if self.client.connected: config['requests']['valid'] += 1 self.server.client = self.client self.client.server_response(self.server, response, statuscode, headers) else: self.serve... | def server_response (self, response, statuscode, status, headers): """the server got a response""" # Okay, transfer control over to the real client if self.client.connected: config['requests']['valid'] += 1 self.server.client = self.client self.client.server_response(self.server, response, statuscode, headers) else: se... | 16,556 |
def server_response (self, response, statuscode, headers): """the server got a response""" # Okay, transfer control over to the real client if self.client.connected: config['requests']['valid'] += 1 self.server.client = self.client self.client.server_response(self.server, response, statuscode, headers) else: self.serve... | def server_response (self, response, statuscode, headers): """the server got a response""" # Okay, transfer control over to the real client if self.client.connected: config['requests']['valid'] += 1 self.server.client = self.client self.client.server_response(self.server, response, status, headers) else: self.server.cl... | 16,557 |
def check_headers (self): """add missing content-type and/or encoding headers""" # 304 Not Modified does not send any type or encoding info, # because this info was cached if self.statuscode == '304': return # check content-type against our own guess i = self.document.find('?') if i>0: document = self.document[:i] else... | def check_headers (self): """add missing content-type and/or encoding headers""" # 304 Not Modified does not send any type or encoding info, # because this info was cached if self.statuscode == '304': return # check content-type against our own guess i = self.document.find('?') if i>0: document = self.document[:i] else... | 16,558 |
def get_request_headers (self, content): port = self.server.socket.getsockname()[1] headers = [ "Host: localhost:%d" % port, "Proxy-Connection: close", ] if content: headers.append("Content-Length: %d" % len(content)) headers.append("Content-Length: %d" % len(content)-5) return headers | def get_request_headers (self, content): port = self.server.socket.getsockname()[1] headers = [ "Host: localhost:%d" % port, "Proxy-Connection: close", ] if content: headers.append("Content-Length: %d" % len(content)) headers.append("Content-Length: %d" % (len(content)-5)) return headers | 16,559 |
def get_response_headers (self, content): return [ "Content-Type: text/plain", "Content-Length: %d" % len(content), "Content-Length: %d" % len(content)-5, ] | def get_response_headers (self, content): return [ "Content-Type: text/plain", "Content-Length: %d" % len(content), "Content-Length: %d" % (len(content)-5), ] | 16,560 |
def generate_sids (): for rule in _rules_without_sid: rule.sid = generate_unique_sid("wc") del _rules_without_sid[:] | def generate_sids (prefix="wc"): for rule in _rules_without_sid: rule.sid = generate_unique_sid("wc") del _rules_without_sid[:] | 16,561 |
def generate_sids (): for rule in _rules_without_sid: rule.sid = generate_unique_sid("wc") del _rules_without_sid[:] | def generate_sids (): for rule in _rules_without_sid: rule.sid = generate_unique_sid(prefix) del _rules_without_sid[:] | 16,562 |
def write_proxyconf (self): """write proxy configuration""" f = file(self['configfile'], 'w') f.write("""<?xml version="1.0" encoding="%s"?> | def write_proxyconf (self): """write proxy configuration""" f = file(self['configfile'], 'w') f.write("""<?xml version="1.0" encoding="%s"?> | 16,563 |
def error(self, code, msg): ServerHandleDirectly( self.client, 'HTTP/1.0 %d Use different host\r\n', 'Content-type: text/html\r\n' 'Location: http://%s\r\n' '\r\n' % (code, new_url), msg) | def error(self, code, msg): ServerHandleDirectly( self.client, 'HTTP/1.0 %d %s\r\n', 'Server: WebCleaner Proxy\r\n' 'Content-type: text/html\r\n' 'Location: http://%s\r\n' '\r\n' % (code, new_url), msg) | 16,564 |
def error(self, code, msg): ServerHandleDirectly( self.client, 'HTTP/1.0 %d Use different host\r\n', 'Content-type: text/html\r\n' 'Location: http://%s\r\n' '\r\n' % (code, new_url), msg) | def error(self, code, msg): ServerHandleDirectly( self.client, 'HTTP/1.0 %d Use different host\r\n', 'Content-type: text/html\r\n' '\r\n' '<html><head>' '<title>WebCleaner Proxy Error %d %s</title>' '</head><body bgcolor=" 'WebCleaner Proxy Error %d %s<br>' '%s<br></center></body></html>' % (code, msg, code, msg), msg) | 16,565 |
def handle_dns(self, hostname, answer): assert self.state == 'dns' if answer.isError(): self.error(400, _(answer.data)) return self.state = 'server' self.ipaddr = socket.gethostbyname(self.hostname) | def handle_dns(self, hostname, answer): assert self.state == 'dns' if answer.isError(): self.error(400, _(answer.data)) return self.state = 'server' self.ipaddr = socket.gethostbyname(self.hostname) | 16,566 |
def classify (self, f): if not self.entries: raise StandardError("Not initialised properly") # Are we still looking for the ruleset to apply or are we in a rule found_rule = False # When we found the rule, what is the level that we successfull passed in_level = 0 # If we failed part of the rule there is no point lookin... | def classify (self, f): if not self.entries: raise StandardError("Not initialised properly") # Are we still looking for the ruleset to apply or are we in a rule found_rule = False # When we found the rule, what is the level that we successfull passed in_level = 0 # If we failed part of the rule there is no point lookin... | 16,567 |
def handle_read (self): """read data from connection, put it into recv_buffer and call process_read""" assert self.connected debug(PROXY, '%s handle_read', self) | def handle_read (self): """read data from connection, put it into recv_buffer and call process_read""" assert self.connected debug(PROXY, '%s handle_read', self) | 16,568 |
def __init__ (self, client, request, headers, content, nofilter,compress): self.client = client self.request = request self.headers = headers self.compress = compress self.content = content self.nofilter = nofilter debug(HURT_ME_PLENTY, "request", `self.request`) self.method, self.url, protocol = self.request.split() s... | def __init__ (self, client, request, headers, content, nofilter,compress): self.client = client self.request = request self.headers = headers self.compress = compress self.content = content self.nofilter = nofilter self.method, self.url, protocol = self.request.split() scheme, hostname, port, document = spliturl(self.u... | 16,569 |
def update_filter (wconfig, dryrun=False, log=None): """Update the given configuration object with .zap files found at baseurl. If dryrun is True, only print out the changes but do nothing throws IOError on error """ chg = False baseurl = wconfig['baseurl']+"filter/" url = baseurl+"filter-md5sums.txt" try: page = open_... | def update_filter (wconfig, dryrun=False, log=None): """Update the given configuration object with .zap files found at baseurl. If dryrun is True, only print out the changes but do nothing throws IOError on error """ chg = False baseurl = wconfig['baseurl']+"filter/" url = baseurl+"filter-md5sums.txt" try: page = open_... | 16,570 |
def process_headers (self): # Headers are terminated by a blank line .. now in the regexp, # we want to say it's either a newline at the beginning of # the document, or it's a lot of headers followed by two newlines. # The cleaner alternative would be to read one line at a time # until we get to a blank line... m = re.... | def process_headers (self): # Headers are terminated by a blank line .. now in the regexp, # we want to say it's either a newline at the beginning of # the document, or it's a lot of headers followed by two newlines. # The cleaner alternative would be to read one line at a time # until we get to a blank line... m = re.... | 16,571 |
def process_headers (self): # Headers are terminated by a blank line .. now in the regexp, # we want to say it's either a newline at the beginning of # the document, or it's a lot of headers followed by two newlines. # The cleaner alternative would be to read one line at a time # until we get to a blank line... m = re.... | def process_headers (self): # Headers are terminated by a blank line .. now in the regexp, # we want to say it's either a newline at the beginning of # the document, or it's a lot of headers followed by two newlines. # The cleaner alternative would be to read one line at a time # until we get to a blank line... m = re.... | 16,572 |
def process_headers (self): # Headers are terminated by a blank line .. now in the regexp, # we want to say it's either a newline at the beginning of # the document, or it's a lot of headers followed by two newlines. # The cleaner alternative would be to read one line at a time # until we get to a blank line... m = re.... | def process_headers (self): # Headers are terminated by a blank line .. now in the regexp, # we want to say it's either a newline at the beginning of # the document, or it's a lot of headers followed by two newlines. # The cleaner alternative would be to read one line at a time # until we get to a blank line... m = re.... | 16,573 |
def process_headers (self): # Headers are terminated by a blank line .. now in the regexp, # we want to say it's either a newline at the beginning of # the document, or it's a lot of headers followed by two newlines. # The cleaner alternative would be to read one line at a time # until we get to a blank line... m = re.... | def process_headers (self): # Headers are terminated by a blank line .. now in the regexp, # we want to say it's either a newline at the beginning of # the document, or it's a lot of headers followed by two newlines. # The cleaner alternative would be to read one line at a time # until we get to a blank line... m = re.... | 16,574 |
def _broken (): p = HtmlPrinter() p.feed("""<a><t""") p.feed("""r>""") p.flush() | def _broken (): p = HtmlPrinter() p.feed("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <META NAME="Description" CONTENT="Obsession Development: Products"> <META NAME="Resource-Type" CONTENT="document"> <META NAME="Content-Type" CONTENT="text/html, charset=iso-8859-1"> <M... | 16,575 |
def _form_ratings (form): """Check category value validity""" for catname, value in _get_prefix_vals(form, 'category_'): category = _get_category(catname) if category is None: # unknown category error['categoryvalue'] = True return False if not category.valid_value(value): error['categoryvalue'] = True return False if ... | def _form_ratings (form): """Check category value validity""" for catname, value in _get_prefix_vals(form, 'category_'): category = _get_category(catname) if category is None: # unknown category error['categoryvalue'] = True return False if category.iterable: realvalue = value else: realvalue = _intrange_from_string(va... | 16,576 |
def read_ids (filename, ids): p = wc.configuration.ZapperParser(filename) p.parse() ids['folder']['sid'] = str(p.folder.sid) ids['folder']['oid'] = p.folder.oid ids['folder']['configversion'] = str(p.folder.configversion) for rule in p.folder.rules: for ftype in ('domains', 'urls'): if rule.name.endswith(ftype): ids[ft... | def read_ids (filename, ids): p = wc.configuration.confparse.ZapperParser(filename) p.parse() ids['folder']['sid'] = str(p.folder.sid) ids['folder']['oid'] = p.folder.oid ids['folder']['configversion'] = str(p.folder.configversion) for rule in p.folder.rules: for ftype in ('domains', 'urls'): if rule.name.endswith(ftyp... | 16,577 |
def blacklist (fname, extract_to="extracted"): source = os.path.join("downloads", fname) # extract tar if fname.endswith(".tar.gz") or fname.endswith(".tgz"): print "extracting archive", fname f = tarfile.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 my... | def blacklist (fname, extract_to="extracted"): source = os.path.join("downloads", fname) # extract tar if fname.endswith(".tar.gz") or fname.endswith(".tgz"): print "extracting archive", fname f = tarfile.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 my... | 16,578 |
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... | 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... | 16,579 |
def _form_reset (): """reset info/error and global vars""" global filterenabled, filterdisabled filterenabled = u"" filterdisabled = u"" for key in info.keys(): info[key] = False for key in error.keys(): error[key] = False res = [None] | def _form_reset (): """reset info/error and global vars""" global filterenabled, filterdisabled filterenabled = u"" filterdisabled = u"" for key in info.keys(): info[key] = False for key in error.keys(): error[key] = False | 16,580 |
def update (wconfig, baseurl, dryrun=False, log=None): """Update the given configuration object with .zap files found at baseurl. If dryrun is True, only print out the changes but do nothing throws IOError on error """ chg = False url = baseurl+"filter-md5sums.txt" try: page = open_url(url) except IOError, msg: print >... | def update (wconfig, dryrun=False, log=None): """Update the given configuration object with .zap files found at baseurl. If dryrun is True, only print out the changes but do nothing throws IOError on error """ chg = False url = baseurl+"filter-md5sums.txt" try: page = open_url(url) except IOError, msg: print >>log, "er... | 16,581 |
def update (wconfig, baseurl, dryrun=False, log=None): """Update the given configuration object with .zap files found at baseurl. If dryrun is True, only print out the changes but do nothing throws IOError on error """ chg = False url = baseurl+"filter-md5sums.txt" try: page = open_url(url) except IOError, msg: print >... | def update (wconfig, baseurl, dryrun=False, log=None): """Update the given configuration object with .zap files found at baseurl. If dryrun is True, only print out the changes but do nothing throws IOError on error """ chg = False url = baseurl+"filter-md5sums.txt" try: page = open_url(url) except IOError, msg: print >... | 16,582 |
def update (wconfig, baseurl, dryrun=False, log=None): """Update the given configuration object with .zap files found at baseurl. If dryrun is True, only print out the changes but do nothing throws IOError on error """ chg = False url = baseurl+"filter-md5sums.txt" try: page = open_url(url) except IOError, msg: print >... | def update (wconfig, baseurl, dryrun=False, log=None): """Update the given configuration object with .zap files found at baseurl. If dryrun is True, only print out the changes but do nothing throws IOError on error """ chg = False url = baseurl+"filter-md5sums.txt" try: page = open_url(url) except IOError, msg: print >... | 16,583 |
def new_instance (self, opts): return HtmlFilter(self.rules, self.ratings, self.url, **opts) | def new_instance (self, **opts): return HtmlFilter(self.rules, self.ratings, self.url, **opts) | 16,584 |
def cdata (self, data): """character data""" self._debug("cdata %r", data) return self._data(data) | def cdata (self, data): """character data""" debug(FILTER, "%s cdata %r", self, data) return self._data(data) | 16,585 |
def characters (self, data): """characters""" self._debug("characters %r", data) return self._data(data) | def characters (self, data): """characters""" debug(FILTER, "%s characters %r", self, data) return self._data(data) | 16,586 |
def comment (self, data): """a comment; accept only non-empty comments""" if not (self.comments and data): return self._debug("comment %r", data) item = [COMMENT, data] self.htmlparser.tagbuf.append(item) | def comment (self, data): """a comment; accept only non-empty comments""" if not (self.comments and data): return debug(FILTER, "%s comment %r", self, data) item = [COMMENT, data] self.htmlparser.tagbuf.append(item) | 16,587 |
def doctype (self, data): self._debug("doctype %r", data) return self._data("<!DOCTYPE%s>"%data) | def doctype (self, data): debug(FILTER, "%s doctype %r", self, data) return self._data("<!DOCTYPE%s>"%data) | 16,588 |
def pi (self, data): self._debug("pi %r", data) return self._data("<?%s?>"%data) | def pi (self, data): debug(FILTER, "%s pi %r", self, data) return self._data("<?%s?>"%data) | 16,589 |
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 self._debug("startElement %r", tag) tag = check_spelling(tag, self.url) if self.stackcount: if self.stackcount[-1][0]==tag: self.stackcount[-1][1] +=... | 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 debug(FILTER, "%s startElement %r", self, tag) if self._is_waiting([STARTTAG, tag, attrs]): return tag = check_spelling(tag, self.url) if self.stackc... | 16,590 |
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 self._debug("startElement %r", tag) tag = check_spelling(tag, self.url) if self.stackcount: if self.stackcount[-1][0]==tag: self.stackcount[-1][1] +=... | 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 self._debug("startElement %r", tag) tag = check_spelling(tag, self.url) if self.stackcount: if self.stackcount[-1][0]==tag: self.stackcount[-1][1] +=... | 16,591 |
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 self._debug("startElement %r", tag) tag = check_spelling(tag, self.url) if self.stackcount: if self.stackcount[-1][0]==tag: self.stackcount[-1][1] +=... | 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 self._debug("startElement %r", tag) tag = check_spelling(tag, self.url) if self.stackcount: if self.stackcount[-1][0]==tag: self.stackcount[-1][1] +=... | 16,592 |
def _filterStartElement (self, tag, attrs): """filter the start element according to filter rules""" rulelist = [] filtered = False item = [STARTTAG, tag, attrs] for rule in self.rules: if rule.match_tag(tag) and rule.match_attrs(attrs): self._debug("matched rule %r on tag %r", rule.title, tag) if rule.start_sufficient... | def filterStartElement (self, tag, attrs): """filter the start element according to filter rules""" rulelist = [] filtered = False item = [STARTTAG, tag, attrs] for rule in self.rules: if rule.match_tag(tag) and rule.match_attrs(attrs): self._debug("matched rule %r on tag %r", rule.title, tag) if rule.start_sufficient:... | 16,593 |
def _filterStartElement (self, tag, attrs): """filter the start element according to filter rules""" rulelist = [] filtered = False item = [STARTTAG, tag, attrs] for rule in self.rules: if rule.match_tag(tag) and rule.match_attrs(attrs): self._debug("matched rule %r on tag %r", rule.title, tag) if rule.start_sufficient... | def _filterStartElement (self, tag, attrs): """filter the start element according to filter rules""" rulelist = [] filtered = False item = [STARTTAG, tag, attrs] for rule in self.rules: if rule.match_tag(tag) and rule.match_attrs(attrs): debug(FILTER, "%s matched rule %r on tag %r", self, rule.title, tag) if rule.start... | 16,594 |
def _filterStartElement (self, tag, attrs): """filter the start element according to filter rules""" rulelist = [] filtered = False item = [STARTTAG, tag, attrs] for rule in self.rules: if rule.match_tag(tag) and rule.match_attrs(attrs): self._debug("matched rule %r on tag %r", rule.title, tag) if rule.start_sufficient... | def _filterStartElement (self, tag, attrs): """filter the start element according to filter rules""" rulelist = [] filtered = False item = [STARTTAG, tag, attrs] for rule in self.rules: if rule.match_tag(tag) and rule.match_attrs(attrs): self._debug("matched rule %r on tag %r", rule.title, tag) if rule.start_sufficient... | 16,595 |
def _filterStartElement (self, tag, attrs): """filter the start element according to filter rules""" rulelist = [] filtered = False item = [STARTTAG, tag, attrs] for rule in self.rules: if rule.match_tag(tag) and rule.match_attrs(attrs): self._debug("matched rule %r on tag %r", rule.title, tag) if rule.start_sufficient... | def _filterStartElement (self, tag, attrs): """filter the start element according to filter rules""" rulelist = [] filtered = False item = [STARTTAG, tag, attrs] for rule in self.rules: if rule.match_tag(tag) and rule.match_attrs(attrs): self._debug("matched rule %r on tag %r", rule.title, tag) if rule.start_sufficient... | 16,596 |
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. | 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. | 16,597 |
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. | defendElement(self,tag):"""Weknowthefollowing:ifarulematches,itmustbetheoneonthetopofthestack.Sowelookonlyatthetoprule. | 16,598 |
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. | 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. | 16,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.