Skip to content

Commit

Permalink
Do not compare types, use isinstance()
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwoerer committed Apr 30, 2024
1 parent a5c1411 commit 2c30f24
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions boututils/datafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"""


import numpy as np

from boututils.boutarray import BoutArray
Expand Down Expand Up @@ -942,7 +941,7 @@ def write(self, name, data, info=False):

try:
for attrname, attrval in data.attributes.items():
if type(attrval) == str:
if isinstance(attrval, str):
attrval = attrval.encode(encoding="utf-8")
self.handle[name].attrs.create(attrname, attrval)
except AttributeError:
Expand Down

0 comments on commit 2c30f24

Please sign in to comment.