Metadata-Version: 2.1
Name: ipo
Version: 0.0.4
Summary: Infix piping operator
Home-page: https://framagit.org/Midgard/ipo
Author: Midgard
License: UNKNOWN
Project-URL: Source, https://framagit.org/Midgard/ipo
Project-URL: Change log, https://framagit.org/Midgard/ipo/-/blob/master/CHANGELOG.md
Project-URL: Bug tracker, https://framagit.org/Midgard/ipo/-/issues
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 3 - Alpha
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: COPYING
License-File: COPYING.LESSER

ipo: Infix piping operator

## Demo
```python
from functools import partial as p
from ipo import ipo, head


# Ipo makes data flows much easier to follow.
ipo([5, 2, 3, 1, 4]) | sorted              | list | print  # [1, 2, 3, 4, 5]
ipo([5, 2, 3, 1, 4]) | p(head, 3)          | list | print  # [5, 2, 3]
ipo([5, 2, 3, 1, 4]) | sorted | p(head, 3) | list | print  # [1, 2, 3]
ipo([5, 2, 3, 1, 4]) | p(head, 3) | sorted | list | print  # [2, 3, 5]

# Much more readable than the original!
#   print(list(sorted(itertools.islice([5, 2, 3, 1, 4], 3))))
```

```python
from functools import partial as p
from itertools import starmap
from ipo import from_csv, skip, to_csv, before, write

# Ipo is ideally suited for working with CSV data.
ipo("""
#Voltage,Current
12,1
8,2
220,6
""".strip().split()) | from_csv | p(skip, 1) | \
	p(starmap, lambda v, a: (v, a, float(v) * float(a))) | \
	to_csv | p(before, ["#Voltage,Current,Power"]) | write
# #Voltage,Current,Power
# 12,1,12.0
# 8,2,16.0
# 220,6,1320.0
```

```python
from functools import partial as p
from ipo import read, write

# Most ipo chains that work over iterable data are lazy by default. You can load huge files,
# process them and write the results to another file.
with open("bigfile.txt") as f_in, open("processed.txt") as f_out:
	read(file=f_in) | p(map, some_preprocessing) | \
	p(map, some_advanced_function) | \
	p(map, some_formatting) | p(write, file=f_out)
```

