Skip to content

Commit

Permalink
doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lsbardel committed Nov 25, 2017
1 parent 0f52dbd commit 517a80e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/apps/wsgi/content.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Design
===============

The :meth:`~String.stream` method is responsible for the streaming
of ``strings`` or :ref:`asynchronous components <tutorials-coroutine>`.
of ``strings``.
It can be overwritten by subclasses to customise the way an
:class:`String` streams its :attr:`~String.children`.

Expand Down
8 changes: 0 additions & 8 deletions docs/apps/wsgi/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
Utilities
=====================

HTTP Parsers
================

Pulsar ships with its own :ref:`HTTP parser <tools-http-parser>` used by
both server and the :ref:`HTTP client <apps-http>`. Headers are collected using
the :ref:`Headers data structure <tools-http-headers>` which exposes a
list/dictionary-type interface.


Authentication
=================
Expand Down
4 changes: 0 additions & 4 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ What is an actor?
~~~~~~~~~~~~~~~~~~~~~~
Check the :ref:`actor design documentation <design-actor>`.

How pulsar handle asynchronous data?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Check the :ref:`asynchronous components documentation <tutorials-coroutine>`.

How is pulsar different from Twisted?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pulsar is written for python 3.4 or above, Twisted is python 2. Pulsar is written
Expand Down
10 changes: 2 additions & 8 deletions pulsar/apps/wsgi/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,7 @@ def append_to(self, parent):
return self

def stream(self, request, counter=0):
'''Returns an iterable over strings or asynchronous components.
If :ref:`asynchronous elements <tutorials-coroutine>` are included
in the iterable, when called, they must result in strings.
This method can be re-implemented by subclasses and should not be
invoked directly.
Use the :meth:`stream` method instead.
'''Returns an iterable over strings.
'''
if self._children:
for child in self._children:
Expand Down Expand Up @@ -576,7 +570,7 @@ class Links(Media):
'''A :class:`.Media` container for ``link`` tags.
The ``<link>`` tag defines the relationship between a
:class:`.HtmlDocument` and an external resource.
:class:`~.HtmlDocument` and an external resource.
It is most used to link to style sheets.
'''
mediatype = 'css'
Expand Down
3 changes: 0 additions & 3 deletions pulsar/async/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ def _error_back(fut):
def maybe_async(value, *, loop=None):
'''Handle a possible asynchronous ``value``.
Return an :ref:`asynchronous instance <tutorials-coroutine>`
only if ``value`` is a generator, a :class:`.Future`.
:parameter value: the value to convert to an asynchronous instance
if it needs to.
:parameter loop: optional :class:`.EventLoop`.
Expand Down
16 changes: 16 additions & 0 deletions pulsar/utils/pylib/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def onetime(self):
return bool(self._onetime)

def fired(self):
"""Returns true or false depending if this event was fired
One-time events only can be fired
"""
return self._self is None

def bind(self, callback):
Expand Down Expand Up @@ -62,6 +66,11 @@ def unbind(self, callback):
return 0

def fire(self, exc=None, data=None):
"""Fire the event
:param exc: fire the event with an exception
:param data: fire an event with data
"""
o = self._self

if o is not None:
Expand Down Expand Up @@ -89,6 +98,13 @@ def fire(self, exc=None, data=None):
self._waiter = None

def waiter(self):
"""Return a :class:`~asyncio.Future` called back once the event
has been fired.
If the event has been fired already return a resolved future.
This method is available only for one-time events
"""
assert self._onetime, 'One time events only can invoke waiter'
if not self._waiter:
self._waiter = get_event_loop().create_future()
if self.fired():
Expand Down
2 changes: 2 additions & 0 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
recommonmark
sphinxcontrib-spelling
flask
greenlet

0 comments on commit 517a80e

Please sign in to comment.