summaryrefslogtreecommitdiffstats
path: root/Demo/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Demo/scripts')
-rwxr-xr-xDemo/scripts/fact.py6
-rwxr-xr-xDemo/scripts/from.py6
-rwxr-xr-xDemo/scripts/lpwatch.py14
-rwxr-xr-xDemo/scripts/pi.py2
-rwxr-xr-xDemo/scripts/primes.py2
5 files changed, 15 insertions, 15 deletions
diff --git a/Demo/scripts/fact.py b/Demo/scripts/fact.py
index 6aac414..b406086 100755
--- a/Demo/scripts/fact.py
+++ b/Demo/scripts/fact.py
@@ -12,17 +12,17 @@ error = 'fact.error' # exception
def fact(n):
if n < 1: raise error # fact() argument should be >= 1
- if n = 1: return [] # special case
+ if n == 1: return [] # special case
res = []
# Treat even factors special, so we can use i = i+2 later
- while n%2 = 0:
+ while n%2 == 0:
res.append(2)
n = n/2
# Try odd numbers up to sqrt(n)
limit = sqrt(n+1)
i = 3
while i <= limit:
- if n%i = 0:
+ if n%i == 0:
res.append(i)
n = n/i
limit = sqrt(n+1)
diff --git a/Demo/scripts/from.py b/Demo/scripts/from.py
index 21ca081..8e663f1 100755
--- a/Demo/scripts/from.py
+++ b/Demo/scripts/from.py
@@ -24,13 +24,13 @@ except RuntimeError:
while 1:
line = mail.readline()
if not line: break # EOF
- if line[:5] = 'From ':
+ if line[:5] == 'From ':
# Start of message found
print line[:-1],
while 1:
line = mail.readline()
if not line: break # EOF
- if line = '\n': break # Blank line ends headers
- if line[:8] = 'Subject:':
+ if line == '\n': break # Blank line ends headers
+ if line[:8] == 'Subject:':
print `line[9:-1]`,
print
diff --git a/Demo/scripts/lpwatch.py b/Demo/scripts/lpwatch.py
index db0f469..afd46f3 100755
--- a/Demo/scripts/lpwatch.py
+++ b/Demo/scripts/lpwatch.py
@@ -23,7 +23,7 @@ def main():
# Strip '-P' from printer names just in case
# the user specified it...
for i in range(len(printers)):
- if printers[i][:2] = '-P':
+ if printers[i][:2] == '-P':
printers[i] = printers[i][2:]
else:
if posix.environ.has_key('PRINTER'):
@@ -54,13 +54,13 @@ def makestatus(name, thisuser):
if not line: break
fields = string.split(line)
n = len(fields)
- if len(fields) >= 6 and fields[n-1] = 'bytes':
+ if len(fields) >= 6 and fields[n-1] == 'bytes':
rank = fields[0]
user = fields[1]
job = fields[2]
files = fields[3:-2]
bytes = eval(fields[n-2])
- if user = thisuser:
+ if user == thisuser:
userseen = 1
elif not userseen:
aheadbytes = aheadbytes + bytes
@@ -77,9 +77,9 @@ def makestatus(name, thisuser):
else:
if fields and fields[0] <> 'Rank':
line = string.strip(line)
- if line = 'no entries':
+ if line == 'no entries':
line = name + ': idle'
- elif line[-22:] = ' is ready and printing':
+ elif line[-22:] == ' is ready and printing':
line = name
lines.append(line)
#
@@ -87,12 +87,12 @@ def makestatus(name, thisuser):
line = `(totalbytes+1023)/1024` + ' K'
if totaljobs <> len(users):
line = line + ' (' + `totaljobs` + ' jobs)'
- if len(users) = 1:
+ if len(users) == 1:
line = line + ' for ' + users.keys()[0]
else:
line = line + ' for ' + `len(users)` + ' users'
if userseen:
- if aheadjobs = 0:
+ if aheadjobs == 0:
line = line + ' (' + thisuser + ' first)'
else:
line = line + ' (' + `(aheadbytes+1023)/1024`
diff --git a/Demo/scripts/pi.py b/Demo/scripts/pi.py
index 5e19db6..74a66a7 100755
--- a/Demo/scripts/pi.py
+++ b/Demo/scripts/pi.py
@@ -19,7 +19,7 @@ def main():
# Print common digits
d, d1 = a/b, a1/b1
#print a, b, a1, b1
- while d = d1:
+ while d == d1:
# Use write() to avoid spaces between the digits
sys.stdout.write(`int(d)`)
# Flush so the output is seen immediately
diff --git a/Demo/scripts/primes.py b/Demo/scripts/primes.py
index 487acef..6a36d6e 100755
--- a/Demo/scripts/primes.py
+++ b/Demo/scripts/primes.py
@@ -17,7 +17,7 @@ def primes(min, max):
i = 3
while i <= max:
for p in primes:
- if i%p = 0 or p*p > i: break
+ if i%p == 0 or p*p > i: break
if i%p <> 0:
primes.append(i)
if i >= min: print i