Package epydoc :: Package markup :: Class ParseError
[hide private]
[frames] | no frames]

Class ParseError
source code


The base class for errors generated while parsing docstrings.

Instance Methods [hide private]
int __cmp__(self, other)
Compare two ParseErrors, based on their line number.
  __init__(self, descr, linenum=None, is_fatal=1)
string __repr__(self)
Return the formal representation of this ParseError.
string __str__(self)
Return a string representation of this ParseError.
  descr(self)
boolean is_fatal(self)
int or None linenum(self)
None set_linenum_offset(self, offset)
Set the line number offset for this error.

Inherited from exceptions.Exception: __getitem__


Instance Variables [hide private]
_descr A description of the error.
_fatal True if this is a fatal error.
_linenum The line on which the error occured within the docstring.
_offset The line number where the docstring begins.

Method Details [hide private]

__cmp__(self, other)
(Comparison operator)

source code 
Compare two ParseErrors, based on their line number.
  • Return -1 if self.linenum<other.linenum
  • Return +1 if self.linenum>other.linenum
  • Return 0 if self.linenum==other.linenum.
The return value is undefined if other is not a ParseError.
Returns: int

__init__(self, descr, linenum=None, is_fatal=1)
(Constructor)

source code 
Parameters:
  • descr (string) - A description of the error.
  • linenum (int) - The line on which the error occured within the docstring. The linenum of the first line is 0.
  • is_fatal (boolean) - True if this is a fatal error.
Overrides: exceptions.Exception.__init__

__repr__(self)
(Representation operator)

source code 
Return the formal representation of this ParseError. ParseErrors have formal representations of the form:
  <ParseError on line 12>
Returns: string
the formal representation of this ParseError.

__str__(self)
(Informal representation operator)

source code 
Return a string representation of this ParseError. This multi-line string contains a description of the error, and specifies where it occured.
Returns: string
the informal representation of this ParseError.
Overrides: exceptions.Exception.__str__

descr(self)

source code 

is_fatal(self)

source code 
Returns: boolean
true if this is a fatal error. If an error is fatal, then epydoc should ignore the output of the parser, and parse the docstring as plaintext.

linenum(self)

source code 
Returns: int or None
The line number on which the error occured (including any offset). If the line number is unknown, then return None.

set_linenum_offset(self, offset)

source code 
Set the line number offset for this error. This offset is the line number where the docstring begins. This offset is added to _linenum when displaying the line number of the error.
Parameters:
  • offset (int) - The new line number offset.
Returns: None

Instance Variable Details [hide private]

_descr

A description of the error.
Type:
string

_fatal

True if this is a fatal error.
Type:
boolean

_linenum

The line on which the error occured within the docstring. The linenum of the first line is 0.
Type:
int

_offset

The line number where the docstring begins. This offset is added to _linenum when displaying the line number of the error. Default value: 1.
Type:
int