Skip to main content

Brings LINQ to Python

Project description

LINQ

Build Status

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

  1. Import the Query class
  2. 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()
>>> )
>>> print(x)
[0, 1, 4, 9, 16]    # Not necessarily in this order.

Project details


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.4.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

python_linq-2.0.4-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file python-linq-2.0.4.tar.gz.

File metadata

  • Download URL: python-linq-2.0.4.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.9

File hashes

Hashes for python-linq-2.0.4.tar.gz
Algorithm Hash digest
SHA256 69be80f3a975142ecca09815d1b5eed9307dc154b2b5915d1c8f7fa152b25a3c
MD5 acb31755cf0caeb831dc591adcaaa74e
BLAKE2b-256 05418aba6a6610a6c6f63b276d56237cd1f58a23e10dd3451442ab9070b9a2f1

See more details on using hashes here.

File details

Details for the file python_linq-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: python_linq-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.9

File hashes

Hashes for python_linq-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a00b829dfa60da7a8772bd6b126143afd6cbc1bf2fb0811390ea570a4c174b68
MD5 e7f51b06b14d67175a2d8212c5b6fb28
BLAKE2b-256 2c5fd235a133721138065064baa1537422e9e3bb6e9c514eff66f5e55b2c6201

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page