From 987a8391a456f48bca6f5565b33713887a5dabb3 Mon Sep 17 00:00:00 2001 From: Robin Stephansen Date: Tue, 16 Jan 2024 21:55:56 +0000 Subject: [PATCH] Formatting fixes by black and removed rouge single quote --- doorstop/cli/commands.py | 2 +- doorstop/core/builder.py | 6 +++--- doorstop/core/document.py | 6 +++--- doorstop/core/tests/test_builder.py | 2 +- doorstop/core/tree.py | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doorstop/cli/commands.py b/doorstop/cli/commands.py index 9930aee84..dac05c454 100644 --- a/doorstop/cli/commands.py +++ b/doorstop/cli/commands.py @@ -207,7 +207,7 @@ def run_remove(args, cwd, _, catch=True): with utilities.capture(catch=catch) as success: # get the item tree = _get_tree(args, cwd) - item = tree.find_item(args.uid,only_active=False) + item = tree.find_item(args.uid, only_active=False) # delete it item.delete() diff --git a/doorstop/core/builder.py b/doorstop/core/builder.py index 3b7cd9b88..6e25725f2 100644 --- a/doorstop/core/builder.py +++ b/doorstop/core/builder.py @@ -94,15 +94,15 @@ def find_document(prefix): return document -def find_item(uid,only_active = True): +def find_item(uid, only_active=True): """Find an item without an explicitly building a tree. - + :param uid: UID :param only_active: Returns only active items """ tree = _get_tree() - item = tree.find_item(uid,only_active=only_active) + item = tree.find_item(uid, only_active=only_active) return item diff --git a/doorstop/core/document.py b/doorstop/core/document.py index 200c9534f..ef620faa7 100644 --- a/doorstop/core/document.py +++ b/doorstop/core/document.py @@ -562,7 +562,7 @@ def remove_item(self, value, reorder=True): """ uid = UID(value) - item = self.find_item(uid,only_active=False) + item = self.find_item(uid, only_active=False) item.delete() if reorder: self.reorder() @@ -780,7 +780,7 @@ def _items_by_level(items, keep=None): for item in items_at_level: yield level, item - def find_item(self, value, only_active = True, _kind=""): + def find_item(self, value, only_active=True, _kind=""): """Return an item by its UID. :param value: item or UID @@ -798,7 +798,7 @@ def find_item(self, value, only_active = True, _kind=""): if item.active: return item else: - log.trace("item is inactive: {}".format(item)) # type: ignore' + log.trace("item is inactive: {}".format(item)) # type: ignore if not only_active: return item diff --git a/doorstop/core/tests/test_builder.py b/doorstop/core/tests/test_builder.py index 71e530e0c..ec4856c12 100644 --- a/doorstop/core/tests/test_builder.py +++ b/doorstop/core/tests/test_builder.py @@ -52,7 +52,7 @@ def test_find_item(self, mock_find_item): _clear_tree() uid = "req1" find_item(uid) - mock_find_item.assert_called_once_with(uid,only_active=True) + mock_find_item.assert_called_once_with(uid, only_active=True) def test_tree_finds_documents(self): """Verify items can be found using a convenience function.""" diff --git a/doorstop/core/tree.py b/doorstop/core/tree.py index 7d1d7d32f..4bb14afe4 100644 --- a/doorstop/core/tree.py +++ b/doorstop/core/tree.py @@ -276,7 +276,7 @@ def remove_item(self, value, reorder=True): uid = UID(value) for document in self: try: - document.find_item(uid,only_active=False) + document.find_item(uid, only_active=False) except DoorstopError: pass # item not found in that document else: @@ -445,7 +445,7 @@ def find_item(self, value, only_active=True, _kind=""): except KeyError: for document in self: try: - item = document.find_item(uid, only_active=only_active,_kind=_kind) + item = document.find_item(uid, only_active=only_active, _kind=_kind) except DoorstopError: pass # item not found in that document else: