diff --git a/IPython/__init__.py b/IPython/__init__.py index e12da90..7ebb80b 100644 --- a/IPython/__init__.py +++ b/IPython/__init__.py @@ -28,7 +28,7 @@ import sys # 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. @@ -40,7 +40,8 @@ See IPython `README.rst` file for more information: https://github.com/ipython/ipython/blob/master/README.rst -""") +""" + ) #----------------------------------------------------------------------------- # Setup the top level names diff --git a/IPython/core/autocall.py b/IPython/core/autocall.py index 5f7720b..54beec3 100644 --- a/IPython/core/autocall.py +++ b/IPython/core/autocall.py @@ -40,7 +40,7 @@ class IPyAutocall(object): 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. diff --git a/IPython/core/completer.py b/IPython/core/completer.py index cdd28f6..59d3e99 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -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, diff --git a/IPython/core/history.py b/IPython/core/history.py index 41a0433..579f603 100644 --- a/IPython/core/history.py +++ b/IPython/core/history.py @@ -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( diff --git a/IPython/core/magics/execution.py b/IPython/core/magics/execution.py index 371da5b..da7f780 100644 --- a/IPython/core/magics/execution.py +++ b/IPython/core/magics/execution.py @@ -511,7 +511,7 @@ class ExecutionMagics(Magics): """Run the named file inside IPython as a program. Usage:: - + %run [-n -i -e -G] [( -t [-N] | -d [-b] | -p [profile options] )] ( -m mod | filename ) [args] @@ -552,7 +552,7 @@ class ExecutionMagics(Magics): *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: diff --git a/IPython/core/magics/script.py b/IPython/core/magics/script.py index a0028c2..9fd2fc6 100644 --- a/IPython/core/magics/script.py +++ b/IPython/core/magics/script.py @@ -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) diff --git a/IPython/core/tests/test_inputtransformer2.py b/IPython/core/tests/test_inputtransformer2.py index 0613dc0..cddb32f 100644 --- a/IPython/core/tests/test_inputtransformer2.py +++ b/IPython/core/tests/test_inputtransformer2.py @@ -87,7 +87,8 @@ g() ##### -MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT = ("""\ +MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT = ( + """\ def test(): for i in range(1): print(i) diff --git a/IPython/core/tests/test_interactiveshell.py b/IPython/core/tests/test_interactiveshell.py index 10cce1f..10827b5 100644 --- a/IPython/core/tests/test_interactiveshell.py +++ b/IPython/core/tests/test_interactiveshell.py @@ -547,7 +547,7 @@ class TestSafeExecfileNonAsciiPath(unittest.TestCase): 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() diff --git a/IPython/core/tests/test_iplib.py b/IPython/core/tests/test_iplib.py index 94ce518..ec7007e 100644 --- a/IPython/core/tests/test_iplib.py +++ b/IPython/core/tests/test_iplib.py @@ -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) diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index b46a9e8..850e227 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -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" diff --git a/IPython/core/tests/test_magic_terminal.py b/IPython/core/tests/test_magic_terminal.py index f090147..5dfa0f0 100644 --- a/IPython/core/tests/test_magic_terminal.py +++ b/IPython/core/tests/test_magic_terminal.py @@ -122,7 +122,8 @@ class PasteTestCase(TestCase): ip.user_ns.pop("x") def test_paste_py_multi(self): - self.paste(""" + self.paste( + """ >>> x = [1,2,3] >>> y = [] >>> for i in x: @@ -145,7 +146,8 @@ class PasteTestCase(TestCase): 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)""" @@ -154,7 +156,8 @@ class PasteTestCase(TestCase): 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) """ @@ -163,7 +166,8 @@ class PasteTestCase(TestCase): def test_paste_email_py(self): "Email quoting of interactive input" - self.paste("""\ + self.paste( + """\ >> >>> def f(x): >> ... return x+1 >> ... diff --git a/IPython/core/tests/test_profile.py b/IPython/core/tests/test_profile.py index a0de2f2..876c7fd 100644 --- a/IPython/core/tests/test_profile.py +++ b/IPython/core/tests/test_profile.py @@ -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") diff --git a/IPython/external/qt_loaders.py b/IPython/external/qt_loaders.py index 975855c..39ea298 100644 --- a/IPython/external/qt_loaders.py +++ b/IPython/external/qt_loaders.py @@ -66,7 +66,9 @@ class ImportDenier(importlib.abc.MetaPathFinder): """ Importing %s disabled by IPython, which has already imported an Incompatible QT Binding: %s - """ % (fullname, loaded_api())) + """ + % (fullname, loaded_api()) + ) ID = ImportDenier() diff --git a/IPython/lib/display.py b/IPython/lib/display.py index 4481683..5ff2983 100644 --- a/IPython/lib/display.py +++ b/IPython/lib/display.py @@ -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' @@ -510,12 +510,10 @@ class FileLinks(FileLink): 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 diff --git a/IPython/lib/tests/test_latextools.py b/IPython/lib/tests/test_latextools.py index ead73ab..d035752 100644 --- a/IPython/lib/tests/test_latextools.py +++ b/IPython/lib/tests/test_latextools.py @@ -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. diff --git a/IPython/lib/tests/test_pretty.py b/IPython/lib/tests/test_pretty.py index ca16924..8608516 100644 --- a/IPython/lib/tests/test_pretty.py +++ b/IPython/lib/tests/test_pretty.py @@ -273,7 +273,7 @@ def test_unicode_repr(): p = pretty.pretty(c) assert p == u p = pretty.pretty([c]) - assert p == u"[%s]" % u + assert p == "[%s]" % u def test_basic_class(): diff --git a/IPython/testing/plugin/dtexample.py b/IPython/testing/plugin/dtexample.py index 119e0a0..68f7016 100644 --- a/IPython/testing/plugin/dtexample.py +++ b/IPython/testing/plugin/dtexample.py @@ -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 @@ -50,7 +50,7 @@ def ipfunc(): In [8]: print(repr(_)) 'hi' - + In [7]: 3+4 Out[7]: 7 @@ -60,7 +60,7 @@ def ipfunc(): In [9]: ipfunc() Out[9]: 'ipfunc' """ - return 'ipfunc' + return "ipfunc" def ipos(): diff --git a/IPython/utils/text.py b/IPython/utils/text.py index ef75f93..74bccdd 100644 --- a/IPython/utils/text.py +++ b/IPython/utils/text.py @@ -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. @@ -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 ---------- diff --git a/docs/source/config/integrating.rst b/docs/source/config/integrating.rst index a045968..07429ef 100644 --- a/docs/source/config/integrating.rst +++ b/docs/source/config/integrating.rst @@ -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 diff --git a/docs/source/index.rst b/docs/source/index.rst index 9cec057..ebef06f 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -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 `_ kernel to work with Python code in Jupyter diff --git a/docs/source/whatsnew/github-stats-0.11.rst b/docs/source/whatsnew/github-stats-0.11.rst index 2f647ce..8fd4680 100644 --- a/docs/source/whatsnew/github-stats-0.11.rst +++ b/docs/source/whatsnew/github-stats-0.11.rst @@ -51,9 +51,9 @@ Pull requests (226): * `542 `_: issue 440 * `533 `_: Remove unused configobj and validate libraries from externals. * `538 `_: fix various tests on Windows -* `540 `_: support `-pylab` flag with deprecation warning +* `540 `_: support ``-pylab`` flag with deprecation warning * `537 `_: Docs update -* `536 `_: `setup.py install` depends on setuptools on Windows +* `536 `_: ``setup.py install`` depends on setuptools on Windows * `480 `_: Get help mid-command * `462 `_: Str and Bytes traitlets * `534 `_: Handle unicode properly in IPython.zmq.iostream diff --git a/docs/source/whatsnew/github-stats-2.0.rst b/docs/source/whatsnew/github-stats-2.0.rst index 5033994..98e3d5e 100644 --- a/docs/source/whatsnew/github-stats-2.0.rst +++ b/docs/source/whatsnew/github-stats-2.0.rst @@ -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 @@ -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 diff --git a/docs/source/whatsnew/version0.9.rst b/docs/source/whatsnew/version0.9.rst index 81ebba1..8d5f73c 100644 --- a/docs/source/whatsnew/version0.9.rst +++ b/docs/source/whatsnew/version0.9.rst @@ -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. @@ -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. diff --git a/docs/source/whatsnew/version8.rst b/docs/source/whatsnew/version8.rst index 6ad4da1..b88dfb4 100644 --- a/docs/source/whatsnew/version8.rst +++ b/docs/source/whatsnew/version8.rst @@ -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 @@ -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 @@ -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 ``__ +You can find all relevant issues and PRs with `the SDG 2021 tag `__ Removing support for older Python versions ------------------------------------------ diff --git a/pytest.ini b/pytest.ini index e0cfec0..81511e9 100644 --- a/pytest.ini +++ b/pytest.ini @@ -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 diff --git a/setup.py b/setup.py index 5614d3e..fbaa5f6 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,9 @@ See IPython `README.rst` file for more information: 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)