Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def getDevices(kind=None):
"""Returns a dict of dict of audio devices of specified `kind`
The dict keys are names and items are dicts of properties
"""
devs = {}
if travisCI: # travis-CI testing does not have a sound device
return devs
else:
allDevs = audio.get_devices(kind)
# annoyingly query_devices is a DeviceList or a dict depending on number
if type(allDevs) == dict:
allDevs = [allDevs]
for ii, dev in enumerate(allDevs):
# newline characters must be removed
devName = dev['name'].replace('\r\n', '')
devs[devName] = dev
dev['id'] = ii
return devs