summaryrefslogtreecommitdiffstats
path: root/Demo/scripts
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-09-13 15:58:53 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-09-13 15:58:53 (GMT)
commitd7b032841aba549f2ec532adcd83829d0126bf40 (patch)
tree79d2cea79020e654f822841e1157fb930038427a /Demo/scripts
parente40a21376a015c16a05940f3d1afc61f5c319502 (diff)
downloadcpython-d7b032841aba549f2ec532adcd83829d0126bf40.zip
cpython-d7b032841aba549f2ec532adcd83829d0126bf40.tar.gz
cpython-d7b032841aba549f2ec532adcd83829d0126bf40.tar.bz2
Merged revisions 66394,66404,66412,66414,66424-66436 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r66394 | benjamin.peterson | 2008-09-11 17:04:02 -0500 (Thu, 11 Sep 2008) | 1 line fix typo ........ r66404 | gerhard.haering | 2008-09-12 08:54:06 -0500 (Fri, 12 Sep 2008) | 2 lines sqlite3 module: Mark iterdump() method as "Non-standard" like all the other methods not found in DB-API. ........ r66412 | gerhard.haering | 2008-09-12 13:58:57 -0500 (Fri, 12 Sep 2008) | 2 lines Fixes issue #3103. In the sqlite3 module, made one more function static. All renaming public symbos now have the pysqlite prefix to avoid name clashes. This at least once created problems where the same symbol name appeared somewhere in Apache and the sqlite3 module was used from mod_python. ........ r66414 | gerhard.haering | 2008-09-12 17:33:22 -0500 (Fri, 12 Sep 2008) | 2 lines Issue #3846: Release GIL during calls to sqlite3_prepare. This improves concurrent access to the same database file from multiple threads/processes. ........ r66424 | andrew.kuchling | 2008-09-12 20:22:08 -0500 (Fri, 12 Sep 2008) | 1 line #687648 from Robert Schuppenies: use classic division. (RM Barry gave permission to update the demos.) ........ r66425 | andrew.kuchling | 2008-09-12 20:27:33 -0500 (Fri, 12 Sep 2008) | 1 line #687648 from Robert Schuppenies: use classic division. From me: don't use string exception; flush stdout after printing ........ r66426 | andrew.kuchling | 2008-09-12 20:34:41 -0500 (Fri, 12 Sep 2008) | 1 line #687648 from Robert Schuppenies: use classic division. From me: don't use string exception; add __main__ section ........ r66427 | andrew.kuchling | 2008-09-12 20:42:55 -0500 (Fri, 12 Sep 2008) | 1 line #687648 from Robert Schuppenies: use classic division. From me: remove two stray semicolons ........ r66428 | andrew.kuchling | 2008-09-12 20:43:28 -0500 (Fri, 12 Sep 2008) | 1 line #687648 from Robert Schuppenies: use classic division. ........ r66429 | andrew.kuchling | 2008-09-12 20:47:02 -0500 (Fri, 12 Sep 2008) | 1 line Remove semicolon ........ r66430 | andrew.kuchling | 2008-09-12 20:48:36 -0500 (Fri, 12 Sep 2008) | 1 line Subclass exception ........ r66431 | andrew.kuchling | 2008-09-12 20:56:56 -0500 (Fri, 12 Sep 2008) | 1 line Fix SyntaxError ........ r66432 | andrew.kuchling | 2008-09-12 20:57:25 -0500 (Fri, 12 Sep 2008) | 1 line Update uses of string exceptions ........ r66433 | andrew.kuchling | 2008-09-12 21:08:30 -0500 (Fri, 12 Sep 2008) | 1 line Use title case ........ r66434 | andrew.kuchling | 2008-09-12 21:09:15 -0500 (Fri, 12 Sep 2008) | 1 line Remove extra 'the'; the following title includes it ........ r66435 | andrew.kuchling | 2008-09-12 21:11:51 -0500 (Fri, 12 Sep 2008) | 1 line #3288: Document as_integer_ratio ........ r66436 | andrew.kuchling | 2008-09-12 21:14:15 -0500 (Fri, 12 Sep 2008) | 1 line Use title case ........
Diffstat (limited to 'Demo/scripts')
-rwxr-xr-xDemo/scripts/fact.py8
-rwxr-xr-xDemo/scripts/ftpstats.py4
-rwxr-xr-xDemo/scripts/lpwatch.py4
-rwxr-xr-xDemo/scripts/markov.py2
-rwxr-xr-xDemo/scripts/newslist.py2
-rwxr-xr-xDemo/scripts/pi.py4
-rwxr-xr-xDemo/scripts/unbirthday.py6
7 files changed, 14 insertions, 16 deletions
diff --git a/Demo/scripts/fact.py b/Demo/scripts/fact.py
index 19d28eb..c76474c 100755
--- a/Demo/scripts/fact.py
+++ b/Demo/scripts/fact.py
@@ -8,23 +8,21 @@
import sys
from math import sqrt
-error = 'fact.error' # exception
-
def fact(n):
- if n < 1: raise error # fact() argument should be >= 1
+ if n < 1: raise ValueError # fact() argument should be >= 1
if n == 1: return [] # special case
res = []
# Treat even factors special, so we can use i = i+2 later
while n%2 == 0:
res.append(2)
- n = n/2
+ n = n//2
# Try odd numbers up to sqrt(n)
limit = sqrt(float(n+1))
i = 3
while i <= limit:
if n%i == 0:
res.append(i)
- n = n/i
+ n = n//i
limit = sqrt(n+1)
else:
i = i+2
diff --git a/Demo/scripts/ftpstats.py b/Demo/scripts/ftpstats.py
index 19ad392..cb0c242 100755
--- a/Demo/scripts/ftpstats.py
+++ b/Demo/scripts/ftpstats.py
@@ -104,7 +104,7 @@ def main():
def showbar(dict, title):
n = len(title)
- print('='*((70-n)/2), title, '='*((71-n)/2))
+ print('='*((70-n)//2), title, '='*((71-n)//2))
list = []
for key in sorted(dict.keys()):
n = len(str(key))
@@ -124,7 +124,7 @@ def show(dict, title, maxitems):
if len(dict) > maxitems:
title = title + ' (first %d)'%maxitems
n = len(title)
- print('='*((70-n)/2), title, '='*((71-n)/2))
+ print('='*((70-n)//2), title, '='*((71-n)//2))
list = []
for key in dict.keys():
list.append((-len(dict[key]), key))
diff --git a/Demo/scripts/lpwatch.py b/Demo/scripts/lpwatch.py
index 567385c..262e562 100755
--- a/Demo/scripts/lpwatch.py
+++ b/Demo/scripts/lpwatch.py
@@ -83,7 +83,7 @@ def makestatus(name, thisuser):
lines.append(line)
#
if totaljobs:
- line = '%d K' % ((totalbytes+1023)/1024)
+ line = '%d K' % ((totalbytes+1023)//1024)
if totaljobs != len(users):
line = line + ' (%d jobs)' % totaljobs
if len(users) == 1:
@@ -95,7 +95,7 @@ def makestatus(name, thisuser):
line = line + ' (%s first)' % thisuser
else:
line = line + ' (%d K before %s)' % (
- (aheadbytes+1023)/1024, thisuser)
+ (aheadbytes+1023)//1024, thisuser)
lines.append(line)
#
sts = pipe.close()
diff --git a/Demo/scripts/markov.py b/Demo/scripts/markov.py
index 3dc57ce..6f3482b 100755
--- a/Demo/scripts/markov.py
+++ b/Demo/scripts/markov.py
@@ -110,7 +110,7 @@ def test():
def tuple(list):
if len(list) == 0: return ()
if len(list) == 1: return (list[0],)
- i = len(list)/2
+ i = len(list)//2
return tuple(list[:i]) + tuple(list[i:])
if __name__ == "__main__":
diff --git a/Demo/scripts/newslist.py b/Demo/scripts/newslist.py
index 3d65a08..02b4b7c 100755
--- a/Demo/scripts/newslist.py
+++ b/Demo/scripts/newslist.py
@@ -320,7 +320,7 @@ def main():
tree={}
# Check that the output directory exists
- checkopdir(pagedir);
+ checkopdir(pagedir)
try:
print('Connecting to '+newshost+'...')
diff --git a/Demo/scripts/pi.py b/Demo/scripts/pi.py
index a360e40..19733cb 100755
--- a/Demo/scripts/pi.py
+++ b/Demo/scripts/pi.py
@@ -17,11 +17,11 @@ def main():
p, q, k = k*k, 2*k+1, k+1
a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1
# Print common digits
- d, d1 = a/b, a1/b1
+ d, d1 = a//b, a1//b1
while d == d1:
output(d)
a, a1 = 10*(a%b), 10*(a1%b1)
- d, d1 = a/b, a1/b1
+ d, d1 = a//b, a1//b1
def output(d):
# Use write() to avoid spaces between the digits
diff --git a/Demo/scripts/unbirthday.py b/Demo/scripts/unbirthday.py
index 5c39092..991537d 100755
--- a/Demo/scripts/unbirthday.py
+++ b/Demo/scripts/unbirthday.py
@@ -99,9 +99,9 @@ def mkdate(xxx_todo_changeme1):
# was different then...
(year, month, day) = xxx_todo_changeme1
days = year*365 # years, roughly
- days = days + (year+3)/4 # plus leap years, roughly
- days = days - (year+99)/100 # minus non-leap years every century
- days = days + (year+399)/400 # plus leap years every 4 centirues
+ days = days + (year+3)//4 # plus leap years, roughly
+ days = days - (year+99)//100 # minus non-leap years every century
+ days = days + (year+399)//400 # plus leap years every 4 centirues
for i in range(1, month):
if i == 2 and calendar.isleap(year):
days = days + 29