Skip to content

Commit

Permalink
Reformat code using black 24.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Hall committed Jan 26, 2024
1 parent 12c2a8f commit 643a553
Show file tree
Hide file tree
Showing 30 changed files with 60 additions and 67 deletions.
6 changes: 3 additions & 3 deletions gramps/cli/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
16 changes: 13 additions & 3 deletions gramps/gen/datehandler/_date_ja.py
Original file line number Diff line number Diff line change
Expand Up @@ -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日
Expand All @@ -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)
Expand All @@ -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,
)
1 change: 1 addition & 0 deletions gramps/gen/filters/rules/place/_withinarea.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
WithinArea : used to verify if a place is contained in a specific area
"""

#
# Gramps - a GTK+/GNOME based genealogy program
#
Expand Down
1 change: 0 additions & 1 deletion gramps/gen/plug/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ def set_person_id(self, val):
#
# ------------------------------------------------------------------------
class Options:

"""
Defines options and provides handling interface.
Expand Down
1 change: 0 additions & 1 deletion gramps/gen/plug/report/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,6 @@ def set_margins(self, margins):
#
# ------------------------------------------------------------------------
class ReportOptions(_options.Options):

"""
Defines options and provides handling interface.
Expand Down
14 changes: 4 additions & 10 deletions gramps/gen/proxy/proxybase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion gramps/gen/utils/place.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions gramps/gui/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 1 addition & 5 deletions gramps/gui/editors/filtereditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions gramps/gui/plug/report/_bookdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ def do_nothing(self, obj):
#
# ------------------------------------------------------------------------
class BookOptions(ReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion gramps/gui/plug/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ def init_subclass(self):
#
# ------------------------------------------------------------------------
class ToolOptions(Options):

"""
Defines options and provides handling interface.
Expand Down
12 changes: 6 additions & 6 deletions gramps/gui/viewmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/drawreport/ancestortree.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,6 @@ def scale_styles(self, scale):
#
# ------------------------------------------------------------------------
class AncestorTreeOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/drawreport/descendtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,6 @@ def scale_styles(self, amount):
#
# ------------------------------------------------------------------------
class DescendTreeOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
8 changes: 5 additions & 3 deletions gramps/plugins/gramplet/placedetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions gramps/plugins/importer/importxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/alphabeticalindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def write_report(self):
#
# ------------------------------------------------------------------------
class AlphabeticalIndexOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/ancestorreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ def write_report(self):
#
# ------------------------------------------------------------------------
class AncestorOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/custombooktext.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def write_report(self):
#
# ------------------------------------------------------------------------
class CustomTextOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/descendreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ def write_report(self):
#
# ------------------------------------------------------------------------
class DescendantOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/detancestralreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,6 @@ def endnotes(self, obj):
#
# ------------------------------------------------------------------------
class DetAncestorOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/detdescendantreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,6 @@ def endnotes(self, obj):
#
# ------------------------------------------------------------------------
class DetDescendantOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/familygroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ def write_report(self):
#
# ------------------------------------------------------------------------
class FamilyGroupOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/kinshipreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ def write_person(self, person_handle):
#
# ------------------------------------------------------------------------
class KinshipOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/placereport.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ def __get_place_handles(self, places):
#
# ------------------------------------------------------------------------
class PlaceOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/simplebooktitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def write_report(self):
#
# ------------------------------------------------------------------------
class SimpleBookTitleOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
1 change: 0 additions & 1 deletion gramps/plugins/textreport/tableofcontents.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def write_report(self):
#
# ------------------------------------------------------------------------
class TableOfContentsOptions(MenuReportOptions):

"""
Defines options and provides handling interface.
"""
Expand Down
16 changes: 10 additions & 6 deletions gramps/plugins/view/geoevents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?")
Expand Down
8 changes: 5 additions & 3 deletions gramps/plugins/webreport/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions gramps/plugins/webreport/webcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 643a553

Please sign in to comment.