Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Kludex/kwonly-transformer
We don't like positional args, we like keyword only args! 🎉
https://github.com/Kludex/kwonly-transformer
Last synced: 27 days ago
JSON representation
We don't like positional args, we like keyword only args! 🎉
- Host: GitHub
- URL: https://github.com/Kludex/kwonly-transformer
- Owner: Kludex
- License: mit
- Created: 2022-06-17T05:47:49.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-02T11:16:36.000Z (about 2 years ago)
- Last Synced: 2024-11-16T05:02:23.233Z (28 days ago)
- Language: Python
- Size: 11.7 KB
- Stars: 86
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-python-code-formatters - kwonly-transformer
README
kwonly-transformer
This is a very opinionated tool. The idea is that we want functions with multiple parameters to have **exclusively** keyword only parameters.
As an example, let's consider a function with multiple parameters. When we are reading the call for that function,
we lose time either checking the reference, or trying to map in our brains what argument matches a specific function parameter.
```python
def do_something(a, b, c, d, e, f):
...do_something(True, "potato", 1, "haha", None, False)
```
`kwonly-transformer` is a tool that formats the above into the following:```python
def do_something(*, a, b, c, d, e, f):
...do_something(a=True, b="potato", c=1, d="haha", e=None, f=False)
```## Installation
```bash
pip install kwonly-transformer
```## License
This project is licensed under the terms of the MIT license.