Skip to content

Commit c40e785

Browse files
authored
Simplify checks like "x is not None or y is not None or z is not None" (#2816)
1 parent 1ef9fb4 commit c40e785

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pygmt/src/text.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def text_( # noqa: PLR0912
179179
if kind == "vectors" and text is None:
180180
raise GMTInvalidInput("Must provide text with x/y pairs")
181181
else:
182-
if x is not None or y is not None or textfiles is not None:
182+
if any(v is not None for v in (x, y, textfiles)):
183183
raise GMTInvalidInput(
184184
"Provide either position only, or x/y pairs, or textfiles."
185185
)
@@ -189,11 +189,8 @@ def text_( # noqa: PLR0912
189189
textfiles = ""
190190

191191
# Build the -F option in gmt text.
192-
if kwargs.get("F") is None and (
193-
position is not None
194-
or angle is not None
195-
or font is not None
196-
or justify is not None
192+
if kwargs.get("F") is None and any(
193+
v is not None for v in (position, angle, font, justify)
197194
):
198195
kwargs.update({"F": ""})
199196

0 commit comments

Comments
 (0)