fossasia / open-event-server

Unnecessary use of json.loads() for file data PY-W0078
Anti-pattern
Major
5 months agoa year old
json.loads(data) can be replaced with json.load(open(path + '/%s' % item[0]))
375        for item in IMPORT_SERIES:
376            item[1].is_importing = True
377            data = open(path + '/%s' % item[0]).read()
378            dic = json.loads(data)379            changed_ids = create_service_from_json(
380                task_handle, dic, item, new_event.id, service_ids
381            )
json.loads(open(path + '/event').read()) can be replaced with json.load(open(path + '/event'))
351    # create event
352    try:
353        update_state(task_handle, 'Importing event core')
354        data = json.loads(open(path + '/event').read())355        _, data = _trim_id(data)
356        srv = ('event', Event)
357        data = _delete_fields(srv, data)