Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitce5d274

Browse files
committed
MNT: shorten logic + docstring
1 parentcfb27b3 commitce5d274

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎lib/matplotlib/cbook/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,7 +1708,8 @@ def safe_first_element(obj):
17081708

17091709
def_safe_first_finite(obj,*,skip_nonfinite=True):
17101710
"""
1711-
Return the first non-None element in *obj*.
1711+
Return the first non-None (and optionally finite) element in *obj*.
1712+
17121713
This is a method for internal use.
17131714
17141715
This is an type-independent way of obtaining the first non-None element,
@@ -1717,7 +1718,7 @@ def _safe_first_finite(obj, *, skip_nonfinite=True):
17171718
"""
17181719
defsafe_isfinite(val):
17191720
try:
1720-
returnnp.isfinite(val)ifnp.isscalar(val)elseTrue
1721+
returnnp.isscalar(val)andnp.isfinite(val)
17211722
exceptTypeError:
17221723
# This is something that numpy can not make heads or tails
17231724
# of, assume "finite"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp