diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 62667b4..fc1f19e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -28,7 +28,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install darker black==21.12b0 + pip install darker==1.5.1 black==22.10.0 - name: Lint with darker run: | darker -r 60625f241f298b5039cb2debc365db38aa7bb522 --check --diff . || ( diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 649ceba..6d04846 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -226,14 +226,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/release.py b/IPython/core/release.py index ae8b15e..bd0ac21 100644 --- a/IPython/core/release.py +++ b/IPython/core/release.py @@ -36,7 +36,7 @@ version_info = (_version_major, _version_minor, _version_patch, _version_extra) kernel_protocol_version_info = (5, 0) kernel_protocol_version = "%i.%i" % kernel_protocol_version_info -license = 'BSD-3-Clause' +license = "BSD-3-Clause" authors = {'Fernando' : ('Fernando Perez','fperez.net@gmail.com'), 'Janko' : ('Janko Hauser','jhauser@zscout.de'), diff --git a/IPython/core/tests/nonascii.py b/IPython/core/tests/nonascii.py index 78801df..12738e3 100644 --- a/IPython/core/tests/nonascii.py +++ b/IPython/core/tests/nonascii.py @@ -1,4 +1,4 @@ # coding: iso-8859-5 # (Unlikely to be the default encoding for most testers.) # ������������������� <- Cyrillic characters -u = '����' +u = "����" diff --git a/IPython/lib/tests/test_imports.py b/IPython/lib/tests/test_imports.py index d2e1b87..515cd4a 100644 --- a/IPython/lib/tests/test_imports.py +++ b/IPython/lib/tests/test_imports.py @@ -1,11 +1,14 @@ # encoding: utf-8 from IPython.testing import decorators as dec + def test_import_backgroundjobs(): from IPython.lib import backgroundjobs + def test_import_deepreload(): from IPython.lib import deepreload + def test_import_demo(): from IPython.lib import demo diff --git a/IPython/terminal/pt_inputhooks/asyncio.py b/IPython/terminal/pt_inputhooks/asyncio.py index 2d8c128..d2499e1 100644 --- a/IPython/terminal/pt_inputhooks/asyncio.py +++ b/IPython/terminal/pt_inputhooks/asyncio.py @@ -31,8 +31,7 @@ from prompt_toolkit import __version__ as ptk_version from IPython.core.async_helpers import get_asyncio_loop -PTK3 = ptk_version.startswith('3.') - +PTK3 = ptk_version.startswith("3.") def inputhook(context): diff --git a/IPython/terminal/pt_inputhooks/gtk.py b/IPython/terminal/pt_inputhooks/gtk.py index 6e246ba..5c201b6 100644 --- a/IPython/terminal/pt_inputhooks/gtk.py +++ b/IPython/terminal/pt_inputhooks/gtk.py @@ -41,6 +41,7 @@ import gtk, gobject # Enable threading in GTK. (Otherwise, GTK will keep the GIL.) gtk.gdk.threads_init() + def inputhook(context): """ When the eventloop of prompt-toolkit is idle, call this inputhook. @@ -50,6 +51,7 @@ def inputhook(context): :param context: An `InputHookContext` instance. """ + def _main_quit(*a, **kw): gtk.main_quit() return False diff --git a/IPython/terminal/pt_inputhooks/gtk3.py b/IPython/terminal/pt_inputhooks/gtk3.py index ae82b4e..b073bd9 100644 --- a/IPython/terminal/pt_inputhooks/gtk3.py +++ b/IPython/terminal/pt_inputhooks/gtk3.py @@ -3,10 +3,12 @@ from gi.repository import Gtk, GLib + def _main_quit(*args, **kwargs): Gtk.main_quit() return False + def inputhook(context): GLib.io_add_watch(context.fileno(), GLib.PRIORITY_DEFAULT, GLib.IO_IN, _main_quit) Gtk.main() 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/testing/plugin/simplevars.py b/IPython/testing/plugin/simplevars.py index cac0b75..82a5edb 100644 --- a/IPython/testing/plugin/simplevars.py +++ b/IPython/testing/plugin/simplevars.py @@ -1,2 +1,2 @@ x = 1 -print('x is:',x) +print("x is:", x) diff --git a/IPython/utils/_sysinfo.py b/IPython/utils/_sysinfo.py index a80b029..2e58242 100644 --- a/IPython/utils/_sysinfo.py +++ b/IPython/utils/_sysinfo.py @@ -1,2 +1,2 @@ # GENERATED BY setup.py -commit = u"" +commit = "" diff --git a/IPython/utils/tests/test_dir2.py b/IPython/utils/tests/test_dir2.py index d35b110..bf7f5e5 100644 --- a/IPython/utils/tests/test_dir2.py +++ b/IPython/utils/tests/test_dir2.py @@ -19,7 +19,6 @@ def test_base(): def test_SubClass(): - class SubClass(Base): y = 2 @@ -53,7 +52,7 @@ def test_misbehaving_object_without_trait_names(): class SillierWithDir(MisbehavingGetattr): def __dir__(self): - return ['some_method'] + return ["some_method"] for bad_klass in (MisbehavingGetattr, SillierWithDir): obj = bad_klass() diff --git a/setupbase.py b/setupbase.py index 5db235c..748b4dd 100644 --- a/setupbase.py +++ b/setupbase.py @@ -346,7 +346,7 @@ def git_prebuild(pkg_dir, build_cmd=build_py): out_file.writelines( [ "# GENERATED BY setup.py\n", - 'commit = u"%s"\n' % repo_commit, + 'commit = "%s"\n' % repo_commit, ] )