|
numpy 2.0.0
|
#include <Python.h>#include <datetime.h>#include <time.h>#include <numpy/arrayobject.h>#include "npy_config.h"#include "numpy/npy_3kcompat.h"#include "numpy/arrayscalars.h"#include "methods.h"#include "_datetime.h"#include "datetime_strings.h"| #define _MULTIARRAYMODULE |
| #define NPY_NO_DEPRECATED_API |
| #define PY_SSIZE_T_CLEAN |
| static npy_uint64 _uint64_euclidean_gcd | ( | npy_uint64 | x, |
| npy_uint64 | y | ||
| ) | [static] |
| NPY_NO_EXPORT void add_minutes_to_datetimestruct | ( | npy_datetimestruct * | dts, |
| int | minutes | ||
| ) |
References cast_datetime_to_datetime(), NPY_DATETIME_NAT, PyDatetimeScalarObject::obmeta, PyDatetimeScalarObject::obval, and raise_if_datetime64_metadata_cast_error().
Referenced by datetime_type_promotion().
| NPY_NO_EXPORT void add_seconds_to_datetimestruct | ( | npy_datetimestruct * | dts, |
| int | seconds | ||
| ) |
| NPY_NO_EXPORT PyObject* append_metastr_to_string | ( | PyArray_DatetimeMetaData * | meta, |
| int | skip_brackets, | ||
| PyObject * | ret | ||
| ) |
Referenced by datetime_metadata_divides().
| NPY_NO_EXPORT npy_bool can_cast_datetime64_metadata | ( | PyArray_DatetimeMetaData * | src_meta, |
| PyArray_DatetimeMetaData * | dst_meta, | ||
| NPY_CASTING | casting | ||
| ) |
| NPY_NO_EXPORT npy_bool can_cast_datetime64_units | ( | NPY_DATETIMEUNIT | src_unit, |
| NPY_DATETIMEUNIT | dst_unit, | ||
| NPY_CASTING | casting | ||
| ) |
| NPY_NO_EXPORT npy_bool can_cast_timedelta64_metadata | ( | PyArray_DatetimeMetaData * | src_meta, |
| PyArray_DatetimeMetaData * | dst_meta, | ||
| NPY_CASTING | casting | ||
| ) |
Referenced by datetime_metadata_divides(), and PyArray_CanCastTo().
| NPY_NO_EXPORT npy_bool can_cast_timedelta64_units | ( | NPY_DATETIMEUNIT | src_unit, |
| NPY_DATETIMEUNIT | dst_unit, | ||
| NPY_CASTING | casting | ||
| ) |
References compute_datetime_metadata_greatest_common_divisor(), get_datetime_metadata_from_dtype(), NPY_DATETIME, NPY_TIMEDELTA, NpyCapsule_FromVoidPtr(), PyArray_free, PyArray_malloc, simple_capsule_dtor(), and _PyArray_Descr::type_num.
| NPY_NO_EXPORT int cast_datetime_to_datetime | ( | PyArray_DatetimeMetaData * | src_meta, |
| PyArray_DatetimeMetaData * | dst_meta, | ||
| npy_datetime | src_dt, | ||
| npy_datetime * | dst_dt | ||
| ) |
Referenced by add_minutes_to_datetimestruct().
| NPY_NO_EXPORT int cast_timedelta_to_timedelta | ( | PyArray_DatetimeMetaData * | src_meta, |
| PyArray_DatetimeMetaData * | dst_meta, | ||
| npy_timedelta | src_dt, | ||
| npy_timedelta * | dst_dt | ||
| ) |
| NPY_NO_EXPORT int compute_datetime_metadata_greatest_common_divisor | ( | PyArray_DatetimeMetaData * | meta1, |
| PyArray_DatetimeMetaData * | meta2, | ||
| PyArray_DatetimeMetaData * | out_meta, | ||
| int | strict_with_nonlinear_units1, | ||
| int | strict_with_nonlinear_units2 | ||
| ) |
References _datetime_strings, PyArray_DatetimeMetaData::base, PyArray_DatetimeMetaData::num, and PyBytes_FromString.
Referenced by can_cast_timedelta64_units().
| NPY_NO_EXPORT PyObject* compute_datetime_metadata_greatest_common_divisor_capsule | ( | PyArray_Descr * | type1, |
| PyArray_Descr * | type2, | ||
| int | strict_with_nonlinear_units1, | ||
| int | strict_with_nonlinear_units2 | ||
| ) |
| NPY_NO_EXPORT int convert_datetime_divisor_to_multiple | ( | PyArray_DatetimeMetaData * | meta, |
| int | den, | ||
| char * | metastr | ||
| ) |
References _datetime_strings.
| NPY_NO_EXPORT PyObject* convert_datetime_metadata_to_tuple | ( | PyArray_DatetimeMetaData * | meta | ) |
| NPY_NO_EXPORT int convert_datetime_metadata_tuple_to_datetime_metadata | ( | PyObject * | tuple, |
| PyArray_DatetimeMetaData * | out_meta | ||
| ) |
References NPY_FR_D.
| NPY_NO_EXPORT PyObject* convert_datetime_metadata_tuple_to_metacobj | ( | PyObject * | tuple | ) |
| NPY_NO_EXPORT int convert_datetime_to_datetimestruct | ( | PyArray_DatetimeMetaData * | meta, |
| npy_datetime | dt, | ||
| npy_datetimestruct * | out | ||
| ) |
| NPY_NO_EXPORT PyObject* convert_datetime_to_pyobject | ( | npy_datetime | dt, |
| PyArray_DatetimeMetaData * | meta | ||
| ) |
| NPY_NO_EXPORT int convert_datetimestruct_to_datetime | ( | PyArray_DatetimeMetaData * | meta, |
| const npy_datetimestruct * | dts, | ||
| npy_datetime * | out | ||
| ) |
Referenced by _strided_to_strided_datetime_general_cast().
| NPY_NO_EXPORT int convert_pydatetime_to_datetimestruct | ( | PyObject * | obj, |
| npy_datetimestruct * | out, | ||
| NPY_DATETIMEUNIT * | out_bestunit, | ||
| int | apply_tzinfo | ||
| ) |
| NPY_NO_EXPORT int convert_pyobject_to_datetime | ( | PyArray_DatetimeMetaData * | meta, |
| PyObject * | obj, | ||
| NPY_CASTING | casting, | ||
| npy_datetime * | out | ||
| ) |
| NPY_NO_EXPORT int convert_pyobject_to_datetime_metadata | ( | PyObject * | obj, |
| PyArray_DatetimeMetaData * | out_meta | ||
| ) |
| NPY_NO_EXPORT int convert_pyobject_to_timedelta | ( | PyArray_DatetimeMetaData * | meta, |
| PyObject * | obj, | ||
| NPY_CASTING | casting, | ||
| npy_timedelta * | out | ||
| ) |
| NPY_NO_EXPORT int convert_pyobjects_to_datetimes | ( | int | count, |
| PyObject ** | objs, | ||
| int * | type_nums, | ||
| NPY_CASTING | casting, | ||
| npy_int64 * | out_values, | ||
| PyArray_DatetimeMetaData * | inout_meta | ||
| ) |
| NPY_NO_EXPORT PyObject* convert_timedelta_to_pyobject | ( | npy_timedelta | td, |
| PyArray_DatetimeMetaData * | meta | ||
| ) |
| NPY_NO_EXPORT PyArray_Descr* create_datetime_dtype | ( | int | type_num, |
| PyArray_DatetimeMetaData * | meta | ||
| ) |
References PyArray_DatetimeMetaData::num.
Referenced by apply_business_day_count(), and business_day_offset().
| NPY_NO_EXPORT PyArray_Descr* create_datetime_dtype_with_unit | ( | int | type_num, |
| NPY_DATETIMEUNIT | unit | ||
| ) |
| NPY_NO_EXPORT PyArrayObject* datetime_arange | ( | PyObject * | start, |
| PyObject * | stop, | ||
| PyObject * | step, | ||
| PyArray_Descr * | dtype | ||
| ) |
| NPY_NO_EXPORT npy_bool datetime_metadata_divides | ( | PyArray_DatetimeMetaData * | dividend, |
| PyArray_DatetimeMetaData * | divisor, | ||
| int | strict_with_nonlinear_units | ||
| ) |
References append_metastr_to_string(), can_cast_timedelta64_metadata(), npy_casting_to_string(), PyUString_ConcatAndDel, PyUString_FromFormat, and PyUString_FromString.
| NPY_NO_EXPORT PyArray_Descr* datetime_type_promotion | ( | PyArray_Descr * | type1, |
| PyArray_Descr * | type2 | ||
| ) |
References add_minutes_to_datetimestruct(), and npy_datetimestruct::sec.
| NPY_NO_EXPORT int days_to_month_number | ( | npy_datetime | days | ) |
| static npy_int64 days_to_yearsdays | ( | npy_int64 * | days_ | ) | [static] |
References _days_per_month_table, npy_datetimestruct::day, is_leapyear(), npy_datetimestruct::month, and npy_datetimestruct::year.
Referenced by get_datetimestruct_minutes().
| NPY_NO_EXPORT PyArray_Descr* find_object_datetime_type | ( | PyObject * | obj, |
| int | type_num | ||
| ) |
| static int find_string_array_datetime64_type | ( | PyObject * | obj, |
| PyArray_DatetimeMetaData * | meta | ||
| ) | [static] |
| NPY_NO_EXPORT void get_datetime_conversion_factor | ( | PyArray_DatetimeMetaData * | src_meta, |
| PyArray_DatetimeMetaData * | dst_meta, | ||
| npy_int64 * | out_num, | ||
| npy_int64 * | out_denom | ||
| ) |
References NPY_FR_GENERIC, NPY_FR_M, NPY_SAFE_CASTING, NPY_SAME_KIND_CASTING, and NPY_UNSAFE_CASTING.
| NPY_NO_EXPORT PyObject* get_datetime_metacobj_from_dtype | ( | PyArray_Descr * | dtype | ) |
Referenced by PyArray_DatetimeToDatetimeStruct().
| NPY_NO_EXPORT PyArray_DatetimeMetaData* get_datetime_metadata_from_dtype | ( | PyArray_Descr * | dtype | ) |
Referenced by can_cast_timedelta64_units(), and PyArray_CanCastTo().
| static npy_uint64 get_datetime_units_factor | ( | NPY_DATETIMEUNIT | bigbase, |
| NPY_DATETIMEUNIT | littlebase | ||
| ) | [static] |
References NPY_FR_D, NPY_FR_GENERIC, NPY_SAME_KIND_CASTING, and NPY_UNSAFE_CASTING.
| NPY_NO_EXPORT npy_int64 get_datetimestruct_days | ( | const npy_datetimestruct * | dts | ) |
| NPY_NO_EXPORT npy_int64 get_datetimestruct_minutes | ( | const npy_datetimestruct * | dts | ) |
References _days_per_month_table, days_to_yearsdays(), and is_leapyear().
| NPY_NO_EXPORT int get_tzoffset_from_pytzinfo | ( | PyObject * | timezone, |
| npy_datetimestruct * | dts | ||
| ) |
References PyArray_DatetimeMetaData::base, and NPY_FR_W.
| NPY_NO_EXPORT npy_bool has_equivalent_datetime_metadata | ( | PyArray_Descr * | type1, |
| PyArray_Descr * | type2 | ||
| ) |
References PyArray_free.
Referenced by PyArray_ConvertClipmodeSequence().
| static npy_bool is_any_numpy_datetime | ( | PyObject * | obj | ) | [static] |
| NPY_NO_EXPORT npy_bool is_any_numpy_datetime_or_timedelta | ( | PyObject * | obj | ) |
References NPY_DATETIME, NPY_TIMEDELTA, PyArray_Check, PyArray_DESCR, and _PyArray_Descr::type_num.
| static npy_bool is_any_numpy_timedelta | ( | PyObject * | obj | ) | [static] |
| NPY_NO_EXPORT int is_leapyear | ( | npy_int64 | year | ) |
<
References npy_datetimestruct::year.
Referenced by days_to_yearsdays(), and get_datetimestruct_minutes().
| NPY_NO_EXPORT void numpy_pydatetime_import | ( | ) |
| NPY_NO_EXPORT int parse_datetime_extended_unit_from_string | ( | char * | str, |
| Py_ssize_t | len, | ||
| char * | metastr, | ||
| PyArray_DatetimeMetaData * | out_meta | ||
| ) |
| NPY_NO_EXPORT int parse_datetime_metadata_from_metastr | ( | char * | metastr, |
| Py_ssize_t | len, | ||
| PyArray_DatetimeMetaData * | out_meta | ||
| ) |
| NPY_NO_EXPORT NPY_DATETIMEUNIT parse_datetime_unit_from_string | ( | char * | str, |
| Py_ssize_t | len, | ||
| char * | metastr | ||
| ) |
References npy_datetimestruct::day, npy_datetimestruct::month, and npy_datetimestruct::year.
| NPY_NO_EXPORT PyArray_Descr* parse_dtype_from_datetime_typestr | ( | char * | typestr, |
| Py_ssize_t | len | ||
| ) |
| NPY_NO_EXPORT npy_datetime PyArray_DatetimeStructToDatetime | ( | NPY_DATETIMEUNIT | fr, |
| npy_datetimestruct * | d | ||
| ) |
References set_datetimestruct_days().
| NPY_NO_EXPORT void PyArray_DatetimeToDatetimeStruct | ( | npy_datetime | val, |
| NPY_DATETIMEUNIT | fr, | ||
| npy_datetimestruct * | result | ||
| ) |
References get_datetime_metacobj_from_dtype(), and NpyCapsule_AsVoidPtr().
| NPY_NO_EXPORT npy_datetime PyArray_TimedeltaStructToTimedelta | ( | NPY_DATETIMEUNIT | fr, |
| npy_timedeltastruct * | d | ||
| ) |
References set_datetimestruct_days().
| NPY_NO_EXPORT void PyArray_TimedeltaToTimedeltaStruct | ( | npy_timedelta | val, |
| NPY_DATETIMEUNIT | fr, | ||
| npy_timedeltastruct * | result | ||
| ) |
| NPY_NO_EXPORT int raise_if_datetime64_metadata_cast_error | ( | char * | object_type, |
| PyArray_DatetimeMetaData * | src_meta, | ||
| PyArray_DatetimeMetaData * | dst_meta, | ||
| NPY_CASTING | casting | ||
| ) |
References NPY_FR_D, NPY_FR_h, NPY_FR_m, NPY_FR_M, NPY_FR_s, NPY_FR_W, and NPY_FR_Y.
Referenced by add_minutes_to_datetimestruct().
| NPY_NO_EXPORT int raise_if_timedelta64_metadata_cast_error | ( | char * | object_type, |
| PyArray_DatetimeMetaData * | src_meta, | ||
| PyArray_DatetimeMetaData * | dst_meta, | ||
| NPY_CASTING | casting | ||
| ) |
| static int recursive_find_object_datetime64_type | ( | PyObject * | obj, |
| PyArray_DatetimeMetaData * | meta | ||
| ) | [static] |
| static int recursive_find_object_timedelta64_type | ( | PyObject * | obj, |
| PyArray_DatetimeMetaData * | meta | ||
| ) | [static] |
| static void set_datetimestruct_days | ( | npy_int64 | days, |
| npy_datetimestruct * | dts | ||
| ) | [static] |
Referenced by PyArray_DatetimeStructToDatetime(), and PyArray_TimedeltaStructToTimedelta().
npy_uint32 _datetime_factors[] [static] |
{
1,
1,
7,
24,
60,
60,
1000,
1000,
1000,
1000,
1000,
1000,
1,
0
}
| NPY_NO_EXPORT char* _datetime_strings[NPY_DATETIME_NUMUNITS] |
{
NPY_STR_Y,
NPY_STR_M,
NPY_STR_W,
NPY_STR_D,
NPY_STR_h,
NPY_STR_m,
NPY_STR_s,
NPY_STR_ms,
NPY_STR_us,
NPY_STR_ns,
NPY_STR_ps,
NPY_STR_fs,
NPY_STR_as,
"generic"
}
| NPY_NO_EXPORT int _days_per_month_table[2][12] |
{
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
}
NPY_DATETIMEUNIT _multiples_table[16][4] [static] |