diff --git a/setup.cfg b/setup.cfg index 488fb1189..ba6c23d2d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = meshio -version = 5.2.2 +version = 5.2.3 author = Nico Schlömer et al. author_email = nico.schloemer@gmail.com description = I/O for many mesh formats diff --git a/src/meshio/_cli/_main.py b/src/meshio/_cli/_main.py index 05645cfd2..d2f06a18a 100644 --- a/src/meshio/_cli/_main.py +++ b/src/meshio/_cli/_main.py @@ -24,7 +24,6 @@ def main(argv=None): ) parser = subparsers.add_parser("convert", help="Convert mesh files", aliases=["c"]) - _convert.add_args(parser) parser.set_defaults(func=_convert.convert) diff --git a/src/meshio/ansys/_ansys.py b/src/meshio/ansys/_ansys.py index fce68d522..c52716f50 100644 --- a/src/meshio/ansys/_ansys.py +++ b/src/meshio/ansys/_ansys.py @@ -365,15 +365,14 @@ def read(filename): # noqa: C901 obj = re.match("\\(45 \\([0-9]+ ([\\S]+) ([\\S]+)\\)\\(\\)\\)", line) if obj: warn( - "Zone specification not supported yet (%r, %r). " "Skipping.", - obj.group(1), - obj.group(2), + f"Zone specification not supported yet ({obj.group(1)}, {obj.group(2)}). " + + "Skipping.", ) else: warn("Zone specification not supported yet.") else: - warn("Unknown index %r. Skipping.", index) + warn(f"Unknown index {index}. Skipping.") # Skipping ahead to the next line with two closing brackets. _skip_close(f, line.count("(") - line.count(")")) diff --git a/src/meshio/dolfin/_dolfin.py b/src/meshio/dolfin/_dolfin.py index f26b22214..b9af20476 100644 --- a/src/meshio/dolfin/_dolfin.py +++ b/src/meshio/dolfin/_dolfin.py @@ -71,7 +71,7 @@ def _read_mesh(filename): assert cell_tags is not None cells[0][1][k] = [elem.attrib[t] for t in cell_tags] else: - warn("Unknown entry %s. Ignoring.", elem.tag) + warn(f"Unknown entry {elem.tag}. Ignoring.") elem.clear() @@ -140,9 +140,7 @@ def _write_mesh(filename, points, cell_type, cells): discarded_cell_types = {c.type for c in cells if c.type != cell_type} warn( "DOLFIN XML can only handle one cell type at a time. " - "Using %s, discarding %s.", - cell_type, - ", ".join(discarded_cell_types), + + f"Using {cell_type}, discarding {', '.join(discarded_cell_types)}.", ) dim = points.shape[1] diff --git a/src/meshio/vtk/_vtk_42.py b/src/meshio/vtk/_vtk_42.py index 8462d856e..4f23c9c94 100644 --- a/src/meshio/vtk/_vtk_42.py +++ b/src/meshio/vtk/_vtk_42.py @@ -605,7 +605,7 @@ def pad(array): if mesh.points.shape[1] == 2: warn( "VTK requires 3D points, but 2D points given. " - "Appending 0 third component." + + "Appending 0 third component." ) points = pad(mesh.points) else: @@ -616,7 +616,7 @@ def pad(array): if len(values.shape) == 2 and values.shape[1] == 2: warn( "VTK requires 3D vectors, but 2D vectors given. " - "Appending 0 third component to {}.".format(name) + + f"Appending 0 third component to {name}." ) mesh.point_data[name] = pad(values) @@ -625,7 +625,7 @@ def pad(array): if len(values.shape) == 2 and values.shape[1] == 2: warn( "VTK requires 3D vectors, but 2D vectors given. " - "Appending 0 third component to {}.".format(name) + + f"Appending 0 third component to {name}." ) data[k] = pad(data[k]) diff --git a/src/meshio/xdmf/time_series.py b/src/meshio/xdmf/time_series.py index 0bf2a5d8b..a3f85030a 100644 --- a/src/meshio/xdmf/time_series.py +++ b/src/meshio/xdmf/time_series.py @@ -256,7 +256,7 @@ def __init__(self, filename, data_format: str = "HDF") -> None: ET.register_namespace("xi", "https://www.w3.org/2001/XInclude/") self.has_mesh = False - self.mesh_name = None + self.mesh_name = "mesh" def __enter__(self): if self.data_format == "HDF": @@ -284,7 +284,6 @@ def write_points_cells( # maxwell.h5:/Mesh/0/mesh/geometry # # - self.mesh_name = "mesh" grid = ET.SubElement( self.domain, "Grid", Name=self.mesh_name, GridType="Uniform" ) @@ -388,18 +387,17 @@ def cells( NumberOfElements=str(num_cells), ) dt, prec = numpy_to_xdmf_dtype[cell_blocks[0].data.dtype.name] - dim = "{} {}".format(*cell_blocks[0].data.shape) data_item = ET.SubElement( topo, "DataItem", DataType=dt, - Dimensions=dim, + Dimensions="{} {}".format(*cell_blocks[0].data.shape), Format=self.data_format, Precision=prec, ) data_item.text = self.numpy_to_xml_string(cell_blocks[0].data) elif len(cell_blocks) > 1: - total_num_cells = sum(c.data.shape[0] for c in cell_blocks) + total_num_cells = sum(len(c.data) for c in cell_blocks) topo = ET.SubElement( grid, "Topology",