Skip to main content

easy cooperation between main-function and argparse

Project description

Overview

The wonderparse project allows for easy cooperation between a main-function/an object that hold the central functions on the one side and argparse on the other.

Installation

To install wonderparse, you can use pip. Open your terminal and run:

pip install wonderparse

Usage

The code from the expit project.

import math as _math

import wonderparse as _wp


def function(x:float):
    try:
        p = _math.exp(-x)
    except OverflowError:
        p = float('+inf')
    return 1 / (1 + p)

def main(args=None):
    _wp.easymode.simple_run(
        args=args,
        program_object=function,
        prog='expit',
    )

Working example:

main([".4"])
### 0.598687660112452

Example with missing parameter.

main([])
### usage: expit [-h] x
### expit: error: the following arguments are required: x
### An exception has occurred, use %tb to see the full traceback.

Example with faulty typing.

main(["spam"])
### usage: expit [-h] x
### expit: error: argument x: invalid float value: 'spam'
### An exception has occurred, use %tb to see the full traceback.

The wonderparse project allows for parsing made easy.

License

This project is licensed under the MIT License.

Credits

Thank you for using wonderparse!

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

wonderparse-1.4.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

wonderparse-1.4.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file wonderparse-1.4.1.tar.gz.

File metadata

  • Download URL: wonderparse-1.4.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for wonderparse-1.4.1.tar.gz
Algorithm Hash digest
SHA256 7d98cd92d6b79b8b62582c49f38a4b82c557122e174b27f767f60fa4a3cee97f
MD5 0ac7fb43b8d4c5e5086817558a9717f7
BLAKE2b-256 6fe9da0dc8bd3298d8347c2019e31155f6104a61429edf9903b20161f1658f9e

See more details on using hashes here.

File details

Details for the file wonderparse-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: wonderparse-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for wonderparse-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 64c756999e78242a413c46e8315b147d5f8e2f1a474a28afbe90b4517a5b9d08
MD5 659174ca041f9b0c1b415d554ea1167e
BLAKE2b-256 51aa0ee2e1adb599bb55daa36a8e5925b199ecd40f78bffbab0fe77dd91fb284

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