@@ -190,7 +190,7 @@ def _check_encoding(
190190def data_kind (
191191 data : Any , required : bool = True
192192) -> Literal [
193- "arg" , "file" , "geojson" , "grid" , "image" , "matrix" , "stringio" , "vectors"
193+ "arg" , "empty" , " file" , "geojson" , "grid" , "image" , "matrix" , "stringio" , "vectors"
194194]:
195195 r"""
196196 Check the kind of data that is provided to a module.
@@ -200,6 +200,8 @@ def data_kind(
200200
201201 - ``"arg"``: ``data`` is ``None`` and ``required=False``, or bool, int, float,
202202 representing an optional argument, used for dealing with optional virtual files
203+ - ``"empty"`: ``data`` is ``None`` and ``required=True``. It means the data is given
204+ via a series of vectors like x/y/z
203205 - ``"file"``: a string or a :class:`pathlib.PurePath` object or a sequence of them,
204206 representing one or more file names
205207 - ``"geojson"``: a geo-like Python object that implements ``__geo_interface__``
@@ -209,10 +211,9 @@ def data_kind(
209211 - ``"stringio"``: a :class:`io.StringIO` object
210212 - ``"matrix"``: a 2-D array-like object that implements ``__array_interface__``
211213 (e.g., :class:`numpy.ndarray`)
212- - ``"vectors"``: ``data`` is ``None`` and ``required=True``, or any unrecognized
213- data. Common data types include, a :class:`pandas.DataFrame` object, a dictionary
214- with array-like values, a 1-D/3-D :class:`numpy.ndarray` object, or array-like
215- objects.
214+ - ``"vectors"``: any unrecognized data. Common data types include, a
215+ :class:`pandas.DataFrame` object, a dictionary with array-like values, a 1-D/3-D
216+ :class:`numpy.ndarray` object, or array-like objects.
216217
217218 Parameters
218219 ----------
@@ -242,6 +243,11 @@ def data_kind(
242243 >>> data_kind(data=None, required=False)
243244 'arg'
244245
246+ The "empty" kind:
247+
248+ >>> data_kind(data=None, required=True)
249+ 'empty'
250+
245251 The "file" kind:
246252
247253 >>> [data_kind(data=data) for data in ("file.txt", ("file1.txt", "file2.txt"))]
@@ -293,10 +299,10 @@ def data_kind(
293299 'vectors'
294300 >>> data_kind(data=pd.Series([1, 2, 3], name="x")) # pd.Series
295301 'vectors'
296- >>> data_kind(data=None)
297- 'vectors'
298302 """
299303 match data :
304+ case None if required : # No data provided and required=True.
305+ kind = "empty"
300306 case str () | pathlib .PurePath (): # One file.
301307 kind = "file"
302308 case list () | tuple () if all (
0 commit comments