Skip to main content

src is a library designed to analyze Python code for various properties, focusing primarily on the evaluation of code authored by programming novices

Project description

pycheckmate

pycheckmate is a library designed to analyze Python code for various properties, focusing primarily on the evaluation of code authored by programming novices.

Installation

pycheckmate requires at least the following Python packages:

  • python >= 3.9 (only for method print_ast)
  • ast

Documentation

The documentation for the latest pycheckmate is currently in progress.

Example Usage

from pycheckmate import PyCheckMate

#store code as str in variable source_code
with open("testing_file.py") as file:
    source_code = file.read()

reqs_args = {
    'param1': { 'default': 0 },
    'param2': { 'type': int }
}

pcm = PyCheckMate(source_code) 

check_func_name = pcm.has_function("test_function")
# check_func_name is a dictionary, could be for example:
#{'passed': True, 'note': "Function 'test_function' found."}

check_func_params = pcm.function_has_parameters("test_function", required_args=reqs_args, required_vararg=False, required_kwarg="kwarg")
# check_func_params is a dictionary, could be for example:
#{'passed': False, 'note': 
    "Parameter 'param1' of function 'test_function' is completly missing.
    Parameter 'param2' of function 'test_function' is of wrong type, expected '<class 'int'>', got 'None'..
    Your function has a parameter to pass a variable number of arguments to the function. Here you are not allowed to use this type of parameter.
    Your function is missing a parameter to pass a variable number of keyworded arguments to the function."}

Testing

python -m unittest discover tests "*_tests.py"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycheckmate-1.0.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycheckmate-1.0.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file pycheckmate-1.0.0.tar.gz.

File metadata

  • Download URL: pycheckmate-1.0.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for pycheckmate-1.0.0.tar.gz
Algorithm Hash digest
SHA256 42e9a29b1a0938a27d547601188fb28f98f3b1c164440416cb95ea154738c5f8
MD5 a0d853c4b83092c9c63c6b90abb6f419
BLAKE2b-256 a3841d5658ce4b8577bac1c00b8b46354aec5c12b88927469f48d3b8a49d98cd

See more details on using hashes here.

File details

Details for the file pycheckmate-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pycheckmate-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for pycheckmate-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a63f1f22f04af8a9f6fb069e9517abd23c75906645634e829513af4fdf38d77f
MD5 13652295382ea2771e3dcb45ad4bdefa
BLAKE2b-256 3908909ef8e16d3a0d9f6a9044f9fa0c718966b6680a18e677eb6b50e87883f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page