ยปCore Development>Code coverage>Tools/scripts/suff.py

Python code coverage for Tools/scripts/suff.py

#countcontent
1n/a#! /usr/bin/env python3
2n/a
3n/a# suff
4n/a#
5n/a# show different suffixes amongst arguments
6n/a
7n/aimport sys
8n/a
9n/a
10n/adef main():
11n/a files = sys.argv[1:]
12n/a suffixes = {}
13n/a for filename in files:
14n/a suff = getsuffix(filename)
15n/a suffixes.setdefault(suff, []).append(filename)
16n/a for suff, filenames in sorted(suffixes.items()):
17n/a print(repr(suff), len(filenames))
18n/a
19n/a
20n/adef getsuffix(filename):
21n/a name, sep, suff = filename.rpartition('.')
22n/a return sep + suff if sep else ''
23n/a
24n/a
25n/aif __name__ == '__main__':
26n/a main()