Skip to content

Commit

Permalink
Fix deprecated import from colletions
Browse files Browse the repository at this point in the history
  • Loading branch information
aleju committed Dec 17, 2019
1 parent c268d36 commit 3cabaf9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelogs/master/fixed/20191217_collections_abc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Fixed Abstract Base Classes Import #527

* Fixed a deprecation warning and potential crash in python 3.8
related to the use of `collections` instead of `collections.abc`.
8 changes: 6 additions & 2 deletions imgaug/imgaug.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
import json
import types
import functools
import collections
# collections.abc exists since 3.3 and is expected to be used for 3.8+
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable

import numpy as np
import cv2
Expand Down Expand Up @@ -305,7 +309,7 @@ def is_iterable(val):
``True`` if the variable is an iterable. Otherwise ``False``.
"""
return isinstance(val, collections.Iterable)
return isinstance(val, Iterable)


# TODO convert to is_single_string() or rename is_single_integer/float/number()
Expand Down

0 comments on commit 3cabaf9

Please sign in to comment.