ImagePRO-Python 1.0.1__py3-none-any.whl → 1.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ImagePRO/utils/result.py CHANGED
@@ -135,12 +135,23 @@ class Result:
135
135
  try:
136
136
  with out_path.open("w", newline="", encoding="utf-8") as f:
137
137
  writer = csv.writer(f)
138
- if isinstance(payload, list) and payload and all(isinstance(i, (list, tuple)) for i in payload):
139
- writer.writerows(payload)
140
- elif isinstance(payload, (list, tuple)):
141
- writer.writerow(list(payload))
138
+ if isinstance(payload, (list, tuple)):
139
+ writer.writerows(flatten_rows(payload))
142
140
  else:
143
141
  writer.writerow([payload])
144
142
  except Exception as exc:
145
143
  raise IOError(f"Failed to write CSV to {out_path}: {exc}") from exc
146
144
  return self
145
+
146
+ def flatten_rows(data):
147
+ """Flatten any nested lists/tuples into rows suitable for CSV writing."""
148
+ rows = []
149
+ for item in data:
150
+ if isinstance(item, (list, tuple)):
151
+ if item and all(isinstance(x, (list, tuple)) for x in item):
152
+ rows.extend(flatten_rows(item))
153
+ else:
154
+ rows.append(list(item))
155
+ else:
156
+ rows.append([item])
157
+ return rows
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ImagePRO-Python
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Professional & modular image processing library with OpenCV, MediaPipe, and YOLO integration.
5
5
  Author-email: Parsa Safaie <parsasafaie.2568@proton.me>
6
6
  License: MIT
@@ -22,9 +22,9 @@ ImagePRO/pre_processing/rotate.py,sha256=kdauqCpn71Yube351o1tmQFyxcj2cjTs0ZJflxs
22
22
  ImagePRO/pre_processing/sharpen.py,sha256=kW9KVXvQ77qezBfUWH7loqstQqJ2QvK7s0gtwoxR4EI,3285
23
23
  ImagePRO/utils/__init__.py,sha256=McVd-o9KtKOpAVYbLi19KxsatPPFFF-Qbt0gdgY3Ln8,170
24
24
  ImagePRO/utils/image.py,sha256=ofzJ5TevUrq8pRwIW7i7zYR4a9IByWPwec1YT4xft3A,3550
25
- ImagePRO/utils/result.py,sha256=ibno72HzeWTBdw9JlvrdJuinxmiZNxaMSzwcSiutGOE,5333
26
- imagepro_python-1.0.1.dist-info/licenses/LICENSE,sha256=sehkHN7dbe5umrINZJyJjIf9VTemZSgTfJlq6iIsbJQ,1069
27
- imagepro_python-1.0.1.dist-info/METADATA,sha256=4QNy2LwiZ8ssL7XHCNGIHVLkNcmFC9qyXuyGpAUxNAE,1456
28
- imagepro_python-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
- imagepro_python-1.0.1.dist-info/top_level.txt,sha256=UOuPzsoWrVKXgUupOSI96shJ6wE8Fhz-8bm8oMlLC3s,9
30
- imagepro_python-1.0.1.dist-info/RECORD,,
25
+ ImagePRO/utils/result.py,sha256=DAFaFZ5jZZ7C2YrhRs6h2PAei6Mbv1Mu8xX_2NQ7c6Y,5605
26
+ imagepro_python-1.0.2.dist-info/licenses/LICENSE,sha256=sehkHN7dbe5umrINZJyJjIf9VTemZSgTfJlq6iIsbJQ,1069
27
+ imagepro_python-1.0.2.dist-info/METADATA,sha256=JuEH1MNcg0bijHw68QKqkXSEPQa3C8xHL7uIAEcgUxI,1456
28
+ imagepro_python-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ imagepro_python-1.0.2.dist-info/top_level.txt,sha256=UOuPzsoWrVKXgUupOSI96shJ6wE8Fhz-8bm8oMlLC3s,9
30
+ imagepro_python-1.0.2.dist-info/RECORD,,