Skip to content

Commit

Permalink
Simplify _make_numpy_header
Browse files Browse the repository at this point in the history
Let Python do the work of turning a dict into a repr thereof.
  • Loading branch information
bmerry committed Aug 2, 2023
1 parent 3063c3a commit e60faff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/spead2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,12 @@ def _parse_numpy_header(cls, header):

@classmethod
def _make_numpy_header(self, shape, dtype, order):
return "{{'descr': {!r}, 'fortran_order': {!r}, 'shape': {!r}}}".format(
_np.lib.format.dtype_to_descr(dtype), order == "F", tuple(shape)
return repr(
{
"descr": _np.lib.format.dtype_to_descr(dtype),
"fortran_order": order == "F",
"shape": tuple(shape),
}
)

@classmethod
Expand Down

0 comments on commit e60faff

Please sign in to comment.