Skip to content

Commit 48e1378

Browse files
committed
Make _validate_data_input public and move it to Session.virtualfile_in
1 parent 318a8c4 commit 48e1378

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

pygmt/clib/session.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
data_kind,
3838
tempfile_from_geojson,
3939
tempfile_from_image,
40+
validate_data_input,
4041
)
4142

4243
FAMILIES = [
@@ -1594,6 +1595,15 @@ def virtualfile_in( # noqa: PLR0912
15941595
kind = data_kind(
15951596
data, x, y, z, required_z=required_z, required_data=required_data
15961597
)
1598+
validate_data_input(
1599+
data=data,
1600+
x=x,
1601+
y=y,
1602+
z=z,
1603+
required_z=required_z,
1604+
required_data=required_data,
1605+
kind=kind,
1606+
)
15971607

15981608
if check_kind:
15991609
valid_kinds = ("file", "arg") if required_data is False else ("file",)

pygmt/helpers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
is_nonstr_iter,
2323
launch_external_viewer,
2424
non_ascii_to_octal,
25+
validate_data_input,
2526
)
2627
from pygmt.helpers.validators import validate_output_table_type

pygmt/helpers/utils.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from pygmt.exceptions import GMTInvalidInput
2020

2121

22-
def _validate_data_input(
22+
def validate_data_input(
2323
data=None, x=None, y=None, z=None, required_z=False, required_data=True, kind=None
2424
):
2525
"""
@@ -193,15 +193,6 @@ def data_kind(data=None, x=None, y=None, z=None, required_z=False, required_data
193193
kind = "matrix"
194194
else:
195195
kind = "vectors"
196-
_validate_data_input(
197-
data=data,
198-
x=x,
199-
y=y,
200-
z=z,
201-
required_z=required_z,
202-
required_data=required_data,
203-
kind=kind,
204-
)
205196
return kind
206197

207198

0 commit comments

Comments
 (0)