summaryrefslogtreecommitdiff
path: root/numpy/core/arrayprint.pyi
diff options
context:
space:
mode:
authorBas van Beek <43369155+BvB93@users.noreply.github.com>2021-12-21 16:33:11 +0100
committerBas van Beek <43369155+BvB93@users.noreply.github.com>2021-12-22 00:08:03 +0100
commit08053b2600f4b93575d8057238861219a1a57edc (patch)
tree9edef76d944cfcbdbb4bcf41516b3cf15f3a9a86 /numpy/core/arrayprint.pyi
parent509d3ab421142905482592337ea2407bacb351ac (diff)
downloadnumpy-08053b2600f4b93575d8057238861219a1a57edc.tar.gz
STY: Replace `Optional` with the `|` operator
Diffstat (limited to 'numpy/core/arrayprint.pyi')
-rw-r--r--numpy/core/arrayprint.pyi96
1 files changed, 48 insertions, 48 deletions
diff --git a/numpy/core/arrayprint.pyi b/numpy/core/arrayprint.pyi
index 0d338206f..b18a554d6 100644
--- a/numpy/core/arrayprint.pyi
+++ b/numpy/core/arrayprint.pyi
@@ -1,5 +1,5 @@
from types import TracebackType
-from typing import Any, Optional, Callable, Union, Type, Literal, TypedDict, SupportsIndex
+from typing import Any, Callable, Union, Type, Literal, TypedDict, SupportsIndex
# Using a private class is by no means ideal, but it is simply a consequence
# of a `contextlib.context` returning an instance of aforementioned class
@@ -50,92 +50,92 @@ class _FormatOptions(TypedDict):
suppress: bool
nanstr: str
infstr: str
- formatter: Optional[_FormatDict]
+ formatter: None | _FormatDict
sign: Literal["-", "+", " "]
floatmode: _FloatMode
legacy: Literal[False, "1.13", "1.21"]
def set_printoptions(
- precision: Optional[SupportsIndex] = ...,
- threshold: Optional[int] = ...,
- edgeitems: Optional[int] = ...,
- linewidth: Optional[int] = ...,
- suppress: Optional[bool] = ...,
- nanstr: Optional[str] = ...,
- infstr: Optional[str] = ...,
- formatter: Optional[_FormatDict] = ...,
- sign: Optional[Literal["-", "+", " "]] = ...,
- floatmode: Optional[_FloatMode] = ...,
+ precision: None | SupportsIndex = ...,
+ threshold: None | int = ...,
+ edgeitems: None | int = ...,
+ linewidth: None | int = ...,
+ suppress: None | bool = ...,
+ nanstr: None | str = ...,
+ infstr: None | str = ...,
+ formatter: None | _FormatDict = ...,
+ sign: Literal[None, "-", "+", " "] = ...,
+ floatmode: None | _FloatMode = ...,
*,
- legacy: Optional[Literal[False, "1.13", "1.21"]] = ...
+ legacy: Literal[None, False, "1.13", "1.21"] = ...
) -> None: ...
def get_printoptions() -> _FormatOptions: ...
def array2string(
a: ndarray[Any, Any],
- max_line_width: Optional[int] = ...,
- precision: Optional[SupportsIndex] = ...,
- suppress_small: Optional[bool] = ...,
+ max_line_width: None | int = ...,
+ precision: None | SupportsIndex = ...,
+ suppress_small: None | bool = ...,
separator: str = ...,
prefix: str = ...,
# NOTE: With the `style` argument being deprecated,
# all arguments between `formatter` and `suffix` are de facto
# keyworld-only arguments
*,
- formatter: Optional[_FormatDict] = ...,
- threshold: Optional[int] = ...,
- edgeitems: Optional[int] = ...,
- sign: Optional[Literal["-", "+", " "]] = ...,
- floatmode: Optional[_FloatMode] = ...,
+ formatter: None | _FormatDict = ...,
+ threshold: None | int = ...,
+ edgeitems: None | int = ...,
+ sign: Literal[None, "-", "+", " "] = ...,
+ floatmode: None | _FloatMode = ...,
suffix: str = ...,
- legacy: Optional[Literal[False, "1.13", "1.21"]] = ...,
+ legacy: Literal[None, False, "1.13", "1.21"] = ...,
) -> str: ...
def format_float_scientific(
x: _FloatLike_co,
- precision: Optional[int] = ...,
+ precision: None | int = ...,
unique: bool = ...,
trim: Literal["k", ".", "0", "-"] = ...,
sign: bool = ...,
- pad_left: Optional[int] = ...,
- exp_digits: Optional[int] = ...,
- min_digits: Optional[int] = ...,
+ pad_left: None | int = ...,
+ exp_digits: None | int = ...,
+ min_digits: None | int = ...,
) -> str: ...
def format_float_positional(
x: _FloatLike_co,
- precision: Optional[int] = ...,
+ precision: None | int = ...,
unique: bool = ...,
fractional: bool = ...,
trim: Literal["k", ".", "0", "-"] = ...,
sign: bool = ...,
- pad_left: Optional[int] = ...,
- pad_right: Optional[int] = ...,
- min_digits: Optional[int] = ...,
+ pad_left: None | int = ...,
+ pad_right: None | int = ...,
+ min_digits: None | int = ...,
) -> str: ...
def array_repr(
arr: ndarray[Any, Any],
- max_line_width: Optional[int] = ...,
- precision: Optional[SupportsIndex] = ...,
- suppress_small: Optional[bool] = ...,
+ max_line_width: None | int = ...,
+ precision: None | SupportsIndex = ...,
+ suppress_small: None | bool = ...,
) -> str: ...
def array_str(
a: ndarray[Any, Any],
- max_line_width: Optional[int] = ...,
- precision: Optional[SupportsIndex] = ...,
- suppress_small: Optional[bool] = ...,
+ max_line_width: None | int = ...,
+ precision: None | SupportsIndex = ...,
+ suppress_small: None | bool = ...,
) -> str: ...
def set_string_function(
- f: Optional[Callable[[ndarray[Any, Any]], str]], repr: bool = ...
+ f: None | Callable[[ndarray[Any, Any]], str], repr: bool = ...
) -> None: ...
def printoptions(
- precision: Optional[SupportsIndex] = ...,
- threshold: Optional[int] = ...,
- edgeitems: Optional[int] = ...,
- linewidth: Optional[int] = ...,
- suppress: Optional[bool] = ...,
- nanstr: Optional[str] = ...,
- infstr: Optional[str] = ...,
- formatter: Optional[_FormatDict] = ...,
- sign: Optional[Literal["-", "+", " "]] = ...,
- floatmode: Optional[_FloatMode] = ...,
+ precision: None | SupportsIndex = ...,
+ threshold: None | int = ...,
+ edgeitems: None | int = ...,
+ linewidth: None | int = ...,
+ suppress: None | bool = ...,
+ nanstr: None | str = ...,
+ infstr: None | str = ...,
+ formatter: None | _FormatDict = ...,
+ sign: Literal[None, "-", "+", " "] = ...,
+ floatmode: None | _FloatMode = ...,
*,
- legacy: Optional[Literal[False, "1.13", "1.21"]] = ...
+ legacy: Literal[None, False, "1.13", "1.21"] = ...
) -> _GeneratorContextManager[_FormatOptions]: ...