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.1.tar.gz (12.1 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.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycheckmate-1.0.1.tar.gz
  • Upload date:
  • Size: 12.1 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.1.tar.gz
Algorithm Hash digest
SHA256 b2927db11f164b81bf5e21a8e9f7f43c4f46170e2dc7d6816bf67145ef1d4383
MD5 736a9ee1527d029ad238fcb616a6dd25
BLAKE2b-256 bfb3ec03418f522f194d9ceb1d8580b1ef5b8c1a8b2aa69f28819f9ad950d036

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycheckmate-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b6c9343492a0921331936a1309d442cf05175e215862a4abe658fa0233fd37b8
MD5 60a2e45df1518eb79111dcded8fc1e35
BLAKE2b-256 d6e2846cf2a7eabd5ed1a403a9a521c74ba01fc7007dfe3a85df8b999cb6ce76

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