--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.AstUtilities.html Mon May 24 11:19:57 2021 +0200 @@ -0,0 +1,455 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.AstUtilities</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>eric7.Plugins.CheckerPlugins.CodeStyleChecker.AstUtilities</h1> + +<p> +Module implementing some utility and compatibility functions for working with +the ast module. +</p> +<h3>Global Attributes</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Classes</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Functions</h3> + +<table> + +<tr> +<td><a href="#getValue">getValue</a></td> +<td>Function to extract the value of a node.</td> +</tr> +<tr> +<td><a href="#getValue_1">getValue</a></td> +<td>Function to extract the value of a node.</td> +</tr> +<tr> +<td><a href="#isBaseString">isBaseString</a></td> +<td>Function to check that a node is a bytes or string.</td> +</tr> +<tr> +<td><a href="#isBaseString_1">isBaseString</a></td> +<td>Function to check that a node is a bytes or string.</td> +</tr> +<tr> +<td><a href="#isBytes">isBytes</a></td> +<td>Function to check that a node is a bytes.</td> +</tr> +<tr> +<td><a href="#isBytes_1">isBytes</a></td> +<td>Function to check that a node is a bytes.</td> +</tr> +<tr> +<td><a href="#isNameConstant">isNameConstant</a></td> +<td>Function to check that a node is a name constant.</td> +</tr> +<tr> +<td><a href="#isNameConstant_1">isNameConstant</a></td> +<td>Function to check that a node is a name constant.</td> +</tr> +<tr> +<td><a href="#isNumber">isNumber</a></td> +<td>Function to check that a node is a number.</td> +</tr> +<tr> +<td><a href="#isNumber_1">isNumber</a></td> +<td>Function to check that a node is a number.</td> +</tr> +<tr> +<td><a href="#isString">isString</a></td> +<td>Function to check that a node is a string.</td> +</tr> +<tr> +<td><a href="#isString_1">isString</a></td> +<td>Function to check that a node is a string.</td> +</tr> +</table> +<hr /> +<hr /> +<a NAME="getValue" ID="getValue"></a> +<h2>getValue</h2> +<b>getValue</b>(<i>node</i>) + +<p> + Function to extract the value of a node. +</p> +<dl> + +<dt><i>node</i> (ast.Constant)</dt> +<dd> +reference to the node to extract the value from +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +value of the node +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +any +</dd> +</dl> +<dl> + +<dt>Raises <b>TypeError</b>:</dt> +<dd> +raised to indicate an unsupported type +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="getValue_1" ID="getValue_1"></a> +<h2>getValue</h2> +<b>getValue</b>(<i>node</i>) + +<p> + Function to extract the value of a node. +</p> +<dl> + +<dt><i>node</i> (one of ast.Num, ast.Str, ast.Bytes or ast.NameConstant)</dt> +<dd> +reference to the node to extract the value from +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +value of the node +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +one of str, bytes, int +</dd> +</dl> +<dl> + +<dt>Raises <b>TypeError</b>:</dt> +<dd> +raised to indicate an unsupported type +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="isBaseString" ID="isBaseString"></a> +<h2>isBaseString</h2> +<b>isBaseString</b>(<i>node</i>) + +<p> + Function to check that a node is a bytes or string. +</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 a bytes or string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="isBaseString_1" ID="isBaseString_1"></a> +<h2>isBaseString</h2> +<b>isBaseString</b>(<i>node</i>) + +<p> + Function to check that a node is a bytes or string. +</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 a bytes or string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="isBytes" ID="isBytes"></a> +<h2>isBytes</h2> +<b>isBytes</b>(<i>node</i>) + +<p> + Function to check that a node is a bytes. +</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 a bytes +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="isBytes_1" ID="isBytes_1"></a> +<h2>isBytes</h2> +<b>isBytes</b>(<i>node</i>) + +<p> + Function to check that a node is a bytes. +</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 a bytes +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="isNameConstant" ID="isNameConstant"></a> +<h2>isNameConstant</h2> +<b>isNameConstant</b>(<i>node</i>) + +<p> + Function to check that a node is a name constant. +</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 a name constant +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="isNameConstant_1" ID="isNameConstant_1"></a> +<h2>isNameConstant</h2> +<b>isNameConstant</b>(<i>node</i>) + +<p> + Function to check that a node is a name constant. +</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 a name constant +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="isNumber" ID="isNumber"></a> +<h2>isNumber</h2> +<b>isNumber</b>(<i>node</i>) + +<p> + Function to check that a node is a number. +</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 a number +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="isNumber_1" ID="isNumber_1"></a> +<h2>isNumber</h2> +<b>isNumber</b>(<i>node</i>) + +<p> + Function to check that a node is a number. +</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 a number +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="isString" ID="isString"></a> +<h2>isString</h2> +<b>isString</b>(<i>node</i>) + +<p> + Function to check that a node is a string. +</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 a string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="isString_1" ID="isString_1"></a> +<h2>isString</h2> +<b>isString</b>(<i>node</i>) + +<p> + Function to check that a node is a string. +</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 a string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html> \ No newline at end of file