7.3.2.2.4. dsp

class dsp(rawsource='', *children, **attributes)[source]

Methods

__init__

append

append_attr_list

For each element in values, if it does not exist in self[attr], append it.

asdom

Return a DOM fragment representation of this Node.

astext

Return a string representation of this Node.

attlist

clear

coerce_append_attr_list

First, convert both self[attr] and value to a non-string sequence type; if either is not already a sequence, convert it to a list of one element.

copy

Monkey-patch `nodes.Element.copy` to not copy the _document attribute.

copy_attr_coerce

If attr is an attribute of self and either self[attr] or value is a list, convert all non-sequence values to a sequence of 1 element and then concatenate the two sequence, setting the result to self[attr].

copy_attr_concatenate

If attr is an attribute of self and both self[attr] and value are lists, concatenate the two sequences, setting the result to self[attr].

copy_attr_consistent

If replace is True or self[attr] is None, replace self[attr] with value.

copy_attr_convert

If attr is an attribute of self, set self[attr] to [self[attr], value], otherwise set self[attr] to value.

deepcopy

Monkey-patch `nodes.Element.deepcopy` for speed.

delattr

emptytag

endtag

extend

findall

Return an iterator yielding nodes following self:

first_child_matching_class

Return the index of the first child whose class exactly matches.

first_child_not_matching_class

Return the index of the first child whose class does not match.

get

get_language_code

Return node's language tag.

has_key

hasattr

index

insert

is_not_default

is_not_known_attribute

Returns True if and only if the given attribute is NOT recognized by this class.

is_not_list_attribute

Returns True if and only if the given attribute is NOT one of the basic list attributes defined for all Elements.

next_node

Return the first node in the iterator returned by findall(), or None if the iterable is empty.

non_default_attributes

note_referenced_by

Note that this Element has been referenced by its name name or id id.

pformat

Return an indented pseudo-XML representation, for test purposes.

pop

previous_sibling

Return preceding sibling node or None.

remove

replace

Replace one child Node with another child or children.

replace_attr

If self[attr] does not exist or force is True or omitted, set self[attr] to value, otherwise do nothing.

replace_self

Replace self node with new, where new is a node or a list of nodes.

set_class

Add a new class to the "classes" attribute.

setdefault

setup_child

shortrepr

starttag

traverse

Return list of nodes following self.

update_all_atts

Updates all attributes from node or dictionary dict_.

update_all_atts_coercion

Updates all attributes from node or dictionary dict_.

update_all_atts_concatenating

Updates all attributes from node or dictionary dict_.

update_all_atts_consistantly

Updates all attributes from node or dictionary dict_.

update_all_atts_convert

Updates all attributes from node or dictionary dict_.

update_basic_atts

Update basic attributes ('ids', 'names', 'classes', 'dupnames', but not 'source') from node or dictionary dict_.

walk

Traverse a tree of Node objects, calling the dispatch_visit() method of visitor when entering each node.

walkabout

Perform a tree traversal similarly to Node.walk() (which see), except also call the dispatch_departure() method before exiting each node.

__init__(rawsource='', *children, **attributes)

Attributes

basic_attributes

Tuple of attributes which are defined for every Element-derived class instance and can be safely transferred to a different node.

child_text_separator

Separator for child nodes, used by astext() method.

document

Return the document root node of the tree containing this Node.

known_attributes

Tuple of attributes that are known to the Element base class.

line

The line number (1-based) of the beginning of this Node in source.

list_attributes

Tuple of attributes that are automatically initialized to empty lists for all nodes.

local_attributes

Tuple of class-specific attributes that should not be copied with the standard attributes when replacing a node.

parent

Back-reference to the Node immediately containing this Node.

source

Path or description of the input source which generated this Node.

tagname

The element generic identifier.

rawsource

The raw text from which this element was constructed.

children

List of child nodes (elements and/or Text).

attributes

Dictionary of attribute {name: value}.