mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Whitespace normalization, via reindent.py.
This commit is contained in:
parent
182b5aca27
commit
3d7d372ce3
13 changed files with 49 additions and 53 deletions
|
@ -6,4 +6,3 @@ setup(name="noddy", version="1.0",
|
||||||
Extension("noddy3", ["noddy3.c"]),
|
Extension("noddy3", ["noddy3.c"]),
|
||||||
Extension("noddy4", ["noddy4.c"]),
|
Extension("noddy4", ["noddy4.c"]),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -211,4 +211,3 @@ sys.path.append(src)
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import doctest, __main__
|
import doctest, __main__
|
||||||
doctest.testmod(__main__)
|
doctest.testmod(__main__)
|
||||||
|
|
||||||
|
|
|
@ -58,5 +58,3 @@ if __name__ == "__main__":
|
||||||
(options, args) = parser.parse_args(["-F", "bar"])
|
(options, args) = parser.parse_args(["-F", "bar"])
|
||||||
assert options.file == "bar", options.file
|
assert options.file == "bar", options.file
|
||||||
print "ok: case insensitive short options work"
|
print "ok: case insensitive short options work"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ def handleSlideshow(slideshow):
|
||||||
|
|
||||||
def handleSlides(slides):
|
def handleSlides(slides):
|
||||||
for slide in slides:
|
for slide in slides:
|
||||||
handleSlide(slide)
|
handleSlide(slide)
|
||||||
|
|
||||||
def handleSlide(slide):
|
def handleSlide(slide):
|
||||||
handleSlideTitle(slide.getElementsByTagName("title")[0])
|
handleSlideTitle(slide.getElementsByTagName("title")[0])
|
||||||
|
|
|
@ -3,11 +3,11 @@ import optparse
|
||||||
class OptionParser (optparse.OptionParser):
|
class OptionParser (optparse.OptionParser):
|
||||||
|
|
||||||
def check_required (self, opt):
|
def check_required (self, opt):
|
||||||
option = self.get_option(opt)
|
option = self.get_option(opt)
|
||||||
|
|
||||||
# Assumes the option's 'default' is set to None!
|
# Assumes the option's 'default' is set to None!
|
||||||
if getattr(self.values, option.dest) is None:
|
if getattr(self.values, option.dest) is None:
|
||||||
self.error("%s option not supplied" % option)
|
self.error("%s option not supplied" % option)
|
||||||
|
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
|
|
|
@ -11,13 +11,13 @@ def main():
|
||||||
nwords = len(words)
|
nwords = len(words)
|
||||||
nrows = (nwords + ncols - 1) / ncols
|
nrows = (nwords + ncols - 1) / ncols
|
||||||
for irow in range(nrows):
|
for irow in range(nrows):
|
||||||
for icol in range(ncols):
|
for icol in range(ncols):
|
||||||
i = irow + icol * nrows
|
i = irow + icol * nrows
|
||||||
if 0 <= i < nwords:
|
if 0 <= i < nwords:
|
||||||
word = words[i]
|
word = words[i]
|
||||||
else:
|
else:
|
||||||
word = ""
|
word = ""
|
||||||
print "%-*s" % (colwidth, word),
|
print "%-*s" % (colwidth, word),
|
||||||
print
|
print
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
|
|
||||||
l = []
|
l = []
|
||||||
try:
|
try:
|
||||||
while 1:
|
while 1:
|
||||||
l = l + raw_input().split()
|
l = l + raw_input().split()
|
||||||
except EOFError:
|
except EOFError:
|
||||||
pass
|
pass
|
||||||
l.sort()
|
l.sort()
|
||||||
for x in l[:]:
|
for x in l[:]:
|
||||||
while l.count(x) > 1: l.remove(x)
|
while l.count(x) > 1: l.remove(x)
|
||||||
ncols = 5
|
ncols = 5
|
||||||
nrows = (len(l)+ncols-1)/ncols
|
nrows = (len(l)+ncols-1)/ncols
|
||||||
for i in range(nrows):
|
for i in range(nrows):
|
||||||
for j in range(i, len(l), nrows):
|
for j in range(i, len(l), nrows):
|
||||||
print l[j].ljust(10),
|
print l[j].ljust(10),
|
||||||
print
|
print
|
||||||
|
|
|
@ -438,8 +438,8 @@ def openfile(file):
|
||||||
return p
|
return p
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print usage_mode
|
print usage_mode
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def do_it(args = None):
|
def do_it(args = None):
|
||||||
if not args:
|
if not args:
|
||||||
|
|
30
PC/testpy.py
30
PC/testpy.py
|
@ -5,28 +5,28 @@ import sys
|
||||||
# change this module too.
|
# change this module too.
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import string
|
import string
|
||||||
except:
|
except:
|
||||||
print """Could not import the standard "string" module.
|
print """Could not import the standard "string" module.
|
||||||
Please check your PYTHONPATH environment variable."""
|
Please check your PYTHONPATH environment variable."""
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import regex_syntax
|
import regex_syntax
|
||||||
except:
|
except:
|
||||||
print """Could not import the standard "regex_syntax" module. If this is
|
print """Could not import the standard "regex_syntax" module. If this is
|
||||||
a PC, you should add the dos_8x3 directory to your PYTHONPATH."""
|
a PC, you should add the dos_8x3 directory to your PYTHONPATH."""
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
for dir in sys.path:
|
for dir in sys.path:
|
||||||
file = os.path.join(dir, "string.py")
|
file = os.path.join(dir, "string.py")
|
||||||
if os.path.isfile(file):
|
if os.path.isfile(file):
|
||||||
test = os.path.join(dir, "test")
|
test = os.path.join(dir, "test")
|
||||||
if os.path.isdir(test):
|
if os.path.isdir(test):
|
||||||
# Add the "test" directory to PYTHONPATH.
|
# Add the "test" directory to PYTHONPATH.
|
||||||
sys.path = sys.path + [test]
|
sys.path = sys.path + [test]
|
||||||
|
|
||||||
import regrtest # Standard Python tester.
|
import regrtest # Standard Python tester.
|
||||||
regrtest.main()
|
regrtest.main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue