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
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ reportUnusedCallResult = "none"
reportExplicitAny = "none"
reportUnreachable = "hint"

exclude = [
"doc",
".conda-root",
"build",
".env",
".run-pylint.py",
]

# This reports even cycles that are qualified by 'if TYPE_CHECKING'. Not what
# we care about at this moment.
# https://github.com/microsoft/pyright/issues/746
Expand Down
5 changes: 5 additions & 0 deletions pytools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3169,6 +3169,11 @@ def ndindex(shape: ShapeT) -> Iterable[ShapeT]:
return np.ndindex(shape)


def not_none(obj: T | None) -> T:
assert obj is not None
return obj


def _test():
import doctest
doctest.testmod()
Expand Down
12 changes: 12 additions & 0 deletions pytools/obj_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ def __getitem__(self: ObjectArray2D[T], x: int, /) -> ObjectArray1D[T]: ...
@overload
def __getitem__(self: ObjectArrayND[T], x: int, /) -> ObjectArrayND[T] | T: ...

@overload
def __getitem__(
self: ObjectArrayND[T],
x: tuple[int | slice, ...],
/) -> ObjectArrayND[T] | T: ...

@overload
def __getitem__(
self: ObjectArray1D[T],
Expand Down Expand Up @@ -271,6 +277,12 @@ def __matmul__(
other: ObjectArray2D[T],
/) -> ObjectArray2D[T]: ...

@overload
def __matmul__(
self: ObjectArrayND[T],
other: ObjectArrayND[T],
/) -> ObjectArrayND[T] | T: ...

@property
def flat(self) -> ObjectArray1D[T]: ...

Expand Down
Loading