Metadata-Version: 2.1
Name: jboc
Version: 0.1.0
Summary: No dependencies, no paradigm - Just a Bunch Of Code
Home-page: https://github.com/maxme1/jboc
Author: maxme1
Author-email: maxs987@gmail.com
License: MIT
Download-URL: https://github.com/maxme1/jboc/archive/v0.1.0.tar.gz
Keywords: utils,misc
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

## No dependencies, no paradigm - Just a Bunch Of Code

A small collection of some useful code that didn't fit into any package that I know of.

# Examples

Turn a generator function into a function that returns a list:

```python
from jboc import collect


@collect
def odd_numbers(n):
    for i in range(n):
        yield 2 * i + 1


# not a generator anymore
odd_numbers(3) == [1, 3, 5] 
```

Same as before, but gather the values into a different container, e.g. a dict:

```python
from jboc import composed


@composed(dict)
def vals_to_squares(values):
    for v in values:
        yield v, v ** 2


# the pairs are gathered in a dict
vals_to_squares([3, 2, 8]) == {3: 9, 2: 4, 8: 64}
```

# Install

```shell
pip install jboc
```


