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
950eea41
Commit
950eea41
authored
Nov 15, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a few docstrings to Timeout's methods
parent
d327559d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
gevent/timeout.py
gevent/timeout.py
+13
-0
No files found.
gevent/timeout.py
View file @
950eea41
...
...
@@ -88,6 +88,7 @@ class Timeout(BaseException):
self
.
timer
=
None
def
start
(
self
):
"""Schedule the timeout."""
assert
not
self
.
pending
,
'%r is already started; to restart it, cancel it first'
%
self
if
self
.
seconds
is
None
:
# "fake" timeout (never expires)
self
.
timer
=
None
...
...
@@ -98,6 +99,16 @@ class Timeout(BaseException):
@
classmethod
def
start_new
(
cls
,
timeout
=
None
,
exception
=
None
):
"""Create a started :class:`Timeout`.
This is a shortcut, the exact action depends on *timeout*'s type:
* If *timeout* is a :class:`Timeout`, then call its :meth:`start` method.
* Otherwise, create a new :class:`Timeout` instance, passing (*timeout*, *exception*) as
arguments, then call its :meth:`start` method.
Returns the :class:`Timeout` instance.
"""
if
isinstance
(
timeout
,
Timeout
):
if
not
timeout
.
pending
:
timeout
.
start
()
...
...
@@ -108,12 +119,14 @@ class Timeout(BaseException):
@
property
def
pending
(
self
):
"""Return True if the timeout is pending, that is, scheduled to be raised."""
if
self
.
timer
is
not
None
:
return
self
.
timer
.
pending
else
:
return
False
def
cancel
(
self
):
"""If the timeout is pending, cancel it. Otherwise, do nothing."""
if
self
.
timer
is
not
None
:
self
.
timer
.
cancel
()
...
...
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