Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
54d409df
Commit
54d409df
authored
Dec 01, 2013
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pyflakes fixes
parent
c655ef40
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
15 deletions
+16
-15
gevent/event.py
gevent/event.py
+1
-0
gevent/timeout.py
gevent/timeout.py
+4
-3
greentest/bench_spawn.py
greentest/bench_spawn.py
+2
-6
greentest/lock_tests.py
greentest/lock_tests.py
+1
-1
greentest/test__server.py
greentest/test__server.py
+1
-0
greentest/test__socket_dns.py
greentest/test__socket_dns.py
+3
-3
greentest/test__subprocess.py
greentest/test__subprocess.py
+1
-1
greentest/test_support.py
greentest/test_support.py
+0
-1
greentest/test_threading_2.py
greentest/test_threading_2.py
+2
-0
util/cythonpp.py
util/cythonpp.py
+1
-0
No files found.
gevent/event.py
View file @
54d409df
...
@@ -141,6 +141,7 @@ class AsyncResult(object):
...
@@ -141,6 +141,7 @@ class AsyncResult(object):
:class:`AsyncResult` implements :meth:`__call__` and thus can be used as :meth:`link` target:
:class:`AsyncResult` implements :meth:`__call__` and thus can be used as :meth:`link` target:
>>> import gevent
>>> result = AsyncResult()
>>> result = AsyncResult()
>>> gevent.spawn(lambda : 1/0).link(result)
>>> gevent.spawn(lambda : 1/0).link(result)
>>> result.get()
>>> result.get()
...
...
gevent/timeout.py
View file @
54d409df
...
@@ -31,7 +31,8 @@ class Timeout(BaseException):
...
@@ -31,7 +31,8 @@ class Timeout(BaseException):
When *exception* is omitted or ``None``, the :class:`Timeout` instance itself is raised:
When *exception* is omitted or ``None``, the :class:`Timeout` instance itself is raised:
>>> Timeout(0.1).start()
>>> import gevent
>>> gevent.Timeout(0.1).start()
>>> gevent.sleep(0.2)
>>> gevent.sleep(0.2)
Traceback (most recent call last):
Traceback (most recent call last):
...
...
...
@@ -39,7 +40,7 @@ class Timeout(BaseException):
...
@@ -39,7 +40,7 @@ class Timeout(BaseException):
For Python 2.5 and newer ``with`` statement can be used::
For Python 2.5 and newer ``with`` statement can be used::
with Timeout(seconds, exception) as timeout:
with
gevent.
Timeout(seconds, exception) as timeout:
pass # ... code block ...
pass # ... code block ...
This is equivalent to try/finally block above with one additional feature:
This is equivalent to try/finally block above with one additional feature:
...
@@ -49,7 +50,7 @@ class Timeout(BaseException):
...
@@ -49,7 +50,7 @@ class Timeout(BaseException):
This is handy for adding a timeout to the functions that don't support *timeout* parameter themselves::
This is handy for adding a timeout to the functions that don't support *timeout* parameter themselves::
data = None
data = None
with Timeout(5, False):
with
gevent.
Timeout(5, False):
data = mysock.makefile().readline()
data = mysock.makefile().readline()
if data is None:
if data is None:
... # 5 seconds passed without reading a line
... # 5 seconds passed without reading a line
...
...
greentest/bench_spawn.py
View file @
54d409df
...
@@ -6,12 +6,8 @@ import random
...
@@ -6,12 +6,8 @@ import random
from
time
import
time
from
time
import
time
def
init
():
N
=
10000
global
N
,
counter
counter
=
0
N
=
10000
counter
=
0
init
()
def
incr
(
sleep
,
**
kwargs
):
def
incr
(
sleep
,
**
kwargs
):
...
...
greentest/lock_tests.py
View file @
54d409df
...
@@ -439,7 +439,7 @@ class BaseSemaphoreTests(BaseTestCase):
...
@@ -439,7 +439,7 @@ class BaseSemaphoreTests(BaseTestCase):
def
test_acquire_contended
(
self
):
def
test_acquire_contended
(
self
):
sem
=
self
.
semtype
(
7
)
sem
=
self
.
semtype
(
7
)
sem
.
acquire
()
sem
.
acquire
()
N
=
10
#
N = 10
results1
=
[]
results1
=
[]
results2
=
[]
results2
=
[]
phase_num
=
0
phase_num
=
0
...
...
greentest/test__server.py
View file @
54d409df
...
@@ -318,6 +318,7 @@ class TestPoolSpawn(TestDefaultSpawn):
...
@@ -318,6 +318,7 @@ class TestPoolSpawn(TestDefaultSpawn):
# to let /short request finish
# to let /short request finish
gevent
.
sleep
(
0.1
)
gevent
.
sleep
(
0.1
)
self
.
assertRequestSucceeded
()
self
.
assertRequestSucceeded
()
del
long_request
test_pool_full
.
error_fatal
=
False
test_pool_full
.
error_fatal
=
False
...
...
greentest/test__socket_dns.py
View file @
54d409df
...
@@ -49,13 +49,13 @@ def log_fresult(result, seconds):
...
@@ -49,13 +49,13 @@ def log_fresult(result, seconds):
msg
=
' -=> raised %r'
%
(
result
,
)
msg
=
' -=> raised %r'
%
(
result
,
)
else
:
else
:
msg
=
' -=> returned %r'
%
(
result
,
)
msg
=
' -=> returned %r'
%
(
result
,
)
time
=
' %.2fms'
%
(
seconds
*
1000.0
,
)
time
_ms
=
' %.2fms'
%
(
seconds
*
1000.0
,
)
space
=
80
-
len
(
msg
)
-
len
(
time
)
space
=
80
-
len
(
msg
)
-
len
(
time
_ms
)
if
space
>
0
:
if
space
>
0
:
space
=
' '
*
space
space
=
' '
*
space
else
:
else
:
space
=
''
space
=
''
log
(
msg
+
space
+
time
)
log
(
msg
+
space
+
time
_ms
)
def
run
(
function
,
*
args
):
def
run
(
function
,
*
args
):
...
...
greentest/test__subprocess.py
View file @
54d409df
...
@@ -130,7 +130,7 @@ class Test(greentest.TestCase):
...
@@ -130,7 +130,7 @@ class Test(greentest.TestCase):
def
test_issue148
(
self
):
def
test_issue148
(
self
):
for
i
in
range
(
7
):
for
i
in
range
(
7
):
try
:
try
:
p1
=
subprocess
.
Popen
(
'this_name_must_not_exist'
)
subprocess
.
Popen
(
'this_name_must_not_exist'
)
except
OSError
as
ex
:
except
OSError
as
ex
:
if
ex
.
errno
!=
errno
.
ENOENT
:
if
ex
.
errno
!=
errno
.
ENOENT
:
raise
raise
...
...
greentest/test_support.py
View file @
54d409df
...
@@ -261,7 +261,6 @@ except IOError:
...
@@ -261,7 +261,6 @@ except IOError:
try
:
try
:
fp
=
open
(
TMP_TESTFN
,
'w+'
)
fp
=
open
(
TMP_TESTFN
,
'w+'
)
TESTFN
=
TMP_TESTFN
TESTFN
=
TMP_TESTFN
del
TMP_TESTFN
except
IOError
:
except
IOError
:
print
(
'WARNING: tests will fail, unable to write to: %s or %s'
%
print
(
'WARNING: tests will fail, unable to write to: %s or %s'
%
(
TESTFN
,
TMP_TESTFN
))
(
TESTFN
,
TMP_TESTFN
))
...
...
greentest/test_threading_2.py
View file @
54d409df
...
@@ -289,6 +289,8 @@ class ThreadTests(unittest.TestCase):
...
@@ -289,6 +289,8 @@ class ThreadTests(unittest.TestCase):
print
(
"test_finalize_with_runnning_thread can't import ctypes"
)
print
(
"test_finalize_with_runnning_thread can't import ctypes"
)
return
# can't do anything
return
# can't do anything
del
ctypes
# pyflakes fix
import
subprocess
import
subprocess
rc
=
subprocess
.
call
([
sys
.
executable
,
"-c"
,
"""if 1:
rc
=
subprocess
.
call
([
sys
.
executable
,
"-c"
,
"""if 1:
%s
%s
...
...
util/cythonpp.py
View file @
54d409df
...
@@ -9,6 +9,7 @@ import pipes
...
@@ -9,6 +9,7 @@ import pipes
import
difflib
import
difflib
from
hashlib
import
md5
from
hashlib
import
md5
do_exec
=
None
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
0
):
exec
(
"def do_exec(co, loc): exec(co, loc)
\
n
"
)
exec
(
"def do_exec(co, loc): exec(co, loc)
\
n
"
)
else
:
else
:
...
...
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