internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ipython/ipython

Issue:
?? is not coloring docstring anymore. 
Mike and I are on it. 



Discussion:

Resolving patch:
diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py
--- a/IPython/core/interactiveshell.py
+++ b/IPython/core/interactiveshell.py
@@ -624,7 +624,7 @@ def init_inspector(self):
         # Object inspector
         self.inspector = oinspect.Inspector(oinspect.InspectColors,
                                             PyColorize.ANSICodeColors,
-                                            'NoColor',
+                                            self.colors,
                                             self.object_info_string_level)
 
     def init_io(self):
diff --git a/IPython/core/oinspect.py b/IPython/core/oinspect.py
--- a/IPython/core/oinspect.py
+++ b/IPython/core/oinspect.py
@@ -352,7 +352,7 @@ class Inspector(Colorable):
 
     def __init__(self, color_table=InspectColors,
                  code_color_table=PyColorize.ANSICodeColors,
-                 scheme='NoColor',
+                 scheme=None,
                  str_detail_level=0,
                  parent=None, config=None):
         super(Inspector, self).__init__(parent=parent, config=config)
@@ -379,8 +379,9 @@ def __head(self,h):
                            self.color_table.active_colors.normal)
 
     def set_active_scheme(self, scheme):
-        self.color_table.set_active_scheme(scheme)
-        self.parser.color_table.set_active_scheme(scheme)
+        if scheme is not None:
+            self.color_table.set_active_scheme(scheme)
+            self.parser.color_table.set_active_scheme(scheme)
 
     def noinfo(self, msg, oname):
         """Generic message when no information is found."""


Test patch:
Repository: ipython/ipython

Issue:
completion should favor displaying the actually completed part of the string rather than the prefix
One screenshot says it all.
![screenshot_20160804_003842](https://cloud.githubusercontent.com/assets/1322974/17394140/6258d5e2-59dc-11e6-8805-a2cf9abd542d.png)



Discussion:
cc @jonathanslenders can we truncate on the left as well? Or do we need to do this in IPython, in terms of what we pass to pt as completions?

> cc @jonathanslenders can we truncate on the left as well? Or do we need to do this in IPython, in terms of what we pass to pt as completions?

Yes we can, we can have the displayed completion and the completion text different already, but it requires some refactor of the completion machinery that we want for 6.0.

@anntzer can you try master ? it's curiously fixed even if I'm not sure why. 
The issue is still present for me as of (git describe) 5.1.0-526-g3c154253b.
> The issue is still present for me as of (git describe) 5.1.0-526-g3c154253b.

Ha I think I know why. Do you have Jedi installed ? 

Resolving patch:
diff --git a/IPython/terminal/ptutils.py b/IPython/terminal/ptutils.py
--- a/IPython/terminal/ptutils.py
+++ b/IPython/terminal/ptutils.py
@@ -11,7 +11,7 @@
 from wcwidth import wcwidth
 
 from IPython.core.completer import (
-    IPCompleter, provisionalcompleter, rectify_completions, cursor_to_position,
+    provisionalcompleter, cursor_to_position,
     _deduplicate_completions)
 from prompt_toolkit.completion import Completer, Completion
 from prompt_toolkit.layout.lexers import Lexer
@@ -21,6 +21,23 @@
 
 _completion_sentinel = object()
 
+def _elide(string, *, min_elide=30):
+    """
+    If a string is long enough, and has at least 2 dots,
+    replace the middle part with ellipses.
+
+    For example:
+    """
+    if len(string) < min_elide:
+        return string
+
+    parts = string.split('.')
+
+    if len(parts) <= 3:
+        return string
+
+    return '{}.{}\N{HORIZONTAL ELLIPSIS}{}.{}'.format(parts[0], parts[1][0], parts[-2][-1], parts[-1])
+
 
 
 
@@ -90,7 +107,12 @@ def _get_completions(body, offset, cursor_position, ipyc):
             # meta_text = ''
             # yield Completion(m, start_position=start_pos,
             #                  display_meta=meta_text)
-            yield Completion(c.text, start_position=c.start - offset, display_meta=c.type)
+            display_text = c.text
+
+            if c.type == 'function':
+                display_text = display_text + '()'
+
+            yield Completion(c.text, start_position=c.start - offset, display=_elide(display_text), display_meta=c.type)
 
 class IPythonPTLexer(Lexer):
     """


Test patch:
Repository: ipython/ipython

Issue:
Document \latex and \unicode completions
cf comment https://github.com/ipython/ipython/pull/6380#issuecomment-242601680



Discussion:
Marking as 6.0 as then we can assume python 3, and that this kind of completion is available.

Note that this still conflicts with the use of \ as path delimiter on Windows (https://github.com/ipython/ipython/issues/8364#issuecomment-96768318), so I'd appreciate if it was togglable (I use vi-mode digraphs for inputting unicode, so I don't need these completions anyways).

Resolving patch:
diff --git a/IPython/core/completer.py b/IPython/core/completer.py
--- a/IPython/core/completer.py
+++ b/IPython/core/completer.py
@@ -9,6 +9,60 @@
 for normal classic Python code, as well as completer for IPython specific
 Syntax like magics.
 
+Latex and Unicode completion
+============================
+
+IPython and compatible frontends not only can complete your code, but can help
+you to input a wide range of characters. In particular we allow you to insert
+a unicode character using the tab completion mechanism.
+
+Forward latex/unicode completion
+--------------------------------
+
+Forward completion allows you to easily type a unicode character using its latex
+name, or unicode long description. To do so type a backslash follow by the
+relevant name and press tab:
+
+
+Using latex completion:
+
+.. code::
+
+    \\alpha<tab>
+    α
+
+or using unicode completion:
+
+
+.. code::
+
+    \\greek small letter alpha<tab>
+    α
+
+
+Only valid Python identifiers will complete. Combining characters (like arrow or
+dots) are also available, unlike latex they need to be put after the their
+counterpart that is to say, `F\\\\vec<tab>` is correct, not `\\\\vec<tab>F`.
+
+Some browsers are known to display combining characters incorrectly.
+
+Backward latex completion
+-------------------------
+
+It is sometime challenging to know how to type a character, if you are using
+IPython, or any compatible frontend you can prepend backslash to the character
+and press `<tab>` to expand it to its latex form.
+
+.. code::
+
+    \\α<tab>
+    \\alpha
+
+
+Both forward and backward completions can be deactivated by setting the
+``Completer.backslash_combining_completions`` option to ``False``.
+
+
 Experimental
 ============
 


Test patch:
Repository: ipython/ipython

Issue:
No import for `IPython.display.Video`?
There is a [`Video` class](https://github.com/ipython/ipython/blob/master/IPython/core/display.py#L1027) but it's not exported: https://github.com/ipython/ipython/blob/master/IPython/core/display.py#L24-L29


Discussion:

Resolving patch:
diff --git a/IPython/core/display.py b/IPython/core/display.py
--- a/IPython/core/display.py
+++ b/IPython/core/display.py
@@ -26,7 +26,7 @@
 'display_javascript', 'display_pdf', 'DisplayObject', 'TextDisplayObject',
 'Pretty', 'HTML', 'Markdown', 'Math', 'Latex', 'SVG', 'JSON', 'GeoJSON', 'Javascript',
 'Image', 'clear_output', 'set_matplotlib_formats', 'set_matplotlib_close',
-'publish_display_data', 'update_display', 'DisplayHandle']
+'publish_display_data', 'update_display', 'DisplayHandle', 'Video']
 
 #-----------------------------------------------------------------------------
 # utility functions
@@ -669,16 +669,16 @@ def _data_and_metadata(self):
     def _repr_json_(self):
         return self._data_and_metadata()
 
-css_t = """$("head").append($("<link/>").attr({
+_css_t = """$("head").append($("<link/>").attr({
   rel:  "stylesheet",
   type: "text/css",
   href: "%s"
 }));
 """
 
-lib_t1 = """$.getScript("%s", function () {
+_lib_t1 = """$.getScript("%s", function () {
 """
-lib_t2 = """});
+_lib_t2 = """});
 """
 
 class GeoJSON(JSON):
@@ -802,11 +802,11 @@ def __init__(self, data=None, url=None, filename=None, lib=None, css=None):
     def _repr_javascript_(self):
         r = ''
         for c in self.css:
-            r += css_t % c
+            r += _css_t % c
         for l in self.lib:
-            r += lib_t1 % l
+            r += _lib_t1 % l
         r += self.data
-        r += lib_t2*len(self.lib)
+        r += _lib_t2*len(self.lib)
         return r
 
 # constants for identifying png/jpeg data


Test patch:
Repository: ipython/ipython

Issue:
autoreload of __mp_main__ failed when running script
This is a continuation of #8564.  After modifying a script, re-running it produces the following error:
```python
In [2]: run foo
[autoreload of __mp_main__ failed: Traceback (most recent call last):
  File "/home/luke/software/python/miniconda/envs/nsp2/lib/python3.6/site-packages/IPython/extensions/autoreload.py", line 247, in check
    superreload(m, reload, self.old_objects)
AttributeError: module has no attribute '__name__'
]
```
This occurs when using both `%autoreload 2` and `c.InteractiveShell.deep_reload = True`.

The merged fix, #8568, hasn't improved the issue for me.  I've had a local workaround for a while:  see my comment [here](https://github.com/ipython/ipython/issues/8564#issuecomment-150321942).  I'll submit a pull request shortly.

System information:
```
python -c "import IPython; print(IPython.sys_info())"

{'commit_hash': '5a894b9',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/home/luke/software/python/miniconda/envs/nsp2/lib/python3.6/site-packages/IPython',
 'ipython_version': '5.3.0',
 'os_name': 'posix',
 'platform': 'Linux-4.8.0-34-generic-x86_64-with-debian-stretch-sid',
 'sys_executable': '/home/luke/software/python/miniconda/envs/nsp2/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, '
                '12:22:00) \n'
                '[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]'}
```



Discussion:

Resolving patch:
diff --git a/IPython/extensions/autoreload.py b/IPython/extensions/autoreload.py
--- a/IPython/extensions/autoreload.py
+++ b/IPython/extensions/autoreload.py
@@ -185,8 +185,8 @@ def filename_and_mtime(self, module):
         if not hasattr(module, '__file__') or module.__file__ is None:
             return None, None
 
-        if getattr(module, '__name__', None) == '__main__':
-            # we cannot reload(__main__)
+        if getattr(module, '__name__', None) in ['__mp_main__', '__main__']:
+            # we cannot reload(__main__) or reload(__mp_main__)
             return None, None
 
         filename = module.__file__


Test patch:
Repository: ipython/ipython

Issue:
Aliases not documented
We have a page documenting magic functions now, but nothing describing the available aliases.

From discussion on #8762



Discussion:
Not sure I understand. There is the magic page as linked in #8762 ([link to docs](https://ipython.readthedocs.org/en/stable/interactive/magics.html)), which describes the available magics. What exactly is what is missing now?

Sorry, it should have said 'nothing describing the available _aliases_'. Run `%alias` in IPython for a list of aliases in use on your system.

@takluyver Where should we document the available aliases? In https://ipython.readthedocs.io/en/stable/interactive/magics.html or in http://ipython.readthedocs.io/en/stable/api/generated/IPython.core.alias.html?

Resolving patch:
diff --git a/IPython/core/magics/osm.py b/IPython/core/magics/osm.py
--- a/IPython/core/magics/osm.py
+++ b/IPython/core/magics/osm.py
@@ -81,11 +81,21 @@ def alias(self, parameter_s=''):
           In [9]: show $$PATH
           /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
 
-        You can use the alias facility to acess all of $PATH.  See the %rehashx
+        You can use the alias facility to access all of $PATH.  See the %rehashx
         function, which automatically creates aliases for the contents of your
         $PATH.
 
-        If called with no parameters, %alias prints the current alias table."""
+        If called with no parameters, %alias prints the current alias table
+        for your system.  For posix systems, the default aliases are 'cat',
+        'cp', 'mv', 'rm', 'rmdir', and 'mkdir', and other platform-specific
+        aliases are added.  For windows-based systems, the default aliases are
+        'copy', 'ddir', 'echo', 'ls', 'ldir', 'mkdir', 'ren', and 'rmdir'.
+
+        You can see the definition of alias by adding a question mark in the
+        end::
+
+          In [1]: cat?
+          Repr: <alias cat for 'cat'>"""
 
         par = parameter_s.strip()
         if not par:


Test patch:
Repository: ipython/ipython

Issue:
Sort and uniq available objects for config
```
In [1]: config
Available objects for config:
     TerminalInteractiveShell
     HistoryManager
     PrefilterManager
     IPCompleter
     DisplayFormatter
     MagicsManager
     ScriptMagics
     AliasManager
     TerminalIPythonApp
     StoreMagics
     StoreMagics
```

The result is not sorted, and StoreMagics shows up twice.


Discussion:

Resolving patch:
diff --git a/IPython/core/magics/config.py b/IPython/core/magics/config.py
--- a/IPython/core/magics/config.py
+++ b/IPython/core/magics/config.py
@@ -108,8 +108,9 @@ def config(self, s):
         # some IPython objects are Configurable, but do not yet have
         # any configurable traits.  Exclude them from the effects of
         # this magic, as their presence is just noise:
-        configurables = [ c for c in self.shell.configurables
-                          if c.__class__.class_traits(config=True) ]
+        configurables = sorted(set([ c for c in self.shell.configurables
+                                     if c.__class__.class_traits(config=True)
+                                     ]), key=lambda x: x.__class__.__name__)
         classnames = [ c.__class__.__name__ for c in configurables ]
 
         line = s.strip()


Test patch:
diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py
--- a/IPython/core/tests/test_magic.py
+++ b/IPython/core/tests/test_magic.py
@@ -80,6 +80,24 @@ def test_config():
     ## should not raise.
     _ip.magic('config')
 
+def test_config_available_configs():
+    """ test that config magic prints available configs in unique and
+    sorted order. """
+    with capture_output() as captured:
+        _ip.magic('config')
+
+    stdout = captured.stdout
+    config_classes = stdout.strip().split('\n')[1:]
+    nt.assert_list_equal(config_classes, sorted(set(config_classes)))
+
+def test_config_print_class():
+    """ test that config with a classname prints the class's options. """
+    with capture_output() as captured:
+        _ip.magic('config TerminalInteractiveShell')
+
+    stdout = captured.stdout
+    nt.assert_in("TerminalInteractiveShell options", stdout)
+
 def test_rehashx():
     # clear up everything
     _ip.alias_manager.clear_aliases()
Repository: ipython/ipython

Issue:
No module named sphinx.util.compat error using `IPython.sphinxext` with Sphinx pre1.7 master branch
Trying out `IPython.sphinxext` 6.1.0 with ``Sphinx==1.7.dev20170617`` I get the following error on a Sphinx project:

```
Extension error:
Could not import extension IPython.sphinxext.ipython_directive (exception: No module named 'sphinx.util.compat')
```

Indeed, the `sphinx.util.compat` is deprecated at 1.6 and will be [removed at  Sphinx 1.7](https://github.com/sphinx-doc/sphinx/blob/3d5e0c5d7/CHANGES#L45).

To reproduce, in a virtual env with IPython 6.1.0 run

    pip install git+https://github.com/sphinx-doc/sphinx

and then 

```
mkdir /tmp/IPython-test
cd /tmp/IPython-test
yes "n" | sphinx-quickstart --dot _ --project IPython-test --author "Example" -v 0 --release 0 --language en --suffix .rst --master index --makefile --batchfile .
echo '
extensions = [
    "IPython.sphinxext.ipython_directive",
]
' >> conf.py
make html
```




Discussion:
Quoting [Sphinx CHANGES (Deprecated at 1.6b1)](http://www.sphinx-doc.org/en/stable/changes.html#id7): 

> sphinx.util.compat.Directive class is now deprecated. Please use instead docutils.parsers.rst.Directive

Thanks for the heads up. 

You seem to have already dug into what needs to be done, do you want to submit a PR ? 

Resolving patch:
diff --git a/IPython/sphinxext/ipython_directive.py b/IPython/sphinxext/ipython_directive.py
--- a/IPython/sphinxext/ipython_directive.py
+++ b/IPython/sphinxext/ipython_directive.py
@@ -138,7 +138,7 @@
 
 # Third-party
 from docutils.parsers.rst import directives
-from sphinx.util.compat import Directive
+from docutils.parsers.rst import Directive
 
 # Our own
 from traitlets.config import Config


Test patch:
Repository: ipython/ipython

Issue:
No module named sphinx.util.compat error using `IPython.sphinxext` with Sphinx pre1.7 master branch
Trying out `IPython.sphinxext` 6.1.0 with ``Sphinx==1.7.dev20170617`` I get the following error on a Sphinx project:

```
Extension error:
Could not import extension IPython.sphinxext.ipython_directive (exception: No module named 'sphinx.util.compat')
```

Indeed, the `sphinx.util.compat` is deprecated at 1.6 and will be [removed at  Sphinx 1.7](https://github.com/sphinx-doc/sphinx/blob/3d5e0c5d7/CHANGES#L45).

To reproduce, in a virtual env with IPython 6.1.0 run

    pip install git+https://github.com/sphinx-doc/sphinx

and then 

```
mkdir /tmp/IPython-test
cd /tmp/IPython-test
yes "n" | sphinx-quickstart --dot _ --project IPython-test --author "Example" -v 0 --release 0 --language en --suffix .rst --master index --makefile --batchfile .
echo '
extensions = [
    "IPython.sphinxext.ipython_directive",
]
' >> conf.py
make html
```




Discussion:
Quoting [Sphinx CHANGES (Deprecated at 1.6b1)](http://www.sphinx-doc.org/en/stable/changes.html#id7): 

> sphinx.util.compat.Directive class is now deprecated. Please use instead docutils.parsers.rst.Directive

Thanks for the heads up. 

You seem to have already dug into what needs to be done, do you want to submit a PR ? 
Done at #10668.

Resolving patch:
diff --git a/IPython/sphinxext/ipython_directive.py b/IPython/sphinxext/ipython_directive.py
--- a/IPython/sphinxext/ipython_directive.py
+++ b/IPython/sphinxext/ipython_directive.py
@@ -139,7 +139,7 @@
 
 # Third-party
 from docutils.parsers.rst import directives
-from sphinx.util.compat import Directive
+from docutils.parsers.rst import Directive
 
 # Our own
 from traitlets.config import Config


Test patch:
Repository: ipython/ipython

Issue:
ipython does not work with python compiled with openssl in fips mode. 
in fips mode, md5 is disabled. hence, ipython fails with 

```
    hash_digest = hashlib.md5(code.encode("utf-8")).hexdigest()
ValueError: error:060800A3:digital envelope routines:EVP_DigestInit_ex:disabled for fips
```
this error.

A fix is changing md5 to sha256 in `IPython/core/compilerop.py` [in this line](https://github.com/ipython/ipython/blob/master/IPython/core/compilerop.py#L58). I can raise a pull request if the change looks fine. 


Discussion:
Sounds OK to me, go ahead and make a PR :-)
As best I can tell, sha1 is supported in FIPS mode, if that's true, let's use that, instead. We're not using this for a cryptographically secure purpose, and  sha256 is a bit slower, and generates a much longer string, most of which we will throw away, anyway - since we take only the first 12 characters.

Also, although it is used in a deprecated function, for now, md5 is also imported in  IPython/utils/path.py. I created a bug to remove it for some future first time contributor.
Why not "Just" `hex(abs(hash("""this is a string """)))` if it's not cryptographically secure ?

Edit: (`abs` because python can give you a negative hex number prefixed with `-`)
`hex(abs(hash()))` may give you a shorter string if hash() happens to return a number close to 0. That may not be a problem, but it might mean that e.g. regexes looking for 12 hex characters don't work.
Ad, but we can pad to 12 with 0s then. 

Resolving patch:
diff --git a/IPython/core/compilerop.py b/IPython/core/compilerop.py
--- a/IPython/core/compilerop.py
+++ b/IPython/core/compilerop.py
@@ -55,7 +55,7 @@ def code_name(code, number=0):
     
     This now expects code to be unicode.
     """
-    hash_digest = hashlib.md5(code.encode("utf-8")).hexdigest()
+    hash_digest = hashlib.sha1(code.encode("utf-8")).hexdigest()
     # Include the number and 12 characters of the hash in the name.  It's
     # pretty much impossible that in a single session we'll have collisions
     # even with truncated hashes, and the full one makes tracebacks too long


Test patch:
Repository: ipython/ipython

Issue:
difference in source highlighting between 5.3 and 6.0rc1 using %colors Linux
The following screenshot shows the difference in source highlighting between the two versions of IPython (note the difference in version between left and right):
![screenshot_20170419_152049](https://cloud.githubusercontent.com/assets/1322974/25204791/086a794c-2514-11e7-9e8f-8bb94a6bad86.png)
The "null" profile is just an empty, freshly created profile.

Arch Linux, pip-installed ipython.



Discussion:

Resolving patch:
diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py
--- a/IPython/core/interactiveshell.py
+++ b/IPython/core/interactiveshell.py
@@ -635,7 +635,8 @@ def init_builtins(self):
 
         self.builtin_trap = BuiltinTrap(shell=self)
 
-    def init_inspector(self):
+    @observe('colors')
+    def init_inspector(self, changes=None):
         # Object inspector
         self.inspector = oinspect.Inspector(oinspect.InspectColors,
                                             PyColorize.ANSICodeColors,


Test patch: