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

type ParseError

source code

Known Subclasses:

The base class for errors generated while parsing docstrings.

Instance Methods [hide private]
 
__init__(self, descr, linenum=None, is_fatal=1)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
boolean
is_fatal(self)
Returns: true if this is a fatal error.
source code
int or None
linenum(self)
Returns: The line number on which the error occured (including any offset).
source code
None
set_linenum_offset(self, offset)
Set the line number offset for this error.
source code
 
descr(self) source code
string
__str__(self)
Return a string representation of this ParseError.
source code
string
__repr__(self)
Return the formal representation of this ParseError.
source code
int
__cmp__(self, other)
Compare two ParseErrors, based on their line number.
source code

Inherited from exceptions.Exception: __new__

Inherited from exceptions.BaseException: __delattr__, __getattribute__, __getitem__, __getslice__, __reduce__, __setattr__, __setstate__

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

Inherited from exceptions.BaseException: args, message

Method Details [hide private]

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

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

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.BaseException.__init__

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

__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.BaseException.__str__

__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.
Overrides: exceptions.BaseException.__repr__

__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

Instance Variable Details [hide private]

_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