##// END OF EJS Templates
Merge pull request #12633 from NotWearingPants/cleanup/autogen_shortcuts.py
Matthias Bussonnier -
r26186:e201af86 merge
parent child Browse files
Show More
@@ -1,4 +1,4 b''
1 from os.path import abspath, dirname, join
1 from pathlib import Path
2
2
3 from IPython.terminal.shortcuts import create_ipython_shortcuts
3 from IPython.terminal.shortcuts import create_ipython_shortcuts
4
4
@@ -77,16 +77,18 b' for kb in ipy_bindings:'
77
77
78
78
79 if __name__ == '__main__':
79 if __name__ == '__main__':
80
80 here = Path(__file__).parent
81 sort_key = lambda k:(str(k[0][1]),str(k[0][0]))
81 dest = here / "source" / "config" / "shortcuts"
82
82
83 here = abspath(dirname(__file__))
83 def sort_key(item):
84 dest = join(here, 'source', 'config', 'shortcuts')
84 k, v = item
85
85 shortcut, flt = k
86 with open(join(dest, 'single_filtered.csv'), 'w') as csv:
86 return (str(shortcut), str(flt))
87 for k, v in sorted(single_filter.items(), key=sort_key):
87
88 csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))
88 for filters, output_filename in [
89
89 (single_filter, "single_filtered"),
90 with open(join(dest, 'multi_filtered.csv'), 'w') as csv:
90 (multi_filter, "multi_filtered"),
91 for k, v in sorted(multi_filter.items(), key=sort_key):
91 ]:
92 csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))
92 with (dest / "{}.csv".format(output_filename)).open("w") as csv:
93 for (shortcut, flt), v in sorted(filters.items(), key=sort_key):
94 csv.write(":kbd:`{}`\t{}\t{}\n".format(shortcut, flt, v))
General Comments 0
You need to be logged in to leave comments. Login now