athphane / userbot

Unnecessary use of json.dumps() for file data PY-W0079
Anti-pattern
Major
6 months ago6 months old
f.write(json.dumps(file_json)) can be replaced with json.dump(file_json, f)
32    message_id = media.id
33    file_json[name] = message_id
34    with open("file_ids.txt", "w") as f:
35        f.write(json.dumps(file_json))36
37
38# Function to reuse to send animation and remember the file_id
f.write(json.dumps({})) can be replaced with json.dump({}, f)
 9
10def reset_file_ids():
11    with open("file_ids.txt", "w") as f:
12        f.write(json.dumps({}))13
14
15if not os.path.exists("file_ids.txt"):