def get_device(device): builds = get_builds() if device not in builds: raise DeviceNotFoundException( "This device has no available builds. Please select another device." ) return builds[device]
def get_device_data(device): devices_data = get_devices_data() for device_data in devices_data: if device_data['model'] == device: return device_data raise DeviceNotFoundException('This device does not exist')
def get_device_builds(device): builds = get_builds() if device not in builds: raise DeviceNotFoundException( 'This device has no available builds. Please select another device.' ) device_builds = builds[device] device_builds.sort(key=lambda b: b['datetime'], reverse=True) return device_builds