diff options
Diffstat (limited to 'Lib/lib-old')
-rw-r--r-- | Lib/lib-old/dump.py | 6 | ||||
-rw-r--r-- | Lib/lib-old/grep.py | 2 | ||||
-rw-r--r-- | Lib/lib-old/newdir.py | 6 | ||||
-rw-r--r-- | Lib/lib-old/tb.py | 34 |
4 files changed, 24 insertions, 24 deletions
diff --git a/Lib/lib-old/dump.py b/Lib/lib-old/dump.py index cecc275..ec895b7 100644 --- a/Lib/lib-old/dump.py +++ b/Lib/lib-old/dump.py @@ -31,7 +31,7 @@ def dumpsymtab(dict): def dumpvar(name, x): import sys t = type(x) - if t = type({}): + if t == type({}): print name, '= {}' for key in x.keys(): item = x[key] @@ -42,7 +42,7 @@ def dumpvar(name, x): if not printable(x): print '#', print name, '=', `x` - elif t = type(sys): + elif t == type(sys): print 'import', name, '#', x else: print '#', name, '=', x @@ -58,6 +58,6 @@ def printable(x): if not printable(item): return 0 return 1 - if x = {}: + if x == {}: return 1 return 0 diff --git a/Lib/lib-old/grep.py b/Lib/lib-old/grep.py index bfee3f5..21ef8d8 100644 --- a/Lib/lib-old/grep.py +++ b/Lib/lib-old/grep.py @@ -30,7 +30,7 @@ def ggrep(syntax, pat, filename): prefix = string.rjust(`lineno`, 3) + ': ' print prefix + line if 0: # XXX - start, end = prog.regs()[0] + start, end = prog.regs[0] line = line[:start] if '\t' not in line: prefix = ' ' * (len(prefix) + start) diff --git a/Lib/lib-old/newdir.py b/Lib/lib-old/newdir.py index 9d07d6c..4994bf9 100644 --- a/Lib/lib-old/newdir.py +++ b/Lib/lib-old/newdir.py @@ -53,7 +53,7 @@ def listattrs(x): return total i = 0 while i+1 < len(total): - if total[i] = total[i+1]: + if total[i] == total[i+1]: del total[i+1] else: i = i+1 @@ -62,7 +62,7 @@ def listattrs(x): # Helper to recognize functions # def is_function(x): - return type(x) = type(is_function) + return type(x) == type(is_function) # Approximation of builtin dir(); this lists the user's # variables by default, not the current local name space. @@ -71,7 +71,7 @@ def is_function(x): # class _dirclass: def dir(args): - if type(args) = type(()): + if type(args) == type(()): return listattrs(args[1]) else: import __main__ diff --git a/Lib/lib-old/tb.py b/Lib/lib-old/tb.py index ec63104..ef0c4b5 100644 --- a/Lib/lib-old/tb.py +++ b/Lib/lib-old/tb.py @@ -40,19 +40,19 @@ def browser(tb): break cmd = string.strip(line) if cmd: - if cmd = 'quit': + if cmd == 'quit': break - elif cmd = 'list': + elif cmd == 'list': browserlist(tb) - elif cmd = 'up': + elif cmd == 'up': if ptr-1 >= 0: ptr = ptr-1 else: print 'Bottom of stack.' - elif cmd = 'down': + elif cmd == 'down': if ptr+1 < len(tblist): ptr = ptr+1 else: print 'Top of stack.' - elif cmd = 'locals': + elif cmd == 'locals': printsymbols(tb.tb_frame.f_locals) - elif cmd = 'globals': + elif cmd == 'globals': printsymbols(tb.tb_frame.f_globals) elif cmd in ('?', 'help'): browserhelp() @@ -65,10 +65,10 @@ def browserlist(tb): last = lineno first = max(1, last-10) for i in range(first, last+1): - if i = lineno: prefix = '***' + string.rjust(`i`, 4) + ':' + if i == lineno: prefix = '***' + string.rjust(`i`, 4) + ':' else: prefix = string.rjust(`i`, 7) + ':' line = readfileline(filename, i) - if line[-1:] = '\n': line = line[:-1] + if line[-1:] == '\n': line = line[:-1] print prefix + line def browserexec(tb, cmd): @@ -126,24 +126,24 @@ def printsymbols(d): print def printobject(v, maxlevel): - if v = None: + if v == None: print 'None', elif type(v) in (type(0), type(0.0)): print v, - elif type(v) = type(''): + elif type(v) == type(''): if len(v) > 20: print `v[:17] + '...'`, else: print `v`, - elif type(v) = type(()): + elif type(v) == type(()): print '(', printlist(v, maxlevel) print ')', - elif type(v) = type([]): + elif type(v) == type([]): print '[', printlist(v, maxlevel) print ']', - elif type(v) = type({}): + elif type(v) == type({}): print '{', printdict(v, maxlevel) print '}', @@ -152,7 +152,7 @@ def printobject(v, maxlevel): def printlist(v, maxlevel): n = len(v) - if n = 0: return + if n == 0: return if maxlevel <= 0: print '...', return @@ -164,7 +164,7 @@ def printlist(v, maxlevel): def printdict(v, maxlevel): keys = v.keys() n = len(keys) - if n = 0: return + if n == 0: return if maxlevel <= 0: print '...', return @@ -187,8 +187,8 @@ def readfileline(filename, lineno): cache_ok = 0 if _filecache.has_key(filename): cached_stat, lines = _filecache[filename] - if stat[ST_SIZE] = cached_stat[ST_SIZE] and \ - stat[ST_MTIME] = cached_stat[ST_MTIME]: + if stat[ST_SIZE] == cached_stat[ST_SIZE] and \ + stat[ST_MTIME] == cached_stat[ST_MTIME]: cache_ok = 1 else: print 'Stale cache entry for', filename |