refactor: big, more patterns\n\nBREAKING CHANGES

This commit is contained in:
2026-03-16 20:53:42 +03:00
parent 2105e9bc36
commit 7e0e4a0b71
5 changed files with 416 additions and 244 deletions

View File

@@ -53,7 +53,7 @@ def remove_from_list(l: list, todel: list):
return l
def parse_all_dirt(reader: "ExcelSheetReader", min_pos: Coord, right, down):
def parse_all_dirt(reader: "ExcelSheetReader", min_pos: Coord, right, down, with_cells=False):
RET = set()
row = min_pos.row
@@ -61,10 +61,9 @@ def parse_all_dirt(reader: "ExcelSheetReader", min_pos: Coord, right, down):
col = min_pos.col
while col < min_pos.col + right:
#print(excel_coordinate(row, col))
cv = reader.get_cell_value(row, col)
value = str(cv).strip()
if cv is not None and len(value) > 0:
RET.add(value)
cv = reader.cell(row, col)
if cv is not None and not cv.is_empty():
RET.add(cv if with_cells else str(cv.value))
col += 1
row += 1
@@ -165,7 +164,7 @@ def find(sh, query = None):
return None
def weekday_to_num(st: str):
if st.upper().strip() == "ПОНЕДЕЛЬНИК":
if st.upper().strip().startswith("ПОНЕД"):
return 1
if st.upper().strip() == "ВТОРНИК":
return 2
@@ -177,7 +176,7 @@ def weekday_to_num(st: str):
return 5
if st.upper().strip() == "СУББОТА":
return 6
if st.upper().strip() == "ВОСКРЕСЕНЬЕ":
if st.upper().strip().startswith("ВОСКР"):
return 7
return -1