Advanced tools for callable objects in Python.
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
Python Callabletoolx
Advanced tools for callable objects in Python.
About The Project
Provides advanced tools for callable objects in Python 3.x.
Built With
Getting Started
To get a local copy up and running follow these simple example steps.
Prerequisites
- Python-lib ArumanSignature, has been used for argument models.
Installation
- Clone the repo
git clone https://github.com/TahsinCr/python-callabletoolx.git
- Install PIP packages
pip install callabletoolx
Usage
Let's try to retrieve a callable object's arguments, argument count, return result, and the arguments with their given values.
from callabletoolx import (
get_arguments, get_argument_length, get_return_argument, get_argument_values
)
def item_to_string(key1:str, key2, start:str='-', *keys, sep:str=', ', **items:int) -> str:
items = [f'{k}:{v}' for k, v in items]
return start + sep.join([key1, key2, *keys, items])
func_args = ['test1', 'test2', '--', 'test3']
func_kwargs = {
'ex' : 'test4'
}
arguments = get_arguments(item_to_string)
print("FuncArgs:", *arguments, sep='\n', end='\n\n')
print("FuncArgLength: {}".format(get_argument_length(item_to_string)), end='\n\n')
print("FuncReturnArg: \n{}".format(get_return_argument(item_to_string)), end='\n\n')
print(
"FuncArgValues:",
*get_argument_values(arguments, func_args, func_kwargs),
sep='\n', end='\n\n'
)
Output
FuncArgs:
Argument(name: key1, type: <class 'str'>, default: Ellipsis, argtype: ARG)
Argument(name: key2, type: typing.Any, default: Ellipsis, argtype: ARG)
Argument(name: start, type: <class 'str'>, default: Ellipsis, argtype: ARG)
Argument(name: keys, type: typing.Any, default: Ellipsis, argtype: ARGS)
Argument(name: sep, type: <class 'str'>, default: ', ', argtype: ARG)
Argument(name: items, type: <class 'int'>, default: Ellipsis, argtype: KWARGS)
FuncArgLength: 6
FuncReturnArg:
Argument(name: return, type: <class 'str'>, default: Ellipsis, argtype: RETURN)
FuncArgValues:
ArgumentValue(name: key1, type: <class 'str'>, default: Ellipsis, argtype: ARG, value: 'test1')
ArgumentValue(name: key2, type: typing.Any, default: Ellipsis, argtype: ARG, value: 'test2')
ArgumentValue(name: start, type: <class 'str'>, default: Ellipsis, argtype: ARG, value: '--')
ArgumentValue(name: keys, type: typing.Any, default: Ellipsis, argtype: ARGS, value: ['test3'])
ArgumentValue(name: sep, type: <class 'str'>, default: ', ', argtype: ARG, value: ', ')
ArgumentValue(name: items, type: <class 'int'>, default: Ellipsis, argtype: KWARGS, value: {'ex': 'test4'})
For more examples, please refer to the Documentation
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Tahsin Çirkin - @TahsinCrs - TahsinCr@outlook.com
Project: TahsinCr/python-callabletoolx
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 callabletoolx-1.0.tar.gz.
File metadata
- Download URL: callabletoolx-1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f593a046a1e237835de298a9ace6d326d5e29d15e2155f1f292318ba67ff576d
|
|
| MD5 |
51734e7d8918399942fb4d718fca9ee3
|
|
| BLAKE2b-256 |
8288007699cfa93c847c2cede6363fc8861ed9f27ffb40921ccf8e030f719d61
|
File details
Details for the file callabletoolx-1.0-py3-none-any.whl.
File metadata
- Download URL: callabletoolx-1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ceb8321c08f6ce896b468bed24f801eaee36ecac79fa474343bc897d29929cd0
|
|
| MD5 |
6ea06abdda2e0e1a48fc44601ea364e6
|
|
| BLAKE2b-256 |
b2f5581c56d0ecb1a2599e0b4d988d97bab3faa2a73375461b777289fd5d89d5
|