Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into generic-part-bdry
Browse files Browse the repository at this point in the history
  • Loading branch information
majosm committed Jun 29, 2022
2 parents f7cfe04 + da6fb9a commit 07f68fe
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 10 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-python@v1
with:
# matches compat target in setup.py
python-version: '3.6'
python-version: '3.8'
- name: "Main Script"
run: |
curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/main/prepare-and-run-flake8.sh
Expand All @@ -35,6 +35,19 @@ jobs:
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 experiments/*.py
mypy:
name: Mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Main Script"
run: |
curl -L -O https://tiker.net/ci-support-v0
. ./ci-support-v0
build_py_project_in_conda_env
python -m pip install mypy
./run-mypy.sh
pytest3:
name: Pytest Conda Py3
runs-on: ubuntu-latest
Expand Down
13 changes: 13 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ Pylint:
except:
- tags

Mypy:
script: |
EXTRA_INSTALL="Cython mpi4py"
curl -L -O https://tiker.net/ci-support-v0
. ./ci-support-v0
build_py_project_in_venv
python -m pip install mypy
./run-mypy.sh
tags:
- python3
except:
- tags

Downstream:
parallel:
matrix:
Expand Down
11 changes: 6 additions & 5 deletions meshmode/mesh/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def _filter_mesh_groups(mesh, selected_elements, vertex_id_dtype):
filtered_vertex_indices = [
mesh.groups[i_old_grp].vertex_indices[
filtered_group_elements[i_new_grp], :]
for i_new_grp, i_old_grp in enumerate(new_group_to_old_group)]
for i_new_grp, i_old_grp in enumerate(new_group_to_old_group)
if mesh.groups[i_old_grp].vertex_indices is not None]

if n_new_groups > 0:
filtered_vertex_indices_flat = np.concatenate([indices.ravel() for indices
Expand Down Expand Up @@ -1286,14 +1287,14 @@ def map_mesh(mesh, f): # noqa
# {{{ affine map

def affine_map(mesh,
A: Optional[Union[Real, np.ndarray]] = None, # noqa: N803
b: Optional[Union[Real, np.ndarray]] = None):
A: Optional[Union[np.generic, np.ndarray]] = None, # noqa: N803
b: Optional[Union[np.generic, np.ndarray]] = None):
"""Apply the affine map :math:`f(x) = A x + b` to the geometry of *mesh*."""

if isinstance(A, Real):
if A is not None and not isinstance(A, np.ndarray):
A = np.diag([A] * mesh.ambient_dim) # noqa: N806

if isinstance(b, Real):
if b is not None and not isinstance(b, np.ndarray):
b = np.array([b] * mesh.ambient_dim)

if A is None and b is None:
Expand Down
3 changes: 3 additions & 0 deletions run-mypy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

python -m mypy --show-error-codes meshmode # examples test
65 changes: 65 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,68 @@ docstring-quotes = """
multiline-quotes = """
# enable-flake8-bugbear
[mypy]
python_version = 3.8
warn_unused_ignores = True
exclude = (?x)(
meshmode/discretization/.*
| meshmode/mesh/__init__.py
| meshmode/mesh/generation\.py
| meshmode/mesh/visualization\.py
| meshmode/mesh/refinement/.*
| meshmode/interop/.*
| meshmode/dof_array\.py
)
[mypy-pyvisfile.*]
ignore_missing_imports = True
[mypy-matplotlib.*]
ignore_missing_imports = True
[mypy-mpl_toolkits.*]
ignore_missing_imports = True
[mypy-firedrake.*]
ignore_missing_imports = True
[mypy-pyop2.*]
ignore_missing_imports = True
[mypy-finat.*]
ignore_missing_imports = True
[mypy-FIAT.*]
ignore_missing_imports = True
[mypy-loopy.*]
ignore_missing_imports = True
[mypy-gmsh_interop.*]
ignore_missing_imports = True
[mypy-scipy.*]
ignore_missing_imports = True
[mypy-pymetis.*]
ignore_missing_imports = True
[mypy-pymbolic.*]
ignore_missing_imports = True
[mypy-recursivenodes.*]
ignore_missing_imports = True
[mypy-mayavi.*]
ignore_missing_imports = True
[mypy-h5py.*]
ignore_missing_imports = True
[mypy-oct2py.*]
ignore_missing_imports = True
[mypy-pyopencl.*]
ignore_missing_imports = True
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ def main():
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
Expand All @@ -39,7 +36,7 @@ def main():
],

packages=find_packages(),
python_requires="~=3.6",
python_requires="~=3.8",
install_requires=[
"numpy",
"modepy>=2020.2",
Expand Down

0 comments on commit 07f68fe

Please sign in to comment.