__config__.pyi 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. from enum import Enum
  2. from types import ModuleType
  3. from typing import Final, Literal as L, TypedDict, overload, type_check_only
  4. from typing_extensions import NotRequired
  5. _CompilerConfigDictValue = TypedDict(
  6. "_CompilerConfigDictValue",
  7. {
  8. "name": str,
  9. "linker": str,
  10. "version": str,
  11. "commands": str,
  12. "args": str,
  13. "linker args": str,
  14. },
  15. )
  16. _CompilerConfigDict = TypedDict(
  17. "_CompilerConfigDict",
  18. {
  19. "c": _CompilerConfigDictValue,
  20. "cython": _CompilerConfigDictValue,
  21. "c++": _CompilerConfigDictValue,
  22. },
  23. )
  24. _MachineInformationDict = TypedDict(
  25. "_MachineInformationDict",
  26. {
  27. "host":_MachineInformationDictValue,
  28. "build": _MachineInformationDictValue,
  29. "cross-compiled": NotRequired[L[True]],
  30. },
  31. )
  32. @type_check_only
  33. class _MachineInformationDictValue(TypedDict):
  34. cpu: str
  35. family: str
  36. endian: L["little", "big"]
  37. system: str
  38. _BuildDependenciesDictValue = TypedDict(
  39. "_BuildDependenciesDictValue",
  40. {
  41. "name": str,
  42. "found": NotRequired[L[True]],
  43. "version": str,
  44. "include directory": str,
  45. "lib directory": str,
  46. "openblas configuration": str,
  47. "pc file directory": str,
  48. },
  49. )
  50. class _BuildDependenciesDict(TypedDict):
  51. blas: _BuildDependenciesDictValue
  52. lapack: _BuildDependenciesDictValue
  53. class _PythonInformationDict(TypedDict):
  54. path: str
  55. version: str
  56. _SIMDExtensionsDict = TypedDict(
  57. "_SIMDExtensionsDict",
  58. {
  59. "baseline": list[str],
  60. "found": list[str],
  61. "not found": list[str],
  62. },
  63. )
  64. _ConfigDict = TypedDict(
  65. "_ConfigDict",
  66. {
  67. "Compilers": _CompilerConfigDict,
  68. "Machine Information": _MachineInformationDict,
  69. "Build Dependencies": _BuildDependenciesDict,
  70. "Python Information": _PythonInformationDict,
  71. "SIMD Extensions": _SIMDExtensionsDict,
  72. },
  73. )
  74. ###
  75. __all__ = ["show_config"]
  76. CONFIG: Final[_ConfigDict] = ...
  77. class DisplayModes(Enum):
  78. stdout = "stdout"
  79. dicts = "dicts"
  80. def _check_pyyaml() -> ModuleType: ...
  81. @overload
  82. def show(mode: L["stdout"] = "stdout") -> None: ...
  83. @overload
  84. def show(mode: L["dicts"]) -> _ConfigDict: ...
  85. @overload
  86. def show_config(mode: L["stdout"] = "stdout") -> None: ...
  87. @overload
  88. def show_config(mode: L["dicts"]) -> _ConfigDict: ...