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
1,518 changes: 87 additions & 1,431 deletions .basedpyright/baseline.json

Large diffs are not rendered by default.

12 changes: 0 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ jobs:
pip install ruff
ruff check

pylint:
name: Pylint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Main Script"
run: |
echo "- scipy" >> .test-conda-env-py3.yml
USE_CONDA_BUILD=1
curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-pylint.sh
. ./prepare-and-run-pylint.sh "$(basename $GITHUB_REPOSITORY)" examples/*.py test/test_*.py

basedpyright:
runs-on: ubuntu-latest
steps:
Expand Down
11 changes: 0 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,6 @@ Ruff:
except:
- tags

Pylint:
script: |
export PY_EXE=python3
EXTRA_INSTALL="Cython pybind11 numpy mako matplotlib scipy mpi4py h5py oct2py"
curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-pylint.sh
. ./prepare-and-run-pylint.sh "$CI_PROJECT_NAME" examples/*.py test/test_*.py
tags:
- python3
except:
- tags

Downstream:
parallel:
matrix:
Expand Down
11 changes: 0 additions & 11 deletions .pylintrc-local.yml

This file was deleted.

3 changes: 2 additions & 1 deletion examples/simple-dg.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import logging
from dataclasses import dataclass
from typing import ClassVar

import numpy as np
import numpy.linalg as la # noqa
Expand Down Expand Up @@ -342,7 +343,7 @@ class TracePair:
exterior: ArrayContainer

# NOTE: let the container do the broadcasting + arithmetic
__array_ufunc__ = None
__array_ufunc__: ClassVar[None] = None

def __getattr__(self, name):
return map_array_container(
Expand Down
31 changes: 19 additions & 12 deletions meshmode/discretization/connection/direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@

from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import TYPE_CHECKING, Generic
from typing import TYPE_CHECKING, Generic, Literal, cast

import numpy as np
from typing_extensions import override

import loopy as lp
from arraycontext import (
Array,
ArrayContext,
ArrayOrContainerOrScalarT,
ArrayOrContainerT,
ArrayT,
NotAnArrayContainerError,
Expand All @@ -55,18 +58,20 @@
if TYPE_CHECKING:
from collections.abc import Sequence

from pytools.tag import Tag

from meshmode.discretization import Discretization, ElementGroupBase


def _reshape_and_preserve_tags(
actx: ArrayContext, ary: ArrayT, new_shape: tuple[int, ...]) -> ArrayT:
actx: ArrayContext, ary: Array, new_shape: tuple[int, ...]) -> Array:
try:
tags = ary.tags
tags = cast("frozenset[Tag]", ary.tags) # pyright: ignore[reportAttributeAccessIssue]
except AttributeError:
# 'ary' might not have a 'tags' attribute (e.g., in case of an np.ndarray)
return ary.reshape(new_shape)
return ary.reshape(*new_shape)
else:
return actx.tag(tags, ary.reshape(new_shape))
return actx.tag(tags, ary.reshape(*new_shape))


# {{{ interpolation batch
Expand Down Expand Up @@ -262,7 +267,7 @@ class DiscretizationConnectionElementGroup:

A list of :class:`InterpolationBatch` instances.
"""
batches: Sequence[InterpolationBatch]
batches: Sequence[InterpolationBatch[Array]]

def __init__(self, batches):
self.batches = batches
Expand Down Expand Up @@ -500,7 +505,7 @@ def _per_target_group_pick_info(
if not batch_source_groups:
return None

result: list[_FromGroupPickData] = []
result: list[_FromGroupPickData[Array]] = []
for source_group_index in batch_source_groups:
batch_indices_for_this_source_group = [
i for i, batch in enumerate(cgrp.batches)
Expand Down Expand Up @@ -565,7 +570,7 @@ def _per_target_group_pick_info(

def _global_point_pick_info(
self, actx: ArrayContext
) -> Sequence[Sequence[_FromGroupPickData] | None]:
) -> Sequence[Sequence[_FromGroupPickData[Array]] | None]:
if self._global_point_pick_info_cache is not None:
return self._global_point_pick_info_cache

Expand All @@ -578,11 +583,12 @@ def _global_point_pick_info(

# {{{ __call__

@override
def __call__(
self, ary: ArrayOrContainerT, *,
self, ary: ArrayOrContainerOrScalarT, *,
_force_use_loopy: bool = False,
_force_no_merged_batches: bool = False,
) -> ArrayOrContainerT:
) -> ArrayOrContainerOrScalarT:
"""
:arg ary: a :class:`~meshmode.dof_array.DOFArray`, or an
:class:`arraycontext.ArrayContainer` of them, containing nodal
Expand Down Expand Up @@ -619,6 +625,7 @@ def __call__(
assert isinstance(ary, DOFArray)

actx = ary.array_context
assert actx is not None

# {{{ kernels

Expand Down Expand Up @@ -719,11 +726,11 @@ def group_pick_knl(is_surjective: bool):

# }}}

group_arrays = []
group_arrays: list[Array | Literal[0]] = []
for i_tgrp, (cgrp, group_pick_info) in enumerate(
zip(self.groups, self._global_point_pick_info(actx), strict=True)):

group_array_contributions = []
group_array_contributions: list[Array] = []

if _force_no_merged_batches:
group_pick_info = None
Expand Down
6 changes: 4 additions & 2 deletions meshmode/dof_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
ArithType: TypeAlias = "DOFArray | int | float | complex | np.generic"


@with_container_arithmetic(

Check warning on line 79 in meshmode/dof_array.py

View workflow job for this annotation

GitHub Actions / Pytest Conda Py3

Broadcasting array context array types across <class 'meshmode.dof_array.DOFArray'> has been implicitly enabled. As of 2026, this will no longer work. Use arraycontext.Bcast* object wrappers for roughly equivalent functionality. See the discussion in https://github.com/inducer/arraycontext/pull/190. To opt out now (and avoid this warning), pass _bcast_actx_array_type=False.

Check warning on line 79 in meshmode/dof_array.py

View workflow job for this annotation

GitHub Actions / Pytest Conda Py3

Broadcasting array context array types across <class 'meshmode.dof_array.DOFArray'> has been implicitly enabled. As of 2026, this will no longer work. Use arraycontext.Bcast* object wrappers for roughly equivalent functionality. See the discussion in https://github.com/inducer/arraycontext/pull/190. To opt out now (and avoid this warning), pass _bcast_actx_array_type=False.

Check warning on line 79 in meshmode/dof_array.py

View workflow job for this annotation

GitHub Actions / Pytest Conda Py3

Broadcasting array context array types across <class 'meshmode.dof_array.DOFArray'> has been implicitly enabled. As of 2026, this will no longer work. Use arraycontext.Bcast* object wrappers for roughly equivalent functionality. See the discussion in https://github.com/inducer/arraycontext/pull/190. To opt out now (and avoid this warning), pass _bcast_actx_array_type=False.

Check warning on line 79 in meshmode/dof_array.py

View workflow job for this annotation

GitHub Actions / Pytest Conda Py3

'bcast_numpy_array=True' is deprecated and will be unsupported from 2025.

Check warning on line 79 in meshmode/dof_array.py

View workflow job for this annotation

GitHub Actions / Pytest Conda Py3

'bcast_numpy_array=True' is deprecated and will be unsupported from 2025.

Check warning on line 79 in meshmode/dof_array.py

View workflow job for this annotation

GitHub Actions / Pytest Conda Py3

'bcast_numpy_array=True' is deprecated and will be unsupported from 2025.

Check warning on line 79 in meshmode/dof_array.py

View workflow job for this annotation

GitHub Actions / Pytest Conda Py3

Broadcasting array context array types across <class 'meshmode.dof_array.DOFArray'> has been implicitly enabled. As of 2026, this will no longer work. Use arraycontext.Bcast* object wrappers for roughly equivalent functionality. See the discussion in https://github.com/inducer/arraycontext/pull/190. To opt out now (and avoid this warning), pass _bcast_actx_array_type=False.

Check warning on line 79 in meshmode/dof_array.py

View workflow job for this annotation

GitHub Actions / Pytest Conda Py3

'bcast_numpy_array=True' is deprecated and will be unsupported from 2025.
bcasts_across_obj_array=True,
rel_comparison=True,

Expand Down Expand Up @@ -400,6 +400,8 @@
def __rsub__(self, other: ArithType) -> DOFArray: ...
def __mul__(self, other: ArithType) -> DOFArray: ...
def __rmul__(self, other: ArithType) -> DOFArray: ...
def __pow__(self, other: ArithType) -> DOFArray: ...
def __rpow__(self, other: ArithType) -> DOFArray: ...
def __truediv__(self, other: ArithType) -> DOFArray: ...
def __rtruediv__(self, other: ArithType) -> DOFArray: ...

Expand Down Expand Up @@ -518,7 +520,7 @@
raise NotImplementedError(f"unsupported value of 'ord': {ord}")


def flat_norm(ary, ord=None) -> Any:
def flat_norm(ary, ord: float | None = None) -> Any:
r"""Return an element-wise :math:`\ell^{\text{ord}}` norm of *ary*.

Unlike :attr:`arraycontext.ArrayContext.np`, this function handles
Expand Down Expand Up @@ -552,7 +554,7 @@
assert actx is _ary.array_context

return _reduce_norm(actx, [
actx.np.linalg.norm(actx.np.ravel(subary, order="A"), ord=ord)
actx.np.linalg.norm(actx.np.ravel(subary, order="C"), ord=ord)
for _, subary in serialize_container(_ary)
], ord=ord)

Expand Down
23 changes: 0 additions & 23 deletions run-pylint.sh

This file was deleted.

Loading