Skip to content

Commit e7c0dba

Browse files
committed
get rid of try catch and simplify logic
Signed-off-by: wiseaidev <[email protected]>
1 parent 635bab0 commit e7c0dba

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

aredis_om/model/model.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -1198,15 +1198,9 @@ def to_string(s):
11981198
map(to_string, res[i + offset][1::2]),
11991199
)
12001200
)
1201-
1202-
try:
1203-
fields["json"] = fields["$"]
1204-
del fields["$"]
1205-
except KeyError:
1206-
pass
1207-
1208-
if "json" in fields:
1209-
json_fields = json.loads(fields["json"])
1201+
# $ means a json entry
1202+
if fields.get("$"):
1203+
json_fields = json.loads(fields.get("$"))
12101204
doc = cls(**json_fields)
12111205
else:
12121206
doc = cls(**fields)

0 commit comments

Comments
 (0)