| |
- builtins.list(builtins.object)
-
- TagCollection
- builtins.object
-
- AdvancedTag
- FilterableTagCollection
class AdvancedTag(builtins.object) |
|
AdvancedTag - Represents a Tag. Used with AdvancedHTMLParser to create a DOM-model
Keep tag names lowercase.
Use the getters and setters instead of attributes directly, or you may lose accounting. |
|
Methods defined here:
- __copy__(self)
- __copy__ - Create a copy (except uid). This tag will NOT ==.
but is safe to add to the same tree as its original
- __deepcopy__(self, arg)
- __deepcopy__ - Create a copy (except uid) for deepcopy. This tag will NOT ==
but is safe to add to the same tree as its original
- __eq__(self, other)
- __eq__ - Test if this and other are THE SAME TAG.
Note: this does NOT test if the tags have the same name, attributes, etc.
Use isTagEqual to test if a tag has the same data (other than children)
So for example:
tag1 = document.getElementById('something')
tag2 = copy.copy(tag1)
tag1 == tag2 # This is False
tag1.isTagEqual(tag2) # This is True
- __getattribute__(self, name)
- Return getattr(self, name).
- __getitem__(self, key)
- __hash__(self)
- Return hash(self).
- __init__(self, tagName, attrList=None, isSelfClosing=False, ownerDocument=None)
- __init__ - Construct
@param tagName - String of tag name. This will be lowercased!
@param attrList - A list of tuples (key, value)
@param isSelfClosing - True if self-closing tag ( <tagName attrs /> ) will be set to False if text or children are added.
@param ownerDocument <None/AdvancedHTMLParser> - The parser (document) associated with this tag, or None for no association
- __ne__(self, other)
- __ne__ - Test if this and other are NOT THE SAME TAG. Note
Note: this does NOT test if the tags have the same name, attributes, etc.
Use isTagEqual to test if a tag has the same data (other than children)
@see AdvancedTag.__eq__
@see AdvancedTag.isTagEqual
- __repr__(self)
- __repr__ - A reconstructable representation of this AdvancedTag.
TODO: Incorporate uid somehow? Without it the tags won't be the SAME TAG, but they'll be equivilant
- __setattr__(self, name, value)
- Implement setattr(self, name, value).
- __str__(self)
- __str__ - Returns start tag, inner text, and end tag
- addClass(self, className)
- addClass - append a class name if not present
- appendBlock(self, block)
- 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 appendChild for tags or @see appendText for text
- 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 add a single block, @see appendBlock
If you know the type, use either @see appendChild for tags or @see appendText for text
- appendChild(self, child)
- appendChild - Append a child to this element.
@param child <AdvancedTag> - Append a child element to this element
- 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 associated with
that document.
@return - None. A browser would return innerHTML, but that's somewhat expensive on a high-level node.
So just call .innerHTML explicitly if you need that
- appendNode = appendChild(self, child)
- appendText(self, text)
- appendText - append some inner text
- 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.
- contains(self, other)
- contains - Check if a provided tag appears anywhere as a sub to this node, or is this node itself.
@param other <AdvancedTag> - Tag to check
@return <bool> - True if #other appears anywhere beneath or is this tag, otherwise False
- containsUid(self, uid)
- containsUid - Check if the uid (unique internal ID) appears anywhere as a sub 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
- filter(self, **kwargs)
- filter aka filterAnd - Perform a filter operation on this node and all children (and all their children, onto the end)
Results must match ALL the filter criteria. for ANY, use the *Or methods
For special filter keys, @see #AdvancedHTMLParser.AdvancedHTMLParser.filter
Requires the QueryableList module to be installed (i.e. AdvancedHTMLParser was installed
without '--no-deps' flag.)
For alternative without QueryableList,
consider #AdvancedHTMLParser.AdvancedHTMLParser.find method or the getElement* methods
@return TagCollection<AdvancedTag>
- filterAnd = filter(self, **kwargs)
- filterOr(self, **kwargs)
- filterOr - Perform a filter operation on this node and all children (and their children, onto the end)
Results must match ANY the filter criteria. for ALL, use the *AND methods
For special filter keys, @see #AdvancedHTMLParser.AdvancedHTMLParser.filter
Requires the QueryableList module to be installed (i.e. AdvancedHTMLParser was installed
without '--no-deps' flag.)
For alternative without QueryableList,
consider #AdvancedHTMLParser.AdvancedHTMLParser.find method or the getElement* methods
@return TagCollection<AdvancedTag>
- 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
@return set<uuid.UUID> A set of uuid objects
- getAllChildNodes(self)
- getAllChildNodes - Gets all the children, and their children,
and their children, and so on, all the way to the end
@return TagCollection<AdvancedTag>
- 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
- getAllNodes(self)
- getAllNodes - Returns this node, all children, and all their children and so on till the end
@return TagCollection<AdvancedTag>
- 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.
- 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, you'll need to recreate those elements (like StyleAttribute(strValue) ).
@return <dict ( str(name), str(value) )> - A dict of attrName to attrValue , all as strings and copies.
- 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, you'll need to recreate those elements (like StyleAttribute(strValue) ).
@return list< tuple< str(name), str(value) > > - A list of tuples of attrName, attrValue pairs, all converted to strings.
This is suitable for passing back into AdvancedTag when creating a new tag.
- getChildBlocks(self)
- getChildBlocks - Gets the child blocks.
@see childBlocks
- getChildren(self)
- getChildren - returns child nodes as a searchable TagCollection.
@return - TagCollection of the immediate children to this tag.
- getElementById(self, _id)
- getElementById - Search children of this tag for a tag containing an id
@param _id - String of id
@return - AdvancedTag or None
- 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 elements
- 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
- getElementsByName(self, name)
- getElementsByName - Search children of this tag for tags with a given name
@param name - name to search
@return - TagCollection of matching elements
- 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.
@return - TagCollection of matching results
@see getFirstElementCustomFilter
- 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 acceptable attribute values
@return - TagCollection of matching elements
- getEndTag(self)
- getEndTag - returns the end tag
@return - String of end tag
- 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> - A function or lambda expression that should return "True" if the passed node matches criteria.
@return <AdvancedTag/None> - First match, or None
@see getElementsCustomFilter
- getPeers(self)
- getPeers - Get elements who share a parent with this element
@return - TagCollection of elements
- 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 (error condition), otherwise a TagCollection of peers that matched.
- 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 matched.
- 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.
- 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 - List of possible values which will match
@return - None if no parent element (error condition), otherwise a TagCollection of peers that matched.
- getStartTag(self)
- getStartTag - Returns the start tag
@return - String of start tag with attributes
- getStyle(self, styleName)
- getStyle - Gets the value of a style paramater, part of the "style" attribute
@param styleName - The name of the style
@return - String of the value of the style. '' is no value.
- getStyleDict(self)
- getStyleDict - Gets a dictionary of style attribute/value pairs.
@return - OrderedDict of "style" attribute.
- getTagName(self)
- getTagName - Gets the tag name of this Tag.
@return - str
- getUid(self)
- 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
- hasChild(self, child)
- hasChild - Returns if #child is a DIRECT child of this node.
@param child <AdvancedTag> - The tag to check
@return <bool> - If #child is a direct child of this node, True. Otherwise, False.
- hasChildNodes(self)
- hasChildNodes - Checks if this node has any children.
@return <bool> - True if this child has any children, otherwise False.
- hasClass(self, className)
- hasClass - Test if this tag has a paticular class name
@param className - A class to search
- 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 - The added child. Note, if it is a text block (str), the return isl NOT be linked by reference.
- 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
@return - The added child. Note, if it is a text block (str), the return isl NOT be linked by reference.
- isEqualNode = __eq__(self, other)
- 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 tag in the html (use regular == operator for that)
So for example:
tag1 = document.getElementById('something')
tag2 = copy.copy(tag1)
tag1 == tag2 # This is False
tag1.isTagEqual(tag2) # This is True
@return bool - True if tags have the same name and attributes, otherwise False
- 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.
@return <bool> - While JS DOM defines no return for this function, this function will return True if a
remove did happen, or False if no parent was set.
- removeAttribute(self, attrName)
- removeAttribute - Removes an attribute, by name.
@param attrName <str> - The attribute name
- 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 removed, or None if requested block is not a child of this node.
NOTE: If you know you are going to remove an AdvancedTag, @see removeChild
If you know you are going to remove a text node, @see removeText
If removing multiple blocks, @see removeBlocks
- 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 in each slot, or None if None removed.
@see removeChild
@see removeText
For multiple, @see removeBlocks
- 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 block, use #removeText function.
If you need to remove an arbitrary block (text or AdvancedTag), @see removeBlock
Removing multiple children? @see removeChildren
- 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 was not removed.
- removeClass(self, className)
- removeClass - remove a class name if present. Returns the class name if removed, otherwise None.
- removeNode = removeChild(self, child)
- 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: To remove a node, @see removeChild
NOTE: To remove a block (maybe a node, maybe text), @see removeBlock
NOTE: To remove ALL occuraces of text, @see removeTextAll
- 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 no text removed
NOTE: To remove a node, @see removeChild
NOTE: To remove a block (maybe a node, maybe text), @see removeBlock
NOTE: To remove a single occurace of text, @see removeText
- setAttribute(self, attrName, attrValue)
- setAttribute - Sets an attribute. Be wary using this for classname, maybe use addClass/removeClass. Attribute names are all lowercase.
@param attrName <str> - The name of the attribute
@param attrValue <str> - The value of the attribute
- setAttributes(self, attributesDict)
- setAttributes - Sets several attributes at once, using a dictionary of attrName : attrValue
@param attributesDict - <str:str> - New attribute names -> values
- 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)
To remove a style, set its value to empty string.
When all styles are removed, the "style" attribute will be nullified.
@param styleName - The name of the style element
@param styleValue - The value of which to assign the style element
@return - String of current value of "style" after change is made.
- 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 removed, the "style" attribute will be nullified.
@param styleUpdatesDict - Dictionary of attribute : value styles.
@return - String of current value of "style" after change is made.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- attributes
- attributesDict - Returns the internal dict mapped to attributes on this object.
Modifications made here WILL affect this tag, use getAttributesDict to get a copy.
This is the default provider of the "attributes" property. Can be toggled to use the DOM-matching version, see @toggleAttributesDOM
@return <dict> - Internal attributes
- attributesDOM
- attributes - Return a NamedNodeMap of the attributes on this object.
This is a horrible method and is not used in practice anywhere sane.
Please use setAttribute, getAttribute, hasAttribute methods instead.
@see SpecialAttributes.NamedNodeMap
This is NOT the default provider of the "attributes" property. Can be toggled to use the DOM-matching version, see @toggleAttributesDOM
@return AttributeNodeMap
- attributesDict
- attributesDict - Returns the internal dict mapped to attributes on this object.
Modifications made here WILL affect this tag, use getAttributesDict to get a copy.
This is the default provider of the "attributes" property. Can be toggled to use the DOM-matching version, see @toggleAttributesDOM
@return <dict> - Internal attributes
- childBlocks
- childBlocks - Return immediate child blocks, both text and tags.
@return list<AdvancedTag/str> - List of blocks associated with this node
NOTE: This does what #childNodes does in JS DOM. Because for many years childNodes has returned
ONLY tags on AdvancedHTMLParser, it would be a major change to match. Likely will be made in a future
version.
- childElementCount
- childElementCount - Returns the number of direct children to this node
@return <int> - The number of direct children to this node
- childNodes
- childNodes - returns immediate child nodes as a TagCollection
@return - TagCollection of child nodes
NOTE: Unlike JS DOM, this returns ONLY tags, not text blocks.
Changing this would be a fairly-major backwards-incompatible change,
and will likely be made in a future version.
For now, use @see childBlocks method to get both text AND tags
- classList
- classList - get the list of class names
- innerHTML
- innerHTML - Returns a string of the inner contents of this tag, including children.
@return - String of inner contents
- nextSibling
- nextSibling - Returns the next sibling. This could be text or an element. use nextSiblingElement to ensure element
- nextSiblingElement
- nextSiblingElement - Returns the next sibling that is an element.
- nodeName
- nodeName - Return the name of this name (tag name)
- nodeType
- nodeType - Return the type of this node (1 - ELEMENT_NODE)
- nodeValue
- nodeValue - Return the value of this node (None)
- outerHTML
- outerHTML - Returns start tag, innerHTML, and end tag
@return - String of start tag, innerHTML, and end tag
- parentElement
- parentElement - get the parent element
- peers
- peers - Get elements with same parent as this item
@return - TagCollection of elements
- previousSibling
- previousSibling - Returns the previous sibling. This could be text or an element. use previousSiblingElement to ensure element
- previousSiblingElement
- previousSiblingElement - Returns the previous sibling that is an element.
|
class FilterableTagCollection(builtins.object) |
| |
Methods defined here:
- __init__(self, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class TagCollection(builtins.list) |
|
A collection of AdvancedTags. You may use this like a normal list, or you can use the various getElements* functions within to operate on the results.
Generally, this is the return of all get* functions.
All the get* functions called on a TagCollection search all contained elements and their childrens. If you need to check ONLY the elements in the tag collection, and not their children,
either provide your own list comprehension to do so, or use the "filterCollection" method, which takes an arbitrary function/lambda expression and filters just the immediate tags. |
|
- Method resolution order:
- TagCollection
- builtins.list
- builtins.object
Methods defined here:
- __add__(self, others)
- Return self+value.
- __iadd__(self, others)
- Implement self+=value.
- __init__(self, values=None)
- Create this object.
@param values - Initial values, or None for empty
- __isub__(self, others)
- __repr__(self)
- Return repr(self).
- __sub__(self, others)
- all(self)
- all - A plain list of these elements
@return - List of these elements
- append(self, tag)
- append - Append an item to this tag collection
@param tag - an AdvancedTag
- 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.
@param em <AdvancedTag> - Element of interest
@return <bool> - True if contained, otherwise False
- 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 <bool> - True if contained, otherwise False
- filter(self, **kwargs)
- filter aka filterAnd - Perform a filter operation on ALL nodes in this collection (NOT including children, see #filterAnd for that)
Results must match ALL the filter criteria. for ANY, use the *Or methods
For special filter keys, @see #AdvancedHTMLParser.AdvancedHTMLParser.filter
Requires the QueryableList module to be installed (i.e. AdvancedHTMLParser was installed
without '--no-deps' flag.)
For alternative without QueryableList,
consider #AdvancedHTMLParser.AdvancedHTMLParser.find method or the getElement* methods
@return TagCollection<AdvancedTag>
- 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 "filterAnd" on a TagCollection
For special filter keys, @see #AdvancedHTMLParser.AdvancedHTMLParser.filter
Requires the QueryableList module to be installed (i.e. AdvancedHTMLParser was installed
without '--no-deps' flag.)
For alternative without QueryableList,
consider #AdvancedHTMLParser.AdvancedHTMLParser.find method or the getElement* methods
@return TagCollection<AdvancedTag>
- 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 TagCollection
For special filter keys, @see #AdvancedHTMLParser.AdvancedHTMLParser.filter
Requires the QueryableList module to be installed (i.e. AdvancedHTMLParser was installed
without '--no-deps' flag.)
For alternative without QueryableList,
consider #AdvancedHTMLParser.AdvancedHTMLParser.find method or the getElement* methods
@return TagCollection<AdvancedTag>
- filterAnd = filter(self, **kwargs)
- 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
@return TagCollection<AdvancedTag>
- filterOr(self, **kwargs)
- filterOr - Perform a filter operation on the nodes in this collection (NOT including children, see #filterAllOr for that)
Results must match ANY the filter criteria. for ALL, use the *And methods
For special filter keys, @see #AdvancedHTMLParser.AdvancedHTMLParser.filter
Requires the QueryableList module to be installed (i.e. AdvancedHTMLParser was installed
without '--no-deps' flag.)
For alternative without QueryableList,
consider #AdvancedHTMLParser.AdvancedHTMLParser.find method or the getElement* methods
@return TagCollection<AdvancedTag>
- getAllNodeUids(self)
- getAllNodeUids - Gets all the internal uids of all nodes, their children, and all their children so on..
@return set<uuid.UUID>
- getAllNodes(self)
- getAllNodes - Gets all the nodes, and all their children for every node within this collection
- 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
- 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 name/value
- 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 class name
- 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"
- 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
- 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 elements that matched criteria
- 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 matching values
@return - TagCollection of all elements matching criteria
- remove(self, toRemove)
- remove - Remove an item from this tag collection
@param toRemove - an AdvancedTag
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- filterAllAnd = <class 'filter'>
- filter(function or None, iterable) --> filter object
Return an iterator yielding those items of iterable for which function(item)
is true. If function is None, return the items that are true.
Methods inherited from builtins.list:
- __contains__(self, key, /)
- Return key in self.
- __delitem__(self, key, /)
- Delete self[key].
- __eq__(self, value, /)
- Return self==value.
- __ge__(self, value, /)
- Return self>=value.
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __gt__(self, value, /)
- Return self>value.
- __imul__(self, value, /)
- Implement self*=value.
- __iter__(self, /)
- Implement iter(self).
- __le__(self, value, /)
- Return self<=value.
- __len__(self, /)
- Return len(self).
- __lt__(self, value, /)
- Return self<value.
- __mul__(self, value, /)
- Return self*value.n
- __ne__(self, value, /)
- Return self!=value.
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
- __reversed__(...)
- L.__reversed__() -- return a reverse iterator over the list
- __rmul__(self, value, /)
- Return self*value.
- __setitem__(self, key, value, /)
- Set self[key] to value.
- __sizeof__(...)
- L.__sizeof__() -- size of L in memory, in bytes
- clear(...)
- L.clear() -> None -- remove all items from L
- copy(...)
- L.copy() -> list -- a shallow copy of L
- count(...)
- L.count(value) -> integer -- return number of occurrences of value
- extend(...)
- L.extend(iterable) -> None -- extend list by appending elements from the iterable
- index(...)
- L.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
- insert(...)
- L.insert(index, object) -- insert object before index
- pop(...)
- L.pop([index]) -> item -- remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
- reverse(...)
- L.reverse() -- reverse *IN PLACE*
- sort(...)
- L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE*
Data and other attributes inherited from builtins.list:
- __hash__ = None
| |