Skip to content

Commit

Permalink
Update util.py
Browse files Browse the repository at this point in the history
refactor with With statement to open file to make code more Pythonic
  • Loading branch information
anonymousdouble authored Dec 19, 2023
1 parent 2975acc commit a8a4202
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/labelme_tests/utils_tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

def get_img_and_data():
json_file = osp.join(data_dir, "annotated_with_data/apc2016_obj3.json")
data = json.load(open(json_file))
with open(json_file) as f:
data = json.load(f)
img_b64 = data["imageData"]
img = image_module.img_b64_to_arr(img_b64)
return img, data
Expand Down

0 comments on commit a8a4202

Please sign in to comment.