Skip to main content

Pyjail Math

Build basic arithmetic expressions that evaluate to given numbers.

from pyjailmath.builder import PyjailMathBuilder

pmb = PyjailMathBuilder(
    '0', '1', '1+1', '-1', '-1-1',  # should evaluate to 0, 1, 2, -1, -2, respectively
    (r'(.+)', r'(\1)'),  # regex replace pattern to force operator precedence
    {'+', '-', '-unary', '*', '**', '//', '^', '~'},  # allowed operators
)
pmb.add_number_mappings({3: '3'})  # additional expressions

# Precompute small values
pmb.precompute_numbers([i for i in range(2, 1000)])
pmb.precompute_numbers([i**2 for i in range(2, 80)])
pmb.precompute_numbers([i**3 for i in range(2, 50)])
pmb.precompute_numbers([i**4 for i in range(2, 30)])

# Compute big value
print(pmb.get_number(133713371337))  # (((~3*~3*3*~3+1)*(~(3**3-~3)**(1+1)))*(3*((3)*(-3*3*~3-3))**(3)-3))//(1+3)

Installation

Install pyjailmath from PyPI using pip.

python3 -m pip install --upgrade pyjailmath

Metadata

Release files for pyjailmath 0.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyjailmath 0.0.0
File Size Uploaded Provenance Actions
pyjailmath-0.0.0.tar.gz 4.9 kB Without provenance Details for pyjailmath-0.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyjailmath 0.0.0
File Interpreter ABI Platform Actions
pyjailmath-0.0.0-py3-none-any.whl Python 3 none any Details for pyjailmath-0.0.0-py3-none-any.whl

Total release size: 9.8 kB

Release files / pyjailmath-0.0.0.tar.gz

Download URL pyjailmath-0.0.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
11d1df8acaaef78a3b2ed7612da7dc02e764cc975af8c9a676b3d9516159b68f
BLAKE2b-256 checksum
How to use checksums
07680534d4edd92c4fa283b5c361a5f876a72685b87e183344fcc304ad8093f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / pyjailmath-0.0.0-py3-none-any.whl

Download URL pyjailmath-0.0.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31961209dbeae43ccf6c645496fa75a823eee5fbb165bca0725d938125d6218b
BLAKE2b-256 checksum
How to use checksums
9c0c9189e63d042187e3a79f9334fcd189049760a8ba1979234f87e433874706
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for pyjailmath 0.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page