m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
4.6 KiB

6 months ago
  1. import sys
  2. from types import TracebackType
  3. from typing import Any, Optional, Callable, Union, Type
  4. # Using a private class is by no means ideal, but it is simply a consquence
  5. # of a `contextlib.context` returning an instance of aformentioned class
  6. from contextlib import _GeneratorContextManager
  7. from numpy import (
  8. ndarray,
  9. generic,
  10. bool_,
  11. integer,
  12. timedelta64,
  13. datetime64,
  14. floating,
  15. complexfloating,
  16. void,
  17. str_,
  18. bytes_,
  19. longdouble,
  20. clongdouble,
  21. )
  22. from numpy.typing import ArrayLike, _CharLike_co, _FloatLike_co
  23. if sys.version_info > (3, 8):
  24. from typing import Literal, TypedDict, SupportsIndex
  25. else:
  26. from typing_extensions import Literal, TypedDict, SupportsIndex
  27. _FloatMode = Literal["fixed", "unique", "maxprec", "maxprec_equal"]
  28. class _FormatDict(TypedDict, total=False):
  29. bool: Callable[[bool_], str]
  30. int: Callable[[integer[Any]], str]
  31. timedelta: Callable[[timedelta64], str]
  32. datetime: Callable[[datetime64], str]
  33. float: Callable[[floating[Any]], str]
  34. longfloat: Callable[[longdouble], str]
  35. complexfloat: Callable[[complexfloating[Any, Any]], str]
  36. longcomplexfloat: Callable[[clongdouble], str]
  37. void: Callable[[void], str]
  38. numpystr: Callable[[_CharLike_co], str]
  39. object: Callable[[object], str]
  40. all: Callable[[object], str]
  41. int_kind: Callable[[integer[Any]], str]
  42. float_kind: Callable[[floating[Any]], str]
  43. complex_kind: Callable[[complexfloating[Any, Any]], str]
  44. str_kind: Callable[[_CharLike_co], str]
  45. class _FormatOptions(TypedDict):
  46. precision: int
  47. threshold: int
  48. edgeitems: int
  49. linewidth: int
  50. suppress: bool
  51. nanstr: str
  52. infstr: str
  53. formatter: Optional[_FormatDict]
  54. sign: Literal["-", "+", " "]
  55. floatmode: _FloatMode
  56. legacy: Literal[False, "1.13"]
  57. def set_printoptions(
  58. precision: Optional[SupportsIndex] = ...,
  59. threshold: Optional[int] = ...,
  60. edgeitems: Optional[int] = ...,
  61. linewidth: Optional[int] = ...,
  62. suppress: Optional[bool] = ...,
  63. nanstr: Optional[str] = ...,
  64. infstr: Optional[str] = ...,
  65. formatter: Optional[_FormatDict] = ...,
  66. sign: Optional[Literal["-", "+", " "]] = ...,
  67. floatmode: Optional[_FloatMode] = ...,
  68. *,
  69. legacy: Optional[Literal[False, "1.13"]] = ...
  70. ) -> None: ...
  71. def get_printoptions() -> _FormatOptions: ...
  72. def array2string(
  73. a: ndarray[Any, Any],
  74. max_line_width: Optional[int] = ...,
  75. precision: Optional[SupportsIndex] = ...,
  76. suppress_small: Optional[bool] = ...,
  77. separator: str = ...,
  78. prefix: str = ...,
  79. # NOTE: With the `style` argument being deprecated,
  80. # all arguments between `formatter` and `suffix` are de facto
  81. # keyworld-only arguments
  82. *,
  83. formatter: Optional[_FormatDict] = ...,
  84. threshold: Optional[int] = ...,
  85. edgeitems: Optional[int] = ...,
  86. sign: Optional[Literal["-", "+", " "]] = ...,
  87. floatmode: Optional[_FloatMode] = ...,
  88. suffix: str = ...,
  89. legacy: Optional[Literal[False, "1.13"]] = ...,
  90. ) -> str: ...
  91. def format_float_scientific(
  92. x: _FloatLike_co,
  93. precision: Optional[int] = ...,
  94. unique: bool = ...,
  95. trim: Literal["k", ".", "0", "-"] = ...,
  96. sign: bool = ...,
  97. pad_left: Optional[int] = ...,
  98. exp_digits: Optional[int] = ...,
  99. min_digits: Optional[int] = ...,
  100. ) -> str: ...
  101. def format_float_positional(
  102. x: _FloatLike_co,
  103. precision: Optional[int] = ...,
  104. unique: bool = ...,
  105. fractional: bool = ...,
  106. trim: Literal["k", ".", "0", "-"] = ...,
  107. sign: bool = ...,
  108. pad_left: Optional[int] = ...,
  109. pad_right: Optional[int] = ...,
  110. min_digits: Optional[int] = ...,
  111. ) -> str: ...
  112. def array_repr(
  113. arr: ndarray[Any, Any],
  114. max_line_width: Optional[int] = ...,
  115. precision: Optional[SupportsIndex] = ...,
  116. suppress_small: Optional[bool] = ...,
  117. ) -> str: ...
  118. def array_str(
  119. a: ndarray[Any, Any],
  120. max_line_width: Optional[int] = ...,
  121. precision: Optional[SupportsIndex] = ...,
  122. suppress_small: Optional[bool] = ...,
  123. ) -> str: ...
  124. def set_string_function(
  125. f: Optional[Callable[[ndarray[Any, Any]], str]], repr: bool = ...
  126. ) -> None: ...
  127. def printoptions(
  128. precision: Optional[SupportsIndex] = ...,
  129. threshold: Optional[int] = ...,
  130. edgeitems: Optional[int] = ...,
  131. linewidth: Optional[int] = ...,
  132. suppress: Optional[bool] = ...,
  133. nanstr: Optional[str] = ...,
  134. infstr: Optional[str] = ...,
  135. formatter: Optional[_FormatDict] = ...,
  136. sign: Optional[Literal["-", "+", " "]] = ...,
  137. floatmode: Optional[_FloatMode] = ...,
  138. *,
  139. legacy: Optional[Literal[False, "1.13"]] = ...
  140. ) -> _GeneratorContextManager[_FormatOptions]: ...