Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse_arg():
keyboards = keymapviz.KEYBOARDS.keys()
types = list(TYPES.keys())
desc = 'keymap.c visualizer'
parser = argparse.ArgumentParser(description=desc,
epilog='Following keyboards are supported.\n * '+'\n * '.join(keyboards),
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('-k', '--keyboard', type=str, choices=keyboards, help='keyboard of keymap.c', metavar='keyboards')
parser.add_argument('-o', '--output', type=str, help='output file name("{}" is replaced index)')
parser.add_argument('-r', '--replace', action='store_true', help='replace comment block including "[keymapviz]" with ascii art. (make *.bac)')
parser.add_argument('-t', '--type', dest='type_', type=str, choices=types, default=types[0], help='type of output(default:ascii)')
parser.add_argument('-v', '--version', action='version', version='%(prog)s {}'.format(VERSION))
parser.add_argument('keymap_c', type=argparse.FileType('r'), help='keymap.c file name')
arg = parser.parse_args()