From c55dbf99334886b9ef7edd0fe8d5598e68ea6edc 2022-04-29 09:18:37 From: Matthias Bussonnier Date: 2022-04-29 09:18:37 Subject: [PATCH] typo and reformat --- 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/interactiveshell.py b/IPython/core/interactiveshell.py index ea9f631..2bb27a6 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -213,14 +213,17 @@ class ExecutionInfo(object): raw_cell = ( (self.raw_cell[:50] + "..") if len(self.raw_cell) > 50 else self.raw_cell ) - return '<%s object at %x, raw_cell="%s" store_history=%s silent=%s shell_futures=%s cell_id=%s>' % ( - name, - id(self), - raw_cell, - self.store_history, - self.silent, - self.shell_futures, - self.cell_id, + return ( + '<%s object at %x, raw_cell="%s" store_history=%s silent=%s shell_futures=%s cell_id=%s>' + % ( + name, + id(self), + raw_cell, + self.store_history, + self.silent, + self.shell_futures, + self.cell_id, + ) ) 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..aff616f 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 diff --git a/IPython/testing/plugin/pytest_ipdoctest.py b/IPython/testing/plugin/pytest_ipdoctest.py index 809713d..4ba2f1a 100644 --- a/IPython/testing/plugin/pytest_ipdoctest.py +++ b/IPython/testing/plugin/pytest_ipdoctest.py @@ -782,7 +782,7 @@ def _init_checker_class() -> Type["IPDoctestOutputChecker"]: precision = 0 if fraction is None else len(fraction) if exponent is not None: precision -= int(exponent) - if float(w.group()) == approx(float(g.group()), abs=10 ** -precision): + if float(w.group()) == approx(float(g.group()), abs=10**-precision): # They're close enough. Replace the text we actually # got with the text we want, so that it will match when we # check the string literally. 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 ----------