bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def _xmpp_join_callback(self, errors): """Called by muc._xmpp_presence_handler""" if len(errors) == 0: self.reconnecting = False if self.stopped: return self.bot.error(3, 'succesfully connected on XMPP side of bridge "'+str(self)+'"', debug=True) self.say(say_levels.notice, 'bridge "'+str(self)+'" is running in '+self....
def _xmpp_join_callback(self, errors): """Called by muc._xmpp_presence_handler""" if len(errors) == 0: self.reconnecting = False if self.stopped: return self.bot.error(3, 'succesfully connected on XMPP side of bridge "'+str(self)+'"', debug=True) self.say(say_levels.notice, 'bridge "'+str(self)+'" is running in '+self....
473,500
def send_raw(self, string): """Send raw string to the server.
def send_raw(self, string): """Send raw string to the server.
473,501
def send_raw(self, string): """Send raw string to the server.
def send_raw(self, string): """Send raw string to the server.
473,502
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,503
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,504
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,505
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,506
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,507
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,508
def _xmpp_join_callback(self, errors): if len(errors) == 0: m = '"'+self.nickname+'" duplicate succesfully created on XMPP side of bridge "'+str(self.bridge)+'"' if self.nickname != self.duplicate_nickname: m += ' using nickname "'+self.duplicate_nickname+'"' self.bridge.say(say_levels.info, '"'+self.nickname+'" will a...
def _xmpp_join_callback(self, errors): if len(errors) == 0: m = '"'+self.nickname+'" duplicate succesfully created on XMPP side of bridge "'+str(self.bridge)+'"' if self.nickname != self.duplicate_nickname: m += ' using nickname "'+self.duplicate_nickname+'"' self.bridge.say(say_levels.info, '"'+self.nickname+'" will a...
473,509
def close(self, message, volontary=True): """Close the connection.
def close(self, message, volontary=True): """Close the connection.
473,510
def process_data(self): """[Internal]"""
def process_data(self): """[Internal]"""
473,511
def _xmpp_join_callback(self, errors): if len(errors) == 0: m = '"'+self.nickname+'" duplicate succesfully created on XMPP side of bridge "'+str(self.bridge)+'"' if self.nickname != self.duplicate_nickname: m += ' using nickname "'+self.duplicate_nickname+'"' self.bridge.say(say_levels.info, '"'+self.nickname+'" will a...
def _xmpp_join_callback(self, errors): if len(errors) == 0: m = '"'+self.nickname+'" duplicate succesfully created on XMPP side of bridge "'+str(self.bridge)+'"' if self.nickname != self.duplicate_nickname: m += ' using nickname "'+self.duplicate_nickname+'"' self.bridge.say(say_levels.info, '"'+self.nickname+'" will a...
473,512
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,513
def say_on_xmpp(self, message, action=False): if isinstance(self.xmpp_c, xmpp.client.Client): self.muc.say(message, action=action) elif not isinstance(self.irc_connection, ServerConnection): self.bridge.say_on_behalf(self.nickname, message, 'xmpp', action=action)
def say_on_xmpp(self, message, action=False): if self.muc.connected: self.muc.say(message, action=action) elif not isinstance(self.irc_connection, ServerConnection): self.bridge.say_on_behalf(self.nickname, message, 'xmpp', action=action)
473,514
def say_on_xmpp_to(self, to, message, action=False): if isinstance(self.xmpp_c, xmpp.client.Client): self.muc.say_to(to, message, action=action) elif not isinstance(self.irc_connection, ServerConnection): if self.bridge.mode not in ['normal', 'bypass']: self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB...
def say_on_xmpp_to(self, to, message, action=False): if self.muc.connected: self.muc.say_to(to, message, action=action) elif not isinstance(self.irc_connection, ServerConnection): if self.bridge.mode not in ['normal', 'bypass']: self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but cross-p...
473,515
def say(self, importance, message, on_irc=True, on_xmpp=True, log=False, send_to_admins=False): """Make the bot say something.""" message = self.bot.format_message(importance, message) if log or send_to_admins: self.bot.error(importance, message+' ('+str(self)+')', send_to_admins=send_to_admins) if importance < self.sa...
def say(self, importance, message, on_irc=True, on_xmpp=True, log=False, send_to_admins=False): """Make the bot say something.""" if log or send_to_admins: self.bot.error(importance, message+' ('+str(self)+')', send_to_admins=send_to_admins) if importance < self.say_level: return if on_xmpp == True: self.xmpp_room.say(...
473,516
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,517
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,518
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,519
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse...
473,520
def disconnect_all(self, message=""): """Disconnects all connections.""" for c in self.connections: c.disconnect(message)
def disconnect_all(self, message="", volontary=True): """Disconnects all connections.""" for c in self.connections: c.disconnect(message)
473,521
def disconnect_all(self, message=""): """Disconnects all connections.""" for c in self.connections: c.disconnect(message)
def disconnect_all(self, message=""): """Disconnects all connections.""" for c in self.connections: c.disconnect(message)
473,522
def change_bridges_mode(bot, command, args_array, bridge): parser = ArgumentParser(prog=command) parser.add_argument('bridge_id', nargs='+') parser.add_argument('new_mode', choices=Bridge._modes) try: args = parser.parse_args(args_array) except ArgumentParser.ParseException as e: return '\n'+e.args[1] found_bridges, r...
def change_bridges_mode(bot, command, args_array, bridge): parser = ArgumentParser(prog=command) parser.add_argument('bridge_id', nargs='+') parser.add_argument('new_mode', choices=Bridge._modes) try: args = parser.parse_args(args_array) except ArgumentParser.ParseException as e: return '\n'+e.args[1] found_bridges, r...
473,523
def startTagInput(self, token): self.parser.parseError("unexpected-input-in-select") if not self.tree.elementInScope("select", variant="select"): assert self.parser.innerHTML self.endTagSelect(impliedTagToken("select")) return token
def startTagInput(self, token): self.parser.parseError("unexpected-input-in-select") if self.tree.elementInScope("select", variant="select"): self.endTagSelect(impliedTagToken("select")) return token
473,524
def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"]
def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"]
473,525
def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"]
def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"]
473,526
def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"]
def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"]
473,527
def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"]
def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"]
473,528
def startTagMeta(self, token): self.tree.insertElement(token) self.tree.openElements.pop() token["selfClosingAcknowledged"] = True
def startTagMeta(self, token): self.tree.insertElement(token) self.tree.openElements.pop() token["selfClosingAcknowledged"] = True
473,529
def endTagTableRowGroup(self, token): if self.tree.elementInScope(token["name"], variant="table"): self.endTagTr(impliedTagToken("tr")) return token else: # innerHTML case assert self.parser.innerHTML self.parser.parseError()
def endTagTableRowGroup(self, token): if self.tree.elementInScope(token["name"], variant="table"): self.endTagTr(impliedTagToken("tr")) return token else: # innerHTML caseself.parser.parseError()
473,530
def startswithany(str, prefixes): for prefix in prefixes: if str.startswith(prefix): return True return False
def startswithany(str, prefixes): for prefix in prefixes: if str.startswith(prefix): return True return False
473,531
def __init__(self, tree = simpletree.TreeBuilder, tokenizer = tokenizer.HTMLTokenizer, strict = False, namespaceHTMLElements = True): """ strict - raise an exception when a parse error is encountered
def __init__(self, tree = simpletree.TreeBuilder, tokenizer = tokenizer.HTMLTokenizer, strict = False, namespaceHTMLElements = True, debug=False): """ strict - raise an exception when a parse error is encountered
473,532
def __init__(self, tree = simpletree.TreeBuilder, tokenizer = tokenizer.HTMLTokenizer, strict = False, namespaceHTMLElements = True): """ strict - raise an exception when a parse error is encountered
def __init__(self, tree = simpletree.TreeBuilder, tokenizer = tokenizer.HTMLTokenizer, strict = False, namespaceHTMLElements = True): """ strict - raise an exception when a parse error is encountered
473,533
def log(function): """Logger that records which phase processes each token""" type_names = dict((value, key) for key, value in constants.tokenTypes.iteritems()) def wrapped(self, *args, **kwargs): if function.__name__ != "__init__" and len(args) > 0: token = args[0] try: info = {"type":type_names[token['type']]} except...
def getPhases(debug): def log(function): """Logger that records which phase processes each token""" type_names = dict((value, key) for key, value in constants.tokenTypes.iteritems()) def wrapped(self, *args, **kwargs): if function.__name__ != "__init__" and len(args) > 0: token = args[0] try: info = {"type":type_names[...
473,534
def wrapped(self, *args, **kwargs): if function.__name__ != "__init__" and len(args) > 0: token = args[0] try: info = {"type":type_names[token['type']]} except: print token raise if token['type'] in constants.tagTokenTypes: info["name"] = token['name']
def wrapped(self, *args, **kwargs): if function.__name__ != "__init__" and len(args) > 0: token = args[0] try: info = {"type":type_names[token['type']]} except: print token raise if token['type'] in constants.tagTokenTypes: info["name"] = token['name']
473,535
def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"]
def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"]
473,536
def processEndTag(self, token): if token["name"] not in ("head", "body", "html", "br"): self.parser.parseError("unexpected-end-tag-before-html", {"name": token["name"]}) else: self.insertHtmlElement() self.parser.phase.processEndTag(token)
def processEndTag(self, token): if token["name"] not in ("head", "body", "html", "br"): self.parser.parseError("unexpected-end-tag-before-html", {"name": token["name"]}) self.anythingElse() self.parser.phase.processStartTag(token) def processEndTag(self, token): self.parser.parseError("expected-doctype-but-got-end-tag...
473,537
def processEndTag(self, token): if token["name"] not in ("head", "body", "html", "br"): self.parser.parseError("unexpected-end-tag-before-html", {"name": token["name"]}) else: self.insertHtmlElement() self.parser.phase.processEndTag(token)
def processEndTag(self, token): if token["name"] not in ("head", "body", "html", "br"): self.parser.parseError("unexpected-end-tag-before-html", {"name": token["name"]}) else: self.insertHtmlElement() self.parser.phase.processEndTag(token)
473,538
def processSpaceCharactersDropNewline(self, token): # Sometimes (start of <pre>, <listing>, and <textarea> blocks) we # want to drop leading newlines data = token["data"] self.processSpaceCharacters = self.processSpaceCharactersNonPre if (data.startswith("\n") and self.tree.openElements[-1].name in ("pre", "listing", "...
def processSpaceCharactersDropNewline(self, token): # Sometimes (start of <pre>, <listing>, and <textarea> blocks) we # want to drop leading newlines data = token["data"] self.processSpaceCharacters = self.processSpaceCharactersNonPre if (data.startswith("\n") and self.tree.openElements[-1].name in ("pre", "listing", "...
473,539
def startTagForm(self, token): if self.tree.formPointer: self.parser.parseError(u"unexpected-start-tag", {"name": "form"}) else: if self.tree.elementInScope("p"): self.endTagP(impliedTagToken("p")) self.tree.insertElement(token) self.tree.formPointer = self.tree.openElements[-1]
def startTagForm(self, token): if self.tree.formPointer: self.parser.parseError(u"unexpected-start-tag", {"name": "form"}) else: if self.tree.elementInScope("p"): self.endTagP(impliedTagToken("p")) self.tree.insertElement(token) self.tree.formPointer = self.tree.openElements[-1]
473,540
def startTagListItem(self, token): self.parser.framesetOK = False
def startTagListItem(self, token): self.parser.framesetOK = False
473,541
def startTagNobr(self, token): self.tree.reconstructActiveFormattingElements() if self.tree.elementInScope("nobr"): self.parser.parseError("unexpected-start-tag-implies-end-tag", {"startName": "nobr", "endName": "nobr"}) self.processEndTag(impliedTagToken("nobr")) # XXX Need tests that trigger the following self.tree.r...
def startTagNobr(self, token): self.tree.reconstructActiveFormattingElements() if self.tree.elementInScope("nobr"): self.parser.parseError("unexpected-start-tag-implies-end-tag", {"startName": "nobr", "endName": "nobr"}) self.processEndTag(impliedTagToken("nobr")) # XXX Need tests that trigger the following self.tree.r...
473,542
def startTagButton(self, token): if self.tree.elementInScope("button"): self.parser.parseError("unexpected-start-tag-implies-end-tag", {"startName": "button", "endName": "button"}) self.processEndTag(impliedTagToken("button")) self.parser.phase.processStartTag(token) else: self.tree.reconstructActiveFormattingElements(...
def startTagButton(self, token): if self.tree.elementInScope("button"): self.parser.parseError("unexpected-start-tag-implies-end-tag", {"startName": "button", "endName": "button"}) self.processEndTag(impliedTagToken("button")) self.parser.phase.processStartTag(token) else: self.tree.reconstructActiveFormattingElements(...
473,543
def startTagAppletMarqueeObject(self, token): self.tree.reconstructActiveFormattingElements() self.tree.insertElement(token) self.tree.activeFormattingElements.append(Marker) self.parser.framesetOK = False
def startTagAppletMarqueeObject(self, token): self.tree.reconstructActiveFormattingElements() self.tree.insertElement(token) self.tree.activeFormattingElements.append(Marker) self.parser.framesetOK = False
473,544
def startTagTable(self, token): if self.parser.compatMode != "quirks": if self.tree.elementInScope("p"): self.processEndTag(impliedTagToken("p")) self.tree.insertElement(token) self.parser.framesetOK = False self.parser.phase = self.parser.phases["inTable"]
def startTagTable(self, token): if self.parser.compatMode != "quirks": if self.tree.elementInScope("p"): self.processEndTag(impliedTagToken("p")) self.tree.insertElement(token) self.parser.framesetOK = False self.parser.phase = self.parser.phases["inTable"]
473,545
def startTagMath(self, token): self.tree.reconstructActiveFormattingElements() self.parser.adjustMathMLAttributes(token) self.parser.adjustForeignAttributes(token) token["namespace"] = namespaces["mathml"] self.tree.insertElement(token) #Need to get the parse error right for the case where the token #has a namespace no...
def startTagMath(self, token): self.tree.reconstructActiveFormattingElements() self.parser.adjustMathMLAttributes(token) self.parser.adjustForeignAttributes(token) token["namespace"] = namespaces["mathml"] self.tree.insertElement(token) #Need to get the parse error right for the case where the token #has a namespace no...
473,546
def startTagMisplaced(self, token): """ Elements that should be children of other elements that have a different insertion mode; here they are ignored "caption", "col", "colgroup", "frame", "frameset", "head", "option", "optgroup", "tbody", "td", "tfoot", "th", "thead", "tr", "noscript" """ self.parser.parseError("unex...
def startTagMisplaced(self, token): """ Elements that should be children of other elements that have a different insertion mode; here they are ignored "caption", "col", "colgroup", "frame", "frameset", "head", "option", "optgroup", "tbody", "td", "tfoot", "th", "thead", "tr", "noscript" """ self.parser.parseError("unex...
473,547
def endTagP(self, token): if not self.tree.elementInScope("p"): self.startTagCloseP(impliedTagToken("p", "StartTag")) self.parser.parseError("unexpected-end-tag", {"name": "p"}) self.endTagP(impliedTagToken("p", "EndTag")) else: self.tree.generateImpliedEndTags("p") if self.tree.openElements[-1].name != "p": self.parse...
def endTagP(self, token): if not self.tree.elementInScope("p"): self.startTagCloseP(impliedTagToken("p", "StartTag")) self.parser.parseError("unexpected-end-tag", {"name": "p"}) self.endTagP(impliedTagToken("p", "EndTag")) else: self.tree.generateImpliedEndTags("p") if self.tree.openElements[-1].name != "p": self.parse...
473,548
def endTagP(self, token): if not self.tree.elementInScope("p"): self.startTagCloseP(impliedTagToken("p", "StartTag")) self.parser.parseError("unexpected-end-tag", {"name": "p"}) self.endTagP(impliedTagToken("p", "EndTag")) else: self.tree.generateImpliedEndTags("p") if self.tree.openElements[-1].name != "p": self.parse...
def endTagP(self, token): if not self.tree.elementInScope("p"): self.startTagCloseP(impliedTagToken("p", "StartTag")) self.parser.parseError("unexpected-end-tag", {"name": "p"}) self.endTagP(impliedTagToken("p", "EndTag")) else: self.tree.generateImpliedEndTags("p") if self.tree.openElements[-1].name != "p": self.parse...
473,549
def endTagBody(self, token): if not self.tree.elementInScope("body"): self.parser.parseError() return elif self.tree.openElements[-1].name != "body": for node in self.tree.openElements[2:]: if node.name not in frozenset(("dd", "dt", "li", "optgroup", "option", "p", "rp", "rt", "tbody", "td", "tfoot", "th", "thead", "tr...
def endTagBody(self, token): if not self.tree.elementInScope("body"): self.parser.parseError() return elif self.tree.openElements[-1].name != "body": for node in self.tree.openElements[2:]: if node.name not in frozenset(("dd", "dt", "li", "optgroup", "option", "p", "rp", "rt", "tbody", "td", "tfoot", "th", "thead", "tr...
473,550
def endTagBody(self, token): if not self.tree.elementInScope("body"): self.parser.parseError() return elif self.tree.openElements[-1].name != "body": for node in self.tree.openElements[2:]: if node.name not in frozenset(("dd", "dt", "li", "optgroup", "option", "p", "rp", "rt", "tbody", "td", "tfoot", "th", "thead", "tr...
def endTagBody(self, token): if not self.tree.elementInScope("body"): self.parser.parseError() return elif self.tree.openElements[-1].name != "body": for node in self.tree.openElements[2:]: if node.name not in frozenset(("dd", "dt", "li", "optgroup", "option", "p", "rp", "rt", "tbody", "td", "tfoot", "th", "thead", "tr...
473,551
def endTagListItem(self, token): if token["name"] == "li": variant = "list" else: variant = None if not self.tree.elementInScope(token["name"], variant=variant): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) else: self.tree.generateImpliedEndTags(exclude = token["name"]) if self.tree.openElement...
def endTagListItem(self, token): if token["name"] == "li": variant = "list" else: variant = None if not self.tree.elementInScope(token["name"], variant=variant): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) else: self.tree.generateImpliedEndTags(exclude = token["name"]) if self.tree.openElement...
473,552
def endTagHeading(self, token): for item in headingElements: if self.tree.elementInScope(item): self.tree.generateImpliedEndTags() break if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("end-tag-too-early", {"name": token["name"]})
def endTagHeading(self, token): for item in headingElements: if self.tree.elementInScope(item): self.tree.generateImpliedEndTags() break if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("end-tag-too-early", {"name": token["name"]})
473,553
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
473,554
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
473,555
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
473,556
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
473,557
def endTagAppletMarqueeObject(self, token): if self.tree.elementInScope(token["name"]): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("end-tag-too-early", {"name": token["name"]})
def endTagAppletMarqueeObject(self, token): if self.tree.elementInScope(token["name"]): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("end-tag-too-early", {"name": token["name"]})
473,558
def endTagOther(self, token): for node in self.tree.openElements[::-1]: if node.name == token["name"]: self.tree.generateImpliedEndTags(exclude=token["name"]) if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) while self.tree.openElements.pop() != ...
def endTagOther(self, token): for node in self.tree.openElements[::-1]: if node.name == token["name"]: self.tree.generateImpliedEndTags(exclude=token["name"]) if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) while self.tree.openElements.pop() != ...
473,559
def clearStackToTableContext(self): # "clear the stack back to a table context" while self.tree.openElements[-1].name not in ("table", "html"): #self.parser.parseError("unexpected-implied-end-tag-in-table", # {"name": self.tree.openElements[-1].name}) self.tree.openElements.pop() # When the current node is <html> it'...
def clearStackToTableContext(self): # "clear the stack back to a table context" while self.tree.openElements[-1].name not in ("table", "html"): #self.parser.parseError("unexpected-implied-end-tag-in-table", # {"name": self.tree.openElements[-1].name}) self.tree.openElements.pop() # When the current node is <html> it'...
473,560
def startTagStyleScript(self, token): self.parser.phases["inHead"].processStartTag(token)
def startTagStyleScript(self, token): self.parser.phases["inHead"].processStartTag(token)
473,561
def startTagInput(self, token): if ("type" in token["data"] and token["data"]["type"].translate(asciiUpper2Lower) == "hidden"): self.parser.parseError("unexpected-hidden-input-in-table") self.tree.insertElement(token) # XXX associate with form self.tree.openElements.pop() else: self.startTagOther(token)
def startTagInput(self, token): if ("type" in token["data"] and token["data"]["type"].translate(asciiUpper2Lower) == "hidden"): self.parser.parseError("unexpected-hidden-input-in-table") self.tree.insertElement(token) # XXX associate with form self.tree.openElements.pop() else: self.startTagOther(token)
473,562
def endTagTable(self, token): if self.tree.elementInScope("table", variant="table"): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "table": self.parser.parseError("end-tag-too-early-named", {"gotName": "table", "expectedName": self.tree.openElements[-1].name}) while self.tree.openElements[-1]...
def endTagTable(self, token): if self.tree.elementInScope("table", variant="table"): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "table": self.parser.parseError("end-tag-too-early-named", {"gotName": "table", "expectedName": self.tree.openElements[-1].name}) while self.tree.openElements[-1]...
473,563
def endTagTable(self, token): if self.tree.elementInScope("table", variant="table"): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "table": self.parser.parseError("end-tag-too-early-named", {"gotName": "table", "expectedName": self.tree.openElements[-1].name}) while self.tree.openElements[-1]...
def endTagTable(self, token): if self.tree.elementInScope("table", variant="table"): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "table": self.parser.parseError("end-tag-too-early-named", {"gotName": "table", "expectedName": self.tree.openElements[-1].name}) while self.tree.openElements[-1]...
473,564
def endTagCaption(self, token): if not self.ignoreEndTagCaption(): # AT this code is quite similar to endTagTable in "InTable" self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "caption": self.parser.parseError("expected-one-end-tag-but-got-another", {"gotName": "caption", "expectedName": self.tr...
def endTagCaption(self, token): if not self.ignoreEndTagCaption(): # AT this code is quite similar to endTagTable in "InTable" self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "caption": self.parser.parseError("expected-one-end-tag-but-got-another", {"gotName": "caption", "expectedName": self.tr...
473,565
def endTagCaption(self, token): if not self.ignoreEndTagCaption(): # AT this code is quite similar to endTagTable in "InTable" self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "caption": self.parser.parseError("expected-one-end-tag-but-got-another", {"gotName": "caption", "expectedName": self.tr...
def endTagCaption(self, token): if not self.ignoreEndTagCaption(): # AT this code is quite similar to endTagTable in "InTable" self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "caption": self.parser.parseError("expected-one-end-tag-but-got-another", {"gotName": "caption", "expectedName": self.tr...
473,566
def processEOF(self): if self.tree.openElements[-1].name == "html": assert self.parser.innerHTML return else: ignoreEndTag = self.ignoreEndTagColgroup() self.endTagColgroup(impliedTagToken("colgroup")) if not ignoreEndTag: self.parser.phase.processEOF()
def processEOF(self): if self.tree.openElements[-1].name == "html": assert self.parser.innerHTML return else: ignoreEndTag = self.ignoreEndTagColgroup() self.endTagColgroup(impliedTagToken("colgroup")) if not ignoreEndTag: self.parser.phase.processEOF()
473,567
def endTagColgroup(self, token): if self.ignoreEndTagColgroup(): # innerHTML case assert self.parser.innerHTML self.parser.parseError() else: self.tree.openElements.pop() self.parser.phase = self.parser.phases["inTable"]
def endTagColgroup(self, token): if self.ignoreEndTagColgroup(): # innerHTML case assert self.parser.innerHTML self.parser.parseError() else: self.tree.openElements.pop() self.parser.phase = self.parser.phases["inTable"]
473,568
def endTagTable(self, token): if (self.tree.elementInScope("tbody", variant="table") or self.tree.elementInScope("thead", variant="table") or self.tree.elementInScope("tfoot", variant="table")): self.clearStackToTableBodyContext() self.endTagTableRowGroup( impliedTagToken(self.tree.openElements[-1].name)) self.parser.p...
def endTagOther(self, token): self.parser.phases["inTable"].processEndTag(token) class InRowPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) self.startTagHandler = utils.MethodDispatcher([ ("html", self.startTagHtml), (("td", "th"), self.startTagTableCell), (("caption", "col", "colg...
473,569
def endTagTable(self, token): if (self.tree.elementInScope("tbody", variant="table") or self.tree.elementInScope("thead", variant="table") or self.tree.elementInScope("tfoot", variant="table")): self.clearStackToTableBodyContext() self.endTagTableRowGroup( impliedTagToken(self.tree.openElements[-1].name)) self.parser.p...
def endTagTable(self, token): if (self.tree.elementInScope("tbody", variant="table") or self.tree.elementInScope("thead", variant="table") or self.tree.elementInScope("tfoot", variant="table")): self.clearStackToTableBodyContext() self.endTagTableRowGroup( impliedTagToken(self.tree.openElements[-1].name)) self.parser.p...
473,570
def ignoreEndTagTr(self): return not self.tree.elementInScope("tr", variant="table")
def ignoreEndTagTr(self): return not self.tree.elementInScope("tr", variant="table")
473,571
def startTagOther(self, token): self.parser.phases["inTable"].processStartTag(token)
def startTagOther(self, token): self.parser.phases["inTable"].processStartTag(token)
473,572
def endTagTableRowGroup(self, token): if self.tree.elementInScope(token["name"], variant="table"): self.endTagTr(impliedTagToken("tr")) self.parser.phase.processEndTag(token) else: # innerHTML case assert self.parser.innerHTML self.parser.parseError()
def endTagTableRowGroup(self, token): if self.tree.elementInScope(token["name"], variant="table"): self.endTagTr(impliedTagToken("tr")) self.parser.phase.processEndTag(token) else: # innerHTML case assert self.parser.innerHTML self.parser.parseError()
473,573
def beforeAttributeValueState(self): data = self.stream.char() if data in spaceCharacters: self.stream.charsUntil(spaceCharacters, True) elif data == u"\"": self.state = self.attributeValueDoubleQuotedState elif data == u"&": self.state = self.attributeValueUnQuotedState self.stream.unget(data); elif data == u"'": self...
def beforeAttributeValueState(self): data = self.stream.char() if data in spaceCharacters: self.stream.charsUntil(spaceCharacters, True) elif data == u"\"": self.state = self.attributeValueDoubleQuotedState elif data == u"&": self.state = self.attributeValueUnQuotedState self.stream.unget(data); elif data == u"'": self...
473,574
def attributeValueUnQuotedState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeAttributeNameState elif data == u"&": self.processEntityInAttribute(">") elif data == u">": self.emitCurrentToken() elif data in (u'"', u"'", u"=", u"<", u"`"): self.tokenQueue.append({"type": tokenTypes...
def attributeValueUnQuotedState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeAttributeNameState elif data == u"&": self.processEntityInAttribute(">") elif data == u">": self.emitCurrentToken() elif data in (u'"', u"'", u"=", u"<", u"`"): self.tokenQueue.append({"type": tokenTypes...
473,575
def startswithany(str, prefixes): for prefix in prefixes: if str.startswith(prefix): return True return False
def startswithany(str, prefixes): for prefix in prefixes: if str.startswith(prefix): return True return False
473,576
def processCharacters(self, token): self.tree.reconstructActiveFormattingElements() self.tree.insertText(token["data"]) self.parser.framesetOK = False
def processCharacters(self, token): self.tree.reconstructActiveFormattingElements() self.tree.insertText(token["data"]) self.parser.framesetOK = False
473,577
def endTagHtml(self, token): self.endTagBody(impliedTagToken("body")) if not self.parser.innerHTML: self.parser.phase.processEndTag(token)
def endTagHtml(self, token): if self.tree.elementInScope("body"): self.endTagBody(impliedTagToken("body")) self.parser.phase.processEndTag(token)
473,578
def readChunk(self, chunkSize=None): if chunkSize is None: chunkSize = self._defaultChunkSize
def readChunk(self, chunkSize=None): if chunkSize is None: chunkSize = self._defaultChunkSize
473,579
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
473,580
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
473,581
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
473,582
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
473,583
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
473,584
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select":"inSelect", "td":"inCell", "th":"inCell", "tr":"inRow", "tbody":"inTableBody", "thead":"inTableBody", "tfoot":"inTableBody", "caption":"inCaption", "colgroup":"inColu...
473,585
def __init__(self, parser, tree): Phase.__init__(self, parser, tree)
def __init__(self, parser, tree): Phase.__init__(self, parser, tree)
473,586
def get_absolute_url(self): return ("grid", [self.slug])
defget_absolute_url(self):return("grid",[self.slug])
473,587
def __unicode__(self): return '%s : %s' % (self.grid.slug, self.title)
def __unicode__(self): return '%s : %s' % (self.grid.slug, self.title)
473,588
def __unicode__(self): return self.title
def __unicode__(self): return self.title
473,589
def __unicode__(self): return self.title
def __unicode__(self): return self.title
473,590
def __unicode__(self): if not self.supported: return '%s (unsupported)' % self.title return self.title
def __unicode__(self): if not self.is_supported: return '%s (unsupported)' % self.title return self.title
473,591
def grid_detail(request, slug, template_name="grid/grid_detail.html"): grid = get_object_or_404(Grid, slug=slug) features = grid.feature_set.all() gp = grid.gridpackage_set.select_related('gridpackage', 'package__repo', 'package__category') grid_packages = gp.annotate(usage_count=Count('package__usage')).order_by('-us...
defgrid_detail(request,slug,template_name="grid/grid_detail.html"):grid=get_object_or_404(Grid,slug=slug)features=grid.feature_set.all()gp=grid.gridpackage_set.select_related('gridpackage','package__repo','package__category')grid_packages=gp.annotate(usage_count=Count('package__usage')).order_by('-usage_count','package...
473,592
def update_package(request, slug): package = get_object_or_404(Package, slug=slug) package.fetch_metadata() return HttpResponseRedirect(reverse("package", kwargs={"slug": package.slug}))
def@login_required update_package(request,@login_required slug):@login_required @login_required package@login_required =@login_required get_object_or_404(Package,@login_required slug=slug)@login_required package.fetch_metadata()@login_required @login_required return@login_required HttpResponseRedirect(reverse("package"...
473,593
def add_example(request, slug, template_name="package/add_example.html"): package = get_object_or_404(Package, slug=slug) new_package_example = PackageExample() form = PackageExampleForm(request.POST or None, instance=new_package_example) if form.is_valid(): package_example = PackageExample(package=package, title=req...
def@login_required add_example(request,@login_required slug,@login_required template_name="package/add_example.html"):@login_required @login_required package@login_required =@login_required get_object_or_404(Package,@login_required slug=slug)@login_required new_package_example@login_required =@login_required PackageExa...
473,594
def usage(request, slug, action): success = False # Check if the user is authenticated, redirecting them to the login page if # they're not. if not request.user.is_authenticated(): url = settings.LOGIN_URL + '?next=%s' % reverse('usage', args=(slug, action)) url += urllib.quote_plus('?next=/%s' % request.META['HTTP_REF...
def usage(request, slug, action): success = False # Check if the user is authenticated, redirecting them to the login page if # they're not. if not request.user.is_authenticated(): url = settings.LOGIN_URL + '?next=%s' % reverse('usage', args=(slug, action)) referer = request.META.get('HTTP_REFERER') if referer: url +=...
473,595
def __unicode__(self): if not self.is_supported: return '%s (unsupported)' % self.title return self.title
def __unicode__(self): if not self.is_supported: return '%s (unsupported)' % self.title return self.title
473,596
def update_package(request, slug): package = get_object_or_404(Package, slug=slug) package.fetch_metadata() return HttpResponseRedirect(reverse("package", kwargs={"slug": package.slug}))
def@login_required update_package(request,@login_required slug):@login_required @login_required package@login_required =@login_required get_object_or_404(Package,@login_required slug=slug)@login_required package.fetch_metadata()@login_required @login_required return@login_required HttpResponseRedirect(reverse("package"...
473,597
def add_example(request, slug, template_name="package/add_example.html"): package = get_object_or_404(Package, slug=slug) new_package_example = PackageExample() form = PackageExampleForm(request.POST or None, instance=new_package_example) if form.is_valid(): package_example = PackageExample(package=package, title=req...
def@login_required add_example(request,@login_required slug,@login_required template_name="package/add_example.html"):@login_required @login_required package@login_required =@login_required get_object_or_404(Package,@login_required slug=slug)@login_required new_package_example@login_required =@login_required PackageExa...
473,598
def fetch_metadata(self, *args, **kwargs): # Get the downloads from pypi if self.pypi_url.strip() and self.pypi_url != "http://pypi.python.org/pypi/": total_downloads = 0 for release in fetch_releases(self.pypi_name()): version, created = Version.objects.get_or_create( package = self, number = release.version )
def fetch_metadata(self, *args, **kwargs): # Get the downloads from pypi if self.pypi_url.strip() and self.pypi_url != "http://pypi.python.org/pypi/": total_downloads = 0 for release in fetch_releases(self.pypi_name()): version, created = Version.objects.get_or_create( package = self, number = release.version )
473,599