File size: 966 Bytes
f05d877
 
18399c7
 
 
 
 
 
 
 
 
 
f05d877
 
 
 
 
3ea1220
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
011e50b
 
 
 
 
 
 
 
3ea1220
 
 
 
 
f05d877
 
 
 
 
 
 
011e50b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""Shared data types."""

from __future__ import annotations

from typing import NamedTuple, TypedDict

try:
  # Python < 3.11
  from typing_extensions import NotRequired
except ImportError:  # pragma: no cover
  # Python >= 3.11
  from typing import NotRequired


class ImageItem(TypedDict):
  url: str
  name: str
  sheet: NotRequired[str]
  row: NotRequired[int]
  column: NotRequired[str]


class DuplicateRecord(TypedDict):
  url: str
  sheet: str
  row: int
  column: str
  name: str
  original_sheet: str
  original_row: int
  original_column: str
  original_name: str


class WhiteBackgroundRecord(TypedDict):
  url: str
  name: str
  sheet: str
  row: int
  column: str


class WorkbookParseResult(NamedTuple):
  items: list[ImageItem]
  summary: str
  duplicates: list[DuplicateRecord]
  duplicates_text: str


class ProcessResult(NamedTuple):
  files: list[str] | None
  zip_path: str | None
  message: str
  tmp_dir: str | None
  white_bg_text: str = ""