Skip to content

Commit d719d6c

Browse files
committed
Fix typo. Slightly more explicit exception checking in _contains_only.
1 parent cf236fd commit d719d6c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

brainx/util.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ def _no_repeats_in_listlist(list_list):
4141
raise ValueError('{0} is not a list of lists'.format(list_list))
4242

4343
def _contains_only(container, type):
44-
"""check that contents of a container are all fo the same type"""
44+
"""check that contents of a container are all of the same type"""
4545
try:
46-
# dict
47-
return all(isinstance(s, type) for s in container.values())
48-
except:
49-
# others
50-
return all(isinstance(s,type) for s in container)
46+
container = container.values() # dict
47+
except AttributeError:
48+
pass
49+
50+
return all(isinstance(s, type) for s in container)
5151

5252
def listlist_to_listset(list_list):
5353
""" converts list of lists to a list of sets (with check)

0 commit comments

Comments
 (0)