Coder Social home page Coder Social logo

compgenerator's Introduction

Comprehension fuzzer

Generate random code samples including list comprehensions and try running them on a Python build.

To use, create a Python 3.11 venv and pip install -r frozen.txt.

Then start the evalserver with the build of Python you want to test for compatibility with 3.11:

/home/carljm/cpython-builds/dbg/python evalserver.py

Then run pytest.

Two other useful options: --hypothesis-show-statistics and --logfile="/some/path"; the latter will dump all valid generated samples to the log file.

Current approach is to generate a bunch of random code samples and filter down to the ones containing list comprehensions, then aim for samples that maximize number of listcomps, lambdas, and classes. The problem is that too many samples are generated without listcomps and then rejected. We probably need a more constrained format for generating the samples initially, but without over-constraining and possibly missing counter-examples.

Note that this will exec() the generated code samples on multiple Python binaries. As the code samples cannot contain imports or calls to builtin functions, this is probably safe, but definitely do not run the evalserver on a publicly accessible port.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.