Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def keymap(keyboard):
"""Locate the correct directory for storing a keymap.
Args:
keyboard
The name of the keyboard. Example: clueboard/66/rev3
"""
for directory in ['.', '..', '../..', '../../..', '../../../..', '../../../../..']:
basepath = os.path.normpath(os.path.join('keyboards', keyboard, directory, 'keymaps'))
if os.path.exists(basepath):
return basepath
logging.error('Could not find keymaps directory!')
raise NoSuchKeyboardError('Could not find keymaps directory for: %s' % keyboard)