Skip to content

Commit

Permalink
Only iteratively rapply on actual lists
Browse files Browse the repository at this point in the history
  • Loading branch information
jtc42 committed May 2, 2020
1 parent 2559019 commit 97c5024
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions labthings/core/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import os
import copy
import typing
from functools import reduce

PY3 = sys.version_info > (3,)
Expand Down Expand Up @@ -99,11 +100,7 @@ def rapply(data, func, *args, apply_to_iterables=True, **kwargs):
for key, val in data.items()
}
# If the object is iterable but NOT a dictionary or a string
elif apply_to_iterables and (
isinstance(data, collections.abc.Iterable)
and not isinstance(data, collections.abc.Mapping)
and not isinstance(data, str)
):
elif apply_to_iterables and (isinstance(data, typing.List)):
return [
rapply(x, func, *args, apply_to_iterables=apply_to_iterables, **kwargs)
for x in data
Expand Down

0 comments on commit 97c5024

Please sign in to comment.