Skip to main content

A Dice expression parser

Project description

Example

from diro import parse, Dice

if __name__ == "__main__":
    d = parse("3D6k1+1*(10+1)*2")
    d.roll()
    print(f"{d}={d.detail_expr()}={d.calc()}")
    # 3D6K1+1*(10+1)*2=6+1*(10+1)*2=28

    d = parse("D100b2")
    d.roll()
    print(f"{d}={d.detail_expr()}={d.calc()}")
    # D100B2=32B2B1=12

    dice = Dice(face=6, count=3, kq=2)
    result = dice.roll()
    print(f"{dice}={result.detail()}={result()}")
    # 3D6K2=1+4+1=5

    diro = parse("1/0")
    print(diro.calc())
    # Err! ZeroDivisionError: division by zero

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

diro_py-0.1.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distributions

diro_py-0.1.1-cp310-none-win_amd64.whl (183.8 kB view details)

Uploaded CPython 3.10 Windows x86-64

diro_py-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl (259.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

diro_py-0.1.1-cp39-none-win_amd64.whl (184.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

diro_py-0.1.1-cp39-cp39-manylinux_2_28_x86_64.whl (259.2 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

diro_py-0.1.1-cp38-none-win_amd64.whl (183.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

diro_py-0.1.1-cp38-cp38-manylinux_2_28_x86_64.whl (250.0 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

diro_py-0.1.1-cp37-none-win_amd64.whl (183.8 kB view details)

Uploaded CPython 3.7 Windows x86-64

diro_py-0.1.1-cp37-cp37m-manylinux_2_28_x86_64.whl (259.4 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.28+ x86-64

diro_py-0.1.1-cp37-abi3-win_amd64.whl (191.0 kB view details)

Uploaded CPython 3.7+ Windows x86-64

diro_py-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (285.6 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ x86-64

diro_py-0.1.1-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (309.3 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ i686

diro_py-0.1.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (249.3 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

diro_py-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (264.3 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

File details

Details for the file diro_py-0.1.1.tar.gz.

File metadata

  • Download URL: diro_py-0.1.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.14.10

File hashes

Hashes for diro_py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 30c6fa683f29ae411319ef083d9ee203bad79f72bafb62154622d5bd59e2c03c
MD5 f77d1296d5f06da36d4af3633154b93a
BLAKE2b-256 74f5bcfbcc62c4ab1f8fea12aa4ccd391f636d4049985963f7c6c174ba974f0a

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 6d974420a88c8e119d919b5839aed825d5a59f0e438c312ab2b464a36d745430
MD5 58ab9fcfb3eab8c31ef60c7e5c75d1f6
BLAKE2b-256 87ab5625ffd83ec1bdfbca057d761b3e0fc9a8efa072f7f40fb79fa34d608b4a

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 62d5d89150e65178dc06e0da7c9367582fbba6e17bdcb23d27b36688858513f6
MD5 274f03f4222c7ded46abc2e8518e9a26
BLAKE2b-256 37e8fd0fbd4b3303ab86c55af38ef44572568ea4656abcebc217e8ebe8fdb84f

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 b769e3683b35b23a65c3f84947cb0298f3b787f93099cdf72656688b7e0de409
MD5 a2ce0861d937d1b288e4d1400b1b6c05
BLAKE2b-256 2208ccd445deca74c6f90cac809a6e2cb85e189372e5639ab93950aea17e4550

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f20aca59ff76c15f053e6a105ebab64bb787d40485d9332937b67786ad4be410
MD5 5b98bfdf15cbe8625335de846bbfc7eb
BLAKE2b-256 02ff34bdb4bbe54f5c1a53645ebf6887e66a6f51ac5db1a1ed9decc3e4a90ed3

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 5ecfd9b110158316179ff254c5044349001ac50fae753a20e688d0ec5d48efb4
MD5 21ad1b5120dc2790d4b8c6ecd3ae1bfe
BLAKE2b-256 4691dbb9df8a2e47b6dedad6ebcbbda78a45600520ef65bbaf868a10069020c1

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 699e7d2d2673a41d1cdbcbdaf25196ea8850d7e1a2934bc7efed92e66440460f
MD5 3bd97ef1909a55a000c37609f1b61977
BLAKE2b-256 bc5a1d5c75e67ae9b36ac207d804e38f704ab4da3fbd0c30be6a0e99a4a772c7

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp37-none-win_amd64.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 c43bc10a2498b44c4ad0b3509a52825c8bc83fba439f3b17f1b9b67cecd0927c
MD5 307835a1bd0f6b462e54c4141997be27
BLAKE2b-256 638773545af3534055feb3c75aecc158146feedf6c21eccadb970c0d93d36f15

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp37-cp37m-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp37-cp37m-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 23195138167fbd58aea49b35a57b674fb59436d6344d0c3ed559fd8ba8d284a3
MD5 32036eb119a3b20b496dff366ff2a8ce
BLAKE2b-256 693cc6cd8baf25f9525cf902d5176004a59645dba47563b327c773ce2cd8b07f

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: diro_py-0.1.1-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 191.0 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.14.10

File hashes

Hashes for diro_py-0.1.1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 21744ed1490bf521de5a041c8363050e302a70acc3269779e13772c9a8154514
MD5 dedb5fbe087e558fdbd250f1fa838ec8
BLAKE2b-256 f72786b20308baf3f9bb38d81290c73edbbdc76d84acb1c29107e1c46d116b1a

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06f08bcd522005832d51755e6aa91a26c4a2f25f90b0315685a6e447b9a7fa0a
MD5 b022b6de28270c5dddb181d8e996c503
BLAKE2b-256 579cbca93b578c68a907d3bd113eb6e7a949c1c8693b0273e525e7ff5069db04

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 f304f3a5c488ac3c866a367ec124cc00e207737926a71f8f6e3560eded5fcbb9
MD5 40cc128568e21a0f4796f980e87ddf1e
BLAKE2b-256 278449ec3efd67511ae829d880d046520fe10842866d98a673ad412a80070ae2

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 33d0f7423895a820d8814c402cb569a5eef8a66cf41b5350fb462dd9b2a0153e
MD5 1bf76142b4f5228d83c37382ef83ed1c
BLAKE2b-256 d086f2535451da2e0db355c16fdcd7c27b0460d34b6229e1ac69bf924156f554

See more details on using hashes here.

File details

Details for the file diro_py-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for diro_py-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ee021619d93d276e6e74ed3e113be9b6d4cb5050848e2c0780302c1e8435da4d
MD5 fd0a17895643c491b927bcf7837b1cf4
BLAKE2b-256 6536b85f36f39072de50ce855f6321f9972709fc3c50cbc7d11f1feca54eb2e0

See more details on using hashes here.

Supported by

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