MCPcopy Create free account
hub / github.com/numpy/numpy / descr_is_legacy_parametric_instance

Function descr_is_legacy_parametric_instance

numpy/core/src/multiarray/descriptor.c:1407–1427  ·  view source on GitHub ↗

* Check the descriptor is a legacy "flexible" DType instance, this is * an instance which is (normally) not attached to an array, such as a string * of length 0 or a datetime with no unit. * These should be largely deprecated, and represent only the DType class * for most `dtype` parameters. * * TODO: This function should eventually receive a deprecation warning and * be removed. *

Source from the content-addressed store, hash-verified

1405 * @return 1 if this is not a concrete dtype instance 0 otherwise
1406 */
1407static int
1408descr_is_legacy_parametric_instance(PyArray_Descr *descr,
1409 PyArray_DTypeMeta *DType)
1410{
1411 if (!NPY_DT_is_legacy(DType)) {
1412 return 0;
1413 }
1414
1415 if (PyDataType_ISUNSIZED(descr)) {
1416 return 1;
1417 }
1418 /* Flexible descr with generic time unit (which can be adapted) */
1419 if (PyDataType_ISDATETIME(descr)) {
1420 PyArray_DatetimeMetaData *meta;
1421 meta = get_datetime_metadata_from_dtype(descr);
1422 if (meta->base == NPY_FR_GENERIC) {
1423 return 1;
1424 }
1425 }
1426 return 0;
1427}
1428
1429
1430/**

Callers 1

Calls 1

Tested by

no test coverage detected