Skip to content

Commit d86aa52

Browse files
committed
Wrapping 'open' with 'with' to prevent ResourceWarnings
1 parent 64ee50d commit d86aa52

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mbed_lstools/platform_database.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ def __init__(self, database_files, primary_database=None):
267267
self._keys = set()
268268
for db in database_files:
269269
try:
270-
new_db = json.load(open(db, encoding="utf-8"))
270+
with open(db, encoding="utf-8") as db_json_file:
271+
new_db = json.load(db_json_file)
271272
duplicates = set(self._keys).intersection(set(new_db.keys()))
272273
if duplicates:
273274
logger.warning(

0 commit comments

Comments
 (0)