Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions src/numpy-stubs/__config__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
from enum import Enum
from types import ModuleType
from typing import Final, Literal as L, TypedDict, overload, type_check_only
from typing_extensions import NotRequired

Check failure on line 4 in src/numpy-stubs/__config__.pyi

View workflow job for this annotation

GitHub Actions / lint

Ruff (UP035)

src/numpy-stubs/__config__.pyi:4:1: UP035 Import from `typing` instead: `NotRequired`

_CompilerConfigDictValue = TypedDict(
"_CompilerConfigDictValue",
{
"name": str,
"linker": str,
"version": str,
"commands": str,
"args": str,
"linker args": str,
},
)
_CompilerConfigDict = TypedDict(
"_CompilerConfigDict",
{
"c": _CompilerConfigDictValue,
"cython": _CompilerConfigDictValue,
"c++": _CompilerConfigDictValue,
},
)
_MachineInformationDict = TypedDict(
"_MachineInformationDict",
{
"host": _MachineInformationDictValue,
"build": _MachineInformationDictValue,
"cross-compiled": NotRequired[L[True]],
},
)

@type_check_only
class _MachineInformationDictValue(TypedDict):
cpu: str
family: str
endian: L["little", "big"]
system: str

_BuildDependenciesDictValue = TypedDict(
"_BuildDependenciesDictValue",
{
"name": str,
"found": NotRequired[L[True]],
"version": str,
"include directory": str,
"lib directory": str,
"openblas configuration": str,
"pc file directory": str,
},
)

class _BuildDependenciesDict(TypedDict):
blas: _BuildDependenciesDictValue
lapack: _BuildDependenciesDictValue

class _PythonInformationDict(TypedDict):
path: str
version: str

_SIMDExtensionsDict = TypedDict(
"_SIMDExtensionsDict",
{
"baseline": list[str],
"found": list[str],
"not found": list[str],
},
)

_ConfigDict = TypedDict(
"_ConfigDict",
{
"Compilers": _CompilerConfigDict,
"Machine Information": _MachineInformationDict,
"Build Dependencies": _BuildDependenciesDict,
"Python Information": _PythonInformationDict,
"SIMD Extensions": _SIMDExtensionsDict,
},
)

###

__all__ = ["show_config"]

CONFIG: Final[_ConfigDict] = ...

class DisplayModes(Enum):
stdout = "stdout"
dicts = "dicts"

def _check_pyyaml() -> ModuleType: ...

@overload
def show(mode: L["stdout"] = "stdout") -> None: ...
@overload
def show(mode: L["dicts"]) -> _ConfigDict: ...

@overload
def show_config(mode: L["stdout"] = "stdout") -> None: ...
@overload
def show_config(mode: L["dicts"]) -> _ConfigDict: ...
Loading
Loading