Better documentation of issues.

This commit is contained in:
Dave Halter
2017-09-03 23:01:34 +02:00
parent 435d310c2b
commit 5993765e0a
2 changed files with 21 additions and 1 deletions

View File

@@ -25,7 +25,6 @@ Typically if you want to work with one specific Python version, use:
.. autofunction:: parso.load_grammar .. autofunction:: parso.load_grammar
Grammar methods Grammar methods
--------------- ---------------
@@ -37,6 +36,17 @@ issues in it:
:undoc-members: :undoc-members:
Error Retrieval
---------------
|parso| is able to find multiple errors in your source code. Iterating through
those errors yields the following instances:
.. autoclass:: parso.normalizer.Issue
:members:
:undoc-members:
Utility Utility
------- -------

View File

@@ -121,8 +121,18 @@ class Issue(object):
def __init__(self, node, code, message): def __init__(self, node, code, message):
self._node = node self._node = node
self.code = code self.code = code
"""
An integer code that stands for the type of error.
"""
self.message = message self.message = message
"""
A message (string) for the issue.
"""
self.start_pos = node.start_pos self.start_pos = node.start_pos
"""
The start position position of the error as a tuple (line, column). As
always in |parso| the first line is 1 and the first column 0.
"""
def __eq__(self, other): def __eq__(self, other):
return self.start_pos == other.start_pos and self.code == other.code return self.start_pos == other.start_pos and self.code == other.code