__config__.pyi 2.3 KB

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