Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Iterable from collections.abc for >=3.8. #39

Merged
merged 3 commits into from
Sep 5, 2019
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
4 changes: 2 additions & 2 deletions fn/iters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import Iterable, deque
from collections import deque
from functools import partial
from itertools import (chain, combinations, cycle, dropwhile, islice, repeat,
starmap, takewhile, tee)
Expand All @@ -7,7 +7,7 @@

from .func import F
from .op import flip
from .uniform import filterfalse, zip_longest, map, range, filter
from .uniform import filterfalse, zip_longest, map, range, filter, Iterable


def take(limit, base):
Expand Down
8 changes: 4 additions & 4 deletions fn/monad.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def parameter(self, name):
from fn.monad import Option

request = dict(url="face.png", mimetype="PNG")
tp = Option(request.get("type", None)) \\ # check "type" key first
.or_call(from_mimetype, request) \\ # or... check "mimetype" key
.or_call(from_extension, request) \\# or... get "url" and check extension
.get_or("application/undefined")
tp = (Option(request.get("type", None)) # check "type" key first
.or_call(from_mimetype, request) # or.. check "mimetype" key
.or_call(from_extension, request) # or... get "url" and check extension
.get_or("application/undefined"))

"""

Expand Down
7 changes: 7 additions & 0 deletions fn/uniform.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@
else:
from itertools import filterfalse
from itertools import zip_longest

# Using or importing the ABCs from 'collections' instead of from
# 'collections.abc' is deprecated, and in 3.8 it will stop working.
if version_info[0] <= 3 and version_info[1] < 8:
from collections import Iterable
else:
from collections.abc import Iterable