Metadata-Version: 2.4
Name: callabletoolx
Version: 1.0.1
Summary: Advanced tools for callable objects in Python.
Author-email: TahsinCr <TahsinCr@outlook.com>
License: MIT
Project-URL: Homepage, https://github.com/TahsinCr/python-callabletoolx
Project-URL: Source, https://github.com/TahsinCr/python-callabletoolx
Keywords: callabletoolx,callabletools,toolx,tools,callable,xcollection
Classifier: Typing :: Typed
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: argumentsignature>=1.0
Dynamic: license-file

<a name="readme-top"></a>

[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]







<!-- About -->
<div align="center">

<h3 align="center">Python Callabletoolx</h3>

<p align="center">

Advanced tools for callable objects in Python.

[Changelog][changelog-url] · [Report Bug][issues-url] · [Request Feature][issues-url]
 
</p>

</div>



<!-- ABOUT THE PROJECT -->

##  About The Project

Provides advanced tools for callable objects in Python 3.x.


###  Built With

* [![python-shield][python-shield]][pypi-project-url]

<br>


<!-- GETTING STARTED -->

##  Getting Started

To get a local copy up and running follow these simple example steps.

###  Prerequisites

* Python-lib [ArumanSignature][pythonlib-argumentsignature], has been used for argument models.


###  Installation

1. Clone the repo
```sh
git clone https://github.com/TahsinCr/python-callabletoolx.git
```

2. Install PIP packages
```sh
pip install callabletoolx
```


<br>



<!-- USAGE EXAMPLES -->

##  Usage

Let's try to retrieve a callable object's arguments, argument count, return result, and the arguments with their given values.
```python
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][wiki-url]_

<br>





<!-- LICENSE -->

##  License

Distributed under the MIT License. See [LICENSE][license-url] for more information.


<br>





<!-- CONTACT -->

##  Contact

Tahsin Çirkin - [@TahsinCrs][x-url] - TahsinCr@outlook.com

Project: [TahsinCr/python-callabletoolx][project-url]







<!-- IMAGES URL -->

[python-shield]: https://img.shields.io/pypi/pyversions/callabletoolx?style=flat-square

[contributors-shield]: https://img.shields.io/github/contributors/TahsinCr/python-callabletoolx.svg?style=for-the-badge

[forks-shield]: https://img.shields.io/github/forks/TahsinCr/python-callabletoolx.svg?style=for-the-badge

[stars-shield]: https://img.shields.io/github/stars/TahsinCr/python-callabletoolx.svg?style=for-the-badge

[issues-shield]: https://img.shields.io/github/issues/TahsinCr/python-callabletoolx.svg?style=for-the-badge

[license-shield]: https://img.shields.io/github/license/TahsinCr/python-callabletoolx.svg?style=for-the-badge

[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555



<!-- Github Project URL -->

[project-url]: https://github.com/TahsinCr/python-callabletoolx

[pypi-project-url]: https://pypi.org/project/callabletoolx

[contributors-url]: https://github.com/TahsinCr/python-callabletoolx/graphs/contributors

[stars-url]: https://github.com/TahsinCr/python-callabletoolx/stargazers

[forks-url]: https://github.com/TahsinCr/python-callabletoolx/network/members

[issues-url]: https://github.com/TahsinCr/python-callabletoolx/issues

[wiki-url]: https://github.com/TahsinCr/python-callabletoolx/wiki

[license-url]: https://github.com/TahsinCr/python-callabletoolx/blob/master/LICENSE

[changelog-url]:https://github.com/TahsinCr/python-callabletoolx/blob/master/CHANGELOG.md



<!-- Contacts URL -->

[linkedin-url]: https://linkedin.com/in/TahsinCr

[x-url]: https://twitter.com/TahsinCrs

<!-- Dependencies URL -->

[pythonlib-argumentsignature]: https://github.com/TahsinCr/python-argumentsignature

