Closed Bug 1276254 Opened 10 years ago Closed 10 years ago

Replace unnecessary usage of read() when loading json from files

Categories

(Tree Management :: Treeherder, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

Details

Attachments

(1 file)

Another minor cleanup that's been sitting in my stashes for a while (having a spring clean). This pattern: with open(...) as f: foo = json.loads(f.read()) Can be replaced with: with open(...) as f: foo = json.load(f)
Attachment #8757343 - Flags: review?(cdawson)
Attachment #8757343 - Flags: review?(cdawson) → review+
Commit pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/b6677fd5c699a676203baf1e38905510cc93cfa1 Bug 1276254 - Remove unnecessary usage of .read() when json decoding By using `json.load()` instead of `json.loads()` we can pass the file object directly, rather than having to `.read()` it first.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: