From 643a55331533585e36699eebf5e72b168caedb06 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 26 Jan 2024 15:14:22 +0000 Subject: [PATCH] Reformat code using black 24.1.0 --- gramps/cli/user.py | 6 +++--- gramps/gen/datehandler/_date_ja.py | 16 +++++++++++++--- gramps/gen/filters/rules/place/_withinarea.py | 1 + gramps/gen/plug/_options.py | 1 - gramps/gen/plug/report/_options.py | 1 - gramps/gen/proxy/proxybase.py | 14 ++++---------- gramps/gen/utils/place.py | 2 +- gramps/gui/clipboard.py | 6 +++--- gramps/gui/editors/filtereditor.py | 6 +----- gramps/gui/plug/report/_bookdialog.py | 2 -- gramps/gui/plug/tool.py | 1 - gramps/gui/viewmanager.py | 12 ++++++------ gramps/plugins/drawreport/ancestortree.py | 1 - gramps/plugins/drawreport/descendtree.py | 1 - gramps/plugins/gramplet/placedetails.py | 8 +++++--- gramps/plugins/importer/importxml.py | 6 +++--- gramps/plugins/textreport/alphabeticalindex.py | 1 - gramps/plugins/textreport/ancestorreport.py | 1 - gramps/plugins/textreport/custombooktext.py | 1 - gramps/plugins/textreport/descendreport.py | 1 - gramps/plugins/textreport/detancestralreport.py | 1 - gramps/plugins/textreport/detdescendantreport.py | 1 - gramps/plugins/textreport/familygroup.py | 1 - gramps/plugins/textreport/kinshipreport.py | 1 - gramps/plugins/textreport/placereport.py | 1 - gramps/plugins/textreport/simplebooktitle.py | 1 - gramps/plugins/textreport/tableofcontents.py | 1 - gramps/plugins/view/geoevents.py | 16 ++++++++++------ gramps/plugins/webreport/calendar.py | 8 +++++--- gramps/plugins/webreport/webcal.py | 8 +++++--- 30 files changed, 60 insertions(+), 67 deletions(-) diff --git a/gramps/cli/user.py b/gramps/cli/user.py index dfa2d136cd8..64f17304e5d 100644 --- a/gramps/cli/user.py +++ b/gramps/cli/user.py @@ -78,9 +78,9 @@ def yes(*args, **kwargs): if auto_accept: self.prompt = yes if quiet: - self.begin_progress = ( - self.end_progress - ) = self.step_progress = self._default_callback = yes + self.begin_progress = self.end_progress = self.step_progress = ( + self._default_callback + ) = yes def begin_progress(self, title, message, steps): """ diff --git a/gramps/gen/datehandler/_date_ja.py b/gramps/gen/datehandler/_date_ja.py index 0660b00b2e3..6d24ec25683 100644 --- a/gramps/gen/datehandler/_date_ja.py +++ b/gramps/gen/datehandler/_date_ja.py @@ -249,7 +249,11 @@ def _display_gregorian(self, date_val, **kwargs): else: value = "%s年%s" % (year, self.short_months[date_val[1]]) else: - value = "%s年%s%s日" % (year, self.short_months[date_val[1]], date_val[0]) + value = "%s年%s%s日" % ( + year, + self.short_months[date_val[1]], + date_val[0], + ) elif self.format == 3: # 1999年十二月31日 @@ -259,7 +263,11 @@ def _display_gregorian(self, date_val, **kwargs): else: value = "%s年%s" % (year, self.long_months[date_val[1]]) else: - value = "%s年%s%s日" % (year, self.long_months[date_val[1]], date_val[0]) + value = "%s年%s%s日" % ( + year, + self.long_months[date_val[1]], + date_val[0], + ) else: return self.display_iso(date_val) @@ -279,5 +287,7 @@ def _display_gregorian(self, date_val, **kwargs): # ------------------------------------------------------------------------- register_datehandler( - ("ja_JP", "ja", "japanese", "Japanese", ("%Y年%m月%d日",)), DateParserJA, DateDisplayJA + ("ja_JP", "ja", "japanese", "Japanese", ("%Y年%m月%d日",)), + DateParserJA, + DateDisplayJA, ) diff --git a/gramps/gen/filters/rules/place/_withinarea.py b/gramps/gen/filters/rules/place/_withinarea.py index 582c8646c1e..6f312285350 100644 --- a/gramps/gen/filters/rules/place/_withinarea.py +++ b/gramps/gen/filters/rules/place/_withinarea.py @@ -1,6 +1,7 @@ """ WithinArea : used to verify if a place is contained in a specific area """ + # # Gramps - a GTK+/GNOME based genealogy program # diff --git a/gramps/gen/plug/_options.py b/gramps/gen/plug/_options.py index a06bd405957..b5bd5f8cf24 100644 --- a/gramps/gen/plug/_options.py +++ b/gramps/gen/plug/_options.py @@ -459,7 +459,6 @@ def set_person_id(self, val): # # ------------------------------------------------------------------------ class Options: - """ Defines options and provides handling interface. diff --git a/gramps/gen/plug/report/_options.py b/gramps/gen/plug/report/_options.py index a5b66266786..0c242b281f9 100644 --- a/gramps/gen/plug/report/_options.py +++ b/gramps/gen/plug/report/_options.py @@ -835,7 +835,6 @@ def set_margins(self, margins): # # ------------------------------------------------------------------------ class ReportOptions(_options.Options): - """ Defines options and provides handling interface. diff --git a/gramps/gen/proxy/proxybase.py b/gramps/gen/proxy/proxybase.py index 1178a36f716..8ae5d3f3d8a 100644 --- a/gramps/gen/proxy/proxybase.py +++ b/gramps/gen/proxy/proxybase.py @@ -163,17 +163,11 @@ def include_something(self, handle, obj=None): # Define default predicates for each object type - include_person = ( - include_family - ) = ( - include_event - ) = ( - include_source - ) = ( + include_person = include_family = include_event = include_source = ( include_citation - ) = ( - include_place - ) = include_media = include_repository = include_note = include_tag = None + ) = include_place = include_media = include_repository = include_note = ( + include_tag + ) = None def get_person_cursor(self): return ProxyCursor(self.get_raw_person_data, self.get_person_handles) diff --git a/gramps/gen/utils/place.py b/gramps/gen/utils/place.py index 7f88b118aff..eb3a6314d08 100644 --- a/gramps/gen/utils/place.py +++ b/gramps/gen/utils/place.py @@ -88,7 +88,7 @@ def _T_(value, context=""): # enable deferred translations # format #3 'D.D8' degree notation, 8 decimals (precision like ISO-DMS) _T_("D.D8"), # format #4 'RT90' Output format for the Swedish coordinate system RT90 - _T_("RT90") + _T_("RT90"), # output display not implemented for the following formats: # 'ISO-D' ISO 6709 degree notation i.e. ±DD.DDDD±DDD.DDDD # 'ISO-DM' ISO 6709 degree, minutes notation diff --git a/gramps/gui/clipboard.py b/gramps/gui/clipboard.py index b090a9d10ad..8e2ce0b2d12 100644 --- a/gramps/gui/clipboard.py +++ b/gramps/gui/clipboard.py @@ -1075,9 +1075,9 @@ def register_wrapper_classes(self): def register_wrapper_class(self, wrapper_class): for drop_target in wrapper_class.DROP_TARGETS: - self._target_type_to_wrapper_class_map[ - drop_target.drag_type - ] = wrapper_class + self._target_type_to_wrapper_class_map[drop_target.drag_type] = ( + wrapper_class + ) # Methods for rendering the cells. diff --git a/gramps/gui/editors/filtereditor.py b/gramps/gui/editors/filtereditor.py index 84c25878d38..ae6eaf69704 100644 --- a/gramps/gui/editors/filtereditor.py +++ b/gramps/gui/editors/filtereditor.py @@ -997,11 +997,7 @@ def on_ok_clicked(self, obj): op = ( "and" if val == 0 - else "or" - if val == 1 - else "one" - if val == 2 - else "sequence" + else "or" if val == 1 else "one" if val == 2 else "sequence" ) self.logical.set_active(val) self.filter.set_logical_op(op) diff --git a/gramps/gui/plug/report/_bookdialog.py b/gramps/gui/plug/report/_bookdialog.py index cad1212c2de..54345be5da4 100644 --- a/gramps/gui/plug/report/_bookdialog.py +++ b/gramps/gui/plug/report/_bookdialog.py @@ -300,7 +300,6 @@ def do_nothing(self, obj): # # ------------------------------------------------------------------------ class BookOptions(ReportOptions): - """ Defines options and provides handling interface. """ @@ -830,7 +829,6 @@ def on_edit_clicked(self, obj): # # ------------------------------------------------------------------------ class BookItemDialog(ReportDialog): - """ This class overrides the interface methods common for different reports in a way specific for this report. This is a book item dialog. diff --git a/gramps/gui/plug/tool.py b/gramps/gui/plug/tool.py index 762abbd7fa2..aa3bbd1f2fa 100644 --- a/gramps/gui/plug/tool.py +++ b/gramps/gui/plug/tool.py @@ -351,7 +351,6 @@ def init_subclass(self): # # ------------------------------------------------------------------------ class ToolOptions(Options): - """ Defines options and provides handling interface. diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index 2ec9a66494e..0d8d2b0b4bf 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -1601,9 +1601,9 @@ def get_available_views(self): % { "name": pdata.name, "gramps_bugtracker_url": URL_BUGHOME, - "firstauthoremail": pdata.authors_email[0] - if pdata.authors_email - else "...", + "firstauthoremail": ( + pdata.authors_email[0] if pdata.authors_email else "..." + ), "error_msg": lasterror, }, parent=self.uistate.window, @@ -1712,9 +1712,9 @@ def run_plugin(pdata, dbstate, uistate): % { "name": pdata.name, "gramps_bugtracker_url": URL_BUGHOME, - "firstauthoremail": pdata.authors_email[0] - if pdata.authors_email - else "...", + "firstauthoremail": ( + pdata.authors_email[0] if pdata.authors_email else "..." + ), "error_msg": error_msg, }, parent=uistate.window, diff --git a/gramps/plugins/drawreport/ancestortree.py b/gramps/plugins/drawreport/ancestortree.py index 956eb46e704..87e53403786 100644 --- a/gramps/plugins/drawreport/ancestortree.py +++ b/gramps/plugins/drawreport/ancestortree.py @@ -815,7 +815,6 @@ def scale_styles(self, scale): # # ------------------------------------------------------------------------ class AncestorTreeOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/drawreport/descendtree.py b/gramps/plugins/drawreport/descendtree.py index 8c2918ca510..e53086547af 100644 --- a/gramps/plugins/drawreport/descendtree.py +++ b/gramps/plugins/drawreport/descendtree.py @@ -1533,7 +1533,6 @@ def scale_styles(self, amount): # # ------------------------------------------------------------------------ class DescendTreeOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/gramplet/placedetails.py b/gramps/plugins/gramplet/placedetails.py index 860d40bc3c5..1aa6d3c2852 100644 --- a/gramps/plugins/gramplet/placedetails.py +++ b/gramps/plugins/gramplet/placedetails.py @@ -148,9 +148,11 @@ def display_alt_names(self, place): Display alternative names for the place. """ alt_names = [ - "%s (%s)" % (name.get_value(), name.get_language()) - if name.get_language() - else name.get_value() + ( + "%s (%s)" % (name.get_value(), name.get_language()) + if name.get_language() + else name.get_value() + ) for name in place.get_alternative_names() ] if len(alt_names) > 0: diff --git a/gramps/plugins/importer/importxml.py b/gramps/plugins/importer/importxml.py index 6f26f1dab91..b6926e94836 100644 --- a/gramps/plugins/importer/importxml.py +++ b/gramps/plugins/importer/importxml.py @@ -298,9 +298,9 @@ def add(self, category, key, obj, sec_obj=None): while obj is an object of which information will be extracted """ if category == "merge-candidate": - self.data_mergecandidate[self.key2data[key]][ - obj.handle - ] = self._extract_mergeinfo(key, obj, sec_obj) + self.data_mergecandidate[self.key2data[key]][obj.handle] = ( + self._extract_mergeinfo(key, obj, sec_obj) + ) elif category == "new-object": self.data_newobject[self.key2data[key]] += 1 elif category == "unknown-object": diff --git a/gramps/plugins/textreport/alphabeticalindex.py b/gramps/plugins/textreport/alphabeticalindex.py index 57d1e141681..0d8597cd557 100644 --- a/gramps/plugins/textreport/alphabeticalindex.py +++ b/gramps/plugins/textreport/alphabeticalindex.py @@ -85,7 +85,6 @@ def write_report(self): # # ------------------------------------------------------------------------ class AlphabeticalIndexOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/textreport/ancestorreport.py b/gramps/plugins/textreport/ancestorreport.py index ac15d9b8b8c..5152be101f9 100644 --- a/gramps/plugins/textreport/ancestorreport.py +++ b/gramps/plugins/textreport/ancestorreport.py @@ -280,7 +280,6 @@ def write_report(self): # # ------------------------------------------------------------------------ class AncestorOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/textreport/custombooktext.py b/gramps/plugins/textreport/custombooktext.py index 7e845cb9b96..4054fa419c2 100644 --- a/gramps/plugins/textreport/custombooktext.py +++ b/gramps/plugins/textreport/custombooktext.py @@ -124,7 +124,6 @@ def write_report(self): # # ------------------------------------------------------------------------ class CustomTextOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/textreport/descendreport.py b/gramps/plugins/textreport/descendreport.py index 7a591eb21ce..09f03cf61da 100644 --- a/gramps/plugins/textreport/descendreport.py +++ b/gramps/plugins/textreport/descendreport.py @@ -537,7 +537,6 @@ def write_report(self): # # ------------------------------------------------------------------------ class DescendantOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/textreport/detancestralreport.py b/gramps/plugins/textreport/detancestralreport.py index dc2d97a9555..848ff11a358 100644 --- a/gramps/plugins/textreport/detancestralreport.py +++ b/gramps/plugins/textreport/detancestralreport.py @@ -828,7 +828,6 @@ def endnotes(self, obj): # # ------------------------------------------------------------------------ class DetAncestorOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/textreport/detdescendantreport.py b/gramps/plugins/textreport/detdescendantreport.py index 27df96bf0e7..30edef02376 100644 --- a/gramps/plugins/textreport/detdescendantreport.py +++ b/gramps/plugins/textreport/detdescendantreport.py @@ -1020,7 +1020,6 @@ def endnotes(self, obj): # # ------------------------------------------------------------------------ class DetDescendantOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/textreport/familygroup.py b/gramps/plugins/textreport/familygroup.py index 00e05a4771c..a521a13af8b 100644 --- a/gramps/plugins/textreport/familygroup.py +++ b/gramps/plugins/textreport/familygroup.py @@ -696,7 +696,6 @@ def write_report(self): # # ------------------------------------------------------------------------ class FamilyGroupOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/textreport/kinshipreport.py b/gramps/plugins/textreport/kinshipreport.py index 574a04a65c8..5d6ff6a20c9 100644 --- a/gramps/plugins/textreport/kinshipreport.py +++ b/gramps/plugins/textreport/kinshipreport.py @@ -343,7 +343,6 @@ def write_person(self, person_handle): # # ------------------------------------------------------------------------ class KinshipOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/textreport/placereport.py b/gramps/plugins/textreport/placereport.py index 7fed14fa9d7..308e407d078 100644 --- a/gramps/plugins/textreport/placereport.py +++ b/gramps/plugins/textreport/placereport.py @@ -439,7 +439,6 @@ def __get_place_handles(self, places): # # ------------------------------------------------------------------------ class PlaceOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/textreport/simplebooktitle.py b/gramps/plugins/textreport/simplebooktitle.py index 5ca6de20575..fbb5a7bdf60 100644 --- a/gramps/plugins/textreport/simplebooktitle.py +++ b/gramps/plugins/textreport/simplebooktitle.py @@ -126,7 +126,6 @@ def write_report(self): # # ------------------------------------------------------------------------ class SimpleBookTitleOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/textreport/tableofcontents.py b/gramps/plugins/textreport/tableofcontents.py index 8d2f984728a..1b83902e8de 100644 --- a/gramps/plugins/textreport/tableofcontents.py +++ b/gramps/plugins/textreport/tableofcontents.py @@ -84,7 +84,6 @@ def write_report(self): # # ------------------------------------------------------------------------ class TableOfContentsOptions(MenuReportOptions): - """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/view/geoevents.py b/gramps/plugins/view/geoevents.py index 37818b53502..565458d87e1 100644 --- a/gramps/plugins/view/geoevents.py +++ b/gramps/plugins/view/geoevents.py @@ -307,12 +307,16 @@ def _createmap_for_one_event(self, event): if hdle: mother = dbstate.db.get_person_from_handle(hdle) descr2 = ("%(father)s - %(mother)s") % { - "father": _nd.display(father) - if father is not None - else "?", - "mother": _nd.display(mother) - if mother is not None - else "?", + "father": ( + _nd.display(father) + if father is not None + else "?" + ), + "mother": ( + _nd.display(mother) + if mother is not None + else "?" + ), } else: descr2 = _("incomplete or unreferenced event ?") diff --git a/gramps/plugins/webreport/calendar.py b/gramps/plugins/webreport/calendar.py index 725e1364b09..0b17cfdf621 100644 --- a/gramps/plugins/webreport/calendar.py +++ b/gramps/plugins/webreport/calendar.py @@ -621,9 +621,11 @@ def __get_next_month_day(year, month, day_col): unordered += Html( "li", text, - inline=False - if (event == "Anniversary") - else True, + inline=( + False + if (event == "Anniversary") + else True + ), ) # no events for this day else: diff --git a/gramps/plugins/webreport/webcal.py b/gramps/plugins/webreport/webcal.py index cf925a9ff75..d9170e5cd06 100644 --- a/gramps/plugins/webreport/webcal.py +++ b/gramps/plugins/webreport/webcal.py @@ -1048,9 +1048,11 @@ def __get_next_month_day(year, month, day_col): unordered += Html( "li", text, - inline=False - if (event == "Anniversary") - else True, + inline=( + False + if (event == "Anniversary") + else True + ), ) # no events for this day else: