Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pyenumerable/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
Implementation of .NET's IEnumerable interface in python W/ support for generics.
""" # noqa: E501


from pyenumerable.implementations import PurePythonEnumerable
from pyenumerable.protocol import Enumerable

__all__ = ["Enumerable", "PurePythonEnumerable"]
__author__ = "AmirHossein Ahmadi"
__license__ = "WTFPL"
__version__ = "1.0.2"
__maintainer__ = "AmirHossein Ahmadi"
__email__ = "[email protected]"
3 changes: 3 additions & 0 deletions pyenumerable/implementations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .pure_python import PurePythonEnumerable

__all__ = ["PurePythonEnumerable"]
32 changes: 2 additions & 30 deletions pyenumerable/protocol/__init__.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
from ._supports_aggregate import SupportsAggregate # noqa: I001
from ._supports_all import SupportsAll
from ._supports_any import SupportsAny
from ._supports_append import SupportsAppend
from ._supports_average import SupportsAverage
from ._supports_chunk import SupportsChunk
from ._supports_concat import SupportsConcat
from ._supports_contains import SupportsContains
from ._supports_count import SupportsCount
from ._supports_distinct import SupportsDistinct
from ._supports_except import SupportsExcept
from ._supports_group_by import SupportsGroupBy
from ._supports_group_join import SupportsGroupJoin
from ._supports_intersect import SupportsIntersect
from ._supports_join import SupportsJoin
from ._supports_max import SupportsMax
from ._supports_min import SupportsMin
from ._supports_of_type import SupportsOfType
from ._supports_order import SupportsOrder
from ._supports_prepend import SupportsPrepend
from ._supports_reverse import SupportsReverse
from ._supports_select import SupportsSelect
from ._supports_sequence_equal import SupportsSequenceEqual
from ._supports_single import SupportsSingle
from ._supports_skip import SupportsSkip
from ._supports_sum import SupportsSum
from ._supports_take import SupportsTake
from ._supports_union import SupportsUnion
from ._supports_where import SupportsWhere
from ._supports_zip import SupportsZip
from ._associable import Associable
from ._enumerable import Enumerable

__all__ = ["Associable", "Enumerable"]
62 changes: 30 additions & 32 deletions pyenumerable/protocol/_enumerable.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
from typing import Protocol

from . import (
SupportsAggregate,
SupportsAll,
SupportsAny,
SupportsAppend,
SupportsAverage,
SupportsChunk,
SupportsConcat,
SupportsContains,
SupportsCount,
SupportsDistinct,
SupportsExcept,
SupportsGroupBy,
SupportsGroupJoin,
SupportsIntersect,
SupportsJoin,
SupportsMax,
SupportsMin,
SupportsOfType,
SupportsOrder,
SupportsPrepend,
SupportsReverse,
SupportsSelect,
SupportsSequenceEqual,
SupportsSingle,
SupportsSkip,
SupportsSum,
SupportsTake,
SupportsUnion,
SupportsWhere,
SupportsZip,
)
from ._supports_aggregate import SupportsAggregate
from ._supports_all import SupportsAll
from ._supports_any import SupportsAny
from ._supports_append import SupportsAppend
from ._supports_average import SupportsAverage
from ._supports_chunk import SupportsChunk
from ._supports_concat import SupportsConcat
from ._supports_contains import SupportsContains
from ._supports_count import SupportsCount
from ._supports_distinct import SupportsDistinct
from ._supports_except import SupportsExcept
from ._supports_group_by import SupportsGroupBy
from ._supports_group_join import SupportsGroupJoin
from ._supports_intersect import SupportsIntersect
from ._supports_join import SupportsJoin
from ._supports_max import SupportsMax
from ._supports_min import SupportsMin
from ._supports_of_type import SupportsOfType
from ._supports_order import SupportsOrder
from ._supports_prepend import SupportsPrepend
from ._supports_reverse import SupportsReverse
from ._supports_select import SupportsSelect
from ._supports_sequence_equal import SupportsSequenceEqual
from ._supports_single import SupportsSingle
from ._supports_skip import SupportsSkip
from ._supports_sum import SupportsSum
from ._supports_take import SupportsTake
from ._supports_union import SupportsUnion
from ._supports_where import SupportsWhere
from ._supports_zip import SupportsZip


class Enumerable[TSource](
Expand Down
7 changes: 3 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Implementation of .NET's [IEnumerable](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1?view=net-9.0) interface in python W/ support for generics.

## Issue tracker
### 1.0.0
### v1.0.x
- [x] Design protocols for each operation set
- [x] Design & Implement `Enumerable` constructor(s) for PP implementation
- [x] Add pure python implementation of `Enumerable` (assuming inputs aren't guaranteed to be `Hashable` or immutable & maintaining order)
Expand Down Expand Up @@ -39,8 +39,7 @@ Implementation of .NET's [IEnumerable](https://learn.microsoft.com/en-us/dotnet/
- [x] Max
- [x] remove `Comparable` bind from type variables
- [x] Publish on pypi
### 1.0.1
- [x] Add project links to `pyproject.toml`
### 1.1.0
- [ ] Add external wrapper constructor
### v1.1.x
- [ ] Improve test code quality
- [ ] Add hashed pure python implementation of `Enumerable` (assuming inputs are guaranteed to be `Hashable` & immutable & not maintaining order)