Skip to content

Commit

Permalink
Update simplified_image_classifier.py (#74)
Browse files Browse the repository at this point in the history
Replace assert by IndexError. This can help to use this with __getitem__ operator in a subscriptable class
  • Loading branch information
vfdev-5 authored and kegl committed Oct 24, 2017
1 parent cea82d3 commit dc6ec6c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rampwf/workflows/simplified_image_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ def load(self, index):
"""
from skimage.io import imread

assert 0 <= index < self.nb_examples
if index < 0 or index >= self.nb_examples:
raise IndexError("list index out of range")

x = self.X_array[index]
filename = os.path.join(self.folder, '{}'.format(x))
Expand Down

0 comments on commit dc6ec6c

Please sign in to comment.