Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Commit a7d1d44

Browse files
tomprogrammerbosd
authored andcommitted
Remove redundant conditions on Cell.vspan/hspan
The condition `hspan and not left` expands to `(not left or not right) and not left` which simplifies to `not left`. After this change `Cell.hspan` and `Cell.vspan` aren't used anymore in this codebase. They stay because they are part of the API.
1 parent c2e2d77 commit a7d1d44

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

camelot/parsers/lattice.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,19 @@ def _shift_index(
145145
tuple
146146
New row and column indices after the shift.
147147
"""
148-
if direction == "l" and table.cells[r_idx][c_idx].hspan:
148+
if direction == "l":
149149
while c_idx > 0 and not table.cells[r_idx][c_idx].left:
150150
c_idx -= 1
151-
elif direction == "r" and table.cells[r_idx][c_idx].hspan:
151+
elif direction == "r":
152152
while (
153153
c_idx < len(table.cells[r_idx]) - 1
154154
and not table.cells[r_idx][c_idx].right
155155
):
156156
c_idx += 1
157-
elif direction == "t" and table.cells[r_idx][c_idx].vspan:
157+
elif direction == "t":
158158
while r_idx > 0 and not table.cells[r_idx][c_idx].top:
159159
r_idx -= 1
160-
elif direction == "b" and table.cells[r_idx][c_idx].vspan:
160+
elif direction == "b":
161161
while r_idx < len(table.cells) - 1 and not table.cells[r_idx][c_idx].bottom:
162162
r_idx += 1
163163

0 commit comments

Comments
 (0)