From: Vladlen Y. Koshelev Date: Mon, 18 Feb 2013 21:16:54 +0000 (+0400) Subject: Fix docstrings quoting. X-Git-Tag: v3.0.0~104^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3585b0e2c2082e140ab668843325b4276c207fa;p=thirdparty%2Ftornado.git Fix docstrings quoting. --- diff --git a/tornado/stack_context.py b/tornado/stack_context.py index 2a055d09d..c30a2598f 100644 --- a/tornado/stack_context.py +++ b/tornado/stack_context.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -'''StackContext allows applications to maintain threadlocal-like state +"""StackContext allows applications to maintain threadlocal-like state that follows execution as it moves to other execution contexts. The motivating examples are to eliminate the need for explicit @@ -64,7 +64,7 @@ Here are a few rules of thumb for when it's necessary: persist across asynchronous calls, create a new `StackContext` (or `ExceptionStackContext`), and make your asynchronous calls in a ``with`` block that references your `StackContext`. -''' +""" from __future__ import absolute_import, division, print_function, with_statement @@ -88,7 +88,7 @@ _state = _State() class StackContext(object): - '''Establishes the given context as a StackContext that will be transferred. + """Establishes the given context as a StackContext that will be transferred. Note that the parameter is a callable that returns a context manager, not the context itself. That is, where for a @@ -106,7 +106,7 @@ class StackContext(object): deactivating a context does not affect any instances of that context that are currently pending). This is an advanced feature and not necessary in most applications. - ''' + """ def __init__(self, context_factory, _active_cell=None): self.context_factory = context_factory self.active_cell = _active_cell or [True] @@ -149,7 +149,7 @@ class StackContext(object): class ExceptionStackContext(object): - '''Specialization of StackContext for exception handling. + """Specialization of StackContext for exception handling. The supplied exception_handler function will be called in the event of an uncaught exception in this context. The semantics are @@ -160,7 +160,7 @@ class ExceptionStackContext(object): If the exception handler returns true, the exception will be consumed and will not be propagated to other exception handlers. - ''' + """ def __init__(self, exception_handler, _active_cell=None): self.exception_handler = exception_handler self.active_cell = _active_cell or [True] @@ -188,12 +188,12 @@ class ExceptionStackContext(object): class NullContext(object): - '''Resets the StackContext. + """Resets the StackContext. Useful when creating a shared resource on demand (e.g. an AsyncHTTPClient) where the stack that caused the creating is not relevant to future operations. - ''' + """ def __enter__(self): self.old_contexts = _state.contexts _state.contexts = () @@ -207,13 +207,13 @@ class _StackContextWrapper(functools.partial): def wrap(fn): - '''Returns a callable object that will restore the current StackContext + """Returns a callable object that will restore the current StackContext when executed. Use this whenever saving a callback to be executed later in a different execution context (either in a different thread or asynchronously in the same thread). - ''' + """ if fn is None or fn.__class__ is _StackContextWrapper: return fn # functools.wraps doesn't appear to work on functools.partial objects diff --git a/tornado/test/httpserver_test.py b/tornado/test/httpserver_test.py index 2a60e9de1..b3a771c36 100644 --- a/tornado/test/httpserver_test.py +++ b/tornado/test/httpserver_test.py @@ -132,7 +132,7 @@ class BadSSLOptionsTest(unittest.TestCase): }) def test_missing_key(self): - '''A missing SSL key should cause an immediate exception.''' + """A missing SSL key should cause an immediate exception.""" application = Application() module_dir = os.path.dirname(__file__) diff --git a/tornado/testing.py b/tornado/testing.py index ff373970c..de6e5b4fb 100644 --- a/tornado/testing.py +++ b/tornado/testing.py @@ -167,10 +167,10 @@ class AsyncTestCase(unittest.TestCase): super(AsyncTestCase, self).tearDown() def get_new_ioloop(self): - '''Creates a new IOLoop for this test. May be overridden in + """Creates a new IOLoop for this test. May be overridden in subclasses for tests that require a specific IOLoop (usually the singleton). - ''' + """ return IOLoop() def _handle_exception(self, typ, value, tb): @@ -192,12 +192,12 @@ class AsyncTestCase(unittest.TestCase): self.__rethrow() def stop(self, _arg=None, **kwargs): - '''Stops the ioloop, causing one pending (or future) call to wait() + """Stops the ioloop, causing one pending (or future) call to wait() to return. Keyword arguments or a single positional argument passed to stop() are saved and will be returned by wait(). - ''' + """ assert _arg is None or not kwargs self.__stop_args = kwargs or _arg if self.__running: @@ -241,7 +241,7 @@ class AsyncTestCase(unittest.TestCase): class AsyncHTTPTestCase(AsyncTestCase): - '''A test case that starts up an HTTP server. + """A test case that starts up an HTTP server. Subclasses must override get_app(), which returns the tornado.web.Application (or other HTTPServer callback) to be tested. @@ -262,7 +262,7 @@ class AsyncHTTPTestCase(AsyncTestCase): self.http_client.fetch(self.get_url('/'), self.stop) response = self.wait() # test contents of response - ''' + """ def setUp(self): super(AsyncHTTPTestCase, self).setUp() sock, port = bind_unused_port()