Documentation/Source/Pep257CheckerPy2.html

Sun, 05 Jan 2014 23:22:17 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Sun, 05 Jan 2014 23:22:17 +0100
branch
Py2 comp.
changeset 3178
f25fc1364c88
parent 3056
9986ec0e559a
permissions
-rw-r--r--

Merge with default branch.

<!DOCTYPE html>
<html><head>
<title>Pep257CheckerPy2</title>
<meta charset="UTF-8">
<style>
body {
    background: #EDECE6;
    margin: 0em 1em 10em 1em;
    color: black;
}

h1 { color: white; background: #85774A; }
h2 { color: white; background: #85774A; }
h3 { color: white; background: #9D936E; }
h4 { color: white; background: #9D936E; }
    
a { color: #BA6D36; }

</style>
</head>
<body><a NAME="top" ID="top"></a>
<h1>Pep257CheckerPy2</h1>
<p>
Module implementing a checker for PEP-257 documentation string conventions.
</p>
<h3>Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Classes</h3>
<table>
<tr>
<td><a href="#Pep257Checker">Pep257Checker</a></td>
<td>Class implementing a checker for PEP-257 documentation string conventions.</td>
</tr><tr>
<td><a href="#Pep257Context">Pep257Context</a></td>
<td>Class implementing the source context.</td>
</tr>
</table>
<h3>Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="Pep257Checker" ID="Pep257Checker"></a>
<h2>Pep257Checker</h2>
<p>
    Class implementing a checker for PEP-257 documentation string conventions.
</p>
<h3>Derived from</h3>
object
<h3>Class Attributes</h3>
<table>
<tr><td>Codes</td></tr>
</table>
<h3>Class Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>
<table>
<tr>
<td><a href="#Pep257Checker.__init__">Pep257Checker</a></td>
<td>Constructor</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkBackslashes">__checkBackslashes</a></td>
<td>Private method to check, that all docstrings containing backslashes are surrounded by raw triple double quotes.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkBlankAfterLastParagraph">__checkBlankAfterLastParagraph</a></td>
<td>Private method to check, that the last paragraph of docstrings is followed by a blank line.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkBlankAfterSummary">__checkBlankAfterSummary</a></td>
<td>Private method to check, that docstring summaries are followed by a blank line.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkBlankBeforeAndAfterClass">__checkBlankBeforeAndAfterClass</a></td>
<td>Private method to check, that class docstrings have one blank line around them.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkClassDocstring">__checkClassDocstring</a></td>
<td>Private method to check, that all public functions and methods have a docstring.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkEndsWithPeriod">__checkEndsWithPeriod</a></td>
<td>Private method to check, that docstring summaries end with a period.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkEricBlankAfterSummary">__checkEricBlankAfterSummary</a></td>
<td>Private method to check, that docstring summaries are followed by a blank line.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkEricEndsWithPeriod">__checkEricEndsWithPeriod</a></td>
<td>Private method to check, that docstring summaries end with a period.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkEricException">__checkEricException</a></td>
<td>Private method to check, that docstrings contain an &#64;exception line if they raise an exception and don't otherwise.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkEricFunctionArguments">__checkEricFunctionArguments</a></td>
<td>Private method to check, that docstrings contain an &#64;param and/or &#64;keyparam line for each argument.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkEricNBlankAfterLastParagraph">__checkEricNBlankAfterLastParagraph</a></td>
<td>Private method to check, that the last paragraph of docstrings is not followed by a blank line.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkEricNoBlankBeforeAndAfterClassOrFunction">__checkEricNoBlankBeforeAndAfterClassOrFunction</a></td>
<td>Private method to check, that class and function/method docstrings have no blank line around them.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkEricQuotesOnSeparateLines">__checkEricQuotesOnSeparateLines</a></td>
<td>Private method to check, that leading and trailing quotes are on a line by themselves.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkEricReturn">__checkEricReturn</a></td>
<td>Private method to check, that docstrings contain an &#64;return line if they return anything and don't otherwise.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkFunctionDocstring">__checkFunctionDocstring</a></td>
<td>Private method to check, that all public functions and methods have a docstring.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkImperativeMood">__checkImperativeMood</a></td>
<td>Private method to check, that docstring summaries are in imperative mood.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkIndent">__checkIndent</a></td>
<td>Private method to check, that docstrings are properly indented.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkModulesDocstrings">__checkModulesDocstrings</a></td>
<td>Private method to check, if the module has a docstring.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkNoBlankLineBefore">__checkNoBlankLineBefore</a></td>
<td>Private method to check, that function/method docstrings are not preceded by a blank line.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkNoSignature">__checkNoSignature</a></td>
<td>Private method to check, that docstring summaries don't repeat the function's signature.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkOneLiner">__checkOneLiner</a></td>
<td>Private method to check, that one-liner docstrings fit on one line with quotes.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkReturnType">__checkReturnType</a></td>
<td>Private method to check, that docstrings mention the return value type.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkTripleDoubleQuotes">__checkTripleDoubleQuotes</a></td>
<td>Private method to check, that all docstrings are surrounded by triple double quotes.</td>
</tr><tr>
<td><a href="#Pep257Checker.__checkUnicode">__checkUnicode</a></td>
<td>Private method to check, that all docstrings containing unicode characters are surrounded by unicode triple double quotes.</td>
</tr><tr>
<td><a href="#Pep257Checker.__error">__error</a></td>
<td>Private method to record an issue.</td>
</tr><tr>
<td><a href="#Pep257Checker.__getArgNames">__getArgNames</a></td>
<td></td>
</tr><tr>
<td><a href="#Pep257Checker.__getSummaryLine">__getSummaryLine</a></td>
<td>Private method to extract the summary line.</td>
</tr><tr>
<td><a href="#Pep257Checker.__getSummaryLines">__getSummaryLines</a></td>
<td>Private method to extract the summary lines.</td>
</tr><tr>
<td><a href="#Pep257Checker.__ignoreCode">__ignoreCode</a></td>
<td>Private method to check if the error code should be ignored.</td>
</tr><tr>
<td><a href="#Pep257Checker.__parseClasses">__parseClasses</a></td>
<td>Private method to extract top-level classes.</td>
</tr><tr>
<td><a href="#Pep257Checker.__parseContexts">__parseContexts</a></td>
<td>Private method to extract a context from the source.</td>
</tr><tr>
<td><a href="#Pep257Checker.__parseDocstring">__parseDocstring</a></td>
<td>Private method to extract a docstring given `def` or `class` source.</td>
</tr><tr>
<td><a href="#Pep257Checker.__parseFunctions">__parseFunctions</a></td>
<td>Private method to extract top-level functions.</td>
</tr><tr>
<td><a href="#Pep257Checker.__parseMethods">__parseMethods</a></td>
<td>Private method to extract methods of all classes.</td>
</tr><tr>
<td><a href="#Pep257Checker.__parseModuleDocstring">__parseModuleDocstring</a></td>
<td>Private method to extract a docstring given a module source.</td>
</tr><tr>
<td><a href="#Pep257Checker.__parseTopLevel">__parseTopLevel</a></td>
<td>Private method to extract top-level functions or classes.</td>
</tr><tr>
<td><a href="#Pep257Checker.__readline">__readline</a></td>
<td>Private method to get the next line from the source.</td>
</tr><tr>
<td><a href="#Pep257Checker.__resetReadline">__resetReadline</a></td>
<td>Private method to reset the internal readline function.</td>
</tr><tr>
<td><a href="#Pep257Checker.__skipIndentedBlock">__skipIndentedBlock</a></td>
<td>Private method to skip over an indented block of source code.</td>
</tr><tr>
<td><a href="#Pep257Checker.run">run</a></td>
<td>Public method to check the given source for violations of doc string conventions according to PEP-257.</td>
</tr><tr>
<td><a href="#Pep257Checker.unpackArgs">unpackArgs</a></td>
<td>Local helper function to unpack function argument names.</td>
</tr>
</table>
<h3>Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="Pep257Checker.__init__" ID="Pep257Checker.__init__"></a>
<h4>Pep257Checker (Constructor)</h4>
<b>Pep257Checker</b>(<i>source, filename, select, ignore, expected, repeat, maxLineLength=79, docType="pep257"</i>)
<p>
        Constructor
</p><dl>
<dt><i>source</i></dt>
<dd>
source code to be checked (list of string)
</dd><dt><i>filename</i></dt>
<dd>
name of the source file (string)
</dd><dt><i>select</i></dt>
<dd>
list of selected codes (list of string)
</dd><dt><i>ignore</i></dt>
<dd>
list of codes to be ignored (list of string)
</dd><dt><i>expected</i></dt>
<dd>
list of expected codes (list of string)
</dd><dt><i>repeat</i></dt>
<dd>
flag indicating to report each occurrence of a code
            (boolean)
</dd><dt><i>maxLineLength=</i></dt>
<dd>
allowed line length (integer)
</dd><dt><i>docType=</i></dt>
<dd>
type of the documentation strings
            (string, one of 'eric' or 'pep257')
</dd>
</dl><a NAME="Pep257Checker.__checkBackslashes" ID="Pep257Checker.__checkBackslashes"></a>
<h4>Pep257Checker.__checkBackslashes</h4>
<b>__checkBackslashes</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that all docstrings containing
        backslashes are surrounded by raw triple double quotes.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkBlankAfterLastParagraph" ID="Pep257Checker.__checkBlankAfterLastParagraph"></a>
<h4>Pep257Checker.__checkBlankAfterLastParagraph</h4>
<b>__checkBlankAfterLastParagraph</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that the last paragraph of docstrings is
        followed by a blank line.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkBlankAfterSummary" ID="Pep257Checker.__checkBlankAfterSummary"></a>
<h4>Pep257Checker.__checkBlankAfterSummary</h4>
<b>__checkBlankAfterSummary</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstring summaries are followed
        by a blank line.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkBlankBeforeAndAfterClass" ID="Pep257Checker.__checkBlankBeforeAndAfterClass"></a>
<h4>Pep257Checker.__checkBlankBeforeAndAfterClass</h4>
<b>__checkBlankBeforeAndAfterClass</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that class docstrings have one
        blank line around them.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkClassDocstring" ID="Pep257Checker.__checkClassDocstring"></a>
<h4>Pep257Checker.__checkClassDocstring</h4>
<b>__checkClassDocstring</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that all public functions and methods
        have a docstring.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkEndsWithPeriod" ID="Pep257Checker.__checkEndsWithPeriod"></a>
<h4>Pep257Checker.__checkEndsWithPeriod</h4>
<b>__checkEndsWithPeriod</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstring summaries end with a period.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkEricBlankAfterSummary" ID="Pep257Checker.__checkEricBlankAfterSummary"></a>
<h4>Pep257Checker.__checkEricBlankAfterSummary</h4>
<b>__checkEricBlankAfterSummary</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstring summaries are followed
        by a blank line.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkEricEndsWithPeriod" ID="Pep257Checker.__checkEricEndsWithPeriod"></a>
<h4>Pep257Checker.__checkEricEndsWithPeriod</h4>
<b>__checkEricEndsWithPeriod</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstring summaries end with a period.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkEricException" ID="Pep257Checker.__checkEricException"></a>
<h4>Pep257Checker.__checkEricException</h4>
<b>__checkEricException</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstrings contain an &#64;exception line
        if they raise an exception and don't otherwise.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkEricFunctionArguments" ID="Pep257Checker.__checkEricFunctionArguments"></a>
<h4>Pep257Checker.__checkEricFunctionArguments</h4>
<b>__checkEricFunctionArguments</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstrings contain an &#64;param and/or
        &#64;keyparam line for each argument.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkEricNBlankAfterLastParagraph" ID="Pep257Checker.__checkEricNBlankAfterLastParagraph"></a>
<h4>Pep257Checker.__checkEricNBlankAfterLastParagraph</h4>
<b>__checkEricNBlankAfterLastParagraph</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that the last paragraph of docstrings is
        not followed by a blank line.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkEricNoBlankBeforeAndAfterClassOrFunction" ID="Pep257Checker.__checkEricNoBlankBeforeAndAfterClassOrFunction"></a>
<h4>Pep257Checker.__checkEricNoBlankBeforeAndAfterClassOrFunction</h4>
<b>__checkEricNoBlankBeforeAndAfterClassOrFunction</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that class and function/method docstrings
        have no blank line around them.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkEricQuotesOnSeparateLines" ID="Pep257Checker.__checkEricQuotesOnSeparateLines"></a>
<h4>Pep257Checker.__checkEricQuotesOnSeparateLines</h4>
<b>__checkEricQuotesOnSeparateLines</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that leading and trailing quotes are on
        a line by themselves.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkEricReturn" ID="Pep257Checker.__checkEricReturn"></a>
<h4>Pep257Checker.__checkEricReturn</h4>
<b>__checkEricReturn</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstrings contain an &#64;return line
        if they return anything and don't otherwise.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkFunctionDocstring" ID="Pep257Checker.__checkFunctionDocstring"></a>
<h4>Pep257Checker.__checkFunctionDocstring</h4>
<b>__checkFunctionDocstring</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that all public functions and methods
        have a docstring.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkImperativeMood" ID="Pep257Checker.__checkImperativeMood"></a>
<h4>Pep257Checker.__checkImperativeMood</h4>
<b>__checkImperativeMood</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstring summaries are in
        imperative mood.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkIndent" ID="Pep257Checker.__checkIndent"></a>
<h4>Pep257Checker.__checkIndent</h4>
<b>__checkIndent</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstrings are properly indented.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkModulesDocstrings" ID="Pep257Checker.__checkModulesDocstrings"></a>
<h4>Pep257Checker.__checkModulesDocstrings</h4>
<b>__checkModulesDocstrings</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, if the module has a docstring.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkNoBlankLineBefore" ID="Pep257Checker.__checkNoBlankLineBefore"></a>
<h4>Pep257Checker.__checkNoBlankLineBefore</h4>
<b>__checkNoBlankLineBefore</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that function/method docstrings are not
        preceded by a blank line.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkNoSignature" ID="Pep257Checker.__checkNoSignature"></a>
<h4>Pep257Checker.__checkNoSignature</h4>
<b>__checkNoSignature</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstring summaries don't repeat
        the function's signature.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkOneLiner" ID="Pep257Checker.__checkOneLiner"></a>
<h4>Pep257Checker.__checkOneLiner</h4>
<b>__checkOneLiner</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that one-liner docstrings fit on
        one line with quotes.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkReturnType" ID="Pep257Checker.__checkReturnType"></a>
<h4>Pep257Checker.__checkReturnType</h4>
<b>__checkReturnType</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that docstrings mention the return value type.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkTripleDoubleQuotes" ID="Pep257Checker.__checkTripleDoubleQuotes"></a>
<h4>Pep257Checker.__checkTripleDoubleQuotes</h4>
<b>__checkTripleDoubleQuotes</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that all docstrings are surrounded
        by triple double quotes.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__checkUnicode" ID="Pep257Checker.__checkUnicode"></a>
<h4>Pep257Checker.__checkUnicode</h4>
<b>__checkUnicode</b>(<i>docstringContext, context</i>)
<p>
        Private method to check, that all docstrings containing unicode
        characters are surrounded by unicode triple double quotes.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd><dt><i>context</i></dt>
<dd>
context of the docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__error" ID="Pep257Checker.__error"></a>
<h4>Pep257Checker.__error</h4>
<b>__error</b>(<i>lineNumber, offset, code, *args</i>)
<p>
        Private method to record an issue.
</p><dl>
<dt><i>lineNumber</i></dt>
<dd>
line number of the issue (integer)
</dd><dt><i>offset</i></dt>
<dd>
position within line of the issue (integer)
</dd><dt><i>code</i></dt>
<dd>
message code (string)
</dd><dt><i>args</i></dt>
<dd>
arguments for the message (list)
</dd>
</dl><a NAME="Pep257Checker.__getArgNames" ID="Pep257Checker.__getArgNames"></a>
<h4>Pep257Checker.__getArgNames</h4>
<b>__getArgNames</b>(<i>node</i>)
<a NAME="Pep257Checker.__getSummaryLine" ID="Pep257Checker.__getSummaryLine"></a>
<h4>Pep257Checker.__getSummaryLine</h4>
<b>__getSummaryLine</b>(<i>docstringContext</i>)
<p>
        Private method to extract the summary line.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
summary line (string) and the line it was found on (integer)
</dd>
</dl><a NAME="Pep257Checker.__getSummaryLines" ID="Pep257Checker.__getSummaryLines"></a>
<h4>Pep257Checker.__getSummaryLines</h4>
<b>__getSummaryLines</b>(<i>docstringContext</i>)
<p>
        Private method to extract the summary lines.
</p><dl>
<dt><i>docstringContext</i></dt>
<dd>
docstring context (Pep257Context)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
summary lines (list of string) and the line it was found on
            (integer)
</dd>
</dl><a NAME="Pep257Checker.__ignoreCode" ID="Pep257Checker.__ignoreCode"></a>
<h4>Pep257Checker.__ignoreCode</h4>
<b>__ignoreCode</b>(<i>code</i>)
<p>
        Private method to check if the error code should be ignored.
</p><dl>
<dt><i>code</i></dt>
<dd>
message code to check for (string)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
flag indicating to ignore the given code (boolean)
</dd>
</dl><a NAME="Pep257Checker.__parseClasses" ID="Pep257Checker.__parseClasses"></a>
<h4>Pep257Checker.__parseClasses</h4>
<b>__parseClasses</b>(<i></i>)
<p>
        Private method to extract top-level classes.
</p><dl>
<dt>Returns:</dt>
<dd>
extracted class contexts (list of Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__parseContexts" ID="Pep257Checker.__parseContexts"></a>
<h4>Pep257Checker.__parseContexts</h4>
<b>__parseContexts</b>(<i>kind</i>)
<p>
        Private method to extract a context from the source.
</p><dl>
<dt><i>kind</i></dt>
<dd>
kind of context to extract (string)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
requested contexts (list of Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__parseDocstring" ID="Pep257Checker.__parseDocstring"></a>
<h4>Pep257Checker.__parseDocstring</h4>
<b>__parseDocstring</b>(<i>context, what=''</i>)
<p>
        Private method to extract a docstring given `def` or `class` source.
</p><dl>
<dt><i>context</i></dt>
<dd>
context data to get the docstring from (Pep257Context)
</dd><dt><i>what</i></dt>
<dd>
string denoting what is being parsed (string)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
context of extracted docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__parseFunctions" ID="Pep257Checker.__parseFunctions"></a>
<h4>Pep257Checker.__parseFunctions</h4>
<b>__parseFunctions</b>(<i></i>)
<p>
        Private method to extract top-level functions.
</p><dl>
<dt>Returns:</dt>
<dd>
extracted function contexts (list of Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__parseMethods" ID="Pep257Checker.__parseMethods"></a>
<h4>Pep257Checker.__parseMethods</h4>
<b>__parseMethods</b>(<i></i>)
<p>
        Private method to extract methods of all classes.
</p><dl>
<dt>Returns:</dt>
<dd>
extracted method contexts (list of Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__parseModuleDocstring" ID="Pep257Checker.__parseModuleDocstring"></a>
<h4>Pep257Checker.__parseModuleDocstring</h4>
<b>__parseModuleDocstring</b>(<i>source</i>)
<p>
        Private method to extract a docstring given a module source.
</p><dl>
<dt><i>source</i></dt>
<dd>
source to parse (list of string)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
context of extracted docstring (Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__parseTopLevel" ID="Pep257Checker.__parseTopLevel"></a>
<h4>Pep257Checker.__parseTopLevel</h4>
<b>__parseTopLevel</b>(<i>keyword</i>)
<p>
        Private method to extract top-level functions or classes.
</p><dl>
<dt><i>keyword</i></dt>
<dd>
keyword signaling what to extract (string)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
extracted function or class contexts (list of Pep257Context)
</dd>
</dl><a NAME="Pep257Checker.__readline" ID="Pep257Checker.__readline"></a>
<h4>Pep257Checker.__readline</h4>
<b>__readline</b>(<i></i>)
<p>
        Private method to get the next line from the source.
</p><dl>
<dt>Returns:</dt>
<dd>
next line of source (string)
</dd>
</dl><a NAME="Pep257Checker.__resetReadline" ID="Pep257Checker.__resetReadline"></a>
<h4>Pep257Checker.__resetReadline</h4>
<b>__resetReadline</b>(<i></i>)
<p>
        Private method to reset the internal readline function.
</p><a NAME="Pep257Checker.__skipIndentedBlock" ID="Pep257Checker.__skipIndentedBlock"></a>
<h4>Pep257Checker.__skipIndentedBlock</h4>
<b>__skipIndentedBlock</b>(<i>tokenGenerator</i>)
<p>
        Private method to skip over an indented block of source code.
</p><dl>
<dt><i>tokenGenerator</i></dt>
<dd>
token generator
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
last token of the indented block
</dd>
</dl><a NAME="Pep257Checker.run" ID="Pep257Checker.run"></a>
<h4>Pep257Checker.run</h4>
<b>run</b>(<i></i>)
<p>
        Public method to check the given source for violations of doc string
        conventions according to PEP-257.
</p><a NAME="Pep257Checker.unpackArgs" ID="Pep257Checker.unpackArgs"></a>
<h4>Pep257Checker.unpackArgs</h4>
<b>unpackArgs</b>(<i></i>)
<p>
                Local helper function to unpack function argument names.
</p><dl>
<dt><i>args</i></dt>
<dd>
list of AST node arguments
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
list of argument names (list of string)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="Pep257Context" ID="Pep257Context"></a>
<h2>Pep257Context</h2>
<p>
    Class implementing the source context.
</p>
<h3>Derived from</h3>
object
<h3>Class Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Class Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>
<table>
<tr>
<td><a href="#Pep257Context.__init__">Pep257Context</a></td>
<td>Constructor</td>
</tr><tr>
<td><a href="#Pep257Context.contextType">contextType</a></td>
<td>Public method to get the context type.</td>
</tr><tr>
<td><a href="#Pep257Context.end">end</a></td>
<td>Public method to get the end line number.</td>
</tr><tr>
<td><a href="#Pep257Context.indent">indent</a></td>
<td>Public method to get the indentation of the first line.</td>
</tr><tr>
<td><a href="#Pep257Context.source">source</a></td>
<td>Public method to get the source.</td>
</tr><tr>
<td><a href="#Pep257Context.ssource">ssource</a></td>
<td>Public method to get the joined source lines.</td>
</tr><tr>
<td><a href="#Pep257Context.start">start</a></td>
<td>Public method to get the start line number.</td>
</tr>
</table>
<h3>Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="Pep257Context.__init__" ID="Pep257Context.__init__"></a>
<h4>Pep257Context (Constructor)</h4>
<b>Pep257Context</b>(<i>source, startLine, contextType</i>)
<p>
        Constructor
</p><dl>
<dt><i>source</i></dt>
<dd>
source code of the context (list of string or string)
</dd><dt><i>startLine</i></dt>
<dd>
line number the context starts in the source (integer)
</dd><dt><i>contextType</i></dt>
<dd>
type of the context object (string)
</dd>
</dl><a NAME="Pep257Context.contextType" ID="Pep257Context.contextType"></a>
<h4>Pep257Context.contextType</h4>
<b>contextType</b>(<i></i>)
<p>
        Public method to get the context type.
</p><dl>
<dt>Returns:</dt>
<dd>
context type (string)
</dd>
</dl><a NAME="Pep257Context.end" ID="Pep257Context.end"></a>
<h4>Pep257Context.end</h4>
<b>end</b>(<i></i>)
<p>
        Public method to get the end line number.
</p><dl>
<dt>Returns:</dt>
<dd>
end line number (integer)
</dd>
</dl><a NAME="Pep257Context.indent" ID="Pep257Context.indent"></a>
<h4>Pep257Context.indent</h4>
<b>indent</b>(<i></i>)
<p>
        Public method to get the indentation of the first line.
</p><dl>
<dt>Returns:</dt>
<dd>
indentation string (string)
</dd>
</dl><a NAME="Pep257Context.source" ID="Pep257Context.source"></a>
<h4>Pep257Context.source</h4>
<b>source</b>(<i></i>)
<p>
        Public method to get the source.
</p><dl>
<dt>Returns:</dt>
<dd>
source (list of string)
</dd>
</dl><a NAME="Pep257Context.ssource" ID="Pep257Context.ssource"></a>
<h4>Pep257Context.ssource</h4>
<b>ssource</b>(<i></i>)
<p>
        Public method to get the joined source lines.
</p><dl>
<dt>Returns:</dt>
<dd>
source (string)
</dd>
</dl><a NAME="Pep257Context.start" ID="Pep257Context.start"></a>
<h4>Pep257Context.start</h4>
<b>start</b>(<i></i>)
<p>
        Public method to get the start line number.
</p><dl>
<dt>Returns:</dt>
<dd>
start line number (integer)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial