https://github.com/billsioros/querpyable
Querpyable: A Python implementation of LINQ
https://github.com/billsioros/querpyable
Last synced: 7 months ago
JSON representation
Querpyable: A Python implementation of LINQ
- Host: GitHub
- URL: https://github.com/billsioros/querpyable
- Owner: billsioros
- License: mit
- Created: 2023-05-21T16:55:33.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-29T00:07:43.000Z (over 1 year ago)
- Last Synced: 2024-05-29T12:58:27.446Z (over 1 year ago)
- Language: Python
- Homepage: https://billsioros.github.io/querpyable/
- Size: 1.43 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: docs/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: docs/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
Querpyable
A Python implementation of LINQ
## :bulb: Example
```python
# 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
```bash
pip install querpyable
```In order to locally set up the project please follow the instructions below:
```shell
# 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](https://billsioros.github.io/querpyable/).
## :heart: Support the project
Feel free to [**Buy me a coffee! ☕**](https://www.buymeacoffee.com/billsioros).
## :sparkles: Contributing
If you would like to contribute to the project, please go through the [Contributing Guidelines](https://billsioros.github.io/querpyable/latest/CONTRIBUTING/) first.
## :label: Credits
This project was generated with [`billsioros/cookiecutter-pypackage`](https://github.com/billsioros/cookiecutter-pypackage) cookiecutter template.