Brings LINQ to Python
Project description
LINQ
Provides simple to use LINQ features to Python 3.x.
Documentation
See this link: https://jakkes.github.io/python-linq/
Installing
From pip
pip install python-linq
From source
git clone https://github.com/jakkes/python-linq.git
cd python-linq
pip install -r requirements.txt
Usage
- Import the
Query
class - Write beautiful queries!
>>> from linq import Query
>>> x = Query([1, 2, 3]).select(lambda x: x * x + 3).to_list()
>>> assert x == [4, 7, 12]
Distribute heavy queries across multiple processes using DistributedQuery
.
>>> import time
>>> from linq import DistributedQuery
>>>
>>> def heavy_transformation(x: int):
>>> time.sleep(10)
>>> return x**2
>>>
>>> def less_than_5(x: int):
>>> return x < 5
>>>
>>> x = (
>>> DistributedQuery(range(100), processes=8)
>>> .where(less_than_5)
>>> .select(heavy_transformation)
>>> .to_list()
>>> )
>>> assert x == [0, 1, 4, 9, 16]
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
python-linq-2.0.3.tar.gz
(13.9 kB
view hashes)
Built Distribution
Close
Hashes for python_linq-2.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 440d93923b5713c78bd02c62c89fe8c66f20094a02e0b807799581dbcc7c8038 |
|
MD5 | 3592d9d6244fc4c200508b26e8efe183 |
|
BLAKE2b-256 | 6b1ba2e092b61001c7e6a14f9b5e37889e80f0b8c7d2496ea013989e2d0d8afd |