summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-05-03 04:46:14 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-05-03 04:46:14 (GMT)
commit4511a713d58a8c530dc341d3eb5a205b5a5d551f (patch)
tree0203a452db59899d3c8d19c6159eaeade8dbbe04 /Doc
parent3053667d0950d267de3d6e210e4408435cda05dc (diff)
downloadcpython-4511a713d58a8c530dc341d3eb5a205b5a5d551f.zip
cpython-4511a713d58a8c530dc341d3eb5a205b5a5d551f.tar.gz
cpython-4511a713d58a8c530dc341d3eb5a205b5a5d551f.tar.bz2
Whitespace normalization.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/sqlite3/adapter_point_1.py1
-rw-r--r--Doc/lib/sqlite3/adapter_point_2.py1
-rw-r--r--Doc/lib/sqlite3/execute_2.py1
-rw-r--r--Doc/lib/sqlite3/execute_3.py2
-rw-r--r--Doc/lib/sqlite3/insert_more_people.py1
-rw-r--r--Doc/lib/sqlite3/shortcut_methods.py43
-rw-r--r--Doc/lib/sqlite3/text_factory.py85
7 files changed, 63 insertions, 71 deletions
diff --git a/Doc/lib/sqlite3/adapter_point_1.py b/Doc/lib/sqlite3/adapter_point_1.py
index 7b0c51e..b4856d5 100644
--- a/Doc/lib/sqlite3/adapter_point_1.py
+++ b/Doc/lib/sqlite3/adapter_point_1.py
@@ -14,4 +14,3 @@ cur = con.cursor()
p = Point(4.0, -3.2)
cur.execute("select ?", (p,))
print cur.fetchone()[0]
-
diff --git a/Doc/lib/sqlite3/adapter_point_2.py b/Doc/lib/sqlite3/adapter_point_2.py
index 3b4ab10..50e3692 100644
--- a/Doc/lib/sqlite3/adapter_point_2.py
+++ b/Doc/lib/sqlite3/adapter_point_2.py
@@ -15,4 +15,3 @@ cur = con.cursor()
p = Point(4.0, -3.2)
cur.execute("select ?", (p,))
print cur.fetchone()[0]
-
diff --git a/Doc/lib/sqlite3/execute_2.py b/Doc/lib/sqlite3/execute_2.py
index 28318cc..b4333d8 100644
--- a/Doc/lib/sqlite3/execute_2.py
+++ b/Doc/lib/sqlite3/execute_2.py
@@ -10,4 +10,3 @@ age = 72
cur.execute("select name_last, age from people where name_last=:who and age=:age",
{"who": who, "age": age})
print cur.fetchone()
-
diff --git a/Doc/lib/sqlite3/execute_3.py b/Doc/lib/sqlite3/execute_3.py
index 2f02372e..9cd3deb 100644
--- a/Doc/lib/sqlite3/execute_3.py
+++ b/Doc/lib/sqlite3/execute_3.py
@@ -10,5 +10,3 @@ age = 72
cur.execute("select name_last, age from people where name_last=:who and age=:age",
locals())
print cur.fetchone()
-
-
diff --git a/Doc/lib/sqlite3/insert_more_people.py b/Doc/lib/sqlite3/insert_more_people.py
index 7daa88b..430d942 100644
--- a/Doc/lib/sqlite3/insert_more_people.py
+++ b/Doc/lib/sqlite3/insert_more_people.py
@@ -14,4 +14,3 @@ for person in newPeople:
# The changes will not be saved unless the transaction is committed explicitly:
con.commit()
-
diff --git a/Doc/lib/sqlite3/shortcut_methods.py b/Doc/lib/sqlite3/shortcut_methods.py
index 93c9547..12ce0c0 100644
--- a/Doc/lib/sqlite3/shortcut_methods.py
+++ b/Doc/lib/sqlite3/shortcut_methods.py
@@ -1,22 +1,21 @@
-import sqlite3
-
-persons = [
- ("Hugo", "Boss"),
- ("Calvin", "Klein")
- ]
-
-con = sqlite3.connect(":memory:")
-
-# Create the table
-con.execute("create table person(firstname, lastname)")
-
-# Fill the table
-con.executemany("insert into person(firstname, lastname) values (?, ?)", persons)
-
-# Print the table contents
-for row in con.execute("select firstname, lastname from person"):
- 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"
-
+import sqlite3
+
+persons = [
+ ("Hugo", "Boss"),
+ ("Calvin", "Klein")
+ ]
+
+con = sqlite3.connect(":memory:")
+
+# Create the table
+con.execute("create table person(firstname, lastname)")
+
+# Fill the table
+con.executemany("insert into person(firstname, lastname) values (?, ?)", persons)
+
+# Print the table contents
+for row in con.execute("select firstname, lastname from person"):
+ 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"
diff --git a/Doc/lib/sqlite3/text_factory.py b/Doc/lib/sqlite3/text_factory.py
index cf2ae92..13c832d 100644
--- a/Doc/lib/sqlite3/text_factory.py
+++ b/Doc/lib/sqlite3/text_factory.py
@@ -1,43 +1,42 @@
-import sqlite3
-
-con = sqlite3.connect(":memory:")
-cur = con.cursor()
-
-# Create the table
-con.execute("create table person(lastname, firstname)")
-
-AUSTRIA = u"\xd6sterreich"
-
-# by default, rows are returned as Unicode
-cur.execute("select ?", (AUSTRIA,))
-row = cur.fetchone()
-assert row[0] == AUSTRIA
-
-# but we can make pysqlite always return bytestrings ...
-con.text_factory = str
-cur.execute("select ?", (AUSTRIA,))
-row = cur.fetchone()
-assert type(row[0]) == str
-# the bytestrings will be encoded in UTF-8, unless you stored garbage in the
-# database ...
-assert row[0] == AUSTRIA.encode("utf-8")
-
-# 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"),))
-row = cur.fetchone()
-assert type(row[0]) == unicode
-
-# 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
-
-cur.execute("select ?", ("Germany",))
-row = cur.fetchone()
-assert type(row[0]) == str
-
+import sqlite3
+
+con = sqlite3.connect(":memory:")
+cur = con.cursor()
+
+# Create the table
+con.execute("create table person(lastname, firstname)")
+
+AUSTRIA = u"\xd6sterreich"
+
+# by default, rows are returned as Unicode
+cur.execute("select ?", (AUSTRIA,))
+row = cur.fetchone()
+assert row[0] == AUSTRIA
+
+# but we can make pysqlite always return bytestrings ...
+con.text_factory = str
+cur.execute("select ?", (AUSTRIA,))
+row = cur.fetchone()
+assert type(row[0]) == str
+# the bytestrings will be encoded in UTF-8, unless you stored garbage in the
+# database ...
+assert row[0] == AUSTRIA.encode("utf-8")
+
+# 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"),))
+row = cur.fetchone()
+assert type(row[0]) == unicode
+
+# 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
+
+cur.execute("select ?", ("Germany",))
+row = cur.fetchone()
+assert type(row[0]) == str