diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2021-05-24 15:04:06 +0200 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2021-05-27 18:23:57 +0200 |
commit | 757eb4abd1b6823d4d7933c9ad0c75160750833b (patch) | |
tree | e3941817371ebede02e872faab771205c89dbf21 /numpy/typing/mypy_plugin.py | |
parent | 44e72e771bff812c00e48bd6c94d90f9f46a7254 (diff) | |
download | numpy-757eb4abd1b6823d4d7933c9ad0c75160750833b.tar.gz |
STY: Use the PEP 604 pipe operator over `Optional` and `Union`
PEP 604 -- Allow writing union types as X | Y
Diffstat (limited to 'numpy/typing/mypy_plugin.py')
-rw-r--r-- | numpy/typing/mypy_plugin.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/typing/mypy_plugin.py b/numpy/typing/mypy_plugin.py index 901bf4fb1..100e0d957 100644 --- a/numpy/typing/mypy_plugin.py +++ b/numpy/typing/mypy_plugin.py @@ -14,7 +14,7 @@ try: from mypy.build import PRI_MED _HookFunc = t.Callable[[AnalyzeTypeContext], Type] - MYPY_EX: t.Optional[ModuleNotFoundError] = None + MYPY_EX: None | ModuleNotFoundError = None except ModuleNotFoundError as ex: MYPY_EX = ex @@ -90,7 +90,7 @@ if t.TYPE_CHECKING or MYPY_EX is None: class _NumpyPlugin(Plugin): """A plugin for assigning platform-specific `numpy.number` precisions.""" - def get_type_analyze_hook(self, fullname: str) -> t.Optional[_HookFunc]: + def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc: """Set the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdouble`. |