Complete LINQ, language integrated query, implementation for Python with full type annotations, comprehensive documentation, 100% test coverage, and queryable drop in replacements for the builtin collection types.
Project description
Typed Linq Collections
Complete LINQ, language integrated query, implementation for Python with full type annotations, comprehensive documentation, 100% test coverage, and queryable drop in replacements for the builtin collection types.
- Rich Query API: Almost the full Enumerable set of operators from .NET gives excellent support for filtering, mapping, grouping, and more in a fluent API
- Comprehensive type annotions: Gives you full autocomplete and static error analysis if using pyright with vscode or PyCharm. In vscode refactoring within the lambdas work like a charm
- Comprehensive test suite: More than 900 tests covering every single line and code branch
- Comprehensive docstrings: Every method and class is documented, giving excellent discoverability of functionality in any modern IDE/editor.
- Lazy Evaluation: Memory efficient query execution with deferred evaluation for every operation other than the to_* methods which create new collections
- Drop-in compatible collection types: Collection types that seamlessly replace and interoperate with standard Python collections. QList, QSet, QDict etc
- Numeric Specializations: Dedicated types for
int,float,Decimal, andFractioncollections - Extensible Design: QIterable is an abstract class/mixin that can be subclassed by any Iterable type to add full querying capabilities
Quick Start
from typed_linq_collections.collections.q_list import QList
from typed_linq_collections.q_iterable import query
fruits = ("apple", "apricot", "mango", "melon", "peach", "pineapple")
def test_querying_built_in_collections() -> None:
fruits_by_first_character = (query(fruits)
.group_by(lambda fruit: fruit[0])
.where(lambda group: group.key in {"a", "p"})
.to_list())
assert fruits_by_first_character == [['apple', 'apricot'], ['peach', 'pineapple']]
def test_querying_with_queryable_collections() -> None:
fruits_by_first_character = (QList(fruits)
.group_by(lambda fruit: fruit[0])
.where(lambda group: group.key in {"a", "p"})
.to_list())
assert fruits_by_first_character == [['apple', 'apricot'], ['peach', 'pineapple']]
def test_numeric_operations() -> None:
total_lenght_of_fruits = (query(fruits)
.select(len)
.as_ints() # get's you a QIntIterable with numeric operations support. typed so that it is only available on a QIterable[int]
.sum())
assert total_lenght_of_fruits == 36
Collection Types
Core Collections
Drop in replacements for the built in collections.
QList[T]- Queryable list (mutable sequence)QSequence[T]- Queryable immutable sequenceQSet[T]- Queryable set (mutable)QFrozenSet[T]- Queryable frozen set (immutable)QDict[K, V]- Queryable dictionaryQDefaultDict[K, V]- Queryable default dictionary
Numeric Collections
Specialized collections with additional numeric operations:
QIntIterable- For integer collectionsQFloatIterable- For float collectionsQDecimalIterable- For Decimal collectionsQFractionIterable- For Fraction collections
and so on with numeric specializations of QList, QSet, QDict, QDefaultDict, QFrozenSet.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file typed_linq_collections-0.9.15.tar.gz.
File metadata
- Download URL: typed_linq_collections-0.9.15.tar.gz
- Upload date:
- Size: 71.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b4942e3fbc362d95fbc1d15d44948b02d2bd39d97a25dbd085ac61d883c43e2
|
|
| MD5 |
e6d42a5c9d9d080926e8f63d3cbd4013
|
|
| BLAKE2b-256 |
6affe15899551a5307c486004d6da8684d5da800fd2576538c360f87dde414ec
|
File details
Details for the file typed_linq_collections-0.9.15-py3-none-any.whl.
File metadata
- Download URL: typed_linq_collections-0.9.15-py3-none-any.whl
- Upload date:
- Size: 99.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a58f687a7d6d2b40019c9547976b87b1a33076632811d56fc05df468798fcf5c
|
|
| MD5 |
970dc60cf21a596365372cb392a78cb1
|
|
| BLAKE2b-256 |
32478a89fec6cbf84ac94061726cd73b34db6e9d43dd14f24f8f410dcb0d5aed
|