diff --git a/IPython/__init__.py b/IPython/__init__.py index e12da90d375..7ebb80b3621 100644 --- a/IPython/__init__.py +++ b/IPython/__init__.py @@ -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. @@ -40,7 +40,8 @@ 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 5f7720bb46c..54beec3f58d 100644 --- a/IPython/core/autocall.py +++ b/IPython/core/autocall.py @@ -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. diff --git a/IPython/core/completer.py b/IPython/core/completer.py index cdd28f65687..59d3e9930fc 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 d7f33255a01..478df3d679c 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 371da5b1f98..da7f780b9cb 100644 --- a/IPython/core/magics/execution.py +++ b/IPython/core/magics/execution.py @@ -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] | -d [-b] | -p [profile options] )] ( -m mod | filename ) [args] @@ -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: diff --git a/IPython/core/magics/script.py b/IPython/core/magics/script.py index a0028c25eea..9fd2fc6c0dd 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 0613dc02c93..cddb32f7138 100644 --- a/IPython/core/tests/test_inputtransformer2.py +++ b/IPython/core/tests/test_inputtransformer2.py @@ -87,7 +87,8 @@ ##### -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 10cce1fd646..10827b5fa0f 100644 --- a/IPython/core/tests/test_interactiveshell.py +++ b/IPython/core/tests/test_interactiveshell.py @@ -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() diff --git a/IPython/core/tests/test_iplib.py b/IPython/core/tests/test_iplib.py index 94ce5185865..ec7007e0f2c 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 b46a9e8388c..850e22792b9 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 f09014786e6..5dfa0f0ed65 100644 --- a/IPython/core/tests/test_magic_terminal.py +++ b/IPython/core/tests/test_magic_terminal.py @@ -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: @@ -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)""" @@ -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) """ @@ -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 >> ... diff --git a/IPython/core/tests/test_profile.py b/IPython/core/tests/test_profile.py index a0de2f2d593..876c7fda856 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 975855ca6bc..39ea298460b 100644 --- a/IPython/external/qt_loaders.py +++ b/IPython/external/qt_loaders.py @@ -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() diff --git a/IPython/lib/display.py b/IPython/lib/display.py index 4481683c4a0..5ff2983dbf4 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 @@ 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 diff --git a/IPython/lib/tests/test_latextools.py b/IPython/lib/tests/test_latextools.py index ead73abff93..d035752b4fe 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 ca16924e8f7..86085166071 100644 --- a/IPython/lib/tests/test_pretty.py +++ b/IPython/lib/tests/test_pretty.py @@ -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(): diff --git a/IPython/testing/plugin/dtexample.py b/IPython/testing/plugin/dtexample.py index 119e0a0536c..68f7016e34d 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 ef75f9331d7..74bccddf68b 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 a0459685236..07429ef1792 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 9cec0577bed..ebef06fe900 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 2f647ce7414..8fd4680c95b 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 5033994e1e1..98e3d5e3963 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 81ebba1cac8..8d5f73c8667 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 6ad4da1855a..b88dfb4151a 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 e0cfec07bdf..81511e9ce51 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 5614d3ef8c8..fbaa5f63cba 100644 --- a/setup.py +++ b/setup.py @@ -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)