Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1598)

Delta Between Two Patch Sets: Lib/fileinput.py

Issue 25788: fileinput.hook_encoded has no way to pass arguments to codecs
Left Patch Set: Created 3 years, 5 months ago
Right Patch Set: Created 3 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 """Helper class to quickly write a loop over all standard input files. 1 """Helper class to quickly write a loop over all standard input files.
2 2
3 Typical use is: 3 Typical use is:
4 4
5 import fileinput 5 import fileinput
6 for line in fileinput.input(): 6 for line in fileinput.input():
7 process(line) 7 process(line)
8 8
9 This iterates over the lines of all files listed in sys.argv[1:], 9 This iterates over the lines of all files listed in sys.argv[1:],
10 defaulting to sys.stdin if the list is empty. If a filename is '-' it 10 defaulting to sys.stdin if the list is empty. If a filename is '-' it
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 if o == '-b': backup = a 428 if o == '-b': backup = a
429 for line in input(args, inplace=inplace, backup=backup): 429 for line in input(args, inplace=inplace, backup=backup):
430 if line[-1:] == '\n': line = line[:-1] 430 if line[-1:] == '\n': line = line[:-1]
431 if line[-1:] == '\r': line = line[:-1] 431 if line[-1:] == '\r': line = line[:-1]
432 print("%d: %s[%d]%s %s" % (lineno(), filename(), filelineno(), 432 print("%d: %s[%d]%s %s" % (lineno(), filename(), filelineno(),
433 isfirstline() and "*" or "", line)) 433 isfirstline() and "*" or "", line))
434 print("%d: %s[%d]" % (lineno(), filename(), filelineno())) 434 print("%d: %s[%d]" % (lineno(), filename(), filelineno()))
435 435
436 if __name__ == '__main__': 436 if __name__ == '__main__':
437 _test() 437 _test()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+