[Python-3000-checkins] r56784 - python/branches/py3k-struni/Doc/lib/sqlite3/adapter_datetime.py python/branches/py3k-struni/Doc/lib/sqlite3/adapter_point_1.py python/branches/py3k-struni/Doc/lib/sqlite3/adapter_point_2.py python/branches/py3k-struni/Doc/lib/sqlite3/collation_reverse.py python/branches/py3k-struni/Doc/lib/sqlite3/complete_statement.py python/branches/py3k-struni/Doc/lib/sqlite3/converter_point.py python/branches/py3k-struni/Doc/lib/sqlite3/countcursors.py python/branches/py3k-struni/Doc/lib/sqlite3/execsql_fetchonerow.py python/branches/py3k-struni/Doc/lib/sqlite3/execsql_printall_1.py python/branches/py3k-struni/Doc/lib/sqlite3/execute_1.py python/branches/py3k-struni/Doc/lib/sqlite3/execute_2.py python/branches/py3k-struni/Doc/lib/sqlite3/execute_3.py python/branches/py3k-struni/Doc/lib/sqlite3/executemany_1.py python/branches/py3k-struni/Doc/lib/sqlite3/executemany_2.py python/branches/py3k-struni/Doc/lib/sqlite3/md5func.py python/branches/py3k-struni/Doc/lib/sqlite3/mysumaggr.py python/branches/py3k-struni/Doc/lib/sqlite3/parse_colnames.py python/branches/py3k-struni/Doc/lib/sqlite3/pysqlite_datetime.py python/branches/py3k-struni/Doc/lib/sqlite3/row_factory.py python/branches/py3k-struni/Doc/lib/sqlite3/shortcut_methods.py python/branches/py3k-struni/Doc/lib/sqlite3/simple_tableprinter.py python/branches/py3k-struni/Doc/lib/sqlite3/text_factory.py

collin.winter python-3000-checkins at python.org
Tue Aug 7 03:20:22 CEST 2007


Author: collin.winter
Date: Tue Aug  7 03:20:21 2007
New Revision: 56784

Modified:
   python/branches/py3k-struni/Doc/lib/sqlite3/adapter_datetime.py
   python/branches/py3k-struni/Doc/lib/sqlite3/adapter_point_1.py
   python/branches/py3k-struni/Doc/lib/sqlite3/adapter_point_2.py
   python/branches/py3k-struni/Doc/lib/sqlite3/collation_reverse.py
   python/branches/py3k-struni/Doc/lib/sqlite3/complete_statement.py
   python/branches/py3k-struni/Doc/lib/sqlite3/converter_point.py
   python/branches/py3k-struni/Doc/lib/sqlite3/countcursors.py
   python/branches/py3k-struni/Doc/lib/sqlite3/execsql_fetchonerow.py
   python/branches/py3k-struni/Doc/lib/sqlite3/execsql_printall_1.py
   python/branches/py3k-struni/Doc/lib/sqlite3/execute_1.py
   python/branches/py3k-struni/Doc/lib/sqlite3/execute_2.py
   python/branches/py3k-struni/Doc/lib/sqlite3/execute_3.py
   python/branches/py3k-struni/Doc/lib/sqlite3/executemany_1.py
   python/branches/py3k-struni/Doc/lib/sqlite3/executemany_2.py
   python/branches/py3k-struni/Doc/lib/sqlite3/md5func.py
   python/branches/py3k-struni/Doc/lib/sqlite3/mysumaggr.py
   python/branches/py3k-struni/Doc/lib/sqlite3/parse_colnames.py
   python/branches/py3k-struni/Doc/lib/sqlite3/pysqlite_datetime.py
   python/branches/py3k-struni/Doc/lib/sqlite3/row_factory.py
   python/branches/py3k-struni/Doc/lib/sqlite3/shortcut_methods.py
   python/branches/py3k-struni/Doc/lib/sqlite3/simple_tableprinter.py
   python/branches/py3k-struni/Doc/lib/sqlite3/text_factory.py
Log:
Run 2to3 over Doc/lib/sqlite3/.

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/adapter_datetime.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/adapter_datetime.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/adapter_datetime.py	Tue Aug  7 03:20:21 2007
@@ -11,4 +11,4 @@
 
 now = datetime.datetime.now()
 cur.execute("select ?", (now,))
-print cur.fetchone()[0]
+print(cur.fetchone()[0])

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/adapter_point_1.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/adapter_point_1.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/adapter_point_1.py	Tue Aug  7 03:20:21 2007
@@ -13,4 +13,4 @@
 
 p = Point(4.0, -3.2)
 cur.execute("select ?", (p,))
-print cur.fetchone()[0]
+print(cur.fetchone()[0])

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/adapter_point_2.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/adapter_point_2.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/adapter_point_2.py	Tue Aug  7 03:20:21 2007
@@ -14,4 +14,4 @@
 
 p = Point(4.0, -3.2)
 cur.execute("select ?", (p,))
-print cur.fetchone()[0]
+print(cur.fetchone()[0])

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/collation_reverse.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/collation_reverse.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/collation_reverse.py	Tue Aug  7 03:20:21 2007
@@ -11,5 +11,5 @@
 cur.executemany("insert into test(x) values (?)", [("a",), ("b",)])
 cur.execute("select x from test order by x collate reverse")
 for row in cur:
-    print row
+    print(row)
 con.close()

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/complete_statement.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/complete_statement.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/complete_statement.py	Tue Aug  7 03:20:21 2007
@@ -8,11 +8,11 @@
 
 buffer = ""
 
-print "Enter your SQL commands to execute in sqlite3."
-print "Enter a blank line to exit."
+print("Enter your SQL commands to execute in sqlite3.")
+print("Enter a blank line to exit.")
 
 while True:
-    line = raw_input()
+    line = input()
     if line == "":
         break
     buffer += line
@@ -22,9 +22,9 @@
             cur.execute(buffer)
 
             if buffer.lstrip().upper().startswith("SELECT"):
-                print cur.fetchall()
+                print(cur.fetchall())
         except sqlite3.Error as e:
-            print "An error occurred:", e.args[0]
+            print("An error occurred:", e.args[0])
         buffer = ""
 
 con.close()

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/converter_point.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/converter_point.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/converter_point.py	Tue Aug  7 03:20:21 2007
@@ -11,7 +11,7 @@
     return "%f;%f" % (point.x, point.y)
 
 def convert_point(s):
-    x, y = map(float, s.split(";"))
+    x, y = list(map(float, s.split(";")))
     return Point(x, y)
 
 # Register the adapter
@@ -30,7 +30,7 @@
 
 cur.execute("insert into test(p) values (?)", (p,))
 cur.execute("select p from test")
-print "with declared types:", cur.fetchone()[0]
+print("with declared types:", cur.fetchone()[0])
 cur.close()
 con.close()
 
@@ -42,6 +42,6 @@
 
 cur.execute("insert into test(p) values (?)", (p,))
 cur.execute('select p as "p [point]" from test')
-print "with column names:", cur.fetchone()[0]
+print("with column names:", cur.fetchone()[0])
 cur.close()
 con.close()

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/countcursors.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/countcursors.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/countcursors.py	Tue Aug  7 03:20:21 2007
@@ -12,4 +12,4 @@
 con = sqlite3.connect(":memory:", factory=CountCursorsConnection)
 cur1 = con.cursor()
 cur2 = con.cursor()
-print con.numcursors
+print(con.numcursors)

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/execsql_fetchonerow.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/execsql_fetchonerow.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/execsql_fetchonerow.py	Tue Aug  7 03:20:21 2007
@@ -9,9 +9,9 @@
 # resulting sequences to yield their elements (name_last, age):
 cur.execute(SELECT)
 for (name_last, age) in cur:
-    print '%s is %d years old.' % (name_last, age)
+    print('%s is %d years old.' % (name_last, age))
 
 # 2. Equivalently:
 cur.execute(SELECT)
 for row in cur:
-    print '%s is %d years old.' % (row[0], row[1])
+    print('%s is %d years old.' % (row[0], row[1]))

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/execsql_printall_1.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/execsql_printall_1.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/execsql_printall_1.py	Tue Aug  7 03:20:21 2007
@@ -10,4 +10,4 @@
 cur.execute("select * from people order by age")
 
 # Retrieve all rows as a sequence and print that sequence:
-print cur.fetchall()
+print(cur.fetchall())

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/execute_1.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/execute_1.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/execute_1.py	Tue Aug  7 03:20:21 2007
@@ -8,4 +8,4 @@
 age = 72
 
 cur.execute("select name_last, age from people where name_last=? and age=?", (who, age))
-print cur.fetchone()
+print(cur.fetchone())

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/execute_2.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/execute_2.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/execute_2.py	Tue Aug  7 03:20:21 2007
@@ -9,4 +9,4 @@
 
 cur.execute("select name_last, age from people where name_last=:who and age=:age",
     {"who": who, "age": age})
-print cur.fetchone()
+print(cur.fetchone())

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/execute_3.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/execute_3.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/execute_3.py	Tue Aug  7 03:20:21 2007
@@ -9,4 +9,4 @@
 
 cur.execute("select name_last, age from people where name_last=:who and age=:age",
     locals())
-print cur.fetchone()
+print(cur.fetchone())

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/executemany_1.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/executemany_1.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/executemany_1.py	Tue Aug  7 03:20:21 2007
@@ -21,4 +21,4 @@
 cur.executemany("insert into characters(c) values (?)", theIter)
 
 cur.execute("select c from characters")
-print cur.fetchall()
+print(cur.fetchall())

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/executemany_2.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/executemany_2.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/executemany_2.py	Tue Aug  7 03:20:21 2007
@@ -12,4 +12,4 @@
 cur.executemany("insert into characters(c) values (?)", char_generator())
 
 cur.execute("select c from characters")
-print cur.fetchall()
+print(cur.fetchall())

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/md5func.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/md5func.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/md5func.py	Tue Aug  7 03:20:21 2007
@@ -1,11 +1,11 @@
 import sqlite3
-import md5
+import hashlib
 
 def md5sum(t):
-    return md5.md5(t).hexdigest()
+    return hashlib.md5(t).hexdigest()
 
 con = sqlite3.connect(":memory:")
 con.create_function("md5", 1, md5sum)
 cur = con.cursor()
 cur.execute("select md5(?)", ("foo",))
-print cur.fetchone()[0]
+print(cur.fetchone()[0])

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/mysumaggr.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/mysumaggr.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/mysumaggr.py	Tue Aug  7 03:20:21 2007
@@ -17,4 +17,4 @@
 cur.execute("insert into test(i) values (1)")
 cur.execute("insert into test(i) values (2)")
 cur.execute("select mysum(i) from test")
-print cur.fetchone()[0]
+print(cur.fetchone()[0])

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/parse_colnames.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/parse_colnames.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/parse_colnames.py	Tue Aug  7 03:20:21 2007
@@ -5,4 +5,4 @@
 cur = con.cursor()
 cur.execute('select ? as "x [timestamp]"', (datetime.datetime.now(),))
 dt = cur.fetchone()[0]
-print dt, type(dt)
+print(dt, type(dt))

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/pysqlite_datetime.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/pysqlite_datetime.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/pysqlite_datetime.py	Tue Aug  7 03:20:21 2007
@@ -11,10 +11,10 @@
 cur.execute("insert into test(d, ts) values (?, ?)", (today, now))
 cur.execute("select d, ts from test")
 row = cur.fetchone()
-print today, "=>", row[0], type(row[0])
-print now, "=>", row[1], type(row[1])
+print(today, "=>", row[0], type(row[0]))
+print(now, "=>", row[1], type(row[1]))
 
 cur.execute('select current_date as "d [date]", current_timestamp as "ts [timestamp]"')
 row = cur.fetchone()
-print "current_date", row[0], type(row[0])
-print "current_timestamp", row[1], type(row[1])
+print("current_date", row[0], type(row[0]))
+print("current_timestamp", row[1], type(row[1]))

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/row_factory.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/row_factory.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/row_factory.py	Tue Aug  7 03:20:21 2007
@@ -10,4 +10,4 @@
 con.row_factory = dict_factory
 cur = con.cursor()
 cur.execute("select 1 as a")
-print cur.fetchone()["a"]
+print(cur.fetchone()["a"])

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/shortcut_methods.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/shortcut_methods.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/shortcut_methods.py	Tue Aug  7 03:20:21 2007
@@ -15,7 +15,7 @@
 
 # Print the table contents
 for row in con.execute("select firstname, lastname from person"):
-    print row
+    print(row)
 
 # Using a dummy WHERE clause to not let SQLite take the shortcut table deletes.
-print "I just deleted", con.execute("delete from person where 1=1").rowcount, "rows"
+print("I just deleted", con.execute("delete from person where 1=1").rowcount, "rows")

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/simple_tableprinter.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/simple_tableprinter.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/simple_tableprinter.py	Tue Aug  7 03:20:21 2007
@@ -11,9 +11,9 @@
 
 # Print a header.
 for fieldDesc in cur.description:
-    print fieldDesc[0].ljust(FIELD_MAX_WIDTH) ,
-print # Finish the header with a newline.
-print '-' * 78
+    print(fieldDesc[0].ljust(FIELD_MAX_WIDTH), end=' ')
+print() # Finish the header with a newline.
+print('-' * 78)
 
 # For each row, print the value of each field left-justified within
 # the maximum possible width of that field.
@@ -21,6 +21,6 @@
 for row in cur:
     for fieldIndex in fieldIndices:
         fieldValue = str(row[fieldIndex])
-        print fieldValue.ljust(FIELD_MAX_WIDTH) ,
+        print(fieldValue.ljust(FIELD_MAX_WIDTH), end=' ')
 
-    print # Finish the row with a newline.
+    print() # Finish the row with a newline.

Modified: python/branches/py3k-struni/Doc/lib/sqlite3/text_factory.py
==============================================================================
--- python/branches/py3k-struni/Doc/lib/sqlite3/text_factory.py	(original)
+++ python/branches/py3k-struni/Doc/lib/sqlite3/text_factory.py	Tue Aug  7 03:20:21 2007
@@ -6,7 +6,7 @@
 # Create the table
 con.execute("create table person(lastname, firstname)")
 
-AUSTRIA = u"\xd6sterreich"
+AUSTRIA = "\xd6sterreich"
 
 # by default, rows are returned as Unicode
 cur.execute("select ?", (AUSTRIA,))
@@ -25,17 +25,17 @@
 # we can also implement a custom text_factory ...
 # here we implement one that will ignore Unicode characters that cannot be
 # decoded from UTF-8
-con.text_factory = lambda x: unicode(x, "utf-8", "ignore")
-cur.execute("select ?", ("this is latin1 and would normally create errors" + u"\xe4\xf6\xfc".encode("latin1"),))
+con.text_factory = lambda x: str(x, "utf-8", "ignore")
+cur.execute("select ?", ("this is latin1 and would normally create errors" + "\xe4\xf6\xfc".encode("latin1"),))
 row = cur.fetchone()
-assert type(row[0]) == unicode
+assert type(row[0]) == str
 
 # pysqlite offers a builtin optimized text_factory that will return bytestring
 # objects, if the data is in ASCII only, and otherwise return unicode objects
 con.text_factory = sqlite3.OptimizedUnicode
 cur.execute("select ?", (AUSTRIA,))
 row = cur.fetchone()
-assert type(row[0]) == unicode
+assert type(row[0]) == str
 
 cur.execute("select ?", ("Germany",))
 row = cur.fetchone()


More information about the Python-3000-checkins mailing list