repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Parser.py
IndexedAdvancedHTMLParser.getElementById
def getElementById(self, _id, root='root', useIndex=True): ''' getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search sta...
python
def getElementById(self, _id, root='root', useIndex=True): ''' getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search sta...
[ "def", "getElementById", "(", "self", ",", "_id", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "if", "self", ".", "useIndex", "is", "Tru...
getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root', the root of the parsed tre...
[ "getElementById", "-", "Searches", "and", "returns", "the", "first", "(", "should", "only", "be", "one", ")", "element", "with", "the", "given", "ID", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1229-L1251
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Parser.py
IndexedAdvancedHTMLParser.getElementsByClassName
def getElementsByClassName(self, className, root='root', useIndex=True): ''' getElementsByClassName - Searches and returns all elements containing a given class name. @param className <str> - A one-word class name @param root <AdvancedTag/'root'> - Sea...
python
def getElementsByClassName(self, className, root='root', useIndex=True): ''' getElementsByClassName - Searches and returns all elements containing a given class name. @param className <str> - A one-word class name @param root <AdvancedTag/'root'> - Sea...
[ "def", "getElementsByClassName", "(", "self", ",", "className", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "if", "useIndex", "is", "True",...
getElementsByClassName - Searches and returns all elements containing a given class name. @param className <str> - A one-word class name @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root', the root of the parsed tree will ...
[ "getElementsByClassName", "-", "Searches", "and", "returns", "all", "elements", "containing", "a", "given", "class", "name", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1254-L1274
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Parser.py
IndexedAdvancedHTMLParser.getElementsByAttr
def getElementsByAttr(self, attrName, attrValue, root='root', useIndex=True): ''' getElementsByAttr - Searches the full tree for elements with a given attribute name and value combination. If you want multiple potential values, see getElementsWithAttrValues If you want an index on a r...
python
def getElementsByAttr(self, attrName, attrValue, root='root', useIndex=True): ''' getElementsByAttr - Searches the full tree for elements with a given attribute name and value combination. If you want multiple potential values, see getElementsWithAttrValues If you want an index on a r...
[ "def", "getElementsByAttr", "(", "self", ",", "attrName", ",", "attrValue", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "if", "useIndex", ...
getElementsByAttr - Searches the full tree for elements with a given attribute name and value combination. If you want multiple potential values, see getElementsWithAttrValues If you want an index on a random attribute, use the addIndexOnAttribute function. @param attrName...
[ "getElementsByAttr", "-", "Searches", "the", "full", "tree", "for", "elements", "with", "a", "given", "attribute", "name", "and", "value", "combination", ".", "If", "you", "want", "multiple", "potential", "values", "see", "getElementsWithAttrValues", "If", "you", ...
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1277-L1299
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Parser.py
IndexedAdvancedHTMLParser.getElementsWithAttrValues
def getElementsWithAttrValues(self, attrName, values, root='root', useIndex=True): ''' getElementsWithAttrValues - Returns elements with an attribute matching one of several values. For a single name/value combination, see getElementsByAttr @param attrName <lowercase str> - A lowerc...
python
def getElementsWithAttrValues(self, attrName, values, root='root', useIndex=True): ''' getElementsWithAttrValues - Returns elements with an attribute matching one of several values. For a single name/value combination, see getElementsByAttr @param attrName <lowercase str> - A lowerc...
[ "def", "getElementsWithAttrValues", "(", "self", ",", "attrName", ",", "values", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "_otherAttribute...
getElementsWithAttrValues - Returns elements with an attribute matching one of several values. For a single name/value combination, see getElementsByAttr @param attrName <lowercase str> - A lowercase attribute name @param attrValues set<str> - List of expected values of attribute ...
[ "getElementsWithAttrValues", "-", "Returns", "elements", "with", "an", "attribute", "matching", "one", "of", "several", "values", ".", "For", "a", "single", "name", "/", "value", "combination", "see", "getElementsByAttr" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1302-L1323
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
uniqueTags
def uniqueTags(tagList): ''' uniqueTags - Returns the unique tags in tagList. @param tagList list<AdvancedTag> : A list of tag objects. ''' ret = [] alreadyAdded = set() for tag in tagList: myUid = tag.getUid() if myUid in alreadyAdded: contin...
python
def uniqueTags(tagList): ''' uniqueTags - Returns the unique tags in tagList. @param tagList list<AdvancedTag> : A list of tag objects. ''' ret = [] alreadyAdded = set() for tag in tagList: myUid = tag.getUid() if myUid in alreadyAdded: contin...
[ "def", "uniqueTags", "(", "tagList", ")", ":", "ret", "=", "[", "]", "alreadyAdded", "=", "set", "(", ")", "for", "tag", "in", "tagList", ":", "myUid", "=", "tag", ".", "getUid", "(", ")", "if", "myUid", "in", "alreadyAdded", ":", "continue", "ret", ...
uniqueTags - Returns the unique tags in tagList. @param tagList list<AdvancedTag> : A list of tag objects.
[ "uniqueTags", "-", "Returns", "the", "unique", "tags", "in", "tagList", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L47-L60
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
toggleAttributesDOM
def toggleAttributesDOM(isEnabled): ''' toggleAttributesDOM - Toggle if the old DOM tag.attributes NamedNodeMap model should be used for the .attributes method, versus a more sane direct dict implementation. The DOM version is always accessable as AdvancedTag.attributesDOM ...
python
def toggleAttributesDOM(isEnabled): ''' toggleAttributesDOM - Toggle if the old DOM tag.attributes NamedNodeMap model should be used for the .attributes method, versus a more sane direct dict implementation. The DOM version is always accessable as AdvancedTag.attributesDOM ...
[ "def", "toggleAttributesDOM", "(", "isEnabled", ")", ":", "if", "isEnabled", ":", "AdvancedTag", ".", "attributes", "=", "AdvancedTag", ".", "attributesDOM", "else", ":", "AdvancedTag", ".", "attributes", "=", "AdvancedTag", ".", "attributesDict" ]
toggleAttributesDOM - Toggle if the old DOM tag.attributes NamedNodeMap model should be used for the .attributes method, versus a more sane direct dict implementation. The DOM version is always accessable as AdvancedTag.attributesDOM The dict version is always accessable as Advanced...
[ "toggleAttributesDOM", "-", "Toggle", "if", "the", "old", "DOM", "tag", ".", "attributes", "NamedNodeMap", "model", "should", "be", "used", "for", "the", ".", "attributes", "method", "versus" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L62-L79
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.cloneNode
def cloneNode(self): ''' cloneNode - Clone this node (tag name and attributes). Does not clone children. Tags will be equal according to isTagEqual method, but will contain a different internal unique id such tag origTag != origTag.cloneNode() , as is the case in JS DOM. ...
python
def cloneNode(self): ''' cloneNode - Clone this node (tag name and attributes). Does not clone children. Tags will be equal according to isTagEqual method, but will contain a different internal unique id such tag origTag != origTag.cloneNode() , as is the case in JS DOM. ...
[ "def", "cloneNode", "(", "self", ")", ":", "return", "self", ".", "__class__", "(", "self", ".", "tagName", ",", "self", ".", "getAttributesList", "(", ")", ",", "self", ".", "isSelfClosing", ")" ]
cloneNode - Clone this node (tag name and attributes). Does not clone children. Tags will be equal according to isTagEqual method, but will contain a different internal unique id such tag origTag != origTag.cloneNode() , as is the case in JS DOM.
[ "cloneNode", "-", "Clone", "this", "node", "(", "tag", "name", "and", "attributes", ")", ".", "Does", "not", "clone", "children", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L341-L348
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.appendText
def appendText(self, text): ''' appendText - append some inner text ''' # self.text is just raw string of the text self.text += text self.isSelfClosing = False # inner text means it can't self close anymo # self.blocks is either text or tags, in order of appea...
python
def appendText(self, text): ''' appendText - append some inner text ''' # self.text is just raw string of the text self.text += text self.isSelfClosing = False # inner text means it can't self close anymo # self.blocks is either text or tags, in order of appea...
[ "def", "appendText", "(", "self", ",", "text", ")", ":", "# self.text is just raw string of the text", "self", ".", "text", "+=", "text", "self", ".", "isSelfClosing", "=", "False", "# inner text means it can't self close anymo", "# self.blocks is either text or tags, in orde...
appendText - append some inner text
[ "appendText", "-", "append", "some", "inner", "text" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L408-L416
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.removeText
def removeText(self, text): ''' removeText - Removes the first occurace of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return text <str/None> - The text in that block (text node) after remove, or None if not found NOTE...
python
def removeText(self, text): ''' removeText - Removes the first occurace of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return text <str/None> - The text in that block (text node) after remove, or None if not found NOTE...
[ "def", "removeText", "(", "self", ",", "text", ")", ":", "# TODO: This would be a good candidate for the refactor of text blocks", "removedBlock", "=", "None", "# Scan all text blocks for \"text\"", "blocks", "=", "self", ".", "blocks", "for", "i", "in", "range", "(", "...
removeText - Removes the first occurace of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return text <str/None> - The text in that block (text node) after remove, or None if not found NOTE: To remove a node, @see removeChild NOT...
[ "removeText", "-", "Removes", "the", "first", "occurace", "of", "given", "text", "in", "a", "text", "node", "(", "i", ".", "e", ".", "not", "part", "of", "a", "tag", ")" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L419-L456
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.removeTextAll
def removeTextAll(self, text): ''' removeTextAll - Removes ALL occuraces of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return list <str> - All text node containing #text BEFORE the text was removed. Empty list if n...
python
def removeTextAll(self, text): ''' removeTextAll - Removes ALL occuraces of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return list <str> - All text node containing #text BEFORE the text was removed. Empty list if n...
[ "def", "removeTextAll", "(", "self", ",", "text", ")", ":", "# TODO: This would be a good candidate for the refactor of text blocks", "removedBlocks", "=", "[", "]", "blocks", "=", "self", ".", "blocks", "for", "i", "in", "range", "(", "len", "(", "blocks", ")", ...
removeTextAll - Removes ALL occuraces of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return list <str> - All text node containing #text BEFORE the text was removed. Empty list if no text removed NOTE: To remove a node, @se...
[ "removeTextAll", "-", "Removes", "ALL", "occuraces", "of", "given", "text", "in", "a", "text", "node", "(", "i", ".", "e", ".", "not", "part", "of", "a", "tag", ")" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L459-L495
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.remove
def remove(self): ''' remove - Will remove this node from its parent, if it has a parent (thus taking it out of the HTML tree) NOTE: If you are using an IndexedAdvancedHTMLParser, calling this will NOT update the index. You MUST call reindex method manually. ...
python
def remove(self): ''' remove - Will remove this node from its parent, if it has a parent (thus taking it out of the HTML tree) NOTE: If you are using an IndexedAdvancedHTMLParser, calling this will NOT update the index. You MUST call reindex method manually. ...
[ "def", "remove", "(", "self", ")", ":", "if", "self", ".", "parentNode", ":", "self", ".", "parentNode", ".", "removeChild", "(", "self", ")", "# self.parentNode will now be None by 'removeChild' method", "return", "True", "return", "False" ]
remove - Will remove this node from its parent, if it has a parent (thus taking it out of the HTML tree) NOTE: If you are using an IndexedAdvancedHTMLParser, calling this will NOT update the index. You MUST call reindex method manually. @return <bool> - While JS DOM defin...
[ "remove", "-", "Will", "remove", "this", "node", "from", "its", "parent", "if", "it", "has", "a", "parent", "(", "thus", "taking", "it", "out", "of", "the", "HTML", "tree", ")" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L498-L512
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.removeBlocks
def removeBlocks(self, blocks): ''' removeBlock - Removes a list of blocks (the first occurance of each) from the direct children of this node. @param blocks list<str/AdvancedTag> - List of AdvancedTags for tag nodes, else strings for text nodes @return The removed blocks ...
python
def removeBlocks(self, blocks): ''' removeBlock - Removes a list of blocks (the first occurance of each) from the direct children of this node. @param blocks list<str/AdvancedTag> - List of AdvancedTags for tag nodes, else strings for text nodes @return The removed blocks ...
[ "def", "removeBlocks", "(", "self", ",", "blocks", ")", ":", "ret", "=", "[", "]", "for", "block", "in", "blocks", ":", "if", "issubclass", "(", "block", ".", "__class__", ",", "AdvancedTag", ")", ":", "ret", ".", "append", "(", "self", ".", "removeC...
removeBlock - Removes a list of blocks (the first occurance of each) from the direct children of this node. @param blocks list<str/AdvancedTag> - List of AdvancedTags for tag nodes, else strings for text nodes @return The removed blocks in each slot, or None if None removed. @see...
[ "removeBlock", "-", "Removes", "a", "list", "of", "blocks", "(", "the", "first", "occurance", "of", "each", ")", "from", "the", "direct", "children", "of", "this", "node", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L515-L536
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.appendChild
def appendChild(self, child): ''' appendChild - Append a child to this element. @param child <AdvancedTag> - Append a child element to this element ''' # Associate parentNode of #child to this tag child.parentNode = self # Associate owner document to ch...
python
def appendChild(self, child): ''' appendChild - Append a child to this element. @param child <AdvancedTag> - Append a child element to this element ''' # Associate parentNode of #child to this tag child.parentNode = self # Associate owner document to ch...
[ "def", "appendChild", "(", "self", ",", "child", ")", ":", "# Associate parentNode of #child to this tag", "child", ".", "parentNode", "=", "self", "# Associate owner document to child and all children recursive", "ownerDocument", "=", "self", ".", "ownerDocument", "child", ...
appendChild - Append a child to this element. @param child <AdvancedTag> - Append a child element to this element
[ "appendChild", "-", "Append", "a", "child", "to", "this", "element", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L538-L561
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.appendBlock
def appendBlock(self, block): ''' append / appendBlock - Append a block to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param <str/AdvancedTag> - block to add @return - #block NOTE: To add multiple blocks, @see appendBlocks ...
python
def appendBlock(self, block): ''' append / appendBlock - Append a block to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param <str/AdvancedTag> - block to add @return - #block NOTE: To add multiple blocks, @see appendBlocks ...
[ "def", "appendBlock", "(", "self", ",", "block", ")", ":", "# Determine block type and call appropriate method", "if", "isinstance", "(", "block", ",", "AdvancedTag", ")", ":", "self", ".", "appendNode", "(", "block", ")", "else", ":", "self", ".", "appendText",...
append / appendBlock - Append a block to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param <str/AdvancedTag> - block to add @return - #block NOTE: To add multiple blocks, @see appendBlocks If you know the type, use either @see...
[ "append", "/", "appendBlock", "-", "Append", "a", "block", "to", "this", "element", ".", "A", "block", "can", "be", "a", "string", "(", "text", "node", ")", "or", "an", "AdvancedTag", "(", "tag", "node", ")" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L567-L584
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.appendBlocks
def appendBlocks(self, blocks): ''' appendBlocks - Append blocks to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param blocks list<str/AdvancedTag> - A list, in order to append, of blocks to add. @return - #blocks NOTE: To ad...
python
def appendBlocks(self, blocks): ''' appendBlocks - Append blocks to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param blocks list<str/AdvancedTag> - A list, in order to append, of blocks to add. @return - #blocks NOTE: To ad...
[ "def", "appendBlocks", "(", "self", ",", "blocks", ")", ":", "for", "block", "in", "blocks", ":", "if", "isinstance", "(", "block", ",", "AdvancedTag", ")", ":", "self", ".", "appendNode", "(", "block", ")", "else", ":", "self", ".", "appendText", "(",...
appendBlocks - Append blocks to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param blocks list<str/AdvancedTag> - A list, in order to append, of blocks to add. @return - #blocks NOTE: To add a single block, @see appendBlock If ...
[ "appendBlocks", "-", "Append", "blocks", "to", "this", "element", ".", "A", "block", "can", "be", "a", "string", "(", "text", "node", ")", "or", "an", "AdvancedTag", "(", "tag", "node", ")" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L590-L607
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.appendInnerHTML
def appendInnerHTML(self, html): ''' appendInnerHTML - Appends nodes from arbitrary HTML as if doing element.innerHTML += 'someHTML' in javascript. @param html <str> - Some HTML NOTE: If associated with a document ( AdvancedHTMLParser ), the html will use the encoding assoc...
python
def appendInnerHTML(self, html): ''' appendInnerHTML - Appends nodes from arbitrary HTML as if doing element.innerHTML += 'someHTML' in javascript. @param html <str> - Some HTML NOTE: If associated with a document ( AdvancedHTMLParser ), the html will use the encoding assoc...
[ "def", "appendInnerHTML", "(", "self", ",", "html", ")", ":", "# Late-binding to prevent circular import", "from", ".", "Parser", "import", "AdvancedHTMLParser", "# Inherit encoding from the associated document, if any.", "encoding", "=", "None", "if", "self", ".", "ownerDo...
appendInnerHTML - Appends nodes from arbitrary HTML as if doing element.innerHTML += 'someHTML' in javascript. @param html <str> - Some HTML NOTE: If associated with a document ( AdvancedHTMLParser ), the html will use the encoding associated with that document. ...
[ "appendInnerHTML", "-", "Appends", "nodes", "from", "arbitrary", "HTML", "as", "if", "doing", "element", ".", "innerHTML", "+", "=", "someHTML", "in", "javascript", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L610-L635
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.removeChild
def removeChild(self, child): ''' removeChild - Remove a child tag, if present. @param child <AdvancedTag> - The child to remove @return - The child [with parentNode cleared] if removed, otherwise None. NOTE: This removes a tag. If removing a text b...
python
def removeChild(self, child): ''' removeChild - Remove a child tag, if present. @param child <AdvancedTag> - The child to remove @return - The child [with parentNode cleared] if removed, otherwise None. NOTE: This removes a tag. If removing a text b...
[ "def", "removeChild", "(", "self", ",", "child", ")", ":", "try", ":", "# Remove from children and blocks", "self", ".", "children", ".", "remove", "(", "child", ")", "self", ".", "blocks", ".", "remove", "(", "child", ")", "# Clear parent node association on ch...
removeChild - Remove a child tag, if present. @param child <AdvancedTag> - The child to remove @return - The child [with parentNode cleared] if removed, otherwise None. NOTE: This removes a tag. If removing a text block, use #removeText function. If y...
[ "removeChild", "-", "Remove", "a", "child", "tag", "if", "present", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L638-L668
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.removeChildren
def removeChildren(self, children): ''' removeChildren - Remove multiple child AdvancedTags. @see removeChild @return list<AdvancedTag/None> - A list of all tags removed in same order as passed. Item is "None" if it was not attached to this node, and thus wa...
python
def removeChildren(self, children): ''' removeChildren - Remove multiple child AdvancedTags. @see removeChild @return list<AdvancedTag/None> - A list of all tags removed in same order as passed. Item is "None" if it was not attached to this node, and thus wa...
[ "def", "removeChildren", "(", "self", ",", "children", ")", ":", "ret", "=", "[", "]", "for", "child", "in", "children", ":", "ret", ".", "append", "(", "self", ".", "removeChild", "(", "child", ")", ")", "return", "ret" ]
removeChildren - Remove multiple child AdvancedTags. @see removeChild @return list<AdvancedTag/None> - A list of all tags removed in same order as passed. Item is "None" if it was not attached to this node, and thus was not removed.
[ "removeChildren", "-", "Remove", "multiple", "child", "AdvancedTags", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L673-L687
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.removeBlock
def removeBlock(self, block): ''' removeBlock - Removes a single block (text node or AdvancedTag) which is a child of this object. @param block <str/AdvancedTag> - The block (text node or AdvancedTag) to remove. @return Returns the removed block if one was remov...
python
def removeBlock(self, block): ''' removeBlock - Removes a single block (text node or AdvancedTag) which is a child of this object. @param block <str/AdvancedTag> - The block (text node or AdvancedTag) to remove. @return Returns the removed block if one was remov...
[ "def", "removeBlock", "(", "self", ",", "block", ")", ":", "if", "issubclass", "(", "block", ".", "__class__", ",", "AdvancedTag", ")", ":", "return", "self", ".", "removeChild", "(", "block", ")", "else", ":", "return", "self", ".", "removeText", "(", ...
removeBlock - Removes a single block (text node or AdvancedTag) which is a child of this object. @param block <str/AdvancedTag> - The block (text node or AdvancedTag) to remove. @return Returns the removed block if one was removed, or None if requested block is not a child of this ...
[ "removeBlock", "-", "Removes", "a", "single", "block", "(", "text", "node", "or", "AdvancedTag", ")", "which", "is", "a", "child", "of", "this", "object", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L690-L706
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.insertBefore
def insertBefore(self, child, beforeChild): ''' insertBefore - Inserts a child before #beforeChild @param child <AdvancedTag/str> - Child block to insert @param beforeChild <AdvancedTag/str> - Child block to insert before. if None, will be appended @r...
python
def insertBefore(self, child, beforeChild): ''' insertBefore - Inserts a child before #beforeChild @param child <AdvancedTag/str> - Child block to insert @param beforeChild <AdvancedTag/str> - Child block to insert before. if None, will be appended @r...
[ "def", "insertBefore", "(", "self", ",", "child", ",", "beforeChild", ")", ":", "# When the second arg is null/None, the node is appended. The argument is required per JS API, but null is acceptable..", "if", "beforeChild", "is", "None", ":", "return", "self", ".", "appendBlock...
insertBefore - Inserts a child before #beforeChild @param child <AdvancedTag/str> - Child block to insert @param beforeChild <AdvancedTag/str> - Child block to insert before. if None, will be appended @return - The added child. Note, if it is a text block (str), the retu...
[ "insertBefore", "-", "Inserts", "a", "child", "before", "#beforeChild" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L710-L749
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.insertAfter
def insertAfter(self, child, afterChild): ''' insertAfter - Inserts a child after #afterChild @param child <AdvancedTag/str> - Child block to insert @param afterChild <AdvancedTag/str> - Child block to insert after. if None, will be appended @return -...
python
def insertAfter(self, child, afterChild): ''' insertAfter - Inserts a child after #afterChild @param child <AdvancedTag/str> - Child block to insert @param afterChild <AdvancedTag/str> - Child block to insert after. if None, will be appended @return -...
[ "def", "insertAfter", "(", "self", ",", "child", ",", "afterChild", ")", ":", "# If after child is null/None, just append", "if", "afterChild", "is", "None", ":", "return", "self", ".", "appendBlock", "(", "child", ")", "isChildTag", "=", "isTagNode", "(", "chil...
insertAfter - Inserts a child after #afterChild @param child <AdvancedTag/str> - Child block to insert @param afterChild <AdvancedTag/str> - Child block to insert after. if None, will be appended @return - The added child. Note, if it is a text block (str), the return is...
[ "insertAfter", "-", "Inserts", "a", "child", "after", "#afterChild" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L751-L785
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.firstChild
def firstChild(self): ''' firstChild - property, Get the first child block, text or tag. @return <str/AdvancedTag/None> - The first child block, or None if no child blocks ''' blocks = object.__getattribute__(self, 'blocks') # First block is empty string for ...
python
def firstChild(self): ''' firstChild - property, Get the first child block, text or tag. @return <str/AdvancedTag/None> - The first child block, or None if no child blocks ''' blocks = object.__getattribute__(self, 'blocks') # First block is empty string for ...
[ "def", "firstChild", "(", "self", ")", ":", "blocks", "=", "object", ".", "__getattribute__", "(", "self", ",", "'blocks'", ")", "# First block is empty string for indent, but don't hardcode incase that changes", "if", "blocks", "[", "0", "]", "==", "''", ":", "firs...
firstChild - property, Get the first child block, text or tag. @return <str/AdvancedTag/None> - The first child block, or None if no child blocks
[ "firstChild", "-", "property", "Get", "the", "first", "child", "block", "text", "or", "tag", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L860-L877
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.lastChild
def lastChild(self): ''' lastChild - property, Get the last child block, text or tag @return <str/AdvancedTag/None> - The last child block, or None if no child blocks ''' blocks = object.__getattribute__(self, 'blocks') # First block is empty string for inden...
python
def lastChild(self): ''' lastChild - property, Get the last child block, text or tag @return <str/AdvancedTag/None> - The last child block, or None if no child blocks ''' blocks = object.__getattribute__(self, 'blocks') # First block is empty string for inden...
[ "def", "lastChild", "(", "self", ")", ":", "blocks", "=", "object", ".", "__getattribute__", "(", "self", ",", "'blocks'", ")", "# First block is empty string for indent, but don't hardcode incase that changes", "if", "blocks", "[", "0", "]", "==", "''", ":", "first...
lastChild - property, Get the last child block, text or tag @return <str/AdvancedTag/None> - The last child block, or None if no child blocks
[ "lastChild", "-", "property", "Get", "the", "last", "child", "block", "text", "or", "tag" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L895-L911
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.nextSibling
def nextSibling(self): ''' nextSibling - Returns the next sibling. This is the child following this node in the parent's list of children. This could be text or an element. use nextSiblingElement to ensure element @return <None/str/AdvancedTag> - None if there a...
python
def nextSibling(self): ''' nextSibling - Returns the next sibling. This is the child following this node in the parent's list of children. This could be text or an element. use nextSiblingElement to ensure element @return <None/str/AdvancedTag> - None if there a...
[ "def", "nextSibling", "(", "self", ")", ":", "parentNode", "=", "self", ".", "parentNode", "# If no parent, no siblings.", "if", "not", "parentNode", ":", "return", "None", "# Determine index in blocks", "myBlockIdx", "=", "parentNode", ".", "blocks", ".", "index", ...
nextSibling - Returns the next sibling. This is the child following this node in the parent's list of children. This could be text or an element. use nextSiblingElement to ensure element @return <None/str/AdvancedTag> - None if there are no nodes (text or tag) in the parent after t...
[ "nextSibling", "-", "Returns", "the", "next", "sibling", ".", "This", "is", "the", "child", "following", "this", "node", "in", "the", "parent", "s", "list", "of", "children", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L929-L952
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.nextElementSibling
def nextElementSibling(self): ''' nextElementSibling - Returns the next sibling that is an element. This is the tag node following this node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag) in the parent after this nod...
python
def nextElementSibling(self): ''' nextElementSibling - Returns the next sibling that is an element. This is the tag node following this node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag) in the parent after this nod...
[ "def", "nextElementSibling", "(", "self", ")", ":", "parentNode", "=", "self", ".", "parentNode", "# If no parent, no siblings", "if", "not", "parentNode", ":", "return", "None", "# Determine the index in children", "myElementIdx", "=", "parentNode", ".", "children", ...
nextElementSibling - Returns the next sibling that is an element. This is the tag node following this node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag) in the parent after this node, ...
[ "nextElementSibling", "-", "Returns", "the", "next", "sibling", "that", "is", "an", "element", ".", "This", "is", "the", "tag", "node", "following", "this", "node", "in", "the", "parent", "s", "list", "of", "children" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L955-L977
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.previousSibling
def previousSibling(self): ''' previousSibling - Returns the previous sibling. This would be the previous node (text or tag) in the parent's list This could be text or an element. use previousSiblingElement to ensure element @return <None/str/AdvancedTa...
python
def previousSibling(self): ''' previousSibling - Returns the previous sibling. This would be the previous node (text or tag) in the parent's list This could be text or an element. use previousSiblingElement to ensure element @return <None/str/AdvancedTa...
[ "def", "previousSibling", "(", "self", ")", ":", "parentNode", "=", "self", ".", "parentNode", "# If no parent, no previous sibling", "if", "not", "parentNode", ":", "return", "None", "# Determine block index on parent of this node", "myBlockIdx", "=", "parentNode", ".", ...
previousSibling - Returns the previous sibling. This would be the previous node (text or tag) in the parent's list This could be text or an element. use previousSiblingElement to ensure element @return <None/str/AdvancedTag> - None if there are no nodes (text or tag) in th...
[ "previousSibling", "-", "Returns", "the", "previous", "sibling", ".", "This", "would", "be", "the", "previous", "node", "(", "text", "or", "tag", ")", "in", "the", "parent", "s", "list", "This", "could", "be", "text", "or", "an", "element", ".", "use", ...
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L982-L1006
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.previousElementSibling
def previousElementSibling(self): ''' previousElementSibling - Returns the previous sibling that is an element. This is the previous tag node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag...
python
def previousElementSibling(self): ''' previousElementSibling - Returns the previous sibling that is an element. This is the previous tag node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag...
[ "def", "previousElementSibling", "(", "self", ")", ":", "parentNode", "=", "self", ".", "parentNode", "# If no parent, no siblings", "if", "not", "parentNode", ":", "return", "None", "# Determine this node's index in the children of parent", "myElementIdx", "=", "parentNode...
previousElementSibling - Returns the previous sibling that is an element. This is the previous tag node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag) in the parent before this node, ...
[ "previousElementSibling", "-", "Returns", "the", "previous", "sibling", "that", "is", "an", "element", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1009-L1034
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.tagBlocks
def tagBlocks(self): ''' tagBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a tag (not text) NOTE: This is similar to .children , and you should probably use .children instead except within this class its...
python
def tagBlocks(self): ''' tagBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a tag (not text) NOTE: This is similar to .children , and you should probably use .children instead except within this class its...
[ "def", "tagBlocks", "(", "self", ")", ":", "myBlocks", "=", "self", ".", "blocks", "return", "[", "block", "for", "block", "in", "myBlocks", "if", "issubclass", "(", "block", ".", "__class__", ",", "AdvancedTag", ")", "]" ]
tagBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a tag (not text) NOTE: This is similar to .children , and you should probably use .children instead except within this class itself @return list<AdvancedTag...
[ "tagBlocks", "-", "Property", ".", "Returns", "all", "the", "blocks", "which", "are", "direct", "children", "of", "this", "node", "where", "that", "block", "is", "a", "tag", "(", "not", "text", ")" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1040-L1051
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getBlocksTags
def getBlocksTags(self): ''' getBlocksTags - Returns a list of tuples referencing the blocks which are direct children of this node, and the block is an AdvancedTag. The tuples are ( block, blockIdx ) where "blockIdx" is the index of self.blocks wherein the tag resides. ...
python
def getBlocksTags(self): ''' getBlocksTags - Returns a list of tuples referencing the blocks which are direct children of this node, and the block is an AdvancedTag. The tuples are ( block, blockIdx ) where "blockIdx" is the index of self.blocks wherein the tag resides. ...
[ "def", "getBlocksTags", "(", "self", ")", ":", "myBlocks", "=", "self", ".", "blocks", "return", "[", "(", "myBlocks", "[", "i", "]", ",", "i", ")", "for", "i", "in", "range", "(", "len", "(", "myBlocks", ")", ")", "if", "issubclass", "(", "myBlock...
getBlocksTags - Returns a list of tuples referencing the blocks which are direct children of this node, and the block is an AdvancedTag. The tuples are ( block, blockIdx ) where "blockIdx" is the index of self.blocks wherein the tag resides. @return list< tuple(block, blockIdx) > - A l...
[ "getBlocksTags", "-", "Returns", "a", "list", "of", "tuples", "referencing", "the", "blocks", "which", "are", "direct", "children", "of", "this", "node", "and", "the", "block", "is", "an", "AdvancedTag", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1054-L1064
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.textBlocks
def textBlocks(self): ''' textBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a text (not a tag) @return list<AdvancedTag> - A list of direct children which are text. ''' myBlocks = self.b...
python
def textBlocks(self): ''' textBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a text (not a tag) @return list<AdvancedTag> - A list of direct children which are text. ''' myBlocks = self.b...
[ "def", "textBlocks", "(", "self", ")", ":", "myBlocks", "=", "self", ".", "blocks", "return", "[", "block", "for", "block", "in", "myBlocks", "if", "not", "issubclass", "(", "block", ".", "__class__", ",", "AdvancedTag", ")", "]" ]
textBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a text (not a tag) @return list<AdvancedTag> - A list of direct children which are text.
[ "textBlocks", "-", "Property", ".", "Returns", "all", "the", "blocks", "which", "are", "direct", "children", "of", "this", "node", "where", "that", "block", "is", "a", "text", "(", "not", "a", "tag", ")" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1068-L1077
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.textContent
def textContent(self): ''' textContent - property, gets the text of this node and all inner nodes. Use .innerText for just this node's text @return <str> - The text of all nodes at this level or lower ''' def _collateText(curNode): ''' ...
python
def textContent(self): ''' textContent - property, gets the text of this node and all inner nodes. Use .innerText for just this node's text @return <str> - The text of all nodes at this level or lower ''' def _collateText(curNode): ''' ...
[ "def", "textContent", "(", "self", ")", ":", "def", "_collateText", "(", "curNode", ")", ":", "'''\n _collateText - Recursive function to gather the \"text\" of all blocks\n\n in the order that they appear\n\n @param curNode <...
textContent - property, gets the text of this node and all inner nodes. Use .innerText for just this node's text @return <str> - The text of all nodes at this level or lower
[ "textContent", "-", "property", "gets", "the", "text", "of", "this", "node", "and", "all", "inner", "nodes", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1092-L1124
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.containsUid
def containsUid(self, uid): ''' containsUid - Check if the uid (unique internal ID) appears anywhere as a direct child to this node, or the node itself. @param uid <uuid.UUID> - uuid to check @return <bool> - True if #uid is this node's uid, or is the uid of any childre...
python
def containsUid(self, uid): ''' containsUid - Check if the uid (unique internal ID) appears anywhere as a direct child to this node, or the node itself. @param uid <uuid.UUID> - uuid to check @return <bool> - True if #uid is this node's uid, or is the uid of any childre...
[ "def", "containsUid", "(", "self", ",", "uid", ")", ":", "# Check if this node is the match", "if", "self", ".", "uid", "==", "uid", ":", "return", "True", "# Scan all children", "for", "child", "in", "self", ".", "children", ":", "if", "child", ".", "contai...
containsUid - Check if the uid (unique internal ID) appears anywhere as a direct child to this node, or the node itself. @param uid <uuid.UUID> - uuid to check @return <bool> - True if #uid is this node's uid, or is the uid of any children at any level down
[ "containsUid", "-", "Check", "if", "the", "uid", "(", "unique", "internal", "ID", ")", "appears", "anywhere", "as", "a", "direct", "child", "to", "this", "node", "or", "the", "node", "itself", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1181-L1198
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getAllChildNodes
def getAllChildNodes(self): ''' getAllChildNodes - Gets all the children, and their children, and their children, and so on, all the way to the end as a TagCollection. Use .childNodes for a regular list @return TagCollection<AdvancedTag> - ...
python
def getAllChildNodes(self): ''' getAllChildNodes - Gets all the children, and their children, and their children, and so on, all the way to the end as a TagCollection. Use .childNodes for a regular list @return TagCollection<AdvancedTag> - ...
[ "def", "getAllChildNodes", "(", "self", ")", ":", "ret", "=", "TagCollection", "(", ")", "# Scan all the children of this node", "for", "child", "in", "self", ".", "children", ":", "# Append each child", "ret", ".", "append", "(", "child", ")", "# Append children'...
getAllChildNodes - Gets all the children, and their children, and their children, and so on, all the way to the end as a TagCollection. Use .childNodes for a regular list @return TagCollection<AdvancedTag> - A TagCollection of all children (and their children ...
[ "getAllChildNodes", "-", "Gets", "all", "the", "children", "and", "their", "children", "and", "their", "children", "and", "so", "on", "all", "the", "way", "to", "the", "end", "as", "a", "TagCollection", ".", "Use", ".", "childNodes", "for", "a", "regular",...
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1200-L1220
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getAllChildNodeUids
def getAllChildNodeUids(self): ''' getAllChildNodeUids - Returns all the unique internal IDs for all children, and there children, so on and so forth until the end. For performing "contains node" kind of logic, this is more efficent than copying the entire nodeset ...
python
def getAllChildNodeUids(self): ''' getAllChildNodeUids - Returns all the unique internal IDs for all children, and there children, so on and so forth until the end. For performing "contains node" kind of logic, this is more efficent than copying the entire nodeset ...
[ "def", "getAllChildNodeUids", "(", "self", ")", ":", "ret", "=", "set", "(", ")", "# Iterate through all children", "for", "child", "in", "self", ".", "children", ":", "# Add child's uid", "ret", ".", "add", "(", "child", ".", "uid", ")", "# Add child's childr...
getAllChildNodeUids - Returns all the unique internal IDs for all children, and there children, so on and so forth until the end. For performing "contains node" kind of logic, this is more efficent than copying the entire nodeset @return set<uuid.UUID> A set of uuid objects
[ "getAllChildNodeUids", "-", "Returns", "all", "the", "unique", "internal", "IDs", "for", "all", "children", "and", "there", "children", "so", "on", "and", "so", "forth", "until", "the", "end", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1238-L1256
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getAllNodeUids
def getAllNodeUids(self): ''' getAllNodeUids - Returns all the unique internal IDs from getAllChildNodeUids, but also includes this tag's uid @return set<uuid.UUID> A set of uuid objects ''' # Start with a set including this tag's uuid ret = { self.uid } ...
python
def getAllNodeUids(self): ''' getAllNodeUids - Returns all the unique internal IDs from getAllChildNodeUids, but also includes this tag's uid @return set<uuid.UUID> A set of uuid objects ''' # Start with a set including this tag's uuid ret = { self.uid } ...
[ "def", "getAllNodeUids", "(", "self", ")", ":", "# Start with a set including this tag's uuid", "ret", "=", "{", "self", ".", "uid", "}", "ret", ".", "update", "(", "self", ".", "getAllChildNodeUids", "(", ")", ")", "return", "ret" ]
getAllNodeUids - Returns all the unique internal IDs from getAllChildNodeUids, but also includes this tag's uid @return set<uuid.UUID> A set of uuid objects
[ "getAllNodeUids", "-", "Returns", "all", "the", "unique", "internal", "IDs", "from", "getAllChildNodeUids", "but", "also", "includes", "this", "tag", "s", "uid" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1258-L1269
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getPeers
def getPeers(self): ''' getPeers - Get elements who share a parent with this element @return - TagCollection of elements ''' parentNode = self.parentNode # If no parent, no peers if not parentNode: return None peers = parentNode.child...
python
def getPeers(self): ''' getPeers - Get elements who share a parent with this element @return - TagCollection of elements ''' parentNode = self.parentNode # If no parent, no peers if not parentNode: return None peers = parentNode.child...
[ "def", "getPeers", "(", "self", ")", ":", "parentNode", "=", "self", ".", "parentNode", "# If no parent, no peers", "if", "not", "parentNode", ":", "return", "None", "peers", "=", "parentNode", ".", "children", "# Otherwise, get all children of parent excluding this nod...
getPeers - Get elements who share a parent with this element @return - TagCollection of elements
[ "getPeers", "-", "Get", "elements", "who", "share", "a", "parent", "with", "this", "element" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1272-L1286
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getStartTag
def getStartTag(self): ''' getStartTag - Returns the start tag represented as HTML @return - String of start tag with attributes ''' attributeStrings = [] # Get all attributes as a tuple (name<str>, value<str>) for name, val in self._attributes.items(): ...
python
def getStartTag(self): ''' getStartTag - Returns the start tag represented as HTML @return - String of start tag with attributes ''' attributeStrings = [] # Get all attributes as a tuple (name<str>, value<str>) for name, val in self._attributes.items(): ...
[ "def", "getStartTag", "(", "self", ")", ":", "attributeStrings", "=", "[", "]", "# Get all attributes as a tuple (name<str>, value<str>)", "for", "name", ",", "val", "in", "self", ".", "_attributes", ".", "items", "(", ")", ":", "# Get all attributes", "if", "val"...
getStartTag - Returns the start tag represented as HTML @return - String of start tag with attributes
[ "getStartTag", "-", "Returns", "the", "start", "tag", "represented", "as", "HTML" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1395-L1430
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getEndTag
def getEndTag(self): ''' getEndTag - returns the end tag representation as HTML string @return - String of end tag ''' # If this is a self-closing tag, we have no end tag (opens and closes in the start) if self.isSelfClosing is True: return '' ...
python
def getEndTag(self): ''' getEndTag - returns the end tag representation as HTML string @return - String of end tag ''' # If this is a self-closing tag, we have no end tag (opens and closes in the start) if self.isSelfClosing is True: return '' ...
[ "def", "getEndTag", "(", "self", ")", ":", "# If this is a self-closing tag, we have no end tag (opens and closes in the start)", "if", "self", ".", "isSelfClosing", "is", "True", ":", "return", "''", "tagName", "=", "self", ".", "tagName", "# Do not add any indentation to ...
getEndTag - returns the end tag representation as HTML string @return - String of end tag
[ "getEndTag", "-", "returns", "the", "end", "tag", "representation", "as", "HTML", "string" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1432-L1449
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.innerHTML
def innerHTML(self): ''' innerHTML - Returns an HTML string of the inner contents of this tag, including children. @return - String of inner contents HTML ''' # If a self-closing tag, there are no contents if self.isSelfClosing is True: return '' ...
python
def innerHTML(self): ''' innerHTML - Returns an HTML string of the inner contents of this tag, including children. @return - String of inner contents HTML ''' # If a self-closing tag, there are no contents if self.isSelfClosing is True: return '' ...
[ "def", "innerHTML", "(", "self", ")", ":", "# If a self-closing tag, there are no contents", "if", "self", ".", "isSelfClosing", "is", "True", ":", "return", "''", "# Assemble all the blocks.", "ret", "=", "[", "]", "# Iterate through blocks", "for", "block", "in", ...
innerHTML - Returns an HTML string of the inner contents of this tag, including children. @return - String of inner contents HTML
[ "innerHTML", "-", "Returns", "an", "HTML", "string", "of", "the", "inner", "contents", "of", "this", "tag", "including", "children", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1452-L1477
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getAttribute
def getAttribute(self, attrName, defaultValue=None): ''' getAttribute - Gets an attribute on this tag. Be wary using this for classname, maybe use addClass/removeClass. Attribute names are all lowercase. @return - The attribute value, or None if none exists. ''' if a...
python
def getAttribute(self, attrName, defaultValue=None): ''' getAttribute - Gets an attribute on this tag. Be wary using this for classname, maybe use addClass/removeClass. Attribute names are all lowercase. @return - The attribute value, or None if none exists. ''' if a...
[ "def", "getAttribute", "(", "self", ",", "attrName", ",", "defaultValue", "=", "None", ")", ":", "if", "attrName", "in", "TAG_ITEM_BINARY_ATTRIBUTES", ":", "if", "attrName", "in", "self", ".", "_attributes", ":", "attrVal", "=", "self", ".", "_attributes", "...
getAttribute - Gets an attribute on this tag. Be wary using this for classname, maybe use addClass/removeClass. Attribute names are all lowercase. @return - The attribute value, or None if none exists.
[ "getAttribute", "-", "Gets", "an", "attribute", "on", "this", "tag", ".", "Be", "wary", "using", "this", "for", "classname", "maybe", "use", "addClass", "/", "removeClass", ".", "Attribute", "names", "are", "all", "lowercase", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1489-L1505
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getAttributesList
def getAttributesList(self): ''' getAttributesList - Get a copy of all attributes as a list of tuples (name, value) ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before...
python
def getAttributesList(self): ''' getAttributesList - Get a copy of all attributes as a list of tuples (name, value) ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before...
[ "def", "getAttributesList", "(", "self", ")", ":", "return", "[", "(", "tostr", "(", "name", ")", "[", ":", "]", ",", "tostr", "(", "value", ")", "[", ":", "]", ")", "for", "name", ",", "value", "in", "self", ".", "_attributes", ".", "items", "("...
getAttributesList - Get a copy of all attributes as a list of tuples (name, value) ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before, you'll need to recreate those elements (like StyleA...
[ "getAttributesList", "-", "Get", "a", "copy", "of", "all", "attributes", "as", "a", "list", "of", "tuples", "(", "name", "value", ")" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1508-L1519
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getAttributesDict
def getAttributesDict(self): ''' getAttributesDict - Get a copy of all attributes as a dict map of name -> value ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before, y...
python
def getAttributesDict(self): ''' getAttributesDict - Get a copy of all attributes as a dict map of name -> value ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before, y...
[ "def", "getAttributesDict", "(", "self", ")", ":", "return", "{", "tostr", "(", "name", ")", "[", ":", "]", ":", "tostr", "(", "value", ")", "[", ":", "]", "for", "name", ",", "value", "in", "self", ".", "_attributes", ".", "items", "(", ")", "}"...
getAttributesDict - Get a copy of all attributes as a dict map of name -> value ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before, you'll need to recreate those elements (like StyleAttr...
[ "getAttributesDict", "-", "Get", "a", "copy", "of", "all", "attributes", "as", "a", "dict", "map", "of", "name", "-", ">", "value" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1522-L1532
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.hasAttribute
def hasAttribute(self, attrName): ''' hasAttribute - Checks for the existance of an attribute. Attribute names are all lowercase. @param attrName <str> - The attribute name @return <bool> - True or False if attribute exists by that name ''...
python
def hasAttribute(self, attrName): ''' hasAttribute - Checks for the existance of an attribute. Attribute names are all lowercase. @param attrName <str> - The attribute name @return <bool> - True or False if attribute exists by that name ''...
[ "def", "hasAttribute", "(", "self", ",", "attrName", ")", ":", "attrName", "=", "attrName", ".", "lower", "(", ")", "# Check if requested attribute is present on this node", "return", "bool", "(", "attrName", "in", "self", ".", "_attributes", ")" ]
hasAttribute - Checks for the existance of an attribute. Attribute names are all lowercase. @param attrName <str> - The attribute name @return <bool> - True or False if attribute exists by that name
[ "hasAttribute", "-", "Checks", "for", "the", "existance", "of", "an", "attribute", ".", "Attribute", "names", "are", "all", "lowercase", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1554-L1565
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.removeAttribute
def removeAttribute(self, attrName): ''' removeAttribute - Removes an attribute, by name. @param attrName <str> - The attribute name ''' attrName = attrName.lower() # Delete provided attribute name ( #attrName ) from attributes map try: ...
python
def removeAttribute(self, attrName): ''' removeAttribute - Removes an attribute, by name. @param attrName <str> - The attribute name ''' attrName = attrName.lower() # Delete provided attribute name ( #attrName ) from attributes map try: ...
[ "def", "removeAttribute", "(", "self", ",", "attrName", ")", ":", "attrName", "=", "attrName", ".", "lower", "(", ")", "# Delete provided attribute name ( #attrName ) from attributes map", "try", ":", "del", "self", ".", "_attributes", "[", "attrName", "]", "except"...
removeAttribute - Removes an attribute, by name. @param attrName <str> - The attribute name
[ "removeAttribute", "-", "Removes", "an", "attribute", "by", "name", ".", "@param", "attrName", "<str", ">", "-", "The", "attribute", "name" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1567-L1580
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.addClass
def addClass(self, className): ''' addClass - append a class name to the end of the "class" attribute, if not present @param className <str> - The name of the class to add ''' className = stripWordsOnly(className) if not className: return None ...
python
def addClass(self, className): ''' addClass - append a class name to the end of the "class" attribute, if not present @param className <str> - The name of the class to add ''' className = stripWordsOnly(className) if not className: return None ...
[ "def", "addClass", "(", "self", ",", "className", ")", ":", "className", "=", "stripWordsOnly", "(", "className", ")", "if", "not", "className", ":", "return", "None", "if", "' '", "in", "className", ":", "# Multiple class names passed, do one at a time", "for", ...
addClass - append a class name to the end of the "class" attribute, if not present @param className <str> - The name of the class to add
[ "addClass", "-", "append", "a", "class", "name", "to", "the", "end", "of", "the", "class", "attribute", "if", "not", "present" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1593-L1620
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.removeClass
def removeClass(self, className): ''' removeClass - remove a class name if present. Returns the class name if removed, otherwise None. @param className <str> - The name of the class to remove @return <str> - The class name removed if one was removed, otherwise None...
python
def removeClass(self, className): ''' removeClass - remove a class name if present. Returns the class name if removed, otherwise None. @param className <str> - The name of the class to remove @return <str> - The class name removed if one was removed, otherwise None...
[ "def", "removeClass", "(", "self", ",", "className", ")", ":", "className", "=", "stripWordsOnly", "(", "className", ")", "if", "not", "className", ":", "return", "None", "if", "' '", "in", "className", ":", "# Multiple class names passed, do one at a time", "for"...
removeClass - remove a class name if present. Returns the class name if removed, otherwise None. @param className <str> - The name of the class to remove @return <str> - The class name removed if one was removed, otherwise None if #className wasn't present
[ "removeClass", "-", "remove", "a", "class", "name", "if", "present", ".", "Returns", "the", "class", "name", "if", "removed", "otherwise", "None", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1623-L1651
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getStyleDict
def getStyleDict(self): ''' getStyleDict - Gets a dictionary of style attribute/value pairs. @return - OrderedDict of "style" attribute. ''' # TODO: This method is not used and does not appear in any tests. styleStr = (self.getAttribute('style') or '').strip() ...
python
def getStyleDict(self): ''' getStyleDict - Gets a dictionary of style attribute/value pairs. @return - OrderedDict of "style" attribute. ''' # TODO: This method is not used and does not appear in any tests. styleStr = (self.getAttribute('style') or '').strip() ...
[ "def", "getStyleDict", "(", "self", ")", ":", "# TODO: This method is not used and does not appear in any tests.", "styleStr", "=", "(", "self", ".", "getAttribute", "(", "'style'", ")", "or", "''", ")", ".", "strip", "(", ")", "styles", "=", "styleStr", ".", "s...
getStyleDict - Gets a dictionary of style attribute/value pairs. @return - OrderedDict of "style" attribute.
[ "getStyleDict", "-", "Gets", "a", "dictionary", "of", "style", "attribute", "/", "value", "pairs", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1654-L1675
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.setStyle
def setStyle(self, styleName, styleValue): ''' setStyle - Sets a style param. Example: "display", "block" If you need to set many styles on an element, use setStyles instead. It takes a dictionary of attribute, value pairs and applies it all in one go (faster) ...
python
def setStyle(self, styleName, styleValue): ''' setStyle - Sets a style param. Example: "display", "block" If you need to set many styles on an element, use setStyles instead. It takes a dictionary of attribute, value pairs and applies it all in one go (faster) ...
[ "def", "setStyle", "(", "self", ",", "styleName", ",", "styleValue", ")", ":", "myAttributes", "=", "self", ".", "_attributes", "if", "'style'", "not", "in", "myAttributes", ":", "myAttributes", "[", "'style'", "]", "=", "\"%s: %s\"", "%", "(", "styleName", ...
setStyle - Sets a style param. Example: "display", "block" If you need to set many styles on an element, use setStyles instead. It takes a dictionary of attribute, value pairs and applies it all in one go (faster) To remove a style, set its value to empty string. ...
[ "setStyle", "-", "Sets", "a", "style", "param", ".", "Example", ":", "display", "block" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1689-L1709
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.setStyles
def setStyles(self, styleUpdatesDict): ''' setStyles - Sets one or more style params. This all happens in one shot, so it is much much faster than calling setStyle for every value. To remove a style, set its value to empty string. When all styles are...
python
def setStyles(self, styleUpdatesDict): ''' setStyles - Sets one or more style params. This all happens in one shot, so it is much much faster than calling setStyle for every value. To remove a style, set its value to empty string. When all styles are...
[ "def", "setStyles", "(", "self", ",", "styleUpdatesDict", ")", ":", "setStyleMethod", "=", "self", ".", "setStyle", "for", "newName", ",", "newValue", "in", "styleUpdatesDict", ".", "items", "(", ")", ":", "setStyleMethod", "(", "newName", ",", "newValue", "...
setStyles - Sets one or more style params. This all happens in one shot, so it is much much faster than calling setStyle for every value. To remove a style, set its value to empty string. When all styles are removed, the "style" attribute will be nullified. ...
[ "setStyles", "-", "Sets", "one", "or", "more", "style", "params", ".", "This", "all", "happens", "in", "one", "shot", "so", "it", "is", "much", "much", "faster", "than", "calling", "setStyle", "for", "every", "value", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1712-L1728
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getElementById
def getElementById(self, _id): ''' getElementById - Search children of this tag for a tag containing an id @param _id - String of id @return - AdvancedTag or None ''' for child in self.children: if child.getAttribute('id') == _id: ...
python
def getElementById(self, _id): ''' getElementById - Search children of this tag for a tag containing an id @param _id - String of id @return - AdvancedTag or None ''' for child in self.children: if child.getAttribute('id') == _id: ...
[ "def", "getElementById", "(", "self", ",", "_id", ")", ":", "for", "child", "in", "self", ".", "children", ":", "if", "child", ".", "getAttribute", "(", "'id'", ")", "==", "_id", ":", "return", "child", "found", "=", "child", ".", "getElementById", "("...
getElementById - Search children of this tag for a tag containing an id @param _id - String of id @return - AdvancedTag or None
[ "getElementById", "-", "Search", "children", "of", "this", "tag", "for", "a", "tag", "containing", "an", "id" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1781-L1795
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getElementsByAttr
def getElementsByAttr(self, attrName, attrValue): ''' getElementsByAttr - Search children of this tag for tags with an attribute name/value pair @param attrName - Attribute name (lowercase) @param attrValue - Attribute value @return - TagCollection of matching e...
python
def getElementsByAttr(self, attrName, attrValue): ''' getElementsByAttr - Search children of this tag for tags with an attribute name/value pair @param attrName - Attribute name (lowercase) @param attrValue - Attribute value @return - TagCollection of matching e...
[ "def", "getElementsByAttr", "(", "self", ",", "attrName", ",", "attrValue", ")", ":", "elements", "=", "[", "]", "for", "child", "in", "self", ".", "children", ":", "if", "child", ".", "getAttribute", "(", "attrName", ")", "==", "attrValue", ":", "elemen...
getElementsByAttr - Search children of this tag for tags with an attribute name/value pair @param attrName - Attribute name (lowercase) @param attrValue - Attribute value @return - TagCollection of matching elements
[ "getElementsByAttr", "-", "Search", "children", "of", "this", "tag", "for", "tags", "with", "an", "attribute", "name", "/", "value", "pair" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1797-L1811
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getElementsByClassName
def getElementsByClassName(self, className): ''' getElementsByClassName - Search children of this tag for tags containing a given class name @param className - Class name @return - TagCollection of matching elements ''' elements = [] for child in sel...
python
def getElementsByClassName(self, className): ''' getElementsByClassName - Search children of this tag for tags containing a given class name @param className - Class name @return - TagCollection of matching elements ''' elements = [] for child in sel...
[ "def", "getElementsByClassName", "(", "self", ",", "className", ")", ":", "elements", "=", "[", "]", "for", "child", "in", "self", ".", "children", ":", "if", "child", ".", "hasClass", "(", "className", ")", "is", "True", ":", "elements", ".", "append", ...
getElementsByClassName - Search children of this tag for tags containing a given class name @param className - Class name @return - TagCollection of matching elements
[ "getElementsByClassName", "-", "Search", "children", "of", "this", "tag", "for", "tags", "containing", "a", "given", "class", "name" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1823-L1836
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getElementsWithAttrValues
def getElementsWithAttrValues(self, attrName, attrValues): ''' getElementsWithAttrValues - Search children of this tag for tags with an attribute name and one of several values @param attrName <lowercase str> - Attribute name (lowercase) @param attrValues set<str> - set of a...
python
def getElementsWithAttrValues(self, attrName, attrValues): ''' getElementsWithAttrValues - Search children of this tag for tags with an attribute name and one of several values @param attrName <lowercase str> - Attribute name (lowercase) @param attrValues set<str> - set of a...
[ "def", "getElementsWithAttrValues", "(", "self", ",", "attrName", ",", "attrValues", ")", ":", "elements", "=", "[", "]", "for", "child", "in", "self", ".", "children", ":", "if", "child", ".", "getAttribute", "(", "attrName", ")", "in", "attrValues", ":",...
getElementsWithAttrValues - Search children of this tag for tags with an attribute name and one of several values @param attrName <lowercase str> - Attribute name (lowercase) @param attrValues set<str> - set of acceptable attribute values @return - TagCollection of matching element...
[ "getElementsWithAttrValues", "-", "Search", "children", "of", "this", "tag", "for", "tags", "with", "an", "attribute", "name", "and", "one", "of", "several", "values" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1838-L1853
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getElementsCustomFilter
def getElementsCustomFilter(self, filterFunc): ''' getElementsCustomFilter - Searches children of this tag for those matching a provided user function @param filterFunc <function> - A function or lambda expression that should return "True" if the passed node matches criteria. ...
python
def getElementsCustomFilter(self, filterFunc): ''' getElementsCustomFilter - Searches children of this tag for those matching a provided user function @param filterFunc <function> - A function or lambda expression that should return "True" if the passed node matches criteria. ...
[ "def", "getElementsCustomFilter", "(", "self", ",", "filterFunc", ")", ":", "elements", "=", "[", "]", "for", "child", "in", "self", ".", "children", ":", "if", "filterFunc", "(", "child", ")", "is", "True", ":", "elements", ".", "append", "(", "child", ...
getElementsCustomFilter - Searches children of this tag for those matching a provided user function @param filterFunc <function> - A function or lambda expression that should return "True" if the passed node matches criteria. @return - TagCollection of matching results @see getFir...
[ "getElementsCustomFilter", "-", "Searches", "children", "of", "this", "tag", "for", "those", "matching", "a", "provided", "user", "function" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1856-L1873
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getFirstElementCustomFilter
def getFirstElementCustomFilter(self, filterFunc): ''' getFirstElementCustomFilter - Gets the first element which matches a given filter func. Scans first child, to the bottom, then next child to the bottom, etc. Does not include "self" node. @param filterFunc <function...
python
def getFirstElementCustomFilter(self, filterFunc): ''' getFirstElementCustomFilter - Gets the first element which matches a given filter func. Scans first child, to the bottom, then next child to the bottom, etc. Does not include "self" node. @param filterFunc <function...
[ "def", "getFirstElementCustomFilter", "(", "self", ",", "filterFunc", ")", ":", "for", "child", "in", "self", ".", "children", ":", "if", "filterFunc", "(", "child", ")", "is", "True", ":", "return", "child", "childSearchResult", "=", "child", ".", "getFirst...
getFirstElementCustomFilter - Gets the first element which matches a given filter func. Scans first child, to the bottom, then next child to the bottom, etc. Does not include "self" node. @param filterFunc <function> - A function or lambda expression that should return "True" if the passed...
[ "getFirstElementCustomFilter", "-", "Gets", "the", "first", "element", "which", "matches", "a", "given", "filter", "func", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1875-L1896
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getParentElementCustomFilter
def getParentElementCustomFilter(self, filterFunc): ''' getParentElementCustomFilter - Runs through parent on up to document root, returning the first tag which filterFunc(tag) returns True. @param filterFunc <function/lambda> - A funct...
python
def getParentElementCustomFilter(self, filterFunc): ''' getParentElementCustomFilter - Runs through parent on up to document root, returning the first tag which filterFunc(tag) returns True. @param filterFunc <function/lambda> - A funct...
[ "def", "getParentElementCustomFilter", "(", "self", ",", "filterFunc", ")", ":", "parentNode", "=", "self", ".", "parentNode", "while", "parentNode", ":", "if", "filterFunc", "(", "parentNode", ")", "is", "True", ":", "return", "parentNode", "parentNode", "=", ...
getParentElementCustomFilter - Runs through parent on up to document root, returning the first tag which filterFunc(tag) returns True. @param filterFunc <function/lambda> - A function or lambda expression that should return "True" if the passed node matche...
[ "getParentElementCustomFilter", "-", "Runs", "through", "parent", "on", "up", "to", "document", "root", "returning", "the" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1898-L1919
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getPeersCustomFilter
def getPeersCustomFilter(self, filterFunc): ''' getPeersCustomFilter - Get elements who share a parent with this element and also pass a custom filter check @param filterFunc <lambda/function> - Passed in an element, and returns True if it should be treated as a match, otherwise Fal...
python
def getPeersCustomFilter(self, filterFunc): ''' getPeersCustomFilter - Get elements who share a parent with this element and also pass a custom filter check @param filterFunc <lambda/function> - Passed in an element, and returns True if it should be treated as a match, otherwise Fal...
[ "def", "getPeersCustomFilter", "(", "self", ",", "filterFunc", ")", ":", "peers", "=", "self", ".", "peers", "if", "peers", "is", "None", ":", "return", "None", "return", "TagCollection", "(", "[", "peer", "for", "peer", "in", "peers", "if", "filterFunc", ...
getPeersCustomFilter - Get elements who share a parent with this element and also pass a custom filter check @param filterFunc <lambda/function> - Passed in an element, and returns True if it should be treated as a match, otherwise False. @return <TagCollection> - Resulting peers, or N...
[ "getPeersCustomFilter", "-", "Get", "elements", "who", "share", "a", "parent", "with", "this", "element", "and", "also", "pass", "a", "custom", "filter", "check" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1922-L1934
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getPeersByAttr
def getPeersByAttr(self, attrName, attrValue): ''' getPeersByAttr - Gets peers (elements on same level) which match an attribute/value combination. @param attrName - Name of attribute @param attrValue - Value that must match @return - None if no parent element (...
python
def getPeersByAttr(self, attrName, attrValue): ''' getPeersByAttr - Gets peers (elements on same level) which match an attribute/value combination. @param attrName - Name of attribute @param attrValue - Value that must match @return - None if no parent element (...
[ "def", "getPeersByAttr", "(", "self", ",", "attrName", ",", "attrValue", ")", ":", "peers", "=", "self", ".", "peers", "if", "peers", "is", "None", ":", "return", "None", "return", "TagCollection", "(", "[", "peer", "for", "peer", "in", "peers", "if", ...
getPeersByAttr - Gets peers (elements on same level) which match an attribute/value combination. @param attrName - Name of attribute @param attrValue - Value that must match @return - None if no parent element (error condition), otherwise a TagCollection of peers that matched.
[ "getPeersByAttr", "-", "Gets", "peers", "(", "elements", "on", "same", "level", ")", "which", "match", "an", "attribute", "/", "value", "combination", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1937-L1949
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getPeersWithAttrValues
def getPeersWithAttrValues(self, attrName, attrValues): ''' getPeersWithAttrValues - Gets peers (elements on same level) whose attribute given by #attrName are in the list of possible vaues #attrValues @param attrName - Name of attribute @param attrValues - ...
python
def getPeersWithAttrValues(self, attrName, attrValues): ''' getPeersWithAttrValues - Gets peers (elements on same level) whose attribute given by #attrName are in the list of possible vaues #attrValues @param attrName - Name of attribute @param attrValues - ...
[ "def", "getPeersWithAttrValues", "(", "self", ",", "attrName", ",", "attrValues", ")", ":", "peers", "=", "self", ".", "peers", "if", "peers", "is", "None", ":", "return", "None", "return", "TagCollection", "(", "[", "peer", "for", "peer", "in", "peers", ...
getPeersWithAttrValues - Gets peers (elements on same level) whose attribute given by #attrName are in the list of possible vaues #attrValues @param attrName - Name of attribute @param attrValues - List of possible values which will match @return - None if no paren...
[ "getPeersWithAttrValues", "-", "Gets", "peers", "(", "elements", "on", "same", "level", ")", "whose", "attribute", "given", "by", "#attrName", "are", "in", "the", "list", "of", "possible", "vaues", "#attrValues" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1951-L1964
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getPeersByName
def getPeersByName(self, name): ''' getPeersByName - Gets peers (elements on same level) with a given name @param name - Name to match @return - None if no parent element (error condition), otherwise a TagCollection of peers that matched. ''' peers = self.pe...
python
def getPeersByName(self, name): ''' getPeersByName - Gets peers (elements on same level) with a given name @param name - Name to match @return - None if no parent element (error condition), otherwise a TagCollection of peers that matched. ''' peers = self.pe...
[ "def", "getPeersByName", "(", "self", ",", "name", ")", ":", "peers", "=", "self", ".", "peers", "if", "peers", "is", "None", ":", "return", "None", "return", "TagCollection", "(", "[", "peer", "for", "peer", "in", "peers", "if", "peer", ".", "name", ...
getPeersByName - Gets peers (elements on same level) with a given name @param name - Name to match @return - None if no parent element (error condition), otherwise a TagCollection of peers that matched.
[ "getPeersByName", "-", "Gets", "peers", "(", "elements", "on", "same", "level", ")", "with", "a", "given", "name" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1966-L1977
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getPeersByClassName
def getPeersByClassName(self, className): ''' getPeersByClassName - Gets peers (elements on same level) with a given class name @param className - classname must contain this name @return - None if no parent element (error condition), otherwise a TagCollection of peers that...
python
def getPeersByClassName(self, className): ''' getPeersByClassName - Gets peers (elements on same level) with a given class name @param className - classname must contain this name @return - None if no parent element (error condition), otherwise a TagCollection of peers that...
[ "def", "getPeersByClassName", "(", "self", ",", "className", ")", ":", "peers", "=", "self", ".", "peers", "if", "peers", "is", "None", ":", "return", "None", "return", "TagCollection", "(", "[", "peer", "for", "peer", "in", "peers", "if", "peer", ".", ...
getPeersByClassName - Gets peers (elements on same level) with a given class name @param className - classname must contain this name @return - None if no parent element (error condition), otherwise a TagCollection of peers that matched.
[ "getPeersByClassName", "-", "Gets", "peers", "(", "elements", "on", "same", "level", ")", "with", "a", "given", "class", "name" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1979-L1990
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.isTagEqual
def isTagEqual(self, other): ''' isTagEqual - Compare if a tag contains the same tag name and attributes as another tag, i.e. if everything between < and > parts of this tag are the same. Does NOT compare children, etc. Does NOT compare if these are the same exact t...
python
def isTagEqual(self, other): ''' isTagEqual - Compare if a tag contains the same tag name and attributes as another tag, i.e. if everything between < and > parts of this tag are the same. Does NOT compare children, etc. Does NOT compare if these are the same exact t...
[ "def", "isTagEqual", "(", "self", ",", "other", ")", ":", "# if type(other) != type(self):", "# return False", "# NOTE: Instead of type check,", "# just see if we can get the needed attributes in case subclassing", "try", ":", "if", "self", ".", "ta...
isTagEqual - Compare if a tag contains the same tag name and attributes as another tag, i.e. if everything between < and > parts of this tag are the same. Does NOT compare children, etc. Does NOT compare if these are the same exact tag in the html (use regular == operator for that) ...
[ "isTagEqual", "-", "Compare", "if", "a", "tag", "contains", "the", "same", "tag", "name", "and", "attributes", "as", "another", "tag" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2002-L2046
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.append
def append(self, tag): ''' append - Append an item to this tag collection @param tag - an AdvancedTag ''' list.append(self, tag) self.uids.add(tag.uid)
python
def append(self, tag): ''' append - Append an item to this tag collection @param tag - an AdvancedTag ''' list.append(self, tag) self.uids.add(tag.uid)
[ "def", "append", "(", "self", ",", "tag", ")", ":", "list", ".", "append", "(", "self", ",", "tag", ")", "self", ".", "uids", ".", "add", "(", "tag", ".", "uid", ")" ]
append - Append an item to this tag collection @param tag - an AdvancedTag
[ "append", "-", "Append", "an", "item", "to", "this", "tag", "collection" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2241-L2248
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.remove
def remove(self, toRemove): ''' remove - Remove an item from this tag collection @param toRemove - an AdvancedTag ''' list.remove(self, toRemove) self.uids.remove(toRemove.uid)
python
def remove(self, toRemove): ''' remove - Remove an item from this tag collection @param toRemove - an AdvancedTag ''' list.remove(self, toRemove) self.uids.remove(toRemove.uid)
[ "def", "remove", "(", "self", ",", "toRemove", ")", ":", "list", ".", "remove", "(", "self", ",", "toRemove", ")", "self", ".", "uids", ".", "remove", "(", "toRemove", ".", "uid", ")" ]
remove - Remove an item from this tag collection @param toRemove - an AdvancedTag
[ "remove", "-", "Remove", "an", "item", "from", "this", "tag", "collection" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2250-L2257
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.filterCollection
def filterCollection(self, filterFunc): ''' filterCollection - Filters only the immediate objects contained within this Collection against a function, not including any children @param filterFunc <function> - A function or lambda expression that returns True to have that element match ...
python
def filterCollection(self, filterFunc): ''' filterCollection - Filters only the immediate objects contained within this Collection against a function, not including any children @param filterFunc <function> - A function or lambda expression that returns True to have that element match ...
[ "def", "filterCollection", "(", "self", ",", "filterFunc", ")", ":", "ret", "=", "TagCollection", "(", ")", "if", "len", "(", "self", ")", "==", "0", ":", "return", "ret", "for", "tag", "in", "self", ":", "if", "filterFunc", "(", "tag", ")", "is", ...
filterCollection - Filters only the immediate objects contained within this Collection against a function, not including any children @param filterFunc <function> - A function or lambda expression that returns True to have that element match @return TagCollection<AdvancedTag>
[ "filterCollection", "-", "Filters", "only", "the", "immediate", "objects", "contained", "within", "this", "Collection", "against", "a", "function", "not", "including", "any", "children" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2267-L2283
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.getElementsByTagName
def getElementsByTagName(self, tagName): ''' getElementsByTagName - Gets elements within this collection having a specific tag name @param tagName - String of tag name @return - TagCollection of unique elements within this collection with given tag name ''' ...
python
def getElementsByTagName(self, tagName): ''' getElementsByTagName - Gets elements within this collection having a specific tag name @param tagName - String of tag name @return - TagCollection of unique elements within this collection with given tag name ''' ...
[ "def", "getElementsByTagName", "(", "self", ",", "tagName", ")", ":", "ret", "=", "TagCollection", "(", ")", "if", "len", "(", "self", ")", "==", "0", ":", "return", "ret", "tagName", "=", "tagName", ".", "lower", "(", ")", "_cmpFunc", "=", "lambda", ...
getElementsByTagName - Gets elements within this collection having a specific tag name @param tagName - String of tag name @return - TagCollection of unique elements within this collection with given tag name
[ "getElementsByTagName", "-", "Gets", "elements", "within", "this", "collection", "having", "a", "specific", "tag", "name" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2285-L2303
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.getElementsByName
def getElementsByName(self, name): ''' getElementsByName - Get elements within this collection having a specific name @param name - String of "name" attribute @return - TagCollection of unique elements within this collection with given "name" ''' ret = TagCo...
python
def getElementsByName(self, name): ''' getElementsByName - Get elements within this collection having a specific name @param name - String of "name" attribute @return - TagCollection of unique elements within this collection with given "name" ''' ret = TagCo...
[ "def", "getElementsByName", "(", "self", ",", "name", ")", ":", "ret", "=", "TagCollection", "(", ")", "if", "len", "(", "self", ")", "==", "0", ":", "return", "ret", "_cmpFunc", "=", "lambda", "tag", ":", "bool", "(", "tag", ".", "name", "==", "na...
getElementsByName - Get elements within this collection having a specific name @param name - String of "name" attribute @return - TagCollection of unique elements within this collection with given "name"
[ "getElementsByName", "-", "Get", "elements", "within", "this", "collection", "having", "a", "specific", "name" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2306-L2321
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.getElementsByClassName
def getElementsByClassName(self, className): ''' getElementsByClassName - Get elements within this collection containing a specific class name @param className - A single class name @return - TagCollection of unique elements within this collection tagged with a specific cla...
python
def getElementsByClassName(self, className): ''' getElementsByClassName - Get elements within this collection containing a specific class name @param className - A single class name @return - TagCollection of unique elements within this collection tagged with a specific cla...
[ "def", "getElementsByClassName", "(", "self", ",", "className", ")", ":", "ret", "=", "TagCollection", "(", ")", "if", "len", "(", "self", ")", "==", "0", ":", "return", "ret", "_cmpFunc", "=", "lambda", "tag", ":", "tag", ".", "hasClass", "(", "classN...
getElementsByClassName - Get elements within this collection containing a specific class name @param className - A single class name @return - TagCollection of unique elements within this collection tagged with a specific class name
[ "getElementsByClassName", "-", "Get", "elements", "within", "this", "collection", "containing", "a", "specific", "class", "name" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2323-L2338
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.getElementById
def getElementById(self, _id): ''' getElementById - Gets an element within this collection by id @param _id - string of "id" attribute @return - a single tag matching the id, or None if none found ''' for tag in self: if tag.id == _id: ...
python
def getElementById(self, _id): ''' getElementById - Gets an element within this collection by id @param _id - string of "id" attribute @return - a single tag matching the id, or None if none found ''' for tag in self: if tag.id == _id: ...
[ "def", "getElementById", "(", "self", ",", "_id", ")", ":", "for", "tag", "in", "self", ":", "if", "tag", ".", "id", "==", "_id", ":", "return", "tag", "for", "subtag", "in", "tag", ".", "children", ":", "tmp", "=", "subtag", ".", "getElementById", ...
getElementById - Gets an element within this collection by id @param _id - string of "id" attribute @return - a single tag matching the id, or None if none found
[ "getElementById", "-", "Gets", "an", "element", "within", "this", "collection", "by", "id" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2340-L2355
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.getElementsByAttr
def getElementsByAttr(self, attr, value): ''' getElementsByAttr - Get elements within this collection posessing a given attribute/value pair @param attr - Attribute name (lowercase) @param value - Matching value @return - TagCollection of all elements matching n...
python
def getElementsByAttr(self, attr, value): ''' getElementsByAttr - Get elements within this collection posessing a given attribute/value pair @param attr - Attribute name (lowercase) @param value - Matching value @return - TagCollection of all elements matching n...
[ "def", "getElementsByAttr", "(", "self", ",", "attr", ",", "value", ")", ":", "ret", "=", "TagCollection", "(", ")", "if", "len", "(", "self", ")", "==", "0", ":", "return", "ret", "attr", "=", "attr", ".", "lower", "(", ")", "_cmpFunc", "=", "lamb...
getElementsByAttr - Get elements within this collection posessing a given attribute/value pair @param attr - Attribute name (lowercase) @param value - Matching value @return - TagCollection of all elements matching name/value
[ "getElementsByAttr", "-", "Get", "elements", "within", "this", "collection", "posessing", "a", "given", "attribute", "/", "value", "pair" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2357-L2375
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.getElementsWithAttrValues
def getElementsWithAttrValues(self, attr, values): ''' getElementsWithAttrValues - Get elements within this collection possessing an attribute name matching one of several values @param attr <lowercase str> - Attribute name (lowerase) @param values set<str> - Set of possible...
python
def getElementsWithAttrValues(self, attr, values): ''' getElementsWithAttrValues - Get elements within this collection possessing an attribute name matching one of several values @param attr <lowercase str> - Attribute name (lowerase) @param values set<str> - Set of possible...
[ "def", "getElementsWithAttrValues", "(", "self", ",", "attr", ",", "values", ")", ":", "ret", "=", "TagCollection", "(", ")", "if", "len", "(", "self", ")", "==", "0", ":", "return", "ret", "if", "type", "(", "values", ")", "!=", "set", ":", "values"...
getElementsWithAttrValues - Get elements within this collection possessing an attribute name matching one of several values @param attr <lowercase str> - Attribute name (lowerase) @param values set<str> - Set of possible matching values @return - TagCollection of all elements match...
[ "getElementsWithAttrValues", "-", "Get", "elements", "within", "this", "collection", "possessing", "an", "attribute", "name", "matching", "one", "of", "several", "values" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2377-L2398
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.getElementsCustomFilter
def getElementsCustomFilter(self, filterFunc): ''' getElementsCustomFilter - Get elements within this collection that match a user-provided function. @param filterFunc <function> - A function that returns True if the element matches criteria @return - TagCollection of all e...
python
def getElementsCustomFilter(self, filterFunc): ''' getElementsCustomFilter - Get elements within this collection that match a user-provided function. @param filterFunc <function> - A function that returns True if the element matches criteria @return - TagCollection of all e...
[ "def", "getElementsCustomFilter", "(", "self", ",", "filterFunc", ")", ":", "ret", "=", "TagCollection", "(", ")", "if", "len", "(", "self", ")", "==", "0", ":", "return", "ret", "_cmpFunc", "=", "lambda", "tag", ":", "filterFunc", "(", "tag", ")", "is...
getElementsCustomFilter - Get elements within this collection that match a user-provided function. @param filterFunc <function> - A function that returns True if the element matches criteria @return - TagCollection of all elements that matched criteria
[ "getElementsCustomFilter", "-", "Get", "elements", "within", "this", "collection", "that", "match", "a", "user", "-", "provided", "function", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2400-L2416
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.getAllNodes
def getAllNodes(self): ''' getAllNodes - Gets all the nodes, and all their children for every node within this collection ''' ret = TagCollection() for tag in self: ret.append(tag) ret += tag.getAllChildNodes() return ret
python
def getAllNodes(self): ''' getAllNodes - Gets all the nodes, and all their children for every node within this collection ''' ret = TagCollection() for tag in self: ret.append(tag) ret += tag.getAllChildNodes() return ret
[ "def", "getAllNodes", "(", "self", ")", ":", "ret", "=", "TagCollection", "(", ")", "for", "tag", "in", "self", ":", "ret", ".", "append", "(", "tag", ")", "ret", "+=", "tag", ".", "getAllChildNodes", "(", ")", "return", "ret" ]
getAllNodes - Gets all the nodes, and all their children for every node within this collection
[ "getAllNodes", "-", "Gets", "all", "the", "nodes", "and", "all", "their", "children", "for", "every", "node", "within", "this", "collection" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2418-L2428
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.getAllNodeUids
def getAllNodeUids(self): ''' getAllNodeUids - Gets all the internal uids of all nodes, their children, and all their children so on.. @return set<uuid.UUID> ''' ret = set() for child in self: ret.update(child.getAllNodeUids()) return ret
python
def getAllNodeUids(self): ''' getAllNodeUids - Gets all the internal uids of all nodes, their children, and all their children so on.. @return set<uuid.UUID> ''' ret = set() for child in self: ret.update(child.getAllNodeUids()) return ret
[ "def", "getAllNodeUids", "(", "self", ")", ":", "ret", "=", "set", "(", ")", "for", "child", "in", "self", ":", "ret", ".", "update", "(", "child", ".", "getAllNodeUids", "(", ")", ")", "return", "ret" ]
getAllNodeUids - Gets all the internal uids of all nodes, their children, and all their children so on.. @return set<uuid.UUID>
[ "getAllNodeUids", "-", "Gets", "all", "the", "internal", "uids", "of", "all", "nodes", "their", "children", "and", "all", "their", "children", "so", "on", ".." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2430-L2441
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.contains
def contains(self, em): ''' contains - Check if #em occurs within any of the elements within this list, as themselves or as a child, any number of levels down. To check if JUST an element is contained within this list directly, use the "in" operator. ...
python
def contains(self, em): ''' contains - Check if #em occurs within any of the elements within this list, as themselves or as a child, any number of levels down. To check if JUST an element is contained within this list directly, use the "in" operator. ...
[ "def", "contains", "(", "self", ",", "em", ")", ":", "for", "node", "in", "self", ":", "if", "node", ".", "contains", "(", "em", ")", ":", "return", "True", "return", "False" ]
contains - Check if #em occurs within any of the elements within this list, as themselves or as a child, any number of levels down. To check if JUST an element is contained within this list directly, use the "in" operator. @param em <AdvancedTag> - Element of inte...
[ "contains", "-", "Check", "if", "#em", "occurs", "within", "any", "of", "the", "elements", "within", "this", "list", "as", "themselves", "or", "as", "a", "child", "any", "number", "of", "levels", "down", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2443-L2459
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.containsUid
def containsUid(self, uid): ''' containsUid - Check if #uid is the uid (unique internal identifier) of any of the elements within this list, as themselves or as a child, any number of levels down. @param uid <uuid.UUID> - uuid of interest @return <...
python
def containsUid(self, uid): ''' containsUid - Check if #uid is the uid (unique internal identifier) of any of the elements within this list, as themselves or as a child, any number of levels down. @param uid <uuid.UUID> - uuid of interest @return <...
[ "def", "containsUid", "(", "self", ",", "uid", ")", ":", "for", "node", "in", "self", ":", "if", "node", ".", "containsUid", "(", "uid", ")", ":", "return", "True", "return", "False" ]
containsUid - Check if #uid is the uid (unique internal identifier) of any of the elements within this list, as themselves or as a child, any number of levels down. @param uid <uuid.UUID> - uuid of interest @return <bool> - True if contained, otherwise False
[ "containsUid", "-", "Check", "if", "#uid", "is", "the", "uid", "(", "unique", "internal", "identifier", ")", "of", "any", "of", "the", "elements", "within", "this", "list", "as", "themselves", "or", "as", "a", "child", "any", "number", "of", "levels", "d...
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2461-L2475
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.filterAll
def filterAll(self, **kwargs): ''' filterAll aka filterAllAnd - Perform a filter operation on ALL nodes in this collection and all their children. Results must match ALL the filter criteria. for ANY, use the *Or methods For just the nodes in this collection, use "filter" or...
python
def filterAll(self, **kwargs): ''' filterAll aka filterAllAnd - Perform a filter operation on ALL nodes in this collection and all their children. Results must match ALL the filter criteria. for ANY, use the *Or methods For just the nodes in this collection, use "filter" or...
[ "def", "filterAll", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "canFilterTags", "is", "False", ":", "raise", "NotImplementedError", "(", "'filter methods requires QueryableList installed, it is not. Either install QueryableList, or try the less-robust \"find\" method, ...
filterAll aka filterAllAnd - Perform a filter operation on ALL nodes in this collection and all their children. Results must match ALL the filter criteria. for ANY, use the *Or methods For just the nodes in this collection, use "filter" or "filterAnd" on a TagCollection For specia...
[ "filterAll", "aka", "filterAllAnd", "-", "Perform", "a", "filter", "operation", "on", "ALL", "nodes", "in", "this", "collection", "and", "all", "their", "children", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2478-L2503
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
TagCollection.filterAllOr
def filterAllOr(self, **kwargs): ''' filterAllOr - Perform a filter operation on ALL nodes in this collection and all their children. Results must match ANY the filter criteria. for ALL, use the *And methods For just the nodes in this collection, use "filterOr" on a TagColl...
python
def filterAllOr(self, **kwargs): ''' filterAllOr - Perform a filter operation on ALL nodes in this collection and all their children. Results must match ANY the filter criteria. for ALL, use the *And methods For just the nodes in this collection, use "filterOr" on a TagColl...
[ "def", "filterAllOr", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "canFilterTags", "is", "False", ":", "raise", "NotImplementedError", "(", "'filter methods requires QueryableList installed, it is not. Either install QueryableList, or try the less-robust \"find\" method...
filterAllOr - Perform a filter operation on ALL nodes in this collection and all their children. Results must match ANY the filter criteria. for ALL, use the *And methods For just the nodes in this collection, use "filterOr" on a TagCollection For special filter keys, @see #Advanc...
[ "filterAllOr", "-", "Perform", "a", "filter", "operation", "on", "ALL", "nodes", "in", "this", "collection", "and", "all", "their", "children", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L2507-L2533
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Formatter.py
AdvancedHTMLFormatter.handle_starttag
def handle_starttag(self, tagName, attributeList, isSelfClosing=False): ''' handle_starttag - Internal for parsing ''' tagName = tagName.lower() inTag = self._inTag if isSelfClosing is False and tagName in IMPLICIT_SELF_CLOSING_TAGS: isSelfClosing = True ...
python
def handle_starttag(self, tagName, attributeList, isSelfClosing=False): ''' handle_starttag - Internal for parsing ''' tagName = tagName.lower() inTag = self._inTag if isSelfClosing is False and tagName in IMPLICIT_SELF_CLOSING_TAGS: isSelfClosing = True ...
[ "def", "handle_starttag", "(", "self", ",", "tagName", ",", "attributeList", ",", "isSelfClosing", "=", "False", ")", ":", "tagName", "=", "tagName", ".", "lower", "(", ")", "inTag", "=", "self", ".", "_inTag", "if", "isSelfClosing", "is", "False", "and", ...
handle_starttag - Internal for parsing
[ "handle_starttag", "-", "Internal", "for", "parsing" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Formatter.py#L155-L182
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Formatter.py
AdvancedHTMLFormatter.handle_endtag
def handle_endtag(self, tagName): ''' handle_endtag - Internal for parsing ''' inTag = self._inTag try: # Handle closing tags which should have been closed but weren't foundIt = False for i in range(len(inTag)): if inTag[i]....
python
def handle_endtag(self, tagName): ''' handle_endtag - Internal for parsing ''' inTag = self._inTag try: # Handle closing tags which should have been closed but weren't foundIt = False for i in range(len(inTag)): if inTag[i]....
[ "def", "handle_endtag", "(", "self", ",", "tagName", ")", ":", "inTag", "=", "self", ".", "_inTag", "try", ":", "# Handle closing tags which should have been closed but weren't", "foundIt", "=", "False", "for", "i", "in", "range", "(", "len", "(", "inTag", ")", ...
handle_endtag - Internal for parsing
[ "handle_endtag", "-", "Internal", "for", "parsing" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Formatter.py#L191-L221
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Formatter.py
AdvancedHTMLFormatter.handle_data
def handle_data(self, data): ''' handle_data - Internal for parsing ''' if data: inTag = self._inTag if len(inTag) > 0: if inTag[-1].tagName not in PRESERVE_CONTENTS_TAGS: data = data.replace('\t', ' ').strip('\r\n') ...
python
def handle_data(self, data): ''' handle_data - Internal for parsing ''' if data: inTag = self._inTag if len(inTag) > 0: if inTag[-1].tagName not in PRESERVE_CONTENTS_TAGS: data = data.replace('\t', ' ').strip('\r\n') ...
[ "def", "handle_data", "(", "self", ",", "data", ")", ":", "if", "data", ":", "inTag", "=", "self", ".", "_inTag", "if", "len", "(", "inTag", ")", ">", "0", ":", "if", "inTag", "[", "-", "1", "]", ".", "tagName", "not", "in", "PRESERVE_CONTENTS_TAGS...
handle_data - Internal for parsing
[ "handle_data", "-", "Internal", "for", "parsing" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Formatter.py#L223-L239
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Formatter.py
AdvancedTagSlim.getStartTag
def getStartTag(self, *args, **kwargs): ''' getStartTag - Override the end-spacing rules @see AdvancedTag.getStartTag ''' ret = AdvancedTag.getStartTag(self, *args, **kwargs) if ret.endswith(' >'): ret = ret[:-2] + '>' elif object.__getatt...
python
def getStartTag(self, *args, **kwargs): ''' getStartTag - Override the end-spacing rules @see AdvancedTag.getStartTag ''' ret = AdvancedTag.getStartTag(self, *args, **kwargs) if ret.endswith(' >'): ret = ret[:-2] + '>' elif object.__getatt...
[ "def", "getStartTag", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "AdvancedTag", ".", "getStartTag", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "if", "ret", ".", "endswith", "(", "' >'", ")", ":...
getStartTag - Override the end-spacing rules @see AdvancedTag.getStartTag
[ "getStartTag", "-", "Override", "the", "end", "-", "spacing", "rules" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Formatter.py#L368-L382
kata198/AdvancedHTMLParser
AdvancedHTMLParser/utils.py
stripIEConditionals
def stripIEConditionals(contents, addHtmlIfMissing=True): ''' stripIEConditionals - Strips Internet Explorer conditional statements. @param contents <str> - Contents String @param addHtmlIfMissing <bool> - Since these normally encompass the "html" element, optionally add it back if missing....
python
def stripIEConditionals(contents, addHtmlIfMissing=True): ''' stripIEConditionals - Strips Internet Explorer conditional statements. @param contents <str> - Contents String @param addHtmlIfMissing <bool> - Since these normally encompass the "html" element, optionally add it back if missing....
[ "def", "stripIEConditionals", "(", "contents", ",", "addHtmlIfMissing", "=", "True", ")", ":", "allMatches", "=", "IE_CONDITIONAL_PATTERN", ".", "findall", "(", "contents", ")", "if", "not", "allMatches", ":", "return", "contents", "for", "match", "in", "allMatc...
stripIEConditionals - Strips Internet Explorer conditional statements. @param contents <str> - Contents String @param addHtmlIfMissing <bool> - Since these normally encompass the "html" element, optionally add it back if missing.
[ "stripIEConditionals", "-", "Strips", "Internet", "Explorer", "conditional", "statements", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/utils.py#L24-L41
kata198/AdvancedHTMLParser
AdvancedHTMLParser/utils.py
addStartTag
def addStartTag(contents, startTag): ''' addStartTag - Safetly add a start tag to the document, taking into account the DOCTYPE @param contents <str> - Contents @param startTag <str> - Fully formed tag, i.e. <html> ''' matchObj = DOCTYPE_MATCH.match(contents) if matchObj: ...
python
def addStartTag(contents, startTag): ''' addStartTag - Safetly add a start tag to the document, taking into account the DOCTYPE @param contents <str> - Contents @param startTag <str> - Fully formed tag, i.e. <html> ''' matchObj = DOCTYPE_MATCH.match(contents) if matchObj: ...
[ "def", "addStartTag", "(", "contents", ",", "startTag", ")", ":", "matchObj", "=", "DOCTYPE_MATCH", ".", "match", "(", "contents", ")", "if", "matchObj", ":", "idx", "=", "matchObj", ".", "end", "(", ")", "else", ":", "idx", "=", "0", "return", "\"%s\\...
addStartTag - Safetly add a start tag to the document, taking into account the DOCTYPE @param contents <str> - Contents @param startTag <str> - Fully formed tag, i.e. <html>
[ "addStartTag", "-", "Safetly", "add", "a", "start", "tag", "to", "the", "document", "taking", "into", "account", "the", "DOCTYPE" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/utils.py#L44-L57
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Validator.py
ValidatingAdvancedHTMLParser.handle_endtag
def handle_endtag(self, tagName): ''' Internal for parsing ''' inTag = self._inTag if len(inTag) == 0: # Attempted to close, but no open tags raise InvalidCloseException(tagName, []) foundIt = False i = len(inTag) - 1 while i >...
python
def handle_endtag(self, tagName): ''' Internal for parsing ''' inTag = self._inTag if len(inTag) == 0: # Attempted to close, but no open tags raise InvalidCloseException(tagName, []) foundIt = False i = len(inTag) - 1 while i >...
[ "def", "handle_endtag", "(", "self", ",", "tagName", ")", ":", "inTag", "=", "self", ".", "_inTag", "if", "len", "(", "inTag", ")", "==", "0", ":", "# Attempted to close, but no open tags", "raise", "InvalidCloseException", "(", "tagName", ",", "[", "]", ")"...
Internal for parsing
[ "Internal", "for", "parsing" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Validator.py#L20-L44
kata198/AdvancedHTMLParser
AdvancedHTMLParser/conversions.py
convertToBooleanString
def convertToBooleanString(val=None): ''' convertToBooleanString - Converts a value to either a string of "true" or "false" @param val <int/str/bool> - Value ''' if hasattr(val, 'lower'): val = val.lower() # Technically, if you set one of these attributes (like "spellch...
python
def convertToBooleanString(val=None): ''' convertToBooleanString - Converts a value to either a string of "true" or "false" @param val <int/str/bool> - Value ''' if hasattr(val, 'lower'): val = val.lower() # Technically, if you set one of these attributes (like "spellch...
[ "def", "convertToBooleanString", "(", "val", "=", "None", ")", ":", "if", "hasattr", "(", "val", ",", "'lower'", ")", ":", "val", "=", "val", ".", "lower", "(", ")", "# Technically, if you set one of these attributes (like \"spellcheck\") to a string of 'false',", "# ...
convertToBooleanString - Converts a value to either a string of "true" or "false" @param val <int/str/bool> - Value
[ "convertToBooleanString", "-", "Converts", "a", "value", "to", "either", "a", "string", "of", "true", "or", "false" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/conversions.py#L38-L60
kata198/AdvancedHTMLParser
AdvancedHTMLParser/conversions.py
convertBooleanStringToBoolean
def convertBooleanStringToBoolean(val=None): ''' convertBooleanStringToBoolean - Convert from a boolean attribute (string "true" / "false" ) into a booelan ''' if not val: return False if hasattr(val, 'lower'): val = val.lower() if val == "false": return False r...
python
def convertBooleanStringToBoolean(val=None): ''' convertBooleanStringToBoolean - Convert from a boolean attribute (string "true" / "false" ) into a booelan ''' if not val: return False if hasattr(val, 'lower'): val = val.lower() if val == "false": return False r...
[ "def", "convertBooleanStringToBoolean", "(", "val", "=", "None", ")", ":", "if", "not", "val", ":", "return", "False", "if", "hasattr", "(", "val", ",", "'lower'", ")", ":", "val", "=", "val", ".", "lower", "(", ")", "if", "val", "==", "\"false\"", "...
convertBooleanStringToBoolean - Convert from a boolean attribute (string "true" / "false" ) into a booelan
[ "convertBooleanStringToBoolean", "-", "Convert", "from", "a", "boolean", "attribute", "(", "string", "true", "/", "false", ")", "into", "a", "booelan" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/conversions.py#L62-L74
kata198/AdvancedHTMLParser
AdvancedHTMLParser/conversions.py
convertToPositiveInt
def convertToPositiveInt(val=None, invalidDefault=0): ''' convertToPositiveInt - Convert to a positive integer, and if invalid use a given value ''' if val is None: return invalidDefault try: val = int(val) except: return invalidDefault if val < 0: retur...
python
def convertToPositiveInt(val=None, invalidDefault=0): ''' convertToPositiveInt - Convert to a positive integer, and if invalid use a given value ''' if val is None: return invalidDefault try: val = int(val) except: return invalidDefault if val < 0: retur...
[ "def", "convertToPositiveInt", "(", "val", "=", "None", ",", "invalidDefault", "=", "0", ")", ":", "if", "val", "is", "None", ":", "return", "invalidDefault", "try", ":", "val", "=", "int", "(", "val", ")", "except", ":", "return", "invalidDefault", "if"...
convertToPositiveInt - Convert to a positive integer, and if invalid use a given value
[ "convertToPositiveInt", "-", "Convert", "to", "a", "positive", "integer", "and", "if", "invalid", "use", "a", "given", "value" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/conversions.py#L77-L92
kata198/AdvancedHTMLParser
AdvancedHTMLParser/conversions.py
_handleInvalid
def _handleInvalid(invalidDefault): ''' _handleInvalid - Common code for raising / returning an invalid value @param invalidDefault <None/str/Exception> - The value to return if "val" is not empty string/None and "val" is not in #possib...
python
def _handleInvalid(invalidDefault): ''' _handleInvalid - Common code for raising / returning an invalid value @param invalidDefault <None/str/Exception> - The value to return if "val" is not empty string/None and "val" is not in #possib...
[ "def", "_handleInvalid", "(", "invalidDefault", ")", ":", "# If not", "# If an instantiated Exception, raise that exception", "try", ":", "isInstantiatedException", "=", "bool", "(", "issubclass", "(", "invalidDefault", ".", "__class__", ",", "Exception", ")", ")", "e...
_handleInvalid - Common code for raising / returning an invalid value @param invalidDefault <None/str/Exception> - The value to return if "val" is not empty string/None and "val" is not in #possibleValues If instantiated Excep...
[ "_handleInvalid", "-", "Common", "code", "for", "raising", "/", "returning", "an", "invalid", "value" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/conversions.py#L94-L127
kata198/AdvancedHTMLParser
AdvancedHTMLParser/conversions.py
convertPossibleValues
def convertPossibleValues(val, possibleValues, invalidDefault, emptyValue=''): ''' convertPossibleValues - Convert input value to one of several possible values, with a default for invalid entries @param val <None/str> - The input value ...
python
def convertPossibleValues(val, possibleValues, invalidDefault, emptyValue=''): ''' convertPossibleValues - Convert input value to one of several possible values, with a default for invalid entries @param val <None/str> - The input value ...
[ "def", "convertPossibleValues", "(", "val", ",", "possibleValues", ",", "invalidDefault", ",", "emptyValue", "=", "''", ")", ":", "from", ".", "utils", "import", "tostr", "# If null, retain null", "if", "val", "is", "None", ":", "if", "emptyValue", "is", "EMPT...
convertPossibleValues - Convert input value to one of several possible values, with a default for invalid entries @param val <None/str> - The input value @param possibleValues list<str> - A list of possible values @param invalidDefa...
[ "convertPossibleValues", "-", "Convert", "input", "value", "to", "one", "of", "several", "possible", "values", "with", "a", "default", "for", "invalid", "entries" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/conversions.py#L130-L174
kata198/AdvancedHTMLParser
AdvancedHTMLParser/conversions.py
convertToIntRange
def convertToIntRange(val, minValue, maxValue, invalidDefault, emptyValue=''): ''' converToIntRange - Convert input value to an integer within a certain range @param val <None/str/int/float> - The input value @param minValue <None/int> - The minimum value (inclusive), o...
python
def convertToIntRange(val, minValue, maxValue, invalidDefault, emptyValue=''): ''' converToIntRange - Convert input value to an integer within a certain range @param val <None/str/int/float> - The input value @param minValue <None/int> - The minimum value (inclusive), o...
[ "def", "convertToIntRange", "(", "val", ",", "minValue", ",", "maxValue", ",", "invalidDefault", ",", "emptyValue", "=", "''", ")", ":", "from", ".", "utils", "import", "tostr", "# If null, retain null", "if", "val", "is", "None", "or", "val", "==", "''", ...
converToIntRange - Convert input value to an integer within a certain range @param val <None/str/int/float> - The input value @param minValue <None/int> - The minimum value (inclusive), or None if no minimum @param maxValue <None/int> - The maximum value (inclusive), o...
[ "converToIntRange", "-", "Convert", "input", "value", "to", "an", "integer", "within", "a", "certain", "range", "@param", "val", "<None", "/", "str", "/", "int", "/", "float", ">", "-", "The", "input", "value" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/conversions.py#L177-L218
kata198/AdvancedHTMLParser
AdvancedHTMLParser/SpecialAttributes.py
SpecialAttributesDict._setTag
def _setTag(self, tag): ''' _setTag - INTERNAL METHOD. Associated a given AdvancedTag to this attributes dict. If bool(#tag) is True, will set the weakref to that tag. Otherwise, will clear the reference @param tag <AdvancedTag...
python
def _setTag(self, tag): ''' _setTag - INTERNAL METHOD. Associated a given AdvancedTag to this attributes dict. If bool(#tag) is True, will set the weakref to that tag. Otherwise, will clear the reference @param tag <AdvancedTag...
[ "def", "_setTag", "(", "self", ",", "tag", ")", ":", "if", "tag", ":", "self", ".", "_tagRef", "=", "weakref", ".", "ref", "(", "tag", ")", "else", ":", "self", ".", "_tagRef", "=", "None" ]
_setTag - INTERNAL METHOD. Associated a given AdvancedTag to this attributes dict. If bool(#tag) is True, will set the weakref to that tag. Otherwise, will clear the reference @param tag <AdvancedTag/None> - Either the AdvancedTag to associate, or...
[ "_setTag", "-", "INTERNAL", "METHOD", ".", "Associated", "a", "given", "AdvancedTag", "to", "this", "attributes", "dict", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/SpecialAttributes.py#L46-L59
kata198/AdvancedHTMLParser
AdvancedHTMLParser/SpecialAttributes.py
SpecialAttributesDict._handleClassAttr
def _handleClassAttr(self): ''' _handleClassAttr - Hack to ensure "class" and "style" show up in attributes when classes are set, and doesn't when no classes are present on associated tag. TODO: I don't like this hack. ''' if len(self.tag._classNames)...
python
def _handleClassAttr(self): ''' _handleClassAttr - Hack to ensure "class" and "style" show up in attributes when classes are set, and doesn't when no classes are present on associated tag. TODO: I don't like this hack. ''' if len(self.tag._classNames)...
[ "def", "_handleClassAttr", "(", "self", ")", ":", "if", "len", "(", "self", ".", "tag", ".", "_classNames", ")", ">", "0", ":", "dict", ".", "__setitem__", "(", "self", ",", "\"class\"", ",", "self", ".", "tag", ".", "className", ")", "else", ":", ...
_handleClassAttr - Hack to ensure "class" and "style" show up in attributes when classes are set, and doesn't when no classes are present on associated tag. TODO: I don't like this hack.
[ "_handleClassAttr", "-", "Hack", "to", "ensure", "class", "and", "style", "show", "up", "in", "attributes", "when", "classes", "are", "set", "and", "doesn", "t", "when", "no", "classes", "are", "present", "on", "associated", "tag", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/SpecialAttributes.py#L151-L173
kata198/AdvancedHTMLParser
AdvancedHTMLParser/SpecialAttributes.py
SpecialAttributesDict.get
def get(self, key, default=None): ''' get - Gets an attribute by key with the chance to provide a default value @param key <str> - The key to query @param default <Anything> Default None - The value to return if key is not found @return - The value of ...
python
def get(self, key, default=None): ''' get - Gets an attribute by key with the chance to provide a default value @param key <str> - The key to query @param default <Anything> Default None - The value to return if key is not found @return - The value of ...
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "key", "=", "key", ".", "lower", "(", ")", "if", "key", "==", "'class'", ":", "return", "self", ".", "tag", ".", "className", "if", "key", "in", "(", "'style'", ",", ...
get - Gets an attribute by key with the chance to provide a default value @param key <str> - The key to query @param default <Anything> Default None - The value to return if key is not found @return - The value of attribute at #key, or #default if not present.
[ "get", "-", "Gets", "an", "attribute", "by", "key", "with", "the", "chance", "to", "provide", "a", "default", "value" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/SpecialAttributes.py#L187-L205
kata198/AdvancedHTMLParser
AdvancedHTMLParser/SpecialAttributes.py
SpecialAttributesDict._direct_set
def _direct_set(self, key, value): ''' _direct_set - INTERNAL USE ONLY!!!! Directly sets a value on the underlying dict, without running through the setitem logic ''' dict.__setitem__(self, key, value) return value
python
def _direct_set(self, key, value): ''' _direct_set - INTERNAL USE ONLY!!!! Directly sets a value on the underlying dict, without running through the setitem logic ''' dict.__setitem__(self, key, value) return value
[ "def", "_direct_set", "(", "self", ",", "key", ",", "value", ")", ":", "dict", ".", "__setitem__", "(", "self", ",", "key", ",", "value", ")", "return", "value" ]
_direct_set - INTERNAL USE ONLY!!!! Directly sets a value on the underlying dict, without running through the setitem logic
[ "_direct_set", "-", "INTERNAL", "USE", "ONLY!!!!" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/SpecialAttributes.py#L207-L215
kata198/AdvancedHTMLParser
AdvancedHTMLParser/SpecialAttributes.py
StyleAttribute.setTag
def setTag(self, tag): ''' setTag - Set the tag association for this style. This will handle the underlying weakref to the tag. Call setTag(None) to clear the association, otherwise setTag(tag) to associate this style to that tag. @param ta...
python
def setTag(self, tag): ''' setTag - Set the tag association for this style. This will handle the underlying weakref to the tag. Call setTag(None) to clear the association, otherwise setTag(tag) to associate this style to that tag. @param ta...
[ "def", "setTag", "(", "self", ",", "tag", ")", ":", "if", "tag", ":", "self", ".", "_tagRef", "=", "weakref", ".", "ref", "(", "tag", ")", "else", ":", "self", ".", "_tagRef", "=", "None" ]
setTag - Set the tag association for this style. This will handle the underlying weakref to the tag. Call setTag(None) to clear the association, otherwise setTag(tag) to associate this style to that tag. @param tag <AdvancedTag/None> - The new association. If ...
[ "setTag", "-", "Set", "the", "tag", "association", "for", "this", "style", ".", "This", "will", "handle", "the", "underlying", "weakref", "to", "the", "tag", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/SpecialAttributes.py#L445-L462
kata198/AdvancedHTMLParser
AdvancedHTMLParser/SpecialAttributes.py
StyleAttribute._ensureHtmlAttribute
def _ensureHtmlAttribute(self): ''' _ensureHtmlAttribute - INTERNAL METHOD. Ensure the "style" attribute is present in the html attributes when is has a value, and absent when it does not. This requires speci...
python
def _ensureHtmlAttribute(self): ''' _ensureHtmlAttribute - INTERNAL METHOD. Ensure the "style" attribute is present in the html attributes when is has a value, and absent when it does not. This requires speci...
[ "def", "_ensureHtmlAttribute", "(", "self", ")", ":", "tag", "=", "self", ".", "tag", "if", "tag", ":", "styleDict", "=", "self", ".", "_styleDict", "tagAttributes", "=", "tag", ".", "_attributes", "# If this is called before we have _attributes setup", "if", "not...
_ensureHtmlAttribute - INTERNAL METHOD. Ensure the "style" attribute is present in the html attributes when is has a value, and absent when it does not. This requires special linkage.
[ "_ensureHtmlAttribute", "-", "INTERNAL", "METHOD", ".", "Ensure", "the", "style", "attribute", "is", "present", "in", "the", "html", "attributes", "when", "is", "has", "a", "value", "and", "absent", "when", "it", "does", "not", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/SpecialAttributes.py#L519-L542
kata198/AdvancedHTMLParser
AdvancedHTMLParser/SpecialAttributes.py
StyleAttribute.setProperty
def setProperty(self, name, value): ''' setProperty - Set a style property to a value. NOTE: To remove a style, use a value of empty string, or None @param name <str> - The style name. NOTE: The dash names are expected here, whereas dot-access ...
python
def setProperty(self, name, value): ''' setProperty - Set a style property to a value. NOTE: To remove a style, use a value of empty string, or None @param name <str> - The style name. NOTE: The dash names are expected here, whereas dot-access ...
[ "def", "setProperty", "(", "self", ",", "name", ",", "value", ")", ":", "styleDict", "=", "self", ".", "_styleDict", "if", "value", "in", "(", "''", ",", "None", ")", ":", "try", ":", "del", "styleDict", "[", "name", "]", "except", "KeyError", ":", ...
setProperty - Set a style property to a value. NOTE: To remove a style, use a value of empty string, or None @param name <str> - The style name. NOTE: The dash names are expected here, whereas dot-access expects the camel case names. Example...
[ "setProperty", "-", "Set", "a", "style", "property", "to", "a", "value", "." ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/SpecialAttributes.py#L555-L577
kata198/AdvancedHTMLParser
AdvancedHTMLParser/SpecialAttributes.py
StyleAttribute.dashNameToCamelCase
def dashNameToCamelCase(dashName): ''' dashNameToCamelCase - Converts a "dash name" (like padding-top) to its camel-case name ( like "paddingTop" ) @param dashName <str> - A name containing dashes NOTE: This method is currently unused, but may be used in the future. kep...
python
def dashNameToCamelCase(dashName): ''' dashNameToCamelCase - Converts a "dash name" (like padding-top) to its camel-case name ( like "paddingTop" ) @param dashName <str> - A name containing dashes NOTE: This method is currently unused, but may be used in the future. kep...
[ "def", "dashNameToCamelCase", "(", "dashName", ")", ":", "nameParts", "=", "dashName", ".", "split", "(", "'-'", ")", "for", "i", "in", "range", "(", "1", ",", "len", "(", "nameParts", ")", ",", "1", ")", ":", "nameParts", "[", "i", "]", "[", "0", ...
dashNameToCamelCase - Converts a "dash name" (like padding-top) to its camel-case name ( like "paddingTop" ) @param dashName <str> - A name containing dashes NOTE: This method is currently unused, but may be used in the future. kept for completeness. @return <str> - The camel-...
[ "dashNameToCamelCase", "-", "Converts", "a", "dash", "name", "(", "like", "padding", "-", "top", ")", "to", "its", "camel", "-", "case", "name", "(", "like", "paddingTop", ")" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/SpecialAttributes.py#L598-L612
kata198/AdvancedHTMLParser
AdvancedHTMLParser/SpecialAttributes.py
StyleAttribute.camelCaseToDashName
def camelCaseToDashName(camelCase): ''' camelCaseToDashName - Convert a camel case name to a dash-name (like paddingTop to padding-top) @param camelCase <str> - A camel-case string @return <str> - A dash-name ''' camelCaseList = list(camelCase) ret...
python
def camelCaseToDashName(camelCase): ''' camelCaseToDashName - Convert a camel case name to a dash-name (like paddingTop to padding-top) @param camelCase <str> - A camel-case string @return <str> - A dash-name ''' camelCaseList = list(camelCase) ret...
[ "def", "camelCaseToDashName", "(", "camelCase", ")", ":", "camelCaseList", "=", "list", "(", "camelCase", ")", "ret", "=", "[", "]", "for", "ch", "in", "camelCaseList", ":", "if", "ch", ".", "isupper", "(", ")", ":", "ret", ".", "append", "(", "'-'", ...
camelCaseToDashName - Convert a camel case name to a dash-name (like paddingTop to padding-top) @param camelCase <str> - A camel-case string @return <str> - A dash-name
[ "camelCaseToDashName", "-", "Convert", "a", "camel", "case", "name", "to", "a", "dash", "-", "name", "(", "like", "paddingTop", "to", "padding", "-", "top", ")" ]
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/SpecialAttributes.py#L615-L635