Package netaddr :: Package ip :: Class LineRecordParser
[frames] | no frames]

Class LineRecordParser

source code

    object --+    
             |    
core.Publisher --+
                 |
                LineRecordParser
Known Subclasses:

A configurable Parser that understands how to parse line based records.

Instance Methods
 
__init__(self, fh, **kwargs)
Constructor.
source code
 
parse_line(self, line)
This is the callback method invoked for every line considered valid by the line parser's settings.
source code
 
parse(self)
Parse and normalises records, notifying registered subscribers with record data as it is encountered.
source code

Inherited from core.Publisher: attach, detach, notify

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, fh, **kwargs)
(Constructor)

source code 

Constructor.

fh - a valid, open file handle to line based record data.

Overrides: object.__init__

parse_line(self, line)

source code 

This is the callback method invoked for every line considered valid by the line parser's settings. It is usually over-ridden by base classes to provide specific line parsing and line skipping logic.

Any line can be vetoed (not passed to registered Subscriber objects) by simply returning None.