Skip to content

Commit

Permalink
remove unused "type: ignore" comments in test_plot.py (fixed in matpl…
Browse files Browse the repository at this point in the history
…otlib 3.10.0) (#9904)
  • Loading branch information
kmuehlbauer authored Dec 18, 2024
1 parent 7612078 commit 8afed74
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions xarray/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,27 @@ def text_in_fig() -> set[str]:
"""
Return the set of all text in the figure
"""
return {t.get_text() for t in plt.gcf().findobj(mpl.text.Text)} # type: ignore[attr-defined] # mpl error?
return {t.get_text() for t in plt.gcf().findobj(mpl.text.Text)}


def find_possible_colorbars() -> list[mpl.collections.QuadMesh]:
# nb. this function also matches meshes from pcolormesh
return plt.gcf().findobj(mpl.collections.QuadMesh) # type: ignore[return-value] # mpl error?
return plt.gcf().findobj(mpl.collections.QuadMesh)


def substring_in_axes(substring: str, ax: mpl.axes.Axes) -> bool:
"""
Return True if a substring is found anywhere in an axes
"""
alltxt: set[str] = {t.get_text() for t in ax.findobj(mpl.text.Text)} # type: ignore[attr-defined] # mpl error?
alltxt: set[str] = {t.get_text() for t in ax.findobj(mpl.text.Text)}
return any(substring in txt for txt in alltxt)


def substring_not_in_axes(substring: str, ax: mpl.axes.Axes) -> bool:
"""
Return True if a substring is not found anywhere in an axes
"""
alltxt: set[str] = {t.get_text() for t in ax.findobj(mpl.text.Text)} # type: ignore[attr-defined] # mpl error?
alltxt: set[str] = {t.get_text() for t in ax.findobj(mpl.text.Text)}
check = [(substring not in txt) for txt in alltxt]
return all(check)

Expand All @@ -122,7 +122,7 @@ def property_in_axes_text(
Return True if the specified text in an axes
has the property assigned to property_str
"""
alltxt: list[mpl.text.Text] = ax.findobj(mpl.text.Text) # type: ignore[assignment]
alltxt: list[mpl.text.Text] = ax.findobj(mpl.text.Text)
return all(
plt.getp(t, property) == property_str
for t in alltxt
Expand Down

0 comments on commit 8afed74

Please sign in to comment.