Skip to content

Commit 856ee65

Browse files
committed
keep backward compatibility for enum members key
1 parent 133e962 commit 856ee65

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

data/json/bool_attr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"class": "H5T_INTEGER"
2121
},
2222
"class": "H5T_ENUM",
23-
"mapping": [
23+
"members": [
2424
{
2525
"name": "FALSE",
2626
"value": 0

data/json/bool_dset.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"class": "H5T_INTEGER"
2525
},
2626
"class": "H5T_ENUM",
27-
"mapping": [
27+
"members": [
2828
{
2929
"name": "FALSE",
3030
"value": 0

data/json/enum_attr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"class": "H5T_INTEGER"
2222
},
2323
"class": "H5T_ENUM",
24-
"mapping": [
24+
"members": [
2525
{
2626
"name": "GAS",
2727
"value": 2

data/json/enum_dset.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"class": "H5T_INTEGER"
2626
},
2727
"class": "H5T_ENUM",
28-
"mapping": [
28+
"members": [
2929
{
3030
"name": "GAS",
3131
"value": 2

src/h5json/hdf5db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ def getObjByPath(self, path):
797797
def getObjectByUuid(self, col_type, obj_uuid):
798798
# col_type should be either "datasets", "groups", or "datatypes"
799799
if col_type not in ("datasets", "groups", "datatypes"):
800-
msg = "Unexpectd error, invalid col_type: [" + col_type + "]"
800+
msg = "Unexpected error, invalid col_type: [" + col_type + "]"
801801
self.log.error(msg)
802802
raise IOError(errno.EIO, msg)
803803
if col_type == "groups" and obj_uuid == self.dbGrp.attrs["rootUUID"]:

src/h5json/hdf5dtype.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,9 +735,13 @@ def createBaseDataType(typeItem):
735735
if base_json["class"] != "H5T_INTEGER":
736736
msg = "Only integer base types can be used with enum type"
737737
raise TypeError(msg)
738-
if "mapping" not in typeItem:
738+
if "mapping" in typeItem:
739+
mapping = typeItem["mapping"]
740+
elif "members" in typeItem:
741+
mapping = typeItem["members"] # backward-compatibility for hdf5-json
742+
else:
739743
raise KeyError("'mapping' not provided for enum type")
740-
mapping = typeItem["mapping"]
744+
741745
if len(mapping) == 0:
742746
raise KeyError("empty enum map")
743747

0 commit comments

Comments
 (0)