Skip to content

Commit 1e38ba0

Browse files
committed
lint fixes
1 parent 7574b19 commit 1e38ba0

File tree

33 files changed

+61
-23
lines changed

33 files changed

+61
-23
lines changed

.github/workflows/ci.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Check out repo
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717
- name: Set up Python
18-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v5
1919
- name: Run pre-commit
20-
uses: pre-commit/action@v2.0.3
20+
uses: pre-commit/action@v3.0.0
2121

2222
build:
2323
needs: [lint]
@@ -27,7 +27,7 @@ jobs:
2727
os: [ubuntu-latest, windows-latest, macOS-latest]
2828
python-version: ["3.7", "3.8", "3.9", "3.10"]
2929
steps:
30-
- uses: actions/setup-python@v2
30+
- uses: actions/setup-python@v5
3131
with:
3232
python-version: ${{ matrix.python-version }}
3333
- name: Checkout code
@@ -36,5 +36,5 @@ jobs:
3636
run: |
3737
pip install tox
3838
tox -- --cov meshio --cov-report xml --cov-report term
39-
- uses: codecov/codecov-action@v1
39+
- uses: codecov/codecov-action@v3
4040
if: ${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' }}

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
repos:
22
- repo: https://github.com/PyCQA/isort
3-
rev: 5.10.1
3+
rev: 5.13.2
44
hooks:
55
- id: isort
66

77
- repo: https://github.com/psf/black
8-
rev: 22.1.0
8+
rev: 24.1.1
99
hooks:
1010
- id: black
1111
language_version: python3
1212

1313
- repo: https://github.com/PyCQA/flake8
14-
rev: 4.0.1
14+
rev: 7.0.0
1515
hooks:
1616
- id: flake8

justfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version := `python3 -c "from configparser import ConfigParser; p = ConfigParser(); p.read('setup.cfg'); print(p['metadata']['version'])"`
1+
version := `python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])"`
22

33
default:
44
@echo "\"just publish\"?"

src/meshio/abaqus/_abaqus.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
I/O for Abaqus inp files.
33
"""
4+
45
import pathlib
56
from itertools import count
67

src/meshio/ansys/_ansys.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
<https://romeo.univ-reims.fr/documents/fluent/tgrid/ug/appb.pdf>
55
"""
6+
67
import re
78

89
import numpy as np

src/meshio/avsucd/_avsucd.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for AVS-UCD format, cf.
33
<https://lanl.github.io/LaGriT/pages/docs/read_avs.html>.
44
"""
5+
56
import numpy as np
67

78
from ..__about__ import __version__ as version

src/meshio/cgns/_cgns.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
TODO link to specification?
55
"""
6+
67
import numpy as np
78

89
from .._exceptions import ReadError

src/meshio/dolfin/_dolfin.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for DOLFIN's XML format, cf.
33
<https://people.sc.fsu.edu/~jburkardt/data/dolfin_xml/dolfin_xml.html>.
44
"""
5+
56
import os
67
import pathlib
78
import re

src/meshio/exodus/_exodus.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<https://src.fedoraproject.org/repo/pkgs/exodusii/922137.pdf/a45d67f4a1a8762bcf66af2ec6eb35f9/922137.pdf>,
66
in particular Appendix A (page 171, Implementation of EXODUS II with netCDF).
77
"""
8+
89
import datetime
910
import re
1011

src/meshio/flac3d/_flac3d.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
I/O for FLAC3D format.
33
"""
4+
45
from __future__ import annotations
56

67
import re
@@ -534,6 +535,7 @@ def _translate_zcells(points, cells):
534535
normal vectors). Reorder corner points according to sign of scalar triple
535536
products.
536537
"""
538+
537539
# See <https://stackoverflow.com/a/42386330/353337>
538540
def slicing_summing(a, b, c):
539541
c0 = b[:, 1] * c[:, 2] - b[:, 2] * c[:, 1]

src/meshio/gmsh/_gmsh22.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for Gmsh's msh format, cf.
33
<http://gmsh.info//doc/texinfo/gmsh.html#File-formats>.
44
"""
5+
56
from __future__ import annotations
67

78
import numpy as np

src/meshio/gmsh/_gmsh40.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for Gmsh's msh format (version 4.0, as used by Gmsh 4.1.5), cf.
33
<http://gmsh.info//doc/texinfo/gmsh.html#MSH-file-format-_0028version-4_0029>.
44
"""
5+
56
from __future__ import annotations
67

78
from functools import partial

src/meshio/gmsh/_gmsh41.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for Gmsh's msh format (version 4.1, as used by Gmsh 4.2.2+), cf.
33
<http://gmsh.info/doc/texinfo/gmsh.html#MSH-file-format>.
44
"""
5+
56
from functools import partial
67

78
import numpy as np
@@ -209,13 +210,15 @@ def _read_elements(
209210
(num_ele,) = fromfile(f, c_size_t, 1)
210211
for physical_name, cell_set in cell_sets.items():
211212
cell_set[k] = np.arange(
212-
num_ele
213-
if (
214-
physical_tags
215-
and field_data[physical_name][1] == dim
216-
and field_data[physical_name][0] in physical_tags[dim][tag]
217-
)
218-
else 0,
213+
(
214+
num_ele
215+
if (
216+
physical_tags
217+
and field_data[physical_name][1] == dim
218+
and field_data[physical_name][0] in physical_tags[dim][tag]
219+
)
220+
else 0
221+
),
219222
dtype=type(num_ele),
220223
)
221224
tpe = _gmsh_to_meshio_type[type_ele]

src/meshio/h5m/_h5m.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for h5m, cf.
33
<https://www.mcs.anl.gov/~fathom/moab-docs/html/h5mmain.html>.
44
"""
5+
56
from datetime import datetime
67

78
import numpy as np

src/meshio/mdpa/_mdpa.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
The MDPA format is unsuitable for fast consumption, this is why:
66
<https://github.com/KratosMultiphysics/Kratos/issues/5365>.
77
"""
8+
89
import numpy as np
910

1011
from .._common import num_nodes_per_cell, raw_from_cell_data, warn

src/meshio/med/_med.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for MED/Salome, cf.
33
<https://docs.salome-platform.org/latest/dev/MEDCoupling/developer/med-file.html>.
44
"""
5+
56
import numpy as np
67

78
from .._common import num_nodes_per_cell

src/meshio/medit/_medit.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Latest official up-to-date documentation and a reference C implementation at
44
<https://github.com/LoicMarechal/libMeshb>
55
"""
6+
67
import struct
78
from ctypes import c_double, c_float
89

src/meshio/nastran/_nastran.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
I/O for Nastran bulk data.
33
"""
4+
45
from __future__ import annotations
56

67
import numpy as np

src/meshio/netgen/_netgen.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for Netgen mesh files
33
<https://github.com/NGSolve/netgen/blob/master/libsrc/meshing/meshclass.cpp>.
44
"""
5+
56
import numpy as np
67

78
from ..__about__ import __version__

src/meshio/neuroglancer/_neuroglancer.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Adapted from https://github.com/HumanBrainProject/neuroglancer-scripts/blob/1fcabb613a715ba17c65d52596dec3d687ca3318/src/neuroglancer_scripts/mesh.py (MIT license)
55
"""
6+
67
import struct
78

89
import numpy as np
@@ -57,7 +58,10 @@ def read_buffer(file):
5758
if len(buf) != 4 * 3 * num_vertices:
5859
raise ReadError("The precomputed mesh data is too short")
5960
flat_vertices = np.frombuffer(buf, "<f")
60-
vertices = np.reshape(flat_vertices, (num_vertices, 3),).copy(
61+
vertices = np.reshape(
62+
flat_vertices,
63+
(num_vertices, 3),
64+
).copy(
6165
order="C"
6266
) # TODO remove copy
6367
# BUG: this could easily exhaust memory if reading a large file that is not

src/meshio/obj/_obj.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for the Wavefront .obj file format, cf.
33
<https://en.wikipedia.org/wiki/Wavefront_.obj_file>.
44
"""
5+
56
import datetime
67

78
import numpy as np

src/meshio/off/_off.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<https://en.wikipedia.org/wiki/OFF_(file_format)>,
44
<http://www.geomview.org/docs/html/OFF.html>.
55
"""
6+
67
import numpy as np
78

89
from .._common import warn

src/meshio/permas/_permas.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
I/O for PERMAS dat files.
33
"""
4+
45
import numpy as np
56

67
from ..__about__ import __version__

src/meshio/ply/_ply.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<https://en.wikipedia.org/wiki/PLY_(file_format)>.
44
<https://web.archive.org/web/20161221115231/http://www.cs.virginia.edu/~gfx/Courses/2001/Advanced.spring.01/plylib/Ply.txt>.
55
"""
6+
67
import collections
78
import datetime
89
import re
@@ -296,11 +297,13 @@ def _read_binary(
296297
# Convert strings to proper numpy dtypes
297298
dts = [
298299
(
299-
endianness + ply_to_numpy_dtype_string[dtype[0]],
300-
endianness + ply_to_numpy_dtype_string[dtype[1]],
300+
(
301+
endianness + ply_to_numpy_dtype_string[dtype[0]],
302+
endianness + ply_to_numpy_dtype_string[dtype[1]],
303+
)
304+
if isinstance(dtype, tuple)
305+
else endianness + ply_to_numpy_dtype_string[dtype]
301306
)
302-
if isinstance(dtype, tuple)
303-
else endianness + ply_to_numpy_dtype_string[dtype]
304307
for dtype in cell_data_dtypes
305308
]
306309

@@ -311,7 +314,7 @@ def _read_binary(
311314
buffer_position = 0
312315

313316
cell_data = {}
314-
for (name, dt) in zip(cell_data_names, dts):
317+
for name, dt in zip(cell_data_names, dts):
315318
if isinstance(dt, tuple):
316319
buffer_increment, cell_data[name] = _read_binary_list(
317320
buffer[buffer_position:], dt[0], dt[1], num_cells, endianness
@@ -370,7 +373,7 @@ def parse_ragged(start, num_cells):
370373
# `block_dtype` to include the initial counts in each row avoids any
371374
# wasteful copy operations.
372375
blocks = []
373-
for (start, end) in block_bounds:
376+
for start, end in block_bounds:
374377
if start == end:
375378
# This should only happen if the element was empty to begin with.
376379
continue

src/meshio/stl/_stl.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for the STL format, cf.
33
<https://en.wikipedia.org/wiki/STL_(file_format)>.
44
"""
5+
56
from __future__ import annotations
67

78
import os

src/meshio/su2/_su2.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O SU2 mesh format
33
<https://su2code.github.io/docs_v7/Mesh-File/>
44
"""
5+
56
from itertools import chain, islice
67

78
import numpy as np

src/meshio/tecplot/_tecplot.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<https://github.com/su2code/SU2/raw/master/externals/tecio/360_data_format_guide.pdf>,
44
<http://paulbourke.net/dataformats/tp/>.
55
"""
6+
67
import numpy as np
78

89
from ..__about__ import __version__ as version

src/meshio/tetgen/_tetgen.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for the TetGen file format, c.f.
33
<https://wias-berlin.de/software/tetgen/fformats.node.html>
44
"""
5+
56
import pathlib
67

78
import numpy as np

src/meshio/ugrid/_ugrid.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Node ordering described in
88
[3] <https://www.simcenter.msstate.edu/software/documentation/ug_io/3d_input_output_grids.html>
99
"""
10+
1011
import numpy as np
1112

1213
from .._common import _pick_first_int_data, warn

src/meshio/vtk/_vtk_42.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
I/O for VTK <https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf>.
33
"""
4+
45
from functools import reduce
56

67
import numpy as np

src/meshio/vtu/_vtu.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<https://vtk.org/Wiki/VTK_XML_Formats>
44
<https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf>
55
"""
6+
67
import base64
78
import re
89
import sys

src/meshio/xdmf/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for XDMF.
33
https://xdmf.org/index.php/XDMF_Model_and_Format
44
"""
5+
56
from .main import read, write
67
from .time_series import TimeSeriesReader, TimeSeriesWriter
78

src/meshio/xdmf/main.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
I/O for XDMF.
33
https://xdmf.org/index.php/XDMF_Model_and_Format
44
"""
5+
56
import os
67
import pathlib
78
from io import BytesIO

0 commit comments

Comments
 (0)