Staging
v0.5.1
https://github.com/python/cpython
Revision 814d687c7df3e0c60036943b68ece13f9f19dfef authored by Batuhan Taşkaya on 16 December 2019, 18:23:27 UTC, committed by Victor Stinner on 16 December 2019, 18:23:27 UTC
Add -i and --indent (indentation level), and --no-type-comments
(type comments) command line options to ast parsing tool.
1 parent a322f50
Raw File
Tip revision: 814d687c7df3e0c60036943b68ece13f9f19dfef authored by Batuhan Taşkaya on 16 December 2019, 18:23:27 UTC
bpo-38348: Extend command line options of ast parsing tool (GH-16540)
Tip revision: 814d687
suff.py
#! /usr/bin/env python3

# suff
#
# show different suffixes amongst arguments

import sys


def main():
    files = sys.argv[1:]
    suffixes = {}
    for filename in files:
        suff = getsuffix(filename)
        suffixes.setdefault(suff, []).append(filename)
    for suff, filenames in sorted(suffixes.items()):
        print(repr(suff), len(filenames))


def getsuffix(filename):
    name, sep, suff = filename.rpartition('.')
    return sep + suff if sep else ''


if __name__ == '__main__':
    main()
back to top