src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html

Thu, 27 Feb 2025 14:42:39 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 27 Feb 2025 14:42:39 +0100
branch
eric7
changeset 11150
73d80859079c
permissions
-rw-r--r--

Code Style Checkers
- Refactored the various code style checkers for better maintainability.

<!DOCTYPE html>
<html><head>
<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor</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.TextVisitor</h1>
<p>
Module implementing a node visitor for bytes and str instances.
</p>

<h3>Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>

<h3>Classes</h3>
<table>
<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>None</td></tr>
</table>

<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_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>
</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_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>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial