Skip to content

Commit

Permalink
Merge pull request #39 from soasme/fix-3.8-warning
Browse files Browse the repository at this point in the history
Import `Iterable` from `collections.abc` for >=3.8.
  • Loading branch information
jacobbridges authored Sep 5, 2019
2 parents 486119e + e9f9dd7 commit 9958f1f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
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

0 comments on commit 9958f1f

Please sign in to comment.