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 and wkentaro committed Jan 7, 2024
1 parent a38ad73 commit 82dc203
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 @@ -10,7 +10,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 82dc203

Please sign in to comment.