diff --git a/.github/workflows/lint_and_test.yml b/.github/workflows/lint_and_test.yml index 1772b872..c7ff897a 100644 --- a/.github/workflows/lint_and_test.yml +++ b/.github/workflows/lint_and_test.yml @@ -17,6 +17,6 @@ jobs: pip install -r requirements.txt pip install . - name: Lint - run: pre-commit run --all-files + run: pre-commit run --all-files --show-diff-on-failure -v - name: Test run: pytest diff --git a/src/domdiv/draw.py b/src/domdiv/draw.py index 3022b6ff..1785004c 100644 --- a/src/domdiv/draw.py +++ b/src/domdiv/draw.py @@ -164,9 +164,9 @@ def __init__( 0 # Exact Centre special case, so swapping is still exact centre ) elif CardPlot.tabNumber == 1: - self.tabIndex = ( - self.tabIndexBack - ) = 1 # There is only one tab, so can only use 1 for both sides + self.tabIndex = self.tabIndexBack = ( + 1 # There is only one tab, so can only use 1 for both sides + ) elif 1 <= self.tabIndex <= CardPlot.tabNumber: self.tabIndexBack = CardPlot.tabNumber + 1 - self.tabIndex else: @@ -629,9 +629,11 @@ def registerFonts(self): pdfmetrics.registerFont( TTFont( font, - fontpath - if is_local - else pkg_resources.resource_filename("domdiv", fontpath), + ( + fontpath + if is_local + else pkg_resources.resource_filename("domdiv", fontpath) + ), ) ) registered[font] = fontpath @@ -786,9 +788,7 @@ def drawPanelOutline( line = ( plotter.LINE if lineType.lower() == "line" - else plotter.DOT - if lineType.lower() == "dot" - else NO_LINE + else plotter.DOT if lineType.lower() == "dot" else NO_LINE ) # lines ending at a midpoint (no dots) midline = NO_LINE if line == plotter.DOT else line @@ -1012,9 +1012,7 @@ def tabHeight(panelStyle, panelHeight): return ( panelHeight if panelStyle in ["tab", "strap"] - else item.tabHeight - if panelStyle == "folder" - else 0.0 + else item.tabHeight if panelStyle == "folder" else 0.0 ) headTabHeight = tabHeight(self.options.head, headHeight) @@ -1692,11 +1690,15 @@ def drawTab(self, item, panel=None, backside=False): side = ( CardPlot.CENTRE if self.options.tab_name_align == "centre" or self.wantCentreTab(card) - else CardPlot.LEFT - if self.options.tab_name_align == "left" - else CardPlot.RIGHT - if self.options.tab_name_align == "right" - else item.getClosestSide(backside=backside) + else ( + CardPlot.LEFT + if self.options.tab_name_align == "left" + else ( + CardPlot.RIGHT + if self.options.tab_name_align == "right" + else item.getClosestSide(backside=backside) + ) + ) ) # calculate x position and write text @@ -2170,24 +2172,36 @@ def calculatePages(self, cards): options.headHeight = ( 0.0 if options.head == "none" - else options.head_height * cm - if options.head_height - else options.dividerBaseHeight + options.labelHeight - if options.head == "folder" - else options.dividerBaseHeight - if options.head == "cover" - else options.labelHeight # tab or strap + else ( + options.head_height * cm + if options.head_height + else ( + options.dividerBaseHeight + options.labelHeight + if options.head == "folder" + else ( + options.dividerBaseHeight + if options.head == "cover" + else options.labelHeight + ) + ) + ) # tab or strap ) options.tailHeight = ( 0.0 if options.tail in ["none", "tab"] # not a real tab - else options.tail_height * cm - if options.tail_height - else options.dividerBaseHeight + options.labelHeight - if options.tail == "folder" - else options.dividerBaseHeight - if options.tail == "cover" - else options.labelHeight # strap + else ( + options.tail_height * cm + if options.tail_height + else ( + options.dividerBaseHeight + options.labelHeight + if options.tail == "folder" + else ( + options.dividerBaseHeight + if options.tail == "cover" + else options.labelHeight + ) + ) + ) # strap ) # Set Height