Mercurial > cpython-lru_cache-weakref
annotate Tools/scripts/suff.py @ 52039:bebc4eef9e89
Blocked revisions 70166-70167,70169,70176,70178,70197 via svnmerge
........
r70166 | georg.brandl | 2009-03-04 12:24:41 -0600 (Wed, 04 Mar 2009) | 2 lines
Remove obsolete stuff from string module docs.
........
r70167 | ronald.oussoren | 2009-03-04 15:07:19 -0600 (Wed, 04 Mar 2009) | 2 lines
Fix issue 5224.
........
r70169 | ronald.oussoren | 2009-03-04 15:12:17 -0600 (Wed, 04 Mar 2009) | 2 lines
Fix for issue 5226.
........
r70176 | ronald.oussoren | 2009-03-04 15:35:05 -0600 (Wed, 04 Mar 2009) | 2 lines
Fixes issues 3883 and 5194
........
r70178 | ronald.oussoren | 2009-03-04 16:49:36 -0600 (Wed, 04 Mar 2009) | 2 lines
Fix for issue #1113328.
........
r70197 | jesus.cea | 2009-03-05 13:37:37 -0600 (Thu, 05 Mar 2009) | 1 line
Minor bsddb documentation glitch
........
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Thu, 05 Mar 2009 22:53:54 +0000 |
| parents | 893a4dc17a91 |
| children | fcfe324663a6 |
| rev | line source |
|---|---|
|
4573
73758db2f464
/usr/local/bin/python -> /usr/bin/env python
Guido van Rossum <guido@python.org>
parents:
1269
diff
changeset
|
1 #! /usr/bin/env python |
| 274 | 2 |
| 3 # suff | |
| 4 # | |
| 5 # show different suffixes amongst arguments | |
| 6 | |
| 7 import sys | |
| 8 | |
| 9 def main(): | |
|
15930
14a27acc755a
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
4573
diff
changeset
|
10 files = sys.argv[1:] |
|
14a27acc755a
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
4573
diff
changeset
|
11 suffixes = {} |
|
29107
93c92f20b6bf
Fix use of 'file' as a variable name.
Andrew M. Kuchling <amk@amk.ca>
parents:
15930
diff
changeset
|
12 for filename in files: |
|
93c92f20b6bf
Fix use of 'file' as a variable name.
Andrew M. Kuchling <amk@amk.ca>
parents:
15930
diff
changeset
|
13 suff = getsuffix(filename) |
|
47100
893a4dc17a91
Ran 2to3 over scripts directory.
Georg Brandl <georg@python.org>
parents:
42427
diff
changeset
|
14 if suff not in suffixes: |
|
15930
14a27acc755a
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
4573
diff
changeset
|
15 suffixes[suff] = [] |
|
29107
93c92f20b6bf
Fix use of 'file' as a variable name.
Andrew M. Kuchling <amk@amk.ca>
parents:
15930
diff
changeset
|
16 suffixes[suff].append(filename) |
|
47100
893a4dc17a91
Ran 2to3 over scripts directory.
Georg Brandl <georg@python.org>
parents:
42427
diff
changeset
|
17 keys = sorted(suffixes.keys()) |
|
15930
14a27acc755a
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
4573
diff
changeset
|
18 for suff in keys: |
|
42427
46625e6122e9
Convert print statements to function calls in Tools/.
Collin Winter <collinw@gmail.com>
parents:
33074
diff
changeset
|
19 print(repr(suff), len(suffixes[suff])) |
| 274 | 20 |
|
29107
93c92f20b6bf
Fix use of 'file' as a variable name.
Andrew M. Kuchling <amk@amk.ca>
parents:
15930
diff
changeset
|
21 def getsuffix(filename): |
|
15930
14a27acc755a
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
4573
diff
changeset
|
22 suff = '' |
|
29107
93c92f20b6bf
Fix use of 'file' as a variable name.
Andrew M. Kuchling <amk@amk.ca>
parents:
15930
diff
changeset
|
23 for i in range(len(filename)): |
|
93c92f20b6bf
Fix use of 'file' as a variable name.
Andrew M. Kuchling <amk@amk.ca>
parents:
15930
diff
changeset
|
24 if filename[i] == '.': |
|
93c92f20b6bf
Fix use of 'file' as a variable name.
Andrew M. Kuchling <amk@amk.ca>
parents:
15930
diff
changeset
|
25 suff = filename[i:] |
|
15930
14a27acc755a
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
4573
diff
changeset
|
26 return suff |
| 274 | 27 |
|
33074
981fff7363b9
[Patch #1005491 ] use __name__ == '__main__' in scripts
Andrew M. Kuchling <amk@amk.ca>
parents:
31515
diff
changeset
|
28 if __name__ == '__main__': |
|
981fff7363b9
[Patch #1005491 ] use __name__ == '__main__' in scripts
Andrew M. Kuchling <amk@amk.ca>
parents:
31515
diff
changeset
|
29 main() |
