NumPy-源码解析-四十四-

32 阅读1小时+

NumPy 源码解析(四十四)

.\numpy\numpy\typing\tests\data\reveal\comparisons.pyi

import sys  # 导入sys模块,用于访问与Python解释器相关的系统功能
import fractions  # 导入fractions模块,支持有理数的运算
import decimal  # 导入decimal模块,支持高精度的十进制浮点数运算
from typing import Any  # 从typing模块导入Any类型,表示任意类型的对象

import numpy as np  # 导入NumPy库并用np别名表示
import numpy.typing as npt  # 导入NumPy的类型标注模块

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果Python版本大于等于3.11,则从typing模块导入assert_type函数
else:
    from typing_extensions import assert_type  # 否则从typing_extensions模块导入assert_type函数

c16 = np.complex128()  # 创建一个复数类型为complex128的NumPy对象并赋值给c16
f8 = np.float64()  # 创建一个浮点数类型为float64的NumPy对象并赋值给f8
i8 = np.int64()  # 创建一个整数类型为int64的NumPy对象并赋值给i8
u8 = np.uint64()  # 创建一个无符号整数类型为uint64的NumPy对象并赋值给u8

c8 = np.complex64()  # 创建一个复数类型为complex64的NumPy对象并赋值给c8
f4 = np.float32()  # 创建一个浮点数类型为float32的NumPy对象并赋值给f4
i4 = np.int32()  # 创建一个整数类型为int32的NumPy对象并赋值给i4
u4 = np.uint32()  # 创建一个无符号整数类型为uint32的NumPy对象并赋值给u4

dt = np.datetime64(0, "D")  # 创建一个日期时间类型为datetime64的NumPy对象并赋值给dt
td = np.timedelta64(0, "D")  # 创建一个时间间隔类型为timedelta64的NumPy对象并赋值给td

b_ = np.bool()  # 创建一个布尔类型为bool的NumPy对象并赋值给b_

b = bool()  # 创建一个Python内置的布尔对象并赋值给b
c = complex()  # 创建一个Python内置的复数对象并赋值给c
f = float()  # 创建一个Python内置的浮点数对象并赋值给f
i = int()  # 创建一个Python内置的整数对象并赋值给i

AR = np.array([0], dtype=np.int64)  # 创建一个NumPy数组,包含一个元素0,数据类型为int64,并赋值给AR
AR.setflags(write=False)  # 设置AR数组为不可写

SEQ = (0, 1, 2, 3, 4)  # 创建一个元组SEQ,包含5个整数元素

# object-like comparisons

assert_type(i8 > fractions.Fraction(1, 5), Any)  # 断言i8与1/5的比较结果的类型为Any
assert_type(i8 > [fractions.Fraction(1, 5)], Any)  # 断言i8与包含1/5的列表的比较结果的类型为Any
assert_type(i8 > decimal.Decimal("1.5"), Any)  # 断言i8与Decimal类型的1.5的比较结果的类型为Any
assert_type(i8 > [decimal.Decimal("1.5")], Any)  # 断言i8与包含Decimal类型1.5的列表的比较结果的类型为Any

# Time structures

assert_type(dt > dt, np.bool)  # 断言日期时间对象dt与自身的比较结果的类型为NumPy布尔类型
assert_type(td > td, np.bool)  # 断言时间间隔对象td与自身的比较结果的类型为NumPy布尔类型
assert_type(td > i, np.bool)  # 断言时间间隔对象td与整数对象i的比较结果的类型为NumPy布尔类型
assert_type(td > i4, np.bool)  # 断言时间间隔对象td与整数对象i4的比较结果的类型为NumPy布尔类型
assert_type(td > i8, np.bool)  # 断言时间间隔对象td与整数对象i8的比较结果的类型为NumPy布尔类型

assert_type(td > AR, npt.NDArray[np.bool])  # 断言时间间隔对象td与NumPy数组AR的比较结果的类型为NumPy布尔数组
assert_type(td > SEQ, npt.NDArray[np.bool])  # 断言时间间隔对象td与元组SEQ的比较结果的类型为NumPy布尔数组
assert_type(AR > SEQ, npt.NDArray[np.bool])  # 断言NumPy数组AR与元组SEQ的比较结果的类型为NumPy布尔数组
assert_type(AR > td, npt.NDArray[np.bool])  # 断言NumPy数组AR与时间间隔对象td的比较结果的类型为NumPy布尔数组
assert_type(SEQ > td, npt.NDArray[np.bool])  # 断言元组SEQ与时间间隔对象td的比较结果的类型为NumPy布尔数组
assert_type(SEQ > AR, npt.NDArray[np.bool])  # 断言元组SEQ与NumPy数组AR的比较结果的类型为NumPy布尔数组

# boolean

assert_type(b_ > b, np.bool)  # 断言NumPy布尔对象b_与Python内置布尔对象b的比较结果的类型为NumPy布尔类型
assert_type(b_ > b_, np.bool)  # 断言NumPy布尔对象b_与自身的比较结果的类型为NumPy布尔类型
assert_type(b_ > i, np.bool)  # 断言NumPy布尔对象b_与整数对象i的比较结果的类型为NumPy布尔类型
assert_type(b_ > i8, np.bool)  # 断言NumPy布尔对象b_与整数对象i8的比较结果的类型为NumPy布尔类型
assert_type(b_ > i4, np.bool)  # 断言NumPy布尔对象b_与整数对象i4的比较结果的类型为NumPy布尔类型
assert_type(b_ > u8, np.bool)  # 断言NumPy布尔对象b_与无符号整数对象u8的比较结果的类型为NumPy布尔类型
assert_type(b_ > u4, np.bool)  # 断言NumPy布尔对象b_与无符号整数对象u4的比较结果的类型为NumPy布尔类型
assert_type(b_ > f, np.bool)  # 断言NumPy布尔对象b_与浮点数对象f的比较结果的类型为NumPy布尔类型
assert_type(b_ > f8, np.bool)  # 断言NumPy布尔对象b_与浮点数对象f8的比较结果的类型为NumPy布尔类型
assert_type(b_ > f4, np.bool)  # 断言NumPy布尔对象b_与浮点数对象f4的比较结果的类型为NumPy布尔类型
assert_type(b_ > c, np.bool)  # 断言NumPy布尔对象b_与复数对象c的比较结果的类型为NumPy布尔类型
assert_type(b_ > c16, np.bool)  # 断言NumPy布尔对象b_与复数对象c16的比较结果的类型为NumPy布尔类型
assert_type(b_ > c8, np.bool)  # 断言NumPy布尔对象b_与复数对象c8的比较结果的类型为NumPy布尔类型
assert_type(b_ > AR, npt.NDArray[np.bool])  # 断言NumPy布尔对象b_与NumPy数组AR的比较结果的类型为NumPy布尔数组
assert_type(b_ > SEQ, npt.NDArray[np.bool])  # 断言NumPy布尔对象b_与元组SEQ的比较结果的类型为NumPy布尔数组

# Complex

assert_type(c16 > c16, np.bool)  # 断言复数对象c16与自身的比较结果的类型为NumPy布尔类型
# 确保 c8 大于 SEQ,返回结果应为布尔值的 NumPy 数组
assert_type(c8 > SEQ, npt.NDArray[np.bool])

# 检查 c16 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(c16 > c8, np.bool)

# 检查 f8 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > c8, np.bool)

# 检查 i8 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(i8 > c8, np.bool)

# 检查 c8 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(c8 > c8, np.bool)

# 检查 f4 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > c8, np.bool)

# 检查 i4 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(i4 > c8, np.bool)

# 检查 b_ 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(b_ > c8, np.bool)

# 检查 b 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(b > c8, np.bool)

# 检查 c 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(c > c8, np.bool)

# 检查 f 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(f > c8, np.bool)

# 检查 i 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(i > c8, np.bool)

# 检查 AR 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(AR > c8, npt.NDArray[np.bool])

# 检查 SEQ 是否大于 c8,返回结果应为布尔值的 NumPy 数组
assert_type(SEQ > c8, npt.NDArray[np.bool])

# Float

# 检查 f8 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > f8, np.bool)

# 检查 f8 是否大于 i8,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > i8, np.bool)

# 检查 f8 是否大于 f4,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > f4, np.bool)

# 检查 f8 是否大于 i4,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > i4, np.bool)

# 检查 f8 是否大于 b_,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > b_, np.bool)

# 检查 f8 是否大于 b,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > b, np.bool)

# 检查 f8 是否大于 c,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > c, np.bool)

# 检查 f8 是否大于 f,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > f, np.bool)

# 检查 f8 是否大于 i,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > i, np.bool)

# 检查 f8 是否大于 AR,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > AR, npt.NDArray[np.bool])

# 检查 f8 是否大于 SEQ,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > SEQ, npt.NDArray[np.bool])

# 检查 f8 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > f8, np.bool)

# 检查 i8 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(i8 > f8, np.bool)

# 检查 f4 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > f8, np.bool)

# 检查 i4 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(i4 > f8, np.bool)

# 检查 b_ 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(b_ > f8, np.bool)

# 检查 b 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(b > f8, np.bool)

# 检查 c 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(c > f8, np.bool)

# 检查 f 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(f > f8, np.bool)

# 检查 i 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(i > f8, np.bool)

# 检查 AR 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(AR > f8, npt.NDArray[np.bool])

# 检查 SEQ 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(SEQ > f8, npt.NDArray[np.bool])

# 检查 f4 是否大于 f8,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > f8, np.bool)

# 检查 f4 是否大于 i8,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > i8, np.bool)

# 检查 f4 是否大于 f4,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > f4, np.bool)

# 检查 f4 是否大于 i4,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > i4, np.bool)

# 检查 f4 是否大于 b_,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > b_, np.bool)

# 检查 f4 是否大于 b,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > b, np.bool)

# 检查 f4 是否大于 c,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > c, np.bool)

# 检查 f4 是否大于 f,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > f, np.bool)

# 检查 f4 是否大于 i,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > i, np.bool)

# 检查 f4 是否大于 AR,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > AR, npt.NDArray[np.bool])

# 检查 f4 是否大于 SEQ,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > SEQ, npt.NDArray[np.bool])

# 检查 f8 是否大于 f4,返回结果应为布尔值的 NumPy 数组
assert_type(f8 > f4, np.bool)

# 检查 i8 是否大于 f4,返回结果应为布尔值的 NumPy 数组
assert_type(i8 > f4, np.bool)

# 检查 f4 是否大于 f4,返回结果应为布尔值的 NumPy 数组
assert_type(f4 > f4, np.bool)

# 检查 i4 是否大于 f4,返回结果应为布尔值的 NumPy 数组
assert_type(i4 > f4, np.bool)

# 检查 b_ 是否大于 f4,返回结果应为布尔值的 NumPy 数组
assert_type(b_ > f4, np.bool)

# 检查 b 是否大于 f4,返回结果应为布尔值的 NumPy 数组
assert_type(b > f4, np.bool)

# 检查 c 是否大于 f4,返回结果应为布尔值的 NumPy 数组
assert_type(c > f4, np.bool)

# 检查 f 是否大于 f4,返回结果应为布尔值的 NumPy 数组
assert_type(f > f4, np.bool)

# 检查 i 是否大于 f4,返回结果应为
# 确保变量 u4 大于变量 u8,返回布尔值
assert_type(u4 > u8, np.bool)
# 确保变量 b_ 大于变量 u8,返回布尔值
assert_type(b_ > u8, np.bool)
# 确保变量 b 大于变量 u8,返回布尔值
assert_type(b > u8, np.bool)
# 确保变量 c 大于变量 u8,返回布尔值
assert_type(c > u8, np.bool)
# 确保变量 f 大于变量 u8,返回布尔值
assert_type(f > u8, np.bool)
# 确保变量 i 大于变量 u8,返回布尔值
assert_type(i > u8, np.bool)
# 确保变量 AR 大于变量 u8,返回类型为 npt.NDArray[np.bool] 的数组
assert_type(AR > u8, npt.NDArray[np.bool])
# 确保变量 SEQ 大于变量 u8,返回类型为 npt.NDArray[np.bool] 的数组
assert_type(SEQ > u8, npt.NDArray[np.bool])

# 确保变量 i4 大于变量 i8,返回布尔值
assert_type(i4 > i8, np.bool)
# 确保变量 i4 大于变量 i4,返回布尔值
assert_type(i4 > i4, np.bool)
# 确保变量 i4 大于变量 i,返回布尔值
assert_type(i4 > i, np.bool)
# 确保变量 i4 大于变量 b_,返回布尔值
assert_type(i4 > b_, np.bool)
# 确保变量 i4 大于变量 b,返回布尔值
assert_type(i4 > b, np.bool)
# 确保变量 i4 大于变量 AR,返回类型为 npt.NDArray[np.bool] 的数组
assert_type(i4 > AR, npt.NDArray[np.bool])
# 确保变量 i4 大于变量 SEQ,返回类型为 npt.NDArray[np.bool] 的数组
assert_type(i4 > SEQ, npt.NDArray[np.bool])

# 确保变量 u4 大于变量 i8,返回布尔值
assert_type(u4 > i8, np.bool)
# 确保变量 u4 大于变量 i4,返回布尔值
assert_type(u4 > i4, np.bool)
# 确保变量 u4 大于变量 u8,返回布尔值
assert_type(u4 > u8, np.bool)
# 确保变量 u4 大于变量 u4,返回布尔值
assert_type(u4 > u4, np.bool)
# 确保变量 u4 大于变量 i,返回布尔值
assert_type(u4 > i, np.bool)
# 确保变量 u4 大于变量 b_,返回布尔值
assert_type(u4 > b_, np.bool)
# 确保变量 u4 大于变量 b,返回布尔值
assert_type(u4 > b, np.bool)
# 确保变量 u4 大于变量 AR,返回类型为 npt.NDArray[np.bool] 的数组
assert_type(u4 > AR, npt.NDArray[np.bool])
# 确保变量 u4 大于变量 SEQ,返回类型为 npt.NDArray[np.bool] 的数组
assert_type(u4 > SEQ, npt.NDArray[np.bool])

# 确保变量 i8 大于变量 i4,返回布尔值
assert_type(i8 > i4, np.bool)
# 确保变量 i4 大于变量 i4,返回布尔值
assert_type(i4 > i4, np.bool)
# 确保变量 i 大于变量 i4,返回布尔值
assert_type(i > i4, np.bool)
# 确保变量 b_ 大于变量 i4,返回布尔值
assert_type(b_ > i4, np.bool)
# 确保变量 b 大于变量 i4,返回布尔值
assert_type(b > i4, np.bool)
# 确保变量 AR 大于变量 i4,返回类型为 npt.NDArray[np.bool] 的数组
assert_type(AR > i4, npt.NDArray[np.bool])
# 确保变量 SEQ 大于变量 i4,返回类型为 npt.NDArray[np.bool] 的数组
assert_type(SEQ > i4, npt.NDArray[np.bool])

# 确保变量 i8 大于变量 u4,返回布尔值
assert_type(i8 > u4, np.bool)
# 确保变量 i4 大于变量 u4,返回布尔值
assert_type(i4 > u4, np.bool)
# 确保变量 u8 大于变量 u4,返回布尔值
assert_type(u8 > u4, np.bool)
# 确保变量 u4 大于变量 u4,返回布尔值
assert_type(u4 > u4, np.bool)
# 确保变量 b_ 大于变量 u4,返回布尔值
assert_type(b_ > u4, np.bool)
# 确保变量 b 大于变量 u4,返回布尔值
assert_type(b > u4, np.bool)
# 确保变量 i 大于变量 u4,返回布尔值
assert_type(i > u4, np.bool)
# 确保变量 AR 大于变量 u4,返回类型为 npt.NDArray[np.bool] 的数组
assert_type(AR > u4, npt.NDArray[np.bool])
# 确保变量 SEQ 大于变量 u4,返回类型为 npt.NDArray[np.bool] 的数组
assert_type(SEQ > u4, npt.NDArray[np.bool])

.\numpy\numpy\typing\tests\data\reveal\constants.pyi

# 导入 sys 模块,用于访问系统相关的功能
import sys

# 导入 numpy 库,并将其命名为 np,以便使用其提供的数学函数和数据结构
import numpy as np

# 根据 Python 解释器版本号,选择合适的 assert_type 函数进行导入
if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    from typing_extensions import assert_type

# 使用 assert_type 函数检查 np.e 是否为 float 类型
assert_type(np.e, float)
# 使用 assert_type 函数检查 np.euler_gamma 是否为 float 类型
assert_type(np.euler_gamma, float)
# 使用 assert_type 函数检查 np.inf 是否为 float 类型
assert_type(np.inf, float)
# 使用 assert_type 函数检查 np.nan 是否为 float 类型
assert_type(np.nan, float)
# 使用 assert_type 函数检查 np.pi 是否为 float 类型
assert_type(np.pi, float)

# 使用 assert_type 函数检查 np.little_endian 是否为 bool 类型
assert_type(np.little_endian, bool)
# 使用 assert_type 函数检查 np.True_ 是否为 np.bool 类型
assert_type(np.True_, np.bool)
# 使用 assert_type 函数检查 np.False_ 是否为 np.bool 类型
assert_type(np.False_, np.bool)

.\numpy\numpy\typing\tests\data\reveal\ctypeslib.pyi

import sys  # 导入sys模块,用于系统相关的操作
import ctypes as ct  # 导入ctypes模块,并使用别名ct,用于与C语言兼容的数据类型和函数接口
from typing import Any  # 从typing模块中导入Any类型,表示可以是任意类型的对象

import numpy as np  # 导入NumPy库,并使用别名np,用于科学计算
import numpy.typing as npt  # 导入NumPy的类型提示模块,用于类型注解
from numpy import ctypeslib  # 从NumPy中导入ctypeslib模块,用于NumPy数组和C类型之间的转换

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果Python版本大于等于3.11,则从typing模块中导入assert_type函数
else:
    from typing_extensions import assert_type  # 否则从typing_extensions模块中导入assert_type函数

AR_bool: npt.NDArray[np.bool]  # AR_bool为NumPy数组类型注解,元素类型为布尔型
AR_ubyte: npt.NDArray[np.ubyte]  # AR_ubyte为NumPy数组类型注解,元素类型为无符号字节型
AR_ushort: npt.NDArray[np.ushort]  # AR_ushort为NumPy数组类型注解,元素类型为无符号短整型
AR_uintc: npt.NDArray[np.uintc]  # AR_uintc为NumPy数组类型注解,元素类型为无符号整型
AR_ulong: npt.NDArray[np.ulong]  # AR_ulong为NumPy数组类型注解,元素类型为无符号长整型
AR_ulonglong: npt.NDArray[np.ulonglong]  # AR_ulonglong为NumPy数组类型注解,元素类型为无符号长长整型
AR_byte: npt.NDArray[np.byte]  # AR_byte为NumPy数组类型注解,元素类型为字节型
AR_short: npt.NDArray[np.short]  # AR_short为NumPy数组类型注解,元素类型为短整型
AR_intc: npt.NDArray[np.intc]  # AR_intc为NumPy数组类型注解,元素类型为整型
AR_long: npt.NDArray[np.long]  # AR_long为NumPy数组类型注解,元素类型为长整型
AR_longlong: npt.NDArray[np.longlong]  # AR_longlong为NumPy数组类型注解,元素类型为长长整型
AR_single: npt.NDArray[np.single]  # AR_single为NumPy数组类型注解,元素类型为单精度浮点型
AR_double: npt.NDArray[np.double]  # AR_double为NumPy数组类型注解,元素类型为双精度浮点型
AR_longdouble: npt.NDArray[np.longdouble]  # AR_longdouble为NumPy数组类型注解,元素类型为长双精度浮点型
AR_void: npt.NDArray[np.void]  # AR_void为NumPy数组类型注解,元素类型为空类型

pointer: ct._Pointer[Any]  # pointer为ctypes指针类型注解,可以指向任意类型的对象

assert_type(np.ctypeslib.c_intp(), ctypeslib.c_intp)  # 断言np.ctypeslib.c_intp()的类型为ctypeslib.c_intp类型

assert_type(np.ctypeslib.ndpointer(), type[ctypeslib._ndptr[None]])  # 断言np.ctypeslib.ndpointer()的类型为ctypeslib._ndptr[None]类型
assert_type(np.ctypeslib.ndpointer(dtype=np.float64), type[ctypeslib._ndptr[np.dtype[np.float64]]])  # 断言np.ctypeslib.ndpointer(dtype=np.float64)的类型为ctypeslib._ndptr[np.dtype[np.float64]]类型
assert_type(np.ctypeslib.ndpointer(dtype=float), type[ctypeslib._ndptr[np.dtype[Any]]])  # 断言np.ctypeslib.ndpointer(dtype=float)的类型为ctypeslib._ndptr[np.dtype[Any]]类型
assert_type(np.ctypeslib.ndpointer(shape=(10, 3)), type[ctypeslib._ndptr[None]])  # 断言np.ctypeslib.ndpointer(shape=(10, 3))的类型为ctypeslib._ndptr[None]类型
assert_type(np.ctypeslib.ndpointer(np.int64, shape=(10, 3)), type[ctypeslib._concrete_ndptr[np.dtype[np.int64]]])  # 断言np.ctypeslib.ndpointer(np.int64, shape=(10, 3))的类型为ctypeslib._concrete_ndptr[np.dtype[np.int64]]类型
assert_type(np.ctypeslib.ndpointer(int, shape=(1,)), type[np.ctypeslib._concrete_ndptr[np.dtype[Any]]])  # 断言np.ctypeslib.ndpointer(int, shape=(1,))的类型为np.ctypeslib._concrete_ndptr[np.dtype[Any]]类型

assert_type(np.ctypeslib.as_ctypes_type(np.bool), type[ct.c_bool])  # 断言np.ctypeslib.as_ctypes_type(np.bool)的类型为ct.c_bool类型
assert_type(np.ctypeslib.as_ctypes_type(np.ubyte), type[ct.c_ubyte])  # 断言np.ctypeslib.as_ctypes_type(np.ubyte)的类型为ct.c_ubyte类型
assert_type(np.ctypeslib.as_ctypes_type(np.ushort), type[ct.c_ushort])  # 断言np.ctypeslib.as_ctypes_type(np.ushort)的类型为ct.c_ushort类型
assert_type(np.ctypeslib.as_ctypes_type(np.uintc), type[ct.c_uint])  # 断言np.ctypeslib.as_ctypes_type(np.uintc)的类型为ct.c_uint类型
assert_type(np.ctypeslib.as_ctypes_type(np.byte), type[ct.c_byte])  # 断言np.ctypeslib.as_ctypes_type(np.byte)的类型为ct.c_byte类型
assert_type(np.ctypeslib.as_ctypes_type(np.short), type[ct.c_short])  # 断言np.ctypeslib.as_ctypes_type(np.short)的类型为ct.c_short类型
assert_type(np.ctypeslib.as_ctypes_type(np.intc), type[ct.c_int])  # 断言np.ctypeslib.as_ctypes_type(np.intc)的类型为ct.c_int类型
assert_type(np.ctypeslib.as_ctypes_type(np.single), type[ct.c_float])  # 断言np.ctypeslib.as_ctypes_type(np.single)的类型为ct.c_float类型
assert_type(np.ctypeslib.as_ctypes_type(np.double), type[ct.c_double])  # 断言np.ctypeslib.as_ctypes_type(np.double)的类型为ct.c_double类型
assert_type(np.ctypeslib.as_ctypes_type(ct.c_double), type[ct.c_double])  # 断言np.ctypeslib.as_ctypes_type(ct.c_double)的类型为ct.c_double类型
assert_type(np.ctypeslib.as_ctypes_type("q"), type[ct.c_longlong])  # 断言np.ctypeslib.as_ctypes_type("q")的类型为ct.c_longlong类型
assert_type(np.ctypeslib.as_ctypes_type([("i8", np.int64), ("f8", np.float64)]), type[Any])  # 断言np.ctypeslib.as_ctypes_type([("i8", np.int64), ("f8", np.float64)])的类型为Any类型
assert_type(np.ctypeslib.as_ctypes_type("i8"), type[Any])  # 断言np.ctypeslib.as_ctypes_type("i8")的类型为Any类型
assert_type(np.ctypeslib.as_ctypes_type("f8"), type[Any])  # 断言np.ctypeslib.as_ctypes_type("f8")的类型为Any类型

assert_type(np.ctypeslib.as_ctypes(AR_bool.take(0)), ct.c_bool)  # 断言np.ctypeslib.as_ctypes(AR_bool.take(0))的类型为ct.c_bool类型
assert_type(np.ctypeslib.as_ctypes(AR_ubyte.take(0)), ct.c_ubyte)  # 断言np.ctypeslib.as_ctypes(AR_ubyte.take(0))的类型为ct.c_ubyte类型
assert_type(np.ctypeslib.as_ctypes(AR_ushort.take(0)), ct.c_ushort)  # 断言np.ctypeslib.as_ctypes(AR_ushort.take(0))的类型为ct.c_ushort类型
assert_type(np.ctypeslib.as_ctypes(AR_uintc.take(0)), ct.c_uint)  # 断言np.ctypeslib.as_ctypes(AR_uintc.take(0))的类型为ct.c_uint类型

assert_type(np.ctypeslib.as_ctypes(AR_byte.take(0)),
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 Any 类型
assert_type(np.ctypeslib.as_ctypes(AR_void.take(0)), Any)
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_bool] 类型
assert_type(np.ctypeslib.as_ctypes(AR_bool), ct.Array[ct.c_bool])
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_ubyte] 类型
assert_type(np.ctypeslib.as_ctypes(AR_ubyte), ct.Array[ct.c_ubyte])
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_ushort] 类型
assert_type(np.ctypeslib.as_ctypes(AR_ushort), ct.Array[ct.c_ushort])
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_uint] 类型
assert_type(np.ctypeslib.as_ctypes(AR_uintc), ct.Array[ct.c_uint])
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_byte] 类型
assert_type(np.ctypeslib.as_ctypes(AR_byte), ct.Array[ct.c_byte])
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_short] 类型
assert_type(np.ctypeslib.as_ctypes(AR_short), ct.Array[ct.c_short])
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_int] 类型
assert_type(np.ctypeslib.as_ctypes(AR_intc), ct.Array[ct.c_int])
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_float] 类型
assert_type(np.ctypeslib.as_ctypes(AR_single), ct.Array[ct.c_float])
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_double] 类型
assert_type(np.ctypeslib.as_ctypes(AR_double), ct.Array[ct.c_double])
# 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[Any] 类型
assert_type(np.ctypeslib.as_ctypes(AR_void), ct.Array[Any])

# 检查 np.ctypeslib.as_array 函数返回值的类型是否为 npt.NDArray[np.ubyte] 类型
assert_type(np.ctypeslib.as_array(AR_ubyte), npt.NDArray[np.ubyte])
# 检查 np.ctypeslib.as_array 函数返回值的类型是否为 npt.NDArray[Any] 类型
assert_type(np.ctypeslib.as_array(1), npt.NDArray[Any])
# 检查 np.ctypeslib.as_array 函数返回值的类型是否为 npt.NDArray[Any] 类型
assert_type(np.ctypeslib.as_array(pointer), npt.NDArray[Any])

# 根据操作系统平台检查和断言以下类型映射关系
if sys.platform == "win32":
    # 当操作系统为 Windows 时,np.long 对应的 ctypes 类型为 ct.c_int 类型
    assert_type(np.ctypeslib.as_ctypes_type(np.long), type[ct.c_int])
    # 当操作系统为 Windows 时,np.ulong 对应的 ctypes 类型为 ct.c_uint 类型
    assert_type(np.ctypeslib.as_ctypes_type(np.ulong), type[ct.c_uint])
    # 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_uint] 类型
    assert_type(np.ctypeslib.as_ctypes(AR_ulong), ct.Array[ct.c_uint])
    # 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_int] 类型
    assert_type(np.ctypeslib.as_ctypes(AR_long), ct.Array[ct.c_int])
    # 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.c_int 类型
    assert_type(np.ctypeslib.as_ctypes(AR_long.take(0)), ct.c_int)
    # 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.c_uint 类型
    assert_type(np.ctypeslib.as_ctypes(AR_ulong.take(0)), ct.c_uint)
else:
    # 当操作系统不为 Windows 时,np.long 对应的 ctypes 类型为 ct.c_long 类型
    assert_type(np.ctypeslib.as_ctypes_type(np.long), type[ct.c_long])
    # 当操作系统不为 Windows 时,np.ulong 对应的 ctypes 类型为 ct.c_ulong 类型
    assert_type(np.ctypeslib.as_ctypes_type(np.ulong), type[ct.c_ulong])
    # 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_ulong] 类型
    assert_type(np.ctypeslib.as_ctypes(AR_ulong), ct.Array[ct.c_ulong])
    # 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.Array[ct.c_long] 类型
    assert_type(np.ctypeslib.as_ctypes(AR_long), ct.Array[ct.c_long])
    # 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.c_long 类型
    assert_type(np.ctypeslib.as_ctypes(AR_long.take(0)), ct.c_long)
    # 检查 np.ctypeslib.as_ctypes 函数返回值的类型是否为 ct.c_ulong 类型
    assert_type(np.ctypeslib.as_ctypes(AR_ulong.take(0)), ct.c_ulong)

.\numpy\numpy\typing\tests\data\reveal\datasource.pyi

# 导入系统模块 sys
import sys
# 导入路径处理模块 Path 从 typing 模块导入 IO 和 Any 类型
from pathlib import Path
from typing import IO, Any

# 导入 numpy 库
import numpy as np

# 如果 Python 版本大于等于 3.11,则从 typing 模块导入 assert_type 函数
if sys.version_info >= (3, 11):
    from typing import assert_type
# 否则,从 typing_extensions 模块导入 assert_type 函数
else:
    from typing_extensions import assert_type

# 声明变量 path1 为 Path 类型
path1: Path
# 声明变量 path2 为 str 类型
path2: str

# 使用 path1 创建一个 numpy 的 DataSource 对象 d1
d1 = np.lib.npyio.DataSource(path1)
# 使用 path2 创建一个 numpy 的 DataSource 对象 d2
d2 = np.lib.npyio.DataSource(path2)
# 创建一个没有指定路径的 numpy 的 DataSource 对象 d3
d3 = np.lib.npyio.DataSource(None)

# 对 d1 的 abspath 方法的返回类型进行断言,应为 str 类型
assert_type(d1.abspath("..."), str)
# 对 d2 的 abspath 方法的返回类型进行断言,应为 str 类型
assert_type(d2.abspath("..."), str)
# 对 d3 的 abspath 方法的返回类型进行断言,应为 str 类型
assert_type(d3.abspath("..."), str)

# 对 d1 的 exists 方法的返回类型进行断言,应为 bool 类型
assert_type(d1.exists("..."), bool)
# 对 d2 的 exists 方法的返回类型进行断言,应为 bool 类型
assert_type(d2.exists("..."), bool)
# 对 d3 的 exists 方法的返回类型进行断言,应为 bool 类型
assert_type(d3.exists("..."), bool)

# 对 d1 的 open 方法的返回类型进行断言,应为 IO[Any] 类型
assert_type(d1.open("...", "r"), IO[Any])
# 对 d2 的 open 方法的返回类型进行断言,应为 IO[Any] 类型,且指定编码为 utf8
assert_type(d2.open("...", encoding="utf8"), IO[Any])
# 对 d3 的 open 方法的返回类型进行断言,应为 IO[Any] 类型,且指定换行符为 /n
assert_type(d3.open("...", newline="/n"), IO[Any])

.\numpy\numpy\typing\tests\data\reveal\dtype.pyi

import sys
import ctypes as ct               # 导入 ctypes 库并使用别名 ct
from typing import Any           # 导入 typing 库中的 Any 类型

import numpy as np               # 导入 numpy 库并使用别名 np

if sys.version_info >= (3, 11):  # 检查 Python 版本是否大于等于 3.11
    from typing import assert_type  # 如果是,导入 typing 库中的 assert_type 函数
else:
    from typing_extensions import assert_type  # 否则,导入 typing_extensions 库中的 assert_type 函数

dtype_U: np.dtype[np.str_]       # 定义变量 dtype_U,类型为 numpy 的 str 类型
dtype_V: np.dtype[np.void]       # 定义变量 dtype_V,类型为 numpy 的 void 类型
dtype_i8: np.dtype[np.int64]     # 定义变量 dtype_i8,类型为 numpy 的 int64 类型

assert_type(np.dtype(np.float64), np.dtype[np.float64])  # 断言验证 np.float64 类型与其自身的类型相等
assert_type(np.dtype(np.float64, metadata={"test": "test"}), np.dtype[np.float64])  # 断言验证带元数据的 np.float64 类型与其自身的类型相等
assert_type(np.dtype(np.int64), np.dtype[np.int64])      # 断言验证 np.int64 类型与其自身的类型相等

# String aliases
assert_type(np.dtype("float64"), np.dtype[np.float64])    # 断言验证字符串别名 "float64" 与 np.float64 类型相等
assert_type(np.dtype("float32"), np.dtype[np.float32])    # 断言验证字符串别名 "float32" 与 np.float32 类型相等
assert_type(np.dtype("int64"), np.dtype[np.int64])        # 断言验证字符串别名 "int64" 与 np.int64 类型相等
assert_type(np.dtype("int32"), np.dtype[np.int32])        # 断言验证字符串别名 "int32" 与 np.int32 类型相等
assert_type(np.dtype("bool"), np.dtype[np.bool])          # 断言验证字符串别名 "bool" 与 np.bool 类型相等
assert_type(np.dtype("bytes"), np.dtype[np.bytes_])       # 断言验证字符串别名 "bytes" 与 np.bytes_ 类型相等
assert_type(np.dtype("str"), np.dtype[np.str_])           # 断言验证字符串别名 "str" 与 np.str_ 类型相等

# Python types
assert_type(np.dtype(complex), np.dtype[np.cdouble])      # 断言验证 Python 复数类型与 np.cdouble 类型相等
assert_type(np.dtype(float), np.dtype[np.double])         # 断言验证 Python 浮点数类型与 np.double 类型相等
assert_type(np.dtype(int), np.dtype[np.int_])             # 断言验证 Python 整数类型与 np.int_ 类型相等
assert_type(np.dtype(bool), np.dtype[np.bool])            # 断言验证 Python 布尔类型与 np.bool 类型相等
assert_type(np.dtype(str), np.dtype[np.str_])             # 断言验证 Python 字符串类型与 np.str_ 类型相等
assert_type(np.dtype(bytes), np.dtype[np.bytes_])         # 断言验证 Python 字节类型与 np.bytes_ 类型相等
assert_type(np.dtype(object), np.dtype[np.object_])       # 断言验证 Python 对象类型与 np.object_ 类型相等

# ctypes
assert_type(np.dtype(ct.c_double), np.dtype[np.double])   # 断言验证 ctypes 的 c_double 类型与 np.double 类型相等
assert_type(np.dtype(ct.c_longlong), np.dtype[np.longlong])  # 断言验证 ctypes 的 c_longlong 类型与 np.longlong 类型相等
assert_type(np.dtype(ct.c_uint32), np.dtype[np.uint32])    # 断言验证 ctypes 的 c_uint32 类型与 np.uint32 类型相等
assert_type(np.dtype(ct.c_bool), np.dtype[np.bool])        # 断言验证 ctypes 的 c_bool 类型与 np.bool 类型相等
assert_type(np.dtype(ct.c_char), np.dtype[np.bytes_])      # 断言验证 ctypes 的 c_char 类型与 np.bytes_ 类型相等
assert_type(np.dtype(ct.py_object), np.dtype[np.object_])  # 断言验证 ctypes 的 py_object 类型与 np.object_ 类型相等

# Special case for None
assert_type(np.dtype(None), np.dtype[np.double])           # 断言验证 None 类型与 np.double 类型相等

# Dtypes of dtypes
assert_type(np.dtype(np.dtype(np.float64)), np.dtype[np.float64])  # 断言验证 np.dtype(np.float64) 类型与 np.float64 类型相等

# Parameterized dtypes
assert_type(np.dtype("S8"), np.dtype[Any])                 # 断言验证参数化的 dtype "S8" 与 Any 类型相等

# Void
assert_type(np.dtype(("U", 10)), np.dtype[np.void])        # 断言验证 void 类型的 dtype ("U", 10) 与 np.void 类型相等

# Methods and attributes
assert_type(dtype_U.base, np.dtype[Any])                   # 断言验证 dtype_U 的 base 属性类型为 Any
assert_type(dtype_U.subdtype, None | tuple[np.dtype[Any], tuple[int, ...]])  # 断言验证 dtype_U 的 subdtype 属性为 None 或 (dtype[Any], tuple[int, ...])
assert_type(dtype_U.newbyteorder(), np.dtype[np.str_])      # 断言验证 dtype_U 调用 newbyteorder() 方法返回 np.str_ 类型
assert_type(dtype_U.type, type[np.str_])                    # 断言验证 dtype_U 的 type 属性为 type[np.str_]
assert_type(dtype_U.name, str)                              # 断言验证 dtype_U 的 name 属性为 str 类型
assert_type(dtype_U.names, None | tuple[str, ...])          # 断言验证 dtype_U 的 names 属性为 None 或 (str, ...)

assert_type(dtype_U * 0, np.dtype[np.str_])                 # 断言验证 dtype_U 乘以 0 的结果为 np.str_ 类型
assert_type(dtype_U * 1, np.dtype[np.str_])                 # 断言验证 dtype_U 乘以 1 的结果为 np.str_ 类型
assert_type(dtype_U * 2, np.dtype[np.str_])                 # 断言验证 dtype_U 乘以 2 的结果为 np.str_ 类型

assert_type(dtype_i8 * 0, np.dtype[np.void])               # 断言验证 dtype_i8 乘以 0 的结果为 np.void 类型
assert_type(dtype_i8 * 1, np.dtype[np.int64])              # 断言验证 dtype_i8 乘以 1 的结果为 np.int64 类型
assert_type(dtype_i8 * 2, np.dtype[np.void])               # 断言验证 dtype_i8 乘以 2 的结果为 np.void 类型

assert_type(0 * dtype_U, np.dtype[np.str_])                 # 断言验证 0 乘以 dtype_U 的结果为 np.str_ 类型
assert_type(1 * dtype_U, np.dtype[np.str_])                 # 断言验证 1 乘以 dtype_U 的结果为 np.str_ 类型
assert_type(2 * dtype_U, np.dtype[np.str_])                 # 断言验证 2 乘以 dtype_U 的结果为 np.str_ 类型

assert_type(0 * dtype_i8, np.dtype[Any])                    # 断言验证 0 乘以 dtype_i8 的结果为 Any 类型
assert_type(1 * dtype_i8, np.dtype[Any])                    # 断言验证 1 乘以 dtype_i8 的结果为 Any 类型
assert_type(2 * dtype_i8, np.dtype[Any])                    # 断言验证 2 乘以 dtype_i8 的结果为 Any 类型

assert_type(dtype_V["f0"], np.dtype[Any])                   # 断言验证 dtype_V 的索引 "f0" 结果为 Any 类型
assert_type(dtype_V[0], np.dtype[Any])                      # 断言验证 dtype_V 的索引 0 结果为 Any 类型
assert_type(dtype_V[["f0", "f1"]], np.dtype[np.void])       # 断言验证 dtype_V 的复合索引 ["f0", "f1"] 结果为 np.void 类型
assert_type(dtype_V[["f0"]], np.dtype[np.void])             # 断言验证 dtype_V 的复合索引 ["f0"] 结果为 np.void 类型

.\numpy\numpy\typing\tests\data\reveal\einsumfunc.pyi

# 导入 sys 模块,用于版本信息检查
import sys
# 导入 Any 类型,用于类型提示
from typing import Any

# 导入 numpy 库
import numpy as np
# 导入 numpy.typing 库,用于类型提示
import numpy.typing as npt

# 如果 Python 版本大于等于 3.11,导入 typing 模块的 assert_type 函数
if sys.version_info >= (3, 11):
    from typing import assert_type
# 否则,从 typing_extensions 模块导入 assert_type 函数
else:
    from typing_extensions import assert_type

# 定义不同类型的列表变量
AR_LIKE_b: list[bool]
AR_LIKE_u: list[np.uint32]
AR_LIKE_i: list[int]
AR_LIKE_f: list[float]
AR_LIKE_c: list[complex]
AR_LIKE_U: list[str]
AR_o: npt.NDArray[np.object_]

# 定义输出类型为 np.float64 的数组变量
OUT_f: npt.NDArray[np.float64]

# 使用 assert_type 函数验证 np.einsum 函数的返回类型
assert_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_b), Any)
assert_type(np.einsum("i,i->i", AR_o, AR_o), Any)
assert_type(np.einsum("i,i->i", AR_LIKE_u, AR_LIKE_u), Any)
assert_type(np.einsum("i,i->i", AR_LIKE_i, AR_LIKE_i), Any)
assert_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f), Any)
assert_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c), Any)
assert_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i), Any)
assert_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c), Any)

# 使用 assert_type 函数验证 np.einsum 函数的返回类型,并指定输出数组类型为 np.float64
assert_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c, out=OUT_f), npt.NDArray[np.float64])
# 使用 assert_type 函数验证 np.einsum 函数的返回类型,并指定输入 dtype 和 casting 类型
assert_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe", out=OUT_f), npt.NDArray[np.float64])
# 使用 assert_type 函数验证 np.einsum 函数的返回类型,并指定输入 dtype 类型
assert_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f, dtype="c16"), Any)
# 使用 assert_type 函数验证 np.einsum 函数的返回类型,并指定输入 dtype 和 casting 类型
assert_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe"), Any)

# 使用 assert_type 函数验证 np.einsum_path 函数的返回类型
assert_type(np.einsum_path("i,i->i", AR_LIKE_b, AR_LIKE_b), tuple[list[Any], str])
assert_type(np.einsum_path("i,i->i", AR_LIKE_u, AR_LIKE_u), tuple[list[Any], str])
assert_type(np.einsum_path("i,i->i", AR_LIKE_i, AR_LIKE_i), tuple[list[Any], str])
assert_type(np.einsum_path("i,i->i", AR_LIKE_f, AR_LIKE_f), tuple[list[Any], str])
assert_type(np.einsum_path("i,i->i", AR_LIKE_c, AR_LIKE_c), tuple[list[Any], str])
assert_type(np.einsum_path("i,i->i", AR_LIKE_b, AR_LIKE_i), tuple[list[Any], str])
assert_type(np.einsum_path("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c), tuple[list[Any], str])

# 使用 assert_type 函数验证 np.einsum 函数的返回类型
assert_type(np.einsum([[1, 1], [1, 1]], AR_LIKE_i, AR_LIKE_i), Any)
# 使用 assert_type 函数验证 np.einsum_path 函数的返回类型
assert_type(np.einsum_path([[1, 1], [1, 1]], AR_LIKE_i, AR_LIKE_i), tuple[list[Any], str])

.\numpy\numpy\typing\tests\data\reveal\emath.pyi

import sys
from typing import Any  # 导入 Any 类型

import numpy as np  # 导入 NumPy 库
import numpy.typing as npt  # 导入 NumPy 的类型标注模块

if sys.version_info >= (3, 11):
    from typing import assert_type  # Python 版本大于等于 3.11 使用标准库中的 assert_type
else:
    from typing_extensions import assert_type  # 否则使用 typing_extensions 库中的 assert_type

AR_f8: npt.NDArray[np.float64]  # 声明 AR_f8 变量为 np.float64 类型的 NumPy 数组
AR_c16: npt.NDArray[np.complex128]  # 声明 AR_c16 变量为 np.complex128 类型的 NumPy 数组
f8: np.float64  # 声明 f8 变量为 np.float64 类型
c16: np.complex128  # 声明 c16 变量为 np.complex128 类型

assert_type(np.emath.sqrt(f8), Any)  # 断言 np.emath.sqrt(f8) 的返回类型为 Any
assert_type(np.emath.sqrt(AR_f8), npt.NDArray[Any])  # 断言 np.emath.sqrt(AR_f8) 的返回类型为 npt.NDArray[Any]
assert_type(np.emath.sqrt(c16), np.complexfloating[Any, Any])  # 断言 np.emath.sqrt(c16) 的返回类型为 np.complexfloating[Any, Any]
assert_type(np.emath.sqrt(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.emath.sqrt(AR_c16) 的返回类型为 npt.NDArray[np.complexfloating[Any, Any]]

assert_type(np.emath.log(f8), Any)  # 断言 np.emath.log(f8) 的返回类型为 Any
assert_type(np.emath.log(AR_f8), npt.NDArray[Any])  # 断言 np.emath.log(AR_f8) 的返回类型为 npt.NDArray[Any]
assert_type(np.emath.log(c16), np.complexfloating[Any, Any])  # 断言 np.emath.log(c16) 的返回类型为 np.complexfloating[Any, Any]
assert_type(np.emath.log(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.emath.log(AR_c16) 的返回类型为 npt.NDArray[np.complexfloating[Any, Any]]

assert_type(np.emath.log10(f8), Any)  # 断言 np.emath.log10(f8) 的返回类型为 Any
assert_type(np.emath.log10(AR_f8), npt.NDArray[Any])  # 断言 np.emath.log10(AR_f8) 的返回类型为 npt.NDArray[Any]
assert_type(np.emath.log10(c16), np.complexfloating[Any, Any])  # 断言 np.emath.log10(c16) 的返回类型为 np.complexfloating[Any, Any]
assert_type(np.emath.log10(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.emath.log10(AR_c16) 的返回类型为 npt.NDArray[np.complexfloating[Any, Any]]

assert_type(np.emath.log2(f8), Any)  # 断言 np.emath.log2(f8) 的返回类型为 Any
assert_type(np.emath.log2(AR_f8), npt.NDArray[Any])  # 断言 np.emath.log2(AR_f8) 的返回类型为 npt.NDArray[Any]
assert_type(np.emath.log2(c16), np.complexfloating[Any, Any])  # 断言 np.emath.log2(c16) 的返回类型为 np.complexfloating[Any, Any]
assert_type(np.emath.log2(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.emath.log2(AR_c16) 的返回类型为 npt.NDArray[np.complexfloating[Any, Any]]

assert_type(np.emath.logn(f8, 2), Any)  # 断言 np.emath.logn(f8, 2) 的返回类型为 Any
assert_type(np.emath.logn(AR_f8, 4), npt.NDArray[Any])  # 断言 np.emath.logn(AR_f8, 4) 的返回类型为 npt.NDArray[Any]
assert_type(np.emath.logn(f8, 1j), np.complexfloating[Any, Any])  # 断言 np.emath.logn(f8, 1j) 的返回类型为 np.complexfloating[Any, Any]
assert_type(np.emath.logn(AR_c16, 1.5), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.emath.logn(AR_c16, 1.5) 的返回类型为 npt.NDArray[np.complexfloating[Any, Any]]

assert_type(np.emath.power(f8, 2), Any)  # 断言 np.emath.power(f8, 2) 的返回类型为 Any
assert_type(np.emath.power(AR_f8, 4), npt.NDArray[Any])  # 断言 np.emath.power(AR_f8, 4) 的返回类型为 npt.NDArray[Any]
assert_type(np.emath.power(f8, 2j), np.complexfloating[Any, Any])  # 断言 np.emath.power(f8, 2j) 的返回类型为 np.complexfloating[Any, Any]
assert_type(np.emath.power(AR_c16, 1.5), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.emath.power(AR_c16, 1.5) 的返回类型为 npt.NDArray[np.complexfloating[Any, Any]]

assert_type(np.emath.arccos(f8), Any)  # 断言 np.emath.arccos(f8) 的返回类型为 Any
assert_type(np.emath.arccos(AR_f8), npt.NDArray[Any])  # 断言 np.emath.arccos(AR_f8) 的返回类型为 npt.NDArray[Any]
assert_type(np.emath.arccos(c16), np.complexfloating[Any, Any])  # 断言 np.emath.arccos(c16) 的返回类型为 np.complexfloating[Any, Any]
assert_type(np.emath.arccos(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.emath.arccos(AR_c16) 的返回类型为 npt.NDArray[np.complexfloating[Any, Any]]

assert_type(np.emath.arcsin(f8), Any)  # 断言 np.emath.arcsin(f8) 的返回类型为 Any
assert_type(np.emath.arcsin(AR_f8), npt.NDArray[Any])  # 断言 np.emath.arcsin(AR_f8) 的返回类型为 npt.NDArray[Any]
assert_type(np.emath.arcsin(c16), np.complexfloating[Any, Any])  # 断言 np.emath.arcsin(c16) 的返回类型为 np.complexfloating[Any, Any]
assert_type(np.emath.arcsin(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.emath.arcsin(AR_c16) 的返回类型为 npt.NDArray[np.complexfloating[Any, Any]]

assert_type(np.emath.arctanh(f8), Any)  # 断言 np.emath.arctanh(f8) 的返回类型为 Any
assert_type(np.emath.arctanh(AR_f8), npt.NDArray[Any])  # 断言 np.emath.arctanh(AR_f8) 的返回类型为 npt.NDArray[Any]
assert_type(np.emath.arctanh(c16), np.complexfloating[Any, Any])  # 断言 np.emath.arctanh(c16) 的返回类型为 np.complexfloating[Any, Any]
assert_type(np.emath.arctanh(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.emath.arctanh(AR_c16) 的返回类型为 npt.NDArray[np.complexfloating[Any, Any]]

.\numpy\numpy\typing\tests\data\reveal\false_positives.pyi

# 导入 sys 模块,用于访问系统相关信息
import sys
# 导入 Any 类型用于类型提示
from typing import Any

# 导入 numpy 库并将其命名为 np
import numpy as np
# 导入 numpy.typing 中的 npt 模块,用于类型提示
import numpy.typing as npt

# 如果 Python 版本大于等于 3.11,则从 typing 模块中导入 assert_type 函数
if sys.version_info >= (3, 11):
    from typing import assert_type
# 否则,从 typing_extensions 模块中导入 assert_type 函数
else:
    from typing_extensions import assert_type

# 定义 AR_Any 变量,类型为 npt.NDArray[Any]
AR_Any: npt.NDArray[Any]

# 由于 Mypy 的一个 bug,它忽略了 `Any` 参数化类型的重载歧义;
# 参考 numpy/numpy#20099 和 python/mypy#11347
#
# 期望的输出应该类似于 `npt.NDArray[Any]`
assert_type(AR_Any + 2, npt.NDArray[np.signedinteger[Any]])

.\numpy\numpy\typing\tests\data\reveal\fft.pyi

import sys
from typing import Any  # 导入 Any 类型

import numpy as np  # 导入 NumPy 库
import numpy.typing as npt  # 导入 NumPy 的类型定义模块

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果 Python 版本大于等于 3.11,则导入 assert_type 函数
else:
    from typing_extensions import assert_type  # 否则导入 typing_extensions 模块中的 assert_type 函数

AR_f8: npt.NDArray[np.float64]  # 定义 AR_f8 变量的类型注解为 np.float64 类型的 NumPy 数组
AR_c16: npt.NDArray[np.complex128]  # 定义 AR_c16 变量的类型注解为 np.complex128 类型的 NumPy 数组
AR_LIKE_f8: list[float]  # 定义 AR_LIKE_f8 变量的类型注解为 float 类型的列表

assert_type(np.fft.fftshift(AR_f8), npt.NDArray[np.float64])  # 断言 np.fft.fftshift 函数返回的类型符合 npt.NDArray[np.float64]
assert_type(np.fft.fftshift(AR_LIKE_f8, axes=0), npt.NDArray[Any])  # 断言 np.fft.fftshift 函数返回的类型符合 npt.NDArray[Any]

assert_type(np.fft.ifftshift(AR_f8), npt.NDArray[np.float64])  # 断言 np.fft.ifftshift 函数返回的类型符合 npt.NDArray[np.float64]
assert_type(np.fft.ifftshift(AR_LIKE_f8, axes=0), npt.NDArray[Any])  # 断言 np.fft.ifftshift 函数返回的类型符合 npt.NDArray[Any]

assert_type(np.fft.fftfreq(5, AR_f8), npt.NDArray[np.floating[Any]])  # 断言 np.fft.fftfreq 函数返回的类型符合 npt.NDArray[np.floating[Any]]
assert_type(np.fft.fftfreq(np.int64(), AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.fft.fftfreq 函数返回的类型符合 npt.NDArray[np.complexfloating[Any, Any]]

assert_type(np.fft.fftfreq(5, AR_f8), npt.NDArray[np.floating[Any]])  # 断言 np.fft.fftfreq 函数返回的类型符合 npt.NDArray[np.floating[Any]]
assert_type(np.fft.fftfreq(np.int64(), AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 断言 np.fft.fftfreq 函数返回的类型符合 npt.NDArray[np.complexfloating[Any, Any]]

assert_type(np.fft.fft(AR_f8), npt.NDArray[np.complex128])  # 断言 np.fft.fft 函数返回的类型符合 npt.NDArray[np.complex128]
assert_type(np.fft.ifft(AR_f8, axis=1), npt.NDArray[np.complex128])  # 断言 np.fft.ifft 函数返回的类型符合 npt.NDArray[np.complex128]
assert_type(np.fft.rfft(AR_f8, n=None), npt.NDArray[np.complex128])  # 断言 np.fft.rfft 函数返回的类型符合 npt.NDArray[np.complex128]
assert_type(np.fft.irfft(AR_f8, norm="ortho"), npt.NDArray[np.float64])  # 断言 np.fft.irfft 函数返回的类型符合 npt.NDArray[np.float64]
assert_type(np.fft.hfft(AR_f8, n=2), npt.NDArray[np.float64])  # 断言 np.fft.hfft 函数返回的类型符合 npt.NDArray[np.float64]
assert_type(np.fft.ihfft(AR_f8), npt.NDArray[np.complex128])  # 断言 np.fft.ihfft 函数返回的类型符合 npt.NDArray[np.complex128]

assert_type(np.fft.fftn(AR_f8), npt.NDArray[np.complex128])  # 断言 np.fft.fftn 函数返回的类型符合 npt.NDArray[np.complex128]
assert_type(np.fft.ifftn(AR_f8), npt.NDArray[np.complex128])  # 断言 np.fft.ifftn 函数返回的类型符合 npt.NDArray[np.complex128]
assert_type(np.fft.rfftn(AR_f8), npt.NDArray[np.complex128])  # 断言 np.fft.rfftn 函数返回的类型符合 npt.NDArray[np.complex128]
assert_type(np.fft.irfftn(AR_f8), npt.NDArray[np.float64])  # 断言 np.fft.irfftn 函数返回的类型符合 npt.NDArray[np.float64]

assert_type(np.fft.rfft2(AR_f8), npt.NDArray[np.complex128])  # 断言 np.fft.rfft2 函数返回的类型符合 npt.NDArray[np.complex128]
assert_type(np.fft.ifft2(AR_f8), npt.NDArray[np.complex128])  # 断言 np.fft.ifft2 函数返回的类型符合 npt.NDArray[np.complex128]
assert_type(np.fft.fft2(AR_f8), npt.NDArray[np.complex128])  # 断言 np.fft.fft2 函数返回的类型符合 npt.NDArray[np.complex128]
assert_type(np.fft.irfft2(AR_f8), npt.NDArray[np.float64])  # 断言 np.fft.irfft2 函数返回的类型符合 npt.NDArray[np.float64]

.\numpy\numpy\typing\tests\data\reveal\flatiter.pyi

# 导入系统模块
import sys
# 导入类型提示模块中的 Any 类型
from typing import Any

# 导入 NumPy 库及其类型提示模块
import numpy as np
import numpy.typing as npt

# 根据 Python 版本选择合适的类型断言模块
if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    from typing_extensions import assert_type

# 声明变量 a 为 NumPy 的 flatiter 对象,其元素类型是 np.str_
a: np.flatiter[npt.NDArray[np.str_]]

# 断言 a 的基础数据类型为 npt.NDArray[np.str_]
assert_type(a.base, npt.NDArray[np.str_])
# 断言 a 的复制对象的数据类型为 npt.NDArray[np.str_]
assert_type(a.copy(), npt.NDArray[np.str_])
# 断言 a 的坐标元组的数据类型为 tuple[int, ...]
assert_type(a.coords, tuple[int, ...])
# 断言 a 的索引的数据类型为 int
assert_type(a.index, int)
# 断言 a 的迭代器的数据类型为 np.flatiter[npt.NDArray[np.str_]]
assert_type(iter(a), np.flatiter[npt.NDArray[np.str_]])
# 断言 a 的下一个元素的数据类型为 np.str_
assert_type(next(a), np.str_)
# 断言 a 的第一个元素的数据类型为 np.str_
assert_type(a[0], np.str_)
# 断言 a 的指定索引处的元素的数据类型为 npt.NDArray[np.str_]
assert_type(a[[0, 1, 2]], npt.NDArray[np.str_])
# 断言 a 的完整切片的数据类型为 npt.NDArray[np.str_]
assert_type(a[...], npt.NDArray[np.str_])
# 断言 a 的全部切片的数据类型为 npt.NDArray[np.str_]
assert_type(a[:], npt.NDArray[np.str_])
# 断言 a 的元组切片的数据类型为 npt.NDArray[np.str_]
assert_type(a[(...,)], npt.NDArray[np.str_])
# 断言 a 的元组索引的数据类型为 np.str_
assert_type(a[(0,)], np.str_)
# 断言 a 转换为数组的数据类型为 npt.NDArray[np.str_]
assert_type(a.__array__(), npt.NDArray[np.str_])
# 断言 a 指定转换为指定类型数组的数据类型为 npt.NDArray[np.float64]
assert_type(a.__array__(np.dtype(np.float64)), npt.NDArray[np.float64])

# 将 a 的第一个元素赋值为字符串 "a"
a[0] = "a"
# 将 a 的前五个元素赋值为字符串 "a"
a[:5] = "a"
# 将 a 的所有元素赋值为字符串 "a"
a[...] = "a"
# 将 a 的所有元素赋值为字符串 "a",使用元组索引
a[(...,)] = "a"

.\numpy\numpy\typing\tests\data\reveal\fromnumeric.pyi

"""Tests for :mod:`_core.fromnumeric`."""

# 导入系统和类型相关的模块
import sys
from typing import Any

# 导入 NumPy 库及其类型提示模块
import numpy as np
import numpy.typing as npt

# 根据 Python 版本导入不同的 assert_type 函数
if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    from typing_extensions import assert_type

# 定义一个 NumPy 的子类 NDArraySubclass,继承自 npt.NDArray[np.complex128]
class NDArraySubclass(npt.NDArray[np.complex128]):
    ...

# 声明一些 NumPy 数组的类型注解
AR_b: npt.NDArray[np.bool]      # 布尔类型的 NumPy 数组
AR_f4: npt.NDArray[np.float32]  # 单精度浮点数类型的 NumPy 数组
AR_c16: npt.NDArray[np.complex128]  # 复数类型的 NumPy 数组
AR_u8: npt.NDArray[np.uint64]   # 64 位无符号整数类型的 NumPy 数组
AR_i8: npt.NDArray[np.int64]    # 64 位有符号整数类型的 NumPy 数组
AR_O: npt.NDArray[np.object_]   # Python 对象类型的 NumPy 数组
AR_subclass: NDArraySubclass    # 自定义的 NumPy 数组子类 NDArraySubclass

# 声明一些普通的 Python 变量
b: np.bool       # 布尔类型变量
f4: np.float32   # 单精度浮点数类型变量
i8: np.int64     # 64 位有符号整数类型变量
f: float         # 浮点数类型变量

# 使用 assert_type 函数验证不同 NumPy 函数返回值的类型
assert_type(np.take(b, 0), np.bool)
assert_type(np.take(f4, 0), np.float32)
assert_type(np.take(f, 0), Any)
assert_type(np.take(AR_b, 0), np.bool)
assert_type(np.take(AR_f4, 0), np.float32)
assert_type(np.take(AR_b, [0]), npt.NDArray[np.bool])
assert_type(np.take(AR_f4, [0]), npt.NDArray[np.float32])
assert_type(np.take([1], [0]), npt.NDArray[Any])
assert_type(np.take(AR_f4, [0], out=AR_subclass), NDArraySubclass)

assert_type(np.reshape(b, 1), npt.NDArray[np.bool])
assert_type(np.reshape(f4, 1), npt.NDArray[np.float32])
assert_type(np.reshape(f, 1), npt.NDArray[Any])
assert_type(np.reshape(AR_b, 1), npt.NDArray[np.bool])
assert_type(np.reshape(AR_f4, 1), npt.NDArray[np.float32])

assert_type(np.choose(1, [True, True]), Any)
assert_type(np.choose([1], [True, True]), npt.NDArray[Any])
assert_type(np.choose([1], AR_b), npt.NDArray[np.bool])
assert_type(np.choose([1], AR_b, out=AR_f4), npt.NDArray[np.float32])

assert_type(np.repeat(b, 1), npt.NDArray[np.bool])
assert_type(np.repeat(f4, 1), npt.NDArray[np.float32])
assert_type(np.repeat(f, 1), npt.NDArray[Any])
assert_type(np.repeat(AR_b, 1), npt.NDArray[np.bool])
assert_type(np.repeat(AR_f4, 1), npt.NDArray[np.float32])

# TODO: array_bdd tests for np.put()

assert_type(np.swapaxes([[0, 1]], 0, 0), npt.NDArray[Any])
assert_type(np.swapaxes(AR_b, 0, 0), npt.NDArray[np.bool])
assert_type(np.swapaxes(AR_f4, 0, 0), npt.NDArray[np.float32])

assert_type(np.transpose(b), npt.NDArray[np.bool])
assert_type(np.transpose(f4), npt.NDArray[np.float32])
assert_type(np.transpose(f), npt.NDArray[Any])
assert_type(np.transpose(AR_b), npt.NDArray[np.bool])
assert_type(np.transpose(AR_f4), npt.NDArray[np.float32])

assert_type(np.partition(b, 0, axis=None), npt.NDArray[np.bool])
assert_type(np.partition(f4, 0, axis=None), npt.NDArray[np.float32])
assert_type(np.partition(f, 0, axis=None), npt.NDArray[Any])
assert_type(np.partition(AR_b, 0), npt.NDArray[np.bool])
assert_type(np.partition(AR_f4, 0), npt.NDArray[np.float32])

assert_type(np.argpartition(b, 0), npt.NDArray[np.intp])
assert_type(np.argpartition(f4, 0), npt.NDArray[np.intp])
assert_type(np.argpartition(f, 0), npt.NDArray[np.intp])
assert_type(np.argpartition(AR_b, 0), npt.NDArray[np.intp])
assert_type(np.argpartition(AR_f4, 0), npt.NDArray[np.intp])

assert_type(np.sort([2, 1], 0), npt.NDArray[Any])
assert_type(np.sort(AR_b, 0), npt.NDArray[np.bool])
# 确保 AR_f4 按列排序后的类型为 np.float32 的 NumPy 数组
assert_type(np.sort(AR_f4, 0), npt.NDArray[np.float32])

# 确保 AR_b 按列排序后的类型为 np.intp 的 NumPy 数组
assert_type(np.argsort(AR_b, 0), npt.NDArray[np.intp])
# 确保 AR_f4 按列排序后的类型为 np.intp 的 NumPy 数组
assert_type(np.argsort(AR_f4, 0), npt.NDArray[np.intp])

# 确保 AR_b 的最大值索引的类型为 np.intp
assert_type(np.argmax(AR_b), np.intp)
# 确保 AR_f4 的最大值索引的类型为 np.intp
assert_type(np.argmax(AR_f4), np.intp)
# 确保 AR_b 按列最大值索引的类型为 Any
assert_type(np.argmax(AR_b, axis=0), Any)
# 确保 AR_f4 按列最大值索引的类型为 Any
assert_type(np.argmax(AR_f4, axis=0), Any)
# 确保 AR_f4 按列最大值索引并将结果存入 AR_subclass 的类型为 NDArraySubclass
assert_type(np.argmax(AR_f4, out=AR_subclass), NDArraySubclass)

# 确保 AR_b 的最小值索引的类型为 np.intp
assert_type(np.argmin(AR_b), np.intp)
# 确保 AR_f4 的最小值索引的类型为 np.intp
assert_type(np.argmin(AR_f4), np.intp)
# 确保 AR_b 按列最小值索引的类型为 Any
assert_type(np.argmin(AR_b, axis=0), Any)
# 确保 AR_f4 按列最小值索引的类型为 Any
assert_type(np.argmin(AR_f4, axis=0), Any)
# 确保 AR_f4 按列最小值索引并将结果存入 AR_subclass 的类型为 NDArraySubclass
assert_type(np.argmin(AR_f4, out=AR_subclass), NDArraySubclass)

# 确保在 AR_b[0] 中搜索 0 的索引的类型为 np.intp
assert_type(np.searchsorted(AR_b[0], 0), np.intp)
# 确保在 AR_f4[0] 中搜索 0 的索引的类型为 np.intp
assert_type(np.searchsorted(AR_f4[0], 0), np.intp)
# 确保在 AR_b[0] 中搜索 [0] 的索引的类型为 npt.NDArray[np.intp]
assert_type(np.searchsorted(AR_b[0], [0]), npt.NDArray[np.intp])
# 确保在 AR_f4[0] 中搜索 [0] 的索引的类型为 npt.NDArray[np.intp]
assert_type(np.searchsorted(AR_f4[0], [0]), npt.NDArray[np.intp])

# 确保将 b 调整为 (5, 5) 大小的数组的类型为 npt.NDArray[np.bool]
assert_type(np.resize(b, (5, 5)), npt.NDArray[np.bool])
# 确保将 f4 调整为 (5, 5) 大小的数组的类型为 npt.NDArray[np.float32]
assert_type(np.resize(f4, (5, 5)), npt.NDArray[np.float32])
# 确保将 f 调整为 (5, 5) 大小的数组的类型为 npt.NDArray[Any]
assert_type(np.resize(f, (5, 5)), npt.NDArray[Any])
# 确保将 AR_b 调整为 (5, 5) 大小的数组的类型为 npt.NDArray[np.bool]
assert_type(np.resize(AR_b, (5, 5)), npt.NDArray[np.bool])
# 确保将 AR_f4 调整为 (5, 5) 大小的数组的类型为 npt.NDArray[np.float32]
assert_type(np.resize(AR_f4, (5, 5)), npt.NDArray[np.float32])

# 确保将 b 去除所有维度为 1 的条目后的类型为 np.bool
assert_type(np.squeeze(b), np.bool)
# 确保将 f4 去除所有维度为 1 的条目后的类型为 np.float32
assert_type(np.squeeze(f4), np.float32)
# 确保将 f 去除所有维度为 1 的条目后的类型为 npt.NDArray[Any]
assert_type(np.squeeze(f), npt.NDArray[Any])
# 确保将 AR_b 去除所有维度为 1 的条目后的类型为 npt.NDArray[np.bool]
assert_type(np.squeeze(AR_b), npt.NDArray[np.bool])
# 确保将 AR_f4 去除所有维度为 1 的条目后的类型为 npt.NDArray[np.float32]
assert_type(np.squeeze(AR_f4), npt.NDArray[np.float32])

# 确保返回 AR_b 的对角线元素的类型为 npt.NDArray[np.bool]
assert_type(np.diagonal(AR_b), npt.NDArray[np.bool])
# 确保返回 AR_f4 的对角线元素的类型为 npt.NDArray[np.float32]
assert_type(np.diagonal(AR_f4), npt.NDArray[np.float32])

# 确保返回 AR_b 的对角线元素的和的类型为 Any
assert_type(np.trace(AR_b), Any)
# 确保返回 AR_f4 的对角线元素的和的类型为 Any
assert_type(np.trace(AR_f4), Any)
# 确保返回 AR_f4 的对角线元素的和并将结果存入 AR_subclass 的类型为 NDArraySubclass
assert_type(np.trace(AR_f4, out=AR_subclass), NDArraySubclass)

# 确保将 b 扁平化后的类型为 npt.NDArray[np.bool]
assert_type(np.ravel(b), npt.NDArray[np.bool])
# 确保将 f4 扁平化后的类型为 npt.NDArray[np.float32]
assert_type(np.ravel(f4), npt.NDArray[np.float32])
# 确保将 f 扁平化后的类型为 npt.NDArray[Any]
assert_type(np.ravel(f), npt.NDArray[Any])
# 确保将 AR_b 扁平化后的类型为 npt.NDArray[np.bool]
assert_type(np.ravel(AR_b), npt.NDArray[np.bool])
# 确保将 AR_f4 扁平化后的类型为 npt.NDArray[np.float32]
assert_type(np.ravel(AR_f4), npt.NDArray[np.float32])

# 确保返回 b 中非零元素的索引的类型为 tuple[npt.NDArray[np.intp], ...]
assert_type(np.nonzero(b), tuple[npt.NDArray[np.intp], ...])
# 确保返回 f4 中非零元素的索引的类型为 tuple[npt.NDArray[np.intp], ...]
assert_type(np.nonzero(f4), tuple[npt.NDArray[np.intp], ...])
# 确保返回 f 中非零元素的索引的类型为 tuple[npt.NDArray[np.intp], ...]
assert_type(np.nonzero(f), tuple[npt.NDArray[np.intp], ...])
# 确保返回 AR_b 中非零元素的索引的类型为 tuple[npt.NDArray[np.intp], ...]
assert_type(np.nonzero(AR_b), tuple[npt.NDArray[np.intp], ...])
# 确保返回 AR_f4 中非零元素的索引的类型为 tuple[npt.NDArray[np.intp], ...]
assert_type(np.nonzero(AR_f4), tuple[npt.NDArray[np.intp], ...])

# 确保返回 b 的形状的类型为 tuple[int, ...]
assert_type(np.shape(b), tuple[int, ...])
# 确保返回 f4 的形状的类型为 tuple[int, ...]
assert_type(np.shape(f4), tuple[int, ...])
# 确保返回 f 的形状的类型为 tuple[int, ...]
assert_type(np.shape(f), tuple[int, ...])
# 确保返回 AR_b 的形状的类型为 tuple[int, ...]
assert_type(np.shape(AR_b), tuple[int, ...])
# 确保返回 AR_f4 的形状的类型为 tuple[int, ...]
assert_type(np
# 断言:检查 np.clip 函数对 AR_b 进行裁剪后的输出类型是否为 NDArraySubclass 类型
assert_type(np.clip(AR_b, 0, 1, out=AR_subclass), NDArraySubclass)

# 断言:检查 np.sum 函数对数组 b 的输出类型是否为 np.bool 类型
assert_type(np.sum(b), np.bool)
# 断言:检查 np.sum 函数对数组 f4 的输出类型是否为 np.float32 类型
assert_type(np.sum(f4), np.float32)
# 断言:检查 np.sum 函数对数组 f 的输出类型是否为 Any(任意类型)
assert_type(np.sum(f), Any)
# 断言:检查 np.sum 函数对数组 AR_b 的输出类型是否为 np.bool 类型
assert_type(np.sum(AR_b), np.bool)
# 断言:检查 np.sum 函数对数组 AR_f4 的输出类型是否为 np.float32 类型
assert_type(np.sum(AR_f4), np.float32)
# 断言:检查 np.sum 函数对数组 AR_b 指定轴向(axis=0)进行操作后的输出类型是否为 Any(任意类型)
assert_type(np.sum(AR_b, axis=0), Any)
# 断言:检查 np.sum 函数对数组 AR_f4 指定轴向(axis=0)进行操作后的输出类型是否为 Any(任意类型)
assert_type(np.sum(AR_f4, axis=0), Any)
# 断言:检查 np.sum 函数对数组 AR_f4 输出到指定的 AR_subclass 对象后的输出类型是否为 NDArraySubclass 类型
assert_type(np.sum(AR_f4, out=AR_subclass), NDArraySubclass)

# 断言:检查 np.all 函数对数组 b 的输出类型是否为 np.bool 类型
assert_type(np.all(b), np.bool)
# 断言:检查 np.all 函数对数组 f4 的输出类型是否为 np.bool 类型
assert_type(np.all(f4), np.bool)
# 断言:检查 np.all 函数对数组 f 的输出类型是否为 np.bool 类型
assert_type(np.all(f), np.bool)
# 断言:检查 np.all 函数对数组 AR_b 的输出类型是否为 np.bool 类型
assert_type(np.all(AR_b), np.bool)
# 断言:检查 np.all 函数对数组 AR_f4 的输出类型是否为 np.bool 类型
assert_type(np.all(AR_f4), np.bool)
# 断言:检查 np.all 函数对数组 AR_b 指定轴向(axis=0)进行操作后的输出类型是否为 Any(任意类型)
assert_type(np.all(AR_b, axis=0), Any)
# 断言:检查 np.all 函数对数组 AR_f4 指定轴向(axis=0)进行操作后的输出类型是否为 Any(任意类型)
assert_type(np.all(AR_f4, axis=0), Any)
# 断言:检查 np.all 函数对数组 AR_b 保持维度(keepdims=True)后的输出类型是否为 Any(任意类型)
assert_type(np.all(AR_b, keepdims=True), Any)
# 断言:检查 np.all 函数对数组 AR_f4 保持维度(keepdims=True)后的输出类型是否为 Any(任意类型)
assert_type(np.all(AR_f4, keepdims=True), Any)
# 断言:检查 np.all 函数对数组 AR_f4 输出到指定的 AR_subclass 对象后的输出类型是否为 NDArraySubclass 类型
assert_type(np.all(AR_f4, out=AR_subclass), NDArraySubclass)

# 断言:检查 np.any 函数对数组 b 的输出类型是否为 np.bool 类型
assert_type(np.any(b), np.bool)
# 断言:检查 np.any 函数对数组 f4 的输出类型是否为 np.bool 类型
assert_type(np.any(f4), np.bool)
# 断言:检查 np.any 函数对数组 f 的输出类型是否为 np.bool 类型
assert_type(np.any(f), np.bool)
# 断言:检查 np.any 函数对数组 AR_b 的输出类型是否为 np.bool 类型
assert_type(np.any(AR_b), np.bool)
# 断言:检查 np.any 函数对数组 AR_f4 的输出类型是否为 np.bool 类型
assert_type(np.any(AR_f4), np.bool)
# 断言:检查 np.any 函数对数组 AR_b 指定轴向(axis=0)进行操作后的输出类型是否为 Any(任意类型)
assert_type(np.any(AR_b, axis=0), Any)
# 断言:检查 np.any 函数对数组 AR_f4 指定轴向(axis=0)进行操作后的输出类型是否为 Any(任意类型)
assert_type(np.any(AR_f4, axis=0), Any)
# 断言:检查 np.any 函数对数组 AR_b 保持维度(keepdims=True)后的输出类型是否为 Any(任意类型)
assert_type(np.any(AR_b, keepdims=True), Any)
# 断言:检查 np.any 函数对数组 AR_f4 保持维度(keepdims=True)后的输出类型是否为 Any(任意类型)
assert_type(np.any(AR_f4, keepdims=True), Any)
# 断言:检查 np.any 函数对数组 AR_f4 输出到指定的 AR_subclass 对象后的输出类型是否为 NDArraySubclass 类型
assert_type(np.any(AR_f4, out=AR_subclass), NDArraySubclass)

# 断言:检查 np.cumsum 函数对数组 b 的输出类型是否为 npt.NDArray[np.bool] 类型
assert_type(np.cumsum(b), npt.NDArray[np.bool])
# 断言:检查 np.cumsum 函数对数组 f4 的输出类型是否为 npt.NDArray[np.float32] 类型
assert_type(np.cumsum(f4), npt.NDArray[np.float32])
# 断言:检查 np.cumsum 函数对数组 f 的输出类型是否为 npt.NDArray[Any] 类型
assert_type(np.cumsum(f), npt.NDArray[Any])
# 断言:检查 np.cumsum 函数对数组 AR_b 的输出类型是否为 npt.NDArray[np.bool] 类型
assert_type(np.cumsum(AR_b), npt.NDArray[np.bool])
# 断言:检查 np.cumsum 函数对数组 AR_f4 的输出类型是否为 npt.NDArray[np.float32] 类型
assert_type(np.cumsum(AR_f4), npt.NDArray[np.float32])
# 断言:检查 np.cumsum 函数对数组 f 指定数据类型为 float 后的输出类型是否为 npt.NDArray[Any] 类型
assert_type(np.cumsum(f, dtype=float), npt.NDArray[Any])
# 断言:检查 np.cumsum 函数对数组 f 指定数据类型为 np.float64 后的输出类型是否为 npt.NDArray[np.float64] 类型
assert_type(np.cumsum(f, dtype=np.float64), npt.NDArray[np.float64])
# 断言:检查 np.cumsum 函数对数组 AR_f4 输出到指定的 AR_subclass 对象后的输出类型是否为 NDArraySubclass 类型
assert_type(np.cumsum(AR_f4, out=AR_subclass), NDArraySubclass)

# 断言:检查 np.ptp 函数对数组 b 的输出类型是否为 np.bool 类型
assert_type(np.ptp(b), np.bool)
# 断言:检查 np.ptp 函数对数组 f4 的输出类型是否为 np.float32 类型
assert_type(np.ptp(f4), np.float32)
# 断言:检查 np.ptp 函数对数组 f 的输出类型是否为 Any(任意类型)
assert_type(np.ptp(f), Any)
# 断言:检查 np.ptp 函数对数组 AR_b 的输出类型是否为 np.bool 类型
assert_type(np.ptp(AR_b), np.bool)
# 断言:检查 np.ptp 函数对数组 AR_f4 的输出类型是否为 np.float32 类型
assert_type(np.ptp(AR_f4), np.float32)
# 断言:检查 np.ptp 函数对数组 AR_b 指定轴向(axis=0)进行操作后的输出类型是否为 Any(任意类型)
assert_type(np.ptp(AR_b, axis=0), Any)
# 断言:检查 np.ptp 函数对数组 AR_f4 指定轴向(axis=0)进行操作后的输出类型是否为 Any(任意类型)
assert_type(np.ptp(AR_f4, axis=0), Any)
#
# 确保 np.prod 返回的结果类型为 np.floating[Any]
assert_type(np.prod(AR_f4), np.floating[Any])
# 确保 np.prod 返回的结果类型为 np.complexfloating[Any, Any]
assert_type(np.prod(AR_c16), np.complexfloating[Any, Any])
# 确保 np.prod 返回的结果类型为 Any
assert_type(np.prod(AR_O), Any)
# 确保 np.prod 返回的结果类型为 Any
assert_type(np.prod(AR_f4, axis=0), Any)
# 确保 np.prod 返回的结果类型为 Any,保持维度
assert_type(np.prod(AR_f4, keepdims=True), Any)
# 确保 np.prod 返回的结果类型为 np.float64
assert_type(np.prod(AR_f4, dtype=np.float64), np.float64)
# 确保 np.prod 返回的结果类型为 Any,使用 float 作为数据类型
assert_type(np.prod(AR_f4, dtype=float), Any)
# 确保 np.prod 返回的结果类型为 NDArraySubclass,并将结果输出到 AR_subclass
assert_type(np.prod(AR_f4, out=AR_subclass), NDArraySubclass)

# 确保 np.cumprod 返回的结果类型为 npt.NDArray[np.int_]
assert_type(np.cumprod(AR_b), npt.NDArray[np.int_])
# 确保 np.cumprod 返回的结果类型为 npt.NDArray[np.uint64]
assert_type(np.cumprod(AR_u8), npt.NDArray[np.uint64])
# 确保 np.cumprod 返回的结果类型为 npt.NDArray[np.int64]
assert_type(np.cumprod(AR_i8), npt.NDArray[np.int64])
# 确保 np.cumprod 返回的结果类型为 npt.NDArray[np.floating[Any]]
assert_type(np.cumprod(AR_f4), npt.NDArray[np.floating[Any]])
# 确保 np.cumprod 返回的结果类型为 npt.NDArray[np.complexfloating[Any, Any]]
assert_type(np.cumprod(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])
# 确保 np.cumprod 返回的结果类型为 npt.NDArray[np.object_]
assert_type(np.cumprod(AR_O), npt.NDArray[np.object_])
# 确保 np.cumprod 返回的结果类型为 npt.NDArray[np.floating[Any]],指定轴向
assert_type(np.cumprod(AR_f4, axis=0), npt.NDArray[np.floating[Any]])
# 确保 np.cumprod 返回的结果类型为 npt.NDArray[np.float64],指定数据类型
assert_type(np.cumprod(AR_f4, dtype=np.float64), npt.NDArray[np.float64])
# 确保 np.cumprod 返回的结果类型为 npt.NDArray[Any],使用 float 作为数据类型
assert_type(np.cumprod(AR_f4, dtype=float), npt.NDArray[Any])
# 确保 np.cumprod 返回的结果类型为 NDArraySubclass,并将结果输出到 AR_subclass
assert_type(np.cumprod(AR_f4, out=AR_subclass), NDArraySubclass)

# 确保 np.ndim 返回的结果类型为 int
assert_type(np.ndim(b), int)
assert_type(np.ndim(f4), int)
assert_type(np.ndim(f), int)
assert_type(np.ndim(AR_b), int)
assert_type(np.ndim(AR_f4), int)

# 确保 np.size 返回的结果类型为 int
assert_type(np.size(b), int)
assert_type(np.size(f4), int)
assert_type(np.size(f), int)
assert_type(np.size(AR_b), int)
assert_type(np.size(AR_f4), int)

# 确保 np.around 返回的结果类型为 np.float16
assert_type(np.around(b), np.float16)
# 确保 np.around 返回的结果类型为 Any
assert_type(np.around(f), Any)
# 确保 np.around 返回的结果类型为 np.int64
assert_type(np.around(i8), np.int64)
# 确保 np.around 返回的结果类型为 np.float32
assert_type(np.around(f4), np.float32)
# 确保 np.around 返回的结果类型为 npt.NDArray[np.float16]
assert_type(np.around(AR_b), npt.NDArray[np.float16])
# 确保 np.around 返回的结果类型为 npt.NDArray[np.int64]
assert_type(np.around(AR_i8), npt.NDArray[np.int64])
# 确保 np.around 返回的结果类型为 npt.NDArray[np.float32]
assert_type(np.around(AR_f4), npt.NDArray[np.float32])
# 确保 np.around 返回的结果类型为 npt.NDArray[Any]
assert_type(np.around([1.5]), npt.NDArray[Any])
# 确保 np.around 返回的结果类型为 NDArraySubclass,并将结果输出到 AR_subclass
assert_type(np.around(AR_f4, out=AR_subclass), NDArraySubclass)

# 确保 np.mean 返回的结果类型为 np.floating[Any]
assert_type(np.mean(AR_b), np.floating[Any])
assert_type(np.mean(AR_i8), np.floating[Any])
assert_type(np.mean(AR_f4), np.floating[Any])
assert_type(np.mean(AR_c16), np.complexfloating[Any, Any])
# 确保 np.mean 返回的结果类型为 Any
assert_type(np.mean(AR_O), Any)
# 确保 np.mean 返回的结果类型为 Any,指定轴向
assert_type(np.mean(AR_f4, axis=0), Any)
# 确保 np.mean 返回的结果类型为 Any,保持维度
assert_type(np.mean(AR_f4, keepdims=True), Any)
# 确保 np.mean 返回的结果类型为 Any,使用 float 作为数据类型
assert_type(np.mean(AR_f4, dtype=float), Any)
# 确保 np.mean 返回的结果类型为 np.float64
assert_type(np.mean(AR_f4, dtype=np.float64), np.float64)
# 确保 np.mean 返回的结果类型为 NDArraySubclass,并将结果输出到 AR_subclass
assert_type(np.mean(AR_f4, out=AR_subclass), NDArraySubclass)

# 确保 np.std 返回的结果类型为 np.floating[Any]
assert_type(np.std(AR_b), np.floating[Any])
assert_type(np.std(AR_i8), np.floating[Any])
assert_type(np.std(AR_f4), np.floating[Any])
assert_type(np.std(AR_c16), np.floating[Any])
# 确保 np.std 返回的结果类型为 Any
assert_type(np.std(AR_O), Any)
# 确保 np.std 返回的结果类型为 Any,指定轴向
assert_type(np.std(AR_f4, axis=0), Any)
# 确保 np.std 返回的结果类型为 Any,保持维度
assert_type(np.std(AR_f4, keepdims=True), Any)
# 确保 np.std 返回的结果类型为 Any,使用 float 作为数据类型
assert_type(np.std(AR_f4, dtype=float), Any)
# 确保 np.std 返回的结果类型为 np.float64
assert_type(np.std(AR_f4, dtype=np.float64), np.float64)
# 确保 np.std 返回的结果类型为 NDArraySubclass,并将结果输出到 AR_subclass
assert_type(np.std(AR_f4, out=AR_subclass), NDArraySubclass)

# 确保 np.var 返回的结果类型为 np.floating[Any]
assert_type(np.var(AR_b), np.floating[Any])
assert_type(np.var(AR_i8), np.floating[Any])
assert_type(np.var(AR_f4), np.floating[Any])
assert_type(np.var(AR_c16), np.floating[Any])
# 确保 np.var 返回的结果类型为 Any
assert_type(np.var(AR_O), Any)
# 确保 np.var 返回的结果类型为 Any,指定轴向
assert_type(np.var(AR_f4, axis=0), Any)
# 确保 np.var 返回的结果类型为 Any,保持维度
assert_type(np.var(AR_f4, keepdims=True), Any)
# 使用 np.var 函数计算数组 AR_f4 的方差,并检查结果类型是否为 Any
assert_type(np.var(AR_f4, dtype=float), Any)

# 使用 np.var 函数计算数组 AR_f4 的方差,并检查结果类型是否为 np.float64
assert_type(np.var(AR_f4, dtype=np.float64), np.float64)

# 使用 np.var 函数计算数组 AR_f4 的方差,并将结果存储在 AR_subclass 中,
# 然后检查 AR_subclass 的类型是否为 NDArraySubclass
assert_type(np.var(AR_f4, out=AR_subclass), NDArraySubclass)

.\numpy\numpy\typing\tests\data\reveal\getlimits.pyi

# 导入系统模块 sys
import sys
# 导入 Any 类型,用于泛型类型注解
from typing import Any

# 导入 NumPy 库并使用别名 np
import numpy as np

# 如果 Python 版本大于等于 3.11,导入 typing 模块的 assert_type 函数
if sys.version_info >= (3, 11):
    from typing import assert_type
# 否则,从 typing_extensions 模块导入 assert_type 函数
else:
    from typing_extensions import assert_type

# 声明变量 f 为浮点数类型
f: float
# 声明变量 f8 为 NumPy 中的 np.float64 类型
f8: np.float64
# 声明变量 c8 为 NumPy 中的 np.complex64 类型

# 声明变量 i 为整数类型
i: int
# 声明变量 i8 为 NumPy 中的 np.int64 类型
i8: np.int64
# 声明变量 u4 为 NumPy 中的 np.uint32 类型

# 声明变量 finfo_f8 为 NumPy 中 np.finfo[np.float64] 类型
finfo_f8: np.finfo[np.float64]
# 声明变量 iinfo_i8 为 NumPy 中 np.iinfo[np.int64] 类型

# 使用 assert_type 函数验证 np.finfo(f) 的类型为 np.finfo[np.double]
assert_type(np.finfo(f), np.finfo[np.double])
# 使用 assert_type 函数验证 np.finfo(f8) 的类型为 np.finfo[np.float64]
assert_type(np.finfo(f8), np.finfo[np.float64])
# 使用 assert_type 函数验证 np.finfo(c8) 的类型为 np.finfo[np.float32]
assert_type(np.finfo(c8), np.finfo[np.float32])
# 使用 assert_type 函数验证 np.finfo('f2') 的类型为 np.finfo[np.floating[Any]]

# 使用 assert_type 函数验证 finfo_f8.dtype 的类型为 np.dtype[np.float64]
assert_type(finfo_f8.dtype, np.dtype[np.float64])
# 使用 assert_type 函数验证 finfo_f8.bits 的类型为 int
assert_type(finfo_f8.bits, int)
# 使用 assert_type 函数验证 finfo_f8.eps 的类型为 np.float64
assert_type(finfo_f8.eps, np.float64)
# 使用 assert_type 函数验证 finfo_f8.epsneg 的类型为 np.float64
assert_type(finfo_f8.epsneg, np.float64)
# 使用 assert_type 函数验证 finfo_f8.iexp 的类型为 int
assert_type(finfo_f8.iexp, int)
# 使用 assert_type 函数验证 finfo_f8.machep 的类型为 int
assert_type(finfo_f8.machep, int)
# 使用 assert_type 函数验证 finfo_f8.max 的类型为 np.float64
assert_type(finfo_f8.max, np.float64)
# 使用 assert_type 函数验证 finfo_f8.maxexp 的类型为 int
assert_type(finfo_f8.maxexp, int)
# 使用 assert_type 函数验证 finfo_f8.min 的类型为 np.float64
assert_type(finfo_f8.min, np.float64)
# 使用 assert_type 函数验证 finfo_f8.minexp 的类型为 int
assert_type(finfo_f8.minexp, int)
# 使用 assert_type 函数验证 finfo_f8.negep 的类型为 int
assert_type(finfo_f8.negep, int)
# 使用 assert_type 函数验证 finfo_f8.nexp 的类型为 int
assert_type(finfo_f8.nexp, int)
# 使用 assert_type 函数验证 finfo_f8.nmant 的类型为 int
assert_type(finfo_f8.nmant, int)
# 使用 assert_type 函数验证 finfo_f8.precision 的类型为 int
assert_type(finfo_f8.precision, int)
# 使用 assert_type 函数验证 finfo_f8.resolution 的类型为 np.float64
assert_type(finfo_f8.resolution, np.float64)
# 使用 assert_type 函数验证 finfo_f8.tiny 的类型为 np.float64
assert_type(finfo_f8.tiny, np.float64)
# 使用 assert_type 函数验证 finfo_f8.smallest_normal 的类型为 np.float64
assert_type(finfo_f8.smallest_normal, np.float64)
# 使用 assert_type 函数验证 finfo_f8.smallest_subnormal 的类型为 np.float64

# 使用 assert_type 函数验证 np.iinfo(i) 的类型为 np.iinfo[np.int_]
assert_type(np.iinfo(i), np.iinfo[np.int_])
# 使用 assert_type 函数验证 np.iinfo(i8) 的类型为 np.iinfo[np.int64]
assert_type(np.iinfo(i8), np.iinfo[np.int64])
# 使用 assert_type 函数验证 np.iinfo(u4) 的类型为 np.iinfo[np.uint32]
assert_type(np.iinfo(u4), np.iinfo[np.uint32])
# 使用 assert_type 函数验证 np.iinfo('i2') 的类型为 np.iinfo[Any]

# 使用 assert_type 函数验证 iinfo_i8.dtype 的类型为 np.dtype[np.int64]
assert_type(iinfo_i8.dtype, np.dtype[np.int64])
# 使用 assert_type 函数验证 iinfo_i8.kind 的类型为 str
assert_type(iinfo_i8.kind, str)
# 使用 assert_type 函数验证 iinfo_i8.bits 的类型为 int
assert_type(iinfo_i8.bits, int)
# 使用 assert_type 函数验证 iinfo_i8.key 的类型为 str
assert_type(iinfo_i8.key, str)
# 使用 assert_type 函数验证 iinfo_i8.min 的类型为 int
assert_type(iinfo_i8.min, int)
# 使用 assert_type 函数验证 iinfo_i8.max 的类型为 int
assert_type(iinfo_i8.max, int)

.\numpy\numpy\typing\tests\data\reveal\histograms.pyi

import sys  # 导入sys模块,用于系统相关操作
from typing import Any  # 从typing模块导入Any类型,用于类型提示

import numpy as np  # 导入NumPy库,并用np作为别名
import numpy.typing as npt  # 导入NumPy的类型提示模块

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果Python版本大于等于3.11,则从typing模块直接导入assert_type函数
else:
    from typing_extensions import assert_type  # 否则从typing_extensions模块导入assert_type函数

AR_i8: npt.NDArray[np.int64]  # 定义AR_i8变量,类型为np.int64的NumPy数组
AR_f8: npt.NDArray[np.float64]  # 定义AR_f8变量,类型为np.float64的NumPy数组

assert_type(np.histogram_bin_edges(AR_i8, bins="auto"), npt.NDArray[Any])  # 断言np.histogram_bin_edges返回值为npt.NDArray[Any]
assert_type(np.histogram_bin_edges(AR_i8, bins="rice", range=(0, 3)), npt.NDArray[Any])  # 断言np.histogram_bin_edges返回值为npt.NDArray[Any]
assert_type(np.histogram_bin_edges(AR_i8, bins="scott", weights=AR_f8), npt.NDArray[Any])  # 断言np.histogram_bin_edges返回值为npt.NDArray[Any]

assert_type(np.histogram(AR_i8, bins="auto"), tuple[npt.NDArray[Any], npt.NDArray[Any]])  # 断言np.histogram返回值为元组,包含两个npt.NDArray[Any]类型
assert_type(np.histogram(AR_i8, bins="rice", range=(0, 3)), tuple[npt.NDArray[Any], npt.NDArray[Any]])  # 断言np.histogram返回值为元组,包含两个npt.NDArray[Any]类型
assert_type(np.histogram(AR_i8, bins="scott", weights=AR_f8), tuple[npt.NDArray[Any], npt.NDArray[Any]])  # 断言np.histogram返回值为元组,包含两个npt.NDArray[Any]类型
assert_type(np.histogram(AR_f8, bins=1, density=True), tuple[npt.NDArray[Any], npt.NDArray[Any]])  # 断言np.histogram返回值为元组,包含两个npt.NDArray[Any]类型

assert_type(np.histogramdd(AR_i8, bins=[1]), tuple[npt.NDArray[Any], tuple[npt.NDArray[Any], ...]])  # 断言np.histogramdd返回值为元组,第一个元素为npt.NDArray[Any],第二个元素为元组类型
assert_type(np.histogramdd(AR_i8, range=[(0, 3)]), tuple[npt.NDArray[Any], tuple[npt.NDArray[Any], ...]])  # 断言np.histogramdd返回值为元组,第一个元素为npt.NDArray[Any],第二个元素为元组类型
assert_type(np.histogramdd(AR_i8, weights=AR_f8), tuple[npt.NDArray[Any], tuple[npt.NDArray[Any], ...]])  # 断言np.histogramdd返回值为元组,第一个元素为npt.NDArray[Any],第二个元素为元组类型
assert_type(np.histogramdd(AR_f8, density=True), tuple[npt.NDArray[Any], tuple[npt.NDArray[Any], ...]])  # 断言np.histogramdd返回值为元组,第一个元素为npt.NDArray[Any],第二个元素为元组类型

.\numpy\numpy\typing\tests\data\reveal\index_tricks.pyi

import sys
from typing import Any, Literal  # 导入必要的模块和类型提示

import numpy as np  # 导入 NumPy 库
import numpy.typing as npt  # 导入 NumPy 的类型提示

if sys.version_info >= (3, 11):
    from typing import assert_type  # 根据 Python 版本导入不同版本的 assert_type
else:
    from typing_extensions import assert_type

AR_LIKE_b: list[bool]  # 定义 AR_LIKE_b 变量类型为布尔类型的列表
AR_LIKE_i: list[int]  # 定义 AR_LIKE_i 变量类型为整数类型的列表
AR_LIKE_f: list[float]  # 定义 AR_LIKE_f 变量类型为浮点数类型的列表
AR_LIKE_U: list[str]  # 定义 AR_LIKE_U 变量类型为字符串类型的列表

AR_i8: npt.NDArray[np.int64]  # 定义 AR_i8 变量类型为 NumPy 中的 np.int64 数组类型

assert_type(np.ndenumerate(AR_i8), np.ndenumerate[np.int64])  # 断言 AR_i8 的 ndenumerate 类型
assert_type(np.ndenumerate(AR_LIKE_f), np.ndenumerate[np.float64])  # 断言 AR_LIKE_f 的 ndenumerate 类型
assert_type(np.ndenumerate(AR_LIKE_U), np.ndenumerate[np.str_])  # 断言 AR_LIKE_U 的 ndenumerate 类型

assert_type(np.ndenumerate(AR_i8).iter, np.flatiter[npt.NDArray[np.int64]])  # 断言 AR_i8 的 ndenumerate 的 iter 属性类型
assert_type(np.ndenumerate(AR_LIKE_f).iter, np.flatiter[npt.NDArray[np.float64]])  # 断言 AR_LIKE_f 的 ndenumerate 的 iter 属性类型
assert_type(np.ndenumerate(AR_LIKE_U).iter, np.flatiter[npt.NDArray[np.str_]])  # 断言 AR_LIKE_U 的 ndenumerate 的 iter 属性类型

assert_type(next(np.ndenumerate(AR_i8)), tuple[tuple[int, ...], np.int64])  # 断言调用 np.ndenumerate(AR_i8) 后返回的类型
assert_type(next(np.ndenumerate(AR_LIKE_f)), tuple[tuple[int, ...], np.float64])  # 断言调用 np.ndenumerate(AR_LIKE_f) 后返回的类型
assert_type(next(np.ndenumerate(AR_LIKE_U)), tuple[tuple[int, ...], np.str_])  # 断言调用 np.ndenumerate(AR_LIKE_U) 后返回的类型

assert_type(iter(np.ndenumerate(AR_i8)), np.ndenumerate[np.int64])  # 断言调用 iter(np.ndenumerate(AR_i8)) 后返回的类型
assert_type(iter(np.ndenumerate(AR_LIKE_f)), np.ndenumerate[np.float64])  # 断言调用 iter(np.ndenumerate(AR_LIKE_f)) 后返回的类型
assert_type(iter(np.ndenumerate(AR_LIKE_U)), np.ndenumerate[np.str_])  # 断言调用 iter(np.ndenumerate(AR_LIKE_U)) 后返回的类型

assert_type(np.ndindex(1, 2, 3), np.ndindex)  # 断言 np.ndindex(1, 2, 3) 的类型
assert_type(np.ndindex((1, 2, 3)), np.ndindex)  # 断言 np.ndindex((1, 2, 3)) 的类型
assert_type(iter(np.ndindex(1, 2, 3)), np.ndindex)  # 断言调用 iter(np.ndindex(1, 2, 3)) 后返回的类型
assert_type(next(np.ndindex(1, 2, 3)), tuple[int, ...])  # 断言调用 next(np.ndindex(1, 2, 3)) 后返回的类型

assert_type(np.unravel_index([22, 41, 37], (7, 6)), tuple[npt.NDArray[np.intp], ...])  # 断言调用 np.unravel_index([22, 41, 37], (7, 6)) 的类型
assert_type(np.unravel_index([31, 41, 13], (7, 6), order="F"), tuple[npt.NDArray[np.intp], ...])  # 断言调用 np.unravel_index([31, 41, 13], (7, 6), order="F") 的类型
assert_type(np.unravel_index(1621, (6, 7, 8, 9)), tuple[np.intp, ...])  # 断言调用 np.unravel_index(1621, (6, 7, 8, 9)) 的类型

assert_type(np.ravel_multi_index([[1]], (7, 6)), npt.NDArray[np.intp])  # 断言调用 np.ravel_multi_index([[1]], (7, 6)) 的类型
assert_type(np.ravel_multi_index(AR_LIKE_i, (7, 6)), np.intp)  # 断言调用 np.ravel_multi_index(AR_LIKE_i, (7, 6)) 的类型
assert_type(np.ravel_multi_index(AR_LIKE_i, (7, 6), order="F"), np.intp)  # 断言调用 np.ravel_multi_index(AR_LIKE_i, (7, 6), order="F") 的类型
assert_type(np.ravel_multi_index(AR_LIKE_i, (4, 6), mode="clip"), np.intp)  # 断言调用 np.ravel_multi_index(AR_LIKE_i, (4, 6), mode="clip") 的类型
assert_type(np.ravel_multi_index(AR_LIKE_i, (4, 4), mode=("clip", "wrap")), np.intp)  # 断言调用 np.ravel_multi_index(AR_LIKE_i, (4, 4), mode=("clip", "wrap")) 的类型
assert_type(np.ravel_multi_index((3, 1, 4, 1), (6, 7, 8, 9)), np.intp)  # 断言调用 np.ravel_multi_index((3, 1, 4, 1), (6, 7, 8, 9)) 的类型

assert_type(np.mgrid[1:1:2], npt.NDArray[Any])  # 断言调用 np.mgrid[1:1:2] 的类型
assert_type(np.mgrid[1:1:2, None:10], npt.NDArray[Any])  # 断言调用 np.mgrid[1:1:2, None:10] 的类型

assert_type(np.ogrid[1:1:2], tuple[npt.NDArray[Any], ...])  # 断言调用 np.ogrid[1:1:2] 的类型
assert_type(np.ogrid[1:1:2, None:10], tuple[npt.NDArray[Any], ...])  # 断言调用 np.ogrid[1:1:2, None:10] 的类型

assert_type(np.index_exp[0:1], tuple[slice])  # 断言 np.index_exp[0:1] 的类型
assert_type(np.index_exp[0:1, None:3], tuple[slice, slice])  # 断言 np.index_exp[0:1, None:3] 的类型
assert_type(np.index_exp[0, 0:1, ..., [0, 1, 3]], tuple[Literal[0], slice, ellipsis, list[int]])  # 断言 np.index_exp[0, 0:1, ..., [0, 1, 3]] 的类型

assert_type(np.s_[0:1], slice)  # 断言 np.s_[0:1] 的类型
assert_type(np.s_[0:1, None:3], tuple[slice, slice])  # 断言 np.s_[0:1, None:3] 的类型
assert_type(np.s_[0, 0:1, ..., [0, 1, 3]], tuple[Literal[0], slice, ellipsis, list[int]])  # 断言 np.s_[0, 0:1, ..., [0, 1, 3]] 的类型

assert_type(np.ix_(AR_LIKE_b), tuple[npt.NDArray[np.bool], ...])  # 断言调用 np.ix_(AR_LIKE_b) 的类型
assert_type(np.ix_(AR_LIKE_i, AR_LIKE_f), tuple[npt.NDArray[np.float64], ...])  # 断言调用 np.ix_(AR_LIKE_i, AR_LIKE_f) 的类型
assert_type(np.ix_(AR_i8), tuple[npt.NDArray[np.int64], ...])  # 断言调用 np.ix_(AR_i8) 的类型

assert_type(np.fill_diagonal(AR_i8, 5), None)  # 断言调用 np.fill_diagonal(AR_i8,
# 断言语句:验证 np.diag_indices(4) 的返回类型为 tuple[npt.NDArray[np.int_], ...]
assert_type(np.diag_indices(4), tuple[npt.NDArray[np.int_], ...])

# 断言语句:验证 np.diag_indices(2, 3) 的返回类型为 tuple[npt.NDArray[np.int_], ...]
assert_type(np.diag_indices(2, 3), tuple[npt.NDArray[np.int_], ...])

# 断言语句:验证 np.diag_indices_from(AR_i8) 的返回类型为 tuple[npt.NDArray[np.int_], ...]
assert_type(np.diag_indices_from(AR_i8), tuple[npt.NDArray[np.int_], ...])

.\numpy\numpy\typing\tests\data\reveal\lib_function_base.pyi

import sys
from typing import Any  # 导入 Any 类型
from collections.abc import Callable  # 导入 Callable 抽象基类

import numpy as np  # 导入 NumPy 库
import numpy.typing as npt  # 导入 NumPy 类型提示

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果 Python 版本 >= 3.11,导入 assert_type
else:
    from typing_extensions import assert_type  # 否则,从 typing_extensions 导入 assert_type

vectorized_func: np.vectorize  # 声明 vectorized_func 为 np.vectorize 类型

f8: np.float64  # 声明 f8 为 np.float64 类型
AR_LIKE_f8: list[float]  # 声明 AR_LIKE_f8 为 float 类型的列表

AR_i8: npt.NDArray[np.int64]  # 声明 AR_i8 为 np.int64 类型的 NumPy 数组
AR_f8: npt.NDArray[np.float64]  # 声明 AR_f8 为 np.float64 类型的 NumPy 数组
AR_c16: npt.NDArray[np.complex128]  # 声明 AR_c16 为 np.complex128 类型的 NumPy 数组
AR_m: npt.NDArray[np.timedelta64]  # 声明 AR_m 为 np.timedelta64 类型的 NumPy 数组
AR_M: npt.NDArray[np.datetime64]  # 声明 AR_M 为 np.datetime64 类型的 NumPy 数组
AR_O: npt.NDArray[np.object_]  # 声明 AR_O 为 np.object_ 类型的 NumPy 数组
AR_b: npt.NDArray[np.bool]  # 声明 AR_b 为 np.bool 类型的 NumPy 数组
AR_U: npt.NDArray[np.str_]  # 声明 AR_U 为 np.str_ 类型的 NumPy 数组
CHAR_AR_U: np.char.chararray[Any, np.dtype[np.str_]]  # 声明 CHAR_AR_U 为 np.char.chararray 类型的数组,元素类型为 np.str_

def func(*args: Any, **kwargs: Any) -> Any: ...  # 定义一个 func 函数,接受任意参数,返回任意类型的值

assert_type(vectorized_func.pyfunc, Callable[..., Any])  # 断言 vectorized_func.pyfunc 的类型为 Callable[..., Any]
assert_type(vectorized_func.cache, bool)  # 断言 vectorized_func.cache 的类型为 bool
assert_type(vectorized_func.signature, None | str)  # 断言 vectorized_func.signature 的类型为 None 或 str
assert_type(vectorized_func.otypes, None | str)  # 断言 vectorized_func.otypes 的类型为 None 或 str
assert_type(vectorized_func.excluded, set[int | str])  # 断言 vectorized_func.excluded 的类型为 set[int | str]
assert_type(vectorized_func.__doc__, None | str)  # 断言 vectorized_func.__doc__ 的类型为 None 或 str
assert_type(vectorized_func([1]), Any)  # 断言 vectorized_func([1]) 的类型为 Any
assert_type(np.vectorize(int), np.vectorize)  # 断言 np.vectorize(int) 的类型为 np.vectorize

assert_type(
    np.vectorize(int, otypes="i", doc="doc", excluded=(), cache=True, signature=None),
    np.vectorize,
)  # 断言调用 np.vectorize 函数的返回类型为 np.vectorize

assert_type(np.rot90(AR_f8, k=2), npt.NDArray[np.float64])  # 断言 np.rot90(AR_f8, k=2) 的返回类型为 npt.NDArray[np.float64]
assert_type(np.rot90(AR_LIKE_f8, axes=(0, 1)), npt.NDArray[Any])  # 断言 np.rot90(AR_LIKE_f8, axes=(0, 1)) 的返回类型为 npt.NDArray[Any]

assert_type(np.flip(f8), np.float64)  # 断言 np.flip(f8) 的返回类型为 np.float64
assert_type(np.flip(1.0), Any)  # 断言 np.flip(1.0) 的返回类型为 Any
assert_type(np.flip(AR_f8, axis=(0, 1)), npt.NDArray[np.float64])  # 断言 np.flip(AR_f8, axis=(0, 1)) 的返回类型为 npt.NDArray[np.float64]
assert_type(np.flip(AR_LIKE_f8, axis=0), npt.NDArray[Any])  # 断言 np.flip(AR_LIKE_f8, axis=0) 的返回类型为 npt.NDArray[Any]

assert_type(np.iterable(1), bool)  # 断言 np.iterable(1) 的返回类型为 bool
assert_type(np.iterable([1]), bool)  # 断言 np.iterable([1]) 的返回类型为 bool

assert_type(np.average(AR_f8), np.floating[Any])  # 断言 np.average(AR_f8) 的返回类型为 np.floating[Any]
assert_type(np.average(AR_f8, weights=AR_c16), np.complexfloating[Any, Any])  # 断言 np.average(AR_f8, weights=AR_c16) 的返回类型为 np.complexfloating[Any, Any]
assert_type(np.average(AR_O), Any)  # 断言 np.average(AR_O) 的返回类型为 Any
assert_type(np.average(AR_f8, returned=True), tuple[np.floating[Any], np.floating[Any]])  # 断言 np.average(AR_f8, returned=True) 的返回类型为 tuple[np.floating[Any], np.floating[Any]]
assert_type(np.average(AR_f8, weights=AR_c16, returned=True), tuple[np.complexfloating[Any, Any], np.complexfloating[Any, Any]])  # 断言 np.average(AR_f8, weights=AR_c16, returned=True) 的返回类型为 tuple[np.complexfloating[Any, Any], np.complexfloating[Any, Any]]
assert_type(np.average(AR_O, returned=True), tuple[Any, Any])  # 断言 np.average(AR_O, returned=True) 的返回类型为 tuple[Any, Any]
assert_type(np.average(AR_f8, axis=0), Any)  # 断言 np.average(AR_f8, axis=0) 的返回类型为 Any
assert_type(np.average(AR_f8, axis=0, returned=True), tuple[Any, Any])  # 断言 np.average(AR_f8, axis=0, returned=True) 的返回类型为 tuple[Any, Any]

assert_type(np.asarray_chkfinite(AR_f8), npt.NDArray[np.float64])  # 断言 np.asarray_chkfinite(AR_f8) 的返回类型为 npt.NDArray[np.float64]
assert_type(np.asarray_chkfinite(AR_LIKE_f8), npt.NDArray[Any])  # 断言 np.asarray_chkfinite(AR_LIKE_f8) 的返回类型为 npt.NDArray[Any]
assert_type(np.asarray_chkfinite(AR_f8, dtype=np.float64), npt.NDArray[np.float64])  # 断言 np.asarray_chkfinite(AR_f8, dtype=np.float64) 的返回类型为 npt.NDArray[np.float64]
assert_type(np.asarray_chkfinite(AR_f8, dtype=float), npt.NDArray[Any])  # 断言 np.asarray_chkfinite(AR_f8, dtype=float) 的返回类型为 npt.NDArray[Any]

assert_type(np.piecewise(AR_f8, AR_b, [func]), npt.NDArray[np.float64])  # 断言 np.piecewise(AR_f8, AR_b, [func]) 的返回类型为 npt.NDArray[np.float64]
assert_type(np.piecewise(AR_LIKE_f8, AR_b, [func]), npt.NDArray[Any])  # 断言 np.piecewise(AR_LIKE_f8, AR_b, [func]) 的返回类型为 npt.NDArray[Any]

assert_type(np.select([AR_f8], [AR_f8]), npt.NDArray[Any])  # 断言 np.select([AR_f8], [AR_f8]) 的返回类型为 npt.NDArray[Any]

assert_type(np.copy(AR_LIKE_f8), npt.NDArray[Any])  # 断言 np.copy(AR_LIKE_f8) 的返回类型为 npt.NDArray[Any]
assert_type(np.copy(AR_U), npt.NDArray[np.str_])  # 断言 np.copy(AR_U) 的返回类型为 npt.NDArray[np.str_]
assert_type(np.copy(CHAR_AR_U), np.ndarray[Any, Any])  # 断言 np.copy(CHAR_AR_U) 的返回类型为 np.ndarray[Any, Any]
assert_type(np.copy(CHAR_AR_U, "K", subok=True), np.char.chararray[Any, np.dtype[np.str_
# 检查 np.gradient 函数返回值的类型是否为 Any 类型
assert_type(np.gradient(AR_LIKE_f8, edge_order=2), Any)

# 检查 np.diff 函数返回值的类型是否为 str 类型
assert_type(np.diff("bob", n=0), str)
# 检查 np.diff 函数返回值的类型是否为 npt.NDArray[Any] 类型
assert_type(np.diff(AR_f8, axis=0), npt.NDArray[Any])
# 检查 np.diff 函数返回值的类型是否为 npt.NDArray[Any] 类型
assert_type(np.diff(AR_LIKE_f8, prepend=1.5), npt.NDArray[Any])

# 检查 np.angle 函数返回值的类型是否为 np.floating[Any] 类型
assert_type(np.angle(f8), np.floating[Any])
# 检查 np.angle 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.angle(AR_f8), npt.NDArray[np.floating[Any]])
# 检查 np.angle 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.angle(AR_c16, deg=True), npt.NDArray[np.floating[Any]])
# 检查 np.angle 函数返回值的类型是否为 npt.NDArray[np.object_] 类型
assert_type(np.angle(AR_O), npt.NDArray[np.object_])

# 检查 np.unwrap 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.unwrap(AR_f8), npt.NDArray[np.floating[Any]])
# 检查 np.unwrap 函数返回值的类型是否为 npt.NDArray[np.object_] 类型
assert_type(np.unwrap(AR_O), npt.NDArray[np.object_])

# 检查 np.sort_complex 函数返回值的类型是否为 npt.NDArray[np.complexfloating[Any, Any]] 类型
assert_type(np.sort_complex(AR_f8), npt.NDArray[np.complexfloating[Any, Any]])

# 检查 np.trim_zeros 函数返回值的类型是否为 npt.NDArray[np.float64] 类型
assert_type(np.trim_zeros(AR_f8), npt.NDArray[np.float64])
# 检查 np.trim_zeros 函数返回值的类型是否为 list[float] 类型
assert_type(np.trim_zeros(AR_LIKE_f8), list[float])

# 检查 np.extract 函数返回值的类型是否为 npt.NDArray[np.float64] 类型
assert_type(np.extract(AR_i8, AR_f8), npt.NDArray[np.float64])
# 检查 np.extract 函数返回值的类型是否为 npt.NDArray[Any] 类型
assert_type(np.extract(AR_i8, AR_LIKE_f8), npt.NDArray[Any])

# 检查 np.place 函数返回值的类型是否为 None 类型
assert_type(np.place(AR_f8, mask=AR_i8, vals=5.0), None)

# 检查 np.cov 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.cov(AR_f8, bias=True), npt.NDArray[np.floating[Any]])
# 检查 np.cov 函数返回值的类型是否为 npt.NDArray[np.complexfloating[Any, Any]] 类型
assert_type(np.cov(AR_f8, AR_c16, ddof=1), npt.NDArray[np.complexfloating[Any, Any]])
# 检查 np.cov 函数返回值的类型是否为 npt.NDArray[np.float32] 类型
assert_type(np.cov(AR_f8, aweights=AR_f8, dtype=np.float32), npt.NDArray[np.float32])
# 检查 np.cov 函数返回值的类型是否为 npt.NDArray[Any] 类型
assert_type(np.cov(AR_f8, fweights=AR_f8, dtype=float), npt.NDArray[Any])

# 检查 np.corrcoef 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.corrcoef(AR_f8, rowvar=True), npt.NDArray[np.floating[Any]])
# 检查 np.corrcoef 函数返回值的类型是否为 npt.NDArray[np.complexfloating[Any, Any]] 类型
assert_type(np.corrcoef(AR_f8, AR_c16), npt.NDArray[np.complexfloating[Any, Any]])
# 检查 np.corrcoef 函数返回值的类型是否为 npt.NDArray[np.float32] 类型
assert_type(np.corrcoef(AR_f8, dtype=np.float32), npt.NDArray[np.float32])
# 检查 np.corrcoef 函数返回值的类型是否为 npt.NDArray[Any] 类型
assert_type(np.corrcoef(AR_f8, dtype=float), npt.NDArray[Any])

# 检查 np.blackman 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.blackman(5), npt.NDArray[np.floating[Any]])
# 检查 np.bartlett 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.bartlett(6), npt.NDArray[np.floating[Any]])
# 检查 np.hanning 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.hanning(4.5), npt.NDArray[np.floating[Any]])
# 检查 np.hamming 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.hamming(0), npt.NDArray[np.floating[Any]])
# 检查 np.i0 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.i0(AR_i8), npt.NDArray[np.floating[Any]])
# 检查 np.kaiser 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.kaiser(4, 5.9), npt.NDArray[np.floating[Any]])

# 检查 np.sinc 函数返回值的类型是否为 np.floating[Any] 类型
assert_type(np.sinc(1.0), np.floating[Any])
# 检查 np.sinc 函数返回值的类型是否为 np.complexfloating[Any, Any] 类型
assert_type(np.sinc(1j), np.complexfloating[Any, Any])
# 检查 np.sinc 函数返回值的类型是否为 npt.NDArray[np.floating[Any]] 类型
assert_type(np.sinc(AR_f8), npt.NDArray[np.floating[Any]])
# 检查 np.sinc 函数返回值的类型是否为 npt.NDArray[np.complexfloating[Any, Any]] 类型
assert_type(np.sinc(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])

# 检查 np.median 函数返回值的类型是否为 np.floating[Any] 类型
assert_type(np.median(AR_f8, keepdims=False), np.floating[Any])
# 检查 np.median 函数返回值的类型是否为 np.complexfloating[Any, Any] 类型
assert_type(np.median(AR_c16, overwrite_input=True), np.complexfloating[Any, Any])
# 检查 np.median 函数返回值的类型是否为 np.timedelta64 类型
assert_type(np.median(AR_m), np.timedelta64)
# 检查 np.median 函数返回值的类型是否为 Any 类型
assert_type(np.median(AR_O), Any)
# 检查 np.median 函数返回值的类型是否为 Any 类型
assert_type(np.median(AR_f8, keepdims=True), Any)
# 检查 np.median 函数返回值的类型是否为 Any 类型
assert_type(np.median(AR_c16, axis=0), Any)
# 检查 np.median 函数返回值的类型是否为 npt.NDArray[np.complex128] 类型
assert_type(np.median(AR_LIKE_f8, out=AR_c16), npt.NDArray[np.complex128])

# 检查 np.percentile 函数返回值的类型是否为 np.floating[Any] 类型
assert_type(np.percentile(AR_f8, 50), np.floating[Any])
# 检查 np.percentile 函数返回值的类型是否为 np.complexfloating[Any, Any] 类型
assert_type(np.percentile(AR_c16, 50), np.complexfloating[Any, Any])
# 检查 np.percentile 函数返回值的类型是否为 np.timedelta64 类型
assert_type(np.percentile(AR_m, 50), np.timedelta64
# 确保 np.percentile 返回的结果是一个包含 np.timedelta64 元素的 NumPy 数组
assert_type(np.percentile(AR_m, [50]), npt.NDArray[np.timedelta64])

# 确保 np.percentile 返回的结果是一个包含 np.datetime64 元素的 NumPy 数组,使用 nearest 方法进行近似
assert_type(np.percentile(AR_M, [50], method="nearest"), npt.NDArray[np.datetime64])

# 确保 np.percentile 返回的结果是一个包含 np.object_ 元素的 NumPy 数组
assert_type(np.percentile(AR_O, [50]), npt.NDArray[np.object_])

# 确保 np.percentile 返回的结果是一个任意类型的 NumPy 数组,keepdims=True 保持维度信息
assert_type(np.percentile(AR_f8, [50], keepdims=True), Any)

# 确保 np.percentile 返回的结果是一个任意类型的 NumPy 数组,指定 axis=1 进行计算
assert_type(np.percentile(AR_f8, [50], axis=[1]), Any)

# 确保 np.percentile 返回的结果是一个包含 np.complex128 元素的 NumPy 数组,将结果输出到 AR_c16 中
assert_type(np.percentile(AR_f8, [50], out=AR_c16), npt.NDArray[np.complex128])

# 确保 np.quantile 返回的结果是一个包含任意类型的浮点数的 NumPy 数组,quantile 指定为 0.5
assert_type(np.quantile(AR_f8, 0.5), np.floating[Any])

# 确保 np.quantile 返回的结果是一个包含 np.complexfloating 元素的 NumPy 数组,quantile 指定为 0.5
assert_type(np.quantile(AR_c16, 0.5), np.complexfloating[Any, Any])

# 确保 np.quantile 返回的结果是一个包含 np.timedelta64 元素的 NumPy 数组,quantile 指定为 0.5
assert_type(np.quantile(AR_m, 0.5), np.timedelta64)

# 确保 np.quantile 返回的结果是一个包含 np.datetime64 元素的 NumPy 数组,quantile 指定为 0.5,并覆盖输入数组
assert_type(np.quantile(AR_M, 0.5, overwrite_input=True), np.datetime64)

# 确保 np.quantile 返回的结果是一个包含任意类型的元素的 NumPy 数组,quantile 指定为 0.5
assert_type(np.quantile(AR_O, 0.5), Any)

# 确保 np.quantile 返回的结果是一个包含 np.floating[Any] 元素的 NumPy 数组,quantile 指定为 [0.5]
assert_type(np.quantile(AR_f8, [0.5]), npt.NDArray[np.floating[Any]])

# 确保 np.quantile 返回的结果是一个包含 np.complexfloating[Any, Any] 元素的 NumPy 数组,quantile 指定为 [0.5]
assert_type(np.quantile(AR_c16, [0.5]), npt.NDArray[np.complexfloating[Any, Any]])

# 确保 np.quantile 返回的结果是一个包含 np.timedelta64 元素的 NumPy 数组,quantile 指定为 [0.5]
assert_type(np.quantile(AR_m, [0.5]), npt.NDArray[np.timedelta64])

# 确保 np.quantile 返回的结果是一个包含 np.datetime64 元素的 NumPy 数组,quantile 指定为 [0.5],使用 nearest 方法
assert_type(np.quantile(AR_M, [0.5], method="nearest"), npt.NDArray[np.datetime64])

# 确保 np.quantile 返回的结果是一个包含 np.object_ 元素的 NumPy 数组,quantile 指定为 [0.5]
assert_type(np.quantile(AR_O, [0.5]), npt.NDArray[np.object_])

# 确保 np.quantile 返回的结果是一个任意类型的 NumPy 数组,keepdims=True 保持维度信息
assert_type(np.quantile(AR_f8, [0.5], keepdims=True), Any)

# 确保 np.quantile 返回的结果是一个任意类型的 NumPy 数组,指定 axis=[1] 进行计算
assert_type(np.quantile(AR_f8, [0.5], axis=[1]), Any)

# 确保 np.quantile 返回的结果是一个包含 np.complex128 元素的 NumPy 数组,将结果输出到 AR_c16 中
assert_type(np.quantile(AR_f8, [0.5], out=AR_c16), npt.NDArray[np.complex128])

# 确保 np.meshgrid 返回的结果是一个元组,包含任意类型的 NumPy 数组
assert_type(np.meshgrid(AR_f8, AR_i8, copy=False), tuple[npt.NDArray[Any], ...])

# 确保 np.meshgrid 返回的结果是一个元组,包含任意类型的 NumPy 数组,使用 indexing="ij"
assert_type(np.meshgrid(AR_f8, AR_i8, AR_c16, indexing="ij"), tuple[npt.NDArray[Any], ...])

# 确保 np.delete 返回的结果是一个包含 np.float64 元素的 NumPy 数组,删除 np.s_[:5] 所指定的切片
assert_type(np.delete(AR_f8, np.s_[:5]), npt.NDArray[np.float64])

# 确保 np.delete 返回的结果是一个包含任意类型的元素的 NumPy 数组,删除 axis=0 上指定的索引 [0, 4, 9]
assert_type(np.delete(AR_LIKE_f8, [0, 4, 9], axis=0), npt.NDArray[Any])

# 确保 np.insert 返回的结果是一个包含 np.float64 元素的 NumPy 数组,在 np.s_[:5] 所指定的位置插入 5
assert_type(np.insert(AR_f8, np.s_[:5], 5), npt.NDArray[np.float64])

# 确保 np.insert 返回的结果是一个包含任意类型的元素的 NumPy 数组,在 axis=0 上指定的索引 [0, 4, 9] 处插入 [0.5, 9.2, 7]
assert_type(np.insert(AR_LIKE_f8, [0, 4, 9], [0.5, 9.2, 7], axis=0), npt.NDArray[Any])

# 确保 np.append 返回的结果是一个包含任意类型的元素的 NumPy 数组,在末尾追加 5
assert_type(np.append(AR_f8, 5), npt.NDArray[Any])

# 确保 np.append 返回的结果是一个包含任意类型的元素的 NumPy 数组,在 axis=0 上追加复数单位 1j
assert_type(np.append(AR_LIKE_f8, 1j, axis=0), npt.NDArray[Any])

# 确保 np.digitize 返回的结果是一个包含 np.intp 元素的 NumPy 数组,将 4.5 插入到 bins=[1] 中
assert_type(np.digitize(4.5, [1]), np.intp)

# 确保 np.digitize 返回的结果是一个包含 np.intp 元素的 NumPy 数组,将 AR_f8 插入到 bins=[1, 2, 3] 中
assert_type(np.digitize(AR_f8, [1, 2, 3]), npt.NDArray[np.intp])

.\numpy\numpy\typing\tests\data\reveal\lib_polynomial.pyi

import sys
from typing import Any, NoReturn
from collections.abc import Iterator

import numpy as np
import numpy.typing as npt

# 如果 Python 版本 >= 3.11,导入 typing 中的 assert_type 函数
if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    # 否则,从 typing_extensions 中导入 assert_type 函数
    from typing_extensions import assert_type

# 定义一些特定类型的 NumPy 数组变量
AR_b: npt.NDArray[np.bool]  # 布尔类型数组
AR_u4: npt.NDArray[np.uint32]  # 32位无符号整数类型数组
AR_i8: npt.NDArray[np.int64]  # 64位整数类型数组
AR_f8: npt.NDArray[np.float64]  # 双精度浮点数类型数组
AR_c16: npt.NDArray[np.complex128]  # 复数类型数组
AR_O: npt.NDArray[np.object_]  # 对象类型数组

poly_obj: np.poly1d  # 多项式对象 poly_obj

# 使用 assert_type 函数检查 poly_obj 的成员变量类型
assert_type(poly_obj.variable, str)  # 多项式变量名应为字符串
assert_type(poly_obj.order, int)  # 多项式阶数应为整数
assert_type(poly_obj.o, int)  # 未知变量 'o' 的数据类型
assert_type(poly_obj.roots, npt.NDArray[Any])  # 多项式的根应为任意类型的 NumPy 数组
assert_type(poly_obj.r, npt.NDArray[Any])  # 未知变量 'r' 的数据类型
assert_type(poly_obj.coeffs, npt.NDArray[Any])  # 多项式系数应为任意类型的 NumPy 数组
assert_type(poly_obj.c, npt.NDArray[Any])  # 未知变量 'c' 的数据类型
assert_type(poly_obj.coef, npt.NDArray[Any])  # 多项式系数应为任意类型的 NumPy 数组
assert_type(poly_obj.coefficients, npt.NDArray[Any])  # 多项式系数应为任意类型的 NumPy 数组
assert_type(poly_obj.__hash__, None)  # 多项式对象的哈希值为 None

# 使用 assert_type 函数检查多项式对象的方法返回类型
assert_type(poly_obj(1), Any)  # 对多项式求值应返回任意类型
assert_type(poly_obj([1]), npt.NDArray[Any])  # 对多项式数组求值应返回任意类型的 NumPy 数组
assert_type(poly_obj(poly_obj), np.poly1d)  # 对多项式对象求值应返回另一个多项式对象

assert_type(len(poly_obj), int)  # 获取多项式长度应返回整数
assert_type(-poly_obj, np.poly1d)  # 对多项式取负应返回另一个多项式对象
assert_type(+poly_obj, np.poly1d)  # 对多项式取正应返回另一个多项式对象

# 使用 assert_type 函数检查多项式对象与标量的运算结果类型
assert_type(poly_obj * 5, np.poly1d)  # 多项式与标量相乘应返回另一个多项式对象
assert_type(5 * poly_obj, np.poly1d)  # 标量与多项式相乘应返回另一个多项式对象
assert_type(poly_obj + 5, np.poly1d)  # 多项式与标量相加应返回另一个多项式对象
assert_type(5 + poly_obj, np.poly1d)  # 标量与多项式相加应返回另一个多项式对象
assert_type(poly_obj - 5, np.poly1d)  # 多项式与标量相减应返回另一个多项式对象
assert_type(5 - poly_obj, np.poly1d)  # 标量与多项式相减应返回另一个多项式对象
assert_type(poly_obj**1, np.poly1d)  # 多项式的整数次幂应返回另一个多项式对象
assert_type(poly_obj**1.0, np.poly1d)  # 多项式的浮点数次幂应返回另一个多项式对象
assert_type(poly_obj / 5, np.poly1d)  # 多项式除以标量应返回另一个多项式对象
assert_type(5 / poly_obj, np.poly1d)  # 标量除以多项式应返回另一个多项式对象

assert_type(poly_obj[0], Any)  # 获取多项式的第一个元素类型应为任意类型
poly_obj[0] = 5  # 将多项式的第一个元素赋值为 5
assert_type(iter(poly_obj), Iterator[Any])  # 对多项式对象进行迭代应返回任意类型的迭代器
assert_type(poly_obj.deriv(), np.poly1d)  # 对多项式进行求导应返回另一个多项式对象
assert_type(poly_obj.integ(), np.poly1d)  # 对多项式进行积分应返回另一个多项式对象

# 使用 assert_type 函数检查 np.poly 和 np.polyint 函数的返回类型
assert_type(np.poly(poly_obj), npt.NDArray[np.floating[Any]])  # 从多项式创建系数数组应返回浮点数类型的 NumPy 数组
assert_type(np.poly(AR_f8), npt.NDArray[np.floating[Any]])  # 从数组创建多项式系数应返回浮点数类型的 NumPy 数组
assert_type(np.poly(AR_c16), npt.NDArray[np.floating[Any]])  # 从复数数组创建多项式系数应返回浮点数类型的 NumPy 数组

assert_type(np.polyint(poly_obj), np.poly1d)  # 对多项式进行不定积分应返回另一个多项式对象
assert_type(np.polyint(AR_f8), npt.NDArray[np.floating[Any]])  # 对浮点数类型数组进行不定积分应返回浮点数类型的 NumPy 数组
assert_type(np.polyint(AR_f8, k=AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 对复数数组进行不定积分应返回复数类型的 NumPy 数组
assert_type(np.polyint(AR_O, m=2), npt.NDArray[np.object_])  # 对对象类型数组进行不定积分应返回对象类型的 NumPy 数组

assert_type(np.polyder(poly_obj), np.poly1d)  # 对多项式进行求导数应返回另一个多项式对象
assert_type(np.polyder(AR_f8), npt.NDArray[np.floating[Any]])  # 对浮点数类型数组进行求导数应返回浮点数类型的 NumPy 数组
assert_type(np.polyder(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])  # 对复数数组进行求导数应返回复数类型的 NumPy 数组
assert_type(np.polyder(AR_O, m=2), npt.NDArray[np.object_])  # 对对象类型数组进行求导数应返回对象类型的 NumPy 数组

# 使用 assert_type 函数检查 np.polyfit 函数的返回类型
assert_type(np.polyfit(AR_f8, AR_f8, 2), npt.NDArray[np.float64])  # 多项式拟合应返回浮点数类型的 NumPy 数组
assert_type(
    np.polyfit(AR_f8, AR_i8, 1, full=True),
    tuple[
        npt.NDArray[np.float64],  # 拟合系数数组应为浮点数类型的 NumPy 数组
        npt.NDArray[np.float64],  # 拟合残差数组应为浮点数类型的 NumPy 数组
        npt.NDArray[np.int32],    # 拟合秩数组应为 32 位整数类型的 NumPy 数组
        npt.NDArray[np.float64],  # 拟合奇异值数组应为浮点数类型的 NumPy 数组
        npt.NDArray[np.float64],  # 拟合条件数数组应为浮点数类型的 NumPy 数组
    ],
)
assert_type(
    np.polyfit(AR_u4, AR_f8, 1.0, cov="unscaled"),
    tuple[
        n
    # 定义一个包含五个元素的元组,每个元素都是 NumPy 数组,具有不同的数据类型
    tuple[
        npt.NDArray[np.complex128],  # 第一个元素,复数类型的 NumPy 数组
        npt.NDArray[np.float64],     # 第二个元素,64 位浮点数类型的 NumPy 数组
        npt.NDArray[np.int32],       # 第三个元素,32 位整数类型的 NumPy 数组
        npt.NDArray[np.float64],     # 第四个元素,64 位浮点数类型的 NumPy 数组
        npt.NDArray[np.float64],     # 第五个元素,64 位浮点数类型的 NumPy 数组
    ],
assert_type(
    # 对 np.polyfit 函数的调用,用于多项式拟合
    np.polyfit(AR_u4, AR_c16, 1.0, cov=True),
    # 期望返回的类型,一个元组,包含两个 np.complex128 类型的数组
    tuple[
        npt.NDArray[np.complex128],
        npt.NDArray[np.complex128],
    ],
)

assert_type(
    # 对 np.polyval 函数的调用,用于计算多项式在给定点的值
    np.polyval(AR_b, AR_b),
    # 期望返回的类型,一个 np.int64 类型的数组
    npt.NDArray[np.int64]
)

assert_type(
    np.polyval(AR_u4, AR_b),
    npt.NDArray[np.unsignedinteger[Any]]
)

assert_type(
    np.polyval(AR_i8, AR_i8),
    npt.NDArray[np.signedinteger[Any]]
)

assert_type(
    np.polyval(AR_f8, AR_i8),
    npt.NDArray[np.floating[Any]]
)

assert_type(
    np.polyval(AR_i8, AR_c16),
    npt.NDArray[np.complexfloating[Any, Any]]
)

assert_type(
    np.polyval(AR_O, AR_O),
    npt.NDArray[np.object_]
)

assert_type(
    np.polyadd(poly_obj, AR_i8),
    np.poly1d
)

assert_type(
    np.polyadd(AR_f8, poly_obj),
    np.poly1d
)

assert_type(
    np.polyadd(AR_b, AR_b),
    npt.NDArray[np.bool]
)

assert_type(
    np.polyadd(AR_u4, AR_b),
    npt.NDArray[np.unsignedinteger[Any]]
)

assert_type(
    np.polyadd(AR_i8, AR_i8),
    npt.NDArray[np.signedinteger[Any]]
)

assert_type(
    np.polyadd(AR_f8, AR_i8),
    npt.NDArray[np.floating[Any]]
)

assert_type(
    np.polyadd(AR_i8, AR_c16),
    npt.NDArray[np.complexfloating[Any, Any]]
)

assert_type(
    np.polyadd(AR_O, AR_O),
    npt.NDArray[np.object_]
)

assert_type(
    np.polysub(poly_obj, AR_i8),
    np.poly1d
)

assert_type(
    np.polysub(AR_f8, poly_obj),
    np.poly1d
)

assert_type(
    np.polysub(AR_b, AR_b),
    NoReturn
)

assert_type(
    np.polysub(AR_u4, AR_b),
    npt.NDArray[np.unsignedinteger[Any]]
)

assert_type(
    np.polysub(AR_i8, AR_i8),
    npt.NDArray[np.signedinteger[Any]]
)

assert_type(
    np.polysub(AR_f8, AR_i8),
    npt.NDArray[np.floating[Any]]
)

assert_type(
    np.polysub(AR_i8, AR_c16),
    npt.NDArray[np.complexfloating[Any, Any]]
)

assert_type(
    np.polysub(AR_O, AR_O),
    npt.NDArray[np.object_]
)

assert_type(
    np.polymul(poly_obj, AR_i8),
    np.poly1d
)

assert_type(
    np.polymul(AR_f8, poly_obj),
    np.poly1d
)

assert_type(
    np.polymul(AR_b, AR_b),
    npt.NDArray[np.bool]
)

assert_type(
    np.polymul(AR_u4, AR_b),
    npt.NDArray[np.unsignedinteger[Any]]
)

assert_type(
    np.polymul(AR_i8, AR_i8),
    npt.NDArray[np.signedinteger[Any]]
)

assert_type(
    np.polymul(AR_f8, AR_i8),
    npt.NDArray[np.floating[Any]]
)

assert_type(
    np.polymul(AR_i8, AR_c16),
    npt.NDArray[np.complexfloating[Any, Any]]
)

assert_type(
    np.polymul(AR_O, AR_O),
    npt.NDArray[np.object_]
)

assert_type(
    np.polydiv(poly_obj, AR_i8),
    tuple[np.poly1d, np.poly1d]
)

assert_type(
    np.polydiv(AR_f8, poly_obj),
    tuple[np.poly1d, np.poly1d]
)

assert_type(
    np.polydiv(AR_b, AR_b),
    tuple[npt.NDArray[np.floating[Any]], npt.NDArray[np.floating[Any]]]
)

assert_type(
    np.polydiv(AR_u4, AR_b),
    tuple[npt.NDArray[np.floating[Any]], npt.NDArray[np.floating[Any]]]
)

assert_type(
    np.polydiv(AR_i8, AR_i8),
    tuple[npt.NDArray[np.floating[Any]], npt.NDArray[np.floating[Any]]]
)

assert_type(
    np.polydiv(AR_f8, AR_i8),
    tuple[npt.NDArray[np.floating[Any]], npt.NDArray[np.floating[Any]]]
)

assert_type(
    np.polydiv(AR_i8, AR_c16),
    tuple[npt.NDArray[np.complexfloating[Any, Any]], npt.NDArray[np.complexfloating[Any, Any]]]
)

assert_type(
    np.polydiv(AR_O, AR_O),
    tuple[npt.NDArray[Any], npt.NDArray[Any]]
)

.\numpy\numpy\typing\tests\data\reveal\lib_utils.pyi

import sys
from io import StringIO

import numpy as np
import numpy.typing as npt
import numpy.lib.array_utils as array_utils

if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    from typing_extensions import assert_type

# 定义一个 numpy 数组类型 AR,元素类型为 np.float64
AR: npt.NDArray[np.float64]
# 定义一个字典类型 AR_DICT,键为字符串,值为 np.float64 类型的 numpy 数组
AR_DICT: dict[str, npt.NDArray[np.float64]]
# 定义一个 StringIO 对象 FILE,用于文件操作
FILE: StringIO

# 定义一个名为 func 的函数,参数为整数 a,返回布尔值,但函数体未实现
def func(a: int) -> bool: ...

# 对 array_utils.byte_bounds 函数调用 assert_type,期望返回类型是 tuple[int, int]
assert_type(array_utils.byte_bounds(AR), tuple[int, int])
# 对 array_utils.byte_bounds 函数以 np.float64 类型的实例为参数调用 assert_type
assert_type(array_utils.byte_bounds(np.float64()), tuple[int, int])

# 调用 np.info 函数,传入整数 1 和 FILE 对象作为输出参数,期望返回 None 类型
assert_type(np.info(1, output=FILE), None)

.\numpy\numpy\typing\tests\data\reveal\lib_version.pyi

# 导入 sys 模块,用于获取 Python 解释器的相关信息
import sys

# 从 numpy.lib 模块中导入 NumpyVersion 类
from numpy.lib import NumpyVersion

# 如果 Python 版本大于等于 3.11,则从 typing 模块中导入 assert_type 函数
if sys.version_info >= (3, 11):
    from typing import assert_type
# 否则,从 typing_extensions 模块中导入 assert_type 函数
else:
    from typing_extensions import assert_type

# 创建 NumpyVersion 对象,指定版本号为 "1.8.0"
version = NumpyVersion("1.8.0")

# 断言 version.vstring 属性的类型为 str
assert_type(version.vstring, str)
# 断言 version.version 属性的类型为 str
assert_type(version.version, str)
# 断言 version.major 属性的类型为 int
assert_type(version.major, int)
# 断言 version.minor 属性的类型为 int
assert_type(version.minor, int)
# 断言 version.bugfix 属性的类型为 int
assert_type(version.bugfix, int)
# 断言 version.pre_release 属性的类型为 str
assert_type(version.pre_release, str)
# 断言 version.is_devversion 属性的类型为 bool
assert_type(version.is_devversion, bool)

# 断言 version 与自身相等的结果的类型为 bool
assert_type(version == version, bool)
# 断言 version 与自身不相等的结果的类型为 bool
assert_type(version != version, bool)
# 断言 version 小于 "1.8.0" 的结果的类型为 bool
assert_type(version < "1.8.0", bool)
# 断言 version 小于等于自身的结果的类型为 bool
assert_type(version <= version, bool)
# 断言 version 大于自身的结果的类型为 bool
assert_type(version > version, bool)
# 断言 version 大于等于 "1.8.0" 的结果的类型为 bool
assert_type(version >= "1.8.0", bool)

.\numpy\numpy\typing\tests\data\reveal\linalg.pyi

import sys  # 导入sys模块,用于系统相关操作
from typing import Any  # 导入Any类型,表示可以是任何类型的变量

import numpy as np  # 导入NumPy库并重命名为np,用于数值计算
import numpy.typing as npt  # 导入NumPy的类型定义模块

from numpy.linalg._linalg import (  # 从NumPy的线性代数模块中导入多个特定的结果类
    QRResult, EigResult, EighResult, SVDResult, SlogdetResult
)

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果Python版本大于等于3.11,导入assert_type函数
else:
    from typing_extensions import assert_type  # 否则,从typing_extensions导入assert_type函数

AR_i8: npt.NDArray[np.int64]  # 定义AR_i8变量为NumPy数组,元素类型为np.int64
AR_f8: npt.NDArray[np.float64]  # 定义AR_f8变量为NumPy数组,元素类型为np.float64
AR_c16: npt.NDArray[np.complex128]  # 定义AR_c16变量为NumPy数组,元素类型为np.complex128
AR_O: npt.NDArray[np.object_]  # 定义AR_O变量为NumPy数组,元素类型为np.object_
AR_m: npt.NDArray[np.timedelta64]  # 定义AR_m变量为NumPy数组,元素类型为np.timedelta64
AR_S: npt.NDArray[np.str_]  # 定义AR_S变量为NumPy数组,元素类型为np.str_
AR_b: npt.NDArray[np.bool]  # 定义AR_b变量为NumPy数组,元素类型为np.bool

# 使用assert_type函数断言以下函数调用的返回类型,并添加注释说明每个函数的作用
assert_type(np.linalg.tensorsolve(AR_i8, AR_i8), npt.NDArray[np.float64])
assert_type(np.linalg.tensorsolve(AR_i8, AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.linalg.tensorsolve(AR_c16, AR_f8), npt.NDArray[np.complexfloating[Any, Any]])

assert_type(np.linalg.solve(AR_i8, AR_i8), npt.NDArray[np.float64])
assert_type(np.linalg.solve(AR_i8, AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.linalg.solve(AR_c16, AR_f8), npt.NDArray[np.complexfloating[Any, Any]])

assert_type(np.linalg.tensorinv(AR_i8), npt.NDArray[np.float64])
assert_type(np.linalg.tensorinv(AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.linalg.tensorinv(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])

assert_type(np.linalg.inv(AR_i8), npt.NDArray[np.float64])
assert_type(np.linalg.inv(AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.linalg.inv(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])

assert_type(np.linalg.matrix_power(AR_i8, -1), npt.NDArray[Any])
assert_type(np.linalg.matrix_power(AR_f8, 0), npt.NDArray[Any])
assert_type(np.linalg.matrix_power(AR_c16, 1), npt.NDArray[Any])
assert_type(np.linalg.matrix_power(AR_O, 2), npt.NDArray[Any])

assert_type(np.linalg.cholesky(AR_i8), npt.NDArray[np.float64])
assert_type(np.linalg.cholesky(AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.linalg.cholesky(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])

assert_type(np.linalg.outer(AR_i8, AR_i8), npt.NDArray[np.signedinteger[Any]])
assert_type(np.linalg.outer(AR_f8, AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.linalg.outer(AR_c16, AR_c16), npt.NDArray[np.complexfloating[Any, Any]])
assert_type(np.linalg.outer(AR_b, AR_b), npt.NDArray[np.bool])
assert_type(np.linalg.outer(AR_O, AR_O), npt.NDArray[np.object_])
assert_type(np.linalg.outer(AR_i8, AR_m), npt.NDArray[np.timedelta64]])

assert_type(np.linalg.qr(AR_i8), QRResult)
assert_type(np.linalg.qr(AR_f8), QRResult)
assert_type(np.linalg.qr(AR_c16), QRResult)

assert_type(np.linalg.eigvals(AR_i8), npt.NDArray[np.float64] | npt.NDArray[np.complex128])
assert_type(np.linalg.eigvals(AR_f8), npt.NDArray[np.floating[Any]] | npt.NDArray[np.complexfloating[Any, Any]])
assert_type(np.linalg.eigvals(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])

assert_type(np.linalg.eigvalsh(AR_i8), npt.NDArray[np.float64])
assert_type(np.linalg.eigvalsh(AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.linalg.eigvalsh(AR_c16), npt.NDArray[np.floating[Any]])
# 确保 AR_i8 的特征值分解结果为 EigResult 类型
assert_type(np.linalg.eig(AR_i8), EigResult)
# 确保 AR_f8 的特征值分解结果为 EigResult 类型
assert_type(np.linalg.eig(AR_f8), EigResult)
# 确保 AR_c16 的特征值分解结果为 EigResult 类型
assert_type(np.linalg.eig(AR_c16), EigResult)

# 确保 AR_i8 的厄米特特征值分解结果为 EighResult 类型
assert_type(np.linalg.eigh(AR_i8), EighResult)
# 确保 AR_f8 的厄米特特征值分解结果为 EighResult 类型
assert_type(np.linalg.eigh(AR_f8), EighResult)
# 确保 AR_c16 的厄米特特征值分解结果为 EighResult 类型
assert_type(np.linalg.eigh(AR_c16), EighResult)

# 确保 AR_i8 的奇异值分解结果为 SVDResult 类型
assert_type(np.linalg.svd(AR_i8), SVDResult)
# 确保 AR_f8 的奇异值分解结果为 SVDResult 类型
assert_type(np.linalg.svd(AR_f8), SVDResult)
# 确保 AR_c16 的奇异值分解结果为 SVDResult 类型
assert_type(np.linalg.svd(AR_c16), SVDResult)
# 确保 AR_i8 的奇异值分解结果为 numpy float64 数组
assert_type(np.linalg.svd(AR_i8, compute_uv=False), npt.NDArray[np.float64])
# 确保 AR_f8 的奇异值分解结果为任意浮点数数组
assert_type(np.linalg.svd(AR_f8, compute_uv=False), npt.NDArray[np.floating[Any]])
# 确保 AR_c16 的奇异值分解结果为任意复数浮点数数组
assert_type(np.linalg.svd(AR_c16, compute_uv=False), npt.NDArray[np.floating[Any]])

# 确保 AR_i8 的条件数计算结果为任意类型
assert_type(np.linalg.cond(AR_i8), Any)
# 确保 AR_f8 的条件数计算结果为任意类型
assert_type(np.linalg.cond(AR_f8), Any)
# 确保 AR_c16 的条件数计算结果为任意类型
assert_type(np.linalg.cond(AR_c16), Any)

# 确保 AR_i8 的矩阵秩计算结果为任意类型
assert_type(np.linalg.matrix_rank(AR_i8), Any)
# 确保 AR_f8 的矩阵秩计算结果为任意类型
assert_type(np.linalg.matrix_rank(AR_f8), Any)
# 确保 AR_c16 的矩阵秩计算结果为任意类型
assert_type(np.linalg.matrix_rank(AR_c16), Any)

# 确保 AR_i8 的伪逆计算结果为 numpy float64 数组
assert_type(np.linalg.pinv(AR_i8), npt.NDArray[np.float64])
# 确保 AR_f8 的伪逆计算结果为任意浮点数数组
assert_type(np.linalg.pinv(AR_f8), npt.NDArray[np.floating[Any]])
# 确保 AR_c16 的伪逆计算结果为任意复数浮点数数组
assert_type(np.linalg.pinv(AR_c16), npt.NDArray[np.complexfloating[Any, Any]])

# 确保 AR_i8 的行列式计算结果为任意类型
assert_type(np.linalg.slogdet(AR_i8), SlogdetResult)
# 确保 AR_f8 的行列式计算结果为任意类型
assert_type(np.linalg.slogdet(AR_f8), SlogdetResult)
# 确保 AR_c16 的行列式计算结果为任意类型
assert_type(np.linalg.slogdet(AR_c16), SlogdetResult)

# 确保 AR_i8 的行列式计算结果为任意类型
assert_type(np.linalg.det(AR_i8), Any)
# 确保 AR_f8 的行列式计算结果为任意类型
assert_type(np.linalg.det(AR_f8), Any)
# 确保 AR_c16 的行列式计算结果为任意类型
assert_type(np.linalg.det(AR_c16), Any)

# 确保 AR_i8 和 AR_i8 的最小二乘解计算结果为指定的 tuple 类型
assert_type(np.linalg.lstsq(AR_i8, AR_i8), tuple[npt.NDArray[np.float64], npt.NDArray[np.float64], np.int32, npt.NDArray[np.float64]])
# 确保 AR_i8 和 AR_f8 的最小二乘解计算结果为指定的 tuple 类型
assert_type(np.linalg.lstsq(AR_i8, AR_f8), tuple[npt.NDArray[np.floating[Any]], npt.NDArray[np.floating[Any]], np.int32, npt.NDArray[np.floating[Any]]])
# 确保 AR_f8 和 AR_c16 的最小二乘解计算结果为指定的 tuple 类型
assert_type(np.linalg.lstsq(AR_f8, AR_c16), tuple[npt.NDArray[np.complexfloating[Any, Any]], npt.NDArray[np.floating[Any]], np.int32, npt.NDArray[np.floating[Any]]])

# 确保 AR_i8 的范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.norm(AR_i8), np.floating[Any])
# 确保 AR_f8 的范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.norm(AR_f8), np.floating[Any])
# 确保 AR_c16 的范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.norm(AR_c16), np.floating[Any])
# 确保 AR_S 的范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.norm(AR_S), np.floating[Any])
# 确保 AR_f8 沿着指定轴的范数计算结果为任意类型
assert_type(np.linalg.norm(AR_f8, axis=0), Any)

# 确保 AR_i8 的矩阵范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.matrix_norm(AR_i8), np.floating[Any])
# 确保 AR_f8 的矩阵范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.matrix_norm(AR_f8), np.floating[Any])
# 确保 AR_c16 的矩阵范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.matrix_norm(AR_c16), np.floating[Any])
# 确保 AR_S 的矩阵范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.matrix_norm(AR_S), np.floating[Any])

# 确保 AR_i8 的向量范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.vector_norm(AR_i8), np.floating[Any])
# 确保 AR_f8 的向量范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.vector_norm(AR_f8), np.floating[Any])
# 确保 AR_c16 的向量范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.vector_norm(AR_c16), np.floating[Any])
# 确保 AR_S 的向量范数计算结果为 numpy floating[Any] 类型
assert_type(np.linalg.vector_norm(AR_S), np.floating[Any])

# 确保 AR_i8 和 AR_i8 的多点乘积计算结果为任意类型
assert_type(np.linalg.multi_dot([AR_i8, AR_i8]), Any)
# 确保 AR_i8 和 AR_f8 的多点乘积计算结果为任意类型
assert_type(np.linalg.multi_dot([AR_i8, AR_f8]), Any)
# 确保 AR_f8 和 AR_c16 的多点乘积计算结果为任意类型
assert_type(np.linalg.multi_dot([AR_f8, AR_c16]), Any)
# 确保 AR_O 和 AR_O 的多点乘积计算结果为任意类型
assert_type(np.linalg.multi_dot([AR_O, AR_O]), Any)
# 确保 AR_m 和 AR_m 的多点乘积计算结果为任意类型
assert_type(np.linalg.multi_dot([AR_m, AR_m]), Any)

# 确保 AR_i8 和
# 确定 np.linalg.cross 返回的结果类型为 npt.NDArray[np.floating[Any]]
assert_type(np.linalg.cross(AR_f8, AR_f8), npt.NDArray[np.floating[Any]])

# 确定 np.linalg.cross 返回的结果类型为 npt.NDArray[np.complexfloating[Any, Any]]
assert_type(np.linalg.cross(AR_c16, AR_c16), npt.NDArray[np.complexfloating[Any, Any]])

# 确定 np.linalg.matmul 返回的结果类型为 npt.NDArray[np.signedinteger[Any]]
assert_type(np.linalg.matmul(AR_i8, AR_i8), npt.NDArray[np.signedinteger[Any]])

# 确定 np.linalg.matmul 返回的结果类型为 npt.NDArray[np.floating[Any]]
assert_type(np.linalg.matmul(AR_f8, AR_f8), npt.NDArray[np.floating[Any]])

# 确定 np.linalg.matmul 返回的结果类型为 npt.NDArray[np.complexfloating[Any, Any]]
assert_type(np.linalg.matmul(AR_c16, AR_c16), npt.NDArray[np.complexfloating[Any, Any]])

.\numpy\numpy\typing\tests\data\reveal\matrix.pyi

import sys
from typing import Any  # 导入需要的类型提示

import numpy as np  # 导入NumPy库
import numpy.typing as npt  # 导入NumPy类型提示

if sys.version_info >= (3, 11):
    from typing import assert_type  # Python版本支持assert_type函数
else:
    from typing_extensions import assert_type  # 使用typing_extensions中的assert_type函数

mat: np.matrix[Any, np.dtype[np.int64]]  # 声明一个NumPy整数矩阵mat
ar_f8: npt.NDArray[np.float64]  # 声明一个NumPy浮点数数组ar_f8

assert_type(mat * 5, np.matrix[Any, Any])  # 断言mat * 5的结果是NumPy矩阵
assert_type(5 * mat, np.matrix[Any, Any])  # 断言5 * mat的结果是NumPy矩阵
mat *= 5  # mat乘以5,原地更新mat矩阵

assert_type(mat**5, np.matrix[Any, Any])  # 断言mat的5次方的结果是NumPy矩阵
mat **= 5  # 将mat矩阵升幂至5次方,原地更新mat矩阵

assert_type(mat.sum(), Any)  # 断言mat所有元素的和的类型
assert_type(mat.mean(), Any)  # 断言mat所有元素的平均值的类型
assert_type(mat.std(), Any)  # 断言mat所有元素的标准差的类型
assert_type(mat.var(), Any)  # 断言mat所有元素的方差的类型
assert_type(mat.prod(), Any)  # 断言mat所有元素的乘积的类型
assert_type(mat.any(), np.bool)  # 断言mat是否有任意一个True值,返回NumPy布尔类型
assert_type(mat.all(), np.bool)  # 断言mat是否所有元素都为True,返回NumPy布尔类型
assert_type(mat.max(), np.int64)  # 断言mat所有元素的最大值的类型
assert_type(mat.min(), np.int64)  # 断言mat所有元素的最小值的类型
assert_type(mat.argmax(), np.intp)  # 断言mat最大值的索引的类型
assert_type(mat.argmin(), np.intp)  # 断言mat最小值的索引的类型
assert_type(mat.ptp(), np.int64)  # 断言mat所有元素的峰峰值的类型

assert_type(mat.sum(axis=0), np.matrix[Any, Any])  # 断言按列求和的结果是NumPy矩阵
assert_type(mat.mean(axis=0), np.matrix[Any, Any])  # 断言按列求平均值的结果是NumPy矩阵
assert_type(mat.std(axis=0), np.matrix[Any, Any])  # 断言按列求标准差的结果是NumPy矩阵
assert_type(mat.var(axis=0), np.matrix[Any, Any])  # 断言按列求方差的结果是NumPy矩阵
assert_type(mat.prod(axis=0), np.matrix[Any, Any])  # 断言按列求乘积的结果是NumPy矩阵
assert_type(mat.any(axis=0), np.matrix[Any, np.dtype[np.bool]])  # 断言按列判断是否有True值,返回NumPy布尔类型的矩阵
assert_type(mat.all(axis=0), np.matrix[Any, np.dtype[np.bool]])  # 断言按列判断是否所有元素都为True,返回NumPy布尔类型的矩阵
assert_type(mat.max(axis=0), np.matrix[Any, np.dtype[np.int64]])  # 断言按列求最大值的结果的类型
assert_type(mat.min(axis=0), np.matrix[Any, np.dtype[np.int64]])  # 断言按列求最小值的结果的类型
assert_type(mat.argmax(axis=0), np.matrix[Any, np.dtype[np.intp]])  # 断言按列求最大值索引的类型
assert_type(mat.argmin(axis=0), np.matrix[Any, np.dtype[np.intp]])  # 断言按列求最小值索引的类型
assert_type(mat.ptp(axis=0), np.matrix[Any, np.dtype[np.int64]])  # 断言按列求峰峰值的类型

assert_type(mat.sum(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列求和结果存储到ar_f8的类型
assert_type(mat.mean(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列求平均值结果存储到ar_f8的类型
assert_type(mat.std(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列求标准差结果存储到ar_f8的类型
assert_type(mat.var(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列求方差结果存储到ar_f8的类型
assert_type(mat.prod(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列求乘积结果存储到ar_f8的类型
assert_type(mat.any(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列判断是否有True值结果存储到ar_f8的类型
assert_type(mat.all(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列判断是否所有元素都为True结果存储到ar_f8的类型
assert_type(mat.max(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列求最大值结果存储到ar_f8的类型
assert_type(mat.min(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列求最小值结果存储到ar_f8的类型
assert_type(mat.argmax(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列求最大值索引结果存储到ar_f8的类型
assert_type(mat.argmin(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列求最小值索引结果存储到ar_f8的类型
assert_type(mat.ptp(out=ar_f8), npt.NDArray[np.float64])  # 断言将按列求峰峰值结果存储到ar_f8的类型

assert_type(mat.T, np.matrix[Any, np.dtype[np.int64]])  # 断言mat的转置的类型
assert_type(mat.I, np.matrix[Any, Any])  # 断言mat的逆矩阵的类型
assert_type(mat.A, npt.NDArray[np.int64])  # 断言将mat转换为数组的类型
assert_type(mat.A1, npt.NDArray[np.int64])  # 断言将mat转换为一维数组的类型
assert_type(mat.H, np.matrix[Any, np.dtype[np.int64]])  # 断言mat的共轭转置的类型
assert_type(mat.getT(), np.matrix[Any, np.dtype[np.int64]])  # 断言获取mat的转置的类型
assert_type(mat.getI(), np.matrix[Any, Any])  # 断言获取mat的逆矩阵的类型
assert_type(mat.getA(), npt.NDArray[np.int64])  # 断言获取mat的数组的类型
assert_type(mat.getA1(), npt.NDArray[np.int64])  # 断言获取mat的一维数组的类型
assert_type(mat.getH(), np.matrix[Any, np.dtype[np.int64]])  # 断言获取mat的共轭转置的类型

assert_type(np.bmat(ar_f8), np.matrix[Any, Any])  # 断言将ar_f8作为矩阵块矩阵的类型
assert_type(np.bmat([[0, 1, 2]]), np.matrix[Any, Any])  # 断言将列表作为矩阵块矩阵的类型
assert_type(np.bmat("mat"), np.matrix[Any, Any])  # 断言将字符串作为矩阵块矩阵的类型

assert_type(np.asmatrix(ar_f8, dtype=np.int64), np.matrix[Any, Any])  # 断言将ar_f8转换为指定数据类型的矩阵的类型

.\numpy\numpy\typing\tests\data\reveal\memmap.pyi

import sys
from typing import Any

import numpy as np  # 导入 NumPy 库

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果 Python 版本大于等于 3.11,则使用标准 typing 模块中的 assert_type 函数
else:
    from typing_extensions import assert_type  # 否则,从 typing_extensions 模块中导入 assert_type 函数

memmap_obj: np.memmap[Any, np.dtype[np.str_]]  # 定义一个类型为 np.memmap 的变量 memmap_obj

assert_type(np.memmap.__array_priority__, float)  # 断言 np.memmap.__array_priority__ 的类型为 float
assert_type(memmap_obj.__array_priority__, float)  # 断言 memmap_obj.__array_priority__ 的类型为 float
assert_type(memmap_obj.filename, str | None)  # 断言 memmap_obj.filename 的类型为 str 或 None
assert_type(memmap_obj.offset, int)  # 断言 memmap_obj.offset 的类型为 int
assert_type(memmap_obj.mode, str)  # 断言 memmap_obj.mode 的类型为 str
assert_type(memmap_obj.flush(), None)  # 断言 memmap_obj.flush() 的返回类型为 None

assert_type(np.memmap("file.txt", offset=5), np.memmap[Any, np.dtype[np.uint8]])  # 断言 np.memmap("file.txt", offset=5) 的类型
assert_type(np.memmap(b"file.txt", dtype=np.float64, shape=(10, 3)), np.memmap[Any, np.dtype[np.float64]])  # 断言 np.memmap(b"file.txt", dtype=np.float64, shape=(10, 3)) 的类型
with open("file.txt", "rb") as f:
    assert_type(np.memmap(f, dtype=float, order="K"), np.memmap[Any, np.dtype[Any]])  # 断言 np.memmap(f, dtype=float, order="K") 的类型

assert_type(memmap_obj.__array_finalize__(object()), None)  # 断言 memmap_obj.__array_finalize__(object()) 的返回类型为 None

.\numpy\numpy\typing\tests\data\reveal\mod.pyi

import sys
from typing import Any

import numpy as np
import numpy.typing as npt
from numpy._typing import _32Bit, _64Bit

if sys.version_info >= (3, 11):
    from typing import assert_type  # 导入 assert_type 函数(Python 3.11 及以上版本)
else:
    from typing_extensions import assert_type  # 导入 assert_type 函数(Python 3.10 及以下版本)

f8 = np.float64()  # 创建一个 64 位浮点数对象
i8 = np.int64()    # 创建一个 64 位整数对象
u8 = np.uint64()   # 创建一个 64 位无符号整数对象

f4 = np.float32()  # 创建一个 32 位浮点数对象
i4 = np.int32()    # 创建一个 32 位整数对象
u4 = np.uint32()   # 创建一个 32 位无符号整数对象

td = np.timedelta64(0, "D")  # 创建一个以天为单位的 timedelta64 对象
b_ = np.bool()     # 创建一个布尔值对象

b = bool()         # 创建一个 Python 内置的布尔值对象
f = float()        # 创建一个 Python 内置的浮点数对象
i = int()          # 创建一个 Python 内置的整数对象

AR_b: npt.NDArray[np.bool]        # 声明一个 numpy 数组类型注解,包含布尔值
AR_m: npt.NDArray[np.timedelta64] # 声明一个 numpy 数组类型注解,包含 timedelta64 类型

# Time structures

assert_type(td % td, np.timedelta64)                # 断言 td 与 td 的取模操作结果是 timedelta64 类型
assert_type(AR_m % td, npt.NDArray[np.timedelta64]) # 断言 AR_m 与 td 的取模操作结果是包含 timedelta64 的 numpy 数组类型
assert_type(td % AR_m, npt.NDArray[np.timedelta64]) # 断言 td 与 AR_m 的取模操作结果是包含 timedelta64 的 numpy 数组类型

assert_type(divmod(td, td), tuple[np.int64, np.timedelta64])                  # 断言 td 与 td 的 divmod 操作结果是包含 int64 和 timedelta64 的元组
assert_type(divmod(AR_m, td), tuple[npt.NDArray[np.int64], npt.NDArray[np.timedelta64]])  # 断言 AR_m 与 td 的 divmod 操作结果是包含对应 numpy 数组类型的元组
assert_type(divmod(td, AR_m), tuple[npt.NDArray[np.int64], npt.NDArray[np.timedelta64]])  # 断言 td 与 AR_m 的 divmod 操作结果是包含对应 numpy 数组类型的元组

# Bool

assert_type(b_ % b, np.int8)      # 断言 b_ 与 b 的取模操作结果是 int8 类型
assert_type(b_ % i, np.int_)      # 断言 b_ 与 i 的取模操作结果是 int_ 类型
assert_type(b_ % f, np.float64)   # 断言 b_ 与 f 的取模操作结果是 float64 类型
assert_type(b_ % b_, np.int8)     # 断言 b_ 与 b_ 的取模操作结果是 int8 类型
assert_type(b_ % i8, np.int64)    # 断言 b_ 与 i8 的取模操作结果是 int64 类型
assert_type(b_ % u8, np.uint64)   # 断言 b_ 与 u8 的取模操作结果是 uint64 类型
assert_type(b_ % f8, np.float64)  # 断言 b_ 与 f8 的取模操作结果是 float64 类型
assert_type(b_ % AR_b, npt.NDArray[np.int8])  # 断言 b_ 与 AR_b 的取模操作结果是包含 int8 的 numpy 数组类型

assert_type(divmod(b_, b), tuple[np.int8, np.int8])        # 断言 b_ 与 b 的 divmod 操作结果是包含 int8 的元组
assert_type(divmod(b_, i), tuple[np.int_, np.int_])        # 断言 b_ 与 i 的 divmod 操作结果是包含 int_ 的元组
assert_type(divmod(b_, f), tuple[np.float64, np.float64])  # 断言 b_ 与 f 的 divmod 操作结果是包含 float64 的元组
assert_type(divmod(b_, b_), tuple[np.int8, np.int8])       # 断言 b_ 与 b_ 的 divmod 操作结果是包含 int8 的元组
assert_type(divmod(b_, i8), tuple[np.int64, np.int64])     # 断言 b_ 与 i8 的 divmod 操作结果是包含 int64 的元组
assert_type(divmod(b_, u8), tuple[np.uint64, np.uint64])   # 断言 b_ 与 u8 的 divmod 操作结果是包含 uint64 的元组
assert_type(divmod(b_, f8), tuple[np.float64, np.float64]) # 断言 b_ 与 f8 的 divmod 操作结果是包含 float64 的元组
assert_type(divmod(b_, AR_b), tuple[npt.NDArray[np.int8], npt.NDArray[np.int8]])  # 断言 b_ 与 AR_b 的 divmod 操作结果是包含对应 numpy 数组类型的元组

assert_type(b % b_, np.int8)      # 断言 b 与 b_ 的取模操作结果是 int8 类型
assert_type(i % b_, np.int_)      # 断言 i 与 b_ 的取模操作结果是 int_ 类型
assert_type(f % b_, np.float64)   # 断言 f 与 b_ 的取模操作结果是 float64 类型
assert_type(b_ % b_, np.int8)     # 断言 b_ 与 b_ 的取模操作结果是 int8 类型
assert_type(i8 % b_, np.int64)    # 断言 i8 与 b_ 的取模操作结果是 int64 类型
assert_type(u8 % b_, np.uint64)   # 断言 u8 与 b_ 的取模操作结果是 uint64 类型
assert_type(f8 % b_, np.float64)  # 断言 f8 与 b_ 的取模操作结果是 float64 类型
assert_type(AR_b % b_, npt.NDArray[np.int8])  # 断言 AR_b 与 b_ 的取模操作结果是包含 int8 的 numpy 数组类型

assert_type(divmod(b, b_), tuple[np.int8, np.int8])        # 断言 b 与 b_ 的 divmod 操作结果是包含 int8 的元组
assert_type(divmod(i, b_), tuple[np.int_, np.int_])        # 断言 i 与 b_ 的 divmod 操作结果是包含 int_ 的元组
assert_type(divmod(f, b_), tuple[np.float64, np.float64])  # 断言 f 与 b_ 的 divmod 操作结果是包含 float64 的元组
assert_type(divmod(b_, b_), tuple[np.int8, np.int8])       # 断言 b_ 与 b_ 的 divmod 操作结果是包含 int8 的元组
assert_type(divmod(i8, b_), tuple[np.int64, np.int64])     # 断言 i8 与 b_ 的 divmod 操作结果是包含 int64 的元组
assert_type(divmod(u8, b_), tuple[np.uint64, np.uint64])   # 断言 u8 与 b_ 的 divmod 操作结果是包含 uint64 的元组
assert_type(divmod(f8, b_), tuple[np.float64, np.float64]) # 断言 f8 与 b_ 的 divmod 操作结果是包含 float64 的元组
assert_type(divmod(AR_b, b_), tuple[npt.NDArray[np.int8], npt.NDArray[np.int8]])  # 断言 AR_b 与 b_ 的 divmod 操作结果是包含对应 numpy 数组类型的元组

# int

assert_type(i8 % b, np.int64)     # 断言 i8 与 b 的取模操作结果是 int64 类型
assert_type(i8 % f, np.float64)   # 断言 i8 与 f 的取模操作结果是 float64 类型
assert_type(i8 % i8, np.int64)    # 断言 i8 与 i8 的取模操作结果是 int64 类型
assert_type(i8 % f8, np.float64)  # 断言 i8 与 f8 的取模操作
assert_type(divmod(i8, i4), tuple[np.signedinteger[_32Bit | _64Bit], np.signedinteger[_32Bit | _64Bit]])
# 确保对两个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为可能的带符号 32 位或 64 位整数类型

assert_type(divmod(i8, f4), tuple[np.floating[_32Bit | _64Bit], np.floating[_32Bit | _64Bit]])
# 确保对一个整数和一个浮点数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为可能的 32 位或 64 位浮点数类型

assert_type(divmod(i4, i4), tuple[np.int32, np.int32])
# 确保对两个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 32 位整数

assert_type(divmod(i4, f4), tuple[np.float32, np.float32])
# 确保对一个整数和一个浮点数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 32 位浮点数

assert_type(divmod(i8, AR_b), tuple[npt.NDArray[np.signedinteger[Any]], npt.NDArray[np.signedinteger[Any]]])
# 确保对一个整数和一个数组进行 divmod 操作,返回一个包含两个元素的元组,元素类型为数组中可能的带符号整数类型

assert_type(b % i8, np.int64)
# 确保计算整数与整数的取模运算,结果为 64 位整数

assert_type(f % i8, np.float64)
# 确保计算浮点数与整数的取模运算,结果为 64 位浮点数

assert_type(i8 % i8, np.int64)
# 确保计算整数与整数的取模运算,结果为 64 位整数

assert_type(f8 % i8, np.float64)
# 确保计算浮点数与整数的取模运算,结果为 64 位浮点数

assert_type(i8 % i4, np.signedinteger[_32Bit | _64Bit])
# 确保计算一个整数与另一个整数的取模运算,结果为可能的带符号 32 位或 64 位整数类型

assert_type(f8 % i4, np.floating[_32Bit | _64Bit])
# 确保计算一个浮点数与整数的取模运算,结果为可能的 32 位或 64 位浮点数类型

assert_type(i4 % i4, np.int32)
# 确保计算整数与整数的取模运算,结果为 32 位整数

assert_type(f4 % i4, np.float32)
# 确保计算浮点数与整数的取模运算,结果为 32 位浮点数

assert_type(AR_b % i8, npt.NDArray[np.signedinteger[Any]])
# 确保计算数组与整数的取模运算,结果为数组中可能的带符号整数类型

assert_type(divmod(b, i8), tuple[np.int64, np.int64])
# 确保对一个整数和一个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 64 位整数

assert_type(divmod(f, i8), tuple[np.float64, np.float64])
# 确保对一个浮点数和一个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 64 位浮点数

assert_type(divmod(i8, i8), tuple[np.int64, np.int64])
# 确保对两个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 64 位整数

assert_type(divmod(f8, i8), tuple[np.float64, np.float64])
# 确保对一个浮点数和一个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 64 位浮点数

assert_type(divmod(i4, i8), tuple[np.signedinteger[_32Bit | _64Bit], np.signedinteger[_32Bit | _64Bit]])
# 确保对一个整数和一个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为可能的带符号 32 位或 64 位整数类型

assert_type(divmod(f4, i8), tuple[np.floating[_32Bit | _64Bit], np.floating[_32Bit | _64Bit]])
# 确保对一个浮点数和一个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为可能的 32 位或 64 位浮点数类型

assert_type(divmod(i4, i4), tuple[np.int32, np.int32])
# 确保对两个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 32 位整数

assert_type(divmod(f4, i4), tuple[np.float32, np.float32])
# 确保对一个浮点数和一个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 32 位浮点数

assert_type(divmod(AR_b, i8), tuple[npt.NDArray[np.signedinteger[Any]], npt.NDArray[np.signedinteger[Any]]])
# 确保对一个数组和一个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为数组中可能的带符号整数类型

# float

assert_type(f8 % b, np.float64)
# 确保计算浮点数与整数的取模运算,结果为 64 位浮点数

assert_type(f8 % f, np.float64)
# 确保计算浮点数与浮点数的取模运算,结果为 64 位浮点数

assert_type(i8 % f4, np.floating[_32Bit | _64Bit])
# 确保计算整数与浮点数的取模运算,结果为可能的 32 位或 64 位浮点数类型

assert_type(f4 % f4, np.float32)
# 确保计算浮点数与浮点数的取模运算,结果为 32 位浮点数

assert_type(f8 % AR_b, npt.NDArray[np.floating[Any]])
# 确保计算浮点数与数组的取模运算,结果为数组中可能的浮点数类型

assert_type(divmod(f8, b), tuple[np.float64, np.float64])
# 确保对一个浮点数和一个整数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 64 位浮点数

assert_type(divmod(f8, f), tuple[np.float64, np.float64])
# 确保对一个浮点数和一个浮点数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 64 位浮点数

assert_type(divmod(f8, f8), tuple[np.float64, np.float64])
# 确保对两个浮点数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 64 位浮点数

assert_type(divmod(f8, f4), tuple[np.floating[_32Bit | _64Bit], np.floating[_32Bit | _64Bit]])
# 确保对一个浮点数和一个浮点数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为可能的 32 位或 64 位浮点数类型

assert_type(divmod(f4, f4), tuple[np.float32, np.float32])
# 确保对两个浮点数进行 divmod 操作,返回一个包含两个元素的元组,元素类型为 32 位浮点数

assert_type(divmod(f8, AR_b), tuple[npt.NDArray[np.floating[Any]], npt.NDArray[np.floating[Any]]])
# 确保对一个浮

.\numpy\numpy\typing\tests\data\reveal\modules.pyi

import sys  # 导入sys模块,用于访问系统相关信息
import types  # 导入types模块,用于操作Python类型信息

import numpy as np  # 导入NumPy库并使用np作为别名
from numpy import f2py  # 从NumPy库中导入f2py模块

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果Python版本大于等于3.11,导入assert_type函数
else:
    from typing_extensions import assert_type  # 否则,导入typing_extensions中的assert_type函数

assert_type(np, types.ModuleType)  # 断言np是一个ModuleType类型的对象

assert_type(np.char, types.ModuleType)  # 断言np.char是一个ModuleType类型的对象
assert_type(np.ctypeslib, types.ModuleType)  # 断言np.ctypeslib是一个ModuleType类型的对象
assert_type(np.emath, types.ModuleType)  # 断言np.emath是一个ModuleType类型的对象
assert_type(np.fft, types.ModuleType)  # 断言np.fft是一个ModuleType类型的对象
assert_type(np.lib, types.ModuleType)  # 断言np.lib是一个ModuleType类型的对象
assert_type(np.linalg, types.ModuleType)  # 断言np.linalg是一个ModuleType类型的对象
assert_type(np.ma, types.ModuleType)  # 断言np.ma是一个ModuleType类型的对象
assert_type(np.matrixlib, types.ModuleType)  # 断言np.matrixlib是一个ModuleType类型的对象
assert_type(np.polynomial, types.ModuleType)  # 断言np.polynomial是一个ModuleType类型的对象
assert_type(np.random, types.ModuleType)  # 断言np.random是一个ModuleType类型的对象
assert_type(np.rec, types.ModuleType)  # 断言np.rec是一个ModuleType类型的对象
assert_type(np.testing, types.ModuleType)  # 断言np.testing是一个ModuleType类型的对象
assert_type(np.version, types.ModuleType)  # 断言np.version是一个ModuleType类型的对象
assert_type(np.exceptions, types.ModuleType)  # 断言np.exceptions是一个ModuleType类型的对象
assert_type(np.dtypes, types.ModuleType)  # 断言np.dtypes是一个ModuleType类型的对象

assert_type(np.lib.format, types.ModuleType)  # 断言np.lib.format是一个ModuleType类型的对象
assert_type(np.lib.mixins, types.ModuleType)  # 断言np.lib.mixins是一个ModuleType类型的对象
assert_type(np.lib.scimath, types.ModuleType)  # 断言np.lib.scimath是一个ModuleType类型的对象
assert_type(np.lib.stride_tricks, types.ModuleType)  # 断言np.lib.stride_tricks是一个ModuleType类型的对象
assert_type(np.ma.extras, types.ModuleType)  # 断言np.ma.extras是一个ModuleType类型的对象
assert_type(np.polynomial.chebyshev, types.ModuleType)  # 断言np.polynomial.chebyshev是一个ModuleType类型的对象
assert_type(np.polynomial.hermite, types.ModuleType)  # 断言np.polynomial.hermite是一个ModuleType类型的对象
assert_type(np.polynomial.hermite_e, types.ModuleType)  # 断言np.polynomial.hermite_e是一个ModuleType类型的对象
assert_type(np.polynomial.laguerre, types.ModuleType)  # 断言np.polynomial.laguerre是一个ModuleType类型的对象
assert_type(np.polynomial.legendre, types.ModuleType)  # 断言np.polynomial.legendre是一个ModuleType类型的对象
assert_type(np.polynomial.polynomial, types.ModuleType)  # 断言np.polynomial.polynomial是一个ModuleType类型的对象

assert_type(np.__path__, list[str])  # 断言np.__path__是一个字符串列表类型的对象
assert_type(np.__version__, str)  # 断言np.__version__是一个字符串类型的对象
assert_type(np.test, np._pytesttester.PytestTester)  # 断言np.test是一个np._pytesttester.PytestTester类型的对象
assert_type(np.test.module_name, str)  # 断言np.test.module_name是一个字符串类型的对象

assert_type(np.__all__, list[str])  # 断言np.__all__是一个字符串列表类型的对象
assert_type(np.char.__all__, list[str])  # 断言np.char.__all__是一个字符串列表类型的对象
assert_type(np.ctypeslib.__all__, list[str])  # 断言np.ctypeslib.__all__是一个字符串列表类型的对象
assert_type(np.emath.__all__, list[str])  # 断言np.emath.__all__是一个字符串列表类型的对象
assert_type(np.lib.__all__, list[str])  # 断言np.lib.__all__是一个字符串列表类型的对象
assert_type(np.ma.__all__, list[str])  # 断言np.ma.__all__是一个字符串列表类型的对象
assert_type(np.random.__all__, list[str])  # 断言np.random.__all__是一个字符串列表类型的对象
assert_type(np.rec.__all__, list[str])  # 断言np.rec.__all__是一个字符串列表类型的对象
assert_type(np.testing.__all__, list[str])  # 断言np.testing.__all__是一个字符串列表类型的对象
assert_type(f2py.__all__, list[str])  # 断言f2py.__all__是一个字符串列表类型的对象

.\numpy\numpy\typing\tests\data\reveal\multiarray.pyi

# 导入系统模块 sys
import sys
# 导入 datetime 模块并使用别名 dt
import datetime as dt
# 导入类型提示模块 Any 和 TypeVar
from typing import Any, TypeVar

# 导入 numpy 库,并使用别名 np
import numpy as np
# 导入 numpy.typing 模块中的 NDArray 类型提示
import numpy.typing as npt

# 如果 Python 版本大于等于 3.11,导入 typing 模块中的 assert_type 函数
# 否则,从 typing_extensions 模块中导入 assert_type 函数
if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    from typing_extensions import assert_type

# 定义一个类型变量 _SCT,它是 np.generic 类型的子类型,并支持协变性
_SCT = TypeVar("_SCT", bound=np.generic, covariant=True)

# 定义一个名为 SubClass 的类,它继承自 npt.NDArray[_SCT] 类型
class SubClass(npt.NDArray[_SCT]): ...

# 定义 subclass 变量,其类型为 SubClass[np.float64]
subclass: SubClass[np.float64]

# 定义 AR_f8 变量,其类型为 npt.NDArray[np.float64]
AR_f8: npt.NDArray[np.float64]
# 定义 AR_i8 变量,其类型为 npt.NDArray[np.int64]
AR_i8: npt.NDArray[np.int64]
# 定义 AR_u1 变量,其类型为 npt.NDArray[np.uint8]
AR_u1: npt.NDArray[np.uint8]
# 定义 AR_m 变量,其类型为 npt.NDArray[np.timedelta64]
AR_m: npt.NDArray[np.timedelta64]
# 定义 AR_M 变量,其类型为 npt.NDArray[np.datetime64]
AR_M: npt.NDArray[np.datetime64]

# 定义 AR_LIKE_f 变量,其类型为 list[float]
AR_LIKE_f: list[float]
# 定义 AR_LIKE_i 变量,其类型为 list[int]
AR_LIKE_i: list[int]

# 定义 m 变量,其类型为 np.timedelta64
m: np.timedelta64
# 定义 M 变量,其类型为 np.datetime64
M: np.datetime64

# 使用 AR_f8 创建一个广播对象 b_f8
b_f8 = np.broadcast(AR_f8)
# 使用 AR_i8, AR_f8, AR_f8 创建一个广播对象 b_i8_f8_f8
b_i8_f8_f8 = np.broadcast(AR_i8, AR_f8, AR_f8)

# 定义一个迭代器对象 nditer_obj,其类型为 np.nditer
nditer_obj: np.nditer

# 定义 date_scalar 变量,其类型为 dt.date
date_scalar: dt.date
# 定义 date_seq 变量,其类型为 list[dt.date]
date_seq: list[dt.date]
# 定义 timedelta_seq 变量,其类型为 list[dt.timedelta]
timedelta_seq: list[dt.timedelta]

# 定义一个名为 func 的函数,它接受一个 int 类型的参数 a,并返回一个 bool 类型的值
def func(a: int) -> bool: ...

# 使用 assert_type 函数验证 b_f8 的下一个值的类型为 tuple[Any, ...]
assert_type(next(b_f8), tuple[Any, ...])
# 使用 assert_type 函数验证 b_f8 重置的返回类型为 None
assert_type(b_f8.reset(), None)
# 使用 assert_type 函数验证 b_f8 的索引值的类型为 int
assert_type(b_f8.index, int)
# 使用 assert_type 函数验证 b_f8 的迭代器元组的类型为 tuple[np.flatiter[Any], ...]
assert_type(b_f8.iters, tuple[np.flatiter[Any], ...])
# 使用 assert_type 函数验证 b_f8 的维度数的类型为 int
assert_type(b_f8.nd, int)
# 使用 assert_type 函数验证 b_f8 的维度数量的类型为 int
assert_type(b_f8.ndim, int)
# 使用 assert_type 函数验证 b_f8 的迭代器数量的类型为 int
assert_type(b_f8.numiter, int)
# 使用 assert_type 函数验证 b_f8 的形状元组的类型为 tuple[int, ...]
assert_type(b_f8.shape, tuple[int, ...])
# 使用 assert_type 函数验证 b_f8 的大小的类型为 int
assert_type(b_f8.size, int)

# 使用 assert_type 函数验证 b_i8_f8_f8 的下一个值的类型为 tuple[Any, ...]
assert_type(next(b_i8_f8_f8), tuple[Any, ...])
# 使用 assert_type 函数验证 b_i8_f8_f8 重置的返回类型为 None
assert_type(b_i8_f8_f8.reset(), None)
# 使用 assert_type 函数验证 b_i8_f8_f8 的索引值的类型为 int
assert_type(b_i8_f8_f8.index, int)
# 使用 assert_type 函数验证 b_i8_f8_f8 的迭代器元组的类型为 tuple[np.flatiter[Any], ...]
assert_type(b_i8_f8_f8.iters, tuple[np.flatiter[Any], ...])
# 使用 assert_type 函数验证 b_i8_f8_f8 的维度数的类型为 int
assert_type(b_i8_f8_f8.nd, int)
# 使用 assert_type 函数验证 b_i8_f8_f8 的维度数量的类型为 int
assert_type(b_i8_f8_f8.ndim, int)
# 使用 assert_type 函数验证 b_i8_f8_f8 的迭代器数量的类型为 int
assert_type(b_i8_f8_f8.numiter, int)
# 使用 assert_type 函数验证 b_i8_f8_f8 的形状元组的类型为 tuple[int, ...]
assert_type(b_i8_f8_f8.shape, tuple[int, ...])
# 使用 assert_type 函数验证 b_i8_f8_f8 的大小的类型为 int
assert_type(b_i8_f8_f8.size, int)

# 使用 assert_type 函数验证 np.inner(AR_f8, AR_i8) 的返回类型为 Any
assert_type(np.inner(AR_f8, AR_i8), Any)

# 使用 assert_type 函数验证 np.where([True, True, False]) 的返回类型为 tuple[npt.NDArray[np.intp], ...]
assert_type(np.where([True, True, False]), tuple[npt.NDArray[np.intp], ...])
# 使用 assert_type 函数验证 np.where([True, True, False], 1, 0) 的返回类型为 npt.NDArray[Any]
assert_type(np.where([True, True, False], 1, 0), npt.NDArray[Any])

# 使用 assert_type 函数验证 np.lexsort([0, 1, 2]) 的返回类型为 Any
assert_type(np.lexsort([0, 1, 2]), Any)

# 使用 assert_type 函数验证 np.can_cast(np.dtype("i8"), int) 的返回类型为 bool
assert_type(np.can_cast(np.dtype("i8"), int), bool)
# 使用 assert_type 函数验证 np.can_cast(AR_f8, "f8") 的返回类型为 bool
assert_type(np.can_cast(AR_f8, "f8"), bool)
# 使用 assert_type 函数验证 np.can_cast(AR_f8, np.complex128, casting="unsafe") 的返回类型为 bool
assert_type(np.can_cast(AR_f8, np.complex128, casting="unsafe"), bool)

# 使用 assert_type 函数验证 np.min_scalar_type([1]) 的返回类型为 np.dtype[Any]
assert_type(np.min_scalar_type([1]), np.dtype[Any])
# 使用 assert_type 函数验证 np.min_scalar_type(AR_f8) 的返回类型为 np.dtype[Any]
assert_type(np.min_scalar_type(AR_f8), np.dtype[Any])

# 使用 assert_type 函数验证 np.result_type(int, [1]) 的返回类型为 np.dtype[Any]
assert_type(np.result_type(int, [1]), np.dtype[Any])
# 使用 assert_type 函数验证 np.result_type(AR_f8, AR_u1) 的返回类型为 np.dtype[Any]
assert_type(np.result_type(AR_f8, AR_u1), np.dtype[Any])
# 使用 assert_type 函数验证 np.result_type(AR_f8, np.complex128) 的返回类型为 np.dtype[Any]
assert_type(np.result_type(AR_f8, np.complex128), np.dtype[Any])

# 使用 assert_type 函数验证 np.dot(AR_LIKE_f, AR_i8) 的返回类型为 Any
assert_type(np.dot(AR_LIKE_f, AR_i8), Any)
# 使用 assert_type 函数验证 np.dot(AR_u1, 1) 的返回类型为 Any
assert_type(np.dot(AR_u1, 1), Any)
# 使用 assert_type 函数验证 np.dot(1.
# 断言两个对象是否共享内存,返回布尔值
assert_type(np.may_share_memory(1, 2), bool)
# 断言两个数组是否共享内存,返回布尔值
assert_type(np.may_share_memory(AR_f8, AR_f8, max_work=1), bool)

# 推断两个数据类型的最小公共类型
assert_type(np.promote_types(np.int32, np.int64), np.dtype[Any])
# 推断两个数据类型的最小公共类型
assert_type(np.promote_types("f4", float), np.dtype[Any])

# 创建一个从 Python 函数到通用函数的转换器
assert_type(np.frompyfunc(func, 1, 1, identity=None), np.ufunc)

# 返回 datetime64 数据类型的元数据
assert_type(np.datetime_data("m8[D]"), tuple[str, int])
# 返回 datetime64 数据类型的元数据
assert_type(np.datetime_data(np.datetime64), tuple[str, int])
# 返回 timedelta64 数据类型的元数据
assert_type(np.datetime_data(np.dtype(np.timedelta64)), tuple[str, int])

# 计算两个日期之间的工作日数量
assert_type(np.busday_count("2011-01", "2011-02"), np.int_)
# 计算两个日期之间的工作日数量
assert_type(np.busday_count(["2011-01"], "2011-02"), npt.NDArray[np.int_])
# 计算两个日期之间的工作日数量
assert_type(np.busday_count(["2011-01"], date_scalar), npt.NDArray[np.int_])

# 计算工作日偏移后的日期
assert_type(np.busday_offset(M, m), np.datetime64)
# 计算工作日偏移后的日期
assert_type(np.busday_offset(date_scalar, m), np.datetime64)
# 计算工作日偏移后的日期
assert_type(np.busday_offset(M, 5), np.datetime64)
# 计算工作日偏移后的日期
assert_type(np.busday_offset(AR_M, m), npt.NDArray[np.datetime64])
# 计算工作日偏移后的日期
assert_type(np.busday_offset(M, timedelta_seq), npt.NDArray[np.datetime64])
# 计算工作日偏移后的日期
assert_type(np.busday_offset("2011-01", "2011-02", roll="forward"), np.datetime64)
# 计算工作日偏移后的日期
assert_type(np.busday_offset(["2011-01"], "2011-02", roll="forward"), npt.NDArray[np.datetime64])

# 判断日期是否是工作日
assert_type(np.is_busday("2012"), np.bool)
# 判断日期是否是工作日
assert_type(np.is_busday(date_scalar), np.bool)
# 判断日期是否是工作日
assert_type(np.is_busday(["2012"]), npt.NDArray[np.bool])

# 将日期时间数组转换为字符串数组
assert_type(np.datetime_as_string(M), np.str_)
# 将日期时间数组转换为字符串数组
assert_type(np.datetime_as_string(AR_M), npt.NDArray[np.str_])

# 创建一个工作日日历对象
assert_type(np.busdaycalendar(holidays=date_seq), np.busdaycalendar)
# 创建一个工作日日历对象
assert_type(np.busdaycalendar(holidays=[M]), np.busdaycalendar)

# 比较两个字符数组的元素
assert_type(np.char.compare_chararrays("a", "b", "!=", rstrip=False), npt.NDArray[np.bool])
# 比较两个字符数组的元素
assert_type(np.char.compare_chararrays(b"a", b"a", "==", True), npt.NDArray[np.bool])

# 创建嵌套迭代器对象
assert_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], flags=["c_index"]), tuple[np.nditer, ...])
# 创建嵌套迭代器对象
assert_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], op_flags=[["readonly", "readonly"]]), tuple[np.nditer, ...])
# 创建嵌套迭代器对象
assert_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], op_dtypes=np.int_), tuple[np.nditer, ...])
# 创建嵌套迭代器对象
assert_type(np.nested_iters([AR_i8, AR_i8], [[0], [1]], order="C", casting="no"), tuple[np.nditer, ...])

.\numpy\numpy\typing\tests\data\reveal\nbit_base_example.pyi

import sys
from typing import TypeVar

import numpy as np
import numpy.typing as npt
from numpy._typing import _64Bit, _32Bit

if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    from typing_extensions import assert_type

T1 = TypeVar("T1", bound=npt.NBitBase)  # 定义一个类型变量 T1,它必须是 numpy 的 NBitBase 的子类或实现类
T2 = TypeVar("T2", bound=npt.NBitBase)  # 定义一个类型变量 T2,它必须是 numpy 的 NBitBase 的子类或实现类

def add(a: np.floating[T1], b: np.integer[T2]) -> np.floating[T1 | T2]:
    # 定义一个函数 add,接收两个参数 a 和 b,分别为 numpy 浮点数类型和整数类型
    return a + b  # 返回 a 和 b 的和,结果类型为 np.floating[T1 | T2],即 a 和 b 类型的联合

i8: np.int64  # 声明 i8 为 np.int64 类型
i4: np.int32  # 声明 i4 为 np.int32 类型
f8: np.float64  # 声明 f8 为 np.float64 类型
f4: np.float32  # 声明 f4 为 np.float32 类型

assert_type(add(f8, i8), np.float64)  # 断言 add 函数返回的类型为 np.float64
assert_type(add(f4, i8), np.floating[_32Bit | _64Bit])  # 断言 add 函数返回的类型为 np.floating[_32Bit | _64Bit]
assert_type(add(f8, i4), np.floating[_32Bit | _64Bit])  # 断言 add 函数返回的类型为 np.floating[_32Bit | _64Bit]
assert_type(add(f4, i4), np.float32)  # 断言 add 函数返回的类型为 np.float32

.\numpy\numpy\typing\tests\data\reveal\ndarray_conversion.pyi

import sys  # 导入sys模块,用于访问系统特定参数和功能
from typing import Any  # 导入Any类型,用于指示可以是任何类型的对象

import numpy as np  # 导入NumPy库,用于支持多维数组和矩阵运算
import numpy.typing as npt  # 导入NumPy的类型定义模块,用于类型提示

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果Python版本大于等于3.11,导入assert_type函数
else:
    from typing_extensions import assert_type  # 否则导入typing_extensions中的assert_type函数

nd: npt.NDArray[np.int_]  # 定义nd变量,类型为NumPy的npt.NDArray,包含np.int_类型的元素

# item 方法
assert_type(nd.item(), int)  # 断言nd.item()返回int类型
assert_type(nd.item(1), int)  # 断言nd.item(1)返回int类型
assert_type(nd.item(0, 1), int)  # 断言nd.item(0, 1)返回int类型
assert_type(nd.item((0, 1)), int)  # 断言nd.item((0, 1))返回int类型

# tolist 方法
assert_type(nd.tolist(), Any)  # 断言nd.tolist()返回任意类型

# itemset 方法不返回值
# tostring 方法非常简单
# tobytes 方法非常简单
# tofile 方法不返回值
# dump 方法不返回值
# dumps 方法非常简单

# astype 方法
assert_type(nd.astype("float"), npt.NDArray[Any])  # 断言nd.astype("float")返回任意类型的NumPy数组
assert_type(nd.astype(float), npt.NDArray[Any])  # 断言nd.astype(float)返回任意类型的NumPy数组
assert_type(nd.astype(np.float64), npt.NDArray[np.float64])  # 断言nd.astype(np.float64)返回np.float64类型的NumPy数组
assert_type(nd.astype(np.float64, "K"), npt.NDArray[np.float64])  # 断言nd.astype(np.float64, "K")返回np.float64类型的NumPy数组
assert_type(nd.astype(np.float64, "K", "unsafe"), npt.NDArray[np.float64])  # 断言nd.astype(np.float64, "K", "unsafe")返回np.float64类型的NumPy数组
assert_type(nd.astype(np.float64, "K", "unsafe", True), npt.NDArray[np.float64])  # 断言nd.astype(np.float64, "K", "unsafe", True)返回np.float64类型的NumPy数组
assert_type(nd.astype(np.float64, "K", "unsafe", True, True), npt.NDArray[np.float64])  # 断言nd.astype(np.float64, "K", "unsafe", True, True)返回np.float64类型的NumPy数组

assert_type(np.astype(nd, np.float64), npt.NDArray[np.float64])  # 断言np.astype(nd, np.float64)返回np.float64类型的NumPy数组

# byteswap 方法
assert_type(nd.byteswap(), npt.NDArray[np.int_])  # 断言nd.byteswap()返回np.int_类型的NumPy数组
assert_type(nd.byteswap(True), npt.NDArray[np.int_])  # 断言nd.byteswap(True)返回np.int_类型的NumPy数组

# copy 方法
assert_type(nd.copy(), npt.NDArray[np.int_])  # 断言nd.copy()返回np.int_类型的NumPy数组
assert_type(nd.copy("C"), npt.NDArray[np.int_])  # 断言nd.copy("C")返回np.int_类型的NumPy数组

assert_type(nd.view(), npt.NDArray[np.int_])  # 断言nd.view()返回np.int_类型的NumPy数组
assert_type(nd.view(np.float64), npt.NDArray[np.float64])  # 断言nd.view(np.float64)返回np.float64类型的NumPy数组
assert_type(nd.view(float), npt.NDArray[Any])  # 断言nd.view(float)返回任意类型的NumPy数组
assert_type(nd.view(np.float64, np.matrix), np.matrix[Any, Any])  # 断言nd.view(np.float64, np.matrix)返回np.matrix类型的NumPy数组

# getfield 方法
assert_type(nd.getfield("float"), npt.NDArray[Any])  # 断言nd.getfield("float")返回任意类型的NumPy数组
assert_type(nd.getfield(float), npt.NDArray[Any])  # 断言nd.getfield(float)返回任意类型的NumPy数组
assert_type(nd.getfield(np.float64), npt.NDArray[np.float64])  # 断言nd.getfield(np.float64)返回np.float64类型的NumPy数组
assert_type(nd.getfield(np.float64, 8), npt.NDArray[np.float64])  # 断言nd.getfield(np.float64, 8)返回np.float64类型的NumPy数组

# setflags 方法不返回值
# fill 方法不返回值

.\numpy\numpy\typing\tests\data\reveal\ndarray_misc.pyi

"""
Tests for miscellaneous (non-magic) ``np.ndarray``/``np.generic`` methods.

More extensive tests are performed for the methods'
function-based counterpart in `../from_numeric.py`.

"""

import sys  # 导入 sys 模块,用于系统相关操作
import operator  # 导入 operator 模块,用于操作符函数
import ctypes as ct  # 导入 ctypes 模块并命名为 ct,用于操作 C 数据类型

from typing import Any, Literal  # 导入类型提示相关类和类型

import numpy as np  # 导入 NumPy 库并命名为 np
import numpy.typing as npt  # 导入 NumPy 类型提示模块

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果 Python 版本大于等于 3.11,导入 assert_type 函数
else:
    from typing_extensions import assert_type  # 否则,从 typing_extensions 导入 assert_type 函数

class SubClass(npt.NDArray[np.object_]): ...  # 定义一个 SubClass 类,继承自 npt.NDArray[np.object_]

f8: np.float64  # 声明变量 f8 为 np.float64 类型
B: SubClass  # 声明变量 B 为 SubClass 类型
AR_f8: npt.NDArray[np.float64]  # 声明变量 AR_f8 为 npt.NDArray[np.float64] 类型
AR_i8: npt.NDArray[np.int64]  # 声明变量 AR_i8 为 npt.NDArray[np.int64] 类型
AR_U: npt.NDArray[np.str_]  # 声明变量 AR_U 为 npt.NDArray[np.str_] 类型
AR_V: npt.NDArray[np.void]  # 声明变量 AR_V 为 npt.NDArray[np.void] 类型

ctypes_obj = AR_f8.ctypes  # 将 AR_f8 的 ctypes 属性赋给 ctypes_obj

assert_type(AR_f8.__dlpack__(), Any)  # 断言 AR_f8 的 __dlpack__ 方法返回任意类型
assert_type(AR_f8.__dlpack_device__(), tuple[int, Literal[0]])  # 断言 AR_f8 的 __dlpack_device__ 方法返回元组[int, Literal[0]]

assert_type(ctypes_obj.data, int)  # 断言 ctypes_obj 的 data 属性为 int 类型
assert_type(ctypes_obj.shape, ct.Array[np.ctypeslib.c_intp])  # 断言 ctypes_obj 的 shape 属性为 ct.Array[np.ctypeslib.c_intp] 类型
assert_type(ctypes_obj.strides, ct.Array[np.ctypeslib.c_intp])  # 断言 ctypes_obj 的 strides 属性为 ct.Array[np.ctypeslib.c_intp] 类型
assert_type(ctypes_obj._as_parameter_, ct.c_void_p)  # 断言 ctypes_obj 的 _as_parameter_ 属性为 ct.c_void_p 类型

assert_type(ctypes_obj.data_as(ct.c_void_p), ct.c_void_p)  # 断言 ctypes_obj 的 data_as 方法返回 ct.c_void_p 类型
assert_type(ctypes_obj.shape_as(ct.c_longlong), ct.Array[ct.c_longlong])  # 断言 ctypes_obj 的 shape_as 方法返回 ct.Array[ct.c_longlong] 类型
assert_type(ctypes_obj.strides_as(ct.c_ubyte), ct.Array[ct.c_ubyte])  # 断言 ctypes_obj 的 strides_as 方法返回 ct.Array[ct.c_ubyte] 类型

assert_type(f8.all(), np.bool)  # 断言 f8 的 all 方法返回 np.bool 类型
assert_type(AR_f8.all(), np.bool)  # 断言 AR_f8 的 all 方法返回 np.bool 类型
assert_type(AR_f8.all(axis=0), Any)  # 断言 AR_f8 的 all 方法在 axis=0 时返回任意类型
assert_type(AR_f8.all(keepdims=True), Any)  # 断言 AR_f8 的 all 方法在 keepdims=True 时返回任意类型
assert_type(AR_f8.all(out=B), SubClass)  # 断言 AR_f8 的 all 方法传入 out=B 参数时返回 SubClass 类型

assert_type(f8.any(), np.bool)  # 断言 f8 的 any 方法返回 np.bool 类型
assert_type(AR_f8.any(), np.bool)  # 断言 AR_f8 的 any 方法返回 np.bool 类型
assert_type(AR_f8.any(axis=0), Any)  # 断言 AR_f8 的 any 方法在 axis=0 时返回任意类型
assert_type(AR_f8.any(keepdims=True), Any)  # 断言 AR_f8 的 any 方法在 keepdims=True 时返回任意类型
assert_type(AR_f8.any(out=B), SubClass)  # 断言 AR_f8 的 any 方法传入 out=B 参数时返回 SubClass 类型

assert_type(f8.argmax(), np.intp)  # 断言 f8 的 argmax 方法返回 np.intp 类型
assert_type(AR_f8.argmax(), np.intp)  # 断言 AR_f8 的 argmax 方法返回 np.intp 类型
assert_type(AR_f8.argmax(axis=0), Any)  # 断言 AR_f8 的 argmax 方法在 axis=0 时返回任意类型
assert_type(AR_f8.argmax(out=B), SubClass)  # 断言 AR_f8 的 argmax 方法传入 out=B 参数时返回 SubClass 类型

assert_type(f8.argmin(), np.intp)  # 断言 f8 的 argmin 方法返回 np.intp 类型
assert_type(AR_f8.argmin(), np.intp)  # 断言 AR_f8 的 argmin 方法返回 np.intp 类型
assert_type(AR_f8.argmin(axis=0), Any)  # 断言 AR_f8 的 argmin 方法在 axis=0 时返回任意类型
assert_type(AR_f8.argmin(out=B), SubClass)  # 断言 AR_f8 的 argmin 方法传入 out=B 参数时返回 SubClass 类型

assert_type(f8.argsort(), npt.NDArray[Any])  # 断言 f8 的 argsort 方法返回 npt.NDArray[Any] 类型
assert_type(AR_f8.argsort(), npt.NDArray[Any])  # 断言 AR_f8 的 argsort 方法返回 npt.NDArray[Any] 类型

assert_type(f8.astype(np.int64).choose([()]), npt.NDArray[Any])  # 断言 f8 转换为 np.int64 类型后调用 choose 方法返回 npt.NDArray[Any] 类型
assert_type(AR_f8.choose([0]), npt.NDArray[Any])  # 断言 AR_f8 调用 choose 方法返回 npt.NDArray[Any] 类型
assert_type(AR_f8.choose([0], out=B), SubClass)  # 断言 AR_f8 调用 choose 方法传入 out=B 参数返回 SubClass 类型

assert_type(f8.clip(1), npt.NDArray[Any])  # 断言 f8 调用 clip 方法返回 npt.NDArray[Any] 类型
assert_type(AR_f8.clip(1), npt.NDArray[Any])  # 断言 AR_f8 调用 clip 方法返回 npt.NDArray[Any] 类型
assert_type(AR_f8.clip(None, 1), npt.NDArray[Any])  # 断言 AR_f8 调用 clip 方法返回 npt.NDArray[Any] 类型
assert_type(AR_f8.clip(1, out=B), SubClass)  # 断言 AR_f8 调用 clip 方法传入 out=B 参数返回 SubClass 类型
assert_type(AR_f8.clip(None, 1, out=B), SubClass)  # 断言 AR_f8 调用 clip 方法传入 out=B 参数返回 SubClass 类型

assert_type(f8.compress([0]), npt.NDArray[Any])  # 断言 f8 调用 compress 方法返回 npt.NDArray[Any] 类型
assert_type(AR_f8.compress([0]), npt.NDArray[Any])  # 断言 AR_f8 调用 compress 方法返回 npt.NDArray[Any] 类型
assert_type(AR_f8.compress([0], out=B), SubClass)  # 断言 AR_f8 调用 compress 方法传入 out=B 参数返回 SubClass 类型

assert_type(f8.conj(), np.float64)  # 断言 f8 调用 conj 方法返回 np.float64 类型
assert_type(AR_f8.conj(), npt.NDArray[np.float64])  # 断言 AR_f8 调用 conj 方法返回 npt.NDArray[np.float64] 类型
assert_type(B.conj(), SubClass)  # 断言
# 断言确保 AR_f8.cumsum() 的返回类型是 SubClass
assert_type(AR_f8.cumsum(out=B), SubClass)

# 断言确保 f8.max() 的返回类型是 Any
assert_type(f8.max(), Any)
# 断言确保 AR_f8.max() 的返回类型是 Any
assert_type(AR_f8.max(), Any)
# 断言确保 AR_f8.max(axis=0) 的返回类型是 Any
assert_type(AR_f8.max(axis=0), Any)
# 断言确保 AR_f8.max(keepdims=True) 的返回类型是 Any
assert_type(AR_f8.max(keepdims=True), Any)
# 断言确保 AR_f8.max(out=B) 的返回类型是 SubClass
assert_type(AR_f8.max(out=B), SubClass)

# 断言确保 f8.mean() 的返回类型是 Any
assert_type(f8.mean(), Any)
# 断言确保 AR_f8.mean() 的返回类型是 Any
assert_type(AR_f8.mean(), Any)
# 断言确保 AR_f8.mean(axis=0) 的返回类型是 Any
assert_type(AR_f8.mean(axis=0), Any)
# 断言确保 AR_f8.mean(keepdims=True) 的返回类型是 Any
assert_type(AR_f8.mean(keepdims=True), Any)
# 断言确保 AR_f8.mean(out=B) 的返回类型是 SubClass
assert_type(AR_f8.mean(out=B), SubClass)

# 断言确保 f8.min() 的返回类型是 Any
assert_type(f8.min(), Any)
# 断言确保 AR_f8.min() 的返回类型是 Any
assert_type(AR_f8.min(), Any)
# 断言确保 AR_f8.min(axis=0) 的返回类型是 Any
assert_type(AR_f8.min(axis=0), Any)
# 断言确保 AR_f8.min(keepdims=True) 的返回类型是 Any
assert_type(AR_f8.min(keepdims=True), Any)
# 断言确保 AR_f8.min(out=B) 的返回类型是 SubClass
assert_type(AR_f8.min(out=B), SubClass)

# 断言确保 f8.prod() 的返回类型是 Any
assert_type(f8.prod(), Any)
# 断言确保 AR_f8.prod() 的返回类型是 Any
assert_type(AR_f8.prod(), Any)
# 断言确保 AR_f8.prod(axis=0) 的返回类型是 Any
assert_type(AR_f8.prod(axis=0), Any)
# 断言确保 AR_f8.prod(keepdims=True) 的返回类型是 Any
assert_type(AR_f8.prod(keepdims=True), Any)
# 断言确保 AR_f8.prod(out=B) 的返回类型是 SubClass
assert_type(AR_f8.prod(out=B), SubClass)

# 断言确保 f8.round() 的返回类型是 np.float64
assert_type(f8.round(), np.float64)
# 断言确保 AR_f8.round() 的返回类型是 npt.NDArray[np.float64]
assert_type(AR_f8.round(), npt.NDArray[np.float64])
# 断言确保 AR_f8.round(out=B) 的返回类型是 SubClass
assert_type(AR_f8.round(out=B), SubClass)

# 断言确保 f8.repeat(1) 的返回类型是 npt.NDArray[np.float64]
assert_type(f8.repeat(1), npt.NDArray[np.float64])
# 断言确保 AR_f8.repeat(1) 的返回类型是 npt.NDArray[np.float64]
assert_type(AR_f8.repeat(1), npt.NDArray[np.float64])
# 断言确保 B.repeat(1) 的返回类型是 npt.NDArray[np.object_]
assert_type(B.repeat(1), npt.NDArray[np.object_])

# 断言确保 f8.std() 的返回类型是 Any
assert_type(f8.std(), Any)
# 断言确保 AR_f8.std() 的返回类型是 Any
assert_type(AR_f8.std(), Any)
# 断言确保 AR_f8.std(axis=0) 的返回类型是 Any
assert_type(AR_f8.std(axis=0), Any)
# 断言确保 AR_f8.std(keepdims=True) 的返回类型是 Any
assert_type(AR_f8.std(keepdims=True), Any)
# 断言确保 AR_f8.std(out=B) 的返回类型是 SubClass
assert_type(AR_f8.std(out=B), SubClass)

# 断言确保 f8.sum() 的返回类型是 Any
assert_type(f8.sum(), Any)
# 断言确保 AR_f8.sum() 的返回类型是 Any
assert_type(AR_f8.sum(), Any)
# 断言确保 AR_f8.sum(axis=0) 的返回类型是 Any
assert_type(AR_f8.sum(axis=0), Any)
# 断言确保 AR_f8.sum(keepdims=True) 的返回类型是 Any
assert_type(AR_f8.sum(keepdims=True), Any)
# 断言确保 AR_f8.sum(out=B) 的返回类型是 SubClass
assert_type(AR_f8.sum(out=B), SubClass)

# 断言确保 f8.take(0) 的返回类型是 np.float64
assert_type(f8.take(0), np.float64)
# 断言确保 AR_f8.take(0) 的返回类型是 np.float64
assert_type(AR_f8.take(0), np.float64)
# 断言确保 AR_f8.take([0]) 的返回类型是 npt.NDArray[np.float64]
assert_type(AR_f8.take([0]), npt.NDArray[np.float64])
# 断言确保 AR_f8.take(0, out=B) 的返回类型是 SubClass
assert_type(AR_f8.take(0, out=B), SubClass)
# 断言确保 AR_f8.take([0], out=B) 的返回类型是 SubClass
assert_type(AR_f8.take([0], out=B), SubClass)

# 断言确保 f8.var() 的返回类型是 Any
assert_type(f8.var(), Any)
# 断言确保 AR_f8.var() 的返回类型是 Any
assert_type(AR_f8.var(), Any)
# 断言确保 AR_f8.var(axis=0) 的返回类型是 Any
assert_type(AR_f8.var(axis=0), Any)
# 断言确保 AR_f8.var(keepdims=True) 的返回类型是 Any
assert_type(AR_f8.var(keepdims=True), Any)
# 断言确保 AR_f8.var(out=B) 的返回类型是 SubClass
assert_type(AR_f8.var(out=B), SubClass)

# 断言确保 AR_f8.argpartition([0]) 的返回类型是 npt.NDArray[np.intp]
assert_type(AR_f8.argpartition([0]), npt.NDArray[np.intp])

# 断言确保 AR_f8.diagonal() 的返回类型是 npt.NDArray[np.float64]
assert_type(AR_f8.diagonal(), npt.NDArray[np.float64])

# 断言确保 AR_f8.dot(1) 的返回类型是 npt.NDArray[Any]
assert_type(AR_f8.dot(1), npt.NDArray[Any])
# 断言确保 AR_f8.dot([1]) 的返回类型是 Any
assert_type(AR_f8.dot([1]), Any)
# 断言确保 AR_f8.dot(1, out=B) 的返回类型是 SubClass
assert_type(AR_f8.dot(1, out=B), SubClass)

# 断言确保 AR_f8.nonzero() 的返回类型是 tuple[npt.NDArray[np.intp], ...]
assert_type(AR_f8.nonzero(), tuple[npt.NDArray[np.intp], ...])

# 断言确保 AR_f8.searchsorted(1) 的返回类型是 np.intp
assert_type(AR_f8.searchsorted(1), np.intp)
# 断言确保 AR_f8.searchsorted([1]) 的返回类型是 npt.NDArray[np.intp]
assert_type(AR_f8.searchsorted([1]), npt.NDArray[np.intp])

# 断言确保 AR_f8.trace() 的返回类型是 Any
assert_type(AR_f8.trace(), Any)
# 断言确保 AR_f8.trace(out=B) 的返回类型是 SubClass
assert_type(AR_f8.trace(out=B), SubClass)

# 断言确保 AR_f8.item() 的返回类型是 float
assert_type(AR_f8.item(), float)
# 断言确保 AR_U.item() 的返回类型是 str
assert_type(AR_U.item(), str)

# 断言确保 AR_f8.ravel() 的返回类型是 npt.NDArray[np.float64]
assert_type(AR_f8.ravel(), npt.NDArray[np.float64])
# 断言确保 AR_U.ravel() 的返回类型是 npt.NDArray[np.str_]
assert_type(AR_U.ravel(), npt.NDArray[np.str_])

#
# 确保 AR_V[AR_i8] 的类型为 numpy 的 void 类型的多维数组
assert_type(AR_V[AR_i8], npt.NDArray[np.void])

# 确保 AR_V[AR_i8, AR_i8] 的类型为 numpy 的 void 类型的多维数组
assert_type(AR_V[AR_i8, AR_i8], npt.NDArray[np.void])

# 确保 AR_V[AR_i8, None] 的类型为 numpy 的 void 类型的多维数组
assert_type(AR_V[AR_i8, None], npt.NDArray[np.void])

# 确保 AR_V[0, ...] 的类型为 numpy 的 void 类型的多维数组
assert_type(AR_V[0, ...], npt.NDArray[np.void])

# 确保 AR_V[[0]] 的类型为 numpy 的 void 类型的多维数组
assert_type(AR_V[[0]], npt.NDArray[np.void])

# 确保 AR_V[[0], [0]] 的类型为 numpy 的 void 类型的多维数组
assert_type(AR_V[[0], [0]], npt.NDArray[np.void])

# 确保 AR_V[:] 的类型为 numpy 的 void 类型的多维数组
assert_type(AR_V[:], npt.NDArray[np.void])

# 确保 AR_V["a"] 的类型为任意类型的多维数组
assert_type(AR_V["a"], npt.NDArray[Any])

# 确保 AR_V[["a", "b"]] 的类型为 numpy 的 void 类型的多维数组
assert_type(AR_V[["a", "b"]], npt.NDArray[np.void])

# 确保将 AR_f8 的内容保存到文件 "test_file" 中,并返回 None
assert_type(AR_f8.dump("test_file"), None)

# 确保将 AR_f8 的内容以字节形式保存到文件 "test_file" 中,并返回 None
assert_type(AR_f8.dump(b"test_file"), None)

# 使用文件对象 f 将 AR_f8 的内容保存到文件中,并返回 None
with open("test_file", "wb") as f:
    assert_type(AR_f8.dump(f), None)

# 确保调用 AR_f8 对象的 __array_finalize__ 方法并传入 None 参数后返回 None
assert_type(AR_f8.__array_finalize__(None), None)

# 确保调用 AR_f8 对象的 __array_finalize__ 方法并传入 B 参数后返回 None
assert_type(AR_f8.__array_finalize__(B), None)

# 确保调用 AR_f8 对象的 __array_finalize__ 方法并传入 AR_f8 参数后返回 None
assert_type(AR_f8.__array_finalize__(AR_f8), None)

.\numpy\numpy\typing\tests\data\reveal\ndarray_shape_manipulation.pyi

# 导入系统模块 sys
# 从 typing 模块中导入 Any 类型
import sys
from typing import Any

# 导入 numpy 库,并将其命名为 np
import numpy as np
# 导入 numpy.typing 模块,引入 npt 别名,用于类型提示
import numpy.typing as npt

# 如果 Python 版本大于等于 3.11,则从 typing 模块导入 assert_type 函数
if sys.version_info >= (3, 11):
    from typing import assert_type
# 否则,从 typing_extensions 模块导入 assert_type 函数
else:
    from typing_extensions import assert_type

# 声明变量 nd,指定其类型为 npt.NDArray[np.int64]
nd: npt.NDArray[np.int64]

# reshape 操作的类型断言
assert_type(nd.reshape(), npt.NDArray[np.int64])
assert_type(nd.reshape(4), npt.NDArray[np.int64])
assert_type(nd.reshape(2, 2), npt.NDArray[np.int64])
assert_type(nd.reshape((2, 2)), npt.NDArray[np.int64])

# 指定 order="C" 参数的 reshape 操作的类型断言
assert_type(nd.reshape((2, 2), order="C"), npt.NDArray[np.int64])
assert_type(nd.reshape(4, order="C"), npt.NDArray[np.int64])

# resize 操作不返回值,无需类型断言

# transpose 操作的类型断言
assert_type(nd.transpose(), npt.NDArray[np.int64])
assert_type(nd.transpose(1, 0), npt.NDArray[np.int64])
assert_type(nd.transpose((1, 0)), npt.NDArray[np.int64])

# swapaxes 操作的类型断言
assert_type(nd.swapaxes(0, 1), npt.NDArray[np.int64])

# flatten 操作的类型断言
assert_type(nd.flatten(), npt.NDArray[np.int64])
assert_type(nd.flatten("C"), npt.NDArray[np.int64])

# ravel 操作的类型断言
assert_type(nd.ravel(), npt.NDArray[np.int64])
assert_type(nd.ravel("C"), npt.NDArray[np.int64])

# squeeze 操作的类型断言
assert_type(nd.squeeze(), npt.NDArray[np.int64])
assert_type(nd.squeeze(0), npt.NDArray[np.int64])
assert_type(nd.squeeze((0, 2)), npt.NDArray[np.int64])

.\numpy\numpy\typing\tests\data\reveal\nditer.pyi

import sys  # 导入sys模块,用于访问系统相关信息
from typing import Any  # 从typing模块导入Any类型

import numpy as np  # 导入NumPy库并重命名为np
import numpy.typing as npt  # 导入NumPy类型提示模块

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果Python版本大于等于3.11,从typing模块导入assert_type函数
else:
    from typing_extensions import assert_type  # 否则从typing_extensions模块导入assert_type函数

nditer_obj: np.nditer  # 声明nditer_obj变量为NumPy的nditer对象

assert_type(np.nditer([0, 1], flags=["c_index"]), np.nditer)  # 断言np.nditer([0, 1], flags=["c_index"])的类型为np.nditer
assert_type(np.nditer([0, 1], op_flags=[["readonly", "readonly"]]), np.nditer)  # 断言np.nditer([0, 1], op_flags=[["readonly", "readonly"]])的类型为np.nditer
assert_type(np.nditer([0, 1], op_dtypes=np.int_), np.nditer)  # 断言np.nditer([0, 1], op_dtypes=np.int_)的类型为np.nditer
assert_type(np.nditer([0, 1], order="C", casting="no"), np.nditer)  # 断言np.nditer([0, 1], order="C", casting="no")的类型为np.nditer

assert_type(nditer_obj.dtypes, tuple[np.dtype[Any], ...])  # 断言nditer_obj.dtypes的类型为tuple[np.dtype[Any], ...]
assert_type(nditer_obj.finished, bool)  # 断言nditer_obj.finished的类型为bool
assert_type(nditer_obj.has_delayed_bufalloc, bool)  # 断言nditer_obj.has_delayed_bufalloc的类型为bool
assert_type(nditer_obj.has_index, bool)  # 断言nditer_obj.has_index的类型为bool
assert_type(nditer_obj.has_multi_index, bool)  # 断言nditer_obj.has_multi_index的类型为bool
assert_type(nditer_obj.index, int)  # 断言nditer_obj.index的类型为int
assert_type(nditer_obj.iterationneedsapi, bool)  # 断言nditer_obj.iterationneedsapi的类型为bool
assert_type(nditer_obj.iterindex, int)  # 断言nditer_obj.iterindex的类型为int
assert_type(nditer_obj.iterrange, tuple[int, ...])  # 断言nditer_obj.iterrange的类型为tuple[int, ...]
assert_type(nditer_obj.itersize, int)  # 断言nditer_obj.itersize的类型为int
assert_type(nditer_obj.itviews, tuple[npt.NDArray[Any], ...])  # 断言nditer_obj.itviews的类型为tuple[npt.NDArray[Any], ...]
assert_type(nditer_obj.multi_index, tuple[int, ...])  # 断言nditer_obj.multi_index的类型为tuple[int, ...]
assert_type(nditer_obj.ndim, int)  # 断言nditer_obj.ndim的类型为int
assert_type(nditer_obj.nop, int)  # 断言nditer_obj.nop的类型为int
assert_type(nditer_obj.operands, tuple[npt.NDArray[Any], ...])  # 断言nditer_obj.operands的类型为tuple[npt.NDArray[Any], ...]
assert_type(nditer_obj.shape, tuple[int, ...])  # 断言nditer_obj.shape的类型为tuple[int, ...]
assert_type(nditer_obj.value, tuple[npt.NDArray[Any], ...])  # 断言nditer_obj.value的类型为tuple[npt.NDArray[Any], ...]

assert_type(nditer_obj.close(), None)  # 断言调用nditer_obj.close()的返回类型为None
assert_type(nditer_obj.copy(), np.nditer)  # 断言调用nditer_obj.copy()的返回类型为np.nditer
assert_type(nditer_obj.debug_print(), None)  # 断言调用nditer_obj.debug_print()的返回类型为None
assert_type(nditer_obj.enable_external_loop(), None)  # 断言调用nditer_obj.enable_external_loop()的返回类型为None
assert_type(nditer_obj.iternext(), bool)  # 断言调用nditer_obj.iternext()的返回类型为bool
assert_type(nditer_obj.remove_axis(0), None)  # 断言调用nditer_obj.remove_axis(0)的返回类型为None
assert_type(nditer_obj.remove_multi_index(), None)  # 断言调用nditer_obj.remove_multi_index()的返回类型为None
assert_type(nditer_obj.reset(), None)  # 断言调用nditer_obj.reset()的返回类型为None

assert_type(len(nditer_obj), int)  # 断言调用len(nditer_obj)的返回类型为int
assert_type(iter(nditer_obj), np.nditer)  # 断言调用iter(nditer_obj)的返回类型为np.nditer
assert_type(next(nditer_obj), tuple[npt.NDArray[Any], ...])  # 断言调用next(nditer_obj)的返回类型为tuple[npt.NDArray[Any], ...]
assert_type(nditer_obj.__copy__(), np.nditer)  # 断言调用nditer_obj.__copy__()的返回类型为np.nditer
with nditer_obj as f:
    assert_type(f, np.nditer)  # 使用with语句创建上下文管理器f,并断言其类型为np.nditer
assert_type(nditer_obj[0], npt.NDArray[Any])  # 断言nditer_obj[0]的类型为npt.NDArray[Any]
assert_type(nditer_obj[:], tuple[npt.NDArray[Any], ...])  # 断言nditer_obj[:]的类型为tuple[npt.NDArray[Any], ...]
nditer_obj[0] = 0  # 给nditer_obj的第一个元素赋值为0
nditer_obj[:] = [0, 1]  # 给nditer_obj的所有元素赋值为[0, 1]

.\numpy\numpy\typing\tests\data\reveal\nested_sequence.pyi

# 导入 sys 模块,用于访问系统相关的功能
import sys
# 从 collections.abc 模块导入 Sequence 类型,用于声明序列类型的变量
from collections.abc import Sequence
# 从 typing 模块导入 Any 类型,用于表示任意类型的变量
from typing import Any

# 从 numpy._typing 模块导入 _NestedSequence 类型,用于声明嵌套序列类型的变量
from numpy._typing import _NestedSequence

# 根据 Python 版本不同选择不同的 assert_type 函数的来源
if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    from typing_extensions import assert_type

# 声明变量 a,其类型为整数序列的序列(二维列表或元组)
a: Sequence[int]
# 声明变量 b,其类型为整数序列的序列的序列(三维列表或元组)
b: Sequence[Sequence[int]]
# 声明变量 c,其类型为整数序列的序列的序列的序列(四维列表或元组)
c: Sequence[Sequence[Sequence[int]]]
# 声明变量 d,其类型为整数序列的序列的序列的序列的序列(五维列表或元组)
d: Sequence[Sequence[Sequence[Sequence[int]]]]
# 声明变量 e,其类型为布尔值序列
e: Sequence[bool]
# 声明变量 f,其类型为包含整数的元组,且元组长度不固定
f: tuple[int, ...]
# 声明变量 g,其类型为整数列表
g: list[int]
# 声明变量 h,其类型为任意类型的序列
h: Sequence[Any]

# 定义函数 func,接受一个 _NestedSequence[int] 类型的参数,无返回值
def func(a: _NestedSequence[int]) -> None:
    ...

# 对函数 func 的返回值进行类型断言,期望其返回 None 类型
assert_type(func(a), None)
assert_type(func(b), None)
assert_type(func(c), None)
assert_type(func(d), None)
assert_type(func(e), None)
assert_type(func(f), None)
assert_type(func(g), None)
assert_type(func(h), None)
# 对 func 函数参数为 range(15) 的返回值进行类型断言
assert_type(func(range(15)), None)

.\numpy\numpy\typing\tests\data\reveal\npyio.pyi

import re  # 导入正则表达式模块
import sys  # 导入系统相关的模块
import zipfile  # 导入处理 ZIP 文件的模块
import pathlib  # 提供处理路径的类和函数
from typing import IO, Any  # 导入类型提示相关的类和函数
from collections.abc import Mapping  # 导入映射类型相关的抽象基类

import numpy.typing as npt  # 导入 NumPy 类型提示
import numpy as np  # 导入 NumPy 数学计算库
from numpy.lib._npyio_impl import BagObj  # 导入 NumPy 内部使用的对象

if sys.version_info >= (3, 11):
    from typing import assert_type  # 如果 Python 版本大于等于 3.11,导入 assert_type 函数
else:
    from typing_extensions import assert_type  # 否则,导入 typing_extensions 中的 assert_type 函数

str_path: str  # 声明一个字符串类型的变量 str_path
pathlib_path: pathlib.Path  # 声明一个路径对象的变量 pathlib_path
str_file: IO[str]  # 声明一个字符串类型的文件对象变量 str_file
bytes_file: IO[bytes]  # 声明一个字节类型的文件对象变量 bytes_file

npz_file: np.lib.npyio.NpzFile  # 声明一个 NumPy .npz 文件对象变量 npz_file

AR_i8: npt.NDArray[np.int64]  # 声明一个 NumPy int64 数组类型变量 AR_i8
AR_LIKE_f8: list[float]  # 声明一个浮点数列表类型变量 AR_LIKE_f8

class BytesWriter:  # 定义一个字节流写入类 BytesWriter
    def write(self, data: bytes) -> None: ...  # 定义一个接受 bytes 类型参数的写入方法

class BytesReader:  # 定义一个字节流读取类 BytesReader
    def read(self, n: int = ...) -> bytes: ...  # 定义一个返回 bytes 类型的读取方法
    def seek(self, offset: int, whence: int = ...) -> int: ...  # 定义一个设置读取位置的方法

bytes_writer: BytesWriter  # 声明一个 BytesWriter 类型的变量 bytes_writer
bytes_reader: BytesReader  # 声明一个 BytesReader 类型的变量 bytes_reader

assert_type(npz_file.zip, zipfile.ZipFile)  # 断言 npz_file.zip 是一个 zipfile.ZipFile 类型的对象
assert_type(npz_file.fid, None | IO[str])  # 断言 npz_file.fid 是 None 或者 IO[str] 类型的对象
assert_type(npz_file.files, list[str])  # 断言 npz_file.files 是一个字符串列表
assert_type(npz_file.allow_pickle, bool)  # 断言 npz_file.allow_pickle 是布尔类型
assert_type(npz_file.pickle_kwargs, None | Mapping[str, Any])  # 断言 npz_file.pickle_kwargs 是 None 或者 Mapping[str, Any] 类型
assert_type(npz_file.f, BagObj[np.lib.npyio.NpzFile])  # 断言 npz_file.f 是 BagObj[np.lib.npyio.NpzFile] 类型的对象
assert_type(npz_file["test"], npt.NDArray[Any])  # 断言 npz_file["test"] 是任意类型的 NumPy 数组
assert_type(len(npz_file), int)  # 断言 len(npz_file) 返回整数类型的长度
with npz_file as f:
    assert_type(f, np.lib.npyio.NpzFile)  # 在上下文中使用 npz_file,断言 f 是 np.lib.npyio.NpzFile 类型的对象

assert_type(np.load(bytes_file), Any)  # 断言 np.load(bytes_file) 返回任意类型的结果
assert_type(np.load(pathlib_path, allow_pickle=True), Any)  # 断言 np.load(pathlib_path, allow_pickle=True) 返回任意类型的结果
assert_type(np.load(str_path, encoding="bytes"), Any)  # 断言 np.load(str_path, encoding="bytes") 返回任意类型的结果
assert_type(np.load(bytes_reader), Any)  # 断言 np.load(bytes_reader) 返回任意类型的结果

assert_type(np.save(bytes_file, AR_LIKE_f8), None)  # 断言 np.save(bytes_file, AR_LIKE_f8) 返回 None
assert_type(np.save(pathlib_path, AR_i8, allow_pickle=True), None)  # 断言 np.save(pathlib_path, AR_i8, allow_pickle=True) 返回 None
assert_type(np.save(str_path, AR_LIKE_f8), None)  # 断言 np.save(str_path, AR_LIKE_f8) 返回 None
assert_type(np.save(bytes_writer, AR_LIKE_f8), None)  # 断言 np.save(bytes_writer, AR_LIKE_f8) 返回 None

assert_type(np.savez(bytes_file, AR_LIKE_f8), None)  # 断言 np.savez(bytes_file, AR_LIKE_f8) 返回 None
assert_type(np.savez(pathlib_path, ar1=AR_i8, ar2=AR_i8), None)  # 断言 np.savez(pathlib_path, ar1=AR_i8, ar2=AR_i8) 返回 None
assert_type(np.savez(str_path, AR_LIKE_f8, ar1=AR_i8), None)  # 断言 np.savez(str_path, AR_LIKE_f8, ar1=AR_i8) 返回 None
assert_type(np.savez(bytes_writer, AR_LIKE_f8, ar1=AR_i8), None)  # 断言 np.savez(bytes_writer, AR_LIKE_f8, ar1=AR_i8) 返回 None

assert_type(np.savez_compressed(bytes_file, AR_LIKE_f8), None)  # 断言 np.savez_compressed(bytes_file, AR_LIKE_f8) 返回 None
assert_type(np.savez_compressed(pathlib_path, ar1=AR_i8, ar2=AR_i8), None)  # 断言 np.savez_compressed(pathlib_path, ar1=AR_i8, ar2=AR_i8) 返回 None
assert_type(np.savez_compressed(str_path, AR_LIKE_f8, ar1=AR_i8), None)  # 断言 np.savez_compressed(str_path, AR_LIKE_f8, ar1=AR_i8) 返回 None
assert_type(np.savez_compressed(bytes_writer, AR_LIKE_f8, ar1=AR_i8), None)  # 断言 np.savez_compressed(bytes_writer, AR_LIKE_f8, ar1=AR_i8) 返回 None

assert_type(np.loadtxt(bytes_file), npt.NDArray[np.float64])  # 断言 np.loadtxt(bytes_file) 返回 npt.NDArray[np.float64] 类型的 NumPy 数组
assert_type(np.loadtxt(pathlib_path, dtype=np.str_), npt.NDArray[np.str_])  # 断言 np.loadtxt(pathlib_path, dtype=np.str_) 返回 npt.NDArray[np.str_] 类型的 NumPy 数组
assert_type(np.loadtxt(str_path, dtype=str, skiprows=2), npt.NDArray[Any])  # 断言 np.loadtxt(str_path, dtype=str, skiprows=2) 返回 npt.NDArray[Any] 类型的 NumPy 数组
assert_type(np.loadtxt(str_file, comments="test"), npt.NDArray[np.float64])  # 断言 np.loadtxt(str_file, comments="test") 返回 npt.NDArray[np.float64] 类型的 NumPy 数组
assert_type(np.loadtxt(str_file, comments=None), npt.NDArray[np.float64])  # 断言 np.loadtxt(str_file, comments=None) 返回 npt.NDArray[np.float64] 类型的 NumPy 数组
assert_type(np.loadtxt(str_path, delimiter="\n"), npt.NDArray[np.float64])  # 断言 np.loadtxt(str_path, delimiter="\n") 返回 npt.NDArray[np.float64] 类型的 NumPy 数组
assert_type(np.loadtxt(str_path, ndmin=2), npt.NDArray[np.float64])  # 断言 np.loadtxt(str_path, ndmin=2) 返回 npt.NDArray[np.float64] 类型的 NumPy 数组
assert_type(np.loadtxt(["1", "2", "3"]), npt.NDArray[np.float64])  # 断言 np.loadtxt(["1", "2", "3"]) 返回 npt.NDArray[np.float64] 类型的 NumPy 数组

assert_type(np.fromregex(bytes_file, "test", np.float64), npt.NDArray[np.float64])  # 断言 np.fromregex(bytes_file, "test", np.float64) 返回 npt.NDArray[np.float64] 类型的 NumPy 数组
assert_type(np.fromregex(str_file, b"test", dtype=float), npt.NDArray[Any])
# 调用 numpy 的 fromregex 函数,从指定的 pathlib 路径中读取数据,使用正则表达式 "test" 匹配内容,并期望返回 np.float64 类型的数组
assert_type(np.fromregex(pathlib_path, "test", np.float64), npt.NDArray[np.float64])

# 调用 numpy 的 fromregex 函数,从给定的字节流中读取数据,使用正则表达式 "test" 匹配内容,并期望返回 np.float64 类型的数组
assert_type(np.fromregex(bytes_reader, "test", np.float64), npt.NDArray[np.float64])

# 调用 numpy 的 genfromtxt 函数,从给定的字节流中读取数据,并期望返回任意类型的数组
assert_type(np.genfromtxt(bytes_file), npt.NDArray[Any])

# 调用 numpy 的 genfromtxt 函数,从 pathlib 路径中读取数据,期望返回 np.str_ 类型的数组,并使用指定的数据类型 dtype=np.str_
assert_type(np.genfromtxt(pathlib_path, dtype=np.str_), npt.NDArray[np.str_])

# 调用 numpy 的 genfromtxt 函数,从指定的字符串路径中读取数据,跳过前两行标题,期望返回任意类型的数组
assert_type(np.genfromtxt(str_path, dtype=str, skip_header=2), npt.NDArray[Any])

# 调用 numpy 的 genfromtxt 函数,从指定的字符串文件中读取数据,"test" 字符串作为注释,期望返回任意类型的数组
assert_type(np.genfromtxt(str_file, comments="test"), npt.NDArray[Any])

# 调用 numpy 的 genfromtxt 函数,从指定的字符串路径中读取数据,使用换行符作为分隔符,期望返回任意类型的数组
assert_type(np.genfromtxt(str_path, delimiter="\n"), npt.NDArray[Any])

# 调用 numpy 的 genfromtxt 函数,从指定的字符串路径中读取数据,期望返回至少包含两个维度的数组
assert_type(np.genfromtxt(str_path, ndmin=2), npt.NDArray[Any])

# 调用 numpy 的 genfromtxt 函数,从提供的字符串列表中读取数据,期望返回至少包含两个维度的数组
assert_type(np.genfromtxt(["1", "2", "3"], ndmin=2), npt.NDArray[Any])

.\numpy\numpy\typing\tests\data\reveal\numeric.pyi

"""
Tests for :mod:`_core.numeric`.

Does not include tests which fall under ``array_constructors``.
"""

# 导入系统模块sys和类型提示模块Any
import sys
from typing import Any

# 导入numpy库,并使用简称np
import numpy as np
# 导入numpy.typing模块,并使用简称npt
import numpy.typing as npt

# 根据Python版本导入assert_type函数
if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    from typing_extensions import assert_type

# 定义一个SubClass类,继承自npt.NDArray[np.int64],但没有实现具体功能
class SubClass(npt.NDArray[np.int64]):
    ...

# 定义变量i8为np.int64类型
i8: np.int64

# 定义变量AR_b到AR_O为不同类型的npt.NDArray数组类型
AR_b: npt.NDArray[np.bool]
AR_u8: npt.NDArray[np.uint64]
AR_i8: npt.NDArray[np.int64]
AR_f8: npt.NDArray[np.float64]
AR_c16: npt.NDArray[np.complex128]
AR_m: npt.NDArray[np.timedelta64]
AR_O: npt.NDArray[np.object_]

# 定义变量B为int类型的列表
B: list[int]
# 定义变量C为SubClass类的实例

C: SubClass

# 对不同函数调用进行类型断言
assert_type(np.count_nonzero(i8), int)
assert_type(np.count_nonzero(AR_i8), int)
assert_type(np.count_nonzero(B), int)
assert_type(np.count_nonzero(AR_i8, keepdims=True), Any)
assert_type(np.count_nonzero(AR_i8, axis=0), Any)

assert_type(np.isfortran(i8), bool)
assert_type(np.isfortran(AR_i8), bool)

assert_type(np.argwhere(i8), npt.NDArray[np.intp])
assert_type(np.argwhere(AR_i8), npt.NDArray[np.intp])

assert_type(np.flatnonzero(i8), npt.NDArray[np.intp])
assert_type(np.flatnonzero(AR_i8), npt.NDArray[np.intp])

assert_type(np.correlate(B, AR_i8, mode="valid"), npt.NDArray[np.signedinteger[Any]])
assert_type(np.correlate(AR_i8, AR_i8, mode="same"), npt.NDArray[np.signedinteger[Any]])
assert_type(np.correlate(AR_b, AR_b), npt.NDArray[np.bool])
assert_type(np.correlate(AR_b, AR_u8), npt.NDArray[np.unsignedinteger[Any]])
assert_type(np.correlate(AR_i8, AR_b), npt.NDArray[np.signedinteger[Any]])
assert_type(np.correlate(AR_i8, AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.correlate(AR_i8, AR_c16), npt.NDArray[np.complexfloating[Any, Any]])
assert_type(np.correlate(AR_i8, AR_m), npt.NDArray[np.timedelta64])
assert_type(np.correlate(AR_O, AR_O), npt.NDArray[np.object_])

assert_type(np.convolve(B, AR_i8, mode="valid"), npt.NDArray[np.signedinteger[Any]])
assert_type(np.convolve(AR_i8, AR_i8, mode="same"), npt.NDArray[np.signedinteger[Any]])
assert_type(np.convolve(AR_b, AR_b), npt.NDArray[np.bool])
assert_type(np.convolve(AR_b, AR_u8), npt.NDArray[np.unsignedinteger[Any]])
assert_type(np.convolve(AR_i8, AR_b), npt.NDArray[np.signedinteger[Any]])
assert_type(np.convolve(AR_i8, AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.convolve(AR_i8, AR_c16), npt.NDArray[np.complexfloating[Any, Any]])
assert_type(np.convolve(AR_i8, AR_m), npt.NDArray[np.timedelta64])
assert_type(np.convolve(AR_O, AR_O), npt.NDArray[np.object_])

assert_type(np.outer(i8, AR_i8), npt.NDArray[np.signedinteger[Any]])
assert_type(np.outer(B, AR_i8), npt.NDArray[np.signedinteger[Any]])
assert_type(np.outer(AR_i8, AR_i8), npt.NDArray[np.signedinteger[Any]])
assert_type(np.outer(AR_i8, AR_i8, out=C), SubClass)
assert_type(np.outer(AR_b, AR_b), npt.NDArray[np.bool])
assert_type(np.outer(AR_b, AR_u8), npt.NDArray[np.unsignedinteger[Any]])
assert_type(np.outer(AR_i8, AR_b), npt.NDArray[np.signedinteger[Any]])
# 确保 np.convolve 返回一个包含任意浮点数的多维数组
assert_type(np.convolve(AR_i8, AR_f8), npt.NDArray[np.floating[Any]])

# 确保 np.outer 返回一个包含复数浮点数的二维数组
assert_type(np.outer(AR_i8, AR_c16), npt.NDArray[np.complexfloating[Any, Any]])

# 确保 np.outer 返回一个包含时间增量的二维数组
assert_type(np.outer(AR_i8, AR_m), npt.NDArray[np.timedelta64])

# 确保 np.outer 返回一个包含对象的二维数组
assert_type(np.outer(AR_O, AR_O), npt.NDArray[np.object_])

# 确保 np.tensordot 返回一个包含任意有符号整数的多维数组
assert_type(np.tensordot(B, AR_i8), npt.NDArray[np.signedinteger[Any]])
assert_type(np.tensordot(AR_i8, AR_i8), npt.NDArray[np.signedinteger[Any]])
assert_type(np.tensordot(AR_i8, AR_i8, axes=0), npt.NDArray[np.signedinteger[Any]])
assert_type(np.tensordot(AR_i8, AR_i8, axes=(0, 1)), npt.NDArray[np.signedinteger[Any]])

# 确保 np.tensordot 返回一个包含布尔值的多维数组
assert_type(np.tensordot(AR_b, AR_b), npt.NDArray[np.bool])
assert_type(np.tensordot(AR_b, AR_u8), npt.NDArray[np.unsignedinteger[Any]])
assert_type(np.tensordot(AR_i8, AR_b), npt.NDArray[np.signedinteger[Any]])

# 确保 np.tensordot 返回一个包含任意浮点数的多维数组
assert_type(np.tensordot(AR_i8, AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.tensordot(AR_i8, AR_c16), npt.NDArray[np.complexfloating[Any, Any]])
assert_type(np.tensordot(AR_i8, AR_m), npt.NDArray[np.timedelta64])
assert_type(np.tensordot(AR_O, AR_O), npt.NDArray[np.object_])

# 确保 np.isscalar 返回一个布尔值
assert_type(np.isscalar(i8), bool)
assert_type(np.isscalar(AR_i8), bool)
assert_type(np.isscalar(B), bool)

# 确保 np.roll 返回一个包含 int64 类型的数组
assert_type(np.roll(AR_i8, 1), npt.NDArray[np.int64])
assert_type(np.roll(AR_i8, (1, 2)), npt.NDArray[np.int64])
assert_type(np.roll(B, 1), npt.NDArray[Any])

# 确保 np.rollaxis 返回一个包含 int64 类型的数组
assert_type(np.rollaxis(AR_i8, 0, 1), npt.NDArray[np.int64])

# 确保 np.moveaxis 返回一个包含 int64 类型的数组
assert_type(np.moveaxis(AR_i8, 0, 1), npt.NDArray[np.int64])
assert_type(np.moveaxis(AR_i8, (0, 1), (1, 2)), npt.NDArray[np.int64])

# 确保 np.cross 返回一个包含任意有符号整数的多维数组
assert_type(np.cross(B, AR_i8), npt.NDArray[np.signedinteger[Any]])
assert_type(np.cross(AR_i8, AR_i8), npt.NDArray[np.signedinteger[Any]])
assert_type(np.cross(AR_b, AR_u8), npt.NDArray[np.unsignedinteger[Any]])
assert_type(np.cross(AR_i8, AR_b), npt.NDArray[np.signedinteger[Any]])

# 确保 np.cross 返回一个包含任意浮点数的多维数组
assert_type(np.cross(AR_i8, AR_f8), npt.NDArray[np.floating[Any]])
assert_type(np.cross(AR_i8, AR_c16), npt.NDArray[np.complexfloating[Any, Any]])
assert_type(np.cross(AR_O, AR_O), npt.NDArray[np.object_])

# 确保 np.indices 返回一个包含 int_ 类型的多维数组
assert_type(np.indices([0, 1, 2]), npt.NDArray[np.int_])

# 确保 np.indices 返回一个包含 int_ 类型的元组
assert_type(np.indices([0, 1, 2], sparse=True), tuple[npt.NDArray[np.int_], ...])

# 确保 np.indices 返回一个包含 float64 类型的多维数组
assert_type(np.indices([0, 1, 2], dtype=np.float64), npt.NDArray[np.float64])

# 确保 np.indices 返回一个包含 float64 类型的元组
assert_type(np.indices([0, 1, 2], sparse=True, dtype=np.float64), tuple[npt.NDArray[np.float64], ...])

# 确保 np.indices 返回一个包含任意类型的多维数组
assert_type(np.indices([0, 1, 2], dtype=float), npt.NDArray[Any])

# 确保 np.indices 返回一个包含任意类型的元组
assert_type(np.indices([0, 1, 2], sparse=True, dtype=float), tuple[npt.NDArray[Any], ...])

# 确保 np.binary_repr 返回一个字符串
assert_type(np.binary_repr(1), str)

# 确保 np.base_repr 返回一个字符串
assert_type(np.base_repr(1), str)

# 确保 np.allclose 返回一个布尔值
assert_type(np.allclose(i8, AR_i8), bool)
assert_type(np.allclose(B, AR_i8), bool)
assert_type(np.allclose(AR_i8, AR_i8), bool)

# 确保 np.isclose 返回一个布尔值
assert_type(np.isclose(i8, i8), np.bool)
assert_type(np.isclose(i8, AR_i8), npt.NDArray[np.bool])
assert_type(np.isclose(B, AR_i8), npt.NDArray[np.bool])
assert_type(np.isclose(AR_i8, AR_i8), npt.NDArray[np.bool])

# 确保 np.array_equal 返回一个布尔值
assert_type(np.array_equal(i8, AR_i8), bool)
# 断言:验证两个 NumPy 数组 B 和 AR_i8 是否相等,并返回布尔值结果
assert_type(np.array_equal(B, AR_i8), bool)

# 断言:验证一个 NumPy 数组 AR_i8 是否与自身相等,并返回布尔值结果
assert_type(np.array_equal(AR_i8, AR_i8), bool)

# 断言:验证两个 NumPy 数组 i8 和 AR_i8 是否在数值意义上等价,并返回布尔值结果
assert_type(np.array_equiv(i8, AR_i8), bool)

# 断言:验证两个 NumPy 数组 B 和 AR_i8 是否在数值意义上等价,并返回布尔值结果
assert_type(np.array_equiv(B, AR_i8), bool)

# 断言:验证一个 NumPy 数组 AR_i8 是否与自身在数值意义上等价,并返回布尔值结果
assert_type(np.array_equiv(AR_i8, AR_i8), bool)

.\numpy\numpy\typing\tests\data\reveal\numerictypes.pyi

# 导入 sys 模块,用于访问系统相关的功能
import sys
# 导入 Literal 类型提示,用于指定字面量类型
from typing import Literal
# 导入 numpy 库,约定使用 np 别名
import numpy as np

# 根据 Python 版本选择不同的 assert_type 函数导入方式
if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    from typing_extensions import assert_type

# 使用 assert_type 函数断言 np.ScalarType 的类型约束
assert_type(
    np.ScalarType,
    tuple[
        type[int],             # 整数类型
        type[float],           # 浮点数类型
        type[complex],         # 复数类型
        type[bool],            # 布尔类型
        type[bytes],           # 字节类型
        type[str],             # 字符串类型
        type[memoryview],      # 内存视图类型
        type[np.bool],         # numpy 布尔类型
        type[np.csingle],      # numpy 单精度复数类型
        type[np.cdouble],      # numpy 双精度复数类型
        type[np.clongdouble],  # numpy 长双精度复数类型
        type[np.half],         # numpy 半精度浮点数类型
        type[np.single],       # numpy 单精度浮点数类型
        type[np.double],       # numpy 双精度浮点数类型
        type[np.longdouble],   # numpy 长双精度浮点数类型
        type[np.byte],         # numpy 字节类型
        type[np.short],        # numpy 短整型
        type[np.intc],         # numpy C 风格整型
        type[np.long],         # numpy 长整型
        type[np.longlong],     # numpy 长长整型
        type[np.timedelta64],  # numpy 时间间隔类型
        type[np.datetime64],   # numpy 日期时间类型
        type[np.object_],      # numpy 对象类型
        type[np.bytes_],       # numpy 字节类型
        type[np.str_],         # numpy 字符串类型
        type[np.ubyte],        # numpy 无符号字节类型
        type[np.ushort],       # numpy 无符号短整型
        type[np.uintc],        # numpy 无符号 C 风格整型
        type[np.ulong],        # numpy 无符号长整型
        type[np.ulonglong],    # numpy 无符号长长整型
        type[np.void],         # numpy 空类型
    ],
)

# 使用 assert_type 函数断言 np.ScalarType 元组的第一个元素为整数类型
assert_type(np.ScalarType[0], type[int])
# 使用 assert_type 函数断言 np.ScalarType 元组的第四个元素为布尔类型
assert_type(np.ScalarType[3], type[bool])
# 使用 assert_type 函数断言 np.ScalarType 元组的第九个元素为 numpy 单精度复数类型
assert_type(np.ScalarType[8], type[np.csingle])
# 使用 assert_type 函数断言 np.ScalarType 元组的第十一个元素为 numpy 长双精度复数类型
assert_type(np.ScalarType[10], type[np.clongdouble])

# 使用 assert_type 函数断言 numpy 布尔类型 np.bool_ 为 numpy 布尔类型
assert_type(np.bool_, type[np.bool])

# 使用 assert_type 函数断言 numpy 类型码表中字符类型 "c" 的字面量类型为 Literal["c"]
assert_type(np.typecodes["Character"], Literal["c"])
# 使用 assert_type 函数断言 numpy 类型码表中复数类型 "FDG" 的字面量类型为 Literal["FDG"]
assert_type(np.typecodes["Complex"], Literal["FDG"])
# 使用 assert_type 函数断言 numpy 类型码表中所有类型码 "All" 的字面量类型为 Literal["?bhilqpBHILQPefdgFDGSUVOMm"]
assert_type(np.typecodes["All"], Literal["?bhilqpBHILQPefdgFDGSUVOMm"])

.\numpy\numpy\typing\tests\data\reveal\random.pyi

import sys
import threading
from typing import Any
from collections.abc import Sequence

import numpy as np
import numpy.typing as npt
from numpy.random._generator import Generator
from numpy.random._mt19937 import MT19937
from numpy.random._pcg64 import PCG64
from numpy.random._sfc64 import SFC64
from numpy.random._philox import Philox
from numpy.random.bit_generator import SeedSequence, SeedlessSeedSequence

# 如果 Python 版本大于等于 3.11,则使用标准库中的 assert_type
if sys.version_info >= (3, 11):
    from typing import assert_type
else:
    # 否则,从 typing_extensions 导入 assert_type
    from typing_extensions import assert_type

# 创建默认的随机数生成器
def_rng = np.random.default_rng()
# 创建种子序列
seed_seq = np.random.SeedSequence()
# 创建 MT19937 随机数生成器
mt19937 = np.random.MT19937()
# 创建 PCG64 随机数生成器
pcg64 = np.random.PCG64()
# 创建 SFC64 随机数生成器
sfc64 = np.random.SFC64()
# 创建 Philox 随机数生成器
philox = np.random.Philox()
# 创建无种子的种子序列
seedless_seq = SeedlessSeedSequence()

# 使用 assert_type 函数确保对象类型正确
assert_type(def_rng, Generator)
assert_type(mt19937, MT19937)
assert_type(pcg64, PCG64)
assert_type(sfc64, SFC64)
assert_type(philox, Philox)
assert_type(seed_seq, SeedSequence)
assert_type(seedless_seq, SeedlessSeedSequence)

# 对 MT19937 随机数生成器进行不同操作,并检查返回类型
mt19937_jumped = mt19937.jumped()
mt19937_jumped3 = mt19937.jumped(3)
mt19937_raw = mt19937.random_raw()
mt19937_raw_arr = mt19937.random_raw(5)

assert_type(mt19937_jumped, MT19937)
assert_type(mt19937_jumped3, MT19937)
assert_type(mt19937_raw, int)
assert_type(mt19937_raw_arr, npt.NDArray[np.uint64])
assert_type(mt19937.lock, threading.Lock)

# 对 PCG64 随机数生成器进行不同操作,并检查返回类型
pcg64_jumped = pcg64.jumped()
pcg64_jumped3 = pcg64.jumped(3)
pcg64_adv = pcg64.advance(3)
pcg64_raw = pcg64.random_raw()
pcg64_raw_arr = pcg64.random_raw(5)

assert_type(pcg64_jumped, PCG64)
assert_type(pcg64_jumped3, PCG64)
assert_type(pcg64_adv, PCG64)
assert_type(pcg64_raw, int)
assert_type(pcg64_raw_arr, npt.NDArray[np.uint64])
assert_type(pcg64.lock, threading.Lock)

# 对 Philox 随机数生成器进行不同操作,并检查返回类型
philox_jumped = philox.jumped()
philox_jumped3 = philox.jumped(3)
philox_adv = philox.advance(3)
philox_raw = philox.random_raw()
philox_raw_arr = philox.random_raw(5)

assert_type(philox_jumped, Philox)
assert_type(philox_jumped3, Philox)
assert_type(philox_adv, Philox)
assert_type(philox_raw, int)
assert_type(philox_raw_arr, npt.NDArray[np.uint64])
assert_type(philox.lock, threading.Lock)

# 对 SFC64 随机数生成器进行不同操作,并检查返回类型
sfc64_raw = sfc64.random_raw()
sfc64_raw_arr = sfc64.random_raw(5)

assert_type(sfc64_raw, int)
assert_type(sfc64_raw_arr, npt.NDArray[np.uint64])
assert_type(sfc64.lock, threading.Lock)

# 对种子序列进行不同操作,并检查返回类型
assert_type(seed_seq.pool, npt.NDArray[np.uint32])
assert_type(seed_seq.entropy, None | int | Sequence[int])
assert_type(seed_seq.spawn(1), list[np.random.SeedSequence])
assert_type(seed_seq.generate_state(8, "uint32"), npt.NDArray[np.uint32 | np.uint64])
assert_type(seed_seq.generate_state(8, "uint64"), npt.NDArray[np.uint32 | np.uint64])

# 创建默认的随机数生成器,并指定其类型
def_gen: np.random.Generator = np.random.default_rng()

# 创建不同的 numpy 数组并指定其类型
D_arr_0p1: npt.NDArray[np.float64] = np.array([0.1])
D_arr_0p5: npt.NDArray[np.float64] = np.array([0.5])
D_arr_0p9: npt.NDArray[np.float64] = np.array([0.9])
D_arr_1p5: npt.NDArray[np.float64] = np.array([1.5])
I_arr_10: npt.NDArray[np.int_] = np.array([10], dtype=np.int_)
I_arr_20: npt.NDArray[np.int_] = np.array([20], dtype=np.int_)
D_arr_like_0p1: list[float] = [0.1]
D_arr_like_0p5: list[float] = [0.5]
D_arr_like_0p9: list[float] = [0.9]
D_arr_like_1p5: list[float] = [1.5]
I_arr_like_10: list[int] = [10]
I_arr_like_20: list[int] = [20]
D_2D_like: list[list[float]] = [[1, 2], [2, 3], [3, 4], [4, 5.1]]
D_2D: npt.NDArray[np.float64] = np.array(D_2D_like)
S_out: npt.NDArray[np.float32] = np.empty(1, dtype=np.float32)
D_out: npt.NDArray[np.float64] = np.empty(1)

assert_type(def_gen.standard_normal(), float)
# 检查 def_gen.standard_normal() 返回类型是否为 float

assert_type(def_gen.standard_normal(dtype=np.float32), float)
# 检查 def_gen.standard_normal(dtype=np.float32) 返回类型是否为 float

assert_type(def_gen.standard_normal(dtype="float32"), float)
# 检查 def_gen.standard_normal(dtype="float32") 返回类型是否为 float

assert_type(def_gen.standard_normal(dtype="double"), float)
# 检查 def_gen.standard_normal(dtype="double") 返回类型是否为 float

assert_type(def_gen.standard_normal(dtype=np.float64), float)
# 检查 def_gen.standard_normal(dtype=np.float64) 返回类型是否为 float

assert_type(def_gen.standard_normal(size=None), float)
# 检查 def_gen.standard_normal(size=None) 返回类型是否为 float

assert_type(def_gen.standard_normal(size=1), npt.NDArray[np.float64])
# 检查 def_gen.standard_normal(size=1) 返回类型是否为 numpy float64 数组

assert_type(def_gen.standard_normal(size=1, dtype=np.float32), npt.NDArray[np.float32])
# 检查 def_gen.standard_normal(size=1, dtype=np.float32) 返回类型是否为 numpy float32 数组

assert_type(def_gen.standard_normal(size=1, dtype="f4"), npt.NDArray[np.float32])
# 检查 def_gen.standard_normal(size=1, dtype="f4") 返回类型是否为 numpy float32 数组

assert_type(def_gen.standard_normal(size=1, dtype="float32", out=S_out), npt.NDArray[np.float32])
# 检查 def_gen.standard_normal(size=1, dtype="float32", out=S_out) 返回类型是否为 numpy float32 数组

assert_type(def_gen.standard_normal(dtype=np.float32, out=S_out), npt.NDArray[np.float32])
# 检查 def_gen.standard_normal(dtype=np.float32, out=S_out) 返回类型是否为 numpy float32 数组

assert_type(def_gen.standard_normal(size=1, dtype=np.float64), npt.NDArray[np.float64])
# 检查 def_gen.standard_normal(size=1, dtype=np.float64) 返回类型是否为 numpy float64 数组

assert_type(def_gen.standard_normal(size=1, dtype="float64"), npt.NDArray[np.float64])
# 检查 def_gen.standard_normal(size=1, dtype="float64") 返回类型是否为 numpy float64 数组

assert_type(def_gen.standard_normal(size=1, dtype="f8"), npt.NDArray[np.float64])
# 检查 def_gen.standard_normal(size=1, dtype="f8") 返回类型是否为 numpy float64 数组

assert_type(def_gen.standard_normal(out=D_out), npt.NDArray[np.float64])
# 检查 def_gen.standard_normal(out=D_out) 返回类型是否为 numpy float64 数组

assert_type(def_gen.standard_normal(size=1, dtype="float64"), npt.NDArray[np.float64])
# 检查 def_gen.standard_normal(size=1, dtype="float64") 返回类型是否为 numpy float64 数组

assert_type(def_gen.standard_normal(size=1, dtype="float64", out=D_out), npt.NDArray[np.float64])
# 检查 def_gen.standard_normal(size=1, dtype="float64", out=D_out) 返回类型是否为 numpy float64 数组

assert_type(def_gen.random(), float)
# 检查 def_gen.random() 返回类型是否为 float

assert_type(def_gen.random(dtype=np.float32), float)
# 检查 def_gen.random(dtype=np.float32) 返回类型是否为 float

assert_type(def_gen.random(dtype="float32"), float)
# 检查 def_gen.random(dtype="float32") 返回类型是否为 float

assert_type(def_gen.random(dtype="double"), float)
# 检查 def_gen.random(dtype="double") 返回类型是否为 float

assert_type(def_gen.random(dtype=np.float64), float)
# 检查 def_gen.random(dtype=np.float64) 返回类型是否为 float

assert_type(def_gen.random(size=None), float)
# 检查 def_gen.random(size=None) 返回类型是否为 float

assert_type(def_gen.random(size=1), npt.NDArray[np.float64])
# 检查 def_gen.random(size=1) 返回类型是否为 numpy float64 数组

assert_type(def_gen.random(size=1, dtype=np.float32), npt.NDArray[np.float32])
# 检查 def_gen.random(size=1, dtype=np.float32) 返回类型是否为 numpy float32 数组

assert_type(def_gen.random(size=1, dtype="f4"), npt.NDArray[np.float32])
# 检查 def_gen.random(size=1, dtype="f4") 返回类型是否为 numpy float32 数组

assert_type(def_gen.random(size=1, dtype="float32", out=S_out), npt.NDArray[np.float32])
# 检查 def_gen.random(size=1, dtype="float32", out=S_out) 返回类型是否为 numpy float32 数组

assert_type(def_gen.random(dtype=np.float32, out=S_out), npt.NDArray[np.float32])
# 检查 def_gen.random(dtype=np.float32, out=S_out) 返回类型是否为 numpy float32 数组

assert_type(def_gen.random(size=1, dtype=np.float64), npt.NDArray[np.float64])
# 检查 def_gen.random(size=1, dtype=np.float64) 返回类型是否为 numpy float64 数组

assert_type(def_gen.random(size=1, dtype="float64"), npt.NDArray[np.float64])
# 检查 def_gen.random(size=1, dtype="float64") 返回类型是否为 numpy float64 数组

assert_type(def_gen.random(size=1, dtype="f8"), npt.NDArray[np.float64])
# 检查 def_gen.random(size=1, dtype="f8") 返回类型是否为 numpy float64 数组

assert_type(def_gen.random(out=D_out), npt.NDArray[np.float64])
# 检查 def_gen.random(out=D_out) 返回类型是否为 numpy float64 数组

assert_type(def_gen.random(size=1, dtype="float64"), npt.NDArray[np.float64])
# 检查 def_gen.random(size=1, dtype="float64") 返回类型是否为 numpy float64 数组

assert_type(def_gen.random(size=1, dtype="float64", out=D_out), npt.NDArray[np.float64])
# 检查 def_gen.random(size=1, dtype="float64", out=D_out) 返回类型是否为 numpy float64 数组

assert_type(def_gen.standard_cauchy(), float)
# 检查 def_gen.standard_cauchy() 返回类型是否为 float
# 验证 def_gen.standard_cauchy() 函数返回值类型是否为 float
assert_type(def_gen.standard_cauchy(size=None), float)
# 验证 def_gen.standard_cauchy(size=1) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_cauchy(size=1), npt.NDArray[np.float64])

# 验证 def_gen.standard_exponential() 函数返回值类型是否为 float
assert_type(def_gen.standard_exponential(), float)
# 验证 def_gen.standard_exponential(method="inv") 函数返回值类型是否为 float
assert_type(def_gen.standard_exponential(method="inv"), float)
# 验证 def_gen.standard_exponential(dtype=np.float32) 函数返回值类型是否为 float
assert_type(def_gen.standard_exponential(dtype=np.float32), float)
# 验证 def_gen.standard_exponential(dtype="float32") 函数返回值类型是否为 float
assert_type(def_gen.standard_exponential(dtype="float32"), float)
# 验证 def_gen.standard_exponential(dtype="double") 函数返回值类型是否为 float
assert_type(def_gen.standard_exponential(dtype="double"), float)
# 验证 def_gen.standard_exponential(dtype=np.float64) 函数返回值类型是否为 float
assert_type(def_gen.standard_exponential(dtype=np.float64), float)
# 验证 def_gen.standard_exponential(size=None) 函数返回值类型是否为 float
assert_type(def_gen.standard_exponential(size=None), float)
# 验证 def_gen.standard_exponential(size=None, method="inv") 函数返回值类型是否为 float
assert_type(def_gen.standard_exponential(size=None, method="inv"), float)
# 验证 def_gen.standard_exponential(size=1, method="inv") 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_exponential(size=1, method="inv"), npt.NDArray[np.float64])
# 验证 def_gen.standard_exponential(size=1, dtype=np.float32) 函数返回值类型是否为 numpy 数组中的 float32 类型
assert_type(def_gen.standard_exponential(size=1, dtype=np.float32), npt.NDArray[np.float32])
# 验证 def_gen.standard_exponential(size=1, dtype="f4", method="inv") 函数返回值类型是否为 numpy 数组中的 float32 类型
assert_type(def_gen.standard_exponential(size=1, dtype="f4", method="inv"), npt.NDArray[np.float32])
# 验证 def_gen.standard_exponential(size=1, dtype="float32", out=S_out) 函数返回值类型是否为 numpy 数组中的 float32 类型
assert_type(def_gen.standard_exponential(size=1, dtype="float32", out=S_out), npt.NDArray[np.float32])
# 验证 def_gen.standard_exponential(dtype=np.float32, out=S_out) 函数返回值类型是否为 numpy 数组中的 float32 类型
assert_type(def_gen.standard_exponential(dtype=np.float32, out=S_out), npt.NDArray[np.float32])
# 验证 def_gen.standard_exponential(size=1, dtype=np.float64, method="inv") 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_exponential(size=1, dtype=np.float64, method="inv"), npt.NDArray[np.float64])
# 验证 def_gen.standard_exponential(size=1, dtype="float64") 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_exponential(size=1, dtype="float64"), npt.NDArray[np.float64])
# 验证 def_gen.standard_exponential(size=1, dtype="f8") 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_exponential(size=1, dtype="f8"), npt.NDArray[np.float64])
# 验证 def_gen.standard_exponential(out=D_out) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_exponential(out=D_out), npt.NDArray[np.float64])
# 验证 def_gen.standard_exponential(size=1, dtype="float64") 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_exponential(size=1, dtype="float64"), npt.NDArray[np.float64])
# 验证 def_gen.standard_exponential(size=1, dtype="float64", out=D_out) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_exponential(size=1, dtype="float64", out=D_out), npt.NDArray[np.float64])

# 验证 def_gen.zipf(1.5) 函数返回值类型是否为 int
assert_type(def_gen.zipf(1.5), int)
# 验证 def_gen.zipf(1.5, size=None) 函数返回值类型是否为 int
assert_type(def_gen.zipf(1.5, size=None), int)
# 验证 def_gen.zipf(1.5, size=1) 函数返回值类型是否为 numpy 数组中的 int64 类型
assert_type(def_gen.zipf(1.5, size=1), npt.NDArray[np.int64])
# 验证 def_gen.zipf(D_arr_1p5) 函数返回值类型是否为 numpy 数组中的 int64 类型
assert_type(def_gen.zipf(D_arr_1p5), npt.NDArray[np.int64])
# 验证 def_gen.zipf(D_arr_1p5, size=1) 函数返回值类型是否为 numpy 数组中的 int64 类型
assert_type(def_gen.zipf(D_arr_1p5, size=1), npt.NDArray[np.int64])
# 验证 def_gen.zipf(D_arr_like_1p5) 函数返回值类型是否为 numpy 数组中的 int64 类型
assert_type(def_gen.zipf(D_arr_like_1p5), npt.NDArray[np.int64])
# 验证 def_gen.zipf(D_arr_like_1p5, size=1) 函数返回值类型是否为 numpy 数组中的 int64 类型
assert_type(def_gen.zipf(D_arr_like_1p5, size=1), npt.NDArray[np.int64])

# 验证 def_gen.weibull(0.5) 函数返回值类型是否为 float
assert_type(def_gen.weibull(0.5), float)
# 验证 def_gen.weibull(0.5, size=None) 函数返回值类型是否为 float
assert_type(def_gen.weibull(0.5, size=None), float)
# 验证 def_gen.weibull(0.5, size=1) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.weibull(0.5, size=1), npt.NDArray[np.float64])
# 验证 def_gen.weibull(D_arr_0p5) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.weibull(D_arr_0p5), npt.NDArray[np.float64])
# 验证 def_gen.weibull(D_arr_0p5, size=1) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.weibull(D_arr_0p5, size=1), npt.NDArray[np.float64])
# 验证 def_gen.weibull(D_arr_like_0p5) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.weibull(D_arr_like_0p5), npt.NDArray[np.float64])
# 验证 def_gen.weibull(D_arr_like_0p5, size=1) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.weibull(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 验证 def_gen.standard_t(0.5) 函数返回值类型是否为 float
assert_type(def_gen.standard_t(0.5), float)
# 验证 def_gen.standard_t(0.5, size=None) 函数返回值类型是否为 float
assert_type(def_gen.standard_t(0.5, size=None), float)
# 验证 def_gen.standard_t(0.5, size=1) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_t(0.5, size=1), npt.NDArray[np.float64])
# 验证 def_gen.standard_t(D_arr_0p5) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_t(D_arr_0p5), npt.NDArray[np.float64])
# 验证 def_gen.standard_t(D_arr_0p5, size=1) 函数返回值类型是否为 numpy 数组中的 float64 类型
assert_type(def_gen.standard_t(D_arr_0p5, size=1),
# 确保 def_gen.standard_t 返回的结果是 npt.NDArray[np.float64] 类型
assert_type(def_gen.standard_t(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 确保 def_gen.poisson 函数返回的结果是 int 类型
assert_type(def_gen.poisson(0.5), int)
# 确保 def_gen.poisson 函数返回的结果是 int 类型,并且 size 参数为 None
assert_type(def_gen.poisson(0.5, size=None), int)
# 确保 def_gen.poisson 函数返回的结果是 npt.NDArray[np.int64] 类型,并且 size 参数为 1
assert_type(def_gen.poisson(0.5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.poisson 函数返回的结果是 npt.NDArray[np.int64] 类型,参数为 D_arr_0p5
assert_type(def_gen.poisson(D_arr_0p5), npt.NDArray[np.int64])
# 确保 def_gen.poisson 函数返回的结果是 npt.NDArray[np.int64] 类型,参数为 D_arr_0p5,并且 size 参数为 1
assert_type(def_gen.poisson(D_arr_0p5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.poisson 函数返回的结果是 npt.NDArray[np.int64] 类型,参数为 D_arr_like_0p5
assert_type(def_gen.poisson(D_arr_like_0p5), npt.NDArray[np.int64])
# 确保 def_gen.poisson 函数返回的结果是 npt.NDArray[np.int64] 类型,参数为 D_arr_like_0p5,并且 size 参数为 1
assert_type(def_gen.poisson(D_arr_like_0p5, size=1), npt.NDArray[np.int64])

# 确保 def_gen.power 函数返回的结果是 float 类型
assert_type(def_gen.power(0.5), float)
# 确保 def_gen.power 函数返回的结果是 float 类型,并且 size 参数为 None
assert_type(def_gen.power(0.5, size=None), float)
# 确保 def_gen.power 函数返回的结果是 npt.NDArray[np.float64] 类型,并且 size 参数为 1
assert_type(def_gen.power(0.5, size=1), npt.NDArray[np.float64])
# 确保 def_gen.power 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_0p5
assert_type(def_gen.power(D_arr_0p5), npt.NDArray[np.float64])
# 确保 def_gen.power 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_0p5,并且 size 参数为 1
assert_type(def_gen.power(D_arr_0p5, size=1), npt.NDArray[np.float64])
# 确保 def_gen.power 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_like_0p5
assert_type(def_gen.power(D_arr_like_0p5), npt.NDArray[np.float64])
# 确保 def_gen.power 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_like_0p5,并且 size 参数为 1
assert_type(def_gen.power(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 确保 def_gen.pareto 函数返回的结果是 float 类型
assert_type(def_gen.pareto(0.5), float)
# 确保 def_gen.pareto 函数返回的结果是 float 类型,并且 size 参数为 None
assert_type(def_gen.pareto(0.5, size=None), float)
# 确保 def_gen.pareto 函数返回的结果是 npt.NDArray[np.float64] 类型,并且 size 参数为 1
assert_type(def_gen.pareto(0.5, size=1), npt.NDArray[np.float64])
# 确保 def_gen.pareto 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_0p5
assert_type(def_gen.pareto(D_arr_0p5), npt.NDArray[np.float64])
# 确保 def_gen.pareto 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_0p5,并且 size 参数为 1
assert_type(def_gen.pareto(D_arr_0p5, size=1), npt.NDArray[np.float64])
# 确保 def_gen.pareto 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_like_0p5
assert_type(def_gen.pareto(D_arr_like_0p5), npt.NDArray[np.float64])
# 确保 def_gen.pareto 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_like_0p5,并且 size 参数为 1
assert_type(def_gen.pareto(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 确保 def_gen.chisquare 函数返回的结果是 float 类型
assert_type(def_gen.chisquare(0.5), float)
# 确保 def_gen.chisquare 函数返回的结果是 float 类型,并且 size 参数为 None
assert_type(def_gen.chisquare(0.5, size=None), float)
# 确保 def_gen.chisquare 函数返回的结果是 npt.NDArray[np.float64] 类型,并且 size 参数为 1
assert_type(def_gen.chisquare(0.5, size=1), npt.NDArray[np.float64])
# 确保 def_gen.chisquare 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_0p5
assert_type(def_gen.chisquare(D_arr_0p5), npt.NDArray[np.float64])
# 确保 def_gen.chisquare 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_0p5,并且 size 参数为 1
assert_type(def_gen.chisquare(D_arr_0p5, size=1), npt.NDArray[np.float64])
# 确保 def_gen.chisquare 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_like_0p5
assert_type(def_gen.chisquare(D_arr_like_0p5), npt.NDArray[np.float64])
# 确保 def_gen.chisquare 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_like_0p5,并且 size 参数为 1
assert_type(def_gen.chisquare(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 确保 def_gen.exponential 函数返回的结果是 float 类型
assert_type(def_gen.exponential(0.5), float)
# 确保 def_gen.exponential 函数返回的结果是 float 类型,并且 size 参数为 None
assert_type(def_gen.exponential(0.5, size=None), float)
# 确保 def_gen.exponential 函数返回的结果是 npt.NDArray[np.float64] 类型,并且 size 参数为 1
assert_type(def_gen.exponential(0.5, size=1), npt.NDArray[np.float64])
# 确保 def_gen.exponential 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_0p5
assert_type(def_gen.exponential(D_arr_0p5), npt.NDArray[np.float64])
# 确保 def_gen.exponential 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_0p5,并且 size 参数为 1
assert_type(def_gen.exponential(D_arr_0p5, size=1), npt.NDArray[np.float64])
# 确保 def_gen.exponential 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_like_0p5
assert_type(def_gen.exponential(D_arr_like_0p5), npt.NDArray[np.float64])
# 确保 def_gen.exponential 函数返回的结果是 npt.NDArray[np.float64] 类型,参数为 D_arr_like_0p5,并且 size 参数为 1
assert_type(def_gen.exponential(D_arr_like_0p5, size=1), npt.NDArray[np.float64
# 调用自定义生成器模块中的logseries函数,返回结果类型为np.int64的NumPy数组
assert_type(def_gen.logseries(D_arr_0p5, size=1), npt.NDArray[np.int64])

# 调用自定义生成器模块中的logseries函数,返回结果类型为np.int64的NumPy数组
assert_type(def_gen.logseries(D_arr_like_0p5), npt.NDArray[np.int64])

# 调用自定义生成器模块中的logseries函数,返回结果类型为np.int64的NumPy数组
assert_type(def_gen.logseries(D_arr_like_0p5, size=1), npt.NDArray[np.int64])

# 调用自定义生成器模块中的rayleigh函数,返回结果类型为float
assert_type(def_gen.rayleigh(0.5), float)

# 调用自定义生成器模块中的rayleigh函数,返回结果类型为float
assert_type(def_gen.rayleigh(0.5, size=None), float)

# 调用自定义生成器模块中的rayleigh函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.rayleigh(0.5, size=1), npt.NDArray[np.float64])

# 调用自定义生成器模块中的rayleigh函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.rayleigh(D_arr_0p5), npt.NDArray[np.float64])

# 调用自定义生成器模块中的rayleigh函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.rayleigh(D_arr_0p5, size=1), npt.NDArray[np.float64])

# 调用自定义生成器模块中的rayleigh函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.rayleigh(D_arr_like_0p5), npt.NDArray[np.float64])

# 调用自定义生成器模块中的rayleigh函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.rayleigh(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为float
assert_type(def_gen.standard_gamma(0.5), float)

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为float
assert_type(def_gen.standard_gamma(0.5, size=None), float)

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为float32
assert_type(def_gen.standard_gamma(0.5, dtype="float32"), float)

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为float32
assert_type(def_gen.standard_gamma(0.5, size=None, dtype="float32"), float)

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.standard_gamma(0.5, size=1), npt.NDArray[np.float64])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.standard_gamma(D_arr_0p5), npt.NDArray[np.float64])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float32的NumPy数组
assert_type(def_gen.standard_gamma(D_arr_0p5, dtype="f4"), npt.NDArray[np.float32])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float32的NumPy数组
assert_type(def_gen.standard_gamma(0.5, size=1, dtype="float32", out=S_out), npt.NDArray[np.float32])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float32的NumPy数组
assert_type(def_gen.standard_gamma(D_arr_0p5, dtype=np.float32, out=S_out), npt.NDArray[np.float32])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.standard_gamma(D_arr_0p5, size=1), npt.NDArray[np.float64])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.standard_gamma(D_arr_like_0p5), npt.NDArray[np.float64])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.standard_gamma(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.standard_gamma(0.5, out=D_out), npt.NDArray[np.float64])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.standard_gamma(D_arr_like_0p5, out=D_out), npt.NDArray[np.float64])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.standard_gamma(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 调用自定义生成器模块中的standard_gamma函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.standard_gamma(D_arr_like_0p5, size=1, out=D_out, dtype=np.float64), npt.NDArray[np.float64])

# 调用自定义生成器模块中的vonmises函数,返回结果类型为float
assert_type(def_gen.vonmises(0.5, 0.5), float)

# 调用自定义生成器模块中的vonmises函数,返回结果类型为float
assert_type(def_gen.vonmises(0.5, 0.5, size=None), float)

# 调用自定义生成器模块中的vonmises函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.vonmises(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 调用自定义生成器模块中的vonmises函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.vonmises(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 调用自定义生成器模块中的vonmises函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.vonmises(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 调用自定义生成器模块中的vonmises函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.vonmises(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 调用自定义生成器模块中的vonmises函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.vonmises(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 调用自定义生成器模块中的vonmises函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.vonmises(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 调用自定义生成器模块中的vonmises函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.vonmises(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 调用自定义生成器模块中的vonmises函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.vonmises(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 调用自定义生成器模块中的vonmises函数,返回结果类型为np.float64的NumPy数组
assert_type(def_gen.vonmises(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 调用自定义生成器模块中的vonmises函数,
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 float
assert_type(def_gen.wald(0.5, 0.5, size=None), float)
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组
assert_type(def_gen.wald(0.5, 0.5, size=1), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5
assert_type(def_gen.wald(D_arr_0p5, 0.5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5
assert_type(def_gen.wald(0.5, D_arr_0p5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5,且样本大小为 1
assert_type(def_gen.wald(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5,且样本大小为 1
assert_type(def_gen.wald(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组,其中一个参数为形状类似于 D_arr_0p5 的数组
assert_type(def_gen.wald(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组,其中一个参数为形状类似于 D_arr_0p5 的数组
assert_type(def_gen.wald(0.5, D_arr_like_0p5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组,两个参数均为数组 D_arr_0p5
assert_type(def_gen.wald(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组,两个参数均为形状类似于 D_arr_0p5 的数组
assert_type(def_gen.wald(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组,两个参数均为数组 D_arr_0p5,且样本大小为 1
assert_type(def_gen.wald(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Wald 分布样本的类型是否为 numpy float64 数组,两个参数均为形状类似于 D_arr_0p5 的数组,且样本大小为 1
assert_type(def_gen.wald(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 检查使用自定义生成器生成的均匀分布样本的类型是否为 float
assert_type(def_gen.uniform(0.5, 0.5), float)
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 float
assert_type(def_gen.uniform(0.5, 0.5, size=None), float)
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5
assert_type(def_gen.uniform(0.5, 0.5, size=1), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5
assert_type(def_gen.uniform(D_arr_0p5, 0.5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5
assert_type(def_gen.uniform(0.5, D_arr_0p5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5,且样本大小为 1
assert_type(def_gen.uniform(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5,且样本大小为 1
assert_type(def_gen.uniform(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,其中一个参数为形状类似于 D_arr_0p5 的数组
assert_type(def_gen.uniform(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,其中一个参数为形状类似于 D_arr_0p5 的数组
assert_type(def_gen.uniform(0.5, D_arr_like_0p5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,两个参数均为数组 D_arr_0p5
assert_type(def_gen.uniform(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,两个参数均为形状类似于 D_arr_0p5 的数组
assert_type(def_gen.uniform(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,两个参数均为数组 D_arr_0p5,且样本大小为 1
assert_type(def_gen.uniform(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的均匀分布样本的类型是否为 numpy float64 数组,两个参数均为形状类似于 D_arr_0p5 的数组,且样本大小为 1
assert_type(def_gen.uniform(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 检查使用自定义生成器生成的 Beta 分布样本的类型是否为 float
assert_type(def_gen.beta(0.5, 0.5), float)
# 检查使用自定义生成器生成的 Beta 分布样本的类型是否为 float
assert_type(def_gen.beta(0.5, 0.5, size=None), float)
# 检查使用自定义生成器生成的 Beta 分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5
assert_type(def_gen.beta(0.5, 0.5, size=1), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Beta 分布样本的类型是否为 numpy float64 数组,其中一个参数为数组 D_arr_0p5
assert_type(def_gen.beta(D_arr_0p5, 0.5), npt.NDArray[np.float64])
# 检查使用自定义生成器生成的 Beta 分布样本的
# 使用 assert_type 函数检查 def_gen.f 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.f(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.f 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.f(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.f 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.f(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.f 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.f(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.f 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.f(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.f 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.f(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.f 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.f(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.f 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.f(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.f 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.f(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 float
assert_type(def_gen.gamma(0.5, 0.5), float)

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 float
assert_type(def_gen.gamma(0.5, 0.5, size=None), float)

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gamma 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gamma(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 float
assert_type(def_gen.gumbel(0.5, 0.5), float)

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 float
assert_type(def_gen.gumbel(0.5, 0.5, size=None), float)

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.gumbel 函数返回值的类型是否为 npt.NDArray[np.float64]
assert_type(def_gen.gumbel(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数检查 def_gen.laplace 函数返回值的类型是否为 float
assert_type(def_gen.laplace(0.5, 0.5), float)

# 使用 assert_type 函数检查 def_gen.laplace 函数返回值的类型是否为 float
assert_type
# 检查 laplace 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.laplace(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 检查 laplace 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.laplace(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 检查 laplace 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.laplace(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 检查 laplace 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.laplace(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 检查 laplace 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.laplace(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 检查 laplace 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.laplace(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 检查 laplace 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.laplace(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 float 的单元测试
assert_type(def_gen.logistic(0.5, 0.5), float)

# 检查 logistic 函数调用,验证返回结果类型为 float 的单元测试
assert_type(def_gen.logistic(0.5, 0.5, size=None), float)

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 检查 logistic 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.logistic(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 float 的单元测试
assert_type(def_gen.lognormal(0.5, 0.5), float)

# 检查 lognormal 函数调用,验证返回结果类型为 float 的单元测试
assert_type(def_gen.lognormal(0.5, 0.5, size=None), float)

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 检查 lognormal 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.lognormal(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 检查 noncentral_chisquare 函数调用,验证返回结果类型为 float 的单元测试
assert_type(def_gen.noncentral_chisquare(0.5, 0.5), float)

# 检查 noncentral_chisquare 函数调用,验证返回结果类型为 float 的单元测试
assert_type(def_gen.noncentral_chisquare(0.5, 0.5, size=None), float)

# 检查 noncentral_chisquare 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.noncentral_chisquare(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 检查 noncentral_chisquare 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.noncentral_chisquare(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 检查 noncentral_chisquare 函数调用,验证返回结果类型为 np.float64 的单元测试
assert_type(def_gen.noncentral_chisquare(0.5, D_arr_0p5), npt.NDArray[np.float64])
# 使用自定义生成器(def_gen)生成非中心卡方分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.noncentral_chisquare(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成非中心卡方分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.noncentral_chisquare(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成非中心卡方分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.noncentral_chisquare(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成非中心卡方分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.noncentral_chisquare(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成非中心卡方分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.noncentral_chisquare(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成非中心卡方分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.noncentral_chisquare(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成非中心卡方分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.noncentral_chisquare(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成非中心卡方分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.noncentral_chisquare(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 float
assert_type(def_gen.normal(0.5, 0.5), float)

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 float
assert_type(def_gen.normal(0.5, 0.5, size=None), float)

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成正态分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.normal(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 float
assert_type(def_gen.triangular(0.1, 0.5, 0.9), float)

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 float
assert_type(def_gen.triangular(0.1, 0.5, 0.9, size=None), float)

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.triangular(0.1, 0.5, 0.9, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.triangular(D_arr_0p1, 0.5, 0.9), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.triangular(0.1, D_arr_0p5, 0.9), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.triangular(D_arr_0p1, 0.5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.triangular(0.1, D_arr_0p5, 0.9, size=1), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.triangular(D_arr_like_0p1, 0.5, D_arr_0p9), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.triangular(0.5, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.triangular(D_arr_0p1, D_arr_0p5, 0.9), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.triangular(D_arr_like_0p1, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])

# 使用自定义生成器(def_gen)生成三角分布的随机变量,返回类型为 numpy.float64 数组
assert_type(def_gen.triangular(D_arr_0p1, D_arr_0p5, D_arr_0p9, size=1), npt.NDArray[np.float64])

# 使用
#`
# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, 0.5, 0.9, size=1), npt.NDArray[np.float64])

# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, 0.5, 0.9), npt.NDArray[np.float64])

# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, D_arr_0p5, 0.9), npt.NDArray[np.float64])

# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, 0.5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])

# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, D_arr_0p5, 0.9, size=1), npt.NDArray[np.float64])

# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, 0.5, D_arr_0p9), npt.NDArray[np.float64])

# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.5, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])

# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, D_arr_0p5, 0.9), npt.NDArray[np.float64])

# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])

# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, D_arr_0p5, D_arr_0p9, size=1), npt.NDArray[np.float64])

# 确保 def_gen.noncentral_f 函数返回的结果类型是 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, D_arr_like_0p5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])


# 确保 def_gen.binomial 函数返回的结果类型是 int
assert_type(def_gen.binomial(10, 0.5), int)

# 确保 def_gen.binomial 函数返回的结果类型是 int
assert_type(def_gen.binomial(10, 0.5, size=None), int)

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, 0.5, size=1), npt.NDArray[np.int64])

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, 0.5), npt.NDArray[np.int64])

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_0p5), npt.NDArray[np.int64])

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, 0.5, size=1), npt.NDArray[np.int64])

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_0p5, size=1), npt.NDArray[np.int64])

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_like_10, 0.5), npt.NDArray[np.int64])

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_like_0p5), npt.NDArray[np.int64])

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, D_arr_0p5), npt.NDArray[np.int64])

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_like_10, D_arr_like_0p5), npt.NDArray[np.int64])

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, D_arr_0p5, size=1), npt.NDArray[np.int64])

# 确保 def_gen.binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_like_10, D_arr_like_0p5, size=1), npt.NDArray[np.int64])


# 确保 def_gen.negative_binomial 函数返回的结果类型是 int
assert_type(def_gen.negative_binomial(10, 0.5), int)

# 确保 def_gen.negative_binomial 函数返回的结果类型是 int
assert_type(def_gen.negative_binomial(10, 0.5, size=None), int)

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(10, 0.5, size=1), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_10, 0.5), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(10, D_arr_0p5), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_10, 0.5, size=1), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(10, D_arr_0p5, size=1), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_like_10, 0.5), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(10, D_arr_like_0p5), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_10, D_arr_0p5), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_like_10, D_arr_like_0p5), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_10, D_arr_0p5, size=1), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 函数返回的结果类型是 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_like_10, D_arr_like_0p5, size=1), npt.NDArray```python
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, 0.5, 0.9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, 0.5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, D_arr_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, 0.5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, D_arr_0p5, 0.9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, 0.5, D_arr_0p9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.5, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, D_arr_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, D_arr_0p5, D_arr_0p9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, D_arr_like_0p5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])

# 确保 def_gen.binomial 返回的结果类型为 int
assert_type(def_gen.binomial(10, 0.5), int)
# 确保 def_gen.binomial 返回的结果类型为 int
assert_type(def_gen.binomial(10, 0.5, size=None), int)
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, 0.5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, 0.5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, 0.5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_0p5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_like_10, 0.5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_like_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, D_arr_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_like_10, D_arr_like_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, D_arr_0p5, size=1), n```py
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, 0.5, 0.9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, 0.5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, D_arr_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, 0.5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, D_arr_0p5, 0.9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, 0.5, D_arr_0p9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.5, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, D_arr_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, D_arr_0p5, D_arr_0p9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, D_arr_like_0p5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])

# 确保 def_gen.binomial 返回的结果类型为 int
assert_type(def_gen.binomial(10, 0.5), int)
# 确保 def_gen.binomial 返回的结果类型为 int
assert_type(def_gen.binomial(10, 0.5, size=None), int)
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, 0.5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, 0.5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, 0.5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_0p5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_like_10, 0.5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_like_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, D_arr_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_like_10, D_arr_like_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, D_arr_0p5, size=1), npt```python
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, 0.5, 0.9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, 0.5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, D_arr_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, 0.5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.1, D_arr_0p5, 0.9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, 0.5, D_arr_0p9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(0.5, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, D_arr_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_0p1, D_arr_0p5, D_arr_0p9, size=1), npt.NDArray[np.float64])
# 确保 def_gen.noncentral_f 返回的结果类型为 npt.NDArray[np.float64]
assert_type(def_gen.noncentral_f(D_arr_like_0p1, D_arr_like_0p5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])

# 确保 def_gen.binomial 返回的结果类型为 int
assert_type(def_gen.binomial(10, 0.5), int)
# 确保 def_gen.binomial 返回的结果类型为 int
assert_type(def_gen.binomial(10, 0.5, size=None), int)
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, 0.5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, 0.5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, 0.5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_0p5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_like_10, 0.5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(10, D_arr_like_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, D_arr_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_like_10, D_arr_like_0p5), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_10, D_arr_0p5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.binomial(I_arr_like_10, D_arr_like_0p5, size=1), npt.NDArray[np.int64])

# 确保 def_gen.negative_binomial 返回的结果类型为 int
assert_type(def_gen.negative_binomial(10, 0.5), int)
# 确保 def_gen.negative_binomial 返回的结果类型为 int
assert_type(def_gen.negative_binomial(10, 0.5, size=None), int)
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(10, 0.5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_10, 0.5), npt.NDArray[np.int64])
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(10, D_arr_0p5), npt.NDArray[np.int64])
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_10, 0.5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(10, D_arr_0p5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_like_10, 0.5), npt.NDArray[np.int64])
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(10, D_arr_like_0p5), npt.NDArray[np.int64])
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_10, D_arr_0p5), npt.NDArray[np.int64])
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_like_10, D_arr_like_0p5), npt.NDArray[np.int64])
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_10, D_arr_0p5, size=1), npt.NDArray[np.int64])
# 确保 def_gen.negative_binomial 返回的结果类型为 npt.NDArray[np.int64]
assert_type(def_gen.negative_binomial(I_arr_like_10, D_arr_like_0p5, size=1), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 int
assert_type(def_gen.hypergeometric(20, 20, 10), int)
# 确保函数 def_gen.hypergeometric 的返回类型为 int
assert_type(def_gen.hypergeometric(20, 20, 10, size=None), int)
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(20, 20, 10, size=1), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(I_arr_20, 20, 10), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(20, I_arr_20, 10), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(I_arr_20, 20, I_arr_like_10, size=1), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(20, I_arr_20, 10, size=1), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(I_arr_like_20, 20, I_arr_10), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(20, I_arr_like_20, 10), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(I_arr_20, I_arr_20, 10), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(I_arr_like_20, I_arr_like_20, 10), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(I_arr_20, I_arr_20, I_arr_10, size=1), npt.NDArray[np.int64])
# 确保函数 def_gen.hypergeometric 的返回类型为 numpy int64 数组
assert_type(def_gen.hypergeometric(I_arr_like_20, I_arr_like_20, I_arr_like_10, size=1), npt.NDArray[np.int64])

# 定义一个包含单个整数 100 的 numpy int64 数组
I_int64_100: npt.NDArray[np.int64] = np.array([100], dtype=np.int64)

# 确保函数 def_gen.integers 的返回类型为 int
assert_type(def_gen.integers(0, 100), int)
# 确保函数 def_gen.integers 的返回类型为 int
assert_type(def_gen.integers(100), int)
# 确保函数 def_gen.integers 的返回类型为 numpy int64 数组
assert_type(def_gen.integers([100]), npt.NDArray[np.int64])
# 确保函数 def_gen.integers 的返回类型为 numpy int64 数组
assert_type(def_gen.integers(0, [100]), npt.NDArray[np.int64])

# 定义一个包含单个布尔值 False 的 numpy bool 数组
I_bool_low: npt.NDArray[np.bool] = np.array([0], dtype=np.bool)
# 定义一个包含单个整数 0 的列表
I_bool_low_like: list[int] = [0]
# 定义一个包含单个布尔值 True 的 numpy bool 数组
I_bool_high_open: npt.NDArray[np.bool] = np.array([1], dtype=np.bool)
# 定义一个包含单个布尔值 True 的 numpy bool 数组
I_bool_high_closed: npt.NDArray[np.bool] = np.array([1], dtype=np.bool)

# 确保函数 def_gen.integers 的返回类型为 bool
assert_type(def_gen.integers(2, dtype=bool), bool)
# 确保函数 def_gen.integers 的返回类型为 bool
assert_type(def_gen.integers(0, 2, dtype=bool), bool)
# 确保函数 def_gen.integers 的返回类型为 bool
assert_type(def_gen.integers(1, dtype=bool, endpoint=True), bool)
# 确保函数 def_gen.integers 的返回类型为 bool
assert_type(def_gen.integers(0, 1, dtype=bool, endpoint=True), bool)
# 确保函数 def_gen.integers 的返回类型为 numpy bool 数组
assert_type(def_gen.integers(I_bool_low_like, 1, dtype=bool, endpoint=True), npt.NDArray[np.bool])
# 确保函数 def_gen.integers 的返回类型为 numpy bool 数组
assert_type(def_gen.integers(I_bool_high_open, dtype=bool), npt.NDArray[np.bool])
# 确保函数 def_gen.integers 的返回类型为 numpy bool 数组
assert_type(def_gen.integers(I_bool_low, I_bool_high_open, dtype=bool), npt.NDArray[np.bool])
# 确保函数 def_gen.integers 的返回类型为 numpy bool 数组
assert_type(def_gen.integers(0, I_bool_high_open, dtype=bool), npt.NDArray[np.bool])
# 确保函数 def_gen.integers 的返回类型为 numpy bool 数组
assert_type(def_gen.integers(I_bool_high_closed, dtype=bool, endpoint=True), npt.NDArray[np.bool])
# 确保函数 def_gen.integers 的返回类型为 numpy bool 数组
assert_type(def_gen.integers(I_bool_low, I_bool_high_closed, dtype=bool, endpoint=True), npt.NDArray[np.bool])
# 确保函数 def_gen.integers 的返回类型为 numpy bool 数组
assert_type(def_gen.integers(0, I_bool_high_closed, dtype=bool, endpoint=True), npt.NDArray[np.bool])

# 确保函数 def_gen.integers 的返回类型为 numpy bool
assert_type(def_gen.integers(2, dtype=np.bool), np.bool)
# 确保函数 def_gen.integers 的返回类型为 numpy bool
assert_type(def_gen.integers(0, 2, dtype=np.bool), np.bool)
# 确保函数 def_gen.integers 的返回类型为 numpy bool
assert_type(def_gen.integers(1, dtype=np.bool, endpoint=True), np.bool)
# 确保函数 def_gen.integers 的返回类型为 numpy bool
assert_type(def_gen.integers(0, 1, dtype=np.bool, endpoint=True), np.bool)
# 确保函数 def_gen.integers 的返回类型为 numpy bool 数组
assert_type(def_gen.integers(I_bool_low_like, 1, dtype=np.bool, endpoint=True), npt.NDArray[np.bool])
# 确保函数 def_gen.integers 的返回类型为 numpy bool 数组
assert_type(def_gen.integers(I_bool_high_open, dtype=np.bool), npt.NDArray[np.bool])
# 断言:生成一个布尔类型的随机整数,范围是[I_bool_low, I_bool_high_open),返回结果的类型应为np.bool
assert_type(def_gen.integers(I_bool_low, I_bool_high_open, dtype=np.bool), npt.NDArray[np.bool])

# 断言:生成一个布尔类型的随机整数,范围是[0, I_bool_high_open),返回结果的类型应为np.bool
assert_type(def_gen.integers(0, I_bool_high_open, dtype=np.bool), npt.NDArray[np.bool])

# 断言:生成一个布尔类型的随机整数,范围是[I_bool_high_closed, ∞),返回结果的类型应为np.bool
assert_type(def_gen.integers(I_bool_high_closed, dtype=np.bool, endpoint=True), npt.NDArray[np.bool])

# 断言:生成一个布尔类型的随机整数,范围是[I_bool_low, I_bool_high_closed],返回结果的类型应为np.bool
assert_type(def_gen.integers(I_bool_low, I_bool_high_closed, dtype=np.bool, endpoint=True), npt.NDArray[np.bool])

# 断言:生成一个布尔类型的随机整数,范围是[0, I_bool_high_closed],返回结果的类型应为np.bool
assert_type(def_gen.integers(0, I_bool_high_closed, dtype=np.bool, endpoint=True), npt.NDArray[np.bool])

# 定义一个uint8类型的数组,其值为[0]
I_u1_low: npt.NDArray[np.uint8] = np.array([0], dtype=np.uint8)

# 定义一个int类型的列表,其值为[0]
I_u1_low_like: list[int] = [0]

# 定义一个uint8类型的数组,其值为[255]
I_u1_high_open: npt.NDArray[np.uint8] = np.array([255], dtype=np.uint8)

# 定义一个uint8类型的数组,其值为[255]
I_u1_high_closed: npt.NDArray[np.uint8] = np.array([255], dtype=np.uint8)

# 断言:生成一个uint8类型的随机整数,范围是[256, ∞),返回结果的类型应为np.uint8
assert_type(def_gen.integers(256, dtype="u1"), np.uint8)

# 断言:生成一个uint8类型的随机整数,范围是[0, 256),返回结果的类型应为np.uint8
assert_type(def_gen.integers(0, 256, dtype="u1"), np.uint8)

# 断言:生成一个uint8类型的随机整数,范围是[0, 255],返回结果的类型应为np.uint8
assert_type(def_gen.integers(255, dtype="u1", endpoint=True), np.uint8)

# 断言:生成一个uint8类型的随机整数,范围是[0, 255],返回结果的类型应为np.uint8
assert_type(def_gen.integers(0, 255, dtype="u1", endpoint=True), np.uint8)

# 断言:生成一个uint8类型的随机整数,范围是[I_u1_low_like, 255],返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(I_u1_low_like, 255, dtype="u1", endpoint=True), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[I_u1_high_open, ∞),返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(I_u1_high_open, dtype="u1"), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[I_u1_low, I_u1_high_open),返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(I_u1_low, I_u1_high_open, dtype="u1"), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[0, I_u1_high_open),返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(0, I_u1_high_open, dtype="u1"), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[I_u1_high_closed, ∞),返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(I_u1_high_closed, dtype="u1", endpoint=True), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[I_u1_low, I_u1_high_closed],返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(I_u1_low, I_u1_high_closed, dtype="u1", endpoint=True), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[0, I_u1_high_closed],返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(0, I_u1_high_closed, dtype="u1", endpoint=True), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[256, ∞),返回结果的类型应为np.uint8
assert_type(def_gen.integers(256, dtype="uint8"), np.uint8)

# 断言:生成一个uint8类型的随机整数,范围是[0, 256),返回结果的类型应为np.uint8
assert_type(def_gen.integers(0, 256, dtype="uint8"), np.uint8)

# 断言:生成一个uint8类型的随机整数,范围是[0, 255],返回结果的类型应为np.uint8
assert_type(def_gen.integers(255, dtype="uint8", endpoint=True), np.uint8)

# 断言:生成一个uint8类型的随机整数,范围是[0, 255],返回结果的类型应为np.uint8
assert_type(def_gen.integers(0, 255, dtype="uint8", endpoint=True), np.uint8)

# 断言:生成一个uint8类型的随机整数,范围是[I_u1_low_like, 255],返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(I_u1_low_like, 255, dtype="uint8", endpoint=True), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[I_u1_high_open, ∞),返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(I_u1_high_open, dtype="uint8"), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[I_u1_low, I_u1_high_open),返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(I_u1_low, I_u1_high_open, dtype="uint8"), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[0, I_u1_high_open),返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(0, I_u1_high_open, dtype="uint8"), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[I_u1_high_closed, ∞),返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(I_u1_high_closed, dtype="uint8", endpoint=True), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[I_u1_low, I_u1_high_closed],返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(I_u1_low, I_u1_high_closed, dtype="uint8", endpoint=True), npt.NDArray[np.uint8])

# 断言:生成一个uint8类型的随机整数,范围是[0, I_u1_high_closed],返回结果的类型应为npt.NDArray[np.uint8]
assert_type(def_gen.integers(0, I_u1_high_closed, dtype="uint8", endpoint=True
# 使用 def_gen.integers 函数生成一个 uint8 类型的随机整数数组,范围是从 I_u1_low_like 到 255,包含 255,生成的结果应为 np.uint8 类型的数组
assert_type(def_gen.integers(I_u1_low_like, 255, dtype=np.uint8, endpoint=True), npt.NDArray[np.uint8])

# 使用 def_gen.integers 函数生成一个 uint8 类型的随机整数数组,范围是从 I_u1_high_open 到 255,不包含 255,生成的结果应为 np.uint8 类型的数组
assert_type(def_gen.integers(I_u1_high_open, dtype=np.uint8), npt.NDArray[np.uint8])

# 使用 def_gen.integers 函数生成一个 uint8 类型的随机整数数组,范围是从 I_u1_low 到 I_u1_high_open,不包含 I_u1_high_open,生成的结果应为 np.uint8 类型的数组
assert_type(def_gen.integers(I_u1_low, I_u1_high_open, dtype=np.uint8), npt.NDArray[np.uint8])

# 使用 def_gen.integers 函数生成一个 uint8 类型的随机整数数组,范围是从 0 到 I_u1_high_open,不包含 I_u1_high_open,生成的结果应为 np.uint8 类型的数组
assert_type(def_gen.integers(0, I_u1_high_open, dtype=np.uint8), npt.NDArray[np.uint8])

# 使用 def_gen.integers 函数生成一个 uint8 类型的随机整数数组,范围是从 I_u1_high_closed 到 255,包含 255,生成的结果应为 np.uint8 类型的数组
assert_type(def_gen.integers(I_u1_high_closed, dtype=np.uint8, endpoint=True), npt.NDArray[np.uint8])

# 使用 def_gen.integers 函数生成一个 uint8 类型的随机整数数组,范围是从 I_u1_low 到 I_u1_high_closed,包含 I_u1_high_closed,生成的结果应为 np.uint8 类型的数组
assert_type(def_gen.integers(I_u1_low, I_u1_high_closed, dtype=np.uint8, endpoint=True), npt.NDArray[np.uint8])

# 使用 def_gen.integers 函数生成一个 uint8 类型的随机整数数组,范围是从 0 到 I_u1_high_closed,包含 I_u1_high_closed,生成的结果应为 np.uint8 类型的数组
assert_type(def_gen.integers(0, I_u1_high_closed, dtype=np.uint8, endpoint=True), npt.NDArray[np.uint8])

# 定义一个名为 I_u2_low 的变量,类型为 np.uint16,其值为 [0] 的数组
I_u2_low: npt.NDArray[np.uint16] = np.array([0], dtype=np.uint16)

# 定义一个名为 I_u2_low_like 的变量,类型为 list[int],其值为 [0] 的列表
I_u2_low_like: list[int] = [0]

# 定义一个名为 I_u2_high_open 的变量,类型为 np.uint16,其值为 [65535] 的数组
I_u2_high_open: npt.NDArray[np.uint16] = np.array([65535], dtype=np.uint16)

# 定义一个名为 I_u2_high_closed 的变量,类型为 np.uint16,其值为 [65535] 的数组
I_u2_high_closed: npt.NDArray[np.uint16] = np.array([65535], dtype=np.uint16)

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数,范围是从 65536 到 65536,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(65536, dtype="u2"), np.uint16)

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数,范围是从 0 到 65536,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(0, 65536, dtype="u2"), np.uint16)

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数,范围是从 65535 到 65535,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(65535, dtype="u2", endpoint=True), np.uint16)

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数,范围是从 0 到 65535,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(0, 65535, dtype="u2", endpoint=True), np.uint16)

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数数组,范围是从 I_u2_low_like 到 65535,包含 65535,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(I_u2_low_like, 65535, dtype="u2", endpoint=True), npt.NDArray[np.uint16])

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数数组,范围是从 I_u2_high_open 到 65535,不包含 65535,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(I_u2_high_open, dtype="u2"), npt.NDArray[np.uint16])

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数数组,范围是从 I_u2_low 到 I_u2_high_open,不包含 I_u2_high_open,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(I_u2_low, I_u2_high_open, dtype="u2"), npt.NDArray[np.uint16])

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数数组,范围是从 0 到 I_u2_high_open,不包含 I_u2_high_open,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(0, I_u2_high_open, dtype="u2"), npt.NDArray[np.uint16])

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数数组,范围是从 I_u2_high_closed 到 65535,包含 65535,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(I_u2_high_closed, dtype="u2", endpoint=True), npt.NDArray[np.uint16])

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数数组,范围是从 I_u2_low 到 I_u2_high_closed,包含 I_u2_high_closed,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(I_u2_low, I_u2_high_closed, dtype="u2", endpoint=True), npt.NDArray[np.uint16])

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数数组,范围是从 0 到 I_u2_high_closed,包含 I_u2_high_closed,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(0, I_u2_high_closed, dtype="u2", endpoint=True), npt.NDArray[np.uint16])

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数,范围是从 65536 到 65536,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(65536, dtype="uint16"), np.uint16)

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数,范围是从 0 到 65536,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(0, 65536, dtype="uint16"), np.uint16)

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数,范围是从 65535 到 65535,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(65535, dtype="uint16", endpoint=True), np.uint16)

# 使用 def_gen.integers 函数生成一个 uint16 类型的随机整数,范围是从 0 到 65535,生成的结果应为 np.uint16 类型的数组
assert_type(def_gen.integers(0, 65535, dtype="uint16", endpoint=True), np.uint16)

# 使用 def_gen.integers 函数
# 确保生成的整数符合指定的数据类型 np.uint16
assert_type(def_gen.integers(0, 65536, dtype=np.uint16), np.uint16)

# 确保生成的整数符合指定的数据类型 np.uint16,包括终点值 65535
assert_type(def_gen.integers(65535, dtype=np.uint16, endpoint=True), np.uint16)

# 确保生成的整数符合指定的数据类型 np.uint16,包括起始和终点值 0 和 65535
assert_type(def_gen.integers(0, 65535, dtype=np.uint16, endpoint=True), np.uint16)

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.uint16],起始值为 I_u2_low_like,终点值为 65535
assert_type(def_gen.integers(I_u2_low_like, 65535, dtype=np.uint16, endpoint=True), npt.NDArray[np.uint16])

# 确保生成的整数符合指定的数据类型 np.uint16,起始值为 I_u2_high_open
assert_type(def_gen.integers(I_u2_high_open, dtype=np.uint16), npt.NDArray[np.uint16])

# 确保生成的整数符合指定的数据类型 np.uint16,起始值为 I_u2_low,终点值为 I_u2_high_open
assert_type(def_gen.integers(I_u2_low, I_u2_high_open, dtype=np.uint16), npt.NDArray[np.uint16])

# 确保生成的整数符合指定的数据类型 np.uint16,起始值为 0,终点值为 I_u2_high_open
assert_type(def_gen.integers(0, I_u2_high_open, dtype=np.uint16), npt.NDArray[np.uint16])

# 确保生成的整数符合指定的数据类型 np.uint16,起始值为 I_u2_high_closed,包括终点值
assert_type(def_gen.integers(I_u2_high_closed, dtype=np.uint16, endpoint=True), npt.NDArray[np.uint16])

# 确保生成的整数符合指定的数据类型 np.uint16,起始值为 I_u2_low,终点值为 I_u2_high_closed,包括终点值
assert_type(def_gen.integers(I_u2_low, I_u2_high_closed, dtype=np.uint16, endpoint=True), npt.NDArray[np.uint16])

# 确保生成的整数符合指定的数据类型 np.uint16,起始值为 0,终点值为 I_u2_high_closed,包括终点值
assert_type(def_gen.integers(0, I_u2_high_closed, dtype=np.uint16, endpoint=True), npt.NDArray[np.uint16])

# 定义起始值为 0 的 np.uint32 类型的数组
I_u4_low: npt.NDArray[np.uint32] = np.array([0], dtype=np.uint32)

# 定义起始值为 0 的 int 类型的列表
I_u4_low_like: list[int] = [0]

# 定义起始值为 4294967295 的 np.uint32 类型的数组
I_u4_high_open: npt.NDArray[np.uint32] = np.array([4294967295], dtype=np.uint32)

# 定义起始值为 4294967295 的 np.uint32 类型的数组
I_u4_high_closed: npt.NDArray[np.uint32] = np.array([4294967295], dtype=np.uint32)

# 确保生成的整数符合指定的数据类型 np.int_,起始值为 4294967296
assert_type(def_gen.integers(4294967296, dtype=np.int_), np.int_)

# 确保生成的整数符合指定的数据类型 np.int_,起始值为 0,终点值为 4294967296
assert_type(def_gen.integers(0, 4294967296, dtype=np.int_), np.int_)

# 确保生成的整数符合指定的数据类型 np.int_,起始值为 4294967295,包括终点值
assert_type(def_gen.integers(4294967295, dtype=np.int_, endpoint=True), np.int_)

# 确保生成的整数符合指定的数据类型 np.int_,起始值为 0,终点值为 4294967295,包括终点值
assert_type(def_gen.integers(0, 4294967295, dtype=np.int_, endpoint=True), np.int_)

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.int_],起始值为 I_u4_low_like,终点值为 4294967295,包括终点值
assert_type(def_gen.integers(I_u4_low_like, 4294967295, dtype=np.int_, endpoint=True), npt.NDArray[np.int_])

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.int_],起始值为 I_u4_high_open
assert_type(def_gen.integers(I_u4_high_open, dtype=np.int_), npt.NDArray[np.int_])

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.int_],起始值为 I_u4_low,终点值为 I_u4_high_open
assert_type(def_gen.integers(I_u4_low, I_u4_high_open, dtype=np.int_), npt.NDArray[np.int_])

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.int_],起始值为 0,终点值为 I_u4_high_open
assert_type(def_gen.integers(0, I_u4_high_open, dtype=np.int_), npt.NDArray[np.int_])

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.int_],起始值为 I_u4_high_closed,包括终点值
assert_type(def_gen.integers(I_u4_high_closed, dtype=np.int_, endpoint=True), npt.NDArray[np.int_])

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.int_],起始值为 I_u4_low,终点值为 I_u4_high_closed,包括终点值
assert_type(def_gen.integers(I_u4_low, I_u4_high_closed, dtype=np.int_, endpoint=True), npt.NDArray[np.int_])

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.int_],起始值为 0,终点值为 I_u4_high_closed,包括终点值
assert_type(def_gen.integers(0, I_u4_high_closed, dtype=np.int_, endpoint=True), npt.NDArray[np.int_])

# 确保生成的整数符合指定的数据类型 np.uint32,起始值为 4294967296
assert_type(def_gen.integers(4294967296, dtype="u4"), np.uint32)

# 确保生成的整数符合指定的数据类型 np.uint32,起始值为 0,终点值为 4294967296
assert_type(def_gen.integers(0, 4294967296, dtype="u4"), np.uint32)

# 确保生成的整数符合指定的数据类型 np.uint32,起始值为 4294967295,包括终点值
assert_type(def_gen.integers(4294967295, dtype="u4", endpoint=True), np.uint32)

# 确保生成的整数符合指定的数据类型 np.uint32,起始值为 0,终点值为 4294967295,包括终点值
assert_type(def_gen.integers(0, 4294967295, dtype="u4", endpoint=True), np.uint32)

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.uint32],起始值为 I_u4_low_like,终点值为 4294967295,包括终点值
assert_type(def_gen.integers(I_u4_low_like, 4294967295, dtype="u4", endpoint=True), npt.NDArray[np.uint32])

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.uint32],起始值为 I_u4_high_open
assert_type(def_gen.integers(I_u4_high_open, dtype="u4"), npt.NDArray[np.uint32])

# 确保生成的整数符合指定的数据类型 npt.NDArray[np.uint32],起始值为 I_u4_low,
# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组
assert_type(def_gen.integers(I_u4_low, I_u4_high_closed, dtype="u4", endpoint=True), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组
assert_type(def_gen.integers(0, I_u4_high_closed, dtype="u4", endpoint=True), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32
assert_type(def_gen.integers(4294967296, dtype="uint32"), np.uint32)

# 确保生成的随机整数数组的元素类型为 np.uint32
assert_type(def_gen.integers(0, 4294967296, dtype="uint32"), np.uint32)

# 确保生成的随机整数数组的元素类型为 np.uint32,并且包含终点值
assert_type(def_gen.integers(4294967295, dtype="uint32", endpoint=True), np.uint32)

# 确保生成的随机整数数组的元素类型为 np.uint32,并且包含起点和终点值
assert_type(def_gen.integers(0, 4294967295, dtype="uint32", endpoint=True), np.uint32)

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组,并且包含起点和终点值
assert_type(def_gen.integers(I_u4_low_like, 4294967295, dtype="uint32", endpoint=True), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组
assert_type(def_gen.integers(I_u4_high_open, dtype="uint32"), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组
assert_type(def_gen.integers(I_u4_low, I_u4_high_open, dtype="uint32"), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组
assert_type(def_gen.integers(0, I_u4_high_open, dtype="uint32"), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32,并且包含终点值
assert_type(def_gen.integers(I_u4_high_closed, dtype="uint32", endpoint=True), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组,并且包含起点和终点值
assert_type(def_gen.integers(I_u4_low, I_u4_high_closed, dtype="uint32", endpoint=True), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组,并且包含起点和终点值
assert_type(def_gen.integers(0, I_u4_high_closed, dtype="uint32", endpoint=True), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32
assert_type(def_gen.integers(4294967296, dtype=np.uint32), np.uint32)

# 确保生成的随机整数数组的元素类型为 np.uint32
assert_type(def_gen.integers(0, 4294967296, dtype=np.uint32), np.uint32)

# 确保生成的随机整数数组的元素类型为 np.uint32,并且包含终点值
assert_type(def_gen.integers(4294967295, dtype=np.uint32, endpoint=True), np.uint32)

# 确保生成的随机整数数组的元素类型为 np.uint32,并且包含起点和终点值
assert_type(def_gen.integers(0, 4294967295, dtype=np.uint32, endpoint=True), np.uint32)

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组,并且包含起点和终点值
assert_type(def_gen.integers(I_u4_low_like, 4294967295, dtype=np.uint32, endpoint=True), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组
assert_type(def_gen.integers(I_u4_high_open, dtype=np.uint32), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组
assert_type(def_gen.integers(I_u4_low, I_u4_high_open, dtype=np.uint32), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组
assert_type(def_gen.integers(0, I_u4_high_open, dtype=np.uint32), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32,并且包含终点值
assert_type(def_gen.integers(I_u4_high_closed, dtype=np.uint32, endpoint=True), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组,并且包含起点和终点值
assert_type(def_gen.integers(I_u4_low, I_u4_high_closed, dtype=np.uint32, endpoint=True), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint32 的 numpy 数组,并且包含起点和终点值
assert_type(def_gen.integers(0, I_u4_high_closed, dtype=np.uint32, endpoint=True), npt.NDArray[np.uint32])

# 确保生成的随机整数数组的元素类型为 np.uint 的 numpy 数组
assert_type(def_gen.integers(4294967296, dtype=np.uint), np.uint)

# 确保生成的随机整数数组的元素类型为 np.uint 的 numpy 数组
assert_type(def_gen.integers(0, 4294967296, dtype=np.uint), np.uint)

# 确保生成的随机整数数组的元素类型为 np.uint,并且包含终点值
assert_type(def_gen.integers(4294967295, dtype=np.uint, endpoint=True), np.uint)

# 确保生成的随机整数数组的元素类型为 np.uint,并且包含起点和终点值
assert_type(def_gen.integers(0, 4294967295, dtype=np.uint, endpoint=True), np.uint)

# 确保生成的随机整数数组的元素类型为 np.uint 的 numpy 数组,并且包含起点和终点值
assert_type(def_gen.integers(I_u4_low_like, 4294967295, dtype=np.uint, endpoint=True), npt.NDArray[np.uint])

# 确保生成的随机整数数组的元素类型为 np.uint 的 numpy 数组
assert_type(def_gen.integers(I_u4_high_open, dtype=np.uint), npt.NDArray[np.uint])

# 确保生成的随机整数数组的元素类型为 np.uint 的 numpy 数组
assert_type(def_gen.integers(I_u4_low, I_u4_high_open, dtype=np.uint), npt.NDArray[np.uint])

# 确保生成的随机整数数组的元素类型为 np.uint 的 numpy 数组
assert_type(def_gen.integers(0, I_u4_high_open, dtype=np.uint), npt.NDArray[np.uint])
# 确保生成的随机整数数组的类型为 np.uint,并且上限为 I_u4_high_closed,包含该上限值
assert_type(def_gen.integers(I_u4_high_closed, dtype=np.uint, endpoint=True), npt.NDArray[np.uint])

# 确保生成的随机整数数组的类型为 np.uint,并且上限在 I_u4_low 和 I_u4_high_closed 之间,包含上限值
assert_type(def_gen.integers(I_u4_low, I_u4_high_closed, dtype=np.uint, endpoint=True), npt.NDArray[np.uint])

# 确保生成的随机整数数组的类型为 np.uint,并且上限为 I_u4_high_closed,包含该上限值
assert_type(def_gen.integers(0, I_u4_high_closed, dtype=np.uint, endpoint=True), npt.NDArray[np.uint])

# 创建一个包含单个元素 0 的 np.uint64 数组
I_u8_low: npt.NDArray[np.uint64] = np.array([0], dtype=np.uint64)

# 创建一个包含单个元素 0 的 int 列表
I_u8_low_like: list[int] = [0]

# 创建一个包含单个元素 18446744073709551615 的 np.uint64 数组
I_u8_high_open: npt.NDArray[np.uint64] = np.array([18446744073709551615], dtype=np.uint64)

# 创建一个包含单个元素 18446744073709551615 的 np.uint64 数组
I_u8_high_closed: npt.NDArray[np.uint64] = np.array([18446744073709551615], dtype=np.uint64)

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 18446744073709551616
assert_type(def_gen.integers(18446744073709551616, dtype="u8"), np.uint64)

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 0 和 18446744073709551616 之间,包含上限值
assert_type(def_gen.integers(0, 18446744073709551616, dtype="u8"), np.uint64)

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 18446744073709551615,包含该上限值
assert_type(def_gen.integers(18446744073709551615, dtype="u8", endpoint=True), np.uint64)

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 0 和 18446744073709551615 之间,包含上限值
assert_type(def_gen.integers(0, 18446744073709551615, dtype="u8", endpoint=True), np.uint64)

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 18446744073709551615,包含该上限值
assert_type(def_gen.integers(I_u8_low_like, 18446744073709551615, dtype="u8", endpoint=True), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 I_u8_high_open 的元素值
assert_type(def_gen.integers(I_u8_high_open, dtype="u8"), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 I_u8_low 和 I_u8_high_open 之间,不包含上限值
assert_type(def_gen.integers(I_u8_low, I_u8_high_open, dtype="u8"), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 0 和 I_u8_high_open 之间,不包含上限值
assert_type(def_gen.integers(0, I_u8_high_open, dtype="u8"), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 I_u8_high_closed 的元素值,包含该上限值
assert_type(def_gen.integers(I_u8_high_closed, dtype="u8", endpoint=True), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 I_u8_low 和 I_u8_high_closed 之间,包含上限值
assert_type(def_gen.integers(I_u8_low, I_u8_high_closed, dtype="u8", endpoint=True), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 0 和 I_u8_high_closed 之间,包含上限值
assert_type(def_gen.integers(0, I_u8_high_closed, dtype="u8", endpoint=True), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 18446744073709551616
assert_type(def_gen.integers(18446744073709551616, dtype="uint64"), np.uint64)

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 0 和 18446744073709551616 之间,包含上限值
assert_type(def_gen.integers(0, 18446744073709551616, dtype="uint64"), np.uint64)

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 18446744073709551615,包含该上限值
assert_type(def_gen.integers(18446744073709551615, dtype="uint64", endpoint=True), np.uint64)

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 0 和 18446744073709551615 之间,包含上限值
assert_type(def_gen.integers(0, 18446744073709551615, dtype="uint64", endpoint=True), np.uint64)

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 I_u8_low_like 和 18446744073709551615 之间,包含上限值
assert_type(def_gen.integers(I_u8_low_like, 18446744073709551615, dtype="uint64", endpoint=True), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 I_u8_high_open 的元素值
assert_type(def_gen.integers(I_u8_high_open, dtype="uint64"), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 I_u8_low 和 I_u8_high_open 之间,不包含上限值
assert_type(def_gen.integers(I_u8_low, I_u8_high_open, dtype="uint64"), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 0 和 I_u8_high_open 之间,不包含上限值
assert_type(def_gen.integers(0, I_u8_high_open, dtype="uint64"), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 I_u8_high_closed 的元素值,包含该上限值
assert_type(def_gen.integers(I_u8_high_closed, dtype="uint64", endpoint=True), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 I_u8_low 和 I_u8_high_closed 之间,包含上限值
assert_type(def_gen.integers(I_u8_low, I_u8_high_closed, dtype="uint64", endpoint=True), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限在 0 和 I_u8_high_closed 之间,包含上限值
assert_type(def_gen.integers(0, I_u8_high_closed, dtype="uint64", endpoint=True), npt.NDArray[np.uint64])

# 确保生成的随机整数数组的类型为 np.uint64,并且上限为 18446744073709551616
assert_type(def_gen.integers(18446744073709551616, dtype=np.uint64), np.uint64)

# 确保生成的
assert_type(def_gen.integers(0, 18446744073709551615, dtype=np.uint64, endpoint=True), np.uint64)
# 检查从0到18446744073709551615范围内的无符号64位整数生成器类型是否为np.uint64

assert_type(def_gen.integers(I_u8_low_like, 18446744073709551615, dtype=np.uint64, endpoint=True), npt.NDArray[np.uint64])
# 检查从I_u8_low_like到18446744073709551615范围内的无符号64位整数生成器类型是否为npt.NDArray[np.uint64]

assert_type(def_gen.integers(I_u8_high_open, dtype=np.uint64), npt.NDArray[np.uint64])
# 检查从0到I_u8_high_open范围内的无符号64位整数生成器类型是否为npt.NDArray[np.uint64]

assert_type(def_gen.integers(I_u8_low, I_u8_high_open, dtype=np.uint64), npt.NDArray[np.uint64])
# 检查从I_u8_low到I_u8_high_open范围内的无符号64位整数生成器类型是否为npt.NDArray[np.uint64]

assert_type(def_gen.integers(0, I_u8_high_open, dtype=np.uint64), npt.NDArray[np.uint64])
# 检查从0到I_u8_high_open范围内的无符号64位整数生成器类型是否为npt.NDArray[np.uint64]

assert_type(def_gen.integers(I_u8_high_closed, dtype=np.uint64, endpoint=True), npt.NDArray[np.uint64])
# 检查从0到I_u8_high_closed范围内的无符号64位整数生成器类型是否为npt.NDArray[np.uint64]

assert_type(def_gen.integers(I_u8_low, I_u8_high_closed, dtype=np.uint64, endpoint=True), npt.NDArray[np.uint64])
# 检查从I_u8_low到I_u8_high_closed范围内的无符号64位整数生成器类型是否为npt.NDArray[np.uint64]

assert_type(def_gen.integers(0, I_u8_high_closed, dtype=np.uint64, endpoint=True), npt.NDArray[np.uint64])
# 检查从0到I_u8_high_closed范围内的无符号64位整数生成器类型是否为npt.NDArray[np.uint64]


I_i1_low: npt.NDArray[np.int8] = np.array([-128], dtype=np.int8)
# 创建一个包含值-128的np.int8类型的数组赋值给I_i1_low

I_i1_low_like: list[int] = [-128]
# 创建一个包含-128值的int类型列表赋值给I_i1_low_like

I_i1_high_open: npt.NDArray[np.int8] = np.array([127], dtype=np.int8)
# 创建一个包含值127的np.int8类型的数组赋值给I_i1_high_open

I_i1_high_closed: npt.NDArray[np.int8] = np.array([127], dtype=np.int8)
# 创建一个包含值127的np.int8类型的数组赋值给I_i1_high_closed

assert_type(def_gen.integers(128, dtype="i1"), np.int8)
# 检查从-128到127范围内的有符号8位整数生成器类型是否为np.int8

assert_type(def_gen.integers(-128, 128, dtype="i1"), np.int8)
# 检查从-128到128范围内的有符号8位整数生成器类型是否为np.int8

assert_type(def_gen.integers(127, dtype="i1", endpoint=True), np.int8)
# 检查从-128到127范围内的有符号8位整数生成器类型是否为np.int8

assert_type(def_gen.integers(-128, 127, dtype="i1", endpoint=True), np.int8)
# 检查从-128到127范围内的有符号8位整数生成器类型是否为np.int8

assert_type(def_gen.integers(I_i1_low_like, 127, dtype="i1", endpoint=True), npt.NDArray[np.int8])
# 检查从I_i1_low_like到127范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def_gen.integers(I_i1_high_open, dtype="i1"), npt.NDArray[np.int8])
# 检查从-128到I_i1_high_open范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def_gen.integers(I_i1_low, I_i1_high_open, dtype="i1"), npt.NDArray[np.int8])
# 检查从I_i1_low到I_i1_high_open范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def_gen.integers(-128, I_i1_high_open, dtype="i1"), npt.NDArray[np.int8])
# 检查从-128到I_i1_high_open范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def_gen.integers(I_i1_high_closed, dtype="i1", endpoint=True), npt.NDArray[np.int8])
# 检查从-128到I_i1_high_closed范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def_gen.integers(I_i1_low, I_i1_high_closed, dtype="i1", endpoint=True), npt.NDArray[np.int8])
# 检查从I_i1_low到I_i1_high_closed范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def_gen.integers(-128, I_i1_high_closed, dtype="i1", endpoint=True), npt.NDArray[np.int8])
# 检查从-128到I_i1_high_closed范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]


assert_type(def_gen.integers(128, dtype="int8"), np.int8)
# 检查从-128到127范围内的有符号8位整数生成器类型是否为np.int8

assert_type(def_gen.integers(-128, 128, dtype="int8"), np.int8)
# 检查从-128到128范围内的有符号8位整数生成器类型是否为np.int8

assert_type(def_gen.integers(127, dtype="int8", endpoint=True), np.int8)
# 检查从-128到127范围内的有符号8位整数生成器类型是否为np.int8

assert_type(def_gen.integers(-128, 127, dtype="int8", endpoint=True), np.int8)
# 检查从-128到127范围内的有符号8位整数生成器类型是否为np.int8

assert_type(def_gen.integers(I_i1_low_like, 127, dtype="int8", endpoint=True), npt.NDArray[np.int8])
# 检查从I_i1_low_like到127范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def_gen.integers(I_i1_high_open, dtype="int8"), npt.NDArray[np.int8])
# 检查从-128到I_i1_high_open范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def_gen.integers(I_i1_low, I_i1_high_open, dtype="int8"), npt.NDArray[np.int8])
# 检查从I_i1_low到I_i1_high_open范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def_gen.integers(-128, I_i1_high_open, dtype="int8"), npt.NDArray[np.int8])
# 检查从-128到I_i1_high_open范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def_gen.integers(I_i1_high_closed, dtype="int8", endpoint=True), npt.NDArray[np.int8])
# 检查从-128到I_i1_high_closed范围内的有符号8位整数生成器类型是否为npt.NDArray[np.int8]

assert_type(def
# 断言生成的随机整数类型为 np.int8
assert_type(def_gen.integers(128, dtype=np.int8), np.int8)
# 断言生成的随机整数类型为 np.int8,范围在 [-128, 128)
assert_type(def_gen.integers(-128, 128, dtype=np.int8), np.int8)
# 断言生成的随机整数类型为 np.int8,范围在 [0, 127]
assert_type(def_gen.integers(127, dtype=np.int8, endpoint=True), np.int8)
# 断言生成的随机整数类型为 np.int8,范围在 [-128, 127]
assert_type(def_gen.integers(-128, 127, dtype=np.int8, endpoint=True), np.int8)
# 断言生成的随机整数类型为 npt.NDArray[np.int8],范围在 [I_i1_low_like, 127]
assert_type(def_gen.integers(I_i1_low_like, 127, dtype=np.int8, endpoint=True), npt.NDArray[np.int8])
# 断言生成的随机整数类型为 npt.NDArray[np.int8],范围在 [I_i1_high_open, inf)
assert_type(def_gen.integers(I_i1_high_open, dtype=np.int8), npt.NDArray[np.int8])
# 断言生成的随机整数类型为 npt.NDArray[np.int8],范围在 [I_i1_low, I_i1_high_open)
assert_type(def_gen.integers(I_i1_low, I_i1_high_open, dtype=np.int8), npt.NDArray[np.int8])
# 断言生成的随机整数类型为 npt.NDArray[np.int8],范围在 [-128, I_i1_high_open)
assert_type(def_gen.integers(-128, I_i1_high_open, dtype=np.int8), npt.NDArray[np.int8])
# 断言生成的随机整数类型为 npt.NDArray[np.int8],范围在 [I_i1_high_closed, 127]
assert_type(def_gen.integers(I_i1_high_closed, dtype=np.int8, endpoint=True), npt.NDArray[np.int8])
# 断言生成的随机整数类型为 npt.NDArray[np.int8],范围在 [I_i1_low, I_i1_high_closed]
assert_type(def_gen.integers(I_i1_low, I_i1_high_closed, dtype=np.int8, endpoint=True), npt.NDArray[np.int8])
# 断言生成的随机整数类型为 npt.NDArray[np.int8],范围在 [-128, I_i1_high_closed]
assert_type(def_gen.integers(-128, I_i1_high_closed, dtype=np.int8, endpoint=True), npt.NDArray[np.int8])

# 定义 np.int16 类型的变量和常量
I_i2_low: npt.NDArray[np.int16] = np.array([-32768], dtype=np.int16)
I_i2_low_like: list[int] = [-32768]
I_i2_high_open: npt.NDArray[np.int16] = np.array([32767], dtype=np.int16)
I_i2_high_closed: npt.NDArray[np.int16] = np.array([32767], dtype=np.int16)

# 断言生成的随机整数类型为 np.int16,范围在 [32768, inf)
assert_type(def_gen.integers(32768, dtype="i2"), np.int16)
# 断言生成的随机整数类型为 np.int16,范围在 [-32768, 32768)
assert_type(def_gen.integers(-32768, 32768, dtype="i2"), np.int16)
# 断言生成的随机整数类型为 np.int16,范围在 [0, 32767]
assert_type(def_gen.integers(32767, dtype="i2", endpoint=True), np.int16)
# 断言生成的随机整数类型为 np.int16,范围在 [-32768, 32767]
assert_type(def_gen.integers(-32768, 32767, dtype="i2", endpoint=True), np.int16)
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [I_i2_low_like, 32767]
assert_type(def_gen.integers(I_i2_low_like, 32767, dtype="i2", endpoint=True), npt.NDArray[np.int16])
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [I_i2_high_open, inf)
assert_type(def_gen.integers(I_i2_high_open, dtype="i2"), npt.NDArray[np.int16])
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [I_i2_low, I_i2_high_open)
assert_type(def_gen.integers(I_i2_low, I_i2_high_open, dtype="i2"), npt.NDArray[np.int16])
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [-32768, I_i2_high_open)
assert_type(def_gen.integers(-32768, I_i2_high_open, dtype="i2"), npt.NDArray[np.int16])
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [I_i2_high_closed, 32767]
assert_type(def_gen.integers(I_i2_high_closed, dtype="i2", endpoint=True), npt.NDArray[np.int16])
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [I_i2_low, I_i2_high_closed]
assert_type(def_gen.integers(I_i2_low, I_i2_high_closed, dtype="i2", endpoint=True), npt.NDArray[np.int16])
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [-32768, I_i2_high_closed]
assert_type(def_gen.integers(-32768, I_i2_high_closed, dtype="i2", endpoint=True), npt.NDArray[np.int16])

# 断言生成的随机整数类型为 np.int16,范围在 [32768, inf)
assert_type(def_gen.integers(32768, dtype="int16"), np.int16)
# 断言生成的随机整数类型为 np.int16,范围在 [-32768, 32768)
assert_type(def_gen.integers(-32768, 32768, dtype="int16"), np.int16)
# 断言生成的随机整数类型为 np.int16,范围在 [0, 32767]
assert_type(def_gen.integers(32767, dtype="int16", endpoint=True), np.int16)
# 断言生成的随机整数类型为 np.int16,范围在 [-32768, 32767]
assert_type(def_gen.integers(-32768, 32767, dtype="int16", endpoint=True), np.int16)
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [I_i2_low_like, 32767]
assert_type(def_gen.integers(I_i2_low_like, 32767, dtype="int16", endpoint=True), npt.NDArray[np.int16])
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [I_i2_high_open, inf)
assert_type(def_gen.integers(I_i2_high_open, dtype="int16"), npt.NDArray[np.int16])
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [I_i2_low, I_i2_high_open)
assert_type(def_gen.integers(I_i2_low, I_i2_high_open, dtype="int16"), npt.NDArray[np.int16])
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [-32768, I_i2_high_open)
assert_type(def_gen.integers(-32768, I_i2_high_open, dtype="int16"), npt.NDArray[np.int16])
# 断言生成的随机整数类型为 npt.NDArray[np.int16],范围在 [I_i2_high_closed, 32767]
assert_type(def_gen.integers(I_i2_high_closed, dtype="int16", endpoint=True), npt.NDArray[np.int16])
# 确保生成的整数数组的数据类型为 int16,并使用 endpoint=True 包含最后一个元素
assert_type(def_gen.integers(I_i2_low, I_i2_high_closed, dtype="int16", endpoint=True), npt.NDArray[np.int16])

# 确保生成的整数数组的数据类型为 int16,范围从 -32768 到 I_i2_high_closed,并包含最后一个元素
assert_type(def_gen.integers(-32768, I_i2_high_closed, dtype="int16", endpoint=True), npt.NDArray[np.int16])

# 确保生成的整数数组的数据类型为 int16,范围从 32768 到最大值,不包含最后一个元素
assert_type(def_gen.integers(32768, dtype=np.int16), np.int16)

# 确保生成的整数数组的数据类型为 int16,范围从 -32768 到 32768,并包含最后一个元素
assert_type(def_gen.integers(-32768, 32768, dtype=np.int16), np.int16)

# 确保生成的整数数组的数据类型为 int16,范围从 32767 到最大值,并包含最后一个元素
assert_type(def_gen.integers(32767, dtype=np.int16, endpoint=True), np.int16)

# 确保生成的整数数组的数据类型为 int16,范围从 -32768 到 32767,并包含最后一个元素
assert_type(def_gen.integers(-32768, 32767, dtype=np.int16, endpoint=True), np.int16)

# 确保生成的整数数组的数据类型为 int16,范围从 I_i2_low_like 到 32767,并包含最后一个元素
assert_type(def_gen.integers(I_i2_low_like, 32767, dtype=np.int16, endpoint=True), npt.NDArray[np.int16])

# 确保生成的整数数组的数据类型为 int16,范围从 I_i2_high_open 到最大值,不包含最后一个元素
assert_type(def_gen.integers(I_i2_high_open, dtype=np.int16), npt.NDArray[np.int16])

# 确保生成的整数数组的数据类型为 int16,范围从 I_i2_low 到 I_i2_high_open,不包含最后一个元素
assert_type(def_gen.integers(I_i2_low, I_i2_high_open, dtype=np.int16), npt.NDArray[np.int16])

# 确保生成的整数数组的数据类型为 int16,范围从 -32768 到 I_i2_high_open,并包含最后一个元素
assert_type(def_gen.integers(-32768, I_i2_high_open, dtype=np.int16), npt.NDArray[np.int16])

# 确保生成的整数数组的数据类型为 int16,范围从 I_i2_high_closed 到最大值,并包含最后一个元素
assert_type(def_gen.integers(I_i2_high_closed, dtype=np.int16, endpoint=True), npt.NDArray[np.int16])

# 确保生成的整数数组的数据类型为 int16,范围从 I_i2_low 到 I_i2_high_closed,并包含最后一个元素
assert_type(def_gen.integers(I_i2_low, I_i2_high_closed, dtype=np.int16, endpoint=True), npt.NDArray[np.int16])

# 确保生成的整数数组的数据类型为 int16,范围从 -32768 到 I_i2_high_closed,并包含最后一个元素
assert_type(def_gen.integers(-32768, I_i2_high_closed, dtype=np.int16, endpoint=True), npt.NDArray[np.int16])

# 将 -2147483648 赋值给数组 I_i4_low,并指定数据类型为 int32
I_i4_low: npt.NDArray[np.int32] = np.array([-2147483648], dtype=np.int32)

# 将 -2147483648 赋值给列表 I_i4_low_like,元素类型为 int
I_i4_low_like: list[int] = [-2147483648]

# 将 2147483647 赋值给数组 I_i4_high_open,并指定数据类型为 int32
I_i4_high_open: npt.NDArray[np.int32] = np.array([2147483647], dtype=np.int32)

# 将 2147483647 赋值给数组 I_i4_high_closed,并指定数据类型为 int32
I_i4_high_closed: npt.NDArray[np.int32] = np.array([2147483647], dtype=np.int32)

# 确保生成的整数数组的数据类型为 int32,范围从 2147483648 到最大值,不包含最后一个元素
assert_type(def_gen.integers(2147483648, dtype="i4"), np.int32)

# 确保生成的整数数组的数据类型为 int32,范围从 -2147483648 到 2147483648,并包含最后一个元素
assert_type(def_gen.integers(-2147483648, 2147483648, dtype="i4"), np.int32)

# 确保生成的整数数组的数据类型为 int32,范围从 2147483647 到最大值,并包含最后一个元素
assert_type(def_gen.integers(2147483647, dtype="i4", endpoint=True), np.int32)

# 确保生成的整数数组的数据类型为 int32,范围从 -2147483648 到 2147483647,并包含最后一个元素
assert_type(def_gen.integers(-2147483648, 2147483647, dtype="i4", endpoint=True), np.int32)

# 确保生成的整数数组的数据类型为 int32,范围从 I_i4_low_like 到 2147483647,并包含最后一个元素
assert_type(def_gen.integers(I_i4_low_like, 2147483647, dtype="i4", endpoint=True), npt.NDArray[np.int32])

# 确保生成的整数数组的数据类型为 int32,范围从 I_i4_high_open 到最大值,不包含最后一个元素
assert_type(def_gen.integers(I_i4_high_open, dtype="i4"), npt.NDArray[np.int32])

# 确保生成的整数数组的数据类型为 int32,范围从 I_i4_low 到 I_i4_high_open,不包含最后一个元素
assert_type(def_gen.integers(I_i4_low, I_i4_high_open, dtype="i4"), npt.NDArray[np.int32])

# 确保生成的整数数组的数据类型为 int32,范围从 -2147483648 到 I_i4_high_open,并包含最后一个元素
assert_type(def_gen.integers(-2147483648, I_i4_high_open, dtype="i4"), npt.NDArray[np.int32])

# 确保生成的整数数组的数据类型为 int32,范围从 I_i4_high_closed 到最大值,并包含最后一个元素
assert_type(def_gen.integers(I_i4_high_closed, dtype="i4", endpoint=True), npt.NDArray[np.int32])

# 确保生成的整数数组的数据类型为 int32,范围从 I_i4_low 到 I_i4_high_closed,并包含最后一个元素
assert_type(def_gen.integers(I_i4_low, I_i4_high_closed, dtype="i4", endpoint=True), npt.NDArray[np.int32])

# 确保生成的整数数组的数据类型为 int32,范围从 -2147483648 到 I_i4_high_closed,并包含最后一个元素
assert_type(def_gen.integers(-2147483648, I_i4_high_closed, dtype="i4", endpoint=True), npt.NDArray[np.int32])

# 确保生成的整数数组的数据类型为 int32,范围从 2147483648 到最大值,不包含最后一个元素
assert_type(def_gen.integers(2147483648, dtype="int32"), np.int32)

# 确保生成的整数数组的数据类型为 int32,范围从 -2147483648 到 2147483648,并包含最后一个元素
assert_type(def_gen.integers(-2147483648, 2147483648, dtype="int32"), np.int32)

# 确保生成的整数数组的数据类型为 int32,范
# 确保返回值是由指定的integers生成器生成的 numpy 数组,数据类型为 int32 的数组
assert_type(def_gen.integers(I_i4_high_open, dtype="int32"), npt.NDArray[np.int32])
# 确保返回值是由指定范围的integers生成器生成的 numpy 数组,数据类型为 int32 的数组
assert_type(def_gen.integers(I_i4_low, I_i4_high_open, dtype="int32"), npt.NDArray[np.int32])
# 确保返回值是由指定范围的integers生成器生成的 numpy 数组,数据类型为 int32 的数组
assert_type(def_gen.integers(-2147483648, I_i4_high_open, dtype="int32"), npt.NDArray[np.int32])
# 确保返回值是由指定的integers生成器生成的 numpy 数组,数据类型为 int32 的数组
assert_type(def_gen.integers(I_i4_high_closed, dtype="int32", endpoint=True), npt.NDArray[np.int32])
# 确保返回值是由指定范围的integers生成器生成的 numpy 数组,数据类型为 int32 的数组
assert_type(def_gen.integers(I_i4_low, I_i4_high_closed, dtype="int32", endpoint=True), npt.NDArray[np.int32])
# 确保返回值是由指定范围的integers生成器生成的 numpy 数组,数据类型为 int32 的数组
assert_type(def_gen.integers(-2147483648, I_i4_high_closed, dtype="int32", endpoint=True), npt.NDArray[np.int32])

# 确保返回值是由指定的integers生成器生成的 numpy int32 类型数据
assert_type(def_gen.integers(2147483648, dtype=np.int32), np.int32)
# 确保返回值是由指定范围的integers生成器生成的 numpy int32 类型数据
assert_type(def_gen.integers(-2147483648, 2147483648, dtype=np.int32), np.int32)
# 确保返回值是由指定的integers生成器生成的 numpy int32 类型数据
assert_type(def_gen.integers(2147483647, dtype=np.int32, endpoint=True), np.int32)
# 确保返回值是由指定范围的integers生成器生成的 numpy int32 类型数据
assert_type(def_gen.integers(-2147483648, 2147483647, dtype=np.int32, endpoint=True), np.int32)
# 确保返回值是由指定范围的integers生成器生成的 numpy 数组,数据类型为 int32 的数组
assert_type(def_gen.integers(I_i4_low_like, 2147483647, dtype=np.int32, endpoint=True), npt.NDArray[np.int32])
# 确保返回值是由指定的integers生成器生成的 numpy int32 类型数据
assert_type(def_gen.integers(I_i4_high_open, dtype=np.int32), npt.NDArray[np.int32])
# 确保返回值是由指定范围的integers生成器生成的 numpy int32 类型数据
assert_type(def_gen.integers(I_i4_low, I_i4_high_open, dtype=np.int32), npt.NDArray[np.int32])
# 确保返回值是由指定范围的integers生成器生成的 numpy int32 类型数据
assert_type(def_gen.integers(-2147483648, I_i4_high_open, dtype=np.int32), npt.NDArray[np.int32])
# 确保返回值是由指定的integers生成器生成的 numpy int32 类型数据
assert_type(def_gen.integers(I_i4_high_closed, dtype=np.int32, endpoint=True), npt.NDArray[np.int32])
# 确保返回值是由指定范围的integers生成器生成的 numpy int32 类型数据
assert_type(def_gen.integers(I_i4_low, I_i4_high_closed, dtype=np.int32, endpoint=True), npt.NDArray[np.int32])
# 确保返回值是由指定范围的integers生成器生成的 numpy int32 类型数据
assert_type(def_gen.integers(-2147483648, I_i4_high_closed, dtype=np.int32, endpoint=True), npt.NDArray[np.int32])

# 创建一个 numpy int64 类型的数组,包含值 -9223372036854775808
I_i8_low: npt.NDArray[np.int64] = np.array([-9223372036854775808], dtype=np.int64)
# 创建一个列表,包含值 -9223372036854775808
I_i8_low_like: list[int] = [-9223372036854775808]
# 创建一个 numpy int64 类型的数组,包含值 9223372036854775807
I_i8_high_open: npt.NDArray[np.int64] = np.array([9223372036854775807], dtype=np.int64)
# 创建一个 numpy int64 类型的数组,包含值 9223372036854775807
I_i8_high_closed: npt.NDArray[np.int64] = np.array([9223372036854775807], dtype=np.int64)

# 确保返回值是由指定的integers生成器生成的 numpy int64 类型数据
assert_type(def_gen.integers(9223372036854775808, dtype="i8"), np.int64)
# 确保返回值是由指定范围的integers生成器生成的 numpy int64 类型数据
assert_type(def_gen.integers(-9223372036854775808, 9223372036854775808, dtype="i8"), np.int64)
# 确保返回值是由指定的integers生成器生成的 numpy int64 类型数据
assert_type(def_gen.integers(9223372036854775807, dtype="i8", endpoint=True), np.int64)
# 确保返回值是由指定范围的integers生成器生成的 numpy int64 类型数据
assert_type(def_gen.integers(-9223372036854775808, 9223372036854775807, dtype="i8", endpoint=True), np.int64)
# 确保返回值是由指定范围的integers生成器生成的 numpy 数组,数据类型为 int64 的数组
assert_type(def_gen.integers(I_i8_low_like, 9223372036854775807, dtype="i8", endpoint=True), npt.NDArray[np.int64])
# 确保返回值是由指定的integers生成器生成的 numpy int64 类型数据
assert_type(def_gen.integers(I_i8_high_open, dtype="i8"), npt.NDArray[np.int64])
# 确保返回值是由指定范围的integers生成器生成的 numpy int64 类型数据
assert_type(def_gen.integers(I_i8_low, I_i8_high_open, dtype="i8"), npt.NDArray[np.int64])
# 确保返回值是由指定范围的integers生成器生成的 numpy int64 类型数据
assert_type(def_gen.integers(-9223372036854775808, I_i8_high_open, dtype="i8"), npt.NDArray[np.int64])
# 确保返回值是由指定的integers生成器生成的 numpy int64 类型数据
assert_type(def_gen.integers(I_i8_high_closed, dtype="i8", endpoint=True), npt.NDArray[np.int64])
# 确保返回值是由指定范围的integers生成器生成的 numpy int64 类型数据
assert_type(def_gen.integers(I_i8_low, I_i8_high_closed, dtype="i8", endpoint=True), npt.NDArray[np.int64])
# 使用 assert_type 函数检查生成器生成的整数是否为 np.int64 类型,生成范围为从最小整数到 I_i8_high_closed,包含最大值
assert_type(def_gen.integers(-9223372036854775808, I_i8_high_closed, dtype="i8", endpoint=True), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的整数是否为 np.int64 类型,生成范围为从 9223372036854775808 开始的 int64 整数
assert_type(def_gen.integers(9223372036854775808, dtype="int64"), np.int64)

# 使用 assert_type 函数检查生成器生成的整数是否为 np.int64 类型,生成范围为从 -9223372036854775808 到 9223372036854775808 的 int64 整数
assert_type(def_gen.integers(-9223372036854775808, 9223372036854775808, dtype="int64"), np.int64)

# 使用 assert_type 函数检查生成器生成的整数是否为 np.int64 类型,生成范围为从 9223372036854775807 开始的 int64 整数,包含最大值
assert_type(def_gen.integers(9223372036854775807, dtype="int64", endpoint=True), np.int64)

# 使用 assert_type 函数检查生成器生成的整数是否为 np.int64 类型,生成范围为从 -9223372036854775808 到 9223372036854775807 的 int64 整数,包含最大值
assert_type(def_gen.integers(-9223372036854775808, 9223372036854775807, dtype="int64", endpoint=True), np.int64)

# 使用 assert_type 函数检查生成器生成的整数是否为 npt.NDArray[np.int64] 类型,生成范围为从 I_i8_low_like 开始到 9223372036854775807 的 int64 整数,包含最大值
assert_type(def_gen.integers(I_i8_low_like, 9223372036854775807, dtype="int64", endpoint=True), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的整数是否为 npt.NDArray[np.int64] 类型,生成范围为从 I_i8_high_open 开始的 int64 整数
assert_type(def_gen.integers(I_i8_high_open, dtype="int64"), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的整数是否为 npt.NDArray[np.int64] 类型,生成范围为从 I_i8_low 到 I_i8_high_open 的 int64 整数
assert_type(def_gen.integers(I_i8_low, I_i8_high_open, dtype="int64"), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的整数是否为 npt.NDArray[np.int64] 类型,生成范围为从 -9223372036854775808 到 I_i8_high_open 的 int64 整数
assert_type(def_gen.integers(-9223372036854775808, I_i8_high_open, dtype="int64"), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的整数是否为 npt.NDArray[np.int64] 类型,生成范围为从 I_i8_high_closed 开始的 int64 整数,包含最大值
assert_type(def_gen.integers(I_i8_high_closed, dtype="int64", endpoint=True), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的整数是否为 npt.NDArray[np.int64] 类型,生成范围为从 I_i8_low 到 I_i8_high_closed 的 int64 整数,包含最大值
assert_type(def_gen.integers(I_i8_low, I_i8_high_closed, dtype="int64", endpoint=True), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的整数是否为 npt.NDArray[np.int64] 类型,生成范围为从 -9223372036854775808 到 I_i8_high_closed 的 int64 整数,包含最大值
assert_type(def_gen.integers(-9223372036854775808, I_i8_high_closed, dtype="int64", endpoint=True), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的随机位生成器是否为 np.random.BitGenerator 类型
assert_type(def_gen.bit_generator, np.random.BitGenerator)

# 使用 assert_type 函数检查生成器生成的字节串是否为 bytes 类型,生成长度为 2 的字节串
assert_type(def_gen.bytes(2), bytes)

# 使用 assert_type 函数检查生成器生成的随机选择是否为 int 类型,从 0 到 5 中选择一个整数
assert_type(def_gen.choice(5), int)

# 使用 assert_type 函数检查生成器生成的随机选择是否为 npt.NDArray[np.int64] 类型,从 0 到 5 中选择 3 个整数
assert_type(def_gen.choice(5, 3), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的随机选择是否为 npt.NDArray[np.int64] 类型,从 0 到 5 中选择 3 个整数,允许重复选择
assert_type(def_gen.choice(5, 3, replace=True), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的随机选择是否为 npt.NDArray[np.int64] 类型,从 0 到 5 中选择 3 个整数,每个选择的概率为 1/5
assert_type(def_gen.choice(5, 3, p=[1 / 5] * 5), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的随机选择是否为 npt.NDArray[np.int64] 类型,从 0 到 5 中选择 3 个整数,每个选择的概率为 1/5,不允许重复选择
assert_type(def_gen.choice(5, 3, p=[1 / 5] * 5, replace=False), npt.NDArray[np.int64])

# 使用 assert_type 函数检查生成器生成的随机选择是否为 Any 类型,从给定列表中选择一个元素
assert_type(def_gen.choice(["pooh", "rabbit", "piglet", "Christopher"]), Any)

# 使用 assert_type 函数检查生成器生成的随机选择是否为 npt.NDArray[Any] 类型,从给定列表中选择 3 个元素
assert_type(def_gen.choice(["pooh", "rabbit", "piglet", "Christopher"], 3), npt.NDArray[Any])
# 确保从给定列表中随机选择三个元素,返回类型应为 NumPy 数组
assert_type(def_gen.choice(["pooh", "rabbit", "piglet", "Christopher"], 3, p=[1 / 4] * 4), npt.NDArray[Any])
# 确保从给定列表中随机选择三个元素(可重复选择),返回类型应为 NumPy 数组
assert_type(def_gen.choice(["pooh", "rabbit", "piglet", "Christopher"], 3, replace=True), npt.NDArray[Any])
# 确保从给定列表中随机选择三个元素(不可重复选择,概率不均等),返回类型应为 NumPy 数组
assert_type(def_gen.choice(["pooh", "rabbit", "piglet", "Christopher"], 3, replace=False, p=np.array([1 / 8, 1 / 8, 1 / 2, 1 / 4])), npt.NDArray[Any])

# 确保生成 Dirichlet 分布的样本,参数为列表,返回类型应为 NumPy 数组(浮点数)
assert_type(def_gen.dirichlet([0.5, 0.5]), npt.NDArray[np.float64])
# 确保生成 Dirichlet 分布的样本,参数为 NumPy 数组,返回类型应为 NumPy 数组(浮点数)
assert_type(def_gen.dirichlet(np.array([0.5, 0.5])), npt.NDArray[np.float64])
# 确保生成 Dirichlet 分布的多个样本,参数为 NumPy 数组,返回类型应为 NumPy 数组(浮点数)
assert_type(def_gen.dirichlet(np.array([0.5, 0.5]), size=3), npt.NDArray[np.float64])

# 确保生成多项式分布的样本,参数为整数和概率列表,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multinomial(20, [1 / 6.0] * 6), npt.NDArray[np.int64])
# 确保生成多项式分布的样本,参数为整数和 NumPy 数组,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multinomial(20, np.array([0.5, 0.5])), npt.NDArray[np.int64])
# 确保生成多项式分布的多个样本,参数为整数、概率列表和 size 参数,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multinomial(20, [1 / 6.0] * 6, size=2), npt.NDArray[np.int64])
# 确保生成多项式分布的多维样本,参数为二维数组、概率列表和 size 参数,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multinomial([[10], [20]], [1 / 6.0] * 6, size=(2, 2)), npt.NDArray[np.int64])
# 确保生成多项式分布的多维样本,参数为 NumPy 数组、NumPy 数组和 size 参数,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multinomial(np.array([[10], [20]]), np.array([0.5, 0.5]), size=(2, 2)), npt.NDArray[np.int64])

# 确保生成多元超几何分布的样本,参数为列表和整数,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multivariate_hypergeometric([3, 5, 7], 2), npt.NDArray[np.int64])
# 确保生成多元超几何分布的样本,参数为 NumPy 数组和整数,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multivariate_hypergeometric(np.array([3, 5, 7]), 2), npt.NDArray[np.int64])
# 确保生成多元超几何分布的多个样本,参数为 NumPy 数组、整数和 size 参数,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multivariate_hypergeometric(np.array([3, 5, 7]), 2, size=4), npt.NDArray[np.int64])
# 确保生成多元超几何分布的多维样本,参数为 NumPy 数组、整数、size 参数和 method 参数,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multivariate_hypergeometric(np.array([3, 5, 7]), 2, size=(4, 7)), npt.NDArray[np.int64])
# 确保生成多元超几何分布的样本,参数为列表、整数和 method 参数,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multivariate_hypergeometric([3, 5, 7], 2, method="count"), npt.NDArray[np.int64])
# 确保生成多元超几何分布的样本,参数为 NumPy 数组、整数和 method 参数,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.multivariate_hypergeometric(np.array([3, 5, 7]), 2, method="marginals"), npt.NDArray[np.int64])

# 确保生成多元正态分布的样本,参数为均值列表和协方差矩阵,返回类型应为 NumPy 数组(浮点数)
assert_type(def_gen.multivariate_normal([0.0], [[1.0]]), npt.NDArray[np.float64])
# 确保生成多元正态分布的样本,参数为均值列表和 NumPy 数组(协方差矩阵),返回类型应为 NumPy 数组(浮点数)
assert_type(def_gen.multivariate_normal([0.0], np.array([[1.0]])), npt.NDArray[np.float64])
# 确保生成多元正态分布的样本,参数为 NumPy 数组和协方差矩阵,返回类型应为 NumPy 数组(浮点数)
assert_type(def_gen.multivariate_normal(np.array([0.0]), [[1.0]]), npt.NDArray[np.float64])
# 确保生成多元正态分布的样本,参数为均值列表和 NumPy 数组(协方差矩阵),返回类型应为 NumPy 数组(浮点数)
assert_type(def_gen.multivariate_normal([0.0], np.array([[1.0]])), npt.NDArray[np.float64])

# 确保生成给定整数范围内的随机排列,返回类型应为 NumPy 数组(整数)
assert_type(def_gen.permutation(10), npt.NDArray[np.int64])
# 确保生成给定列表的随机排列,返回类型应为 NumPy 数组(任意类型)
assert_type(def_gen.permutation([1, 2, 3, 4]), npt.NDArray[Any])
# 确保生成给定 NumPy 数组的随机排列,返回类型应为 NumPy 数组(任意类型)
assert_type(def_gen.permutation(np.array([1, 2, 3, 4])), npt.NDArray[Any])
# 确保生成给定二维数组按指定轴的随机排列,返回类型应为 NumPy 数组(任意类型)
assert_type(def_gen.permutation(D_2D, axis=1), npt.NDArray[Any])
# 确保生成给定二维数组的随机排列,返回类型应为 NumPy 数组(任意类型)
assert_type(def_gen.permuted(D_2D), npt.NDArray[Any])
# 确保生成给定形状的随机排列,返回类型应为 NumPy 数组(任意类型)
assert_type(def_gen.permuted(D_2D_like), npt.NDArray[Any])
# 确保生成给定二维数组按指定轴的随机排列,返回类型应为 NumPy 数组(任意类型)
assert_type(def_gen.permuted(D_2D, axis=1), npt.NDArray[Any])
# 确保生成给定二维数组按指定输出的随机排列,返回类型应为 NumPy 数组(任意类型)
assert_type(def_gen.permuted(D_2D, out=D_2D), npt.NDArray[Any])
# 确保生成给
assert_type(def_gen.__repr__(), str)
assert_type(def_gen.__setstate__(dict(def_gen.bit_generator.state)), None)

# 创建一个 RandomState 对象,使用 NumPy 的随机数生成器初始化
random_st: np.random.RandomState = np.random.RandomState()

# 验证随机数生成器生成标准正态分布的值是否为浮点数
assert_type(random_st.standard_normal(), float)
# 验证随机数生成器生成指定大小标准正态分布的值是否为浮点数
assert_type(random_st.standard_normal(size=None), float)
# 验证随机数生成器生成指定大小标准正态分布的值是否为浮点数数组
assert_type(random_st.standard_normal(size=1), npt.NDArray[np.float64])

# 验证随机数生成器生成 [0,1) 之间均匀分布的随机数是否为浮点数
assert_type(random_st.random(), float)
# 验证随机数生成器生成指定大小 [0,1) 之间均匀分布的随机数是否为浮点数
assert_type(random_st.random(size=None), float)
# 验证随机数生成器生成指定大小 [0,1) 之间均匀分布的随机数是否为浮点数数组
assert_type(random_st.random(size=1), npt.NDArray[np.float64])

# 验证随机数生成器生成标准 Cauchy 分布的随机数是否为浮点数
assert_type(random_st.standard_cauchy(), float)
# 验证随机数生成器生成指定大小标准 Cauchy 分布的随机数是否为浮点数
assert_type(random_st.standard_cauchy(size=None), float)
# 验证随机数生成器生成指定大小标准 Cauchy 分布的随机数是否为浮点数数组
assert_type(random_st.standard_cauchy(size=1), npt.NDArray[np.float64])

# 验证随机数生成器生成指数分布的随机数是否为浮点数
assert_type(random_st.standard_exponential(), float)
# 验证随机数生成器生成指定大小指数分布的随机数是否为浮点数
assert_type(random_st.standard_exponential(size=None), float)
# 验证随机数生成器生成指定大小指数分布的随机数是否为浮点数数组
assert_type(random_st.standard_exponential(size=1), npt.NDArray[np.float64])

# 验证随机数生成器生成参数为 1.5 的 Zipf 分布的随机整数是否为整数
assert_type(random_st.zipf(1.5), int)
# 验证随机数生成器生成参数为 1.5 的 Zipf 分布的随机整数是否为整数
assert_type(random_st.zipf(1.5, size=None), int)
# 验证随机数生成器生成参数为 1.5 的 Zipf 分布的随机整数是否为整数数组
assert_type(random_st.zipf(1.5, size=1), npt.NDArray[np.long])
# 验证随机数生成器生成参数为 D_arr_1p5 的 Zipf 分布的随机整数是否为整数数组
assert_type(random_st.zipf(D_arr_1p5), npt.NDArray[np.long])
# 验证随机数生成器生成参数为 D_arr_1p5 的 Zipf 分布的随机整数是否为整数数组
assert_type(random_st.zipf(D_arr_1p5, size=1), npt.NDArray[np.long])
# 验证随机数生成器生成参数为 D_arr_like_1p5 的 Zipf 分布的随机整数是否为整数数组
assert_type(random_st.zipf(D_arr_like_1p5), npt.NDArray[np.long])
# 验证随机数生成器生成参数为 D_arr_like_1p5 的 Zipf 分布的随机整数是否为整数数组
assert_type(random_st.zipf(D_arr_like_1p5, size=1), npt.NDArray[np.long])

# 验证随机数生成器生成参数为 0.5 的 Weibull 分布的随机数是否为浮点数
assert_type(random_st.weibull(0.5), float)
# 验证随机数生成器生成参数为 0.5 的 Weibull 分布的随机数是否为浮点数
assert_type(random_st.weibull(0.5, size=None), float)
# 验证随机数生成器生成参数为 0.5 的 Weibull 分布的随机数是否为浮点数数组
assert_type(random_st.weibull(0.5, size=1), npt.NDArray[np.float64])
# 验证随机数生成器生成参数为 D_arr_0p5 的 Weibull 分布的随机数是否为浮点数数组
assert_type(random_st.weibull(D_arr_0p5), npt.NDArray[np.float64])
# 验证随机数生成器生成参数为 D_arr_0p5 的 Weibull 分布的随机数是否为浮点数数组
assert_type(random_st.weibull(D_arr_0p5, size=1), npt.NDArray[np.float64])
# 验证随机数生成器生成参数为 D_arr_like_0p5 的 Weibull 分布的随机数是否为浮点数数组
assert_type(random_st.weibull(D_arr_like_0p5), npt.NDArray[np.float64])
# 验证随机数生成器生成参数为 D_arr_like_0p5 的 Weibull 分布的随机数是否为浮点数数组
assert_type(random_st.weibull(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 验证随机数生成器生成参数为 0.5 的标准 t 分布的随机数是否为浮点数
assert_type(random_st.standard_t(0.5), float)
# 验证随机数生成器生成参数为 0.5 的标准 t 分布的随机数是否为浮点数
assert_type(random_st.standard_t(0.5, size=None), float)
# 验证随机数生成器生成参数为 0.5 的标准 t 分布的随机数是否为浮点数数组
assert_type(random_st.standard_t(0.5, size=1), npt.NDArray[np.float64])
# 验证随机数生成器生成参数为 D_arr_0p5 的标准 t 分布的随机数是否为浮点数数组
assert_type(random_st.standard_t(D_arr_0p5), npt.NDArray[np.float64])
# 验证随机数生成器生成参数为 D_arr_0p5 的标准 t 分布的随机数是否为浮点数数组
assert_type(random_st.standard_t(D_arr_0p5, size=1), npt.NDArray[np.float64])
# 验证随机数生成器生成参数为 D_arr_like_0p5 的标准 t 分布的随机数是否为浮点数数组
assert_type(random_st.standard_t(D_arr_like_0p5), npt.NDArray[np.float64])
# 验证随机数生成器生成参数为 D_arr_like_0p5 的标准 t 分布的随机数是否为浮点数数组
assert_type(random_st.standard_t(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 验证随机数生成器生成参数为 0.5 的 Poisson 分布的随机整数是否为整数
assert_type(random_st.poisson(0.5), int)
# 验证随机数生成器生成参数为 0.5 的 Poisson 分布的随机整数是否为整数
assert_type(random_st.poisson(0.5, size=None), int)
# 验证随机数生成器生成参数为 0.5 的 Poisson 分布的随机整数是否为整数数组
assert_type(random_st.poisson(0.5, size=1), npt.NDArray[np.long])
# 验证随机数生成器生成参数为 D_arr_0p5 的 Poisson 分布的随机整数是否为整数数组
assert_type(random_st.poisson(D_arr_
# 检查 random_st.power(D_arr_like_0p5) 的返回类型是否为 np.float64
assert_type(random_st.power(D_arr_like_0p5), npt.NDArray[np.float64])

# 检查 random_st.power(D_arr_like_0p5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.power(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 检查 random_st.pareto(0.5) 的返回类型是否为 float
assert_type(random_st.pareto(0.5), float)

# 检查 random_st.pareto(0.5, size=None) 的返回类型是否为 float
assert_type(random_st.pareto(0.5, size=None), float)

# 检查 random_st.pareto(0.5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.pareto(0.5, size=1), npt.NDArray[np.float64])

# 检查 random_st.pareto(D_arr_0p5) 的返回类型是否为 np.float64
assert_type(random_st.pareto(D_arr_0p5), npt.NDArray[np.float64])

# 检查 random_st.pareto(D_arr_0p5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.pareto(D_arr_0p5, size=1), npt.NDArray[np.float64])

# 检查 random_st.pareto(D_arr_like_0p5) 的返回类型是否为 np.float64
assert_type(random_st.pareto(D_arr_like_0p5), npt.NDArray[np.float64])

# 检查 random_st.pareto(D_arr_like_0p5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.pareto(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 检查 random_st.chisquare(0.5) 的返回类型是否为 float
assert_type(random_st.chisquare(0.5), float)

# 检查 random_st.chisquare(0.5, size=None) 的返回类型是否为 float
assert_type(random_st.chisquare(0.5, size=None), float)

# 检查 random_st.chisquare(0.5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.chisquare(0.5, size=1), npt.NDArray[np.float64])

# 检查 random_st.chisquare(D_arr_0p5) 的返回类型是否为 np.float64
assert_type(random_st.chisquare(D_arr_0p5), npt.NDArray[np.float64])

# 检查 random_st.chisquare(D_arr_0p5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.chisquare(D_arr_0p5, size=1), npt.NDArray[np.float64])

# 检查 random_st.chisquare(D_arr_like_0p5) 的返回类型是否为 np.float64
assert_type(random_st.chisquare(D_arr_like_0p5), npt.NDArray[np.float64])

# 检查 random_st.chisquare(D_arr_like_0p5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.chisquare(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 检查 random_st.exponential(0.5) 的返回类型是否为 float
assert_type(random_st.exponential(0.5), float)

# 检查 random_st.exponential(0.5, size=None) 的返回类型是否为 float
assert_type(random_st.exponential(0.5, size=None), float)

# 检查 random_st.exponential(0.5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.exponential(0.5, size=1), npt.NDArray[np.float64])

# 检查 random_st.exponential(D_arr_0p5) 的返回类型是否为 np.float64
assert_type(random_st.exponential(D_arr_0p5), npt.NDArray[np.float64])

# 检查 random_st.exponential(D_arr_0p5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.exponential(D_arr_0p5, size=1), npt.NDArray[np.float64])

# 检查 random_st.exponential(D_arr_like_0p5) 的返回类型是否为 np.float64
assert_type(random_st.exponential(D_arr_like_0p5), npt.NDArray[np.float64])

# 检查 random_st.exponential(D_arr_like_0p5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.exponential(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 检查 random_st.geometric(0.5) 的返回类型是否为 int
assert_type(random_st.geometric(0.5), int)

# 检查 random_st.geometric(0.5, size=None) 的返回类型是否为 int
assert_type(random_st.geometric(0.5, size=None), int)

# 检查 random_st.geometric(0.5, size=1) 的返回类型是否为 np.long
assert_type(random_st.geometric(0.5, size=1), npt.NDArray[np.long])

# 检查 random_st.geometric(D_arr_0p5) 的返回类型是否为 np.long
assert_type(random_st.geometric(D_arr_0p5), npt.NDArray[np.long])

# 检查 random_st.geometric(D_arr_0p5, size=1) 的返回类型是否为 np.long
assert_type(random_st.geometric(D_arr_0p5, size=1), npt.NDArray[np.long])

# 检查 random_st.geometric(D_arr_like_0p5) 的返回类型是否为 np.long
assert_type(random_st.geometric(D_arr_like_0p5), npt.NDArray[np.long])

# 检查 random_st.geometric(D_arr_like_0p5, size=1) 的返回类型是否为 np.long
assert_type(random_st.geometric(D_arr_like_0p5, size=1), npt.NDArray[np.long])

# 检查 random_st.logseries(0.5) 的返回类型是否为 int
assert_type(random_st.logseries(0.5), int)

# 检查 random_st.logseries(0.5, size=None) 的返回类型是否为 int
assert_type(random_st.logseries(0.5, size=None), int)

# 检查 random_st.logseries(0.5, size=1) 的返回类型是否为 np.long
assert_type(random_st.logseries(0.5, size=1), npt.NDArray[np.long])

# 检查 random_st.logseries(D_arr_0p5) 的返回类型是否为 np.long
assert_type(random_st.logseries(D_arr_0p5), npt.NDArray[np.long])

# 检查 random_st.logseries(D_arr_0p5, size=1) 的返回类型是否为 np.long
assert_type(random_st.logseries(D_arr_0p5, size=1), npt.NDArray[np.long])

# 检查 random_st.logseries(D_arr_like_0p5) 的返回类型是否为 np.long
assert_type(random_st.logseries(D_arr_like_0p5), npt.NDArray[np.long])

# 检查 random_st.logseries(D_arr_like_0p5, size=1) 的返回类型是否为 np.long
assert_type(random_st.logseries(D_arr_like_0p5, size=1), npt.NDArray[np.long])

# 检查 random_st.rayleigh(0.5) 的返回类型是否为 float
assert_type(random_st.rayleigh(0.5), float)

# 检查 random_st.rayleigh(0.5, size=None) 的返回类型是否为 float
assert_type(random_st.rayleigh(0.5, size=None), float)

# 检查 random_st.rayleigh(0.5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.rayleigh(0.5, size=1), npt.NDArray[np.float64])

# 检查 random_st.rayleigh(D_arr_0p5) 的返回类型是否为 np.float64
assert_type(random_st.rayleigh(D_arr_0p5), npt.NDArray[np.float64])

# 检查 random_st.rayleigh(D_arr_0p5, size=1) 的返回类型是否为 np.float64
assert_type(random_st.rayleigh(D_arr_0p5, size=1), npt.NDArray[np.float64])

# 检查 random_st.rayleigh(D_arr_like_0p5) 的返回类型是否为 np.float64
assert_type(random_st.ray
# 使用 assert_type 函数验证 random_st.standard_gamma 函数返回值的类型是否为 float
assert_type(random_st.standard_gamma(0.5, size=None), float)

# 使用 assert_type 函数验证 random_st.standard_gamma 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64
assert_type(random_st.standard_gamma(0.5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.standard_gamma 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_0p5
assert_type(random_st.standard_gamma(D_arr_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.standard_gamma 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_0p5,并指定生成数组的大小为 1
assert_type(random_st.standard_gamma(D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.standard_gamma 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_like_0p5
assert_type(random_st.standard_gamma(D_arr_like_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.standard_gamma 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_like_0p5,并指定生成数组的大小为 1
assert_type(random_st.standard_gamma(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.standard_gamma 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_like_0p5,并指定生成数组的大小为 1
assert_type(random_st.standard_gamma(D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 float
assert_type(random_st.vonmises(0.5, 0.5), float)

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 float
assert_type(random_st.vonmises(0.5, 0.5, size=None), float)

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64
assert_type(random_st.vonmises(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_0p5 和 0.5
assert_type(random_st.vonmises(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 0.5 和 D_arr_0p5
assert_type(random_st.vonmises(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_0p5 和 0.5,并指定生成数组的大小为 1
assert_type(random_st.vonmises(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 0.5 和 D_arr_like_0p5,并指定生成数组的大小为 1
assert_type(random_st.vonmises(0.5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_like_0p5 和 0.5
assert_type(random_st.vonmises(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 0.5 和 D_arr_like_0p5
assert_type(random_st.vonmises(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_0p5 和 D_arr_0p5
assert_type(random_st.vonmises(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_like_0p5 和 D_arr_like_0p5
assert_type(random_st.vonmises(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_0p5 和 D_arr_0p5,并指定生成数组的大小为 1
assert_type(random_st.vonmises(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.vonmises 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_like_0p5 和 D_arr_like_0p5,并指定生成数组的大小为 1
assert_type(random_st.vonmises(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.wald 函数返回值的类型是否为 float
assert_type(random_st.wald(0.5, 0.5), float)

# 使用 assert_type 函数验证 random_st.wald 函数返回值的类型是否为 float
assert_type(random_st.wald(0.5, 0.5, size=None), float)

# 使用 assert_type 函数验证 random_st.wald 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64
assert_type(random_st.wald(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.wald 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_0p5 和 0.5
assert_type(random_st.wald(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.wald 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 0.5 和 D_arr_0p5
assert_type(random_st.wald(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.wald 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_0p5 和 0.5,并指定生成数组的大小为 1
assert_type(random_st.wald(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.wald 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 0.5 和 D_arr_0p5,并指定生成数组的大小为 1
assert_type(random_st.wald(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.wald 函数返回值的类型是否为 numpy 数组,元素类型为 np.float64,
# 输入参数为 D_arr_like_0p5 和 0.5
assert_type(random_st.wald(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 使用 assert_type 函数验证 random_st.wald 函数返回值的类型是否为 numpy 数组,元素
# 确保 random_st.uniform 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.uniform(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])
# 确保 random_st.uniform 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.uniform(0.5, D_arr_like_0p5), npt.NDArray[np.float64])
# 确保 random_st.uniform 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.uniform(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])
# 确保 random_st.uniform 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.uniform(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])
# 确保 random_st.uniform 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.uniform(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 确保 random_st.uniform 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.uniform(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 确保 random_st.beta 返回的值是 float 类型
assert_type(random_st.beta(0.5, 0.5), float)
# 确保 random_st.beta 返回的值是 float 类型
assert_type(random_st.beta(0.5, 0.5, size=None), float)
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(0.5, 0.5, size=1), npt.NDArray[np.float64])
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(D_arr_0p5, 0.5), npt.NDArray[np.float64])
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(0.5, D_arr_0p5), npt.NDArray[np.float64])
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(0.5, D_arr_like_0p5), npt.NDArray[np.float64])
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 确保 random_st.beta 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.beta(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 确保 random_st.f 返回的值是 float 类型
assert_type(random_st.f(0.5, 0.5), float)
# 确保 random_st.f 返回的值是 float 类型
assert_type(random_st.f(0.5, 0.5, size=None), float)
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(0.5, 0.5, size=1), npt.NDArray[np.float64])
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(D_arr_0p5, 0.5), npt.NDArray[np.float64])
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(0.5, D_arr_0p5), npt.NDArray[np.float64])
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(0.5, D_arr_like_0p5), npt.NDArray[np.float64])
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 确保 random_st.f 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.f(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 确保 random_st.gamma 返回的值是 float 类型
assert_type(random_st.gamma(0.5, 0.5), float)
# 确保 random_st.gamma 返回的值是 float 类型
assert_type(random_st.gamma(0.5, 0.5, size=None), float)
# 确保 random_st.gamma 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.gamma(0.5, 0.5, size=1), npt.NDArray[np.float64])
# 确保 random_st.gamma 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.gamma(D_arr_0p5, 0.5), npt.NDArray[np.float64])
# 确保 random_st.gamma 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.gamma(0.5, D_arr_0p5), npt.NDArray[np.float64])
# 确保 random_st.gamma 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.gamma(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])
# 确保 random_st.gamma 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.gamma(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 确保 random_st.gamma 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.gamma(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])
# 确保 random_st.gamma 返回的值是 npt.NDArray[np.float64] 类型
assert_type(random_st.gamma(0.5, D_arr_like_0p
# 验证 random_st.gamma 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gamma(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])
# 验证 random_st.gamma 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gamma(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])
# 验证 random_st.gamma 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gamma(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 验证 random_st.gamma 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gamma(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.gumbel 函数返回的结果类型为 float
assert_type(random_st.gumbel(0.5, 0.5), float)
# 验证 random_st.gumbel 函数返回的结果类型为 float
assert_type(random_st.gumbel(0.5, 0.5, size=None), float)
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(0.5, 0.5, size=1), npt.NDArray[np.float64])
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(D_arr_0p5, 0.5), npt.NDArray[np.float64])
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(0.5, D_arr_0p5), npt.NDArray[np.float64])
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(0.5, D_arr_like_0p5), npt.NDArray[np.float64])
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 验证 random_st.gumbel 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.gumbel(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.laplace 函数返回的结果类型为 float
assert_type(random_st.laplace(0.5, 0.5), float)
# 验证 random_st.laplace 函数返回的结果类型为 float
assert_type(random_st.laplace(0.5, 0.5, size=None), float)
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(0.5, 0.5, size=1), npt.NDArray[np.float64])
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(D_arr_0p5, 0.5), npt.NDArray[np.float64])
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(0.5, D_arr_0p5), npt.NDArray[np.float64])
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(0.5, D_arr_like_0p5), npt.NDArray[np.float64])
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 验证 random_st.laplace 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.laplace(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.logistic 函数返回的结果类型为 float
assert_type(random_st.logistic(0.5, 0.5), float)
# 验证 random_st.logistic 函数返回的结果类型为 float
assert_type(random_st.logistic(0.5, 0.5, size=None), float)
# 验证 random_st.logistic 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.logistic(0.5, 0.5, size=1), npt.NDArray[np.float64])
# 验证 random_st.logistic 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.logistic(D_arr_0p5, 0.5), npt.NDArray[np.float64])
# 验证 random_st.logistic 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.logistic(0.5, D_arr_0p5), npt.NDArray[np.float64])
# 验证 random_st.logistic 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.logistic(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])
# 验证 random_st.logistic 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.logistic(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])
# 验证 random_st.logistic 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.logistic(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])
# 验证 random_st.logistic 函数返回的结果类型为 np.float64 的 NumPy 数组
assert_type(random_st.logistic(0.5, D_arr_like_0p5), npt.NDArray[np.float64])
# 验证 random_st.logistic 函数返回的结果类型为 np.float64
assert_type(random_st.logistic(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 验证 random_st.logistic 函数返回的结果类型为 np.float64
assert_type(random_st.logistic(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 验证 random_st.logistic 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.logistic(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.logistic 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.logistic(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 float
assert_type(random_st.lognormal(0.5, 0.5), float)

# 验证 random_st.lognormal 函数返回的结果类型为 float,且不指定返回数据的尺寸
assert_type(random_st.lognormal(0.5, 0.5, size=None), float)

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.lognormal(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64
assert_type(random_st.lognormal(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64
assert_type(random_st.lognormal(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.lognormal(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.lognormal(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64
assert_type(random_st.lognormal(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64
assert_type(random_st.lognormal(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64
assert_type(random_st.lognormal(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.lognormal(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.lognormal(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.lognormal 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.lognormal(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 float
assert_type(random_st.noncentral_chisquare(0.5, 0.5), float)

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 float,且不指定返回数据的尺寸
assert_type(random_st.noncentral_chisquare(0.5, 0.5, size=None), float)

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.noncentral_chisquare(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64
assert_type(random_st.noncentral_chisquare(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64
assert_type(random_st.noncentral_chisquare(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.noncentral_chisquare(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.noncentral_chisquare(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64
assert_type(random_st.noncentral_chisquare(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64
assert_type(random_st.noncentral_chisquare(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64
assert_type(random_st.noncentral_chisquare(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.noncentral_chisquare(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.noncentral_chisquare(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.noncentral_chisquare 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.noncentral_chisquare(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 验证 random_st.normal 函数返回的结果类型为 float
assert_type(random_st.normal(0.5, 0.5), float)

# 验证 random_st.normal 函数返回的结果类型为 float,且不指定返回数据的尺寸
assert_type(random_st.normal(0.5, 0.5, size=None), float)

# 验证 random_st.normal 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.normal(0.5, 0.5, size=1), npt.NDArray[np.float64])

# 验证 random_st.normal 函数返回的结果类型为 np.float64
assert_type(random_st.normal(D_arr_0p5, 0.5), npt.NDArray[np.float64])

# 验证 random_st.normal 函数返回的结果类型为 np.float64
assert_type(random_st.normal(0.5, D_arr_0p5), npt.NDArray[np.float64])

# 验证 random_st.normal 函数返回的结果类型为 np.float64,且指定返回数据的尺寸为 1
assert_type(random_st.normal(D_arr_0p5, 0.5, size=1), npt.NDArray[np.float64])
# 验证从正态分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.normal(0.5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 验证从正态分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.normal(D_arr_like_0p5, 0.5), npt.NDArray[np.float64])

# 验证从正态分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.normal(0.5, D_arr_like_0p5), npt.NDArray[np.float64])

# 验证从正态分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.normal(D_arr_0p5, D_arr_0p5), npt.NDArray[np.float64])

# 验证从正态分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.normal(D_arr_like_0p5, D_arr_like_0p5), npt.NDArray[np.float64])

# 验证从正态分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.normal(D_arr_0p5, D_arr_0p5, size=1), npt.NDArray[np.float64])

# 验证从正态分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.normal(D_arr_like_0p5, D_arr_like_0p5, size=1), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 float 类型
assert_type(random_st.triangular(0.1, 0.5, 0.9), float)

# 验证从三角分布中随机采样的值是否为 float 类型
assert_type(random_st.triangular(0.1, 0.5, 0.9, size=None), float)

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(0.1, 0.5, 0.9, size=1), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(D_arr_0p1, 0.5, 0.9), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(0.1, D_arr_0p5, 0.9), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(D_arr_0p1, 0.5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(0.1, D_arr_0p5, 0.9, size=1), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(D_arr_like_0p1, 0.5, D_arr_0p9), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(0.5, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(D_arr_0p1, D_arr_0p5, 0.9), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(D_arr_like_0p1, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(D_arr_0p1, D_arr_0p5, D_arr_0p9, size=1), npt.NDArray[np.float64])

# 验证从三角分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.triangular(D_arr_like_0p1, D_arr_like_0p5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 float 类型
assert_type(random_st.noncentral_f(0.1, 0.5, 0.9), float)

# 验证从非中心 F 分布中随机采样的值是否为 float 类型
assert_type(random_st.noncentral_f(0.1, 0.5, 0.9, size=None), float)

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(0.1, 0.5, 0.9, size=1), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(D_arr_0p1, 0.5, 0.9), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(0.1, D_arr_0p5, 0.9), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(D_arr_0p1, 0.5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(0.1, D_arr_0p5, 0.9, size=1), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(D_arr_like_0p1, 0.5, D_arr_0p9), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(0.5, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(D_arr_0p1, D_arr_0p5, 0.9), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(D_arr_like_0p1, D_arr_like_0p5, 0.9), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(D_arr_0p1, D_arr_0p5, D_arr_0p9, size=1), npt.NDArray[np.float64])

# 验证从非中心 F 分布中随机采样的值是否为 numpy.float64 类型
assert_type(random_st.noncentral_f(D_arr_like_0p1, D_arr_like_0p5, D_arr_like_0p9, size=1), npt.NDArray[np.float64])

# 验证从二项分布中随机采样的值是否为 int 类型
assert_type(random_st.binomial(10, 0.5), int)

# 验证从二项分
# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型
assert_type(random_st.binomial(10, 0.5, size=1), npt.NDArray[np.long])

# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_10 和 0.5
assert_type(random_st.binomial(I_arr_10, 0.5), npt.NDArray[np.long])

# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型,传入参数 10 和 D_arr_0p5
assert_type(random_st.binomial(10, D_arr_0p5), npt.NDArray[np.long])

# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_10、0.5 和 size=1
assert_type(random_st.binomial(I_arr_10, 0.5, size=1), npt.NDArray[np.long])

# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型,传入参数 10、D_arr_0p5 和 size=1
assert_type(random_st.binomial(10, D_arr_0p5, size=1), npt.NDArray[np.long])

# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_like_10 和 0.5
assert_type(random_st.binomial(I_arr_like_10, 0.5), npt.NDArray[np.long])

# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型,传入参数 10 和 D_arr_like_0p5
assert_type(random_st.binomial(10, D_arr_like_0p5), npt.NDArray[np.long])

# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_10 和 D_arr_0p5
assert_type(random_st.binomial(I_arr_10, D_arr_0p5), npt.NDArray[np.long])

# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_like_10、D_arr_like_0p5
assert_type(random_st.binomial(I_arr_like_10, D_arr_like_0p5), npt.NDArray[np.long])

# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_10、D_arr_0p5 和 size=1
assert_type(random_st.binomial(I_arr_10, D_arr_0p5, size=1), npt.NDArray[np.long])

# 验证 random_st.binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_like_10、D_arr_like_0p5 和 size=1
assert_type(random_st.binomial(I_arr_like_10, D_arr_like_0p5, size=1), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 int 类型,传入参数 10 和 0.5
assert_type(random_st.negative_binomial(10, 0.5), int)

# 验证 random_st.negative_binomial 函数的返回类型是否为 int 类型,传入参数 10、0.5 和 size=None
assert_type(random_st.negative_binomial(10, 0.5, size=None), int)

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 10、0.5 和 size=1
assert_type(random_st.negative_binomial(10, 0.5, size=1), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_10 和 0.5
assert_type(random_st.negative_binomial(I_arr_10, 0.5), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 10 和 D_arr_0p5
assert_type(random_st.negative_binomial(10, D_arr_0p5), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_10、0.5 和 size=1
assert_type(random_st.negative_binomial(I_arr_10, 0.5, size=1), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 10、D_arr_0p5 和 size=1
assert_type(random_st.negative_binomial(10, D_arr_0p5, size=1), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_like_10 和 0.5
assert_type(random_st.negative_binomial(I_arr_like_10, 0.5), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 10 和 D_arr_like_0p5
assert_type(random_st.negative_binomial(10, D_arr_like_0p5), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_10 和 D_arr_0p5
assert_type(random_st.negative_binomial(I_arr_10, D_arr_0p5), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_like_10 和 D_arr_like_0p5
assert_type(random_st.negative_binomial(I_arr_like_10, D_arr_like_0p5), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_10、D_arr_0p5 和 size=1
assert_type(random_st.negative_binomial(I_arr_10, D_arr_0p5, size=1), npt.NDArray[np.long])

# 验证 random_st.negative_binomial 函数的返回类型是否为 np.long 类型,传入参数 I_arr_like_10、D_arr_like_0p5 和 size=1
assert_type(random_st.negative_binomial(I_arr_like_10, D_arr_like_0p5, size=1), npt.NDArray[np.long])

# 验证 random_st.hypergeometric 函数的返回类型是否为 int 类型,传入参数 20、20 和 10
assert_type(random_st.hypergeometric(20, 20, 10), int)

# 验证 random_st.hypergeometric 函数的返回类型是否为 int 类型,传入参数 20、20、10 和 size=None
assert_type(random_st.hypergeometric(20, 20, 10, size=None), int)

# 验证 random_st.hypergeometric 函数的返回类型是否为 np.long 类型,传入参数 20、20、10 和 size=1
assert_type(random_st.hypergeometric(20, 20, 10, size=1), npt.NDArray[np.long])

# 验证 random_st.hypergeometric 函数的返回类型是否为 np.long 类型,传入参数 I_arr_20、20 和 10
assert_type(random_st.hypergeometric(I_arr_20, 20, 10), npt.NDArray[np.long])

# 验证 random_st.hypergeometric 函数的返回类型是否为 np.long 类型,传入参数 20、I_arr_20 和 10
assert_type(random_st.hypergeometric(20, I_arr_20, 10), npt.NDArray[np.long])

# 验证 random_st.hypergeometric 函数的返回类型是否为 np.long 类型,传入参数 I_arr_20、20、I_arr_like_10 和 size=1
assert_type(random_st.hypergeometric(I_arr_20, 20, I_arr_like_10, size=1), npt.NDArray[np.long])

# 验证 random_st.hypergeometric 函数的返回类型是否为 np.long 类型,传入参数 20、I_arr_20、10 和 size=1
assert_type(random_st.hypergeometric(20, I_arr_20, 10, size=1), npt.NDArray[np.long])

# 验证 random_st.hypergeometric 函数的返回类型是否为 np.long 类型,传入参数 I_arr_like_20、20 和 I_arr_10
assert_type(random_st.hypergeometric(I_arr_like_20, 20, I_arr_10), npt.NDArray[np.long])

# 验证 random_st.hypergeometric 函数的返回类型是否为 np.long 类型
# 确保 hypergeometric 函数返回的类型为 np.long 的 NumPy 数组
assert_type(random_st.hypergeometric(I_arr_like_20, I_arr_like_20, I_arr_like_10, size=1), npt.NDArray[np.long])

# 确保 randint 函数返回的类型为 int
assert_type(random_st.randint(0, 100), int)
assert_type(random_st.randint(100), int)
# 确保 randint 函数返回的类型为包含 np.long 类型元素的 NumPy 数组
assert_type(random_st.randint([100]), npt.NDArray[np.long])
# 确保 randint 函数返回的类型为包含 np.long 类型元素的 NumPy 数组
assert_type(random_st.randint(0, [100]), npt.NDArray[np.long])

# 确保 randint 函数返回的类型为 bool
assert_type(random_st.randint(2, dtype=bool), bool)
assert_type(random_st.randint(0, 2, dtype=bool), bool)
# 确保 randint 函数返回的类型为包含 np.bool 类型元素的 NumPy 数组
assert_type(random_st.randint(I_bool_high_open, dtype=bool), npt.NDArray[np.bool])
assert_type(random_st.randint(I_bool_low, I_bool_high_open, dtype=bool), npt.NDArray[np.bool])
assert_type(random_st.randint(0, I_bool_high_open, dtype=bool), npt.NDArray[np.bool])

# 确保 randint 函数返回的类型为 np.bool
assert_type(random_st.randint(2, dtype=np.bool), np.bool)
assert_type(random_st.randint(0, 2, dtype=np.bool), np.bool)
# 确保 randint 函数返回的类型为包含 np.bool 类型元素的 NumPy 数组
assert_type(random_st.randint(I_bool_high_open, dtype=np.bool), npt.NDArray[np.bool])
assert_type(random_st.randint(I_bool_low, I_bool_high_open, dtype=np.bool), npt.NDArray[np.bool])
assert_type(random_st.randint(0, I_bool_high_open, dtype=np.bool), npt.NDArray[np.bool])

# 确保 randint 函数返回的类型为 np.uint8
assert_type(random_st.randint(256, dtype="u1"), np.uint8)
assert_type(random_st.randint(0, 256, dtype="u1"), np.uint8)
# 确保 randint 函数返回的类型为包含 np.uint8 类型元素的 NumPy 数组
assert_type(random_st.randint(I_u1_high_open, dtype="u1"), npt.NDArray[np.uint8])
assert_type(random_st.randint(I_u1_low, I_u1_high_open, dtype="u1"), npt.NDArray[np.uint8])
assert_type(random_st.randint(0, I_u1_high_open, dtype="u1"), npt.NDArray[np.uint8])

# 确保 randint 函数返回的类型为 np.uint8
assert_type(random_st.randint(256, dtype="uint8"), np.uint8)
assert_type(random_st.randint(0, 256, dtype="uint8"), np.uint8)
# 确保 randint 函数返回的类型为包含 np.uint8 类型元素的 NumPy 数组
assert_type(random_st.randint(I_u1_high_open, dtype="uint8"), npt.NDArray[np.uint8])
assert_type(random_st.randint(I_u1_low, I_u1_high_open, dtype="uint8"), npt.NDArray[np.uint8])
assert_type(random_st.randint(0, I_u1_high_open, dtype="uint8"), npt.NDArray[np.uint8])

# 确保 randint 函数返回的类型为 np.uint8
assert_type(random_st.randint(256, dtype=np.uint8), np.uint8)
assert_type(random_st.randint(0, 256, dtype=np.uint8), np.uint8)
# 确保 randint 函数返回的类型为包含 np.uint8 类型元素的 NumPy 数组
assert_type(random_st.randint(I_u1_high_open, dtype=np.uint8), npt.NDArray[np.uint8])
assert_type(random_st.randint(I_u1_low, I_u1_high_open, dtype=np.uint8), npt.NDArray[np.uint8])
assert_type(random_st.randint(0, I_u1_high_open, dtype=np.uint8), npt.NDArray[np.uint8])

# 确保 randint 函数返回的类型为 np.uint16
assert_type(random_st.randint(65536, dtype="u2"), np.uint16)
assert_type(random_st.randint(0, 65536, dtype="u2"), np.uint16)
# 确保 randint 函数返回的类型为包含 np.uint16 类型元素的 NumPy 数组
assert_type(random_st.randint(I_u2_high_open, dtype="u2"), npt.NDArray[np.uint16])
assert_type(random_st.randint(I_u2_low, I_u2_high_open, dtype="u2"), npt.NDArray[np.uint16])
assert_type(random_st.randint(0, I_u2_high_open, dtype="u2"), npt.NDArray[np.uint16])

# 确保 randint 函数返回的类型为 np.uint16
assert_type(random_st.randint(65536, dtype="uint16"), np.uint16)
assert_type(random_st.randint(0, 65536, dtype="uint16"), np.uint16)
# 确保 randint 函数返回的类型为包含 np.uint16 类型元素的 NumPy 数组
assert_type(random_st.randint(I_u2_high_open, dtype="uint16"), npt.NDArray[np.uint16])
assert_type(random_st.randint(I_u2_low, I_u2_high_open, dtype="uint16"), npt.NDArray[np.uint16])
# 检查随机生成的无符号 16 位整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(0, I_u2_high_open, dtype="uint16"), npt.NDArray[np.uint16])

# 检查随机生成的无符号 16 位整数类型的随机数是否与 numpy 的 np.uint16 类型相匹配
assert_type(random_st.randint(65536, dtype=np.uint16), np.uint16)

# 检查随机生成的无符号 16 位整数类型的随机数是否在指定范围内,并与 numpy 的 np.uint16 类型相匹配
assert_type(random_st.randint(0, 65536, dtype=np.uint16), np.uint16)

# 检查随机生成的无符号 16 位整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(I_u2_high_open, dtype=np.uint16), npt.NDArray[np.uint16])

# 检查随机生成的无符号 16 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(I_u2_low, I_u2_high_open, dtype=np.uint16), npt.NDArray[np.uint16])

# 检查随机生成的无符号 16 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, I_u2_high_open, dtype=np.uint16), npt.NDArray[np.uint16])

# 检查随机生成的无符号 32 位整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(4294967296, dtype="u4"), np.uint32)

# 检查随机生成的无符号 32 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, 4294967296, dtype="u4"), np.uint32)

# 检查随机生成的无符号 32 位整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(I_u4_high_open, dtype="u4"), npt.NDArray[np.uint32])

# 检查随机生成的无符号 32 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(I_u4_low, I_u4_high_open, dtype="u4"), npt.NDArray[np.uint32])

# 检查随机生成的无符号 32 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, I_u4_high_open, dtype="u4"), npt.NDArray[np.uint32])

# 检查随机生成的无符号 32 位整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(4294967296, dtype="uint32"), np.uint32)

# 检查随机生成的无符号 32 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, 4294967296, dtype="uint32"), np.uint32)

# 检查随机生成的无符号 32 位整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(I_u4_high_open, dtype="uint32"), npt.NDArray[np.uint32])

# 检查随机生成的无符号 32 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(I_u4_low, I_u4_high_open, dtype="uint32"), npt.NDArray[np.uint32])

# 检查随机生成的无符号 32 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, I_u4_high_open, dtype="uint32"), npt.NDArray[np.uint32])

# 检查随机生成的无符号 32 位整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(4294967296, dtype=np.uint32), np.uint32)

# 检查随机生成的无符号 32 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, 4294967296, dtype=np.uint32), np.uint32)

# 检查随机生成的无符号 32 位整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(I_u4_high_open, dtype=np.uint32), npt.NDArray[np.uint32])

# 检查随机生成的无符号 32 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(I_u4_low, I_u4_high_open, dtype=np.uint32), npt.NDArray[np.uint32])

# 检查随机生成的无符号 32 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, I_u4_high_open, dtype=np.uint32), npt.NDArray[np.uint32])

# 检查随机生成的无符号整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(4294967296, dtype=np.uint), np.uint)

# 检查随机生成的无符号整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, 4294967296, dtype=np.uint), np.uint)

# 检查随机生成的无符号整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(I_u4_high_open, dtype=np.uint), npt.NDArray[np.uint])

# 检查随机生成的无符号整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(I_u4_low, I_u4_high_open, dtype=np.uint), npt.NDArray[np.uint])

# 检查随机生成的无符号整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, I_u4_high_open, dtype=np.uint), npt.NDArray[np.uint])

# 检查随机生成的无符号 64 位整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(18446744073709551616, dtype="u8"), np.uint64)

# 检查随机生成的无符号 64 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, 18446744073709551616, dtype="u8"), np.uint64)

# 检查随机生成的无符号 64 位整数类型的随机数是否与给定的类型相匹配
assert_type(random_st.randint(I_u8_high_open, dtype="u8"), npt.NDArray[np.uint64])

# 检查随机生成的无符号 64 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(I_u8_low, I_u8_high_open, dtype="u8"), npt.NDArray[np.uint64])

# 检查随机生成的无符号 64 位整数类型的随机数是否在指定范围内,并与给定的类型相匹配
assert_type(random_st.randint(0, I_u8_high_open, dtype="u8"), npt.NDArray[np.uint64])

# 检
# 验证从随机数生成器中生成的无符号64位整数是否为numpy数组中的uint64类型
assert_type(random_st.randint(0, I_u8_high_open, dtype="uint64"), npt.NDArray[np.uint64])

# 验证从随机数生成器中生成的np.uint64类型整数是否为np.uint64类型
assert_type(random_st.randint(18446744073709551616, dtype=np.uint64), np.uint64)

# 验证从随机数生成器中生成的范围在[0, 18446744073709551616)之间的np.uint64类型整数是否为np.uint64类型
assert_type(random_st.randint(0, 18446744073709551616, dtype=np.uint64), np.uint64)

# 验证从随机数生成器中生成的大于I_u8_high_open的np.uint64类型整数是否为numpy数组中的uint64类型
assert_type(random_st.randint(I_u8_high_open, dtype=np.uint64), npt.NDArray[np.uint64])

# 验证从随机数生成器中生成的范围在[I_u8_low, I_u8_high_open)之间的np.uint64类型整数是否为numpy数组中的uint64类型
assert_type(random_st.randint(I_u8_low, I_u8_high_open, dtype=np.uint64), npt.NDArray[np.uint64])

# 验证从随机数生成器中生成的范围在[0, I_u8_high_open)之间的np.uint64类型整数是否为numpy数组中的uint64类型
assert_type(random_st.randint(0, I_u8_high_open, dtype=np.uint64), npt.NDArray[np.uint64])

# 验证从随机数生成器中生成的int8类型整数是否为np.int8类型
assert_type(random_st.randint(128, dtype="i1"), np.int8)

# 验证从随机数生成器中生成的范围在[-128, 128)之间的np.int8类型整数是否为np.int8类型
assert_type(random_st.randint(-128, 128, dtype="i1"), np.int8)

# 验证从随机数生成器中生成的大于I_i1_high_open的np.int8类型整数是否为numpy数组中的int8类型
assert_type(random_st.randint(I_i1_high_open, dtype="i1"), npt.NDArray[np.int8])

# 验证从随机数生成器中生成的范围在[I_i1_low, I_i1_high_open)之间的np.int8类型整数是否为numpy数组中的int8类型
assert_type(random_st.randint(I_i1_low, I_i1_high_open, dtype="i1"), npt.NDArray[np.int8])

# 验证从随机数生成器中生成的范围在[-128, I_i1_high_open)之间的np.int8类型整数是否为numpy数组中的int8类型
assert_type(random_st.randint(-128, I_i1_high_open, dtype="i1"), npt.NDArray[np.int8])

# 验证从随机数生成器中生成的int8类型整数是否为np.int8类型
assert_type(random_st.randint(128, dtype="int8"), np.int8)

# 验证从随机数生成器中生成的范围在[-128, 128)之间的np.int8类型整数是否为np.int8类型
assert_type(random_st.randint(-128, 128, dtype="int8"), np.int8)

# 验证从随机数生成器中生成的大于I_i1_high_open的np.int8类型整数是否为numpy数组中的int8类型
assert_type(random_st.randint(I_i1_high_open, dtype="int8"), npt.NDArray[np.int8])

# 验证从随机数生成器中生成的范围在[I_i1_low, I_i1_high_open)之间的np.int8类型整数是否为numpy数组中的int8类型
assert_type(random_st.randint(I_i1_low, I_i1_high_open, dtype="int8"), npt.NDArray[np.int8])

# 验证从随机数生成器中生成的范围在[-128, I_i1_high_open)之间的np.int8类型整数是否为numpy数组中的int8类型
assert_type(random_st.randint(-128, I_i1_high_open, dtype="int8"), npt.NDArray[np.int8])

# 验证从随机数生成器中生成的int8类型整数是否为np.int8类型
assert_type(random_st.randint(128, dtype=np.int8), np.int8)

# 验证从随机数生成器中生成的范围在[-128, 128)之间的np.int8类型整数是否为np.int8类型
assert_type(random_st.randint(-128, 128, dtype=np.int8), np.int8)

# 验证从随机数生成器中生成的大于I_i1_high_open的np.int8类型整数是否为numpy数组中的int8类型
assert_type(random_st.randint(I_i1_high_open, dtype=np.int8), npt.NDArray[np.int8])

# 验证从随机数生成器中生成的范围在[I_i1_low, I_i1_high_open)之间的np.int8类型整数是否为numpy数组中的int8类型
assert_type(random_st.randint(I_i1_low, I_i1_high_open, dtype=np.int8), npt.NDArray[np.int8])

# 验证从随机数生成器中生成的范围在[-128, I_i1_high_open)之间的np.int8类型整数是否为numpy数组中的int8类型
assert_type(random_st.randint(-128, I_i1_high_open, dtype=np.int8), npt.NDArray[np.int8])

# 验证从随机数生成器中生成的int16类型整数是否为np.int16类型
assert_type(random_st.randint(32768, dtype="i2"), np.int16)

# 验证从随机数生成器中生成的范围在[-32768, 32768)之间的np.int16类型整数是否为np.int16类型
assert_type(random_st.randint(-32768, 32768, dtype="i2"), np.int16)

# 验证从随机数生成器中生成的大于I_i2_high_open的np.int16类型整数是否为numpy数组中的int16类型
assert_type(random_st.randint(I_i2_high_open, dtype="i2"), npt.NDArray[np.int16])

# 验证从随机数生成器中生成的范围在[I_i2_low, I_i2_high_open)之间的np.int16类型整数是否为numpy数组中的int16类型
assert_type(random_st.randint(I_i2_low, I_i2_high_open, dtype="i2"), npt.NDArray[np.int16])

# 验证从随机数生成器中生成的范围在[-32768, I_i2_high_open)之间的np.int16类型整数是否为numpy数组中的int16类型
assert_type(random_st.randint(-32768, I_i2_high_open, dtype="i2"), npt.NDArray[np.int16])

# 验证从随机数生成器中生成的int16类型整数是否为np.int16类型
assert_type(random_st.randint(32768, dtype="int16"), np.int16)

# 验证从随机数生成器中生成的范围在[-32768, 32768)之间的np.int16类型整数是否为np.int16类型
assert_type(random_st.randint(-32768, 32768, dtype="int16"), np.int16)

# 验证从随机数生成器中生成的大于I_i2_high_open的np.int16类型整数是否为numpy数组中的int16类型
assert_type(random_st.randint(I_i2_high_open, dtype="int16"), npt.NDArray[np.int16])

# 验证从随机数生成器中生成的范围在[I_i2_low, I_i2_high_open)之间的np.int16类型整数是否为numpy数组中的int16类型
assert_type(random_st.randint(I_i2_low, I_i2_high_open, dtype="int16"), npt.NDArray[np.int16])

# 验证从随机数生成器中生成的范围在[-32768, I_i2_high_open)之间的np.int16类型整数是否为numpy数组中的int16类型
assert_type(random_st.randint(-32768, I_i2_high_open, dtype="int16"), npt.NDArray[np.int16])

# 验证从随机数生成器中生成的int16类型整数是否为np.int16类型
# 确保生成的随机数类型为 np.int32
assert_type(random_st.randint(-2147483648, 2147483648, dtype="i4"), np.int32)
# 确保生成的随机数类型为 npt.NDArray[np.int32]
assert_type(random_st.randint(I_i4_high_open, dtype="i4"), npt.NDArray[np.int32])
# 确保生成的随机数类型为 npt.NDArray[np.int32]
assert_type(random_st.randint(I_i4_low, I_i4_high_open, dtype="i4"), npt.NDArray[np.int32])
# 确保生成的随机数类型为 npt.NDArray[np.int32]
assert_type(random_st.randint(-2147483648, I_i4_high_open, dtype="i4"), npt.NDArray[np.int32])

# 确保生成的随机数类型为 np.int32
assert_type(random_st.randint(2147483648, dtype="int32"), np.int32)
# 确保生成的随机数类型为 np.int32
assert_type(random_st.randint(-2147483648, 2147483648, dtype="int32"), np.int32)
# 确保生成的随机数类型为 npt.NDArray[np.int32]
assert_type(random_st.randint(I_i4_high_open, dtype="int32"), npt.NDArray[np.int32])
# 确保生成的随机数类型为 npt.NDArray[np.int32]
assert_type(random_st.randint(I_i4_low, I_i4_high_open, dtype="int32"), npt.NDArray[np.int32])
# 确保生成的随机数类型为 npt.NDArray[np.int32]
assert_type(random_st.randint(-2147483648, I_i4_high_open, dtype="int32"), npt.NDArray[np.int32])

# 确保生成的随机数类型为 np.int32
assert_type(random_st.randint(2147483648, dtype=np.int32), np.int32)
# 确保生成的随机数类型为 np.int32
assert_type(random_st.randint(-2147483648, 2147483648, dtype=np.int32), np.int32)
# 确保生成的随机数类型为 npt.NDArray[np.int32]
assert_type(random_st.randint(I_i4_high_open, dtype=np.int32), npt.NDArray[np.int32])
# 确保生成的随机数类型为 npt.NDArray[np.int32]
assert_type(random_st.randint(I_i4_low, I_i4_high_open, dtype=np.int32), npt.NDArray[np.int32])
# 确保生成的随机数类型为 npt.NDArray[np.int32]
assert_type(random_st.randint(-2147483648, I_i4_high_open, dtype=np.int32), npt.NDArray[np.int32])

# 确保生成的随机数类型为 np.int_
assert_type(random_st.randint(9223372036854775808, dtype=np.int_), np.int_)
# 确保生成的随机数类型为 np.int_
assert_type(random_st.randint(-9223372036854775808, 9223372036854775808, dtype=np.int_), np.int_)
# 确保生成的随机数类型为 npt.NDArray[np.int_]
assert_type(random_st.randint(I_i4_high_open, dtype=np.int_), npt.NDArray[np.int_])
# 确保生成的随机数类型为 npt.NDArray[np.int_]
assert_type(random_st.randint(I_i4_low, I_i4_high_open, dtype=np.int_), npt.NDArray[np.int_])
# 确保生成的随机数类型为 npt.NDArray[np.int_]
assert_type(random_st.randint(-2147483648, I_i4_high_open, dtype=np.int_), npt.NDArray[np.int_])

# 确保生成的随机数类型为 np.int64
assert_type(random_st.randint(9223372036854775808, dtype="i8"), np.int64)
# 确保生成的随机数类型为 np.int64
assert_type(random_st.randint(-9223372036854775808, 9223372036854775808, dtype="i8"), np.int64)
# 确保生成的随机数类型为 npt.NDArray[np.int64]
assert_type(random_st.randint(I_i8_high_open, dtype="i8"), npt.NDArray[np.int64])
# 确保生成的随机数类型为 npt.NDArray[np.int64]
assert_type(random_st.randint(I_i8_low, I_i8_high_open, dtype="i8"), npt.NDArray[np.int64])
# 确保生成的随机数类型为 npt.NDArray[np.int64]
assert_type(random_st.randint(-9223372036854775808, I_i8_high_open, dtype="i8"), npt.NDArray[np.int64])

# 确保生成的随机数类型为 np.int64
assert_type(random_st.randint(9223372036854775808, dtype="int64"), np.int64)
# 确保生成的随机数类型为 np.int64
assert_type(random_st.randint(-9223372036854775808, 9223372036854775808, dtype="int64"), np.int64)
# 确保生成的随机数类型为 npt.NDArray[np.int64]
assert_type(random_st.randint(I_i8_high_open, dtype="int64"), npt.NDArray[np.int64])
# 确保生成的随机数类型为 npt.NDArray[np.int64]
assert_type(random_st.randint(I_i8_low, I_i8_high_open, dtype="int64"), npt.NDArray[np.int64])
# 确保生成的随机数类型为 npt.NDArray[np.int64]
assert_type(random_st.randint(-9223372036854775808, I_i8_high_open, dtype="int64"), npt.NDArray[np.int64])

# 确保生成的随机数类型为 np.int64
assert_type(random_st.randint(9223372036854775808, dtype=np.int64), np.int64)
# 确保生成的随机数类型为 np.int64
assert_type(random_st.randint(-9223372036854775808, 9223372036854775808, dtype=np.int64), np.int64)
# 确保生成的随机数类型为 npt.NDArray[np.int64]
assert_type(random_st.randint(I_i8_high_open, dtype=np.int64), npt.NDArray[np.int64])
# 确保生成的随机数类型为 npt.NDArray[np.int64]
assert_type(random_st.randint(I_i8_low, I_i8_high_open, dtype=np.int64), npt.NDArray[np.int64])
# 检查生成的随机整数类型,范围从 -9223372036854775808 到 I_i8_high_open
assert_type(random_st.randint(-9223372036854775808, I_i8_high_open, dtype=np.int64), npt.NDArray[np.int64])

# 检查随机数生成器对象的类型
assert_type(random_st._bit_generator, np.random.BitGenerator)

# 检查生成的随机字节类型
assert_type(random_st.bytes(2), bytes)

# 检查随机选择单个整数的类型
assert_type(random_st.choice(5), int)
# 检查随机选择多个整数的类型
assert_type(random_st.choice(5, 3), npt.NDArray[np.long])
# 检查带有替换的多项式抽样的类型
assert_type(random_st.choice(5, 3, replace=True), npt.NDArray[np.long])
# 检查带有自定义概率分布的多项式抽样的类型
assert_type(random_st.choice(5, 3, p=[1 / 5] * 5), npt.NDArray[np.long])
# 检查不带替换和自定义概率分布的多项式抽样的类型
assert_type(random_st.choice(5, 3, p=[1 / 5] * 5, replace=False), npt.NDArray[np.long])

# 检查随机选择字符串列表中元素的类型
assert_type(random_st.choice(["pooh", "rabbit", "piglet", "Christopher"]), Any)
# 检查随机选择多个字符串列表中元素的类型
assert_type(random_st.choice(["pooh", "rabbit", "piglet", "Christopher"], 3), npt.NDArray[Any])
# 检查带有自定义概率分布的随机选择多个字符串列表中元素的类型
assert_type(random_st.choice(["pooh", "rabbit", "piglet", "Christopher"], 3, p=[1 / 4] * 4), npt.NDArray[Any])
# 检查带有替换的随机选择多个字符串列表中元素的类型
assert_type(random_st.choice(["pooh", "rabbit", "piglet", "Christopher"], 3, replace=True), npt.NDArray[Any])
# 检查带有自定义概率分布和不带替换的随机选择多个字符串列表中元素的类型
assert_type(random_st.choice(["pooh", "rabbit", "piglet", "Christopher"], 3, replace=False, p=np.array([1 / 8, 1 / 8, 1 / 2, 1 / 4])), npt.NDArray[Any])

# 检查 Dirichlet 分布生成的类型
assert_type(random_st.dirichlet([0.5, 0.5]), npt.NDArray[np.float64])
assert_type(random_st.dirichlet(np.array([0.5, 0.5])), npt.NDArray[np.float64])
assert_type(random_st.dirichlet(np.array([0.5, 0.5]), size=3), npt.NDArray[np.float64])

# 检查多项式分布生成的类型
assert_type(random_st.multinomial(20, [1 / 6.0] * 6), npt.NDArray[np.long])
assert_type(random_st.multinomial(20, np.array([0.5, 0.5])), npt.NDArray[np.long])
assert_type(random_st.multinomial(20, [1 / 6.0] * 6, size=2), npt.NDArray[np.long])

# 检查多变量正态分布生成的类型
assert_type(random_st.multivariate_normal([0.0], [[1.0]]), npt.NDArray[np.float64])
assert_type(random_st.multivariate_normal([0.0], np.array([[1.0]])), npt.NDArray[np.float64])
assert_type(random_st.multivariate_normal(np.array([0.0]), [[1.0]]), npt.NDArray[np.float64])
assert_type(random_st.multivariate_normal([0.0], np.array([[1.0]])), npt.NDArray[np.float64])

# 检查数组元素随机排列生成的类型
assert_type(random_st.permutation(10), npt.NDArray[np.long])
assert_type(random_st.permutation([1, 2, 3, 4]), npt.NDArray[Any])
assert_type(random_st.permutation(np.array([1, 2, 3, 4])), npt.NDArray[Any])
assert_type(random_st.permutation(D_2D), npt.NDArray[Any])

# 检查原地随机打乱数组的类型
assert_type(random_st.shuffle(np.arange(10)), None)
assert_type(random_st.shuffle([1, 2, 3, 4, 5]), None)
assert_type(random_st.shuffle(D_2D), None)

# 检查 RandomState 对象生成的类型
assert_type(np.random.RandomState(pcg64), np.random.RandomState)
assert_type(np.random.RandomState(0), np.random.RandomState)
assert_type(np.random.RandomState([0, 1, 2]), np.random.RandomState)
# 检查对象转换为字符串的类型
assert_type(random_st.__str__(), str)
# 检查对象表示形式的类型
assert_type(random_st.__repr__(), str)
# 检查获取状态字典的类型
random_st_state = random_st.__getstate__()
assert_type(random_st_state, dict[str, Any])
# 检查设置状态的方法返回的类型
assert_type(random_st.__setstate__(random_st_state), None)
# 检查设置种子的方法返回的类型
assert_type(random_st.seed(), None)
assert_type(random_st.seed(1), None)
assert_type(random_st.seed([0, 1]), None)
# 检查获取状态的方法返回的类型
random_st_get_state = random_st.get_state()
assert_type(random_st_state, dict[str, Any])
# 调用 random_st 对象的 get_state 方法,并设置 legacy 参数为 True,返回随机状态的字典或元组
random_st_get_state_legacy = random_st.get_state(legacy=True)

# 断言 random_st_get_state_legacy 的类型为 dict[str, Any] 或 tuple[str, npt.NDArray[np.uint32], int, int, float]
assert_type(random_st_get_state_legacy, dict[str, Any] | tuple[str, npt.NDArray[np.uint32], int, int, float])

# 调用 random_st 对象的 set_state 方法,并传入 random_st_get_state 的返回值作为参数,断言返回值为 None
assert_type(random_st.set_state(random_st_get_state), None)

# 断言 random_st 对象的 rand 方法返回类型为 float
assert_type(random_st.rand(), float)

# 断言 random_st 对象的 rand 方法传入参数 1 后返回类型为 npt.NDArray[np.float64]
assert_type(random_st.rand(1), npt.NDArray[np.float64])

# 断言 random_st 对象的 rand 方法传入参数 (1, 2) 后返回类型为 npt.NDArray[np.float64]
assert_type(random_st.rand(1, 2), npt.NDArray[np.float64])

# 断言 random_st 对象的 randn 方法返回类型为 float
assert_type(random_st.randn(), float)

# 断言 random_st 对象的 randn 方法传入参数 1 后返回类型为 npt.NDArray[np.float64]
assert_type(random_st.randn(1), npt.NDArray[np.float64])

# 断言 random_st 对象的 randn 方法传入参数 (1, 2) 后返回类型为 npt.NDArray[np.float64]
assert_type(random_st.randn(1, 2), npt.NDArray[np.float64])

# 断言 random_st 对象的 random_sample 方法返回类型为 float
assert_type(random_st.random_sample(), float)

# 断言 random_st 对象的 random_sample 方法传入参数 1 后返回类型为 npt.NDArray[np.float64]
assert_type(random_st.random_sample(1), npt.NDArray[np.float64])

# 断言 random_st 对象的 random_sample 方法传入参数 size=(1, 2) 后返回类型为 npt.NDArray[np.float64]
assert_type(random_st.random_sample(size=(1, 2)), npt.NDArray[np.float64])

# 断言 random_st 对象的 tomaxint 方法返回类型为 int
assert_type(random_st.tomaxint(), int)

# 断言 random_st 对象的 tomaxint 方法传入参数 1 后返回类型为 npt.NDArray[np.int64]
assert_type(random_st.tomaxint(1), npt.NDArray[np.int64])

# 断言 random_st 对象的 tomaxint 方法传入参数 (1,) 后返回类型为 npt.NDArray[np.int64]
assert_type(random_st.tomaxint((1,)), npt.NDArray[np.int64])

# 调用 np.random 的 set_bit_generator 方法,传入参数 pcg64,并断言返回值为 None
assert_type(np.random.set_bit_generator(pcg64), None)

# 断言调用 np.random 的 get_bit_generator 方法返回类型为 np.random.BitGenerator
assert_type(np.random.get_bit_generator(), np.random.BitGenerator)