eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html

Sun, 12 Sep 2021 20:22:27 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 12 Sep 2021 20:22:27 +0200
branch
eric7
changeset 8596
d64760b2da50
parent 8372
e0227a7c850e
permissions
-rw-r--r--

Documentation Generator: streamlined the code to use an external style sheet file.

<!DOCTYPE html>
<html><head>
<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<a NAME="top" ID="top"></a>
<h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker</h1>

<p>
Module implementing a checker for miscellaneous checks.
</p>
<h3>Global Attributes</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Classes</h3>

<table>

<tr>
<td><a href="#BugBearVisitor">BugBearVisitor</a></td>
<td>Class implementing a node visitor to check for various topics.</td>
</tr>
<tr>
<td><a href="#DateTimeVisitor">DateTimeVisitor</a></td>
<td>Class implementing a node visitor to check datetime function calls.</td>
</tr>
<tr>
<td><a href="#LoggingVisitor">LoggingVisitor</a></td>
<td>Class implementing a node visitor to check logging statements.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td>
<td>Class implementing a checker for miscellaneous checks.</td>
</tr>
<tr>
<td><a href="#NameFinder">NameFinder</a></td>
<td>Class to extract a name out of a tree of nodes.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor">ReturnVisitor</a></td>
<td>Class implementing a node visitor to check return statements.</td>
</tr>
<tr>
<td><a href="#SysVersionVisitor">SysVersionVisitor</a></td>
<td>Class implementing a node visitor to check the use of sys.version and sys.version_info.</td>
</tr>
<tr>
<td><a href="#TextVisitor">TextVisitor</a></td>
<td>Class implementing a node visitor for bytes and str instances.</td>
</tr>
</table>
<h3>Functions</h3>

<table>

<tr>
<td><a href="#composeCallPath">composeCallPath</a></td>
<td>Generator function to assemble the call path of a given node.</td>
</tr>
</table>
<hr />
<hr />
<a NAME="BugBearVisitor" ID="BugBearVisitor"></a>
<h2>BugBearVisitor</h2>

<p>
    Class implementing a node visitor to check for various topics.
</p>
<h3>Derived from</h3>
ast.NodeVisitor
<h3>Class Attributes</h3>

<table>
<tr><td>NodeWindowSize</td></tr>
</table>
<h3>Class Methods</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>

<table>

<tr>
<td><a href="#BugBearVisitor.__init__">BugBearVisitor</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.__checkForM502">__checkForM502</a></td>
<td>Private method to check the use of *strip().</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.__checkForM507">__checkForM507</a></td>
<td>Private method to check for unused loop variables.</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.visit">visit</a></td>
<td>Public method to traverse a given AST node.</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.visit_Assert">visit_Assert</a></td>
<td>Public method to handle 'assert' statements.</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.visit_Assign">visit_Assign</a></td>
<td>Public method to handle assignments.</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.visit_AsyncFor">visit_AsyncFor</a></td>
<td>Public method to handle 'for' statements.</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.visit_Attribute">visit_Attribute</a></td>
<td>Public method to handle attributes.</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.visit_Call">visit_Call</a></td>
<td>Public method to handle a function call.</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.visit_For">visit_For</a></td>
<td>Public method to handle 'for' statements.</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.visit_JoinedStr">visit_JoinedStr</a></td>
<td>Public method to handle f-string arguments.</td>
</tr>
<tr>
<td><a href="#BugBearVisitor.visit_UAdd">visit_UAdd</a></td>
<td>Public method to handle unary additions.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="BugBearVisitor.__init__" ID="BugBearVisitor.__init__"></a>
<h4>BugBearVisitor (Constructor)</h4>
<b>BugBearVisitor</b>(<i></i>)

<p>
        Constructor
</p>
<a NAME="BugBearVisitor.__checkForM502" ID="BugBearVisitor.__checkForM502"></a>
<h4>BugBearVisitor.__checkForM502</h4>
<b>__checkForM502</b>(<i>node</i>)

<p>
        Private method to check the use of *strip().
</p>
<dl>

<dt><i>node</i> (ast.Call)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="BugBearVisitor.__checkForM507" ID="BugBearVisitor.__checkForM507"></a>
<h4>BugBearVisitor.__checkForM507</h4>
<b>__checkForM507</b>(<i>node</i>)

<p>
        Private method to check for unused loop variables.
</p>
<dl>

<dt><i>node</i> (ast.For)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="BugBearVisitor.visit" ID="BugBearVisitor.visit"></a>
<h4>BugBearVisitor.visit</h4>
<b>visit</b>(<i>node</i>)

<p>
        Public method to traverse a given AST node.
</p>
<dl>

<dt><i>node</i> (ast.Node)</dt>
<dd>
AST node to be traversed
</dd>
</dl>
<a NAME="BugBearVisitor.visit_Assert" ID="BugBearVisitor.visit_Assert"></a>
<h4>BugBearVisitor.visit_Assert</h4>
<b>visit_Assert</b>(<i>node</i>)

<p>
        Public method to handle 'assert' statements.
</p>
<dl>

<dt><i>node</i> (ast.Assert)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="BugBearVisitor.visit_Assign" ID="BugBearVisitor.visit_Assign"></a>
<h4>BugBearVisitor.visit_Assign</h4>
<b>visit_Assign</b>(<i>node</i>)

<p>
        Public method to handle assignments.
</p>
<dl>

<dt><i>node</i> (ast.Assign)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="BugBearVisitor.visit_AsyncFor" ID="BugBearVisitor.visit_AsyncFor"></a>
<h4>BugBearVisitor.visit_AsyncFor</h4>
<b>visit_AsyncFor</b>(<i>node</i>)

<p>
        Public method to handle 'for' statements.
</p>
<dl>

<dt><i>node</i> (ast.AsyncFor)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="BugBearVisitor.visit_Attribute" ID="BugBearVisitor.visit_Attribute"></a>
<h4>BugBearVisitor.visit_Attribute</h4>
<b>visit_Attribute</b>(<i>node</i>)

<p>
        Public method to handle attributes.
</p>
<dl>

<dt><i>node</i> (ast.Attribute)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="BugBearVisitor.visit_Call" ID="BugBearVisitor.visit_Call"></a>
<h4>BugBearVisitor.visit_Call</h4>
<b>visit_Call</b>(<i>node</i>)

<p>
        Public method to handle a function call.
</p>
<dl>

<dt><i>node</i> (ast.Call)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="BugBearVisitor.visit_For" ID="BugBearVisitor.visit_For"></a>
<h4>BugBearVisitor.visit_For</h4>
<b>visit_For</b>(<i>node</i>)

<p>
        Public method to handle 'for' statements.
</p>
<dl>

<dt><i>node</i> (ast.For)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="BugBearVisitor.visit_JoinedStr" ID="BugBearVisitor.visit_JoinedStr"></a>
<h4>BugBearVisitor.visit_JoinedStr</h4>
<b>visit_JoinedStr</b>(<i>node</i>)

<p>
        Public method to handle f-string arguments.
</p>
<dl>

<dt><i>node</i> (ast.JoinedStr)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="BugBearVisitor.visit_UAdd" ID="BugBearVisitor.visit_UAdd"></a>
<h4>BugBearVisitor.visit_UAdd</h4>
<b>visit_UAdd</b>(<i>node</i>)

<p>
        Public method to handle unary additions.
</p>
<dl>

<dt><i>node</i> (ast.UAdd)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="DateTimeVisitor" ID="DateTimeVisitor"></a>
<h2>DateTimeVisitor</h2>

<p>
    Class implementing a node visitor to check datetime function calls.
</p>
<p>
    Note: This class is modelled after flake8_datetimez checker.
</p>
<h3>Derived from</h3>
ast.NodeVisitor
<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="#DateTimeVisitor.__init__">DateTimeVisitor</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#DateTimeVisitor.__getFromKeywords">__getFromKeywords</a></td>
<td>Private method to get a keyword node given its name.</td>
</tr>
<tr>
<td><a href="#DateTimeVisitor.visit_Call">visit_Call</a></td>
<td>Public method to handle a function call.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="DateTimeVisitor.__init__" ID="DateTimeVisitor.__init__"></a>
<h4>DateTimeVisitor (Constructor)</h4>
<b>DateTimeVisitor</b>(<i></i>)

<p>
        Constructor
</p>
<a NAME="DateTimeVisitor.__getFromKeywords" ID="DateTimeVisitor.__getFromKeywords"></a>
<h4>DateTimeVisitor.__getFromKeywords</h4>
<b>__getFromKeywords</b>(<i>keywords, name</i>)

<p>
        Private method to get a keyword node given its name.
</p>
<dl>

<dt><i>keywords</i> (list of ast.AST)</dt>
<dd>
list of keyword argument nodes
</dd>
<dt><i>name</i> (str)</dt>
<dd>
name of the keyword node
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
keyword node
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
ast.AST
</dd>
</dl>
<a NAME="DateTimeVisitor.visit_Call" ID="DateTimeVisitor.visit_Call"></a>
<h4>DateTimeVisitor.visit_Call</h4>
<b>visit_Call</b>(<i>node</i>)

<p>
        Public method to handle a function call.
</p>
<p>
        Every datetime related function call is check for use of the naive
        variant (i.e. use without TZ info).
</p>
<dl>

<dt><i>node</i> (ast.Call)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="LoggingVisitor" ID="LoggingVisitor"></a>
<h2>LoggingVisitor</h2>

<p>
    Class implementing a node visitor to check logging statements.
</p>
<h3>Derived from</h3>
ast.NodeVisitor
<h3>Class Attributes</h3>

<table>
<tr><td>LoggingLevels</td></tr>
</table>
<h3>Class Methods</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>

<table>

<tr>
<td><a href="#LoggingVisitor.__init__">LoggingVisitor</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#LoggingVisitor.__detectLoggingLevel">__detectLoggingLevel</a></td>
<td>Private method to decide whether an AST Call is a logging call.</td>
</tr>
<tr>
<td><a href="#LoggingVisitor.__isFormatCall">__isFormatCall</a></td>
<td>Private method to check if a function call uses format.</td>
</tr>
<tr>
<td><a href="#LoggingVisitor.__withinExtraKeyword">__withinExtraKeyword</a></td>
<td>Private method to check, if we are inside the extra keyword.</td>
</tr>
<tr>
<td><a href="#LoggingVisitor.__withinLoggingArgument">__withinLoggingArgument</a></td>
<td>Private method to check, if we are inside a logging argument.</td>
</tr>
<tr>
<td><a href="#LoggingVisitor.__withinLoggingStatement">__withinLoggingStatement</a></td>
<td>Private method to check, if we are inside a logging statement.</td>
</tr>
<tr>
<td><a href="#LoggingVisitor.visit_BinOp">visit_BinOp</a></td>
<td>Public method to handle binary operations while processing the first logging argument.</td>
</tr>
<tr>
<td><a href="#LoggingVisitor.visit_Call">visit_Call</a></td>
<td>Public method to handle a function call.</td>
</tr>
<tr>
<td><a href="#LoggingVisitor.visit_JoinedStr">visit_JoinedStr</a></td>
<td>Public method to handle f-string arguments.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="LoggingVisitor.__init__" ID="LoggingVisitor.__init__"></a>
<h4>LoggingVisitor (Constructor)</h4>
<b>LoggingVisitor</b>(<i></i>)

<p>
        Constructor
</p>
<a NAME="LoggingVisitor.__detectLoggingLevel" ID="LoggingVisitor.__detectLoggingLevel"></a>
<h4>LoggingVisitor.__detectLoggingLevel</h4>
<b>__detectLoggingLevel</b>(<i>node</i>)

<p>
        Private method to decide whether an AST Call is a logging call.
</p>
<dl>

<dt><i>node</i> (ast.Call)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
logging level
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str or None
</dd>
</dl>
<a NAME="LoggingVisitor.__isFormatCall" ID="LoggingVisitor.__isFormatCall"></a>
<h4>LoggingVisitor.__isFormatCall</h4>
<b>__isFormatCall</b>(<i>node</i>)

<p>
        Private method to check if a function call uses format.
</p>
<dl>

<dt><i>node</i> (ast.Call)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating the function call uses format
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="LoggingVisitor.__withinExtraKeyword" ID="LoggingVisitor.__withinExtraKeyword"></a>
<h4>LoggingVisitor.__withinExtraKeyword</h4>
<b>__withinExtraKeyword</b>(<i>node</i>)

<p>
        Private method to check, if we are inside the extra keyword.
</p>
<dl>

<dt><i>node</i> (ast.keyword)</dt>
<dd>
reference to the node to be checked
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating we are inside the extra keyword
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="LoggingVisitor.__withinLoggingArgument" ID="LoggingVisitor.__withinLoggingArgument"></a>
<h4>LoggingVisitor.__withinLoggingArgument</h4>
<b>__withinLoggingArgument</b>(<i></i>)

<p>
        Private method to check, if we are inside a logging argument.
</p>
<dl>
<dt>Return:</dt>
<dd>
flag indicating we are inside a logging argument
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="LoggingVisitor.__withinLoggingStatement" ID="LoggingVisitor.__withinLoggingStatement"></a>
<h4>LoggingVisitor.__withinLoggingStatement</h4>
<b>__withinLoggingStatement</b>(<i></i>)

<p>
        Private method to check, if we are inside a logging statement.
</p>
<dl>
<dt>Return:</dt>
<dd>
flag indicating we are inside a logging statement
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="LoggingVisitor.visit_BinOp" ID="LoggingVisitor.visit_BinOp"></a>
<h4>LoggingVisitor.visit_BinOp</h4>
<b>visit_BinOp</b>(<i>node</i>)

<p>
        Public method to handle binary operations while processing the first
        logging argument.
</p>
<dl>

<dt><i>node</i> (ast.BinOp)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="LoggingVisitor.visit_Call" ID="LoggingVisitor.visit_Call"></a>
<h4>LoggingVisitor.visit_Call</h4>
<b>visit_Call</b>(<i>node</i>)

<p>
        Public method to handle a function call.
</p>
<p>
        Every logging statement and string format is expected to be a function
        call.
</p>
<dl>

<dt><i>node</i> (ast.Call)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="LoggingVisitor.visit_JoinedStr" ID="LoggingVisitor.visit_JoinedStr"></a>
<h4>LoggingVisitor.visit_JoinedStr</h4>
<b>visit_JoinedStr</b>(<i>node</i>)

<p>
        Public method to handle f-string arguments.
</p>
<dl>

<dt><i>node</i> (ast.JoinedStr)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="MiscellaneousChecker" ID="MiscellaneousChecker"></a>
<h2>MiscellaneousChecker</h2>

<p>
    Class implementing a checker for miscellaneous checks.
</p>
<h3>Derived from</h3>
None
<h3>Class Attributes</h3>

<table>
<tr><td>BuiltinsWhiteList</td></tr><tr><td>Codes</td></tr><tr><td>FormatFieldRegex</td></tr><tr><td>Formatter</td></tr>
</table>
<h3>Class Methods</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>

<table>

<tr>
<td><a href="#MiscellaneousChecker.__init__">MiscellaneousChecker</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkBugBear">__checkBugBear</a></td>
<td>Private method for bugbear checks.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkBuiltins">__checkBuiltins</a></td>
<td>Private method to check, if built-ins are shadowed.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkCoding">__checkCoding</a></td>
<td>Private method to check the presence of a coding line and valid encodings.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkCommentedCode">__checkCommentedCode</a></td>
<td>Private method to check for commented code.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkComprehensions">__checkComprehensions</a></td>
<td>Private method to check some comprehension related things.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkCopyright">__checkCopyright</a></td>
<td>Private method to check the presence of a copyright statement.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkDateTime">__checkDateTime</a></td>
<td>Private method to check use of naive datetime functions.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkDictWithSortedKeys">__checkDictWithSortedKeys</a></td>
<td>Private method to check, if dictionary keys appear in sorted order.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkFormatString">__checkFormatString</a></td>
<td>Private method to check string format strings.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkFuture">__checkFuture</a></td>
<td>Private method to check the __future__ imports.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkGettext">__checkGettext</a></td>
<td>Private method to check the 'gettext' import statement.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkLineContinuation">__checkLineContinuation</a></td>
<td>Private method to check line continuation using backslash.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkLogging">__checkLogging</a></td>
<td>Private method to check logging statements.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkMutableDefault">__checkMutableDefault</a></td>
<td>Private method to check for use of mutable types as default arguments.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkPep3101">__checkPep3101</a></td>
<td>Private method to check for old style string formatting.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkPrintStatements">__checkPrintStatements</a></td>
<td>Private method to check for print statements.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkReturn">__checkReturn</a></td>
<td>Private method to check return statements.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkSysVersion">__checkSysVersion</a></td>
<td>Private method to check the use of sys.version and sys.version_info.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__checkTuple">__checkTuple</a></td>
<td>Private method to check for one element tuples.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__dictShouldBeChecked">__dictShouldBeChecked</a></td>
<td>Private function to test, if the node should be checked.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__error">__error</a></td>
<td>Private method to record an issue.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__getCoding">__getCoding</a></td>
<td>Private method to get the defined coding of the source.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__getFields">__getFields</a></td>
<td>Private method to extract the format field information.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.__ignoreCode">__ignoreCode</a></td>
<td>Private method to check if the message code should be ignored.</td>
</tr>
<tr>
<td><a href="#MiscellaneousChecker.run">run</a></td>
<td>Public method to check the given source against miscellaneous conditions.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="MiscellaneousChecker.__init__" ID="MiscellaneousChecker.__init__"></a>
<h4>MiscellaneousChecker (Constructor)</h4>
<b>MiscellaneousChecker</b>(<i>source, filename, tree, select, ignore, expected, repeat, args</i>)

<p>
        Constructor
</p>
<dl>

<dt><i>source</i> (list of str)</dt>
<dd>
source code to be checked
</dd>
<dt><i>filename</i> (str)</dt>
<dd>
name of the source file
</dd>
<dt><i>tree</i> (ast.Module)</dt>
<dd>
AST tree of the source code
</dd>
<dt><i>select</i> (list of str)</dt>
<dd>
list of selected codes
</dd>
<dt><i>ignore</i> (list of str)</dt>
<dd>
list of codes to be ignored
</dd>
<dt><i>expected</i> (list of str)</dt>
<dd>
list of expected codes
</dd>
<dt><i>repeat</i> (bool)</dt>
<dd>
flag indicating to report each occurrence of a code
</dd>
<dt><i>args</i> (dict)</dt>
<dd>
dictionary of arguments for the miscellaneous checks
</dd>
</dl>
<a NAME="MiscellaneousChecker.__checkBugBear" ID="MiscellaneousChecker.__checkBugBear"></a>
<h4>MiscellaneousChecker.__checkBugBear</h4>
<b>__checkBugBear</b>(<i></i>)

<p>
        Private method for bugbear checks.
</p>
<a NAME="MiscellaneousChecker.__checkBuiltins" ID="MiscellaneousChecker.__checkBuiltins"></a>
<h4>MiscellaneousChecker.__checkBuiltins</h4>
<b>__checkBuiltins</b>(<i></i>)

<p>
        Private method to check, if built-ins are shadowed.
</p>
<a NAME="MiscellaneousChecker.__checkCoding" ID="MiscellaneousChecker.__checkCoding"></a>
<h4>MiscellaneousChecker.__checkCoding</h4>
<b>__checkCoding</b>(<i></i>)

<p>
        Private method to check the presence of a coding line and valid
        encodings.
</p>
<a NAME="MiscellaneousChecker.__checkCommentedCode" ID="MiscellaneousChecker.__checkCommentedCode"></a>
<h4>MiscellaneousChecker.__checkCommentedCode</h4>
<b>__checkCommentedCode</b>(<i></i>)

<p>
        Private method to check for commented code.
</p>
<a NAME="MiscellaneousChecker.__checkComprehensions" ID="MiscellaneousChecker.__checkComprehensions"></a>
<h4>MiscellaneousChecker.__checkComprehensions</h4>
<b>__checkComprehensions</b>(<i></i>)

<p>
        Private method to check some comprehension related things.
</p>
<a NAME="MiscellaneousChecker.__checkCopyright" ID="MiscellaneousChecker.__checkCopyright"></a>
<h4>MiscellaneousChecker.__checkCopyright</h4>
<b>__checkCopyright</b>(<i></i>)

<p>
        Private method to check the presence of a copyright statement.
</p>
<a NAME="MiscellaneousChecker.__checkDateTime" ID="MiscellaneousChecker.__checkDateTime"></a>
<h4>MiscellaneousChecker.__checkDateTime</h4>
<b>__checkDateTime</b>(<i></i>)

<p>
        Private method to check use of naive datetime functions.
</p>
<a NAME="MiscellaneousChecker.__checkDictWithSortedKeys" ID="MiscellaneousChecker.__checkDictWithSortedKeys"></a>
<h4>MiscellaneousChecker.__checkDictWithSortedKeys</h4>
<b>__checkDictWithSortedKeys</b>(<i></i>)

<p>
        Private method to check, if dictionary keys appear in sorted order.
</p>
<a NAME="MiscellaneousChecker.__checkFormatString" ID="MiscellaneousChecker.__checkFormatString"></a>
<h4>MiscellaneousChecker.__checkFormatString</h4>
<b>__checkFormatString</b>(<i></i>)

<p>
        Private method to check string format strings.
</p>
<a NAME="MiscellaneousChecker.__checkFuture" ID="MiscellaneousChecker.__checkFuture"></a>
<h4>MiscellaneousChecker.__checkFuture</h4>
<b>__checkFuture</b>(<i></i>)

<p>
        Private method to check the __future__ imports.
</p>
<a NAME="MiscellaneousChecker.__checkGettext" ID="MiscellaneousChecker.__checkGettext"></a>
<h4>MiscellaneousChecker.__checkGettext</h4>
<b>__checkGettext</b>(<i></i>)

<p>
        Private method to check the 'gettext' import statement.
</p>
<a NAME="MiscellaneousChecker.__checkLineContinuation" ID="MiscellaneousChecker.__checkLineContinuation"></a>
<h4>MiscellaneousChecker.__checkLineContinuation</h4>
<b>__checkLineContinuation</b>(<i></i>)

<p>
        Private method to check line continuation using backslash.
</p>
<a NAME="MiscellaneousChecker.__checkLogging" ID="MiscellaneousChecker.__checkLogging"></a>
<h4>MiscellaneousChecker.__checkLogging</h4>
<b>__checkLogging</b>(<i></i>)

<p>
        Private method to check logging statements.
</p>
<a NAME="MiscellaneousChecker.__checkMutableDefault" ID="MiscellaneousChecker.__checkMutableDefault"></a>
<h4>MiscellaneousChecker.__checkMutableDefault</h4>
<b>__checkMutableDefault</b>(<i></i>)

<p>
        Private method to check for use of mutable types as default arguments.
</p>
<a NAME="MiscellaneousChecker.__checkPep3101" ID="MiscellaneousChecker.__checkPep3101"></a>
<h4>MiscellaneousChecker.__checkPep3101</h4>
<b>__checkPep3101</b>(<i></i>)

<p>
        Private method to check for old style string formatting.
</p>
<a NAME="MiscellaneousChecker.__checkPrintStatements" ID="MiscellaneousChecker.__checkPrintStatements"></a>
<h4>MiscellaneousChecker.__checkPrintStatements</h4>
<b>__checkPrintStatements</b>(<i></i>)

<p>
        Private method to check for print statements.
</p>
<a NAME="MiscellaneousChecker.__checkReturn" ID="MiscellaneousChecker.__checkReturn"></a>
<h4>MiscellaneousChecker.__checkReturn</h4>
<b>__checkReturn</b>(<i></i>)

<p>
        Private method to check return statements.
</p>
<a NAME="MiscellaneousChecker.__checkSysVersion" ID="MiscellaneousChecker.__checkSysVersion"></a>
<h4>MiscellaneousChecker.__checkSysVersion</h4>
<b>__checkSysVersion</b>(<i></i>)

<p>
        Private method to check the use of sys.version and sys.version_info.
</p>
<a NAME="MiscellaneousChecker.__checkTuple" ID="MiscellaneousChecker.__checkTuple"></a>
<h4>MiscellaneousChecker.__checkTuple</h4>
<b>__checkTuple</b>(<i></i>)

<p>
        Private method to check for one element tuples.
</p>
<a NAME="MiscellaneousChecker.__dictShouldBeChecked" ID="MiscellaneousChecker.__dictShouldBeChecked"></a>
<h4>MiscellaneousChecker.__dictShouldBeChecked</h4>
<b>__dictShouldBeChecked</b>(<i>node</i>)

<p>
        Private function to test, if the node should be checked.
</p>
<dl>

<dt><i>node</i></dt>
<dd>
reference to the AST node
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating to check the node
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="MiscellaneousChecker.__error" ID="MiscellaneousChecker.__error"></a>
<h4>MiscellaneousChecker.__error</h4>
<b>__error</b>(<i>lineNumber, offset, code, *args</i>)

<p>
        Private method to record an issue.
</p>
<dl>

<dt><i>lineNumber</i> (int)</dt>
<dd>
line number of the issue
</dd>
<dt><i>offset</i> (int)</dt>
<dd>
position within line of the issue
</dd>
<dt><i>code</i> (str)</dt>
<dd>
message code
</dd>
<dt><i>args</i> (list)</dt>
<dd>
arguments for the message
</dd>
</dl>
<a NAME="MiscellaneousChecker.__getCoding" ID="MiscellaneousChecker.__getCoding"></a>
<h4>MiscellaneousChecker.__getCoding</h4>
<b>__getCoding</b>(<i></i>)

<p>
        Private method to get the defined coding of the source.
</p>
<dl>
<dt>Return:</dt>
<dd>
tuple containing the line number and the coding
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
tuple of int and str
</dd>
</dl>
<a NAME="MiscellaneousChecker.__getFields" ID="MiscellaneousChecker.__getFields"></a>
<h4>MiscellaneousChecker.__getFields</h4>
<b>__getFields</b>(<i>string</i>)

<p>
        Private method to extract the format field information.
</p>
<dl>

<dt><i>string</i> (str)</dt>
<dd>
format string to be parsed
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
format field information as a tuple with fields, implicit
            field definitions present and explicit field definitions present
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
tuple of set of str, bool, bool
</dd>
</dl>
<a NAME="MiscellaneousChecker.__ignoreCode" ID="MiscellaneousChecker.__ignoreCode"></a>
<h4>MiscellaneousChecker.__ignoreCode</h4>
<b>__ignoreCode</b>(<i>code</i>)

<p>
        Private method to check if the message code should be ignored.
</p>
<dl>

<dt><i>code</i> (str)</dt>
<dd>
message code to check for
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating to ignore the given code
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="MiscellaneousChecker.run" ID="MiscellaneousChecker.run"></a>
<h4>MiscellaneousChecker.run</h4>
<b>run</b>(<i></i>)

<p>
        Public method to check the given source against miscellaneous
        conditions.
</p>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="NameFinder" ID="NameFinder"></a>
<h2>NameFinder</h2>

<p>
    Class to extract a name out of a tree of nodes.
</p>
<h3>Derived from</h3>
ast.NodeVisitor
<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="#NameFinder.__init__">NameFinder</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#NameFinder.getNames">getNames</a></td>
<td>Public method to return the extracted names and Name nodes.</td>
</tr>
<tr>
<td><a href="#NameFinder.visit">visit</a></td>
<td>Public method to traverse a given AST node.</td>
</tr>
<tr>
<td><a href="#NameFinder.visit_Name">visit_Name</a></td>
<td>Public method to handle 'Name' nodes.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="NameFinder.__init__" ID="NameFinder.__init__"></a>
<h4>NameFinder (Constructor)</h4>
<b>NameFinder</b>(<i></i>)

<p>
        Constructor
</p>
<a NAME="NameFinder.getNames" ID="NameFinder.getNames"></a>
<h4>NameFinder.getNames</h4>
<b>getNames</b>(<i></i>)

<p>
        Public method to return the extracted names and Name nodes.
</p>
<dl>
<dt>Return:</dt>
<dd>
dictionary containing the names as keys and the list of nodes
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
dict
</dd>
</dl>
<a NAME="NameFinder.visit" ID="NameFinder.visit"></a>
<h4>NameFinder.visit</h4>
<b>visit</b>(<i>node</i>)

<p>
        Public method to traverse a given AST node.
</p>
<dl>

<dt><i>node</i> (ast.Node)</dt>
<dd>
AST node to be traversed
</dd>
</dl>
<a NAME="NameFinder.visit_Name" ID="NameFinder.visit_Name"></a>
<h4>NameFinder.visit_Name</h4>
<b>visit_Name</b>(<i>node</i>)

<p>
        Public method to handle 'Name' nodes.
</p>
<dl>

<dt><i>node</i> (ast.Name)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="ReturnVisitor" ID="ReturnVisitor"></a>
<h2>ReturnVisitor</h2>

<p>
    Class implementing a node visitor to check return statements.
</p>
<h3>Derived from</h3>
ast.NodeVisitor
<h3>Class Attributes</h3>

<table>
<tr><td>Assigns</td></tr><tr><td>Refs</td></tr><tr><td>Returns</td></tr>
</table>
<h3>Class Methods</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>

<table>

<tr>
<td><a href="#ReturnVisitor.__init__">ReturnVisitor</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__checkFunction">__checkFunction</a></td>
<td>Private method to check a function definition node.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__checkImplicitReturn">__checkImplicitReturn</a></td>
<td>Private method to check for an implicit return statement.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__checkImplicitReturnValue">__checkImplicitReturnValue</a></td>
<td>Private method to check for implicit return values.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__checkUnnecessaryAssign">__checkUnnecessaryAssign</a></td>
<td>Private method to check for an unnecessary assign statement.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__checkUnnecessaryReturnNone">__checkUnnecessaryReturnNone</a></td>
<td>Private method to check for an unnecessary 'return None' statement.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__hasRefsBeforeNextAssign">__hasRefsBeforeNextAssign</a></td>
<td>Private method to check for references before a following assign statement.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__isFalse">__isFalse</a></td>
<td>Private method to check, if a node value is False.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__isNone">__isNone</a></td>
<td>Private method to check, if a node value is None.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__resultExists">__resultExists</a></td>
<td>Private method to check the existance of a return result.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__visitAssignTarget">__visitAssignTarget</a></td>
<td>Private method to handle an assign target node.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__visitLoop">__visitLoop</a></td>
<td>Private method to handle loop nodes.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.__visitWithStack">__visitWithStack</a></td>
<td>Private method to traverse a given function node using a stack.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.assigns">assigns</a></td>
<td>Public method to get the Assign nodes.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.refs">refs</a></td>
<td>Public method to get the References nodes.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.returns">returns</a></td>
<td>Public method to get the Return nodes.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.visit_Assign">visit_Assign</a></td>
<td>Public method to handle an assign node.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.visit_AsyncFor">visit_AsyncFor</a></td>
<td>Public method to handle an async for loop.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td>
<td>Public method to handle a function definition.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.visit_For">visit_For</a></td>
<td>Public method to handle a for loop.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.visit_FunctionDef">visit_FunctionDef</a></td>
<td>Public method to handle a function definition.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.visit_Name">visit_Name</a></td>
<td>Public method to handle a name node.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.visit_Return">visit_Return</a></td>
<td>Public method to handle a return node.</td>
</tr>
<tr>
<td><a href="#ReturnVisitor.visit_While">visit_While</a></td>
<td>Public method to handle a while loop.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="ReturnVisitor.__init__" ID="ReturnVisitor.__init__"></a>
<h4>ReturnVisitor (Constructor)</h4>
<b>ReturnVisitor</b>(<i></i>)

<p>
        Constructor
</p>
<a NAME="ReturnVisitor.__checkFunction" ID="ReturnVisitor.__checkFunction"></a>
<h4>ReturnVisitor.__checkFunction</h4>
<b>__checkFunction</b>(<i>node</i>)

<p>
        Private method to check a function definition node.
</p>
<dl>

<dt><i>node</i> (ast.AsyncFunctionDef or ast.FunctionDef)</dt>
<dd>
reference to the node to check
</dd>
</dl>
<a NAME="ReturnVisitor.__checkImplicitReturn" ID="ReturnVisitor.__checkImplicitReturn"></a>
<h4>ReturnVisitor.__checkImplicitReturn</h4>
<b>__checkImplicitReturn</b>(<i>node</i>)

<p>
        Private method to check for an implicit return statement.
</p>
<dl>

<dt><i>node</i> (ast.AST)</dt>
<dd>
reference to the node to check
</dd>
</dl>
<a NAME="ReturnVisitor.__checkImplicitReturnValue" ID="ReturnVisitor.__checkImplicitReturnValue"></a>
<h4>ReturnVisitor.__checkImplicitReturnValue</h4>
<b>__checkImplicitReturnValue</b>(<i></i>)

<p>
        Private method to check for implicit return values.
</p>
<a NAME="ReturnVisitor.__checkUnnecessaryAssign" ID="ReturnVisitor.__checkUnnecessaryAssign"></a>
<h4>ReturnVisitor.__checkUnnecessaryAssign</h4>
<b>__checkUnnecessaryAssign</b>(<i>node</i>)

<p>
        Private method to check for an unnecessary assign statement.
</p>
<dl>

<dt><i>node</i> (ast.AST)</dt>
<dd>
reference to the node to check
</dd>
</dl>
<a NAME="ReturnVisitor.__checkUnnecessaryReturnNone" ID="ReturnVisitor.__checkUnnecessaryReturnNone"></a>
<h4>ReturnVisitor.__checkUnnecessaryReturnNone</h4>
<b>__checkUnnecessaryReturnNone</b>(<i></i>)

<p>
        Private method to check for an unnecessary 'return None' statement.
</p>
<a NAME="ReturnVisitor.__hasRefsBeforeNextAssign" ID="ReturnVisitor.__hasRefsBeforeNextAssign"></a>
<h4>ReturnVisitor.__hasRefsBeforeNextAssign</h4>
<b>__hasRefsBeforeNextAssign</b>(<i>varname, returnLineno</i>)

<p>
        Private method to check for references before a following assign
        statement.
</p>
<dl>

<dt><i>varname</i> (str)</dt>
<dd>
variable name to check for
</dd>
<dt><i>returnLineno</i> (int)</dt>
<dd>
line number of the return statement
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating the existence of references
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="ReturnVisitor.__isFalse" ID="ReturnVisitor.__isFalse"></a>
<h4>ReturnVisitor.__isFalse</h4>
<b>__isFalse</b>(<i>node</i>)

<p>
        Private method to check, if a node value is False.
</p>
<dl>

<dt><i>node</i> (ast.AST)</dt>
<dd>
reference to the node to check
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating the node contains a False value
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="ReturnVisitor.__isNone" ID="ReturnVisitor.__isNone"></a>
<h4>ReturnVisitor.__isNone</h4>
<b>__isNone</b>(<i>node</i>)

<p>
        Private method to check, if a node value is None.
</p>
<dl>

<dt><i>node</i> (ast.AST)</dt>
<dd>
reference to the node to check
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating the node contains a None value
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="ReturnVisitor.__resultExists" ID="ReturnVisitor.__resultExists"></a>
<h4>ReturnVisitor.__resultExists</h4>
<b>__resultExists</b>(<i></i>)

<p>
        Private method to check the existance of a return result.
</p>
<dl>
<dt>Return:</dt>
<dd>
flag indicating the existence of a return result
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="ReturnVisitor.__visitAssignTarget" ID="ReturnVisitor.__visitAssignTarget"></a>
<h4>ReturnVisitor.__visitAssignTarget</h4>
<b>__visitAssignTarget</b>(<i>node</i>)

<p>
        Private method to handle an assign target node.
</p>
<dl>

<dt><i>node</i> (ast.AST)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="ReturnVisitor.__visitLoop" ID="ReturnVisitor.__visitLoop"></a>
<h4>ReturnVisitor.__visitLoop</h4>
<b>__visitLoop</b>(<i>node</i>)

<p>
        Private method to handle loop nodes.
</p>
<dl>

<dt><i>node</i> (ast.For, ast.AsyncFor or ast.While)</dt>
<dd>
reference to the loop node to handle
</dd>
</dl>
<a NAME="ReturnVisitor.__visitWithStack" ID="ReturnVisitor.__visitWithStack"></a>
<h4>ReturnVisitor.__visitWithStack</h4>
<b>__visitWithStack</b>(<i>node</i>)

<p>
        Private method to traverse a given function node using a stack.
</p>
<dl>

<dt><i>node</i> (ast.FunctionDef or ast.AsyncFunctionDef)</dt>
<dd>
AST node to be traversed
</dd>
</dl>
<a NAME="ReturnVisitor.assigns" ID="ReturnVisitor.assigns"></a>
<h4>ReturnVisitor.assigns</h4>
<b>assigns</b>(<i></i>)

<p>
        Public method to get the Assign nodes.
</p>
<dl>
<dt>Return:</dt>
<dd>
dictionary containing the node name as key and line number
            as value
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
dict
</dd>
</dl>
<a NAME="ReturnVisitor.refs" ID="ReturnVisitor.refs"></a>
<h4>ReturnVisitor.refs</h4>
<b>refs</b>(<i></i>)

<p>
        Public method to get the References nodes.
</p>
<dl>
<dt>Return:</dt>
<dd>
dictionary containing the node name as key and line number
            as value
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
dict
</dd>
</dl>
<a NAME="ReturnVisitor.returns" ID="ReturnVisitor.returns"></a>
<h4>ReturnVisitor.returns</h4>
<b>returns</b>(<i></i>)

<p>
        Public method to get the Return nodes.
</p>
<dl>
<dt>Return:</dt>
<dd>
dictionary containing the node name as key and line number
            as value
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
dict
</dd>
</dl>
<a NAME="ReturnVisitor.visit_Assign" ID="ReturnVisitor.visit_Assign"></a>
<h4>ReturnVisitor.visit_Assign</h4>
<b>visit_Assign</b>(<i>node</i>)

<p>
        Public method to handle an assign node.
</p>
<dl>

<dt><i>node</i> (ast.Assign)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="ReturnVisitor.visit_AsyncFor" ID="ReturnVisitor.visit_AsyncFor"></a>
<h4>ReturnVisitor.visit_AsyncFor</h4>
<b>visit_AsyncFor</b>(<i>node</i>)

<p>
        Public method to handle an async for loop.
</p>
<dl>

<dt><i>node</i> (ast.AsyncFor)</dt>
<dd>
reference to the async for node to handle
</dd>
</dl>
<a NAME="ReturnVisitor.visit_AsyncFunctionDef" ID="ReturnVisitor.visit_AsyncFunctionDef"></a>
<h4>ReturnVisitor.visit_AsyncFunctionDef</h4>
<b>visit_AsyncFunctionDef</b>(<i>node</i>)

<p>
        Public method to handle a function definition.
</p>
<dl>

<dt><i>node</i> (ast.AsyncFunctionDef)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="ReturnVisitor.visit_For" ID="ReturnVisitor.visit_For"></a>
<h4>ReturnVisitor.visit_For</h4>
<b>visit_For</b>(<i>node</i>)

<p>
        Public method to handle a for loop.
</p>
<dl>

<dt><i>node</i> (ast.For)</dt>
<dd>
reference to the for node to handle
</dd>
</dl>
<a NAME="ReturnVisitor.visit_FunctionDef" ID="ReturnVisitor.visit_FunctionDef"></a>
<h4>ReturnVisitor.visit_FunctionDef</h4>
<b>visit_FunctionDef</b>(<i>node</i>)

<p>
        Public method to handle a function definition.
</p>
<dl>

<dt><i>node</i> (ast.FunctionDef)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="ReturnVisitor.visit_Name" ID="ReturnVisitor.visit_Name"></a>
<h4>ReturnVisitor.visit_Name</h4>
<b>visit_Name</b>(<i>node</i>)

<p>
        Public method to handle a name node.
</p>
<dl>

<dt><i>node</i> (ast.Name)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="ReturnVisitor.visit_Return" ID="ReturnVisitor.visit_Return"></a>
<h4>ReturnVisitor.visit_Return</h4>
<b>visit_Return</b>(<i>node</i>)

<p>
        Public method to handle a return node.
</p>
<dl>

<dt><i>node</i> (ast.Return)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="ReturnVisitor.visit_While" ID="ReturnVisitor.visit_While"></a>
<h4>ReturnVisitor.visit_While</h4>
<b>visit_While</b>(<i>node</i>)

<p>
        Public method to handle a while loop.
</p>
<dl>

<dt><i>node</i> (ast.While)</dt>
<dd>
reference to the while node to handle
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="SysVersionVisitor" ID="SysVersionVisitor"></a>
<h2>SysVersionVisitor</h2>

<p>
    Class implementing a node visitor to check the use of sys.version and
    sys.version_info.
</p>
<p>
    Note: This class is modelled after flake8-2020 checker.
</p>
<h3>Derived from</h3>
ast.NodeVisitor
<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="#SysVersionVisitor.__init__">SysVersionVisitor</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#SysVersionVisitor.__isSys">__isSys</a></td>
<td>Private method to check for a reference to sys attribute.</td>
</tr>
<tr>
<td><a href="#SysVersionVisitor.__isSysVersionUpperSlice">__isSysVersionUpperSlice</a></td>
<td>Private method to check the upper slice of sys.version.</td>
</tr>
<tr>
<td><a href="#SysVersionVisitor.visit_Attribute">visit_Attribute</a></td>
<td>Public method to handle an attribute.</td>
</tr>
<tr>
<td><a href="#SysVersionVisitor.visit_Compare">visit_Compare</a></td>
<td>Public method to handle a comparison.</td>
</tr>
<tr>
<td><a href="#SysVersionVisitor.visit_ImportFrom">visit_ImportFrom</a></td>
<td>Public method to handle a from ...</td>
</tr>
<tr>
<td><a href="#SysVersionVisitor.visit_Name">visit_Name</a></td>
<td>Public method to handle an name.</td>
</tr>
<tr>
<td><a href="#SysVersionVisitor.visit_Subscript">visit_Subscript</a></td>
<td>Public method to handle a subscript.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="SysVersionVisitor.__init__" ID="SysVersionVisitor.__init__"></a>
<h4>SysVersionVisitor (Constructor)</h4>
<b>SysVersionVisitor</b>(<i></i>)

<p>
        Constructor
</p>
<a NAME="SysVersionVisitor.__isSys" ID="SysVersionVisitor.__isSys"></a>
<h4>SysVersionVisitor.__isSys</h4>
<b>__isSys</b>(<i>attr, node</i>)

<p>
        Private method to check for a reference to sys attribute.
</p>
<dl>

<dt><i>attr</i> (str)</dt>
<dd>
attribute name
</dd>
<dt><i>node</i> (ast.Node)</dt>
<dd>
reference to the node to be checked
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating a match
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="SysVersionVisitor.__isSysVersionUpperSlice" ID="SysVersionVisitor.__isSysVersionUpperSlice"></a>
<h4>SysVersionVisitor.__isSysVersionUpperSlice</h4>
<b>__isSysVersionUpperSlice</b>(<i>node, n</i>)

<p>
        Private method to check the upper slice of sys.version.
</p>
<dl>

<dt><i>node</i> (ast.Node)</dt>
<dd>
reference to the node to be checked
</dd>
<dt><i>n</i> (int)</dt>
<dd>
slice value to check against
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating a match
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="SysVersionVisitor.visit_Attribute" ID="SysVersionVisitor.visit_Attribute"></a>
<h4>SysVersionVisitor.visit_Attribute</h4>
<b>visit_Attribute</b>(<i>node</i>)

<p>
        Public method to handle an attribute.
</p>
<dl>

<dt><i>node</i> (ast.Attribute)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="SysVersionVisitor.visit_Compare" ID="SysVersionVisitor.visit_Compare"></a>
<h4>SysVersionVisitor.visit_Compare</h4>
<b>visit_Compare</b>(<i>node</i>)

<p>
        Public method to handle a comparison.
</p>
<dl>

<dt><i>node</i> (ast.Compare)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="SysVersionVisitor.visit_ImportFrom" ID="SysVersionVisitor.visit_ImportFrom"></a>
<h4>SysVersionVisitor.visit_ImportFrom</h4>
<b>visit_ImportFrom</b>(<i>node</i>)

<p>
        Public method to handle a from ... import ... statement.
</p>
<dl>

<dt><i>node</i> (ast.ImportFrom)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="SysVersionVisitor.visit_Name" ID="SysVersionVisitor.visit_Name"></a>
<h4>SysVersionVisitor.visit_Name</h4>
<b>visit_Name</b>(<i>node</i>)

<p>
        Public method to handle an name.
</p>
<dl>

<dt><i>node</i> (ast.Name)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="SysVersionVisitor.visit_Subscript" ID="SysVersionVisitor.visit_Subscript"></a>
<h4>SysVersionVisitor.visit_Subscript</h4>
<b>visit_Subscript</b>(<i>node</i>)

<p>
        Public method to handle a subscript.
</p>
<dl>

<dt><i>node</i> (ast.Subscript)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="TextVisitor" ID="TextVisitor"></a>
<h2>TextVisitor</h2>

<p>
    Class implementing a node visitor for bytes and str instances.
</p>
<p>
    It tries to detect docstrings as string of the first expression of each
    module, class or function.
</p>
<h3>Derived from</h3>
ast.NodeVisitor
<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="#TextVisitor.__init__">TextVisitor</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#TextVisitor.__addNode">__addNode</a></td>
<td>Private method to add a node to our list of nodes.</td>
</tr>
<tr>
<td><a href="#TextVisitor.__visitBody">__visitBody</a></td>
<td>Private method to traverse the body of the node manually.</td>
</tr>
<tr>
<td><a href="#TextVisitor.__visitDefinition">__visitDefinition</a></td>
<td>Private method handling class and function definitions.</td>
</tr>
<tr>
<td><a href="#TextVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td>
<td>Public method to handle an asynchronous function definition.</td>
</tr>
<tr>
<td><a href="#TextVisitor.visit_Bytes">visit_Bytes</a></td>
<td>Public method to record a bytes node.</td>
</tr>
<tr>
<td><a href="#TextVisitor.visit_Call">visit_Call</a></td>
<td>Public method to handle a function call.</td>
</tr>
<tr>
<td><a href="#TextVisitor.visit_ClassDef">visit_ClassDef</a></td>
<td>Public method to handle a class definition.</td>
</tr>
<tr>
<td><a href="#TextVisitor.visit_Constant">visit_Constant</a></td>
<td>Public method to handle constant nodes.</td>
</tr>
<tr>
<td><a href="#TextVisitor.visit_FunctionDef">visit_FunctionDef</a></td>
<td>Public method to handle a function definition.</td>
</tr>
<tr>
<td><a href="#TextVisitor.visit_Module">visit_Module</a></td>
<td>Public method to handle a module.</td>
</tr>
<tr>
<td><a href="#TextVisitor.visit_Str">visit_Str</a></td>
<td>Public method to record a string node.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="TextVisitor.__init__" ID="TextVisitor.__init__"></a>
<h4>TextVisitor (Constructor)</h4>
<b>TextVisitor</b>(<i></i>)

<p>
        Constructor
</p>
<a NAME="TextVisitor.__addNode" ID="TextVisitor.__addNode"></a>
<h4>TextVisitor.__addNode</h4>
<b>__addNode</b>(<i>node</i>)

<p>
        Private method to add a node to our list of nodes.
</p>
<dl>

<dt><i>node</i> (ast.AST)</dt>
<dd>
reference to the node to add
</dd>
</dl>
<a NAME="TextVisitor.__visitBody" ID="TextVisitor.__visitBody"></a>
<h4>TextVisitor.__visitBody</h4>
<b>__visitBody</b>(<i>node</i>)

<p>
        Private method to traverse the body of the node manually.
</p>
<p>
        If the first node is an expression which contains a string or bytes it
        marks that as a docstring.
</p>
<dl>

<dt><i>node</i> (ast.AST)</dt>
<dd>
reference to the node to traverse
</dd>
</dl>
<a NAME="TextVisitor.__visitDefinition" ID="TextVisitor.__visitDefinition"></a>
<h4>TextVisitor.__visitDefinition</h4>
<b>__visitDefinition</b>(<i>node</i>)

<p>
        Private method handling class and function definitions.
</p>
<dl>

<dt><i>node</i> (ast.FunctionDef, ast.AsyncFunctionDef or ast.ClassDef)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="TextVisitor.visit_AsyncFunctionDef" ID="TextVisitor.visit_AsyncFunctionDef"></a>
<h4>TextVisitor.visit_AsyncFunctionDef</h4>
<b>visit_AsyncFunctionDef</b>(<i>node</i>)

<p>
        Public method to handle an asynchronous function definition.
</p>
<dl>

<dt><i>node</i> (ast.AsyncFunctionDef)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="TextVisitor.visit_Bytes" ID="TextVisitor.visit_Bytes"></a>
<h4>TextVisitor.visit_Bytes</h4>
<b>visit_Bytes</b>(<i>node</i>)

<p>
        Public method to record a bytes node.
</p>
<dl>

<dt><i>node</i> (ast.Bytes)</dt>
<dd>
reference to the bytes node
</dd>
</dl>
<a NAME="TextVisitor.visit_Call" ID="TextVisitor.visit_Call"></a>
<h4>TextVisitor.visit_Call</h4>
<b>visit_Call</b>(<i>node</i>)

<p>
        Public method to handle a function call.
</p>
<dl>

<dt><i>node</i> (ast.Call)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="TextVisitor.visit_ClassDef" ID="TextVisitor.visit_ClassDef"></a>
<h4>TextVisitor.visit_ClassDef</h4>
<b>visit_ClassDef</b>(<i>node</i>)

<p>
        Public method to handle a class definition.
</p>
<dl>

<dt><i>node</i> (ast.ClassDef)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="TextVisitor.visit_Constant" ID="TextVisitor.visit_Constant"></a>
<h4>TextVisitor.visit_Constant</h4>
<b>visit_Constant</b>(<i>node</i>)

<p>
        Public method to handle constant nodes.
</p>
<dl>

<dt><i>node</i> (ast.Constant)</dt>
<dd>
reference to the bytes node
</dd>
</dl>
<a NAME="TextVisitor.visit_FunctionDef" ID="TextVisitor.visit_FunctionDef"></a>
<h4>TextVisitor.visit_FunctionDef</h4>
<b>visit_FunctionDef</b>(<i>node</i>)

<p>
        Public method to handle a function definition.
</p>
<dl>

<dt><i>node</i> (ast.FunctionDef)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="TextVisitor.visit_Module" ID="TextVisitor.visit_Module"></a>
<h4>TextVisitor.visit_Module</h4>
<b>visit_Module</b>(<i>node</i>)

<p>
        Public method to handle a module.
</p>
<dl>

<dt><i>node</i> (ast.Module)</dt>
<dd>
reference to the node to handle
</dd>
</dl>
<a NAME="TextVisitor.visit_Str" ID="TextVisitor.visit_Str"></a>
<h4>TextVisitor.visit_Str</h4>
<b>visit_Str</b>(<i>node</i>)

<p>
        Public method to record a string node.
</p>
<dl>

<dt><i>node</i> (ast.Str)</dt>
<dd>
reference to the string node
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="composeCallPath" ID="composeCallPath"></a>
<h2>composeCallPath</h2>
<b>composeCallPath</b>(<i>node</i>)

<p>
    Generator function to assemble the call path of a given node.
</p>
<dl>

<dt><i>node</i> (ast.Node)</dt>
<dd>
node to assemble call path for
</dd>
</dl>
<dl>
<dt>Yield:</dt>
<dd>
call path components
</dd>
</dl>
<dl>
<dt>Yield Type:</dt>
<dd>
str
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial