Skip to content

Commit

Permalink
chore: conform flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejnovak committed Aug 16, 2023
1 parent e056759 commit 70c79f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mplhep/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def iterable_not_string(arg):
# Check if iterable
if iterable_not_string(kwargs[kwarg]):
# Check if tuple (can be used for colors)
if type(kwargs[kwarg]) == tuple:
if isinstance(kwargs[kwarg], tuple):
for i in range(len(_chunked_kwargs)):
_chunked_kwargs[i][kwarg] = kwargs[kwarg]
else:
Expand Down Expand Up @@ -946,7 +946,7 @@ def _draw_text_bbox(ax):
Draw legend() and fetch it's bbox
"""
fig = ax.figure
textboxes = [k for k in ax.get_children() if type(k) == AnchoredText]
textboxes = [k for k in ax.get_children() if isinstance(k, AnchoredText)]
if len(textboxes) > 1:
print("Warning: More than one textbox found")
for box in textboxes:
Expand Down Expand Up @@ -1179,7 +1179,7 @@ def hist_legend(ax=None, **kwargs):

handles, labels = ax.get_legend_handles_labels()
new_handles = [
Line2D([], [], c=h.get_edgecolor()) if type(h) == mpl.patches.Polygon else h
Line2D([], [], c=h.get_edgecolor()) if isinstance(h, mpl.patches.Polygon) else h
for h in handles
]
ax.legend(handles=new_handles[::-1], labels=labels[::-1], **kwargs)
Expand Down

0 comments on commit 70c79f5

Please sign in to comment.