Skip to main content

A Python implementation of LINQ

Project description

Querpyable

A Python implementation of LINQ

PyPI - Python Version PyPI CI CD pre-commit.ci status Test Coverage PyPI - License Open in GitHub Codespaces Cookiecutter Template Renovate - Enabled Buy me a coffee Dependency Review

:bulb: Example

# Calculating the first 10000 primes
primes = (
    Queryable.range(2, 1_000_000)
    .where(lambda n: all(n % i != 0 for i in range(2, int(n**0.5) + 1)))
    .take(10000)
    .to_list()
)

# Calculating Factorials using Aggregate:
factorial = (
    Queryable
    .range(1, 5)
    .aggregate(lambda result, current: result * current)
)

# Finding Palindromic Words in a List:
words = ["level", "hello", "world", "radar", "LINQ", "civic"]
palindromic_words = (
    Queryable(words)
    .where(lambda word: word == word[::-1])
    .to_list()
)

# Selecting Unique Characters from a Sentence:
sentence = "LINQ is fun and powerful"
unique_characters = (
    Queryable(sentence)
    .where(lambda char: char.isalpha())
    .select(lambda char: char.lower())
    .distinct()
    .to_list()
)

:cd: Installation

pip install querpyable

In order to locally set up the project please follow the instructions below:

# Set up the GitHub repository
git clone https://github.com/billsioros/querpyable

# Create a virtual environment using poetry and install the required dependencies
poetry shell
poetry install

# Install pre-commit hooks
pre-commit install --install-hooks
pre-commit autoupdate

:book: Documentation

The project's documentation can be found here.

:heart: Support the project

Feel free to Buy me a coffee! ☕.

:sparkles: Contributing

If you would like to contribute to the project, please go through the Contributing Guidelines first.

:label: Credits

This project was generated with billsioros/cookiecutter-pypackage cookiecutter template.

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

querpyable-3.0.0.tar.gz (12.3 kB view hashes)

Uploaded Source

Built Distribution

querpyable-3.0.0-py3-none-any.whl (10.0 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