mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
[Bug #724767] Avoid use of 'file' as a variable name
This commit is contained in:
parent
2398d578a3
commit
87ddce1bf0
1 changed files with 7 additions and 7 deletions
|
@ -3,17 +3,17 @@
|
||||||
"Replace LF with CRLF in argument files. Print names of changed files."
|
"Replace LF with CRLF in argument files. Print names of changed files."
|
||||||
|
|
||||||
import sys, re, os
|
import sys, re, os
|
||||||
for file in sys.argv[1:]:
|
for filename in sys.argv[1:]:
|
||||||
if os.path.isdir(file):
|
if os.path.isdir(filename):
|
||||||
print file, "Directory!"
|
print filename, "Directory!"
|
||||||
continue
|
continue
|
||||||
data = open(file, "rb").read()
|
data = open(filename, "rb").read()
|
||||||
if '\0' in data:
|
if '\0' in data:
|
||||||
print file, "Binary!"
|
print filename, "Binary!"
|
||||||
continue
|
continue
|
||||||
newdata = re.sub("\r?\n", "\r\n", data)
|
newdata = re.sub("\r?\n", "\r\n", data)
|
||||||
if newdata != data:
|
if newdata != data:
|
||||||
print file
|
print filename
|
||||||
f = open(file, "wb")
|
f = open(filename, "wb")
|
||||||
f.write(newdata)
|
f.write(newdata)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue