Skip to content

Commit 25a3135

Browse files
committed
♿️ inline tabulate import in tool/ufunc.py
1 parent b514d4a commit 25a3135

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tool/ufunc.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
from functools import cache
2323
from typing import Any, Final, TypeAlias
2424

25-
import tabulate # pyright: ignore[reportMissingModuleSource]
26-
2725
import numpy as np
2826
import numpy._core.umath as um # noqa: PLC2701
2927

@@ -59,7 +57,7 @@ def _all_types(u: np.ufunc) -> tuple[str, ...]:
5957
6058
Returns
6159
-------
62-
extra_types : list of string-like type signatures
60+
extra_types : tuple of string-like type signatures like "ab->c"
6361
"""
6462
extra_types: list[str] = []
6563

@@ -163,6 +161,8 @@ def _sort_key(ufunc: np.ufunc, /) -> tuple[Any, ...]:
163161

164162

165163
def _parse_args(args: Sequence[str] | None, /) -> argparse.Namespace:
164+
import tabulate # pyright: ignore[reportMissingModuleSource] # noqa: PLC0415
165+
166166
parser = argparse.ArgumentParser(prog="ufunc.py")
167167

168168
parser.add_argument("nin", type=int, help="filter by `ufunc.nin`")
@@ -211,6 +211,8 @@ def main(args: Sequence[str] | None = None, /) -> int:
211211
as_code = "{}".format
212212

213213
if data:
214+
import tabulate # pyright: ignore[reportMissingModuleSource] # noqa: PLC0415
215+
214216
print(
215217
tabulate.tabulate(
216218
[list(map(as_code, entry.values())) for entry in data],

0 commit comments

Comments
 (0)