diff --git a/IPython/parallel/client/remotefunction.py b/IPython/parallel/client/remotefunction.py index 026c0d0..45c6264 100644 --- a/IPython/parallel/client/remotefunction.py +++ b/IPython/parallel/client/remotefunction.py @@ -152,8 +152,10 @@ class ParallelFunction(RemoteFunction): dist : str [default: 'b'] The key for which mapObject to use to distribute sequences options are: - * 'b' : use contiguous chunks in order - * 'r' : use round-robin striping + + * 'b' : use contiguous chunks in order + * 'r' : use round-robin striping + block : bool [default: None] Whether to wait for results or not. The default behavior is to use the current `block` attribute of `view` @@ -162,7 +164,8 @@ class ParallelFunction(RemoteFunction): ordered : bool [default: True] Whether the result should be kept in order. If False, results become available as they arrive, regardless of submission order. - **flags : remaining kwargs are passed to View.temp_flags + **flags + remaining kwargs are passed to View.temp_flags """ chunksize = None diff --git a/IPython/parallel/client/view.py b/IPython/parallel/client/view.py index d08f03c..57a7154 100644 --- a/IPython/parallel/client/view.py +++ b/IPython/parallel/client/view.py @@ -221,30 +221,27 @@ class View(HasTraits): raise NotImplementedError("Implement in subclasses") def apply(self, f, *args, **kwargs): - """calls f(*args, **kwargs) on remote engines, returning the result. + """calls ``f(*args, **kwargs)`` on remote engines, returning the result. This method sets all apply flags via this View's attributes. - if self.block is False: - returns AsyncResult - else: - returns actual result of f(*args, **kwargs) + Returns :class:`~IPython.parallel.client.asyncresult.AsyncResult` + instance if ``self.block`` is False, otherwise the return value of + ``f(*args, **kwargs)``. """ return self._really_apply(f, args, kwargs) def apply_async(self, f, *args, **kwargs): - """calls f(*args, **kwargs) on remote engines in a nonblocking manner. + """calls ``f(*args, **kwargs)`` on remote engines in a nonblocking manner. - returns AsyncResult + Returns :class:`~IPython.parallel.client.asyncresult.AsyncResult` instance. """ return self._really_apply(f, args, kwargs, block=False) @spin_after def apply_sync(self, f, *args, **kwargs): - """calls f(*args, **kwargs) on remote engines in a blocking manner, + """calls ``f(*args, **kwargs)`` on remote engines in a blocking manner, returning the result. - - returns: actual result of f(*args, **kwargs) """ return self._really_apply(f, args, kwargs, block=True) @@ -320,8 +317,7 @@ class View(HasTraits): def get_result(self, indices_or_msg_ids=None): """return one or more results, specified by history index or msg_id. - See client.get_result for details. - + See :meth:`IPython.parallel.client.client.Client.get_result` for details. """ if indices_or_msg_ids is None: @@ -345,9 +341,9 @@ class View(HasTraits): raise NotImplementedError def map_async(self, f, *sequences, **kwargs): - """Parallel version of builtin `map`, using this view's engines. + """Parallel version of builtin :func:`python:map`, using this view's engines. - This is equivalent to map(...block=False) + This is equivalent to ``map(...block=False)``. See `self.map` for details. """ @@ -357,9 +353,9 @@ class View(HasTraits): return self.map(f,*sequences,**kwargs) def map_sync(self, f, *sequences, **kwargs): - """Parallel version of builtin `map`, using this view's engines. + """Parallel version of builtin :func:`python:map`, using this view's engines. - This is equivalent to map(...block=True) + This is equivalent to ``map(...block=True)``. See `self.map` for details. """ @@ -369,7 +365,7 @@ class View(HasTraits): return self.map(f,*sequences,**kwargs) def imap(self, f, *sequences, **kwargs): - """Parallel version of `itertools.imap`. + """Parallel version of :func:`itertools.imap`. See `self.map` for details. @@ -575,7 +571,7 @@ class DirectView(View): @sync_results def map(self, f, *sequences, **kwargs): - """view.map(f, *sequences, block=self.block) => list|AsyncMapResult + """``view.map(f, *sequences, block=self.block)`` => list|AsyncMapResult Parallel version of builtin `map`, using this View's `targets`. @@ -597,14 +593,14 @@ class DirectView(View): Returns ------- - if block=False: - AsyncMapResult - An object like AsyncResult, but which reassembles the sequence of results - into a single list. AsyncMapResults can be iterated through before all - results are complete. - else: - list - the result of map(f,*sequences) + + If block=False + An :class:`~IPython.parallel.client.asyncresult.AsyncMapResult` instance. + An object like AsyncResult, but which reassembles the sequence of results + into a single list. AsyncMapResults can be iterated through before all + results are complete. + else + A list, the result of ``map(f,*sequences)`` """ block = kwargs.pop('block', self.block) @@ -1056,7 +1052,7 @@ class LoadBalancedView(View): @sync_results @save_ids def map(self, f, *sequences, **kwargs): - """view.map(f, *sequences, block=self.block, chunksize=1, ordered=True) => list|AsyncMapResult + """``view.map(f, *sequences, block=self.block, chunksize=1, ordered=True)`` => list|AsyncMapResult Parallel version of builtin `map`, load-balanced by this View. @@ -1091,14 +1087,13 @@ class LoadBalancedView(View): Returns ------- - if block=False: - AsyncMapResult - An object like AsyncResult, but which reassembles the sequence of results - into a single list. AsyncMapResults can be iterated through before all - results are complete. - else: - the result of map(f,*sequences) - + if block=False + An :class:`~IPython.parallel.client.asyncresult.AsyncMapResult` instance. + An object like AsyncResult, but which reassembles the sequence of results + into a single list. AsyncMapResults can be iterated through before all + results are complete. + else + A list, the result of ``map(f,*sequences)`` """ # default diff --git a/IPython/parallel/controller/dependency.py b/IPython/parallel/controller/dependency.py index 853a0b7..93af379 100644 --- a/IPython/parallel/controller/dependency.py +++ b/IPython/parallel/controller/dependency.py @@ -105,17 +105,16 @@ def require(*objects, **mapping): and will be pushed to the engine with their __name__. Other objects can be passed by keyword arg. - Examples - -------- + Examples:: - In [1]: @require('numpy') - ...: def norm(a): - ...: return numpy.linalg.norm(a,2) + In [1]: @require('numpy') + ...: def norm(a): + ...: return numpy.linalg.norm(a,2) - In [2]: foo = lambda x: x*x - In [3]: @require(foo) - ...: def bar(a): - ...: return foo(1-a) + In [2]: foo = lambda x: x*x + In [3]: @require(foo) + ...: def bar(a): + ...: return foo(1-a) """ names = [] for obj in objects: diff --git a/IPython/parallel/controller/dictdb.py b/IPython/parallel/controller/dictdb.py index e3ad9e0..bffcc2a 100644 --- a/IPython/parallel/controller/dictdb.py +++ b/IPython/parallel/controller/dictdb.py @@ -6,37 +6,42 @@ Authors: * Min RK -TaskRecords are dicts of the form: -{ - 'msg_id' : str(uuid), - 'client_uuid' : str(uuid), - 'engine_uuid' : str(uuid) or None, - 'header' : dict(header), - 'content': dict(content), - 'buffers': list(buffers), - 'submitted': datetime, - 'started': datetime or None, - 'completed': datetime or None, - 'resubmitted': datetime or None, - 'result_header' : dict(header) or None, - 'result_content' : dict(content) or None, - 'result_buffers' : list(buffers) or None, -} -With this info, many of the special categories of tasks can be defined by query: - -pending: completed is None -client's outstanding: client_uuid = uuid && completed is None -MIA: arrived is None (and completed is None) -etc. +TaskRecords are dicts of the form:: + + { + 'msg_id' : str(uuid), + 'client_uuid' : str(uuid), + 'engine_uuid' : str(uuid) or None, + 'header' : dict(header), + 'content': dict(content), + 'buffers': list(buffers), + 'submitted': datetime, + 'started': datetime or None, + 'completed': datetime or None, + 'resubmitted': datetime or None, + 'result_header' : dict(header) or None, + 'result_content' : dict(content) or None, + 'result_buffers' : list(buffers) or None, + } + +With this info, many of the special categories of tasks can be defined by query, +e.g.: + +* pending: completed is None +* client's outstanding: client_uuid = uuid && completed is None +* MIA: arrived is None (and completed is None) + +EngineRecords are dicts of the form:: + + { + 'eid' : int(id), + 'uuid': str(uuid) + } -EngineRecords are dicts of the form: -{ - 'eid' : int(id), - 'uuid': str(uuid) -} This may be extended, but is currently. -We support a subset of mongodb operators: +We support a subset of mongodb operators:: + $lt,$gt,$lte,$gte,$ne,$in,$nin,$all,$mod,$exists """ #----------------------------------------------------------------------------- diff --git a/IPython/parallel/controller/hub.py b/IPython/parallel/controller/hub.py index 8bdba12..176edfa 100644 --- a/IPython/parallel/controller/hub.py +++ b/IPython/parallel/controller/hub.py @@ -1149,11 +1149,15 @@ class Hub(SessionFactory): def queue_status(self, client_id, msg): """Return the Queue status of one or more targets. - if verbose: return the msg_ids - else: return len of each type. - keys: queue (pending MUX jobs) - tasks (pending Task jobs) - completed (finished jobs from both queues)""" + + If verbose, return the msg_ids, else return len of each type. + + Keys: + + * queue (pending MUX jobs) + * tasks (pending Task jobs) + * completed (finished jobs from both queues) + """ content = msg['content'] targets = content['targets'] try: diff --git a/IPython/parallel/util.py b/IPython/parallel/util.py index d8344e9..f914953 100644 --- a/IPython/parallel/util.py +++ b/IPython/parallel/util.py @@ -199,7 +199,8 @@ def disambiguate_url(url, location=None): """turn multi-ip interfaces '0.0.0.0' and '*' into connectable ones, based on the location (default interpretation is localhost). - This is for zeromq urls, such as tcp://*:10101.""" + This is for zeromq urls, such as ``tcp://*:10101``. + """ try: proto,ip,port = split_url(url) except AssertionError: diff --git a/IPython/terminal/interactiveshell.py b/IPython/terminal/interactiveshell.py index 3eb48f9..9297c70 100644 --- a/IPython/terminal/interactiveshell.py +++ b/IPython/terminal/interactiveshell.py @@ -560,12 +560,11 @@ class TerminalInteractiveShell(InteractiveShell): The returned line does not include the trailing newline. When the user enters the EOF key sequence, EOFError is raised. - Optional inputs: + Parameters + ---------- - - prompt(''): a string to be printed to prompt the user. - - - continue_prompt(False): whether this line is the first one or a - continuation in a sequence of inputs. + prompt : str, optional + A string to be printed to prompt the user. """ # Code run by the user may have modified the readline completer state. # We must ensure that our completer is back in place. diff --git a/IPython/testing/decorators.py b/IPython/testing/decorators.py index 62422ce..04c0dbe 100644 --- a/IPython/testing/decorators.py +++ b/IPython/testing/decorators.py @@ -175,20 +175,21 @@ def skipif(skip_condition, msg=None): Parameters ---------- - skip_condition : bool or callable. - Flag to determine whether to skip test. If the condition is a - callable, it is used at runtime to dynamically make the decision. This - is useful for tests that may require costly imports, to delay the cost - until the test suite is actually executed. + + skip_condition : bool or callable + Flag to determine whether to skip test. If the condition is a + callable, it is used at runtime to dynamically make the decision. This + is useful for tests that may require costly imports, to delay the cost + until the test suite is actually executed. msg : string - Message to give on raising a SkipTest exception - - Returns - ------- - decorator : function - Decorator, which, when applied to a function, causes SkipTest - to be raised when the skip_condition was True, and the function - to be called normally otherwise. + Message to give on raising a SkipTest exception. + + Returns + ------- + decorator : function + Decorator, which, when applied to a function, causes SkipTest + to be raised when the skip_condition was True, and the function + to be called normally otherwise. Notes ----- diff --git a/docs/source/whatsnew/github-stats-0.12.rst b/docs/source/whatsnew/github-stats-0.12.rst index 6503f22..05d139a 100644 --- a/docs/source/whatsnew/github-stats-0.12.rst +++ b/docs/source/whatsnew/github-stats-0.12.rst @@ -140,7 +140,7 @@ Pull requests (257): * `1126 `_: Totally remove pager when read only (notebook) * `1091 `_: qtconsole : allow copy with shortcut in pager * `1114 `_: fix magics history in two-process ipython console -* `1113 `_: Fixing #1112 removing failing asserts for test_carriage_return and test_... +* `1113 `_: Fixing #1112 removing failing asserts for test_carriage_return and test_beep * `1089 `_: Support carriage return ('\r') and beep ('\b') characters in the qtconsole * `1108 `_: Completer usability 2 (rebased of pr #1082) * `864 `_: Two-process terminal frontend (ipython core branch) diff --git a/docs/source/whatsnew/github-stats-1.0.rst b/docs/source/whatsnew/github-stats-1.0.rst index f3beb3c..05bdbde 100644 --- a/docs/source/whatsnew/github-stats-1.0.rst +++ b/docs/source/whatsnew/github-stats-1.0.rst @@ -643,7 +643,7 @@ Pull Requests (793): * :ghpull:`3223`: add missing mathjax_url to new settings dict * :ghpull:`3089`: add stdin to the notebook * :ghpull:`3221`: Remove references to HTMLCell (dead code) -* :ghpull:`3205`: add ignored *args to HasTraits constructor +* :ghpull:`3205`: add ignored ``*args`` to HasTraits constructor * :ghpull:`3088`: cleanup IPython handler settings * :ghpull:`3201`: use much faster regexp for ansi coloring * :ghpull:`3220`: avoid race condition in profile creation @@ -1064,7 +1064,7 @@ Pull Requests (793): * :ghpull:`2140`: 2to3: Apply `has_key` fixer. * :ghpull:`2131`: Add option append (-a) to %save * :ghpull:`2117`: use explicit url in notebook example -* :ghpull:`2133`: Tell git that *.py files contain Python code, for use in word-diffs. +* :ghpull:`2133`: Tell git that ``*.py`` files contain Python code, for use in word-diffs. * :ghpull:`2134`: Apply 2to3 `next` fix. * :ghpull:`2126`: ipcluster broken with any batch launcher (PBS/LSF/SGE) * :ghpull:`2104`: Windows make file for Sphinx documentation @@ -1423,7 +1423,7 @@ Issues (691): * :ghissue:`3207`: [Feature] folders for ipython notebook dashboard * :ghissue:`3178`: cell magics do not work with empty lines after #2447 * :ghissue:`3204`: Default plot() colors unsuitable for red-green colorblind users -* :ghissue:`1789`: :\n/*foo turns into :\n*(foo) in triple-quoted strings. +* :ghissue:`1789`: ``:\n/*foo`` turns into ``:\n*(foo)`` in triple-quoted strings. * :ghissue:`3202`: File cell magic fails with blank lines * :ghissue:`3199`: %%cython -a stopped working? * :ghissue:`2688`: obsolete imports in import autocompletion @@ -1649,7 +1649,7 @@ Issues (691): * :ghissue:`1308`: ipython qtconsole --ssh=server --existing ... hangs * :ghissue:`1679`: List command doesn't work in ipdb debugger the first time * :ghissue:`2545`: pypi win32 installer creates 64bit executibles -* :ghissue:`2080`: Event loop issues with IPython 0.12 and PyQt4 (QDialog.exec_ and more) +* :ghissue:`2080`: Event loop issues with IPython 0.12 and PyQt4 (``QDialog.exec_`` and more) * :ghissue:`2541`: Allow `python -m IPython` * :ghissue:`2508`: subplots_adjust() does not work correctly in ipython notebook * :ghissue:`2289`: Incorrect mathjax rendering of certain arrays of equations