Skip to content

Commit

Permalink
Change re-defined var
Browse files Browse the repository at this point in the history
  • Loading branch information
marklit committed Aug 12, 2024
1 parent 58b9aa2 commit 5479def
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


def parse_tiff(lines:list):
stack, stack_id = {}, None
out, stack_id = {}, None

for line in lines:
if not stack_id:
Expand All @@ -28,24 +28,24 @@ def parse_tiff(lines:list):
stack_id = stack_id + 1
elif line.startswith(' ') and line.count(':') == 1:
if stack_id not in stack:
stack[stack_id] = {'stack_num': stack_id}
out[stack_id] = {'stack_num': stack_id}

x, y = line.strip().split(':')

if len(x) > 1 and not x.startswith('Tag ') and \
y and \
len(str(y).strip()) > 1:
stack[stack_id][x.strip()] = y.strip()
out[stack_id][x.strip()] = y.strip()
elif line.startswith(' ') and \
line.count(':') == 2 and \
'Image Width' in line:
if stack_id not in stack:
stack[stack_id] = {'stack_num': stack_id}
out[stack_id] = {'stack_num': stack_id}

_, width, _, _, _ = re.split(r'\: ([0-9]*)', line)
stack[stack_id]['width'] = int(width.strip())
out[stack_id]['width'] = int(width.strip())

return [y for x, y in stack.items()]
return [y for x, y in out.items()]


@app.command()
Expand Down

0 comments on commit 5479def

Please sign in to comment.