A package for finding the list of errors in a code compared to the expected code
Project description
AST ERROR DETECTION
Overview
ast-error-detection is a Python library designed for analyzing and annotating algorithmic errors in code. It leverages the Abstract Syntax Tree (AST) module from Python's standard library to identify, categorize, and contextualize errors. The output of the library is a list of errors, where each error is a dictionary describing the issue and its context.
This library is under an ongoing scientific study. If you use it for academic purposes, please cite the forthcoming publication (details will be provided).
Features
- Parses and processes Python code using the AST module.
- Identifies and categorizes errors with detailed contextual information.
- Provides actionable insights for debugging.
Installation
Install the package via pip:
pip install ast_error_detection
Usage
Here’s a basic example of how to use the library:
from ast-error-detection import get_code_errors
# Example erroneous code to analyze
code_1 = """
# Code snippet here
"""
# Example expected code
code_2 = """
# Code snippet here
"""
# Convert AST to custom node representation
result = get_code_errors(code_1, code_2)
# Print the results
print(result)
Output Format
The output is always a list of errors. Each error is a dictionary structured as follows:
-
For
deleteorinserterrors (3 elements):error: Description of the error.value: The value to delete or insert.context: Contextual location of the error (see below).
-
For
updateerrors (4 elements):error: Description of the error.old_value: The old value to update.new_value: The new value to update.context: Contextual location of the error.
Context Format
The context describes where the error occurred in the code execution hierarchy. For example:
Module > Function Name > For Loop > If > Condition
This indicates that the error is in the condition of an if statement inside a for loop within a function in the module.
Example
Input Code 1
print('Hello')
Input Code 2
print('Hello1')
Output
[('CONST_VALUE_MISMATCH', "Const: 'Hello'", "Const: 'Hello1'", "Module > Call: print > Const: 'Hello'")]
License
This project is licensed under the GNU Affero General Public License v3 (AGPL-3.0). If you wish to use this library for proprietary or commercial purposes, you must obtain a separate license.
Please contact Badmavasan [Lip6] at [badmavasan.kirouchenassamy@lip6.fr] for commercial licensing inquiries.
Scientific Publication
This library is part of an ongoing scientific study. If you use it for academic purposes, please cite the forthcoming publication:
[Publication details will be added here once available.]
Stay tuned for updates!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asterrdetection-0.3-py3-none-any.whl.
File metadata
- Download URL: asterrdetection-0.3-py3-none-any.whl
- Upload date:
- Size: 33.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d9f220c32e0875a6266eb39a09d9e4e224cad53ff8a6102e83bcdd42dc5550d
|
|
| MD5 |
b8893dce29a85199132de3552f66d021
|
|
| BLAKE2b-256 |
9d57473c3005c6730225067f19414afb39bfeb55ec0545a7d2cd8defff864293
|