src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticVisitor.html

Sat, 26 Apr 2025 12:34:32 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 26 Apr 2025 12:34:32 +0200
branch
eric7
changeset 11240
c48c615c04a3
parent 11150
73d80859079c
permissions
-rw-r--r--

MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.

<!DOCTYPE html>
<html><head>
<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticVisitor</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<a NAME="top" ID="top"></a>
<h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticVisitor</h1>
<p>
Module implementing a node visitor to check for pydantic related issues.
</p>

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

<h3>Classes</h3>
<table>
<tr>
<td><a href="#PydanticVisitor">PydanticVisitor</a></td>
<td>Class implementing a node visitor to check for pydantic related issues.</td>
</tr>
</table>

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

<hr />
<hr />
<a NAME="PydanticVisitor" ID="PydanticVisitor"></a>
<h2>PydanticVisitor</h2>
<p>
    Class implementing a node visitor to check for pydantic related issues.
</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="#PydanticVisitor.__init__">PydanticVisitor</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.__checkForPyd001">__checkForPyd001</a></td>
<td>Private method to check positional argument for Field default argument.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.__checkForPyd002">__checkForPyd002</a></td>
<td>Private method to check non-annotated attribute inside Pydantic model.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.__checkForPyd003">__checkForPyd003</a></td>
<td>Private method to check unecessary Field call to specify a default value.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.__checkForPyd004">__checkForPyd004</a></td>
<td>Private method to check for a default argument specified in annotated.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.__checkForPyd005">__checkForPyd005</a></td>
<td>Private method to check for a field name overriding the annotation.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.__checkForPyd006">__checkForPyd006</a></td>
<td>Private method to check for duplicate field names.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.__checkForPyd010">__checkForPyd010</a></td>
<td>Private method to check for the use of `__pydantic_config__`.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.__currentClass">__currentClass</a></td>
<td>Private method returning the current class type as recorded by the __enterClass method.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.__enterClass">__enterClass</a></td>
<td>Private method to record class type when entering a class definition.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.__leaveClass">__leaveClass</a></td>
<td>Private method to remove the data recorded by the __enterClass method.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.visit_AnnAssign">visit_AnnAssign</a></td>
<td>Public method to process annotated assignment.</td>
</tr>
<tr>
<td><a href="#PydanticVisitor.visit_ClassDef">visit_ClassDef</a></td>
<td>Public method to process class definitions.</td>
</tr>
</table>

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


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

<dl>

<dt><i>errorCallback</i> (func)</dt>
<dd>
callback function to register an issue
</dd>
</dl>
<a NAME="PydanticVisitor.__checkForPyd001" ID="PydanticVisitor.__checkForPyd001"></a>
<h4>PydanticVisitor.__checkForPyd001</h4>
<b>__checkForPyd001</b>(<i>node: ast.AnnAssign</i>)
<p>
        Private method to check positional argument for Field default argument.
</p>

<dl>

<dt><i>node</i> (ast.AnnAssign)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="PydanticVisitor.__checkForPyd002" ID="PydanticVisitor.__checkForPyd002"></a>
<h4>PydanticVisitor.__checkForPyd002</h4>
<b>__checkForPyd002</b>(<i>node</i>)
<p>
        Private method to check non-annotated attribute inside Pydantic model.
</p>

<dl>

<dt><i>node</i> (ast.ClassDef)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="PydanticVisitor.__checkForPyd003" ID="PydanticVisitor.__checkForPyd003"></a>
<h4>PydanticVisitor.__checkForPyd003</h4>
<b>__checkForPyd003</b>(<i>node</i>)
<p>
        Private method to check unecessary Field call to specify a default value.
</p>

<dl>

<dt><i>node</i> (ast.AnnAssign)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="PydanticVisitor.__checkForPyd004" ID="PydanticVisitor.__checkForPyd004"></a>
<h4>PydanticVisitor.__checkForPyd004</h4>
<b>__checkForPyd004</b>(<i>node</i>)
<p>
        Private method to check for a default argument specified in annotated.
</p>

<dl>

<dt><i>node</i> (ast.AnnAssign)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="PydanticVisitor.__checkForPyd005" ID="PydanticVisitor.__checkForPyd005"></a>
<h4>PydanticVisitor.__checkForPyd005</h4>
<b>__checkForPyd005</b>(<i>node</i>)
<p>
        Private method to check for a field name overriding the annotation.
</p>

<dl>

<dt><i>node</i> (ast.ClassDef)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="PydanticVisitor.__checkForPyd006" ID="PydanticVisitor.__checkForPyd006"></a>
<h4>PydanticVisitor.__checkForPyd006</h4>
<b>__checkForPyd006</b>(<i>node</i>)
<p>
        Private method to check for duplicate field names.
</p>

<dl>

<dt><i>node</i> (ast.ClassDef)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="PydanticVisitor.__checkForPyd010" ID="PydanticVisitor.__checkForPyd010"></a>
<h4>PydanticVisitor.__checkForPyd010</h4>
<b>__checkForPyd010</b>(<i>node: ast.ClassDef</i>)
<p>
        Private method to check for the use of `__pydantic_config__`.
</p>

<dl>

<dt><i>node</i> (ast.ClassDef)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="PydanticVisitor.__currentClass" ID="PydanticVisitor.__currentClass"></a>
<h4>PydanticVisitor.__currentClass</h4>
<b>__currentClass</b>(<i></i>)
<p>
        Private method returning the current class type as recorded by the __enterClass
        method.
</p>

<dl>
<dt>Return:</dt>
<dd>
current class type (one of 'pydantic_model', 'dataclass' or
            'other_class')
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str
</dd>
</dl>
<a NAME="PydanticVisitor.__enterClass" ID="PydanticVisitor.__enterClass"></a>
<h4>PydanticVisitor.__enterClass</h4>
<b>__enterClass</b>(<i>node</i>)
<p>
        Private method to record class type when entering a class definition.
</p>

<dl>

<dt><i>node</i> (ast.ClassDef)</dt>
<dd>
reference to the node to be processed
</dd>
</dl>
<a NAME="PydanticVisitor.__leaveClass" ID="PydanticVisitor.__leaveClass"></a>
<h4>PydanticVisitor.__leaveClass</h4>
<b>__leaveClass</b>(<i></i>)
<p>
        Private method to remove the data recorded by the __enterClass method.
</p>

<a NAME="PydanticVisitor.visit_AnnAssign" ID="PydanticVisitor.visit_AnnAssign"></a>
<h4>PydanticVisitor.visit_AnnAssign</h4>
<b>visit_AnnAssign</b>(<i>node: ast.AnnAssign</i>)
<p>
        Public method to process annotated assignment.
</p>

<dl>

<dt><i>node</i> (ast.AnnAssign)</dt>
<dd>
reference to the node to be processed.
</dd>
</dl>
<a NAME="PydanticVisitor.visit_ClassDef" ID="PydanticVisitor.visit_ClassDef"></a>
<h4>PydanticVisitor.visit_ClassDef</h4>
<b>visit_ClassDef</b>(<i>node: ast.ClassDef</i>)
<p>
        Public method to process class definitions.
</p>

<dl>

<dt><i>node</i> (ast.ClassDef)</dt>
<dd>
reference to the node to be processed.
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial