From a9b3a0bb6698c5094c0e6d991a97c7a99760eae6 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Fri, 17 Jul 2020 00:56:17 -0700 Subject: [PATCH] maint: reformat code using black Signed-off-by: David Aguilar --- cola/cmds.py | 4 +--- cola/compat.py | 1 + cola/widgets/main.py | 5 +++-- cola/widgets/submodules.py | 29 ++++++++++++++++------------- cola/widgets/text.py | 4 +--- test/cmds_test.py | 1 + 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/cola/cmds.py b/cola/cmds.py index 64c5fafc..62f88173 100644 --- a/cola/cmds.py +++ b/cola/cmds.py @@ -2674,9 +2674,7 @@ class SubmoduleAdd(ConfirmAction): question = N_('Add this submodule?') info = N_('The submodule will be added using\n' '"%s"' % self.command()) ok_txt = N_('Add Submodule') - return Interaction.confirm( - title, question, info, ok_txt, icon=icons.ok() - ) + return Interaction.confirm(title, question, info, ok_txt, icon=icons.ok()) def action(self): context = self.context diff --git a/cola/compat.py b/cola/compat.py index 8367d483..246f89d8 100644 --- a/cola/compat.py +++ b/cola/compat.py @@ -51,6 +51,7 @@ else: # Qt's max 32-bit signed integer range (-2147483648 to 2147483647) maxint = (2 ** 31) - 1 + def setenv(key, value): """Compatibility wrapper for setting environment variables diff --git a/cola/widgets/main.py b/cola/widgets/main.py index 58917c2e..2ab888df 100644 --- a/cola/widgets/main.py +++ b/cola/widgets/main.py @@ -308,8 +308,9 @@ class MainView(standard.MainWindow): ) self.add_submodule_action = add_action( - self, N_('Add Submodule...'), - partial(submodules.add_submodule, context, parent=self) + self, + N_('Add Submodule...'), + partial(submodules.add_submodule, context, parent=self), ) self.fetch_action = add_action( diff --git a/cola/widgets/submodules.py b/cola/widgets/submodules.py index d5e545c7..0e5e321c 100644 --- a/cola/widgets/submodules.py +++ b/cola/widgets/submodules.py @@ -26,7 +26,6 @@ def add_submodule(context, parent): class SubmodulesWidget(QtWidgets.QFrame): - def __init__(self, context, parent): super(SubmodulesWidget, self).__init__(parent) self.context = context @@ -55,7 +54,7 @@ class SubmodulesWidget(QtWidgets.QFrame): defs.spacing, self.add_button, self.open_parent_button, - self.refresh_button + self.refresh_button, ) self.corner_widget = QtWidgets.QWidget(self) self.corner_widget.setLayout(self.button_layout) @@ -92,18 +91,25 @@ class AddSubmodule(standard.Dialog): hint = N_('Branch name') tooltip = N_('Submodule branch to track (optional)') - self.branch_text = text.HintedDefaultLineEdit(hint, tooltip=tooltip, parent=self) + self.branch_text = text.HintedDefaultLineEdit( + hint, tooltip=tooltip, parent=self + ) self.depth_spinbox = standard.SpinBox( - mini=0, maxi=compat.maxint, value=0, parent=self) + mini=0, maxi=compat.maxint, value=0, parent=self + ) self.depth_spinbox.setToolTip( - N_('Create a shallow clone with history truncated to the ' - 'specified number of revisions. 0 performs a full clone.') + N_( + 'Create a shallow clone with history truncated to the ' + 'specified number of revisions. 0 performs a full clone.' + ) ) hint = N_('Reference URL') tooltip = N_('Reference repository to use when cloning (optional)') - self.reference_text = text.HintedDefaultLineEdit(hint, tooltip=tooltip, parent=self) + self.reference_text = text.HintedDefaultLineEdit( + hint, tooltip=tooltip, parent=self + ) self.add_button = qtutils.ok_button(N_('Add Submodule'), enabled=False) self.close_button = qtutils.close_button() @@ -122,14 +128,11 @@ class AddSubmodule(standard.Dialog): defs.button_spacing, qtutils.STRETCH, self.add_button, - self.close_button + self.close_button, ) self.main_layout = qtutils.vbox( - defs.large_margin, - defs.spacing, - self.form_layout, - self.button_layout + defs.large_margin, defs.spacing, self.form_layout, self.button_layout ) self.setLayout(self.main_layout) self.init_size(parent=qtutils.active_window()) @@ -150,7 +153,7 @@ class AddSubmodule(standard.Dialog): self.path_text.value(), self.branch_text.value(), self.depth_spinbox.value(), - self.reference_text.value() + self.reference_text.value(), ) diff --git a/cola/widgets/text.py b/cola/widgets/text.py index b0b5e9c7..5d145c1e 100644 --- a/cola/widgets/text.py +++ b/cola/widgets/text.py @@ -796,9 +796,7 @@ class HintedLineEdit(HintedDefaultLineEdit): """A monospace line edit with hint text""" def __init__(self, context, hint, tooltip=None, parent=None): - super(HintedLineEdit, self).__init__( - hint, tooltip=tooltip, parent=parent - ) + super(HintedLineEdit, self).__init__(hint, tooltip=tooltip, parent=parent) self.setFont(qtutils.diff_font(context)) diff --git a/test/cmds_test.py b/test/cmds_test.py index ee39627a..ce79a2b5 100644 --- a/test/cmds_test.py +++ b/test/cmds_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """Test the cmds module""" from __future__ import absolute_import, division, unicode_literals + try: from unittest.mock import Mock, patch except ImportError: -- 2.11.4.GIT