Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
40fc59d9
Commit
40fc59d9
authored
Apr 26, 2011
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 11929: Minor whitespace clean-ups.
parent
30fe8188
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
17 deletions
+26
-17
Doc/includes/dbpickle.py
Doc/includes/dbpickle.py
+2
-1
Doc/includes/mp_benchmarks.py
Doc/includes/mp_benchmarks.py
+9
-4
Doc/includes/mp_pool.py
Doc/includes/mp_pool.py
+4
-4
Doc/includes/mp_synchronize.py
Doc/includes/mp_synchronize.py
+6
-4
Doc/includes/mp_webserver.py
Doc/includes/mp_webserver.py
+2
-2
Doc/includes/sqlite3/adapter_datetime.py
Doc/includes/sqlite3/adapter_datetime.py
+2
-1
Doc/includes/tzinfo-examples.py
Doc/includes/tzinfo-examples.py
+1
-1
No files found.
Doc/includes/dbpickle.py
View file @
40fc59d9
...
...
@@ -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:"
)
...
...
Doc/includes/mp_benchmarks.py
View file @
40fc59d9
...
...
@@ -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
()
...
...
Doc/includes/mp_pool.py
View file @
40fc59d9
...
...
@@ -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
...
...
Doc/includes/mp_synchronize.py
View file @
40fc59d9
...
...
@@ -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
()
...
...
Doc/includes/mp_webserver.py
View file @
40fc59d9
...
...
@@ -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
...
...
Doc/includes/sqlite3/adapter_datetime.py
View file @
40fc59d9
import
sqlite3
import
datetime
,
time
import
datetime
import
time
def
adapt_datetime
(
ts
):
return
time
.
mktime
(
ts
.
timetuple
())
...
...
Doc/includes/tzinfo-examples.py
View file @
40fc59d9
...
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment