Skip to main content

No project description provided

Project description

PNQ

CI pypi Downloads

PNQ is a Python implementation like Language Integrated Query (LINQ).

!!! danger PNQはベータ版です。

- 現在、ドキュメントとAPIが一致していません。
- ライブラリが十分な品質に到達するまで、頻繁に内部実装やAPIが更新される恐れがあります。
- 本番環境では利用しないでください。

Features

  • コレクション操作に関する多彩な操作
  • アクセシブルなインタフェース
  • 型ヒントの活用
  • 非同期ストリームに対応

Similar tools

Documentation

Dependencies

  • Python 3.8+

Installation

Install with pip:

$ pip install pnq

Getting Started

import pnq

for x in pnq.query([1, 2, 3]).map(lambda x: x * 2):
    print(x)
# => 2, 4, 6

pnq.query([1, 2, 3]).map(lambda x: x * 2).result()
# => [2, 4, 6]

pnq.query([1, 2, 3]).filter(lambda x: x == 3).one()
# => 2
import asyncio
import pnq

async def aiter():
    yield 1
    yield 2
    yield 3

async def main():
    async for x in pnq.query(aiter()).map(lambda x: x * 2):
        print(x)
    # => 2, 4, 6

    await pnq.query(aiter()).map(lambda x: x * 2)
    # => [2, 4, 6]

    await pnq.query(aiter()).filter(lambda x: x == 3)._.one()
    # => 3

asyncio.run(main())

release note

v0.0.1 (2021-xx-xx)

  • Initial release.

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

pnq-0.0.21.tar.gz (63.5 kB view hashes)

Uploaded Source

Built Distribution

pnq-0.0.21-py3-none-any.whl (80.5 kB view hashes)

Uploaded Python 3

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