]> granicus.if.org Git - python/commitdiff
Issue 11929: Minor whitespace clean-ups.
authorRaymond Hettinger <python@rcn.com>
Tue, 26 Apr 2011 20:55:55 +0000 (13:55 -0700)
committerRaymond Hettinger <python@rcn.com>
Tue, 26 Apr 2011 20:55:55 +0000 (13:55 -0700)
Doc/includes/dbpickle.py
Doc/includes/mp_benchmarks.py
Doc/includes/mp_pool.py
Doc/includes/mp_synchronize.py
Doc/includes/mp_webserver.py
Doc/includes/sqlite3/adapter_datetime.py
Doc/includes/tzinfo-examples.py

index c021eac6c39f68fae335c90e75aed4bd08883432..b88ee87d872ab4580500c7d132a372f5dbb61183 100644 (file)
@@ -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:")
index 72d4426c257a88d707496119e5972e6a7efc2614..acdf6425bc6edbf874a18f2711608a6f7f3ef56f 100644 (file)
@@ -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()
index e360703bd1e78178015d2d97bc350ac849277903..15784987540139375a865ce725fe3180609ec6db 100644 (file)
@@ -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
index fd393f28881fd2f3d400d395be420355b24b58e2..81dbc387fc4a65f3af5d20562fbb7e32abca629c 100644 (file)
@@ -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()
index 0878de110df4e707f23c8226fa3e8af130b69360..651024d9393295232fa01f3e31c98484be56727c 100644 (file)
@@ -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
index 5869e22b32f58071bdf92b9624da9748d9c845da..be33395100c325efcf96ef7ac883eeb345fec684 100644 (file)
@@ -1,5 +1,6 @@
 import sqlite3
-import datetime, time
+import datetime
+import time
 
 def adapt_datetime(ts):
     return time.mktime(ts.timetuple())
index 5132429fb447b0ed79e8cace2349854a9345bb67..3a8cf47eaf4855cc7d1a1dd3810523d4683578c6 100644 (file)
@@ -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):