mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
New == syntax
This commit is contained in:
parent
4d8e859e8f
commit
bdfcfccbe5
73 changed files with 419 additions and 391 deletions
|
|
@ -17,13 +17,13 @@ except NameError:
|
|||
statfunc = posix.stat
|
||||
|
||||
# Parse options
|
||||
if sys.argv[1] = '-m':
|
||||
if sys.argv[1] == '-m':
|
||||
itime = ST_MTIME
|
||||
del sys.argv[1]
|
||||
elif sys.argv[1] = '-c':
|
||||
elif sys.argv[1] == '-c':
|
||||
itime = ST_CTIME
|
||||
del sys.argv[1]
|
||||
elif sys.argv[1] = '-a':
|
||||
elif sys.argv[1] == '-a':
|
||||
itime = ST_CTIME
|
||||
del sys.argv[1]
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ def main():
|
|||
silent = 0
|
||||
verbose = 0
|
||||
if sys.argv[1:]:
|
||||
if sys.argv[1] = '-v':
|
||||
if sys.argv[1] == '-v':
|
||||
verbose = 1
|
||||
elif sys.argv[1] = '-s':
|
||||
elif sys.argv[1] == '-s':
|
||||
silent = 1
|
||||
MAGIC = '\0\0\0\0'
|
||||
try:
|
||||
|
|
@ -32,7 +32,7 @@ def main():
|
|||
print 'Checking', `dirname`, '...'
|
||||
names.sort()
|
||||
for name in names:
|
||||
if name[-3:] = '.py':
|
||||
if name[-3:] == '.py':
|
||||
name = path.join(dirname, name)
|
||||
try:
|
||||
st = posix.stat(name)
|
||||
|
|
@ -55,7 +55,7 @@ def main():
|
|||
print `name_c`
|
||||
continue
|
||||
mtime = get_long(mtime_str)
|
||||
if mtime = 0 or mtime = -1:
|
||||
if mtime == 0 or mtime == -1:
|
||||
print 'Bad ".pyc" file', `name_c`
|
||||
elif mtime <> st[ST_MTIME]:
|
||||
print 'Out-of-date ".pyc" file',
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ def visit(pattern, dirname, names):
|
|||
name = path.join(dirname, name)
|
||||
try:
|
||||
linkto = posix.readlink(name)
|
||||
if linkto[:n] = pattern:
|
||||
if linkto[:n] == pattern:
|
||||
print name, '->', linkto
|
||||
except posix.error:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -170,18 +170,18 @@ def main():
|
|||
return 1
|
||||
optu = optc = optd = 0
|
||||
for opt, void in optlist:
|
||||
if opt = '-u':
|
||||
if opt == '-u':
|
||||
optu = 1
|
||||
elif opt = '-c':
|
||||
elif opt == '-c':
|
||||
optc = 1
|
||||
elif opt = '-d':
|
||||
elif opt == '-d':
|
||||
optd = 1
|
||||
if optu = optc = optd = 0:
|
||||
if optu == optc == optd == 0:
|
||||
optu = optc = optd = 1
|
||||
if not args:
|
||||
args = ['-']
|
||||
for file in args:
|
||||
if file = '-':
|
||||
if file == '-':
|
||||
readinput(sys.stdin)
|
||||
else:
|
||||
readinput(open(file, 'r'))
|
||||
|
|
|
|||
|
|
@ -67,13 +67,13 @@ m_from = regexp.compile('^[ \t]*import[ \t]+([^#]+)')
|
|||
def process(filename, table):
|
||||
fp = open(filename, 'r')
|
||||
mod = path.basename(filename)
|
||||
if mod[-3:] = '.py':
|
||||
if mod[-3:] == '.py':
|
||||
mod = mod[:-3]
|
||||
table[mod] = list = []
|
||||
while 1:
|
||||
line = fp.readline()
|
||||
if not line: break
|
||||
while line[-1:] = '\\':
|
||||
while line[-1:] == '\\':
|
||||
nextline = fp.readline()
|
||||
if not nextline: break
|
||||
line = line[:-1] + nextline
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ def treat_file(file):
|
|||
print 'Cannot open', file
|
||||
return
|
||||
base = path.basename(file)
|
||||
if base[-3:] = '.py': base = base[:-3]
|
||||
if base[-3:] == '.py': base = base[:-3]
|
||||
s = base + '\t' + file + '\t' + '1\n'
|
||||
tags.append(s)
|
||||
while 1:
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ def main():
|
|||
def getsuffix(file):
|
||||
suff = ''
|
||||
for i in range(len(file)):
|
||||
if file[i] = '.':
|
||||
if file[i] == '.':
|
||||
suff = file[i:]
|
||||
return suff
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ for prog in sys.argv[1:]:
|
|||
mode = S_IMODE(st[ST_MODE])
|
||||
if mode % 2 or mode/8 % 2 or mode/64 % 2:
|
||||
if ident:
|
||||
if st[:3] = ident:
|
||||
if st[:3] == ident:
|
||||
s = ': same as '
|
||||
else:
|
||||
s = ': also '
|
||||
|
|
|
|||
|
|
@ -50,19 +50,19 @@ def skipfile(file):
|
|||
# Skip executables
|
||||
try:
|
||||
data = open(file, 'r').read(len(EXECMAGIC))
|
||||
if data = EXECMAGIC: return 1
|
||||
if data == EXECMAGIC: return 1
|
||||
except:
|
||||
pass
|
||||
return 0
|
||||
|
||||
def badprefix(file):
|
||||
for bad in badprefixes:
|
||||
if file[:len(bad)] = bad: return 1
|
||||
if file[:len(bad)] == bad: return 1
|
||||
return 0
|
||||
|
||||
def badsuffix(file):
|
||||
for bad in badsuffixes:
|
||||
if file[-len(bad):] = bad: return 1
|
||||
if file[-len(bad):] == bad: return 1
|
||||
return 0
|
||||
|
||||
def go(args):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue