numbers-parser 4.10.2__py3-none-any.whl → 4.10.3__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.
- numbers_parser/cell.py +8 -1
- numbers_parser/model.py +16 -10
- {numbers_parser-4.10.2.dist-info → numbers_parser-4.10.3.dist-info}/METADATA +2 -2
- {numbers_parser-4.10.2.dist-info → numbers_parser-4.10.3.dist-info}/RECORD +7 -7
- {numbers_parser-4.10.2.dist-info → numbers_parser-4.10.3.dist-info}/LICENSE.rst +0 -0
- {numbers_parser-4.10.2.dist-info → numbers_parser-4.10.3.dist-info}/WHEEL +0 -0
- {numbers_parser-4.10.2.dist-info → numbers_parser-4.10.3.dist-info}/entry_points.txt +0 -0
numbers_parser/cell.py
CHANGED
|
@@ -7,6 +7,7 @@ from datetime import datetime as builtin_datetime
|
|
|
7
7
|
from datetime import timedelta as builtin_timedelta
|
|
8
8
|
from enum import IntEnum
|
|
9
9
|
from fractions import Fraction
|
|
10
|
+
from hashlib import sha1
|
|
10
11
|
from os.path import basename
|
|
11
12
|
from struct import pack, unpack
|
|
12
13
|
from typing import Any, List, Tuple, Union
|
|
@@ -1139,6 +1140,7 @@ class Cell(CellStorageFlags, Cacheable):
|
|
|
1139
1140
|
preferred_filename = [x.preferred_file_name for x in datas if x.identifier == image_id][0]
|
|
1140
1141
|
all_paths = self._model.objects.file_store.keys()
|
|
1141
1142
|
image_pathnames = [x for x in all_paths if x == f"Data/{stored_filename}"]
|
|
1143
|
+
|
|
1142
1144
|
if len(image_pathnames) == 0:
|
|
1143
1145
|
warn(
|
|
1144
1146
|
f"Cannot find file '{preferred_filename}' in Numbers archive",
|
|
@@ -1146,7 +1148,12 @@ class Cell(CellStorageFlags, Cacheable):
|
|
|
1146
1148
|
stacklevel=3,
|
|
1147
1149
|
)
|
|
1148
1150
|
else:
|
|
1149
|
-
|
|
1151
|
+
image_data = self._model.objects.file_store[image_pathnames[0]]
|
|
1152
|
+
digest = sha1(image_data).digest()
|
|
1153
|
+
if digest not in self._model._images:
|
|
1154
|
+
self._model._images[digest] = image_id
|
|
1155
|
+
|
|
1156
|
+
return (image_data, preferred_filename)
|
|
1150
1157
|
|
|
1151
1158
|
def _custom_format(self) -> str: # noqa: PLR0911
|
|
1152
1159
|
if self._text_format_id is not None and self._type == CellType.TEXT:
|
numbers_parser/model.py
CHANGED
|
@@ -215,6 +215,7 @@ class _NumbersModel(Cacheable):
|
|
|
215
215
|
self._control_specs = DataLists(self, "control_cell_spec_table", "cell_spec")
|
|
216
216
|
self._table_data = {}
|
|
217
217
|
self._styles = None
|
|
218
|
+
self._images = {}
|
|
218
219
|
self._custom_formats = None
|
|
219
220
|
self._custom_format_archives = None
|
|
220
221
|
self._custom_format_ids = None
|
|
@@ -1539,17 +1540,22 @@ class _NumbersModel(Cacheable):
|
|
|
1539
1540
|
|
|
1540
1541
|
def add_cell_style(self, style: Style) -> int:
|
|
1541
1542
|
if style.bg_image is not None:
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1543
|
+
digest = sha1(style.bg_image.data).digest()
|
|
1544
|
+
if digest in self._images:
|
|
1545
|
+
image_id = self._images[digest]
|
|
1546
|
+
else:
|
|
1547
|
+
datas = self.objects[PACKAGE_ID].datas
|
|
1548
|
+
image_id = self.next_image_identifier()
|
|
1549
|
+
datas.append(
|
|
1550
|
+
TSPArchiveMessages.DataInfo(
|
|
1551
|
+
identifier=image_id,
|
|
1552
|
+
digest=digest,
|
|
1553
|
+
preferred_file_name=style.bg_image.filename,
|
|
1554
|
+
file_name=style.bg_image.filename,
|
|
1555
|
+
materialized_length=len(style.bg_image.data),
|
|
1556
|
+
)
|
|
1551
1557
|
)
|
|
1552
|
-
|
|
1558
|
+
self._images[digest] = image_id
|
|
1553
1559
|
color_attrs = {
|
|
1554
1560
|
"cell_fill": {
|
|
1555
1561
|
"image": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: numbers-parser
|
|
3
|
-
Version: 4.10.
|
|
3
|
+
Version: 4.10.3
|
|
4
4
|
Summary: Read and write Apple Numbers spreadsheets
|
|
5
5
|
Home-page: https://github.com/masaccio/numbers-parser
|
|
6
6
|
License: MIT
|
|
@@ -37,7 +37,7 @@ Description-Content-Type: text/markdown
|
|
|
37
37
|
generated by Numbers version 10.3, and up with the latest tested version being 13.2
|
|
38
38
|
(current as of September 2023).
|
|
39
39
|
|
|
40
|
-
It supports and is tested against Python versions from 3.
|
|
40
|
+
It supports and is tested against Python versions from 3.9 onwards. It is not compatible
|
|
41
41
|
with earlier versions of Python.
|
|
42
42
|
|
|
43
43
|
## Installation
|
|
@@ -2,7 +2,7 @@ numbers_parser/__init__.py,sha256=w0ZhMcFpVol1VwjyYHjvqBmshvsMDfLIyFX-GmpOpMQ,14
|
|
|
2
2
|
numbers_parser/_cat_numbers.py,sha256=-HboBJT11Vjcr8sjLZl7Z6qAapnPEc_kFYq6PTqON20,4619
|
|
3
3
|
numbers_parser/_unpack_numbers.py,sha256=U5SL16uNNe0BvYtUtIYJT-t3RN36Q8U-8UTr7lnOylw,7040
|
|
4
4
|
numbers_parser/bullets.py,sha256=OnVVMPjhTDrC-ncw52Gb00UEXNmn2Rvd3xi7lfqW3hk,2616
|
|
5
|
-
numbers_parser/cell.py,sha256=
|
|
5
|
+
numbers_parser/cell.py,sha256=q8gDmrncUpZTNx-XGfTRDToDVFudSkOMhDLMOEJU5ss,75511
|
|
6
6
|
numbers_parser/constants.py,sha256=gROxeu8wDj-a96rWy2bR_c8CoF0RagqWI3V4SE6SN4M,9908
|
|
7
7
|
numbers_parser/containers.py,sha256=EnHcsmHIFLsRiZsjhqMcJL20k6sHMsd5neVDFNUDuwc,4751
|
|
8
8
|
numbers_parser/currencies.py,sha256=8k4a3WKmDoHeurkDICymHX13N7ManHSTaka_JNXCZYA,3767
|
|
@@ -49,11 +49,11 @@ numbers_parser/generated/functionmap.py,sha256=VdZo0ERMYONcrnJFwABcSCHb8pjA4wY2o
|
|
|
49
49
|
numbers_parser/iwafile.py,sha256=xHDBZWd5EEaPHonlAAl4OYmmaXg_Nw4H0OmItt91URg,11861
|
|
50
50
|
numbers_parser/iwork.py,sha256=U0Irxt-3v3vFP_feCuYMDxWUgqeq_YHMCfw1tsDpUcM,8947
|
|
51
51
|
numbers_parser/mapping.py,sha256=in8W3S8DmTcPefFaxnATLw0FQ4YnFsnAE-cl5dljzJE,32215
|
|
52
|
-
numbers_parser/model.py,sha256=
|
|
52
|
+
numbers_parser/model.py,sha256=0DKFurS9DSLwdIvij4Zz5CjDDvlYC4ZlN2DnoxW4nIU,97058
|
|
53
53
|
numbers_parser/numbers_cache.py,sha256=1ghEBghQAYFpPiEeOtb74i016mXc039v1pOubbqvaLs,1141
|
|
54
54
|
numbers_parser/numbers_uuid.py,sha256=-LeAj_ULC0va57pEmyegGY0xXqkNNjyuLukCaiQJhOk,2642
|
|
55
|
-
numbers_parser-4.10.
|
|
56
|
-
numbers_parser-4.10.
|
|
57
|
-
numbers_parser-4.10.
|
|
58
|
-
numbers_parser-4.10.
|
|
59
|
-
numbers_parser-4.10.
|
|
55
|
+
numbers_parser-4.10.3.dist-info/LICENSE.rst,sha256=8vTa1-5KSdHrTpU9rlheO5005EWReEPMpjV7BjSaMc4,1050
|
|
56
|
+
numbers_parser-4.10.3.dist-info/METADATA,sha256=CNp5aHpYLS0CehOLWXXE-vE4hl3w6qVsaEEZagB6RCE,16267
|
|
57
|
+
numbers_parser-4.10.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
58
|
+
numbers_parser-4.10.3.dist-info/entry_points.txt,sha256=V91uB9vBPxf3eCY1h-0syv21imYCT0MJfMxf87DmwIk,115
|
|
59
|
+
numbers_parser-4.10.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|