Skip to content

Commit 2eeefec

Browse files
authored
Merge pull request #1188 from nschloe/3.10
3.10
2 parents 2b033a7 + cacdf51 commit 2eeefec

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
strategy:
2525
matrix:
26-
python-version: [3.7, 3.8, 3.9]
26+
python-version: ["3.7", "3.8", "3.9", "3.10-dev"]
2727
steps:
2828
- uses: actions/setup-python@v2
2929
with:

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ default:
55

66
tag:
77
@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
8-
curl -H "Authorization: token `cat ~/.github-access-token`" -d '{"tag_name": "{{version}}"}' https://api.github.com/repos/nschloe/meshio/releases
8+
curl -H "Authorization: token `cat ~/.github-access-token`" -d '{"tag_name": "v{{version}}"}' https://api.github.com/repos/nschloe/meshio/releases
99

1010
upload: clean
1111
@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = meshio
3-
version = 5.0.1
3+
version = 5.0.2
44
author = Nico Schlömer et al.
55
author_email = [email protected]
66
description = I/O for many mesh formats
@@ -22,6 +22,7 @@ classifiers =
2222
Programming Language :: Python :: 3.7
2323
Programming Language :: Python :: 3.8
2424
Programming Language :: Python :: 3.9
25+
Programming Language :: Python :: 3.10
2526
Topic :: Scientific/Engineering
2627
Topic :: Utilities
2728
keywords =

src/meshio/_helpers.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from __future__ import annotations
2+
13
import pathlib
2-
from typing import List, Optional
34

45
import numpy as np
56

@@ -13,7 +14,7 @@
1314
_writer_map = {}
1415

1516

16-
def register(name: str, extensions: List[str], reader, writer_map):
17+
def register(name: str, extensions: list[str], reader, writer_map):
1718
for ext in extensions:
1819
extension_to_filetype[ext] = name
1920

@@ -35,7 +36,7 @@ def _filetype_from_path(path: pathlib.Path):
3536
return out
3637

3738

38-
def read(filename, file_format: Optional[str] = None):
39+
def read(filename, file_format: str | None = None):
3940
"""Reads an unstructured mesh with added data.
4041
4142
:param filenames: The files/PathLikes to read from.
@@ -97,7 +98,7 @@ def write_points_cells(
9798
mesh.write(filename, file_format=file_format, **kwargs)
9899

99100

100-
def write(filename, mesh: Mesh, file_format: Optional[str] = None, **kwargs):
101+
def write(filename, mesh: Mesh, file_format: str | None = None, **kwargs):
101102
"""Writes mesh together with data to a file.
102103
103104
:params filename: File to write to.

src/meshio/_mesh.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from __future__ import annotations
2+
13
import collections
24
import warnings
3-
from typing import Optional
45

56
import numpy as np
67

@@ -59,8 +60,8 @@ def __init__(
5960
self.point_data[key] = np.asarray(item)
6061
if len(self.point_data[key]) != len(self.points):
6162
raise ValueError(
62-
f"len(points) = {len(points)}, "
63-
f'but len(point_data["{key}"]) = {len(point_data[key])}'
63+
f"len(points) = {len(self.points)}, "
64+
f'but len(point_data["{key}"]) = {len(self.point_data[key])}'
6465
)
6566

6667
# assert cell data consistency and convert to numpy arrays
@@ -212,7 +213,7 @@ def prune_z_0(self, tol: float = 1.0e-13):
212213
if self.points.shape[1] == 3 and np.all(np.abs(self.points[:, 2]) < tol):
213214
self.points = self.points[:, :2]
214215

215-
def write(self, path_or_buf, file_format: Optional[str] = None, **kwargs):
216+
def write(self, path_or_buf, file_format: str | None = None, **kwargs):
216217
# avoid circular import
217218
from ._helpers import write
218219

src/meshio/svg/_svg.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Optional, Union
1+
from __future__ import annotations
2+
23
from xml.etree import ElementTree as ET
34

45
import numpy as np
@@ -11,11 +12,11 @@ def write(
1112
filename,
1213
mesh,
1314
float_fmt: str = ".3f",
14-
stroke_width: Optional[str] = None,
15+
stroke_width: str | None = None,
1516
# Use a default image_width (not None). If set to None, images will come out at the
1617
# width of the mesh (which is okay). Some viewers (e.g., eog) have problems
1718
# displaying SVGs of width around 1 since they interpret it as the width in pixels.
18-
image_width: Optional[Union[int, float]] = 100,
19+
image_width: int | float | None = 100,
1920
# ParaView's default colors
2021
fill: str = "#c8c5bd",
2122
stroke: str = "#000080",

0 commit comments

Comments
 (0)