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
180 changes: 6 additions & 174 deletions .basedpyright/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3835,30 +3835,6 @@
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 11,
"endColumn": 29,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 11,
"endColumn": 34,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 11,
"endColumn": 36,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
Expand Down Expand Up @@ -3890,14 +3866,6 @@
"endColumn": 38,
"lineCount": 1
}
},
{
"code": "reportUnreachable",
"range": {
"startColumn": 12,
"endColumn": 58,
"lineCount": 1
}
}
],
"./pytools/convergence.py": [
Expand Down Expand Up @@ -4029,30 +3997,6 @@
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
"startColumn": 8,
"endColumn": 12,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 8,
"endColumn": 14,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 45,
"endColumn": 69,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
Expand Down Expand Up @@ -5801,22 +5745,6 @@
}
],
"./pytools/obj_array.py": [
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 12,
"endColumn": 13,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 12,
"endColumn": 13,
"lineCount": 1
}
},
{
"code": "reportUnknownParameterType",
"range": {
Expand Down Expand Up @@ -5937,14 +5865,6 @@
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 8,
"endColumn": 9,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
Expand Down Expand Up @@ -6707,30 +6627,6 @@
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 32,
"endColumn": 54,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 32,
"endColumn": 64,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 32,
"endColumn": 66,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
Expand Down Expand Up @@ -7251,22 +7147,6 @@
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 28,
"endColumn": 46,
"lineCount": 1
}
},
{
"code": "reportAttributeAccessIssue",
"range": {
"startColumn": 30,
"endColumn": 46,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
Expand Down Expand Up @@ -7427,22 +7307,6 @@
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 23,
"endColumn": 41,
"lineCount": 1
}
},
{
"code": "reportAttributeAccessIssue",
"range": {
"startColumn": 25,
"endColumn": 41,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
Expand Down Expand Up @@ -7990,34 +7854,18 @@
}
},
{
"code": "reportUnreachable",
"code": "reportOptionalMemberAccess",
"range": {
"startColumn": 4,
"endColumn": 18,
"lineCount": 16
}
},
{
"code": "reportUnreachable",
"range": {
"startColumn": 8,
"endColumn": 14,
"startColumn": 14,
"endColumn": 15,
"lineCount": 1
}
},
{
"code": "reportUnreachable",
"range": {
"startColumn": 8,
"endColumn": 18,
"lineCount": 3
}
},
{
"code": "reportUnreachable",
"code": "reportUnusedClass",
"range": {
"startColumn": 12,
"endColumn": 18,
"startColumn": 14,
"endColumn": 22,
"lineCount": 1
}
}
Expand Down Expand Up @@ -8835,22 +8683,6 @@
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 8,
"endColumn": 14,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 17,
"endColumn": 37,
"lineCount": 1
}
},
{
"code": "reportUnknownParameterType",
"range": {
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
python-version: '3.x'
- name: "Main Script"
run: |
EXTRA_INSTALL="basedpyright numpy attrs orderedsets pytest mpi4py matplotlib optype<0.18"
EXTRA_INSTALL="basedpyright numpy attrs orderedsets pytest mpi4py matplotlib optype"

sudo apt update
sudo apt -y install libopenmpi-dev
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
python-version: '3.x'
- name: "Main Script"
run: |
EXTRA_INSTALL="numpy optype<0.18"
EXTRA_INSTALL="numpy optype"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Ruff:

Documentation:
script: |
EXTRA_INSTALL="numpy siphash24 optype<0.18"
EXTRA_INSTALL="numpy siphash24 optype"
curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/main/build-docs.sh
. ./build-docs.sh
tags:
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ numpy = [
]
test = [
"basedpyright",
# NOTE: 0.18 requires Python 3.12
"optype<0.18",
"optype",
"pytest",
"ruff",
]
Expand Down Expand Up @@ -136,7 +135,7 @@ exclude = [
# we care about at this moment.
# https://github.com/microsoft/pyright/issues/746
reportImportCycles = "none"
pythonVersion = "3.10"
pythonVersion = "3.12"
pythonPlatform = "All"

[[tool.basedpyright.executionEnvironments]]
Expand Down
3 changes: 2 additions & 1 deletion pytools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ def __getattr__(self, name):
class Record(RecordWithoutPickling):
__slots__: ClassVar[list[str]] = []

@override
def __getstate__(self):
return {
key: getattr(self, key)
Expand Down Expand Up @@ -3352,7 +3353,7 @@ def ndindex(shape: ShapeT) -> Iterable[ShapeT]:
"""
# undocumented for now
import numpy as np
return np.ndindex(shape)
return np.ndindex(shape) # pyright: ignore[reportReturnType]


def not_none(obj: T | None) -> T:
Expand Down
4 changes: 2 additions & 2 deletions pytools/convergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def add_data_point(
def estimate_order_of_convergence(self,
gliding_mean: int | None = None,
) -> np.ndarray:
abscissae = np.array([a for a, e in self.history])
errors = np.array([e for a, e in self.history])
abscissae = np.array([a for a, e in self.history], dtype=np.float64)
errors = np.array([e for a, e in self.history], dtype=np.float64)

# NOTE: in case any of the errors are exactly 0.0, which
# can give NaNs in `estimate_order_of_convergence`
Expand Down
14 changes: 11 additions & 3 deletions pytools/obj_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,16 @@ def vectorize(
issue described under :func:`new_1d`.
"""

import numpy as np
if isinstance(ary, ObjectArray):
import numpy as np

from pytools import ndindex

result = np.empty_like(ary)
ary = cast("ObjectArray[ShapeT, T_co]", ary)
for i in np.ndindex(ary.shape):
for i in ndindex(ary.shape):
result[i] = f(ary[i])

return cast("ObjectArray[ShapeT, ResultT]", cast("object", result))

return f(ary)
Expand Down Expand Up @@ -631,10 +635,14 @@ def rec_vectorize(
"""
if isinstance(ary, ObjectArray):
import numpy as np

from pytools import ndindex

ary = cast("ObjectArray[ShapeT, object]", ary)
result = np.empty_like(ary)
for i in np.ndindex(ary.shape):
for i in ndindex(ary.shape):
result[i] = rec_vectorize(f, ary[i])

return cast("ObjectArray[Any, ShapeT]", cast("object", result))

return f(ary)
Expand Down
Loading
Loading