Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_htmlparser.EventCollector Class Reference
Inheritance diagram for test.test_htmlparser.EventCollector:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def get_events
def handle_starttag
def handle_startendtag
def handle_endtag
def handle_comment
def handle_charref
def handle_data
def handle_decl
def handle_entityref
def handle_pi
def unknown_decl

Public Attributes

 events
 append

Detailed Description

Definition at line 9 of file test_htmlparser.py.


Constructor & Destructor Documentation

def test.test_htmlparser.EventCollector.__init__ (   self,
  args,
  kw 
)

Definition at line 11 of file test_htmlparser.py.

00011 
00012     def __init__(self, *args, **kw):
00013         self.events = []
00014         self.append = self.events.append
00015         html.parser.HTMLParser.__init__(self, *args, **kw)

Here is the caller graph for this function:


Member Function Documentation

Definition at line 16 of file test_htmlparser.py.

00016 
00017     def get_events(self):
00018         # Normalize the list of events so that buffer artefacts don't
00019         # separate runs of contiguous characters.
00020         L = []
00021         prevtype = None
00022         for event in self.events:
00023             type = event[0]
00024             if type == prevtype == "data":
00025                 L[-1] = ("data", L[-1][1] + event[1])
00026             else:
00027                 L.append(event)
00028             prevtype = type
00029         self.events = L
00030         return L

Definition at line 47 of file test_htmlparser.py.

00047 
00048     def handle_charref(self, data):
00049         self.append(("charref", data))

Definition at line 44 of file test_htmlparser.py.

00044 
00045     def handle_comment(self, data):
00046         self.append(("comment", data))

Definition at line 50 of file test_htmlparser.py.

00050 
00051     def handle_data(self, data):
00052         self.append(("data", data))

Definition at line 53 of file test_htmlparser.py.

00053 
00054     def handle_decl(self, data):
00055         self.append(("decl", data))

Definition at line 39 of file test_htmlparser.py.

00039 
00040     def handle_endtag(self, tag):
00041         self.append(("endtag", tag))

Definition at line 56 of file test_htmlparser.py.

00056 
00057     def handle_entityref(self, data):
00058         self.append(("entityref", data))

Definition at line 59 of file test_htmlparser.py.

00059 
00060     def handle_pi(self, data):
00061         self.append(("pi", data))

def test.test_htmlparser.EventCollector.handle_startendtag (   self,
  tag,
  attrs 
)

Definition at line 36 of file test_htmlparser.py.

00036 
00037     def handle_startendtag(self, tag, attrs):
00038         self.append(("startendtag", tag, attrs))

def test.test_htmlparser.EventCollector.handle_starttag (   self,
  tag,
  attrs 
)

Reimplemented in test.test_htmlparser.EventCollectorExtra.

Definition at line 33 of file test_htmlparser.py.

00033 
00034     def handle_starttag(self, tag, attrs):
00035         self.append(("starttag", tag, attrs))

Definition at line 62 of file test_htmlparser.py.

00062 
00063     def unknown_decl(self, decl):
00064         self.append(("unknown decl", decl))
00065 


Member Data Documentation

Definition at line 13 of file test_htmlparser.py.

Definition at line 12 of file test_htmlparser.py.


The documentation for this class was generated from the following file: