From 3fb7c743fce3f4d11e31d903c3c7a2fecae7aa30 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Thu, 18 Feb 2021 21:57:28 -0800 Subject: [PATCH] maint: format code using black $ make format Signed-off-by: David Aguilar --- bin/git-cola-sequence-editor | 8 +++++- cola/app.py | 8 +++--- cola/cmds.py | 13 ++++----- cola/core.py | 6 ++-- cola/git.py | 4 +-- cola/gitcmds.py | 16 +++++++++-- cola/icons.py | 2 ++ cola/settings.py | 11 +++----- cola/utils.py | 8 ++---- cola/version.py | 6 ++-- cola/widgets/bookmarks.py | 1 - cola/widgets/compare.py | 6 ++-- cola/widgets/createbranch.py | 6 ++-- cola/widgets/dag.py | 67 +++++++++++++++++--------------------------- cola/widgets/gitignore.py | 3 +- cola/widgets/main.py | 37 +++++++++++------------- cola/widgets/spellcheck.py | 3 +- cola/widgets/standard.py | 5 +--- cola/widgets/startup.py | 12 ++------ cola/widgets/stash.py | 15 ++++------ cola/widgets/status.py | 1 - cola/widgets/text.py | 3 +- cola/widgets/toolbar.py | 4 +-- test/compat_test.py | 3 +- test/core_test.py | 9 ++---- test/i18n_test.py | 15 ++++------ 26 files changed, 112 insertions(+), 160 deletions(-) diff --git a/bin/git-cola-sequence-editor b/bin/git-cola-sequence-editor index c2071548..39e8d119 100755 --- a/bin/git-cola-sequence-editor +++ b/bin/git-cola-sequence-editor @@ -337,7 +337,13 @@ class RebaseTreeWidget(standard.DraggableTreeWidget): self.comment_char = comment_char # header self.setHeaderLabels( - [N_('#'), N_('Enabled'), N_('Command'), N_('SHA-1'), N_('Summary'),] + [ + N_('#'), + N_('Enabled'), + N_('Command'), + N_('SHA-1'), + N_('Summary'), + ] ) self.header().setStretchLastSection(True) self.setColumnCount(5) diff --git a/cola/app.py b/cola/app.py index 47362eb4..c32c720f 100644 --- a/cola/app.py +++ b/cola/app.py @@ -326,8 +326,7 @@ def restore_session(args): def application_init(args, update=False): - """Parses the command-line arguments and starts git-cola - """ + """Parses the command-line arguments and starts git-cola""" # Ensure that we're working in a valid git repository. # If not, try to find one. When found, chdir there. setup_environment() @@ -491,8 +490,9 @@ def new_worktree(context, repo, prompt): valid = model.set_worktree(gitdir) if not valid: - standard.critical(N_('Error Opening Repository'), - N_('Could not open %s.' % gitdir)) + standard.critical( + N_('Error Opening Repository'), N_('Could not open %s.' % gitdir) + ) def offer_to_create_repo(context, gitdir): diff --git a/cola/cmds.py b/cola/cmds.py index f1810d00..a5fffde7 100644 --- a/cola/cmds.py +++ b/cola/cmds.py @@ -584,6 +584,7 @@ class ResetHard(ResetCommand): class RestoreWorktree(ConfirmAction): """Reset the worktree using the "git read-tree" command""" + @staticmethod def tooltip(ref): tooltip = N_( @@ -617,6 +618,7 @@ class RestoreWorktree(ConfirmAction): class UndoLastCommit(ResetCommand): """Undo the last commit""" + # NOTE: this is the similar to ResetSoft() with an additional check for # published commits and different messages. def __init__(self, context): @@ -850,7 +852,6 @@ class RemoteEdit(ContextCommand): class RemoveFromSettings(ConfirmAction): - def __init__(self, context, repo, entry, icon=None): super(RemoveFromSettings, self).__init__(context) self.context = context @@ -863,7 +864,6 @@ class RemoveFromSettings(ConfirmAction): class RemoveBookmark(RemoveFromSettings): - def confirm(self): entry = self.entry title = msg = N_('Delete Bookmark?') @@ -1587,8 +1587,7 @@ class LoadCommitMessageFromOID(ContextCommand): class PrepareCommitMessageHook(ContextCommand): - """Use the cola-prepare-commit-msg hook to prepare the commit message - """ + """Use the cola-prepare-commit-msg hook to prepare the commit message""" UNDOABLE = True @@ -1817,8 +1816,7 @@ class NewBareRepo(ContextCommand): def unix_path(path, is_win32=utils.is_win32): - """Git for Windows requires unix paths, so force them here - """ + """Git for Windows requires unix paths, so force them here""" if is_win32(): path = path.replace('\\', '/') first = path[0] @@ -2332,8 +2330,7 @@ def check_conflicts(context, unmerged): def is_conflict_free(path): - """Return True if `path` contains no conflict markers - """ + """Return True if `path` contains no conflict markers""" rgx = re.compile(r'^(<<<<<<<|\|\|\|\|\|\|\||>>>>>>>) ') try: with core.xopen(path, 'r') as f: diff --git a/cola/core.py b/cola/core.py index f71cc4f6..44785326 100644 --- a/cola/core.py +++ b/cola/core.py @@ -83,8 +83,7 @@ def decode_maybe(value, encoding, errors='strict'): def decode(value, encoding=None, errors='strict'): - """decode(encoded_string) returns an unencoded unicode string - """ + """decode(encoded_string) returns an unencoded unicode string""" if value is None: result = None elif isinstance(value, ustr): @@ -114,8 +113,7 @@ def decode(value, encoding=None, errors='strict'): def encode(string, encoding=None): - """encode(unencoded_string) returns a string encoded in utf-8 - """ + """encode(unencoded_string) returns a string encoded in utf-8""" if not isinstance(string, ustr): return string return string.encode(encoding or ENCODING, 'replace') diff --git a/cola/git.py b/cola/git.py index 08629544..b34dc19f 100644 --- a/cola/git.py +++ b/cola/git.py @@ -170,9 +170,7 @@ class Paths(object): def find_git_directory(path): - """Perform Git repository discovery - - """ + """Perform Git repository discovery""" return Paths( git_dir=core.getenv('GIT_DIR'), worktree=core.getenv('GIT_WORK_TREE') ).get(path) diff --git a/cola/gitcmds.py b/cola/gitcmds.py index d8167ef1..0a6d1d8f 100644 --- a/cola/gitcmds.py +++ b/cola/gitcmds.py @@ -734,7 +734,14 @@ def parse_ls_tree(context, rev): objtype = match.group(2) oid = match.group(3) filename = match.group(4) - output.append((mode, objtype, oid, filename,)) + output.append( + ( + mode, + objtype, + oid, + filename, + ) + ) return output @@ -772,7 +779,12 @@ def parse_rev_list(raw_revs): if match: rev_id = match.group(1) summary = match.group(2) - revs.append((rev_id, summary,)) + revs.append( + ( + rev_id, + summary, + ) + ) return revs diff --git a/cola/icons.py b/cola/icons.py index 4bfafe88..8b4de9e1 100644 --- a/cola/icons.py +++ b/cola/icons.py @@ -137,6 +137,7 @@ def status(filename, deleted, is_staged, untracked): # Icons creators and SVG file references + def three_bars(): return icon('three-bars.svg') @@ -201,6 +202,7 @@ def discard(): # directory is used for the File Browser, where more contrast with the file # icons are needed. + def folder(): return icon('folder.svg') diff --git a/cola/settings.py b/cola/settings.py index dc842ebd..3226ba87 100644 --- a/cola/settings.py +++ b/cola/settings.py @@ -114,9 +114,7 @@ class Settings(object): normalize = display.normalize_path path = normalize(path) try: - index = [ - normalize(recent['path']) for recent in self.recent - ].index(path) + index = [normalize(recent['path']) for recent in self.recent].index(path) entry = self.recent.pop(index) except (IndexError, ValueError): entry = { @@ -132,10 +130,9 @@ class Settings(object): normalize = display.normalize_path path = normalize(path) try: - index = [ - normalize(recent.get('path', '')) - for recent in self.recent - ].index(path) + index = [normalize(recent.get('path', '')) for recent in self.recent].index( + path + ) except ValueError: return try: diff --git a/cola/utils.py b/cola/utils.py index 1bf26568..43838c75 100644 --- a/cola/utils.py +++ b/cola/utils.py @@ -148,16 +148,12 @@ def dirname(path, current_dir=''): def splitpath(path): - """Split paths using '/' regardless of platform - - """ + """Split paths using '/' regardless of platform""" return path.split('/') def join(*paths): - """Join paths using '/' regardless of platform - - """ + """Join paths using '/' regardless of platform""" return '/'.join(paths) diff --git a/cola/version.py b/cola/version.py index c74b16a9..5fccb352 100644 --- a/cola/version.py +++ b/cola/version.py @@ -62,8 +62,7 @@ def build_version(): @memoize def check_version(min_ver, ver): - """Check whether ver is greater or equal to min_ver - """ + """Check whether ver is greater or equal to min_ver""" min_ver_list = version_to_list(min_ver) ver_list = version_to_list(ver) return min_ver_list <= ver_list @@ -81,8 +80,7 @@ def check_git(context, key): def version_to_list(value): - """Convert a version string to a list of numbers or strings - """ + """Convert a version string to a list of numbers or strings""" ver_list = [] for p in value.split('.'): try: diff --git a/cola/widgets/bookmarks.py b/cola/widgets/bookmarks.py index 68659d8f..f3338656 100644 --- a/cola/widgets/bookmarks.py +++ b/cola/widgets/bookmarks.py @@ -394,7 +394,6 @@ class BuildItem(object): class BookmarksTreeWidgetItem(QtWidgets.QTreeWidgetItem): - def __init__(self, path, name, icon, is_default): QtWidgets.QTreeWidgetItem.__init__(self) self.path = path diff --git a/cola/widgets/compare.py b/cola/widgets/compare.py index d9ff0af6..0e397364 100644 --- a/cola/widgets/compare.py +++ b/cola/widgets/compare.py @@ -187,8 +187,7 @@ class CompareBranchesDialog(standard.Dialog): self.diff_files.addTopLevelItems([mk(f, icon) for f in files]) def remote_ref(self, branch): - """Returns the remote ref for 'git diff [local] [remote]' - """ + """Returns the remote ref for 'git diff [local] [remote]'""" context = self.context if branch == self.BRANCH_POINT: # Compare against the branch point so find the merge-base @@ -243,8 +242,7 @@ class CompareBranchesDialog(standard.Dialog): item.setSelected(True) def compare(self): - """Shows the diff for a specific file - """ + """Shows the diff for a specific file""" tree_widget = self.diff_files item = tree_widget.currentItem() if item and item.isSelected(): diff --git a/cola/widgets/createbranch.py b/cola/widgets/createbranch.py index cb0c0411..31a24615 100644 --- a/cola/widgets/createbranch.py +++ b/cola/widgets/createbranch.py @@ -341,14 +341,12 @@ class CreateBranchDialog(standard.Dialog): self.branch_name.set_value(branch) def display_model(self): - """Sets the branch list to the available branches - """ + """Sets the branch list to the available branches""" branches = self.branch_sources() qtutils.set_items(self.branch_list, branches) def branch_sources(self): - """Get the list of items for populating the branch root list. - """ + """Get the list of items for populating the branch root list.""" if get(self.local_radio): value = self.model.local_branches elif get(self.remote_radio): diff --git a/cola/widgets/dag.py b/cola/widgets/dag.py index 452f365e..26456824 100644 --- a/cola/widgets/dag.py +++ b/cola/widgets/dag.py @@ -278,56 +278,44 @@ def viewer_actions(widget): icons.compare(), qtutils.add_action( widget, N_('Diff this -> selected'), widget.proxy.diff_this_selected - ) + ), ), 'diff_selected_this': set_icon( icons.compare(), qtutils.add_action( widget, N_('Diff selected -> this'), widget.proxy.diff_selected_this - ) + ), ), 'create_branch': set_icon( icons.branch(), - qtutils.add_action( - widget, N_('Create Branch'), widget.proxy.create_branch - ) + qtutils.add_action(widget, N_('Create Branch'), widget.proxy.create_branch), ), 'create_patch': set_icon( icons.save(), - qtutils.add_action( - widget, N_('Create Patch'), widget.proxy.create_patch - ) + qtutils.add_action(widget, N_('Create Patch'), widget.proxy.create_patch), ), 'create_tag': set_icon( icons.tag(), - qtutils.add_action( - widget, N_('Create Tag'), widget.proxy.create_tag - ) + qtutils.add_action(widget, N_('Create Tag'), widget.proxy.create_tag), ), 'create_tarball': set_icon( icons.file_zip(), qtutils.add_action( widget, N_('Save As Tarball/Zip...'), widget.proxy.create_tarball - ) + ), ), 'cherry_pick': set_icon( icons.style_dialog_apply(), - qtutils.add_action( - widget, N_('Cherry Pick'), widget.proxy.cherry_pick - ) + qtutils.add_action(widget, N_('Cherry Pick'), widget.proxy.cherry_pick), ), 'revert': set_icon( - icons.undo(), - qtutils.add_action(widget, N_('Revert'), widget.proxy.revert) + icons.undo(), qtutils.add_action(widget, N_('Revert'), widget.proxy.revert) ), 'diff_commit': set_icon( icons.diff(), qtutils.add_action( - widget, - N_('Launch Diff Tool'), - widget.proxy.show_diff, - hotkeys.DIFF - ) + widget, N_('Launch Diff Tool'), widget.proxy.show_diff, hotkeys.DIFF + ), ), 'diff_commit_all': set_icon( icons.diff(), @@ -335,62 +323,59 @@ def viewer_actions(widget): widget, N_('Launch Directory Diff Tool'), widget.proxy.show_dir_diff, - hotkeys.DIFF_SECONDARY - ) + hotkeys.DIFF_SECONDARY, + ), ), 'checkout_detached': qtutils.add_action( - widget, N_('Checkout Detached HEAD'), - widget.proxy.checkout_detached + widget, N_('Checkout Detached HEAD'), widget.proxy.checkout_detached ), 'reset_soft': set_icon( icons.style_dialog_reset(), qtutils.add_action( widget, N_('Reset Branch (Soft)'), widget.proxy.reset_soft - ) + ), ), 'reset_mixed': set_icon( icons.style_dialog_reset(), qtutils.add_action( - widget, - N_('Reset Branch and Stage (Mixed)'), - widget.proxy.reset_mixed - ) + widget, N_('Reset Branch and Stage (Mixed)'), widget.proxy.reset_mixed + ), ), 'reset_keep': set_icon( icons.style_dialog_reset(), qtutils.add_action( widget, N_('Restore Worktree and Reset All (Keep Unstaged Edits)'), - widget.proxy.reset_keep - ) + widget.proxy.reset_keep, + ), ), 'reset_merge': set_icon( icons.style_dialog_reset(), qtutils.add_action( widget, N_('Restore Worktree and Reset All (Merge)'), - widget.proxy.reset_merge - ) + widget.proxy.reset_merge, + ), ), 'reset_hard': set_icon( icons.style_dialog_reset(), qtutils.add_action( widget, N_('Restore Worktree and Reset All (Hard)'), - widget.proxy.reset_hard - ) + widget.proxy.reset_hard, + ), ), 'restore_worktree': set_icon( icons.edit(), qtutils.add_action( widget, N_('Restore Worktree'), widget.proxy.restore_worktree - ) + ), ), 'save_blob': set_icon( icons.save(), qtutils.add_action( widget, N_('Grab File...'), widget.proxy.save_blob_dialog - ) + ), ), 'copy': set_icon( icons.copy(), @@ -398,8 +383,8 @@ def viewer_actions(widget): widget, N_('Copy SHA-1'), widget.proxy.copy_to_clipboard, - hotkeys.COPY_SHA1 - ) + hotkeys.COPY_SHA1, + ), ), } diff --git a/cola/widgets/gitignore.py b/cola/widgets/gitignore.py index 7c9f48be..789c50ca 100644 --- a/cola/widgets/gitignore.py +++ b/cola/widgets/gitignore.py @@ -12,8 +12,7 @@ from .standard import Dialog def gitignore_view(context): - """Launches a gitignore dialog - """ + """Launches a gitignore dialog""" view = AddToGitIgnore(context, parent=qtutils.active_window()) view.show() return view diff --git a/cola/widgets/main.py b/cola/widgets/main.py index 9b2aa751..0f7d99ab 100644 --- a/cola/widgets/main.py +++ b/cola/widgets/main.py @@ -185,8 +185,7 @@ class MainView(standard.MainWindow): self.unstage_all_action.setIcon(icons.remove()) self.undo_commit_action = add_action( - self, N_('Undo Last Commit'), - cmds.run(cmds.UndoLastCommit, context) + self, N_('Undo Last Commit'), cmds.run(cmds.UndoLastCommit, context) ) self.undo_commit_action.setIcon(icons.style_dialog_discard()) @@ -285,9 +284,7 @@ class MainView(standard.MainWindow): self.cherry_pick_action.setIcon(icons.style_dialog_apply()) self.load_commitmsg_action = add_action( - self, - N_('Load Commit Message...'), - partial(guicmds.load_commitmsg, context) + self, N_('Load Commit Message...'), partial(guicmds.load_commitmsg, context) ) self.prepare_commitmsg_hook_action = add_action( @@ -298,9 +295,7 @@ class MainView(standard.MainWindow): ) self.save_tarball_action = add_action( - self, - N_('Save As Tarball/Zip...'), - partial(archive.save_archive, context) + self, N_('Save As Tarball/Zip...'), partial(archive.save_archive, context) ) self.save_tarball_action.setIcon(icons.file_zip()) @@ -368,43 +363,45 @@ class MainView(standard.MainWindow): self.stash_action.setIcon(icons.commit()) self.reset_soft_action = add_action( - self, N_('Reset Branch (Soft)'), - partial(guicmds.reset_soft, context) + self, N_('Reset Branch (Soft)'), partial(guicmds.reset_soft, context) ) self.reset_soft_action.setIcon(icons.style_dialog_reset()) self.reset_soft_action.setToolTip(cmds.ResetSoft.tooltip('')) self.reset_mixed_action = add_action( - self, N_('Reset Branch and Stage (Mixed)'), - partial(guicmds.reset_mixed, context) + self, + N_('Reset Branch and Stage (Mixed)'), + partial(guicmds.reset_mixed, context), ) self.reset_mixed_action.setIcon(icons.style_dialog_reset()) self.reset_mixed_action.setToolTip(cmds.ResetMixed.tooltip('')) self.reset_keep_action = add_action( - self, N_('Restore Worktree and Reset All (Keep Unstaged Changes)'), - partial(guicmds.reset_keep, context) + self, + N_('Restore Worktree and Reset All (Keep Unstaged Changes)'), + partial(guicmds.reset_keep, context), ) self.reset_keep_action.setIcon(icons.style_dialog_reset()) self.reset_keep_action.setToolTip(cmds.ResetKeep.tooltip('')) self.reset_merge_action = add_action( - self, N_('Restore Worktree and Reset All (Merge)'), - partial(guicmds.reset_merge, context) + self, + N_('Restore Worktree and Reset All (Merge)'), + partial(guicmds.reset_merge, context), ) self.reset_merge_action.setIcon(icons.style_dialog_reset()) self.reset_merge_action.setToolTip(cmds.ResetMerge.tooltip('')) self.reset_hard_action = add_action( - self, N_('Restore Worktree and Reset All (Hard)'), - partial(guicmds.reset_hard, context) + self, + N_('Restore Worktree and Reset All (Hard)'), + partial(guicmds.reset_hard, context), ) self.reset_hard_action.setIcon(icons.style_dialog_reset()) self.reset_hard_action.setToolTip(cmds.ResetHard.tooltip('')) self.restore_worktree_action = add_action( - self, N_('Restore Worktree'), - partial(guicmds.restore_worktree, context) + self, N_('Restore Worktree'), partial(guicmds.restore_worktree, context) ) self.restore_worktree_action.setIcon(icons.edit()) self.restore_worktree_action.setToolTip( diff --git a/cola/widgets/spellcheck.py b/cola/widgets/spellcheck.py index ea83b3a7..2fdbda15 100644 --- a/cola/widgets/spellcheck.py +++ b/cola/widgets/spellcheck.py @@ -113,8 +113,7 @@ class Highlighter(QSyntaxHighlighter): class SpellAction(QAction): - """QAction that returns the text in a signal. - """ + """QAction that returns the text in a signal.""" result = Signal(object) diff --git a/cola/widgets/standard.py b/cola/widgets/standard.py index 1a42ac55..05a92cc3f 100644 --- a/cola/widgets/standard.py +++ b/cola/widgets/standard.py @@ -143,7 +143,6 @@ class WidgetMixin(object): class MainWindowMixin(WidgetMixin): - def __init__(self): WidgetMixin.__init__(self) # Dockwidget options @@ -682,9 +681,7 @@ class ProgressDialog(QtWidgets.QProgressDialog): class ProgressAnimationThread(QtCore.QThread): - """Emits a pseudo-animated text stream for progress bars - - """ + """Emits a pseudo-animated text stream for progress bars""" updated = Signal(object) diff --git a/cola/widgets/startup.py b/cola/widgets/startup.py index 61b19859..fa42f16d 100644 --- a/cola/widgets/startup.py +++ b/cola/widgets/startup.py @@ -111,10 +111,7 @@ class StartupDialog(standard.Dialog): bookmarks.setWordWrap(True) self.tab_layout = qtutils.vbox( - defs.no_margin, - defs.no_spacing, - self.tab_bar, - self.bookmarks + defs.no_margin, defs.no_spacing, self.tab_bar, self.bookmarks ) self.logo_layout = qtutils.vbox( @@ -221,9 +218,7 @@ class StartupDialog(standard.Dialog): def clone_repo(self): context = self.context progress = standard.progress('', '', self) - clone.clone_repo( - context, self, True, progress, self.clone_repo_done, False - ) + clone.clone_repo(context, self, True, progress, self.clone_repo_done, False) def clone_repo_done(self, task): if task.cmd and task.cmd.status == 0: @@ -258,8 +253,7 @@ class StartupDialog(standard.Dialog): repo = next(repo for repo in all_repos if repo['path'] == repodir) title = N_('Repository Not Found') - text = N_('%s could not be opened. Remove from bookmarks?') \ - % repo['path'] + text = N_('%s could not be opened. Remove from bookmarks?') % repo['path'] logo = icons.from_style(QtWidgets.QStyle.SP_MessageBoxWarning) if standard.question(title, text, N_('Remove'), logo=logo): self.context.settings.remove_bookmark(repo['path'], repo['name']) diff --git a/cola/widgets/stash.py b/cola/widgets/stash.py index 925906a4..ad451ddf 100644 --- a/cola/widgets/stash.py +++ b/cola/widgets/stash.py @@ -19,8 +19,7 @@ from . import standard def view(context, show=True): - """Launches a stash dialog using the provided model + view - """ + """Launches a stash dialog using the provided model + view""" model = stash.StashModel(context) stash_view = StashView(context, model, parent=qtutils.active_window()) if show: @@ -148,8 +147,7 @@ class StashView(standard.Dialog): self.stash_index.setChecked(False) def selected_stash(self): - """Returns the stash name of the currently selected stash - """ + """Returns the stash name of the currently selected stash""" list_widget = self.stash_list stash_list = self.revids return qtutils.selected_item(list_widget, stash_list) @@ -185,8 +183,7 @@ class StashView(standard.Dialog): self.button_pop.setEnabled(is_selected) def update_from_model(self): - """Initiates git queries on the model and updates the view - """ + """Initiates git queries on the model and updates the view""" stashes, revids, author_dates, names = self.model.stash_info() self.stashes = stashes self.revids = revids @@ -210,8 +207,7 @@ class StashView(standard.Dialog): self.stash_apply(pop=True) def stash_apply(self, pop=False): - """Applies the currently selected stash - """ + """Applies the currently selected stash""" selection = self.selected_stash() if not selection: return @@ -250,8 +246,7 @@ class StashView(standard.Dialog): QtCore.QTimer.singleShot(1, self.accept) def stash_drop(self): - """Drops the currently selected stash - """ + """Drops the currently selected stash""" selection = self.selected_stash() name = self.selected_name() if not selection: diff --git a/cola/widgets/status.py b/cola/widgets/status.py index a185080d..4a6c17d9 100644 --- a/cola/widgets/status.py +++ b/cola/widgets/status.py @@ -1243,7 +1243,6 @@ def customize_copy_actions(context, parent): class CustomizeCopyActions(standard.Dialog): - def __init__(self, context, parent): standard.Dialog.__init__(self, parent=parent) self.setWindowTitle(N_('Custom Copy Actions')) diff --git a/cola/widgets/text.py b/cola/widgets/text.py index 5d145c1e..b5f574ac 100644 --- a/cola/widgets/text.py +++ b/cola/widgets/text.py @@ -55,8 +55,7 @@ class LineEdit(QtWidgets.QLineEdit): class LineEditCursorPosition(object): - """Translate cursorPositionChanged(int,int) into cursorPosition(int,int) - """ + """Translate cursorPositionChanged(int,int) into cursorPosition(int,int)""" def __init__(self, widget, row): self._widget = widget diff --git a/cola/widgets/toolbar.py b/cola/widgets/toolbar.py index 8c4b63b1..4cf4e5c6 100644 --- a/cola/widgets/toolbar.py +++ b/cola/widgets/toolbar.py @@ -351,9 +351,7 @@ class ToolbarView(standard.Dialog): pass icon = command.get('icon', None) tooltip = command.get('tooltip', None) - child = create_child( - parent, item, command['title'], tooltip, icon - ) + child = create_child(parent, item, command['title'], tooltip, icon) top.appendRow(child) top.sortChildren(0, Qt.AscendingOrder) diff --git a/test/compat_test.py b/test/compat_test.py index 3a1c9287..a82230d2 100644 --- a/test/compat_test.py +++ b/test/compat_test.py @@ -11,8 +11,7 @@ class CompatTestCase(unittest.TestCase): """Tests the compat module""" def test_setenv(self): - """Test the core.decode function - """ + """Test the core.decode function""" key = 'COLA_UNICODE_TEST' value = '字龍' compat.setenv(key, value) diff --git a/test/core_test.py b/test/core_test.py index 9da8a744..9c05e25c 100644 --- a/test/core_test.py +++ b/test/core_test.py @@ -9,20 +9,17 @@ from . import helper class CoreColaUnicodeTestCase(unittest.TestCase): - """Tests the cola.core module's unicode handling - """ + """Tests the cola.core module's unicode handling""" def test_core_decode(self): - """Test the core.decode function - """ + """Test the core.decode function""" filename = helper.fixture('unicode.txt') expect = core.decode(core.encode('unicøde')) actual = core.read(filename).strip() self.assertEqual(expect, actual) def test_core_encode(self): - """Test the core.encode function - """ + """Test the core.encode function""" filename = helper.fixture('unicode.txt') expect = core.encode('unicøde') actual = core.encode(core.read(filename).strip()) diff --git a/test/i18n_test.py b/test/i18n_test.py index 36bd7553..ba33cde3 100644 --- a/test/i18n_test.py +++ b/test/i18n_test.py @@ -13,40 +13,35 @@ class ColaI18nTestCase(unittest.TestCase): i18n.uninstall() def test_translates_noun(self): - """Test that strings with @@noun are translated - """ + """Test that strings with @@noun are translated""" i18n.install('ja_JP') expect = uchr(0x30B3) + uchr(0x30DF) + uchr(0x30C3) + uchr(0x30C8) actual = N_('Commit@@verb') self.assertEqual(expect, actual) def test_translates_verb(self): - """Test that strings with @@verb are translated - """ + """Test that strings with @@verb are translated""" i18n.install('de_DE') expect = 'Commit aufnehmen' actual = N_('Commit@@verb') self.assertEqual(expect, actual) def test_translates_english_noun(self): - """Test that English strings with @@noun are properly handled - """ + """Test that English strings with @@noun are properly handled""" i18n.install('en_US.UTF-8') expect = 'Commit' actual = N_('Commit@@noun') self.assertEqual(expect, actual) def test_translates_english_verb(self): - """Test that English strings with @@verb are properly handled - """ + """Test that English strings with @@verb are properly handled""" i18n.install('en_US.UTF-8') expect = 'Commit' actual = N_('Commit@@verb') self.assertEqual(expect, actual) def test_translates_random_english(self): - """Test that random English strings are passed through as-is - """ + """Test that random English strings are passed through as-is""" i18n.install('en_US.UTF-8') expect = 'Random' actual = N_('Random') -- 2.11.4.GIT