Skip to content

Commit

Permalink
Fix ci mypy errros (#1012)
Browse files Browse the repository at this point in the history
  • Loading branch information
mauicv authored May 21, 2024
1 parent 5344d9b commit 4cca971
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion alibi/datasets/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def load_cats(target_size: tuple = (299, 299), return_X_y: bool = False) -> Unio
# data
img = tar.extractfile(member).read() # type: ignore[union-attr]
img = PIL.Image.open(BytesIO(img))
img = np.expand_dims(img.resize(target_size), axis=0)
img = np.array(img.resize(target_size))
img = np.expand_dims(img, axis=0)
images.append(img)

# labels
Expand Down
2 changes: 1 addition & 1 deletion alibi/explainers/pd_variance.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ def plot_pd_variance(exp: Explanation,
f"Available values are: {exp.meta['params']['target_names']}.")

if isinstance(target, numbers.Integral) \
and (target > len(exp.meta['params']['target_names'])): # type: ignore[operator]
and (target > len(exp.meta['params']['target_names'])):
raise IndexError(f"Target index out of range. Received {target}. "
f"The number of targets is {len(exp.meta['params']['target_names'])}.")

Expand Down
1 change: 1 addition & 0 deletions alibi/utils/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def visualize_image_attr(
heat_map = None
# Show original image
if ImageVisualizationMethod[method] == ImageVisualizationMethod.original_image:
assert original_image is not None
plt_axis.imshow(original_image)
else:
# Choose appropriate signed attributions and normalize.
Expand Down

0 comments on commit 4cca971

Please sign in to comment.