Repository: spyder-ide/spyder

Issue:
Help fails to produce Rich Text on annotated functions
# Description of your problem
## What steps will reproduce the problem?
1. Create a function and use function annotations, à la [PEP-3107](https://www.python.org/dev/peps/pep-3107/) and save the module (in this case to `doc_check.py`). For example:

``` python
def test_function(value: int) -> int:
    """This is a very boring function

    This function just returns whatever you put into it.

    Parameters
    ----------
    value
        This is an integer

    Returns
    -------
    test_function
        This is the same as whatever we put in the function
    """
    return value
```
1. Import the module in the command window
2. Type the module.function name and press Ctrl+I. 
## What is the expected output? What do you see instead?
### Expected Output

I expect to see Rich Text help in the Help pane, similar to that generated from a sphinx-quickstart html output:
![test_function_html_output](https://cloud.githubusercontent.com/assets/7116641/19576672/b716b0d0-96c8-11e6-9af8-8d8523888b99.png)

(It should be noted that in general section headers are handled well in the Help pane--I'm not sure why they're not showing up in my basic Sphinx setup. Napoleon handles them well:
![test_function_html_output_napoleon](https://cloud.githubusercontent.com/assets/7116641/19576782/3f40769e-96c9-11e6-8b77-dfe531d83984.png)
### What I see

In the Spyder Help pane I just get **No documentation available**
## Please provide any additional information below
## Versions and main components
- Spyder Version: 3.0.1
- Python Version: 3.4.5
- Operating system: Windows 7 Enterprise 64-bit
## Dependencies

Please go to the menu entry `Help > Optional Dependencies` (or
`Help > Dependencies`), press the button `Copy to clipboard`
and paste the contents below:
jedi >=0.8.1     :  0.9.0 (OK)
matplotlib >=1.0 :  1.5.3 (OK)
nbconvert >=4.0  :  4.2.0 (OK)
numpy >=1.7      :  1.11.1 (OK)
pandas >=0.13.1  :  0.18.1 (OK)
pep8 >=0.6       :  1.7.0 (OK)
pyflakes >=0.6.0 :  1.3.0 (OK)
pygments >=2.0   :  2.1.3 (OK)
pylint >=0.25    :  1.5.4 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
sphinx >=0.6.6   :  1.4.6 (OK)
sympy >=0.7.3    :  1.0 (OK)



Discussion:

Resolving patch:
diff --git a/spyder/utils/dochelpers.py b/spyder/utils/dochelpers.py
--- a/spyder/utils/dochelpers.py
+++ b/spyder/utils/dochelpers.py
@@ -15,7 +15,7 @@
 from spyder.utils import encoding
 from spyder.py3compat import (is_text_string, builtins, get_meth_func,
                               get_meth_class_inst, get_meth_class,
-                              get_func_defaults, to_text_string)
+                              get_func_defaults, to_text_string, PY2)
 
 
 SYMBOLS = r"[^\'\"a-zA-Z0-9_.]"
@@ -112,10 +112,17 @@ def getdoc(obj):
             doc['note'] = 'Function'
         doc['name'] = obj.__name__
         if inspect.isfunction(obj):
-            args, varargs, varkw, defaults = inspect.getargspec(obj)
-            doc['argspec'] = inspect.formatargspec(args, varargs, varkw,
-                                              defaults,
-                                              formatvalue=lambda o:'='+repr(o))
+            if PY2:
+                args, varargs, varkw, defaults = inspect.getargspec(obj)
+                doc['argspec'] = inspect.formatargspec(
+                    args, varargs, varkw, defaults,
+                    formatvalue=lambda o:'='+repr(o))
+            else:
+                (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults,
+                 annotations) = inspect.getfullargspec(obj)
+                doc['argspec'] = inspect.formatargspec(
+                    args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults,
+                    annotations, formatvalue=lambda o:'='+repr(o))
             if name == '<lambda>':
                 doc['name'] = name + ' lambda '
                 doc['argspec'] = doc['argspec'][1:-1] # remove parentheses


Test patch: