MCPcopy Create free account
hub / github.com/Image-Py/imagepy / parse

Function parse

imagepy/core/util/xlreport.py:13–36  ·  view source on GitHub ↗
(wb)

Source from the content-addressed store, hash-verified

11 pyxl.reader.excel.SUPPORTED_FORMATS += ('.rpt',)
12
13def parse(wb):
14 rst, key = [], {}
15 for ws in wb.worksheets:
16 rst.append((ws.title, []))
17 for row in ws.rows:
18 for cell in row:
19 if not isinstance(cell.value, str):continue
20 if cell.value[0]+cell.value[-1] != '{}': continue
21 cont = cell.value[1:-1].strip()
22 tp = cont.split(' ')[0]
23 cont = cont[len(tp):].strip()
24 note, value = 'no description', None
25 if '#' in cont:
26 note = cont.split('#')[-1].strip()
27 cont = cont[:cont.index('#')].strip()
28 if '=' in cont:
29 value = cont.split('=')[1].strip()
30 name = cont[:cont.index('=')].strip()
31 else: name = cont
32
33 rst[-1][-1].append(((cell.row, cell.col_idx),
34 [tp, name, value, note]))
35 key[name] = [tp, name, value, note]
36 return rst, key
37
38def trans(img, W, H, margin, scale):
39 h, w = img.shape[:2]

Callers 1

xlreport.pyFile · 0.70

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected