summaryrefslogtreecommitdiffstats
path: root/Doc/includes
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-04-26 20:55:55 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-04-26 20:55:55 (GMT)
commit40fc59d98b70902f140aaf3c3e4c2b0739a9f1bc (patch)
tree082f364f553cd21d79e5724415e8a321472d67e6 /Doc/includes
parent30fe8188b4ccf8a620faf7bb38413b5a81c67ed3 (diff)
downloadcpython-40fc59d98b70902f140aaf3c3e4c2b0739a9f1bc.zip
cpython-40fc59d98b70902f140aaf3c3e4c2b0739a9f1bc.tar.gz
cpython-40fc59d98b70902f140aaf3c3e4c2b0739a9f1bc.tar.bz2
Issue 11929: Minor whitespace clean-ups.
Diffstat (limited to 'Doc/includes')
-rw-r--r--Doc/includes/dbpickle.py3
-rw-r--r--Doc/includes/mp_benchmarks.py13
-rw-r--r--Doc/includes/mp_pool.py8
-rw-r--r--Doc/includes/mp_synchronize.py10
-rw-r--r--Doc/includes/mp_webserver.py4
-rw-r--r--Doc/includes/sqlite3/adapter_datetime.py3
-rw-r--r--Doc/includes/tzinfo-examples.py2
7 files changed, 26 insertions, 17 deletions
diff --git a/Doc/includes/dbpickle.py b/Doc/includes/dbpickle.py
index c021eac..b88ee87 100644
--- a/Doc/includes/dbpickle.py
+++ b/Doc/includes/dbpickle.py
@@ -47,7 +47,8 @@ class DBUnpickler(pickle.Unpickler):
def main():
- import io, pprint
+ import io
+ import pprint
# Initialize and populate our database.
conn = sqlite3.connect(":memory:")
diff --git a/Doc/includes/mp_benchmarks.py b/Doc/includes/mp_benchmarks.py
index 72d4426..acdf642 100644
--- a/Doc/includes/mp_benchmarks.py
+++ b/Doc/includes/mp_benchmarks.py
@@ -5,7 +5,12 @@
# All rights reserved.
#
-import time, sys, multiprocessing, threading, queue, gc
+import time
+import sys
+import multiprocessing
+import threading
+import queue
+import gc
if sys.platform == 'win32':
_timer = time.clock
@@ -111,7 +116,7 @@ def test_seqspeed(seq):
for i in range(iterations):
a = seq[5]
- elapsed = _timer()-t
+ elapsed = _timer() - t
print(iterations, 'iterations in', elapsed, 'seconds')
print('average number/sec:', iterations/elapsed)
@@ -132,7 +137,7 @@ def test_lockspeed(l):
l.acquire()
l.release()
- elapsed = _timer()-t
+ elapsed = _timer() - t
print(iterations, 'iterations in', elapsed, 'seconds')
print('average number/sec:', iterations/elapsed)
@@ -169,7 +174,7 @@ def test_conditionspeed(Process, c):
c.notify()
c.wait()
- elapsed = _timer()-t
+ elapsed = _timer() - t
c.release()
p.join()
diff --git a/Doc/includes/mp_pool.py b/Doc/includes/mp_pool.py
index e360703..1578498 100644
--- a/Doc/includes/mp_pool.py
+++ b/Doc/includes/mp_pool.py
@@ -25,18 +25,18 @@ def calculatestar(args):
return calculate(*args)
def mul(a, b):
- time.sleep(0.5*random.random())
+ time.sleep(0.5 * random.random())
return a * b
def plus(a, b):
- time.sleep(0.5*random.random())
+ time.sleep(0.5 * random.random())
return a + b
def f(x):
- return 1.0 / (x-5.0)
+ return 1.0 / (x - 5.0)
def pow3(x):
- return x**3
+ return x ** 3
def noop(x):
pass
diff --git a/Doc/includes/mp_synchronize.py b/Doc/includes/mp_synchronize.py
index fd393f2..81dbc38 100644
--- a/Doc/includes/mp_synchronize.py
+++ b/Doc/includes/mp_synchronize.py
@@ -5,7 +5,9 @@
# All rights reserved.
#
-import time, sys, random
+import time
+import sys
+import random
from queue import Empty
import multiprocessing # may get overwritten
@@ -237,9 +239,9 @@ def test(namespace=multiprocessing):
multiprocessing = namespace
- for func in [ test_value, test_queue, test_condition,
- test_semaphore, test_join_timeout, test_event,
- test_sharedvalues ]:
+ for func in [test_value, test_queue, test_condition,
+ test_semaphore, test_join_timeout, test_event,
+ test_sharedvalues]:
print('\n\t######## %s\n' % func.__name__)
func()
diff --git a/Doc/includes/mp_webserver.py b/Doc/includes/mp_webserver.py
index 0878de1..651024d 100644
--- a/Doc/includes/mp_webserver.py
+++ b/Doc/includes/mp_webserver.py
@@ -24,7 +24,7 @@ if sys.platform == 'win32':
def note(format, *args):
- sys.stderr.write('[%s]\t%s\n' % (current_process().name, format%args))
+ sys.stderr.write('[%s]\t%s\n' % (current_process().name, format % args))
class RequestHandler(SimpleHTTPRequestHandler):
@@ -45,7 +45,7 @@ def runpool(address, number_of_processes):
server = HTTPServer(address, RequestHandler)
# create child processes to act as workers
- for i in range(number_of_processes-1):
+ for i in range(number_of_processes - 1):
Process(target=serve_forever, args=(server,)).start()
# main process also acts as a worker
diff --git a/Doc/includes/sqlite3/adapter_datetime.py b/Doc/includes/sqlite3/adapter_datetime.py
index 5869e22..be33395 100644
--- a/Doc/includes/sqlite3/adapter_datetime.py
+++ b/Doc/includes/sqlite3/adapter_datetime.py
@@ -1,5 +1,6 @@
import sqlite3
-import datetime, time
+import datetime
+import time
def adapt_datetime(ts):
return time.mktime(ts.timetuple())
diff --git a/Doc/includes/tzinfo-examples.py b/Doc/includes/tzinfo-examples.py
index 5132429..3a8cf47 100644
--- a/Doc/includes/tzinfo-examples.py
+++ b/Doc/includes/tzinfo-examples.py
@@ -27,7 +27,7 @@ class FixedOffset(tzinfo):
"""Fixed offset in minutes east from UTC."""
def __init__(self, offset, name):
- self.__offset = timedelta(minutes = offset)
+ self.__offset = timedelta(minutes=offset)
self.__name = name
def utcoffset(self, dt):