<commit_before>cimport AudioHardware
from AudioHardware cimport *
cimport stdlib

def yo():
	cdef UInt32 sz, ndevices
	cdef AudioDeviceID *devices
	cdef char *name

	AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &sz, NULL)
	ndevices = sz / sizeof(AudioDeviceID)

	print "Number of detected devices:", ndevices<commit_msg>Enumerate core audio devices in cython.<commit_after>cimport AudioHardware
from AudioHardware cimport *
cimport stdlib

cdef extern from "Python.h":
	object PyString_FromStringAndSize(char *v, int len)

def yo():
	cdef UInt32 sz, ndevices, i
	cdef AudioDeviceID *devices
	cdef char *name

	AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &sz, NULL)
	ndevices = sz / sizeof(AudioDeviceID)

	print "Number of detected devices:", ndevices
	devices = stdlib.malloc(sizeof(*devices) * ndevices)
	res = []
	try:
		AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &sz,
				devices)

		for i in range(ndevices):
			AudioDeviceGetPropertyInfo(devices[i], 0, false,
						   kAudioDevicePropertyDeviceName, &sz,
						   NULL)
			name = malloc(sz + 1)
			AudioDeviceGetProperty(devices[i], 0, false,
					kAudioDevicePropertyDeviceName, &sz,
					name)
			devicename = PyString_FromStringAndSize(name, sz+1)
			free(name)
			res.append(devicename)

	finally:
		stdlib.free(devices)

	return devicename
{'fraction_non_alphanumeric': 0.08475836431226766, 'fraction_numerical': 0.005947955390334572, 'mean_word_length': 5.231481481481482, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '670238', 'n_tokens_mistral': 495, 'n_tokens_neox': 431, 'n_words': 112}