functions while mapping and validating dynamic
Project description
argscall
argscall is python library that can be used to call functions while mapping and validating dynamic input arguments «*args or **kwargs» using the function arguments signature.
Usage
from argscall import argsCaller
# A simple function that requires one argument
def do_something(name):
print(name.upper())
# Call the function passing a list with arguments
argscall(do_something, "a").call()
It becomes more usefull when used with dynamic input arguments, e.g command line arguments:
# test.py
import sys
from argscall import argsCaller
# A sample function that requires an argument
def do_something(name):
print(name.upper())
# Call the function passing the command line arguments
argsCaller(do_something, *sys.argv[1:]).call()
Testing different use cases
$ python test.py Joe
JOE
$ python test.py
Traceback (most recent call last)
...
argscall.exceptions.MissingArgument: Missing required argument: name
$ python test.py Joe Black
Traceback (most recent call last)
...
argscall.exceptions.TooManyArgument: Got more arguments than expected (value: 'Black')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file argscall-0.0.2.tar.gz.
File metadata
- Download URL: argscall-0.0.2.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a57024ec45dd7ce319c0110c19f3bdf203bfb6e6927affb778a0b3dee10a00f
|
|
| MD5 |
3bb0e69fce8ecf37c8b2ba2dfec7a2bf
|
|
| BLAKE2b-256 |
20c3598b533ef6c4deb2a10861cdd1908dcb89fc2b18bf1498eda63a1de17de8
|
File details
Details for the file argscall-0.0.2-py3-none-any.whl.
File metadata
- Download URL: argscall-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
875f84451d891f2e6f01275e05a7dd1e93d1880a24367011652b5f321a4707e4
|
|
| MD5 |
b78f21661d0f770c95d56a8442700a67
|
|
| BLAKE2b-256 |
4ff8689520aa2afb55ab4ea3e06e96942485897ad13643ab87ba91a94aba8cc7
|