Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
STY: attempt to placate mypy
Bit confused why it was not hitting these before.
  • Loading branch information
tacaswell committed Jul 3, 2023
commit 2c7f076e1284fe188535ea62fae746f2d8fa3ed6
4 changes: 4 additions & 0 deletions lib/matplotlib/cm.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class ScalarMappable:
cmap: colors.Colormap | None
colorbar: Colorbar | None
callbacks: cbook.CallbackRegistry

# private use
_A: ArrayLike | None

def __init__(
self,
norm: colors.Normalize | None = ...,
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1086,12 +1086,12 @@ def draw(*, fig: Figure | None = None) -> None:

@_copy_docstring_and_deprecators(Figure.savefig)
def savefig(*args, **kwargs) -> None:
fig = kwargs.pop('fig', None) or gcf()
# savefig default implementation has no return, so mypy is unhappy
# presumably this is here because subclasses can return?
fig = kwargs.pop('fig', None) or gcf()
res = fig.savefig(*args, **kwargs)
res = fig.savefig(*args, **kwargs) # type: ignore[func-returns-value]
fig.canvas.draw_idle() # Need this if 'transparent=True', to reset colors.
return res
return res # type: ignore[return-value]


## Putting things in figures ##
Expand Down