diff --git a/_sources/installation.rst.txt b/_sources/installation.rst.txt index 26803a0..980d23a 100644 --- a/_sources/installation.rst.txt +++ b/_sources/installation.rst.txt @@ -3,7 +3,7 @@ Downloading and Installation ==================================== .. _numpy: https://numpy.org/ -.. _github: https://github.com/newville/asteval +.. _github: https://github.com/lmfit/asteval .. _PyPI: https://pypi.org/project/asteval/ Requirements @@ -28,10 +28,8 @@ until late in the "beta" period of development. Historically, the delay has not been too long, though `asteval` may not support newly introduced language features. -At this writing (Asteval 0.9.31, July, 2023), minimal testing has been done -with Python 3.12-beta4, without numpy installed. All tests pass, which -suggests that there no changes needed to the way `asteval` works with the AST -generated by Python. +At this writing (Asteval 0.9.32, March, 2024), testing is done with Python 3.8 +through 3.12, with and without numpy installed. Download and Installation ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -52,7 +50,7 @@ Development Version The latest development version can be found at the `github`_ repository, and cloned with:: - git clone https://github.com/newville/asteval.git + git clone https://github.com/lmfit/asteval.git Installation diff --git a/_static/basic.css b/_static/basic.css index 7577acb..30fee9d 100644 --- a/_static/basic.css +++ b/_static/basic.css @@ -237,6 +237,10 @@ a.headerlink { visibility: hidden; } +a:visited { + color: #551A8B; +} + h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, @@ -670,6 +674,16 @@ dd { margin-left: 30px; } +.sig dd { + margin-top: 0px; + margin-bottom: 0px; +} + +.sig dl { + margin-top: 0px; + margin-bottom: 0px; +} + dl > dd:last-child, dl > dd:last-child > :last-child { margin-bottom: 0; @@ -738,6 +752,14 @@ abbr, acronym { cursor: help; } +.translated { + background-color: rgba(207, 255, 207, 0.2) +} + +.untranslated { + background-color: rgba(255, 207, 207, 0.2) +} + /* -- code displays --------------------------------------------------------- */ pre { diff --git a/_static/documentation_options.js b/_static/documentation_options.js index 673fa7b..897b587 100644 --- a/_static/documentation_options.js +++ b/_static/documentation_options.js @@ -1,5 +1,4 @@ -var DOCUMENTATION_OPTIONS = { - URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), +const DOCUMENTATION_OPTIONS = { VERSION: '0.9.31', LANGUAGE: 'en', COLLAPSE_INDEX: false, diff --git a/_static/pygments.css b/_static/pygments.css index 691aeb8..0d49244 100644 --- a/_static/pygments.css +++ b/_static/pygments.css @@ -17,6 +17,7 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #A00000 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #FF0000 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #00A000 } /* Generic.Inserted */ diff --git a/_static/searchtools.js b/_static/searchtools.js index 97d56a7..7918c3f 100644 --- a/_static/searchtools.js +++ b/_static/searchtools.js @@ -57,12 +57,12 @@ const _removeChildren = (element) => { const _escapeRegExp = (string) => string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string -const _displayItem = (item, searchTerms) => { +const _displayItem = (item, searchTerms, highlightTerms) => { const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; - const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT; const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + const contentRoot = document.documentElement.dataset.content_root; const [docName, title, anchor, descr, score, _filename] = item; @@ -75,20 +75,24 @@ const _displayItem = (item, searchTerms) => { if (dirname.match(/\/index\/$/)) dirname = dirname.substring(0, dirname.length - 6); else if (dirname === "index/") dirname = ""; - requestUrl = docUrlRoot + dirname; + requestUrl = contentRoot + dirname; linkUrl = requestUrl; } else { // normal html builders - requestUrl = docUrlRoot + docName + docFileSuffix; + requestUrl = contentRoot + docName + docFileSuffix; linkUrl = docName + docLinkSuffix; } let linkEl = listItem.appendChild(document.createElement("a")); linkEl.href = linkUrl + anchor; linkEl.dataset.score = score; linkEl.innerHTML = title; - if (descr) + if (descr) { listItem.appendChild(document.createElement("span")).innerHTML = " (" + descr + ")"; + // highlight search terms in the description + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + } else if (showSearchSummary) fetch(requestUrl) .then((responseData) => responseData.text()) @@ -97,6 +101,9 @@ const _displayItem = (item, searchTerms) => { listItem.appendChild( Search.makeSearchSummary(data, searchTerms) ); + // highlight search terms in the summary + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); }); Search.output.appendChild(listItem); }; @@ -115,14 +122,15 @@ const _finishSearch = (resultCount) => { const _displayNextItem = ( results, resultCount, - searchTerms + searchTerms, + highlightTerms, ) => { // results left, load the summary and display it // this is intended to be dynamic (don't sub resultsCount) if (results.length) { - _displayItem(results.pop(), searchTerms); + _displayItem(results.pop(), searchTerms, highlightTerms); setTimeout( - () => _displayNextItem(results, resultCount, searchTerms), + () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), 5 ); } @@ -360,7 +368,7 @@ const Search = { // console.info("search results:", Search.lastresults); // print the results - _displayNextItem(results, results.length, searchTerms); + _displayNextItem(results, results.length, searchTerms, highlightTerms); }, /** diff --git a/_static/sphinx_highlight.js b/_static/sphinx_highlight.js index aae669d..8a96c69 100644 --- a/_static/sphinx_highlight.js +++ b/_static/sphinx_highlight.js @@ -29,14 +29,19 @@ const _highlight = (node, addItems, text, className) => { } span.appendChild(document.createTextNode(val.substr(pos, text.length))); + const rest = document.createTextNode(val.substr(pos + text.length)); parent.insertBefore( span, parent.insertBefore( - document.createTextNode(val.substr(pos + text.length)), + rest, node.nextSibling ) ); node.nodeValue = val.substr(0, pos); + /* There may be more occurrences of search term in this node. So call this + * function recursively on the remaining fragment. + */ + _highlight(rest, addItems, text, className); if (isInSVG) { const rect = document.createElementNS( @@ -140,5 +145,10 @@ const SphinxHighlight = { }, }; -_ready(SphinxHighlight.highlightSearchWords); -_ready(SphinxHighlight.initEscapeListener); +_ready(() => { + /* Do not call highlightSearchWords() when we are on the search page. + * It will highlight words from the *previous* search query. + */ + if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); + SphinxHighlight.initEscapeListener(); +}); diff --git a/_static/sphinxdoc.css b/_static/sphinxdoc.css index 3dadf44..1e9ffe0 100644 --- a/_static/sphinxdoc.css +++ b/_static/sphinxdoc.css @@ -151,6 +151,10 @@ a:hover { color: #2491CF; } +a:visited { + color: #551A8B; +} + div.body a { text-decoration: underline; } diff --git a/api.html b/api.html index 5eda7ac..8f65048 100644 --- a/api.html +++ b/api.html @@ -1,16 +1,16 @@ - + - + asteval reference — ASTEVAL: Minimal Python AST evaluator - - - - - + + + + + @@ -38,8 +38,8 @@

Navigation

-

asteval reference

-

The asteval module has a pretty simple interface, providing an +

asteval reference

+

The asteval module has a pretty simple interface, providing an Interpreter class which creates an Interpreter of expressions and code. There are a few options available to control what language features to support, how to deal with writing to standard output and standard error, @@ -48,26 +48,26 @@

Navigation

symbol names, and make_symbol_table() is useful for creating symbol tables that may be pre-loaded with custom symbols and functions.

-

The Interpreter class

+

The Interpreter class

-class asteval.Interpreter(symtable=None, nested_symtable=False, user_symbols=None, writer=None, err_writer=None, use_numpy=True, max_statement_length=50000, minimal=False, readonly_symbols=None, builtins_readonly=False, config=None, **kws)
+class asteval.Interpreter(symtable=None, nested_symtable=False, user_symbols=None, writer=None, err_writer=None, use_numpy=True, max_statement_length=50000, minimal=False, readonly_symbols=None, builtins_readonly=False, config=None, **kws)

create an asteval Interpreter: a restricted, simplified interpreter of mathematical expressions using Python syntax.

Parameters:
  • symtable (dict or None) – dictionary or SymbolTable to use as symbol table (if None, one will be created).

  • -
  • nested_symtable (bool, optional) – whether to use a new-style nested symbol table instead of a plain dict [False]

  • +
  • nested_symtable (bool, optional) – whether to use a new-style nested symbol table instead of a plain dict [False]

  • user_symbols (dict or None) – dictionary of user-defined symbols to add to symbol table.

  • writer (file-like or None) – callable file-like object where standard output will be sent.

  • err_writer (file-like or None) – callable file-like object where standard error will be sent.

  • -
  • use_numpy (bool) – whether to use functions from numpy.

  • -
  • max_statement_length (int) – maximum length of expression allowed [50,000 characters]

  • +
  • use_numpy (bool) – whether to use functions from numpy.

  • +
  • max_statement_length (int) – maximum length of expression allowed [50,000 characters]

  • readonly_symbols (iterable or None) – symbols that the user can not assign to

  • -
  • builtins_readonly (bool) – whether to blacklist all symbols that are in the initial symtable

  • -
  • minimal (bool) – create a minimal interpreter: disable many nodes (see Note 1).

  • -
  • config (dict) – dictionay listing which nodes to support (see note 2))

  • +
  • builtins_readonly (bool) – whether to blacklist all symbols that are in the initial symtable

  • +
  • minimal (bool) – create a minimal interpreter: disable many nodes (see Note 1).

  • +
  • config (dict) – dictionay listing which nodes to support (see note 2))

@@ -83,20 +83,20 @@

The make_symbol_table() that will include several standard python builtin functions, several -functions from the math module and (if available and not turned off) +functions from the math module and (if available and not turned off) several functions from numpy.

The writer argument can be used to provide a place to send all output -that would normally go to sys.stdout. The default is, of -course, to send output to sys.stdout. Similarly, err_writer +that would normally go to sys.stdout. The default is, of +course, to send output to sys.stdout. Similarly, err_writer will be used for output that will otherwise be sent to -sys.stderr.

+sys.stderr.

The use_numpy argument can be used to control whether functions from numpy are loaded into the symbol table.

Whether the user-code is able to overwrite the entries in the symbol table can be controlled with the readonly_symbols and builtins_readonly keywords.

-

Configuring which features the Interpreter recognizes

+

Configuring which features the Interpreter recognizes

The interpreter can be configured to enable or disable many language constructs, named according to the AST node in the Python language definition.

Table of optional Python AST nodes used asteval. The minimal configuration @@ -259,7 +259,7 @@

Configuring which features the Interpreter recognizesor by setting the config dictionary as described above:

-

Interpreter methods and attributes

+

Interpreter methods and attributes

An Interpreter instance has many methods, but most of them are implementation details for how to handle particular AST nodes, and should not be considered as part of the usable API. The methods described be low, @@ -267,16 +267,16 @@

Interpreter methods and attributes
-asteval.eval(expression[, lineno=0[, show_errors=True[, raise_errors=False]]])
+asteval.eval(expression[, lineno=0[, show_errors=True[, raise_errors=False]]])

evaluate the expression, returning the result.

Parameters:
  • expression (string) – code to evaluate.

  • -
  • lineno (int) – line number (for error messages).

  • -
  • show_errors (bool) – whether to print error messages or leave them +

  • lineno (int) – line number (for error messages).

  • +
  • show_errors (bool) – whether to print error messages or leave them in the errors list.

  • -
  • raise_errors (bool) – whether to re-raise exceptions or leave them +

  • raise_errors (bool) – whether to re-raise exceptions or leave them in the errors list.

@@ -285,7 +285,7 @@

Interpreter methods and attributes
-asteval.__call__(expression[, lineno=0[, show_errors=True[, raise_errors=False]]])
+asteval.__call__(expression[, lineno=0[, show_errors=True[, raise_errors=False]]])

same as eval(). That is:

>>> from asteval import Interpreter
 >>> a = Interpreter()
@@ -300,7 +300,7 @@ 

Interpreter methods and attributes
-asteval.symtable
+asteval.symtable

the symbol table where all data and functions for the Interpreter are stored and looked up. By default, this is a simple dictionary with symbol names as keys, and values of data and functions. If the nested_symtable @@ -314,7 +314,7 @@

Interpreter methods and attributes
-asteval.error
+asteval.error

a list of error information, filled on exceptions. You can test this after each call of the interpreter. It will be empty if the last execution was successful. If an error occurs, this will contain a liste @@ -323,13 +323,13 @@

Interpreter methods and attributes
-asteval.error_msg
+asteval.error_msg

the most recent error message.

-

Symbol Tables used in asteval

+

Symbol Tables used in asteval

The symbol table holds all of the data used by the Interpreter. That is, when you execute a = b * cos(pi/3), the Interpreter sees that it needs to lookup values for b, cos, and pi (it already knows =, *, /, @@ -372,7 +372,7 @@

Interpreter methods and attributesNew in version 0.9.31.

-

New Style Symbol Table

+

New Style Symbol Table

Beginning with version 0.9.31, there is an option to use a more complex and nested symbol table. This symbol table uses a "Group" object which is a subclass of a Python dict that can also be used with object.attribute syntax:

@@ -417,20 +417,20 @@

New Style Symbol Table

-

Utility Functions

+

Utility Functions

-asteval.valid_symbol_name(name)
+asteval.valid_symbol_name(name)

Determine whether the input symbol name is a valid name.

Parameters:
-

name (str) – name to check for validity.

+

name (str) – name to check for validity.

Returns:

valid – whether name is a a valid symbol name

Return type:
-

bool

+

bool

This checks for Python reserved words and that the name matches @@ -439,14 +439,14 @@

Utility Functions
-asteval.make_symbol_table(use_numpy=True, nested=False, top=True, **kws)
+asteval.make_symbol_table(use_numpy=True, nested=False, top=True, **kws)

Create a default symboltable, taking dict of user-defined symbols.

Parameters:
    -
  • numpy (bool, optional) – whether to include symbols from numpy [True]

  • -
  • nested (bool, optional) – whether to make a “new-style” nested table instead of a plain dict [False]

  • -
  • top (bool, optional) – whether this is the top-level table in a nested-table [True]

  • +
  • numpy (bool, optional) – whether to include symbols from numpy [True]

  • +
  • nested (bool, optional) – whether to make a “new-style” nested table instead of a plain dict [False]

  • +
  • top (bool, optional) – whether this is the top-level table in a nested-table [True]

  • kws (optional) – additional symbol name, value pairs to include in symbol table

@@ -454,7 +454,7 @@

Utility Functions

symbol_table – a symbol table that can be used in asteval.Interpereter

Return type:
-

dict or nested Group

+

dict or nested Group

@@ -565,8 +565,8 @@

Navigation

\ No newline at end of file diff --git a/basics.html b/basics.html index 3a4d934..3b2bb59 100644 --- a/basics.html +++ b/basics.html @@ -1,16 +1,16 @@ - + - + Using asteval — ASTEVAL: Minimal Python AST evaluator - - - - - + + + + + @@ -42,12 +42,12 @@

Navigation

-

Using asteval

+

Using asteval

This chapter gives a quick overview of asteval, showing basic usage and the most important features. Further details can be found in the next chapter (asteval reference).

-

creating and using an asteval Interpreter

+

creating and using an asteval Interpreter

The asteval module is very easy to use. Import the module and create an Interpreter:

>>> from asteval import Interpreter
 >>> aeval = Interpreter()
@@ -75,7 +75,7 @@ 

creating and using an asteval Interpreter -

accessing the symbol table

+

accessing the symbol table

The symbol table (that is, the mapping between variable and function names and the underlying objects) is a simple dictionary (by default, see Symbol Tables used in asteval for details of an optional alternative) held in the @@ -104,7 +104,7 @@

accessing the symbol table -

built-in functions

+

built-in functions

At startup, many symbols are loaded into the symbol table from Python’s builtins and the math module. The builtins include several basic Python functions:

@@ -141,7 +141,7 @@

built-in functionsnumpy.

-

conditionals and loops

+

conditionals and loops

If-then-else blocks, for-loops (including the optional else block), while loops (also including optional else block), and with blocks are supported, and work exactly as they do in python. Thus:

@@ -159,19 +159,19 @@

conditionals and loops

-

comprehensions

+

comprehensions

list, dict, and set comprehension are supported, acting just as they do in Python. Generators, yield, and async programmming are not currently supported.

-

printing

-

For printing, asteval emulates Python’s native print() function. You +

printing

+

For printing, asteval emulates Python’s native print() function. You can change where output is sent with the writer argument when creating the interpreter, or supreess printing all together with the no_print -option. By default, outputs are sent to sys.stdout.

+option. By default, outputs are sent to sys.stdout.

-

writing functions

+

writing functions

User-defined functions can be written and executed, as in python with a def block, for example:

>>> from asteval import Interpreter
@@ -186,7 +186,7 @@ 

writing functions -

exceptions

+

exceptions

Asteval monitors and caches exceptions in the evaluated code. Brief error messages are printed (with Python’s print function, and so using standard output by default), and the full set of exceptions is kept in the @@ -288,8 +288,8 @@

Navigation

\ No newline at end of file diff --git a/genindex.html b/genindex.html index 2ae8b54..977e9b4 100644 --- a/genindex.html +++ b/genindex.html @@ -1,15 +1,15 @@ - + Index — ASTEVAL: Minimal Python AST evaluator - - - - - + + + + + @@ -157,8 +157,8 @@

Navigation

\ No newline at end of file diff --git a/index.html b/index.html index 1737b9c..bdb4dff 100644 --- a/index.html +++ b/index.html @@ -1,16 +1,16 @@ - + - + ASTEVAL: Minimal Python AST Evaluator — ASTEVAL: Minimal Python AST evaluator - - - - - + + + + + @@ -38,14 +38,14 @@

Navigation

-

ASTEVAL: Minimal Python AST Evaluator

+

ASTEVAL: Minimal Python AST Evaluator

The asteval package evaluates Python expressions and statements, providing a -safer alternative to Python’s builtin eval() and a richer, easier to -use alternative to ast.literal_eval(). It does this by building an +safer alternative to Python’s builtin eval() and a richer, easier to +use alternative to ast.literal_eval(). It does this by building an embedded interpreter for a subset of the Python language using Python’s -ast module. The emphasis and main area of application is the +ast module. The emphasis and main area of application is the evaluation of mathematical expressions. Because of this emphasis, mathematical -functions from Python’s math module are built-in to asteval, and a +functions from Python’s math module are built-in to asteval, and a large number of functions from numpy will be available if numpy is installed on your system. For backward compatibility, a few functions that were moved from numpy to numpy_financial will be imported, if that @@ -59,9 +59,9 @@

ASTEVAL: Minimal Python AST Evaluatorast module. There are important differences and missing features +ast module. There are important differences and missing features compared to Python. Many of these absences are intentional, and part of -the effort to try to make a safer version of eval(), while some +the effort to try to make a safer version of eval(), while some are simply due to the reduced requirements for an embedded mini-language. These differences and absences include:

@@ -75,8 +75,8 @@

ASTEVAL: Minimal Python AST Evaluatorlambda are not supported.

  • yield, await, and async programming are not supported.

  • -
  • Many builtin functions (eval(), getattr(), -hasattr(), setattr(), and delattr()) are not allowed.

  • +
  • Many builtin functions (eval(), getattr(), +hasattr(), setattr(), and delattr()) are not allowed.

  • Accessing many object attributes that can provide access to the python interpreter are not allowed.

  • @@ -92,7 +92,7 @@

    ASTEVAL: Minimal Python AST Evaluatoreval(). However, asteval is an open source project written by +eval(). However, asteval is an open source project written by volunteers, and we cannot guarantee that it is completely safe against malicious attacks.

    @@ -146,7 +146,7 @@

    ASTEVAL: Minimal Python AST Evaluatorgithub.com +Development version:
        github.com
    \ No newline at end of file diff --git a/installation.html b/installation.html index a2b3737..a032ca2 100644 --- a/installation.html +++ b/installation.html @@ -1,16 +1,16 @@ - + - + Downloading and Installation — ASTEVAL: Minimal Python AST evaluator - - - - - + + + + + @@ -42,9 +42,9 @@

    Navigation

    -

    Downloading and Installation

    +

    Downloading and Installation

    -

    Requirements

    +

    Requirements

    Asteval is a pure Python module. For Python 3.8 and higher, there are no required dependencies outside of the standard library. If numpy and numpy_financial are available, Asteval will make use of these libraries. The @@ -61,13 +61,11 @@

    Requirements -

    Download and Installation

    +

    Download and Installation

    The latest stable version of asteval is 0.9.31 and is available at PyPI or as a conda package. You should be able to install asteval with:

    @@ -80,21 +78,21 @@

    Download and Installation -

    Development Version

    -

    The latest development version can be found at the github repository, and cloned with:

    -
    git clone https://github.com/newville/asteval.git
    +

    Development Version

    +

    The latest development version can be found at the github repository, and cloned with:

    +
    git clone https://github.com/lmfit/asteval.git
     

    -

    Installation

    +

    Installation

    Installation from source on any platform is:

    pip install .
     
    -

    License

    +

    License

    The ASTEVAL code is distribution under the following license:

    The MIT License
     
    @@ -194,8 +192,8 @@ 

    Navigation

    \ No newline at end of file diff --git a/motivation.html b/motivation.html index 9ee545c..2156a4a 100644 --- a/motivation.html +++ b/motivation.html @@ -1,16 +1,16 @@ - + - + Motivation for asteval — ASTEVAL: Minimal Python AST evaluator - - - - - + + + + + @@ -42,35 +42,35 @@

    Navigation

    -

    Motivation for asteval

    +

    Motivation for asteval

    The asteval module allows you to evaluate a large subset of the Python language -from within a python program, without using eval(). It is, in effect, -a restricted version of Python’s built-in eval(), forbidding several +from within a python program, without using eval(). It is, in effect, +a restricted version of Python’s built-in eval(), forbidding several actions, and using (by default) a simple dictionary as a flat namespace. A completely fair question is: Why is this desirable? That is, why not simply -use eval(), or just use Python itself?

    +use eval(), or just use Python itself?

    The short answer is that sometimes you want to allow evaluation of user input, or expose a simple or even scientific calculator inside a larger application. -For this, eval() is pretty scary, as it exposes all of Python, which +For this, eval() is pretty scary, as it exposes all of Python, which makes user input difficult to trust. Since asteval does not support the import statement (unless explicitly enabled) or many other constructs, user -code cannot access the os and sys modules or any functions +code cannot access the os and sys modules or any functions or classes outside those provided in the symbol table.

    Many of the other missing features (modules, classes, lambda, yield, generators) are similarly motivated by a desire for a safer version of -eval(). The idea for asteval is to make a simple procedural, +eval(). The idea for asteval is to make a simple procedural, mathematically-oriented language that can be embedded into larger applications.

    In fact, the asteval module grew out the the need for a simple expression evaluator for scientific applications such as the lmfit and xraylarch modules. An early attempt using the pyparsing module worked but was error-prone and difficult to maintain. While the simplest of calculators or expressiona-evaluators is not hard with pyparsing, it turned out that using the -Python ast module makes it much easier to implement a feature-rich +Python ast module makes it much easier to implement a feature-rich scientific calculator, including slicing, complex numbers, keyword arguments to functions, etc. In fact, this approach meant that adding more complex programming constructs like conditionals, loops, exception handling, and even user-defined functions was fairly simple. An important benefit of using the -ast module is that whole categories of implementation errors +ast module is that whole categories of implementation errors involving parsing, lexing, and defining a grammar disappear. Any valid python expression will be parsed correctly and converted into an Abstract Syntax Tree. Furthermore, the resulting AST is easy to walk through, greatly simplifying the @@ -83,18 +83,18 @@

    Motivation for astevalhttps://stackoverflow.com/questions/34106484), use of asteval and numpy can approach the speed of eval and the numexpr modules.

    -

    How Safe is asteval?

    -

    Asteval avoids all of the exploits we know about that make eval() +

    How Safe is asteval?

    +

    Asteval avoids all of the exploits we know about that make eval() dangerous. For reference, see, Eval is really dangerous and the comments and links therein. From this discussion it is apparent that not only -is eval() unsafe, but that it is a difficult prospect to make any +is eval() unsafe, but that it is a difficult prospect to make any program that takes user input perfectly safe. In particular, if a user can cause Python to crash with a segmentation fault, safety cannot be guaranteed. Asteval explicitly forbids the exploits described in the above link, and works hard to prevent malicious code from crashing Python or accessing the underlying operating system. That said, we cannot guarantee that asteval is completely safe from malicious code. We claim only that it is safer than the -builtin eval(), and that you might find it useful.

    +builtin eval(), and that you might find it useful.

    Some of the things not allowed in the asteval interpreter for safety reasons include:

    @@ -272,8 +272,8 @@

    Navigation

    \ No newline at end of file diff --git a/py-modindex.html b/py-modindex.html index 7b152f0..1f154cf 100644 --- a/py-modindex.html +++ b/py-modindex.html @@ -1,15 +1,15 @@ - + Python Module Index — ASTEVAL: Minimal Python AST evaluator - - - - - + + + + + @@ -92,8 +92,8 @@

    Navigation

    \ No newline at end of file diff --git a/search.html b/search.html index 2916d2b..51f4db9 100644 --- a/search.html +++ b/search.html @@ -1,16 +1,16 @@ - + Search — ASTEVAL: Minimal Python AST evaluator - - + + - - - + + + @@ -93,8 +93,8 @@

    Navigation

    \ No newline at end of file diff --git a/searchindex.js b/searchindex.js index e99c928..ad4a84b 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({"docnames": ["api", "basics", "index", "installation", "motivation"], "filenames": ["api.rst", "basics.rst", "index.rst", "installation.rst", "motivation.rst"], "titles": ["asteval reference", "Using asteval", "ASTEVAL: Minimal Python AST Evaluator", "Downloading and Installation", "Motivation for asteval"], "terms": {"modul": [0, 1, 2, 3, 4], "ha": [0, 3, 4], "pretti": [0, 4], "simpl": [0, 1, 2, 4], "interfac": 0, "provid": [0, 2, 3, 4], "an": [0, 2, 3, 4], "which": [1, 2, 3, 4], "creat": [0, 2, 4], "express": [0, 1, 2, 3, 4], "code": [0, 1, 3, 4], "There": [0, 2, 4], "ar": [0, 1, 2, 3, 4], "few": [0, 2], "option": [0, 1], "avail": [0, 1, 2, 3], "control": 0, "what": [0, 2, 4], "languag": [0, 1, 2, 3, 4], "featur": [1, 2, 3, 4], "support": [0, 1, 2, 3, 4], "how": [0, 2], "deal": [0, 3], "write": [0, 2, 3], "standard": [0, 1, 2, 3], "output": [0, 1], "error": [0, 1, 4], "specifi": [0, 4], "symbol": [2, 4], "tabl": [2, 4], "also": [0, 1, 2, 3, 4], "conveni": 0, "valid_symbol_nam": 0, "i": [0, 1, 2, 3], "us": [2, 3, 4], "tese": [], "valid": [0, 1, 4], "name": [0, 1, 2], "make_symbol_t": 0, "mai": [0, 3, 4], "pre": 0, "load": [0, 1, 4], "custom": 0, "symtabl": [0, 1], "none": [0, 1, 4], "usersym": [], "writer": [0, 1], "err_writ": 0, "use_numpi": 0, "true": [0, 1], "max_statement_length": 0, "50000": 0, "minim": [0, 3], "fals": [0, 1], "no_if": [], "no_for": [], "no_whil": 0, "no_tri": [], "no_functiondef": [], "no_ifexp": [], "no_listcomp": [], "no_augassign": [], "no_assert": [], "no_delet": [], "no_rais": [], "no_print": 1, "max_tim": [], "readonly_symbol": 0, "builtins_readonli": 0, "restrict": [0, 2, 3, 4], "simplifi": [0, 4], "mathemat": [0, 1, 2, 4], "python": [0, 1, 3, 4], "syntax": [0, 4], "paramet": 0, "dict": [0, 1], "dictionari": [0, 1, 2, 4], "one": 0, "user": [0, 1, 2, 4], "defin": [0, 1, 2, 4], "add": 0, "file": [0, 3, 4], "like": [0, 1, 2, 4], "callabl": 0, "object": [0, 1, 2, 4], "where": [0, 1], "sent": [0, 1], "bool": [0, 1], "whether": [0, 3], "from": [0, 1, 2, 3, 4], "numpi": [0, 1, 2, 3, 4], "int": [0, 1], "maximum": 0, "length": 0, "allow": [0, 2, 4], "50": 0, "000": [0, 4], "charact": 0, "disabl": [0, 4], "all": [0, 1, 2, 3, 4], "see": [0, 1, 4], "note": [0, 1], "1": [0, 1, 4], "block": [0, 1, 2], "while": [0, 1, 2, 4], "try": [0, 1, 2, 4], "list": [0, 1, 2, 4], "comprehens": [0, 2], "augement": [], "assign": 0, "etc": 4, "assert": [0, 1], "del": 1, "rais": [0, 1, 4], "print": [0, 2], "iter": 0, "can": [0, 1, 2, 3, 4], "blacklist": [0, 4], "initi": 0, "set": [0, 1, 2], "equival": 0, "no_": [], "By": [0, 1, 2], "default": [0, 1, 2, 4], "includ": [0, 1, 2, 3, 4], "sever": [0, 1, 4], "builtin": [0, 1, 2, 4], "math": [0, 1, 2], "turn": [0, 4], "off": 0, "argument": [0, 1, 4], "place": 0, "send": 0, "would": [0, 2, 4], "normal": [0, 4], "go": [0, 4], "sy": [0, 1, 4], "stdout": [0, 1], "cours": 0, "similarli": [0, 4], "otherwis": [0, 3], "stderr": 0, "mani": [0, 1, 2, 4], "construct": [0, 2, 4], "advanc": [], "slice": [0, 1, 2, 4], "arrai": [0, 2, 4], "3": [0, 1, 3], "2": [0, 1], "elif": [0, 1], "els": [0, 1, 2], "condit": [0, 2, 3, 4], "loop": [0, 2, 4], "except": [0, 2, 4], "final": [0, 1, 4], "definit": [0, 4], "augment": 0, "x": [0, 1, 4], "test": [0, 3], "b": [0, 1], "out": [0, 3, 4], "sqrt": [0, 1, 4], "valu": [0, 4], "each": [0, 1], "appropri": 0, "no_xxx": [], "To": [0, 4], "calcul": [2, 4], "element": [], "import": [0, 1, 2, 4], "exec": 1, "lambda": [1, 2, 4], "global": [0, 1], "gener": [1, 2, 3, 4], "yield": [1, 2, 4], "decor": 2, "In": [0, 1, 2, 4], "addit": [0, 1, 4], "action": [3, 4], "known": [0, 4], "unsaf": 4, "inspect": [], "get": [], "base": [], "instanc": [0, 1], "method": [1, 2, 3], "most": [0, 1, 4], "them": [0, 4], "implement": [0, 4], "detail": [0, 1], "handl": [0, 1, 4], "particular": [0, 3, 4], "ast": [0, 3, 4], "node": 0, "should": [0, 3, 4], "consid": [0, 4], "part": [0, 2], "usabl": 0, "api": 0, "describ": [0, 4], "low": 0, "exampl": [0, 1, 4], "elsewher": 0, "thi": [0, 1, 2, 3, 4], "document": [0, 3], "stabl": [0, 3], "eval": [0, 1, 2, 4], "lineno": 0, "0": [0, 1, 3, 4], "show_error": 0, "raise_error": 0, "evalu": [0, 1, 4], "return": [0, 1, 2, 4], "result": [0, 1, 2, 4], "string": [0, 2], "line": 0, "number": [0, 1, 2, 4], "messag": [0, 1], "leav": 0, "rerais": [], "__call__": [0, 4], "same": 0, "That": [0, 4], "instead": 0, "A": [2, 3, 4], "kei": 0, "data": [0, 2], "For": [1, 2, 3, 4], "full": [0, 1], "you": [0, 1, 2, 3, 4], "simpli": [2, 4], "access": [0, 2, 4], "insert": 0, "replac": 0, "remov": [0, 4], "alter": 0, "your": [0, 1, 2, 4], "retriev": [], "inform": [0, 4], "fill": 0, "after": [0, 3, 4], "call": [0, 2, 4], "It": [0, 2, 3, 4], "empti": [0, 1], "last": 0, "execut": [0, 1, 4], "wa": [0, 4], "success": 0, "If": [0, 1, 3, 4], "occur": 0, "contain": 0, "error_msg": 0, "recent": [0, 1], "determin": [0, 4], "input": [0, 2, 4], "str": [0, 1], "check": [0, 4], "type": [0, 2], "reserv": [0, 1], "word": [0, 1], "match": [0, 1], "regular": [0, 1], "za": [0, 1], "z_": [0, 1], "z0": [0, 1], "9_": [0, 1], "kw": 0, "symbolt": 0, "take": [0, 4], "pair": 0, "symbol_t": 0, "interperet": 0, "make": [0, 2, 3, 4], "might": [0, 2, 4], "do": [0, 1, 3, 4], "np": 0, "def": [0, 1, 4], "cosd": 0, "co": [0, 1], "angl": 0, "degre": [0, 1], "radian": [0, 1], "sind": 0, "sin": [0, 1], "tand": 0, "tan": [0, 1], "sym": 0, "aeval": [0, 1, 4], "30": [0, 3], "5": [0, 1, 4], "chapter": 1, "give": [0, 1, 2], "quick": 1, "overview": 1, "show": 1, "basic": [0, 1, 2], "usag": 1, "further": 1, "found": [0, 1, 3], "next": 1, "refer": [1, 2, 4], "The": [1, 2, 3, 4], "veri": [1, 2, 4], "easi": [1, 4], "now": 1, "have": [0, 1, 3, 4], "embed": [1, 2, 4], "procedur": [0, 1, 4], "much": [1, 2, 4], "73205080757": 1, "rang": [1, 4], "10": [0, 1, 4], "log": 1, "69314718056": 1, "41421356237": 1, "09861228867": 1, "38629436112": 1, "4": 1, "60943791243": 1, "2360679775": 1, "79175946923": 1, "6": 1, "44948974278": 1, "94591014906": 1, "7": [0, 1, 3], "64575131106": 1, "07944154168": 1, "8": [1, 3, 4], "82842712475": 1, "19722457734": 1, "9": [0, 1, 3, 4], "30258509299": 1, "map": 1, "between": [0, 1], "variabl": [0, 1, 2], "underli": [1, 4], "held": [0, 1, 2], "attribut": [1, 2, 4], "read": [0, 1, 4], "written": [1, 2], "y": [0, 1, 4], "100": [1, 4], "12": [1, 3], "here": 1, "divis": 1, "even": [1, 4], "though": [0, 1, 3], "operand": 1, "integ": 1, "As": [0, 1, 4], "itself": [1, 4], "must": [0, 1], "pattern": 1, "valid_nam": 1, "certain": [1, 4], "cannot": [0, 1, 2, 4], "within": [0, 1, 4], "These": [1, 2], "break": 1, "class": [1, 2, 4], "continu": 1, "pass": [0, 1, 3], "execfil": 1, "__import__": [1, 4], "__package__": 1, "At": [1, 3], "startup": 1, "": [1, 2, 4], "ab": 1, "ani": [1, 3, 4], "bin": 1, "bytearrai": 1, "byte": 1, "chr": 1, "complex": [0, 1, 4], "dir": 1, "divmod": 1, "enumer": 1, "filter": 1, "float": 1, "format": [0, 1], "frozenset": 1, "hash": 1, "hex": 1, "id": 1, "isinst": 1, "len": 1, "max": 1, "min": 1, "oct": 1, "ord": 1, "pow": [1, 4], "repr": 1, "revers": 1, "round": 1, "sort": 1, "sum": 1, "tupl": [0, 1, 2], "zip": 1, "larg": [1, 2, 4], "arithmeticerror": 1, "assertionerror": 1, "attributeerror": 1, "baseexcept": 1, "buffererror": 1, "byteswarn": 1, "deprecationwarn": 1, "eoferror": 1, "environmenterror": 1, "floatingpointerror": 1, "generatorexit": 1, "ioerror": 1, "importerror": 1, "importwarn": 1, "indentationerror": 1, "indexerror": 1, "keyerror": 1, "keyboardinterrupt": 1, "lookuperror": 1, "memoryerror": 1, "nameerror": 1, "notimpl": 1, "notimplementederror": 1, "oserror": 1, "overflowerror": 1, "referenceerror": 1, "runtimeerror": 1, "runtimewarn": 1, "stopiter": 1, "syntaxerror": 1, "syntaxwarn": 1, "systemerror": 1, "systemexit": 1, "typeerror": 1, "unboundlocalerror": 1, "unicodedecodeerror": 1, "unicodeencodeerror": 1, "unicodeerror": 1, "unicodetranslateerror": 1, "unicodewarn": 1, "valueerror": 1, "warn": 1, "zerodivisionerror": 1, "aco": 1, "acosh": 1, "asin": 1, "asinh": 1, "atan": 1, "atan2": 1, "atanh": 1, "ceil": 1, "copysign": 1, "cosh": 1, "e": 1, "exp": 1, "fab": 1, "factori": 1, "floor": 1, "fmod": 1, "frexp": 1, "fsum": 1, "hypot": 1, "isinf": 1, "isnan": 1, "ldexp": 1, "log10": 1, "log1p": 1, "modf": 1, "pi": [0, 1], "sinh": 1, "tanh": 1, "trunc": 1, "400": [], "work": [0, 1, 3, 4], "exactli": [0, 1], "thei": [0, 1, 3], "thu": 1, "114": 1, "049534067": 1, "emul": 1, "nativ": 1, "chang": [1, 3, 4], "when": [0, 1, 4], "supreess": 1, "togeth": 1, "func": 1, "norm": 1, "monitor": 1, "cach": 1, "brief": 1, "so": [1, 3, 4], "kept": [1, 4], "exceptionhold": 1, "through": [0, 1, 3, 4], "get_error": 1, "reset": 1, "begin": [0, 1, 4], "onli": [1, 4], "re": [0, 1, 4], "repl": 1, "d": [0, 1], "want": [1, 4], "someth": [0, 1], "similar": 1, "inp_str": 1, "raw_input": 1, "dsl": 1, "err": 1, "packag": [2, 3], "statement": [0, 2, 4], "safer": [2, 4], "altern": [1, 2], "richer": 2, "easier": [2, 4], "literal_ev": 2, "doe": [2, 4], "build": [0, 2, 3], "interpret": [2, 4], "subset": [2, 4], "emphasi": 2, "main": 2, "area": 2, "applic": [2, 4], "becaus": [2, 4], "function": [2, 4], "built": [2, 4], "instal": 2, "system": [2, 4], "primari": 2, "goal": 2, "subscript": 2, "truli": 2, "structur": 2, "howev": 2, "mean": [0, 2, 4], "attempt": [2, 4], "reproduc": 2, "its": [2, 4], "own": [0, 2], "differ": [0, 2], "miss": [2, 4], "compar": 2, "absenc": 2, "intent": 2, "effort": 2, "version": [0, 2, 4], "some": [0, 2, 3, 4], "due": 2, "reduc": 2, "requir": 2, "mini": 2, "singl": [2, 4], "flat": [0, 2, 4], "namespac": [2, 4], "f": 0, "hint": 2, "getattr": [2, 4], "hasattr": [2, 4], "setattr": [2, 4], "delattr": [2, 4], "privat": 4, "act": [1, 2], "miniatur": 2, "focus": 2, "notic": [2, 3, 4], "limit": [0, 2, 3, 4], "kind": [2, 3], "toi": 2, "program": [0, 2, 4], "introduc": [2, 3], "scientif": [2, 4], "concept": 2, "design": 2, "suppli": 2, "safeti": [2, 4], "against": 2, "malici": [2, 4], "incompet": 2, "concern": [2, 4], "tri": 2, "hard": [2, 4], "possibl": 2, "prevent": [0, 2, 4], "crash": [2, 4], "exploit": [2, 4], "sens": 2, "certainli": [2, 4], "than": [0, 2, 4], "open": [2, 4], "sourc": [2, 3], "project": 2, "volunt": 2, "we": [2, 3, 4], "guarante": [2, 3, 4], "complet": [2, 4], "safe": 2, "attack": [2, 4], "download": 2, "develop": 2, "licens": 2, "motiv": 2, "util": 2, "astev": 3, "pure": 3, "depend": 3, "higher": 3, "outsid": [3, 4], "librari": [3, 4], "importlib_metadata": [], "suit": 3, "pytest": 3, "coverag": 3, "sphinx": 3, "latest": 3, "28": [], "later": 3, "11": 3, "immedi": 3, "plan": 3, "drop": 3, "been": [3, 4], "until": [3, 4], "past": 3, "end": [3, 4], "mainten": [], "period": 3, "secur": [3, 4], "fix": 3, "new": 3, "seri": 3, "too": [0, 2, 3, 4], "releas": 3, "17": [], "pypi": 3, "conda": 3, "abl": [0, 3, 4], "pip": 3, "channel": 3, "forg": 3, "o": [3, 4], "specif": [0, 2, 3, 4], "extens": 3, "prefer": 3, "platform": 3, "environ": 3, "github": 3, "repositori": 3, "clone": 3, "git": 3, "http": [3, 4], "com": [3, 4], "newvil": 3, "distribut": 3, "under": [3, 4], "follow": [0, 3, 4], "mit": [3, 4], "copyright": 3, "c": [0, 3, 4], "2021": [], "matthew": 3, "univers": 3, "chicago": 3, "permiss": [3, 4], "herebi": 3, "grant": 3, "free": 3, "charg": 3, "person": 3, "obtain": 3, "copi": 3, "softwar": 3, "associ": 3, "without": [3, 4], "right": 3, "modifi": 3, "merg": 3, "publish": 3, "sublicens": 3, "sell": 3, "permit": 3, "whom": 3, "furnish": 3, "subject": 3, "abov": [0, 3, 4], "shall": 3, "substanti": 3, "portion": 3, "THE": 3, "AS": 3, "warranti": 3, "OF": 3, "OR": 3, "impli": 3, "BUT": 3, "NOT": 3, "TO": 3, "merchant": 3, "fit": 3, "FOR": 3, "purpos": 3, "AND": 3, "noninfring": 3, "IN": 3, "NO": 3, "event": 3, "author": 3, "holder": 3, "BE": 3, "liabl": 3, "claim": [3, 4], "damag": 3, "other": [3, 4], "liabil": 3, "contract": 3, "tort": 3, "aris": 3, "connect": 3, "WITH": 3, "effect": 4, "forbid": 4, "fair": 4, "question": 4, "why": 4, "desir": 4, "just": [1, 4], "short": 4, "answer": 4, "sometim": 4, "expos": 4, "insid": [0, 4], "larger": 4, "scari": 4, "difficult": [0, 4], "trust": 4, "sinc": 4, "those": [0, 4], "idea": 4, "orient": 4, "fact": 4, "grew": 4, "need": [0, 3, 4], "lmfit": 4, "xraylarch": 4, "earli": 4, "pypars": 4, "prone": 4, "maintain": 4, "simplest": 4, "expressiona": 4, "rich": 4, "keyword": [0, 4], "approach": 4, "meant": 4, "ad": 4, "more": [0, 2, 4], "fairli": 4, "benefit": 4, "whole": 4, "categori": 4, "involv": 4, "pars": 4, "lex": 4, "grammar": 4, "disappear": 4, "correctli": 4, "convert": 4, "abstract": 4, "tree": 4, "furthermor": 4, "walk": 4, "greatli": 4, "process": 4, "start": [3, 4], "quit": [0, 4], "useabl": 4, "domain": [0, 4], "about": 4, "speed": 4, "slower": 4, "often": 4, "4x": 4, "said": 4, "case": [0, 4], "stackoverflow": 4, "34106484": 4, "numexpr": 4, "avoid": 4, "know": [0, 4], "danger": 4, "realli": 4, "comment": 4, "link": 4, "therein": 4, "discuss": [0, 4], "appar": 4, "prospect": 4, "perfectli": [0, 4], "caus": 4, "segment": 4, "fault": 4, "explicitli": 4, "oper": [0, 4], "find": [0, 4], "thing": 4, "reason": [2, 4], "neither": 4, "nor": 4, "__": 4, "dunder": 4, "__globals__": 4, "__code__": 4, "__func__": 4, "__self__": 4, "__module__": 4, "__dict__": 4, "__class__": 4, "__getattribute__": 4, "func_glob": 4, "func_cod": 4, "func_closur": 4, "im_class": 4, "im_func": 4, "im_self": 4, "gi_cod": 4, "gi_fram": 4, "f_local": 4, "elimin": 4, "entir": 4, "seg": 4, "typic": 4, "ufunc": 4, "troubl": 4, "paranoid": 4, "never": 4, "address": 4, "resourc": 4, "hog": 4, "denial": 4, "servic": 4, "timeout": 4, "look": [0, 4], "txt": 4, "nmax": 4, "1e8": 4, "arang": 4, "amount": 4, "cpu": 4, "time": [3, 4], "come": 4, "up": [0, 4], "run": 4, "hundr": 4, "year": 4, "probabl": 4, "exce": 4, "anyon": 4, "threshold": 4, "accept": 4, "good": 4, "wai": [3, 4], "predict": 4, "long": [3, 4], "text": 4, "z": 4, "well": [3, 4], "001": 4, "second": 4, "still": [2, 4], "sec": 4, "With": [0, 4], "hour": 4, "machin": 4, "runtim": 4, "lexic": 4, "doubl": [], "exponenti": 4, "demonstr": 4, "stuck": 4, "doubt": 4, "thread": 4, "done": [3, 4], "foolproof": [], "tell": 4, "taken": 4, "reliabl": 4, "watch": 4, "interrupt": 4, "kill": 4, "problem": 4, "recurs": 4, "contextlib": 4, "contextmanag": 4, "limited_recurs": 4, "recursion_limit": 4, "old_limit": 4, "getrecursionlimit": 4, "setrecursionlimit": 4, "disk": 4, "untrust": 4, "loadtxt": 4, "doesn": [], "t": 0, "elev": 4, "privileg": 4, "ensur": 4, "summari": 4, "could": 4, "un": [], "recommend": 4, "improv": 4, "situat": 4, "appreci": 4, "post6": [], "29": [], "automat": [0, 3], "gaurante": [], "offici": 3, "late": 3, "beta": 3, "histor": [0, 3], "delai": 3, "newli": 3, "interest": [], "either": [0, 4], "config": 0, "dictionai": 0, "importfrom": 0, "functiondef": 0, "ifexp": 0, "listcomp": 0, "dictcomp": 0, "setcomp": 0, "augassign": 0, "delet": 0, "enabl": [0, 2, 4], "post8": [], "post28": [], "comphrens": [], "thees": [], "with_import": 0, "with_importfrom": 0, "async": [1, 2], "programm": 1, "current": 1, "unless": [2, 4], "await": [1, 2], "someon": 2, "familiar": 2, "expect": [0, 2], "caveat": 4, "extra": 4, "care": 4, "clear": 4, "expon": 4, "But": 4, "clever": 4, "readili": 4, "secondari": 4, "lead": 4, "increas": 4, "risk": 4, "overwrit": 0, "entri": 0, "arg": [], "binop": [], "boolop": [], "constant": [], "ellipsi": [], "excepthandl": [], "expr": [], "extslic": [], "index": [], "nameconst": [], "num": [], "unaryop": [], "formattedvalu": 0, "joinedstr": [], "accord": 0, "bare": 0, "bone": 0, "mathemet": [], "descript": 0, "ref": [], "node_t": [], "_": [], "individu": 0, "no_nod": 0, "with_nod": 0, "aeval_al": [], "aeval_nowhil": 0, "aveal_noblock": 0, "aeval_min": 0, "shown": 0, "post30": [], "longer": 3, "june": [], "2023": 3, "beta2": [], "post36": [], "exclud": 0, "happen": [0, 4], "detect": 4, "befor": 4, "challeng": 4, "backward": 2, "compat": 2, "were": 2, "move": 2, "numpy_financi": [2, 3], "post3": [], "nested_symt": 0, "style": [], "nest": 0, "plain": 0, "top": 0, "level": [0, 4], "post7": [], "elabor": 2, "experiment": 2, "both": 2, "attribrut": [], "9e13": 4, "almost": 4, "anoth": 4, "And": 4, "size": 4, "countless": 4, "li": 4, "configur": 2, "recogn": 2, "aeval_max": 0, "store": 0, "subclass": 0, "atti": [], "user_symbol": 0, "hold": 0, "correspond": 0, "slightli": 0, "simpler": 0, "roughli": 0, "everyth": 0, "being": 0, "manipul": 0, "1622776601683795": 0, "writeabl": 0, "fulli": 0, "40": [], "group": 0, "identifi": 0, "special": 0, "member": [], "_searchgroup": 0, "sub": 0, "search": 0, "subgroup": 0, "350": [0, 1], "old": 0, "brows": 0, "first": 0, "order": 0, "soon": 0, "lookup": 0, "alreadi": 0, "isn": 0, "littl": 0, "local": 0, "frame": 0, "mostli": 0, "31": [0, 3], "had": 0, "autom": 0, "nonloc": 1, "post21": [], "window": 3, "maco": 3, "linux": 3, "juli": 3, "beta4": 3, "suggest": 3}, "objects": {"": [[0, 0, 0, "-", "asteval"]], "asteval": [[0, 1, 1, "", "Interpreter"], [0, 2, 1, "", "__call__"], [0, 3, 1, "", "error"], [0, 3, 1, "", "error_msg"], [0, 2, 1, "", "eval"], [0, 4, 1, "", "make_symbol_table"], [0, 3, 1, "", "symtable"], [0, 4, 1, "", "valid_symbol_name"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:attribute", "4": "py:function"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "attribute", "Python attribute"], "4": ["py", "function", "Python function"]}, "titleterms": {"astev": [0, 1, 2, 4], "refer": 0, "The": 0, "interpret": [0, 1], "class": 0, "util": 0, "function": [0, 1], "us": [0, 1], "creat": 1, "an": 1, "access": 1, "symbol": [0, 1], "tabl": [0, 1], "built": 1, "condit": 1, "loop": 1, "print": 1, "write": 1, "except": 1, "minim": 2, "python": 2, "ast": 2, "evalu": 2, "download": 3, "instal": 3, "requir": 3, "develop": 3, "version": 3, "licens": 3, "motiv": 4, "how": 4, "safe": 4, "i": 4, "comprehens": 1, "configur": 0, "what": [], "featur": 0, "support": [], "method": 0, "which": 0, "attribut": 0, "recogn": 0, "new": 0, "style": 0}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 8, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.todo": 2, "sphinx.ext.intersphinx": 1, "sphinx": 57}, "alltitles": {"asteval reference": [[0, "asteval-reference"]], "The Interpreter class": [[0, "the-interpreter-class"]], "Configuring which features the Interpreter recognizes": [[0, "configuring-which-features-the-interpreter-recognizes"]], "Interpreter methods and attributes": [[0, "interpreter-methods-and-attributes"]], "Symbol Tables used in asteval": [[0, "symbol-tables-used-in-asteval"]], "New Style Symbol Table": [[0, "new-style-symbol-table"]], "Utility Functions": [[0, "utility-functions"]], "Using asteval": [[1, "using-asteval"]], "creating and using an asteval Interpreter": [[1, "creating-and-using-an-asteval-interpreter"]], "accessing the symbol table": [[1, "accessing-the-symbol-table"]], "built-in functions": [[1, "built-in-functions"]], "conditionals and loops": [[1, "conditionals-and-loops"]], "comprehensions": [[1, "comprehensions"]], "printing": [[1, "printing"]], "writing functions": [[1, "writing-functions"]], "exceptions": [[1, "exceptions"]], "ASTEVAL: Minimal Python AST Evaluator": [[2, "asteval-minimal-python-ast-evaluator"]], "Downloading and Installation": [[3, "downloading-and-installation"]], "Requirements": [[3, "requirements"]], "Download and Installation": [[3, "download-and-installation"]], "Development Version": [[3, "development-version"]], "Installation": [[3, "installation"]], "License": [[3, "license"]], "Motivation for asteval": [[4, "motivation-for-asteval"]], "How Safe is asteval?": [[4, "how-safe-is-asteval"]]}, "indexentries": {"interpreter (class in asteval)": [[0, "asteval.Interpreter"]], "__call__() (in module asteval)": [[0, "asteval.__call__"]], "asteval": [[0, "module-asteval"]], "error (in module asteval)": [[0, "asteval.error"]], "error_msg (in module asteval)": [[0, "asteval.error_msg"]], "eval() (in module asteval)": [[0, "asteval.eval"]], "make_symbol_table() (in module asteval)": [[0, "asteval.make_symbol_table"]], "module": [[0, "module-asteval"]], "symtable (in module asteval)": [[0, "asteval.symtable"]], "valid_symbol_name() (in module asteval)": [[0, "asteval.valid_symbol_name"]]}}) \ No newline at end of file +Search.setIndex({"docnames": ["api", "basics", "index", "installation", "motivation"], "filenames": ["api.rst", "basics.rst", "index.rst", "installation.rst", "motivation.rst"], "titles": ["asteval reference", "Using asteval", "ASTEVAL: Minimal Python AST Evaluator", "Downloading and Installation", "Motivation for asteval"], "terms": {"modul": [0, 1, 2, 3, 4], "ha": [0, 3, 4], "pretti": [0, 4], "simpl": [0, 1, 2, 4], "interfac": 0, "provid": [0, 2, 3, 4], "an": [0, 2, 3, 4], "creat": [0, 2, 4], "express": [0, 1, 2, 3, 4], "code": [0, 1, 3, 4], "There": [0, 2, 4], "ar": [0, 1, 2, 3, 4], "few": [0, 2], "option": [0, 1], "avail": [0, 1, 2, 3], "control": 0, "what": [0, 2, 4], "languag": [0, 1, 2, 3, 4], "support": [0, 1, 2, 3, 4], "how": [0, 2], "deal": [0, 3], "write": [0, 2, 3], "standard": [0, 1, 2, 3], "output": [0, 1], "error": [0, 1, 4], "specifi": [0, 4], "also": [0, 1, 2, 3, 4], "conveni": 0, "valid_symbol_nam": 0, "i": [0, 1, 2, 3], "test": [0, 3], "valid": [0, 1, 4], "name": [0, 1, 2], "make_symbol_t": 0, "mai": [0, 3, 4], "pre": 0, "load": [0, 1, 4], "custom": 0, "symtabl": [0, 1], "none": [0, 1, 4], "nested_symt": 0, "fals": [0, 1], "user_symbol": 0, "writer": [0, 1], "err_writ": 0, "use_numpi": 0, "true": [0, 1], "max_statement_length": 0, "50000": 0, "minim": 0, "readonly_symbol": 0, "builtins_readonli": 0, "config": 0, "kw": 0, "restrict": [0, 2, 3, 4], "simplifi": [0, 4], "mathemat": [0, 1, 2, 4], "python": [0, 1, 3, 4], "syntax": [0, 4], "paramet": 0, "dict": [0, 1], "dictionari": [0, 1, 2, 4], "symbolt": 0, "one": 0, "bool": [0, 1], "whether": [0, 3], "nest": 0, "instead": 0, "plain": 0, "user": [0, 1, 2, 4], "defin": [0, 1, 2, 4], "add": 0, "file": [0, 3, 4], "like": [0, 1, 2, 4], "callabl": 0, "object": [0, 1, 2, 4], "where": [0, 1], "sent": [0, 1], "from": [0, 1, 2, 3, 4], "numpi": [0, 1, 2, 3, 4], "int": [0, 1], "maximum": 0, "length": 0, "allow": [0, 2, 4], "50": 0, "000": [0, 4], "charact": 0, "iter": 0, "can": [0, 1, 2, 3, 4], "assign": 0, "blacklist": [0, 4], "all": [0, 1, 2, 3, 4], "initi": 0, "disabl": [0, 4], "mani": [0, 1, 2, 4], "node": 0, "see": [0, 1, 4], "note": [0, 1], "1": [0, 1, 4], "dictionai": 0, "list": [0, 1, 2, 4], "2": [0, 1], "set": [0, 1, 2], "equival": 0, "follow": [0, 3, 4], "import": [0, 1, 2, 4], "importfrom": 0, "while": [0, 1, 2, 4], "try": [0, 1, 2, 4], "functiondef": 0, "ifexp": 0, "listcomp": 0, "dictcomp": 0, "setcomp": 0, "augassign": 0, "assert": [0, 1], "delet": 0, "rais": [0, 1, 4], "print": [0, 2], "default": [0, 1, 2, 4], "though": [0, 1, 3], "thei": [0, 1, 3], "enabl": [0, 2, 4], "By": [0, 1, 2], "includ": [0, 1, 2, 3, 4], "sever": [0, 1, 4], "builtin": [0, 1, 2, 4], "math": [0, 1, 2], "turn": [0, 4], "off": 0, "argument": [0, 1, 4], "place": 0, "send": 0, "would": [0, 2, 4], "normal": [0, 4], "go": [0, 4], "sy": [0, 1, 4], "stdout": [0, 1], "cours": 0, "similarli": [0, 4], "otherwis": [0, 3], "stderr": 0, "abl": [0, 3, 4], "overwrit": 0, "entri": 0, "keyword": [0, 4], "construct": [0, 2, 4], "accord": 0, "ast": [0, 4], "definit": [0, 4], "exclud": 0, "give": [0, 1, 2], "bare": 0, "bone": 0, "full": [0, 1], "data": [0, 2], "type": [0, 2], "arrai": [0, 2, 4], "slice": [0, 1, 2, 4], "descript": 0, "statement": [0, 2, 4], "x": [0, 1, 4], "y": [0, 1, 4], "block": [0, 1, 2], "b": [0, 1], "c": [0, 3, 4], "els": [0, 1, 2], "d": [0, 1], "loop": [0, 2, 4], "formattedvalu": 0, "f": 0, "string": [0, 2], "comprehens": [0, 2], "except": [0, 2, 4], "basic": [0, 1, 2], "oper": [0, 4], "elif": [0, 1], "condit": [0, 2, 3, 4], "final": [0, 1, 4], "augment": 0, "out": [0, 3, 4], "sqrt": [0, 1, 4], "valu": [0, 4], "too": [0, 2, 3, 4], "format": [0, 1], "str": [0, 1], "individu": 0, "appropri": 0, "no_nod": 0, "with_nod": 0, "when": [0, 1, 4], "That": [0, 4], "you": [0, 1, 2, 3, 4], "might": [0, 2, 4], "aeval_nowhil": 0, "no_whil": 0, "aveal_noblock": 0, "pass": [0, 1], "aeval_min": 0, "As": [0, 1, 4], "shown": 0, "abov": [0, 3, 4], "To": [0, 4], "with_import": 0, "with_importfrom": 0, "aeval_max": 0, "describ": [0, 4], "instanc": [0, 1], "most": [0, 1, 4], "them": [0, 4], "implement": [0, 4], "detail": [0, 1], "handl": [0, 1, 4], "particular": [0, 3, 4], "should": [0, 3, 4], "consid": [0, 4], "part": [0, 2], "usabl": 0, "api": 0, "low": 0, "exampl": [0, 1, 4], "elsewher": 0, "thi": [0, 1, 2, 3, 4], "document": [0, 3], "stabl": [0, 3], "eval": [0, 1, 2, 4], "lineno": 0, "0": [0, 1, 3, 4], "show_error": 0, "raise_error": 0, "evalu": [0, 1, 4], "return": [0, 1, 2, 4], "result": [0, 1, 2, 4], "line": 0, "number": [0, 1, 2, 4], "messag": [0, 1], "leav": 0, "re": [0, 1, 4], "__call__": [0, 4], "same": 0, "store": 0, "look": [0, 4], "up": [0, 4], "kei": 0, "If": [0, 1, 3, 4], "subclass": 0, "more": [0, 2, 4], "discuss": [0, 4], "In": [0, 1, 2, 4], "either": [0, 4], "case": [0, 4], "access": [0, 2, 4], "call": [0, 2, 4], "program": [0, 2, 4], "read": [0, 1, 4], "insert": 0, "replac": 0, "remov": [0, 4], "alter": 0, "known": [0, 4], "your": [0, 1, 2, 4], "inform": [0, 4], "fill": 0, "after": [0, 3, 4], "each": [0, 1], "It": [0, 2, 3, 4], "empti": [0, 1], "last": 0, "execut": [0, 1, 4], "wa": [0, 4], "success": 0, "occur": 0, "contain": 0, "error_msg": 0, "recent": [0, 1], "hold": 0, "co": [0, 1], "pi": [0, 1], "3": [0, 1, 3], "need": [0, 4], "lookup": 0, "alreadi": 0, "know": [0, 4], "mean": [0, 2, 4], "those": [0, 4], "variabl": [0, 1, 2], "histor": [0, 3], "correspond": 0, "slightli": 0, "simpler": 0, "than": [0, 2, 4], "roughli": 0, "everyth": 0, "being": 0, "global": [0, 1], "isn": 0, "t": 0, "exactli": [0, 1], "happen": [0, 4], "insid": [0, 4], "procedur": [0, 1, 4], "littl": 0, "differ": [0, 2], "special": 0, "local": 0, "frame": 0, "mostli": 0, "limit": [0, 2, 3, 4], "must": [0, 1], "match": [0, 1], "za": [0, 1], "z_": [0, 1], "z0": [0, 1], "9_": [0, 1], "reserv": [0, 1], "word": [0, 1], "held": [0, 1, 2], "manipul": 0, "perfectli": [0, 4], "do": [0, 1, 3, 4], "someth": [0, 1], "aeval": [0, 1, 4], "10": [0, 1, 4], "1622776601683795": 0, "some": [0, 2, 3, 4], "build": [0, 2, 3], "own": [0, 2], "prevent": [0, 2, 4], "writeabl": 0, "within": [0, 1, 4], "fulli": 0, "version": [0, 2, 4], "9": [0, 1, 3, 4], "31": [0, 3], "begin": [0, 1, 4], "complex": [0, 1, 4], "group": 0, "7": [0, 1, 3], "identifi": 0, "cannot": [0, 1, 2, 4], "addit": [0, 1, 4], "flat": [0, 2, 4], "have": [0, 1, 3, 4], "_searchgroup": 0, "sub": 0, "search": 0, "subgroup": 0, "350": [0, 1], "tupl": [0, 1, 2], "find": [0, 4], "With": [0, 4], "old": 0, "make": [0, 2, 3, 4], "difficult": [0, 4], "brows": 0, "through": [0, 1, 3, 4], "first": 0, "top": 0, "level": [0, 4], "found": [0, 1, 3], "order": 0, "soon": 0, "expect": [0, 2], "had": 0, "automat": [0, 3], "between": [0, 1], "work": [0, 1, 4], "domain": [0, 4], "specif": [0, 2, 3, 4], "autom": 0, "quit": [0, 4], "determin": [0, 4], "input": [0, 2, 4], "check": [0, 4], "regular": [0, 1], "take": [0, 4], "pair": 0, "symbol_t": 0, "interperet": 0, "np": 0, "def": [0, 1, 4], "cosd": 0, "angl": 0, "degre": [0, 1], "radian": [0, 1], "sind": 0, "sin": [0, 1], "tand": 0, "tan": [0, 1], "sym": 0, "30": [0, 3], "5": [0, 1, 4], "chapter": 1, "quick": 1, "overview": 1, "show": 1, "usag": 1, "featur": [1, 2, 3, 4], "further": 1, "next": 1, "refer": [1, 2, 4], "The": [1, 2, 3, 4], "veri": [1, 2, 4], "easi": [1, 4], "now": 1, "embed": [1, 2, 4], "much": [1, 2, 4], "73205080757": 1, "rang": [1, 4], "log": 1, "69314718056": 1, "41421356237": 1, "09861228867": 1, "38629436112": 1, "4": 1, "60943791243": 1, "2360679775": 1, "79175946923": 1, "6": 1, "44948974278": 1, "94591014906": 1, "64575131106": 1, "07944154168": 1, "8": [1, 3, 4], "82842712475": 1, "19722457734": 1, "30258509299": 1, "map": 1, "underli": [1, 4], "altern": [1, 2], "attribut": [1, 2, 4], "written": [1, 2], "100": [1, 4], "12": [1, 3], "here": 1, "divis": 1, "even": [1, 4], "operand": 1, "integ": 1, "itself": [1, 4], "pattern": 1, "valid_nam": 1, "certain": [1, 4], "These": [1, 2], "async": [1, 2], "await": [1, 2], "break": 1, "class": [1, 2, 4], "continu": 1, "del": 1, "exec": 1, "execfil": 1, "lambda": [1, 2, 4], "nonloc": 1, "__import__": [1, 4], "__package__": 1, "At": [1, 3], "startup": 1, "": [1, 2, 4], "ab": 1, "ani": [1, 3, 4], "bin": 1, "bytearrai": 1, "byte": 1, "chr": 1, "dir": 1, "divmod": 1, "enumer": 1, "filter": 1, "float": 1, "frozenset": 1, "hash": 1, "hex": 1, "id": 1, "isinst": 1, "len": 1, "max": 1, "min": 1, "oct": 1, "ord": 1, "pow": [1, 4], "repr": 1, "revers": 1, "round": 1, "sort": 1, "sum": 1, "zip": 1, "larg": [1, 2, 4], "arithmeticerror": 1, "assertionerror": 1, "attributeerror": 1, "baseexcept": 1, "buffererror": 1, "byteswarn": 1, "deprecationwarn": 1, "eoferror": 1, "environmenterror": 1, "floatingpointerror": 1, "generatorexit": 1, "ioerror": 1, "importerror": 1, "importwarn": 1, "indentationerror": 1, "indexerror": 1, "keyerror": 1, "keyboardinterrupt": 1, "lookuperror": 1, "memoryerror": 1, "nameerror": 1, "notimpl": 1, "notimplementederror": 1, "oserror": 1, "overflowerror": 1, "referenceerror": 1, "runtimeerror": 1, "runtimewarn": 1, "stopiter": 1, "syntaxerror": 1, "syntaxwarn": 1, "systemerror": 1, "systemexit": 1, "typeerror": 1, "unboundlocalerror": 1, "unicodedecodeerror": 1, "unicodeencodeerror": 1, "unicodeerror": 1, "unicodetranslateerror": 1, "unicodewarn": 1, "valueerror": 1, "warn": 1, "zerodivisionerror": 1, "aco": 1, "acosh": 1, "asin": 1, "asinh": 1, "atan": 1, "atan2": 1, "atanh": 1, "ceil": 1, "copysign": 1, "cosh": 1, "e": 1, "exp": 1, "fab": 1, "factori": 1, "floor": 1, "fmod": 1, "frexp": 1, "fsum": 1, "hypot": 1, "isinf": 1, "isnan": 1, "ldexp": 1, "log10": 1, "log1p": 1, "modf": 1, "sinh": 1, "tanh": 1, "trunc": 1, "thu": 1, "114": 1, "049534067": 1, "act": [1, 2], "just": [1, 4], "gener": [1, 2, 3, 4], "yield": [1, 2, 4], "programm": 1, "current": 1, "For": [1, 2, 3, 4], "emul": 1, "nativ": 1, "chang": [1, 4], "supreess": 1, "togeth": 1, "no_print": 1, "func": 1, "norm": 1, "monitor": 1, "cach": 1, "brief": 1, "so": [1, 3, 4], "kept": [1, 4], "exceptionhold": 1, "which": [1, 2, 4], "get_error": 1, "method": [1, 2, 3], "reset": 1, "onli": [1, 4], "repl": 1, "want": [1, 4], "similar": 1, "inp_str": 1, "raw_input": 1, "dsl": 1, "err": 1, "packag": [2, 3], "safer": [2, 4], "richer": 2, "easier": [2, 4], "us": [2, 3, 4], "literal_ev": 2, "doe": [2, 4], "interpret": [2, 4], "subset": [2, 4], "emphasi": 2, "main": 2, "area": 2, "applic": [2, 4], "becaus": [2, 4], "function": [2, 4], "built": [2, 4], "instal": 2, "system": [2, 4], "backward": 2, "compat": 2, "were": 2, "move": 2, "numpy_financi": [2, 3], "primari": 2, "goal": 2, "subscript": 2, "truli": 2, "structur": 2, "howev": 2, "attempt": [2, 4], "reproduc": 2, "its": [2, 4], "miss": [2, 4], "compar": 2, "absenc": 2, "intent": 2, "effort": 2, "simpli": [2, 4], "due": 2, "reduc": 2, "requir": 2, "mini": 2, "symbol": [2, 4], "singl": [2, 4], "tabl": [2, 4], "namespac": [2, 4], "A": [2, 3, 4], "elabor": 2, "still": [2, 4], "experiment": 2, "both": 2, "unless": [2, 4], "decor": 2, "hint": 2, "getattr": [2, 4], "hasattr": [2, 4], "setattr": [2, 4], "delattr": [2, 4], "miniatur": 2, "focus": 2, "calcul": [2, 4], "notic": [2, 3, 4], "kind": [2, 3], "toi": 2, "introduc": [2, 3], "scientif": [2, 4], "concept": 2, "reason": [2, 4], "complet": [2, 4], "someon": 2, "familiar": 2, "design": 2, "suppli": 2, "safeti": [2, 4], "against": 2, "malici": [2, 4], "incompet": 2, "concern": [2, 4], "tri": 2, "hard": [2, 4], "possibl": 2, "crash": [2, 4], "exploit": [2, 4], "sens": 2, "certainli": [2, 4], "open": [2, 4], "sourc": [2, 3], "project": 2, "volunt": 2, "we": [2, 3, 4], "guarante": [2, 3, 4], "safe": 2, "attack": [2, 4], "download": 2, "develop": 2, "licens": 2, "motiv": 2, "configur": 2, "recogn": 2, "util": 2, "astev": 3, "pure": 3, "higher": 3, "depend": 3, "outsid": [3, 4], "librari": [3, 4], "suit": 3, "pytest": 3, "coverag": 3, "sphinx": 3, "latest": 3, "later": 3, "11": 3, "window": 3, "maco": 3, "linux": 3, "without": [3, 4], "been": [3, 4], "until": [3, 4], "well": [3, 4], "past": 3, "end": [3, 4], "secur": [3, 4], "fix": 3, "immedi": 3, "plan": 3, "drop": 3, "longer": 3, "new": 3, "seri": 3, "time": [3, 4], "offici": 3, "releas": 3, "start": [3, 4], "late": 3, "beta": 3, "period": 3, "delai": 3, "long": [3, 4], "newli": 3, "32": 3, "march": 3, "2024": 3, "done": [3, 4], "pypi": 3, "conda": 3, "pip": 3, "channel": 3, "forg": 3, "o": [3, 4], "extens": 3, "prefer": 3, "platform": 3, "environ": 3, "github": 3, "repositori": 3, "clone": 3, "git": 3, "http": [3, 4], "com": [3, 4], "lmfit": [3, 4], "distribut": 3, "under": [3, 4], "mit": [3, 4], "copyright": 3, "2023": 3, "matthew": 3, "newvil": 3, "univers": 3, "chicago": 3, "permiss": [3, 4], "herebi": 3, "grant": 3, "free": 3, "charg": 3, "person": 3, "obtain": 3, "copi": 3, "softwar": 3, "associ": 3, "right": 3, "modifi": 3, "merg": 3, "publish": 3, "sublicens": 3, "sell": 3, "permit": 3, "whom": 3, "furnish": 3, "subject": 3, "shall": 3, "substanti": 3, "portion": 3, "THE": 3, "AS": 3, "warranti": 3, "OF": 3, "OR": 3, "impli": 3, "BUT": 3, "NOT": 3, "TO": 3, "merchant": 3, "fit": 3, "FOR": 3, "purpos": 3, "AND": 3, "noninfring": 3, "IN": 3, "NO": 3, "event": 3, "author": 3, "holder": 3, "BE": 3, "liabl": 3, "claim": [3, 4], "damag": 3, "other": [3, 4], "liabil": 3, "action": [3, 4], "contract": 3, "tort": 3, "aris": 3, "connect": 3, "WITH": 3, "effect": 4, "forbid": 4, "fair": 4, "question": 4, "why": 4, "desir": 4, "short": 4, "answer": 4, "sometim": 4, "expos": 4, "larger": 4, "scari": 4, "trust": 4, "sinc": 4, "explicitli": 4, "idea": 4, "orient": 4, "fact": 4, "grew": 4, "xraylarch": 4, "earli": 4, "pypars": 4, "prone": 4, "maintain": 4, "simplest": 4, "expressiona": 4, "rich": 4, "etc": 4, "approach": 4, "meant": 4, "ad": 4, "fairli": 4, "benefit": 4, "whole": 4, "categori": 4, "involv": 4, "pars": 4, "lex": 4, "grammar": 4, "disappear": 4, "correctli": 4, "convert": 4, "abstract": 4, "tree": 4, "furthermor": 4, "walk": 4, "greatli": 4, "process": 4, "useabl": 4, "about": 4, "speed": 4, "slower": 4, "often": 4, "4x": 4, "said": 4, "stackoverflow": 4, "34106484": 4, "numexpr": 4, "avoid": 4, "danger": 4, "realli": 4, "comment": 4, "link": 4, "therein": 4, "appar": 4, "unsaf": 4, "prospect": 4, "caus": 4, "segment": 4, "fault": 4, "thing": 4, "neither": 4, "nor": 4, "__": 4, "dunder": 4, "__globals__": 4, "__code__": 4, "__func__": 4, "__self__": 4, "__module__": 4, "__dict__": 4, "__class__": 4, "__getattribute__": 4, "func_glob": 4, "func_cod": 4, "func_closur": 4, "im_class": 4, "im_func": 4, "im_self": 4, "gi_cod": 4, "gi_fram": 4, "f_local": 4, "elimin": 4, "entir": 4, "seg": 4, "caveat": 4, "typic": 4, "ufunc": 4, "troubl": 4, "paranoid": 4, "never": 4, "extra": 4, "care": 4, "address": 4, "resourc": 4, "hog": 4, "denial": 4, "servic": 4, "timeout": 4, "txt": 4, "nmax": 4, "1e8": 4, "arang": 4, "amount": 4, "cpu": 4, "9e13": 4, "almost": 4, "anoth": 4, "z": 4, "run": 4, "001": 4, "second": 4, "sec": 4, "hour": 4, "machin": 4, "come": 4, "hundr": 4, "year": 4, "probabl": 4, "exce": 4, "anyon": 4, "threshold": 4, "accept": 4, "good": 4, "wai": 4, "predict": 4, "text": 4, "lexic": 4, "clear": 4, "exponenti": 4, "runtim": 4, "tell": 4, "expon": 4, "But": 4, "And": 4, "size": 4, "countless": 4, "clever": 4, "readili": 4, "demonstr": 4, "stuck": 4, "doubt": 4, "thread": 4, "reliabl": 4, "taken": 4, "detect": 4, "befor": 4, "challeng": 4, "li": 4, "watch": 4, "interrupt": 4, "kill": 4, "problem": 4, "recurs": 4, "contextlib": 4, "contextmanag": 4, "limited_recurs": 4, "recursion_limit": 4, "old_limit": 4, "getrecursionlimit": 4, "setrecursionlimit": 4, "secondari": 4, "disk": 4, "untrust": 4, "loadtxt": 4, "elev": 4, "privileg": 4, "ensur": 4, "privat": 4, "summari": 4, "could": 4, "lead": 4, "increas": 4, "risk": 4, "recommend": 4, "improv": 4, "situat": 4, "appreci": 4}, "objects": {"": [[0, 0, 0, "-", "asteval"]], "asteval": [[0, 1, 1, "", "Interpreter"], [0, 2, 1, "", "__call__"], [0, 3, 1, "", "error"], [0, 3, 1, "", "error_msg"], [0, 2, 1, "", "eval"], [0, 4, 1, "", "make_symbol_table"], [0, 3, 1, "", "symtable"], [0, 4, 1, "", "valid_symbol_name"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:attribute", "4": "py:function"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "attribute", "Python attribute"], "4": ["py", "function", "Python function"]}, "titleterms": {"astev": [0, 1, 2, 4], "refer": 0, "The": 0, "interpret": [0, 1], "class": 0, "configur": 0, "which": 0, "featur": 0, "recogn": 0, "method": 0, "attribut": 0, "symbol": [0, 1], "tabl": [0, 1], "us": [0, 1], "new": 0, "style": 0, "util": 0, "function": [0, 1], "creat": 1, "an": 1, "access": 1, "built": 1, "condit": 1, "loop": 1, "comprehens": 1, "print": 1, "write": 1, "except": 1, "minim": 2, "python": 2, "ast": 2, "evalu": 2, "download": 3, "instal": 3, "requir": 3, "develop": 3, "version": 3, "licens": 3, "motiv": 4, "how": 4, "safe": 4, "i": 4}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.todo": 2, "sphinx.ext.intersphinx": 1, "sphinx": 60}, "alltitles": {"asteval reference": [[0, "asteval-reference"]], "The Interpreter class": [[0, "the-interpreter-class"]], "Configuring which features the Interpreter recognizes": [[0, "configuring-which-features-the-interpreter-recognizes"]], "Interpreter methods and attributes": [[0, "interpreter-methods-and-attributes"]], "Symbol Tables used in asteval": [[0, "symbol-tables-used-in-asteval"]], "New Style Symbol Table": [[0, "new-style-symbol-table"]], "Utility Functions": [[0, "utility-functions"]], "Using asteval": [[1, "using-asteval"]], "creating and using an asteval Interpreter": [[1, "creating-and-using-an-asteval-interpreter"]], "accessing the symbol table": [[1, "accessing-the-symbol-table"]], "built-in functions": [[1, "built-in-functions"]], "conditionals and loops": [[1, "conditionals-and-loops"]], "comprehensions": [[1, "comprehensions"]], "printing": [[1, "printing"]], "writing functions": [[1, "writing-functions"]], "exceptions": [[1, "exceptions"]], "ASTEVAL: Minimal Python AST Evaluator": [[2, "asteval-minimal-python-ast-evaluator"]], "Downloading and Installation": [[3, "downloading-and-installation"]], "Requirements": [[3, "requirements"]], "Download and Installation": [[3, "download-and-installation"]], "Development Version": [[3, "development-version"]], "Installation": [[3, "installation"]], "License": [[3, "license"]], "Motivation for asteval": [[4, "motivation-for-asteval"]], "How Safe is asteval?": [[4, "how-safe-is-asteval"]]}, "indexentries": {"interpreter (class in asteval)": [[0, "asteval.Interpreter"]], "__call__() (in module asteval)": [[0, "asteval.__call__"]], "asteval": [[0, "module-asteval"]], "error (in module asteval)": [[0, "asteval.error"]], "error_msg (in module asteval)": [[0, "asteval.error_msg"]], "eval() (in module asteval)": [[0, "asteval.eval"]], "make_symbol_table() (in module asteval)": [[0, "asteval.make_symbol_table"]], "module": [[0, "module-asteval"]], "symtable (in module asteval)": [[0, "asteval.symtable"]], "valid_symbol_name() (in module asteval)": [[0, "asteval.valid_symbol_name"]]}}) \ No newline at end of file