Skip to content

Commit

Permalink
Merge branch 'master' into fix-mix-history
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Apr 29, 2022
2 parents 15e5d96 + c97f6d2 commit 33426a2
Show file tree
Hide file tree
Showing 26 changed files with 63 additions and 54 deletions.
5 changes: 3 additions & 2 deletions IPython/__init__.py
Expand Up @@ -28,7 +28,7 @@
# Don't forget to also update setup.py when this changes!
if sys.version_info < (3, 8):
raise ImportError(
"""
"""
IPython 8+ supports Python 3.8 and above, following NEP 29.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Python 3.3 and 3.4 were supported up to IPython 6.x.
Expand All @@ -40,7 +40,8 @@
https://github.com/ipython/ipython/blob/master/README.rst
""")
"""
)

#-----------------------------------------------------------------------------
# Setup the top level names
Expand Down
2 changes: 1 addition & 1 deletion IPython/core/autocall.py
Expand Up @@ -40,7 +40,7 @@ def __init__(self, ip=None):
self._ip = ip

def set_ip(self, ip):
""" Will be used to set _ip point to current ipython instance b/f call
"""Will be used to set _ip point to current ipython instance b/f call
Override this method if you don't want this to happen.
Expand Down
2 changes: 1 addition & 1 deletion IPython/core/completer.py
Expand Up @@ -589,7 +589,7 @@ class Completer(Configurable):
This will enable completion on elements of lists, results of function calls, etc.,
but can be unsafe because the code is actually evaluated on TAB.
"""
""",
).tag(config=True)

use_jedi = Bool(default_value=JEDI_INSTALLED,
Expand Down
2 changes: 1 addition & 1 deletion IPython/core/history.py
Expand Up @@ -166,7 +166,7 @@ class HistoryAccessor(HistoryAccessorBase):
in which case there will be no stored history, no SQLite connection,
and no background saving thread. This may be necessary in some
threaded environments where IPython is embedded.
"""
""",
).tag(config=True)

connection_options = Dict(
Expand Down
4 changes: 2 additions & 2 deletions IPython/core/magics/execution.py
Expand Up @@ -511,7 +511,7 @@ def run(self, parameter_s='', runner=None,
"""Run the named file inside IPython as a program.
Usage::
%run [-n -i -e -G]
[( -t [-N<N>] | -d [-b<N>] | -p [profile options] )]
( -m mod | filename ) [args]
Expand Down Expand Up @@ -552,7 +552,7 @@ def run(self, parameter_s='', runner=None,
*two* back slashes (e.g. ``\\\\*``) to suppress expansions.
To completely disable these expansions, you can use -G flag.
On Windows systems, the use of single quotes `'` when specifying
On Windows systems, the use of single quotes `'` when specifying
a file is not supported. Use double quotes `"`.
Options:
Expand Down
4 changes: 2 additions & 2 deletions IPython/core/magics/script.py
Expand Up @@ -58,8 +58,8 @@ def script_args(f):
'--no-raise-error', action="store_false", dest='raise_error',
help="""Whether you should raise an error message in addition to
a stream on stderr if you get a nonzero exit code.
"""
)
""",
),
]
for arg in args:
f = arg(f)
Expand Down
3 changes: 2 additions & 1 deletion IPython/core/tests/test_inputtransformer2.py
Expand Up @@ -87,7 +87,8 @@

#####

MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT = ("""\
MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT = (
"""\
def test():
for i in range(1):
print(i)
Expand Down
2 changes: 1 addition & 1 deletion IPython/core/tests/test_interactiveshell.py
Expand Up @@ -547,7 +547,7 @@ def setUp(self):
self.TESTDIR = join(self.BASETESTDIR, u"åäö")
os.mkdir(self.TESTDIR)
with open(
join(self.TESTDIR, u"åäötestscript.py"), "w", encoding="utf-8"
join(self.TESTDIR, "åäötestscript.py"), "w", encoding="utf-8"
) as sfile:
sfile.write("pass\n")
self.oldpath = os.getcwd()
Expand Down
3 changes: 2 additions & 1 deletion IPython/core/tests/test_iplib.py
Expand Up @@ -236,7 +236,8 @@ def test_run_cell():
if 4:
print "bar"
""")
"""
)
# Simply verifies that this kind of input is run
ip.run_cell(complex)

Expand Down
4 changes: 3 additions & 1 deletion IPython/core/tests/test_magic.py
Expand Up @@ -448,7 +448,9 @@ def test_multiline_time():
ip = get_ipython()
ip.user_ns.pop('run', None)

ip.run_cell(dedent("""\
ip.run_cell(
dedent(
"""\
%%time
a = "ho"
b = "hey"
Expand Down
12 changes: 8 additions & 4 deletions IPython/core/tests/test_magic_terminal.py
Expand Up @@ -122,7 +122,8 @@ def test_paste_pyprompt(self):
ip.user_ns.pop("x")

def test_paste_py_multi(self):
self.paste("""
self.paste(
"""
>>> x = [1,2,3]
>>> y = []
>>> for i in x:
Expand All @@ -145,7 +146,8 @@ def test_paste_py_multi_r(self):

def test_paste_email(self):
"Test pasting of email-quoted contents"
self.paste("""\
self.paste(
"""\
>> def foo(x):
>> return x + 1
>> xx = foo(1.1)"""
Expand All @@ -154,7 +156,8 @@ def test_paste_email(self):

def test_paste_email2(self):
"Email again; some programs add a space also at each quoting level"
self.paste("""\
self.paste(
"""\
> > def foo(x):
> > return x + 1
> > yy = foo(2.1) """
Expand All @@ -163,7 +166,8 @@ def test_paste_email2(self):

def test_paste_email_py(self):
"Email quoting of interactive input"
self.paste("""\
self.paste(
"""\
>> >>> def f(x):
>> ... return x+1
>> ...
Expand Down
2 changes: 1 addition & 1 deletion IPython/core/tests/test_profile.py
Expand Up @@ -108,7 +108,7 @@ def test_list_profiles_in():
for name in ("profile_foo", "profile_hello", "not_a_profile"):
Path(td / name).mkdir(parents=True)
if dec.unicode_paths:
Path(td / u"profile_ünicode").mkdir(parents=True)
Path(td / "profile_ünicode").mkdir(parents=True)

with open(td / "profile_file", "w", encoding="utf-8") as f:
f.write("I am not a profile directory")
Expand Down
4 changes: 3 additions & 1 deletion IPython/external/qt_loaders.py
Expand Up @@ -66,7 +66,9 @@ def find_spec(self, fullname, path, target=None):
"""
Importing %s disabled by IPython, which has
already imported an Incompatible QT Binding: %s
""" % (fullname, loaded_api()))
"""
% (fullname, loaded_api())
)


ID = ImportDenier()
Expand Down
16 changes: 7 additions & 9 deletions IPython/lib/display.py
Expand Up @@ -103,9 +103,9 @@ class Audio(DisplayObject):
See Also
--------
ipywidgets.Audio
AUdio widget with more more flexibility and options.
Audio widget with more more flexibility and options.
"""
_read_flags = 'rb'

Expand Down Expand Up @@ -510,12 +510,10 @@ def __init__(self,

self.recursive = recursive

def _get_display_formatter(self,
dirname_output_format,
fname_output_format,
fp_format,
fp_cleaner=None):
""" generate built-in formatter function
def _get_display_formatter(
self, dirname_output_format, fname_output_format, fp_format, fp_cleaner=None
):
"""generate built-in formatter function
this is used to define both the notebook and terminal built-in
formatters as they only differ by some wrapper text for each entry
Expand Down
2 changes: 1 addition & 1 deletion IPython/lib/tests/test_latextools.py
Expand Up @@ -31,7 +31,7 @@ def no_op(*args, **kwargs):


@onlyif_cmds_exist("latex", "dvipng")
@pytest.mark.parametrize("s, wrap", [(u"$$x^2$$", False), (u"x^2", True)])
@pytest.mark.parametrize("s, wrap", [("$$x^2$$", False), ("x^2", True)])
def test_latex_to_png_dvipng_runs(s, wrap):
"""
Test that latex_to_png_dvipng just runs without error.
Expand Down
2 changes: 1 addition & 1 deletion IPython/lib/tests/test_pretty.py
Expand Up @@ -273,7 +273,7 @@ def __repr__(self):
p = pretty.pretty(c)
assert p == u
p = pretty.pretty([c])
assert p == u"[%s]" % u
assert p == "[%s]" % u


def test_basic_class():
Expand Down
6 changes: 3 additions & 3 deletions IPython/testing/plugin/dtexample.py
Expand Up @@ -38,7 +38,7 @@ def ipfunc():
....: print(i, end=' ')
....: print(i+1, end=' ')
....:
0 1 1 2 2 3
0 1 1 2 2 3
It's OK to use '_' for the last result, but do NOT try to use IPython's
Expand All @@ -50,7 +50,7 @@ def ipfunc():
In [8]: print(repr(_))
'hi'
In [7]: 3+4
Out[7]: 7
Expand All @@ -60,7 +60,7 @@ def ipfunc():
In [9]: ipfunc()
Out[9]: 'ipfunc'
"""
return 'ipfunc'
return "ipfunc"


def ipos():
Expand Down
8 changes: 4 additions & 4 deletions IPython/utils/text.py
Expand Up @@ -470,11 +470,11 @@ def strip_ansi(source):

class EvalFormatter(Formatter):
"""A String Formatter that allows evaluation of simple expressions.
Note that this version interprets a `:` as specifying a format string (as per
standard string formatting), so if slicing is required, you must explicitly
create a slice.
This is to be used in templating cases, such as the parallel batch
script templates, where simple arithmetic on arguments is useful.
Expand Down Expand Up @@ -690,8 +690,8 @@ def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :
return ([[_get_or_default(items, c * nrow + r, default=empty) for c in range(ncol)] for r in range(nrow)], info)


def columnize(items, row_first=False, separator=' ', displaywidth=80, spread=False):
""" Transform a list of strings into a single string with columns.
def columnize(items, row_first=False, separator=" ", displaywidth=80, spread=False):
"""Transform a list of strings into a single string with columns.
Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/config/integrating.rst
Expand Up @@ -135,7 +135,7 @@ Metadata
^^^^^^^^

We often want to provide frontends with guidance on how to display the data. To
support this, ``_repr_*_()`` methods (except `_repr_pretty_``?) can also return a ``(data, metadata)``
support this, ``_repr_*_()`` methods (except ``_repr_pretty_``?) can also return a ``(data, metadata)``
tuple where ``metadata`` is a dictionary containing arbitrary key-value pairs for
the frontend to interpret. An example use case is ``_repr_jpeg_()``, which can
be set to return a jpeg image and a ``{'height': 400, 'width': 600}`` dictionary
Expand Down
6 changes: 3 additions & 3 deletions docs/source/index.rst
Expand Up @@ -17,9 +17,9 @@ interactively. Its main components are:
* A powerful interactive Python shell.


.. image:: ./_images/ipython-6-screenshot.png
:alt: Screenshot of IPython 6.0
:align: center
.. image:: ./_images/ipython-6-screenshot.png
:alt: Screenshot of IPython 6.0
:align: center


* A `Jupyter <https://jupyter.org/>`_ kernel to work with Python code in Jupyter
Expand Down
4 changes: 2 additions & 2 deletions docs/source/whatsnew/github-stats-0.11.rst
Expand Up @@ -51,9 +51,9 @@ Pull requests (226):
* `542 <https://github.com/ipython/ipython/issues/542>`_: issue 440
* `533 <https://github.com/ipython/ipython/issues/533>`_: Remove unused configobj and validate libraries from externals.
* `538 <https://github.com/ipython/ipython/issues/538>`_: fix various tests on Windows
* `540 <https://github.com/ipython/ipython/issues/540>`_: support `-pylab` flag with deprecation warning
* `540 <https://github.com/ipython/ipython/issues/540>`_: support ``-pylab`` flag with deprecation warning
* `537 <https://github.com/ipython/ipython/issues/537>`_: Docs update
* `536 <https://github.com/ipython/ipython/issues/536>`_: `setup.py install` depends on setuptools on Windows
* `536 <https://github.com/ipython/ipython/issues/536>`_: ``setup.py install`` depends on setuptools on Windows
* `480 <https://github.com/ipython/ipython/issues/480>`_: Get help mid-command
* `462 <https://github.com/ipython/ipython/issues/462>`_: Str and Bytes traitlets
* `534 <https://github.com/ipython/ipython/issues/534>`_: Handle unicode properly in IPython.zmq.iostream
Expand Down
4 changes: 2 additions & 2 deletions docs/source/whatsnew/github-stats-2.0.rst
Expand Up @@ -916,7 +916,7 @@ Pull Requests (687):
* :ghpull:`4444`: Css cleaning
* :ghpull:`4523`: Use username and password for MongoDB on ShiningPanda
* :ghpull:`4510`: Update whatsnew from PR files
* :ghpull:`4441`: add `setup.py jsversion`
* :ghpull:`4441`: add ``setup.py jsversion``
* :ghpull:`4518`: Fix for race condition in url file decoding.
* :ghpull:`4497`: don't automatically unpack datetime objects in the message spec
* :ghpull:`4506`: wait for empty queues as well as load-balanced tasks
Expand Down Expand Up @@ -1050,7 +1050,7 @@ Pull Requests (687):
* :ghpull:`4214`: engine ID metadata should be unicode, not bytes
* :ghpull:`4232`: no highlight if no language specified
* :ghpull:`4218`: Fix display of SyntaxError when .py file is modified
* :ghpull:`4207`: add `setup.py css` command
* :ghpull:`4207`: add ``setup.py css`` command
* :ghpull:`4224`: clear previous callbacks on execute
* :ghpull:`4180`: Iptest refactoring
* :ghpull:`4105`: JS output area misaligned
Expand Down
4 changes: 2 additions & 2 deletions docs/source/whatsnew/version0.9.rst
Expand Up @@ -81,7 +81,7 @@ New features
:mod:`IPython.kernel`, :mod:`IPython.kernel.core`, :mod:`traitlets.config`,
:mod:`IPython.tools` and :mod:`IPython.testing`.

* As part of merging in the `ipython1-dev` stuff, the `setup.py` script and
* As part of merging in the `ipython1-dev` stuff, the ``setup.py`` script and
friends have been completely refactored. Now we are checking for
dependencies using the approach that matplotlib uses.

Expand Down Expand Up @@ -161,7 +161,7 @@ Backwards incompatible changes
`'basic'` to `'b'`.

* IPython has a larger set of dependencies if you want all of its capabilities.
See the `setup.py` script for details.
See the ``setup.py`` script for details.

* The constructors for :class:`IPython.kernel.client.MultiEngineClient` and
:class:`IPython.kernel.client.TaskClient` no longer take the (ip,port) tuple.
Expand Down
9 changes: 3 additions & 6 deletions docs/source/whatsnew/version8.rst
Expand Up @@ -16,9 +16,6 @@ IPython 8.3.0
- :ghpull:`13600`, ``pre_run_*``-hooks will now have a ``cell_id`` attribute on
the info object when frontend provide it.

- :ghpull:`13624`, fixed :kbd:`End` key being broken after accepting an
autosuggestion.

.. _version 8.2.0:

IPython 8.2.0
Expand Down Expand Up @@ -519,8 +516,8 @@ Automatic Vi prompt stripping

When pasting code into IPython, it will strip the leading prompt characters if
there are any. For example, you can paste the following code into the console -
it will still work, even though each line is prefixed with prompts (`In`,
`Out`)::
it will still work, even though each line is prefixed with prompts (``In``,
``Out``)::

In [1]: 2 * 2 == 4
Out[1]: True
Expand Down Expand Up @@ -615,7 +612,7 @@ who did a fantastic job at updating our code base, migrating to pytest, pushing
our coverage, and fixing a large number of bugs. I highly recommend contacting
them if you need help with C++ and Python projects.

You can find all relevant issues and PRs with the SDG 2021 tag `<https://github.com/ipython/ipython/issues?q=label%3A%22Numfocus+SDG+2021%22+>`__
You can find all relevant issues and PRs with `the SDG 2021 tag <https://github.com/ipython/ipython/issues?q=label%3A%22Numfocus+SDG+2021%22+>`__

Removing support for older Python versions
------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Expand Up @@ -45,3 +45,4 @@ addopts = --durations=10
--ignore=IPython/utils/version.py
doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
ipdoctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
asyncio_mode = strict
4 changes: 3 additions & 1 deletion setup.py
Expand Up @@ -52,7 +52,9 @@
Python {py} detected.
{pip}
""".format(py=sys.version_info, pip=pip_message )
""".format(
py=sys.version_info, pip=pip_message
)

print(error, file=sys.stderr)
sys.exit(1)
Expand Down

0 comments on commit 33426a2

Please sign in to comment.