[Python-checkins] python/dist/src/Demo/scripts find-uname.py,NONE,1.1.6.1 pp.py,1.4,1.4.30.1 README,1.18,1.18.30.1
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Mon, 28 Apr 2003 10:39:43 -0700
Update of /cvsroot/python/python/dist/src/Demo/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv27228/Demo/scripts
Modified Files:
Tag: ast-branch
pp.py README
Added Files:
Tag: ast-branch
find-uname.py
Log Message:
Merge head to this branch.
Merge all sorts of changes from just before 2.3b1 into the ast
branch. This should make the eventual merge back to the trunk easier.
The merge is almost entirely porting changes into the ast-branch.
There was no attempt to get changes to compile.c into newcompile.c.
That work should be done when newcompile.c is closer to completion.
The only significant conflicts appeared to be in pythonrun.c.
--- NEW FILE: find-uname.py ---
#!/usr/bin/env python
"""
For each argument on the command line, look for it in the set of all Unicode
names. Arguments are treated as case-insensitive regular expressions, e.g.:
% find-uname 'small letter a$' 'horizontal line'
*** small letter a$ matches ***
LATIN SMALL LETTER A (97)
COMBINING LATIN SMALL LETTER A (867)
CYRILLIC SMALL LETTER A (1072)
PARENTHESIZED LATIN SMALL LETTER A (9372)
CIRCLED LATIN SMALL LETTER A (9424)
FULLWIDTH LATIN SMALL LETTER A (65345)
*** horizontal line matches ***
HORIZONTAL LINE EXTENSION (9135)
"""
import unicodedata
import sys
import re
def main(args):
unicode_names= []
for ix in range(sys.maxunicode+1):
try:
unicode_names.append( (ix, unicodedata.name(unichr(ix))) )
except ValueError: # no name for the character
pass
for arg in args:
pat = re.compile(arg, re.I)
matches = [(x,y) for (x,y) in unicode_names
if pat.search(y) is not None]
if matches:
print "***", arg, "matches", "***"
for (x,y) in matches:
print "%s (%d)" % (y,x)
if __name__ == "__main__":
main(sys.argv[1:])
Index: pp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/scripts/pp.py,v
retrieving revision 1.4
retrieving revision 1.4.30.1
diff -C2 -d -r1.4 -r1.4.30.1
*** pp.py 27 Nov 1996 19:47:06 -0000 1.4
--- pp.py 28 Apr 2003 17:38:38 -0000 1.4.30.1
***************
*** 121,138 ****
import tempfile
! tfn = tempfile.mktemp()
! try:
! fp = open(tfn, 'w')
! fp.write(program)
! fp.close()
! if DFLAG:
! import pdb
! pdb.run('execfile(' + `tfn` + ')')
! else:
! execfile(tfn)
! finally:
! import os
! try:
! os.unlink(tfn)
! except:
! pass
--- 121,130 ----
import tempfile
! fp = tempfile.NamedTemporaryFile()
! fp.write(program)
! fp.flush()
! if DFLAG:
! import pdb
! pdb.run('execfile(' + `tfn` + ')')
! else:
! execfile(tfn)
Index: README
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/scripts/README,v
retrieving revision 1.18
retrieving revision 1.18.30.1
diff -C2 -d -r1.18 -r1.18.30.1
*** README 2 Mar 1995 16:00:55 -0000 1.18
--- README 28 Apr 2003 17:38:39 -0000 1.18.30.1
***************
*** 4,7 ****
--- 4,8 ----
fact.py Factorize numbers
+ find-uname.py Search for Unicode characters using regexps.
from.py Summarize mailbox
ftpstats.py Summarize ftp daemon log file