o 6a8 @s:UdZddlmZddlZddlZz2ddlZddlm Z ddl m Z m Z ddl mZmZmZddlmZeje ge fZdZded <WneyWZzeZWYdZ[ndZ[wwgZd ed <d(ddZd)ddZeZded<eZded<d*ddZejsedurd+dd Z Gd!d"d"e Z!d,d%d&Z"dSd,d'd&Z"dS)-z6A module containing `numpy`-specific plugins for mypy.) annotationsN)Type)PluginAnalyzeTypeContext)MypyFile ImportFrom Statement)PRI_MEDzt.Optional[ModuleNotFoundError]MYPY_EX t.List[str]__all__returnt.Dict[str, str]c Csdtjfdtjfdtjfdtjfdtjfdtjfdtjfdtjfd tj fd tj fg }i}|D]\}}d |j j }d |d |d|<q.|S)N _NBitByte _NBitShort _NBitIntC _NBitIntP_NBitInt _NBitLongLong _NBitHalf _NBitSingle _NBitDouble_NBitLongDoubleznumpy._Bitnumpy.typing._nbit.) npbyteshortintcintpint_longlonghalfsingledouble longdoubledtypeitemsize)namesretnametypnr.:/usr/lib/python3/dist-packages/numpy/typing/mypy_plugin.py_get_precision_dicts  r0cs.tjtjtjtjg}hdfdd|DS)N> int128int256float80float96uint128uint256float128float256 complex160 complex192 complex256 complex512csg|] }|jvr|jqSr.)__name__).0iextended_namesr.r/ =sz0_get_extended_precision_list..)r ulonglongr"r& clongdouble)extended_typesr.r@r/_get_extended_precision_list-srFzt.Final_PRECISION_DICT_EXTENDED_PRECISION_LISTctxrrcCs2|\}}}|jdd}td|}||S)z;Replace a type-alias with a concrete ``NBitBase`` subclass..r)r+splitrG named_type)rIr,_apir+name_newr.r.r/_hookHs  rQiterablet.Iterable[Statement]idstrintcCs8t|D]\}}t|dd|kr|Sqtd|)z>Identify the first ``ImportFrom`` instance the specified `id`.rTNzBFailed to identify a `ImportFrom` instance with the following id: ) enumerategetattr ValueError)rRrTr?valuer.r.r/_indexQsr[c@s$eZdZdZdddZdd d Zd S) _NumpyPluginzCA plugin for assigning platform-specific `numpy.number` precisions.fullnamerUr t.Optional[_HookFunc]cCs|tvrtSdS)zSet the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdouble`. N)rGrQ)selfr]r.r.r/get_type_analyze_hook]sz"_NumpyPlugin.get_type_analyze_hookfilert.List[t.Tuple[int, str, int]]cCs^t|jdfg}|jdkr-tddddtDd}d|_|j|jfD] }t|d}|||<q!|S) zImport platform-specific extended-precision `numpy.number` subclasses. For example: `numpy.float96`, `numpy.float128` and `numpy.complex256`. rKnumpyz numpy.typing._extended_precisionrcSsg|]}||fqSr.r.)r>vr.r.r/rBqsz4_NumpyPlugin.get_additional_deps..)r)T)r r]rrH is_top_leveldefsimportsr[)r_rar*rglstr?r.r.r/get_additional_depsfs    z _NumpyPlugin.get_additional_depsN)r]rUr r^)rarr rb)r= __module__ __qualname____doc__r`rir.r.r.r/r\Zs  r\versiont.Type[_NumpyPlugin]cCstSzAn entry-point for mypy.)r\rmr.r.r/plugin|rqcCstro)r rpr.r.r/rqrr)r r)r r )rIrr r)rRrSrTrUr rV)rmrUr rn)#rl __future__rtypingtrcr mypy.typesmypyr mypy.pluginrr mypy.nodesrrr mypy.buildr Callable _HookFuncr __annotations__ModuleNotFoundErrorexr r0rFrGrHrQ TYPE_CHECKINGr[r\rqr.r.r.r/s6         "