numbers-parser 4.14.2__py3-none-any.whl → 4.14.4__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/_cat_numbers.py +15 -6
- numbers_parser/document.py +4 -3
- numbers_parser/model.py +6 -3
- {numbers_parser-4.14.2.dist-info → numbers_parser-4.14.4.dist-info}/METADATA +11 -28
- {numbers_parser-4.14.2.dist-info → numbers_parser-4.14.4.dist-info}/RECORD +8 -8
- {numbers_parser-4.14.2.dist-info → numbers_parser-4.14.4.dist-info}/WHEEL +1 -1
- {numbers_parser-4.14.2.dist-info → numbers_parser-4.14.4.dist-info}/LICENSE.rst +0 -0
- {numbers_parser-4.14.2.dist-info → numbers_parser-4.14.4.dist-info}/entry_points.txt +0 -0
numbers_parser/_cat_numbers.py
CHANGED
|
@@ -5,7 +5,15 @@ import sys
|
|
|
5
5
|
|
|
6
6
|
from sigfig import round as sigfig
|
|
7
7
|
|
|
8
|
-
from numbers_parser import
|
|
8
|
+
from numbers_parser import (
|
|
9
|
+
Document,
|
|
10
|
+
ErrorCell,
|
|
11
|
+
FileError,
|
|
12
|
+
FileFormatError,
|
|
13
|
+
NumberCell,
|
|
14
|
+
UnsupportedError,
|
|
15
|
+
_get_version,
|
|
16
|
+
)
|
|
9
17
|
from numbers_parser import __name__ as numbers_parser_name
|
|
10
18
|
from numbers_parser.constants import MAX_SIGNIFICANT_DIGITS
|
|
11
19
|
from numbers_parser.experimental import _enable_experimental_features
|
|
@@ -137,11 +145,12 @@ def main() -> None:
|
|
|
137
145
|
print_table_names(filename)
|
|
138
146
|
else:
|
|
139
147
|
print_table(args, filename)
|
|
140
|
-
except FileFormatError as e: # noqa: PERF203
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
148
|
+
except (FileFormatError, FileError, UnsupportedError) as e: # noqa: PERF203
|
|
149
|
+
err_str = str(e)
|
|
150
|
+
if filename in err_str:
|
|
151
|
+
print(err_str, file=sys.stderr)
|
|
152
|
+
else:
|
|
153
|
+
print(f"{filename}: {err_str}", file=sys.stderr)
|
|
145
154
|
sys.exit(1)
|
|
146
155
|
|
|
147
156
|
|
numbers_parser/document.py
CHANGED
|
@@ -283,7 +283,7 @@ class Document:
|
|
|
283
283
|
|
|
284
284
|
long_date = doc.add_custom_format(
|
|
285
285
|
name="Long Date",
|
|
286
|
-
type="
|
|
286
|
+
type="datetime",
|
|
287
287
|
date_time_format="EEEE, d MMMM yyyy"
|
|
288
288
|
)
|
|
289
289
|
table.set_cell_formatting("C1", "custom", format=long_date)
|
|
@@ -1303,7 +1303,8 @@ class Table(Cacheable):
|
|
|
1303
1303
|
if (
|
|
1304
1304
|
cell.is_merged
|
|
1305
1305
|
and ((side == "right" and cell.size[1] > 1) or (side == "bottom" and cell.size[0] > 1))
|
|
1306
|
-
|
|
1306
|
+
) or (
|
|
1307
|
+
isinstance(cell, MergedCell)
|
|
1307
1308
|
and (
|
|
1308
1309
|
(side == "top" and cell.row_start < row)
|
|
1309
1310
|
or (side == "right" and cell.col_end > col)
|
|
@@ -1342,7 +1343,7 @@ class Table(Cacheable):
|
|
|
1342
1343
|
|
|
1343
1344
|
table.set_cell_formatting(
|
|
1344
1345
|
"C1",
|
|
1345
|
-
"
|
|
1346
|
+
"datetime",
|
|
1346
1347
|
date_time_format="EEEE, d MMMM yyyy"
|
|
1347
1348
|
)
|
|
1348
1349
|
table.set_cell_formatting(
|
numbers_parser/model.py
CHANGED
|
@@ -706,7 +706,10 @@ class _NumbersModel(Cacheable):
|
|
|
706
706
|
@cache(num_args=2)
|
|
707
707
|
def table_string(self, table_id: int, key: int) -> str:
|
|
708
708
|
"""Return the string associated with a string ID for a particular table."""
|
|
709
|
-
|
|
709
|
+
try:
|
|
710
|
+
return self._table_strings.lookup_value(table_id, key).string
|
|
711
|
+
except KeyError:
|
|
712
|
+
return ""
|
|
710
713
|
|
|
711
714
|
def init_table_strings(self, table_id: int) -> None:
|
|
712
715
|
"""Cache table strings reference and delete all existing keys/values."""
|
|
@@ -1984,7 +1987,7 @@ class _NumbersModel(Cacheable):
|
|
|
1984
1987
|
payload = self.objects[entry.rich_text_payload.identifier]
|
|
1985
1988
|
payload_storage = self.objects[payload.storage.identifier]
|
|
1986
1989
|
smartfield_entries = payload_storage.table_smartfield.entries
|
|
1987
|
-
cell_text = payload_storage.text[0]
|
|
1990
|
+
cell_text = payload_storage.text[0] if len(payload_storage.text) > 0 else ""
|
|
1988
1991
|
|
|
1989
1992
|
hyperlinks = []
|
|
1990
1993
|
for i, e in enumerate(smartfield_entries):
|
|
@@ -2457,7 +2460,7 @@ def node_to_col_ref(node: object, table_name: str, col: int) -> str:
|
|
|
2457
2460
|
def node_to_row_ref(node: object, table_name: str, row: int) -> str:
|
|
2458
2461
|
row = node.AST_row.row if node.AST_row.absolute else row + node.AST_row.row
|
|
2459
2462
|
|
|
2460
|
-
row_name = f"${row+1}" if node.AST_row.absolute else f"{row+1}"
|
|
2463
|
+
row_name = f"${row + 1}" if node.AST_row.absolute else f"{row + 1}"
|
|
2461
2464
|
if table_name is not None:
|
|
2462
2465
|
return f"{table_name}::{row_name}:{row_name}"
|
|
2463
2466
|
return f"{row_name}:{row_name}"
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: numbers-parser
|
|
3
|
-
Version: 4.14.
|
|
3
|
+
Version: 4.14.4
|
|
4
4
|
Summary: Read and write Apple Numbers spreadsheets
|
|
5
|
-
Home-page: https://github.com/masaccio/numbers-parser
|
|
6
5
|
License: MIT
|
|
7
6
|
Author: Jon Connell
|
|
8
7
|
Author-email: python@figsandfudge.com
|
|
@@ -14,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
|
|
18
18
|
Requires-Dist: compact-json (>=1.1.3,<2.0.0)
|
|
19
19
|
Requires-Dist: enum-tools (>=0.11)
|
|
@@ -40,38 +40,20 @@ with earlier versions of Python.
|
|
|
40
40
|
|
|
41
41
|
## Installation
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
python3 -m pip install numbers-parser
|
|
45
|
-
```
|
|
43
|
+
A pre-requisite for this package is [python-snappy](https://pypi.org/project/python-snappy/) which will be installed by Python automatically, but python-snappy also requires binary libraries for snappy compression.
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
which will be installed by Python automatically, but python-snappy also requires that the binary
|
|
49
|
-
libraries for snappy compression are present.
|
|
50
|
-
|
|
51
|
-
The most straightforward way to install the binary dependencies is to use
|
|
52
|
-
[Homebrew](https://brew.sh) and source Python from Homebrew rather than from macOS as described
|
|
53
|
-
in the [python-snappy github](https://github.com/andrix/python-snappy):
|
|
54
|
-
|
|
55
|
-
For Intel Macs:
|
|
45
|
+
The most straightforward way to install the binary dependencies is to use [Homebrew](https://brew.sh) and source Python from Homebrew rather than from macOS as described in the [python-snappy github](https://github.com/andrix/python-snappy). Using [pipx](https://pipx.pypa.io/stable/installation/) for package management is also strongly recommended:
|
|
56
46
|
|
|
57
47
|
```bash
|
|
58
|
-
brew install snappy python3
|
|
59
|
-
|
|
60
|
-
python3 -m pip install python-snappy
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
For Apple Silicon Macs:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
brew install snappy python3
|
|
67
|
-
CPPFLAGS="-I/opt/homebrew/include -L/opt/homebrew/lib" \
|
|
68
|
-
python3 -m pip install python-snappy
|
|
48
|
+
brew install snappy python3 pipx
|
|
49
|
+
pipx install numbers-parser
|
|
69
50
|
```
|
|
70
51
|
|
|
71
52
|
For Linux (your package manager may be different):
|
|
72
53
|
|
|
73
54
|
```bash
|
|
74
55
|
sudo apt-get -y install libsnappy-dev
|
|
56
|
+
python3 -m pip install numbers-parser
|
|
75
57
|
```
|
|
76
58
|
|
|
77
59
|
On Windows, you will need to either arrange for snappy to be found for VSC++ or you can install python
|
|
@@ -80,6 +62,7 @@ for Windows on Arm. There appear to be no x86 pre-compiled packages for Windows.
|
|
|
80
62
|
|
|
81
63
|
```text
|
|
82
64
|
pip install python_snappy-0.6.1-cp312-cp312-win_arm64.whl
|
|
65
|
+
python3 -m pip install numbers-parser
|
|
83
66
|
```
|
|
84
67
|
|
|
85
68
|
## Quick Start
|
|
@@ -272,7 +255,7 @@ Cell formats are changed using
|
|
|
272
255
|
```python
|
|
273
256
|
table.set_cell_formatting(
|
|
274
257
|
"C1",
|
|
275
|
-
"
|
|
258
|
+
"datetime",
|
|
276
259
|
date_time_format="EEEE, d MMMM yyyy"
|
|
277
260
|
)
|
|
278
261
|
table.set_cell_formatting(
|
|
@@ -295,7 +278,7 @@ before assigning it to cells using
|
|
|
295
278
|
```python
|
|
296
279
|
long_date = doc.add_custom_format(
|
|
297
280
|
name="Long Date",
|
|
298
|
-
type="
|
|
281
|
+
type="datetime",
|
|
299
282
|
date_time_format="EEEE, d MMMM yyyy"
|
|
300
283
|
)
|
|
301
284
|
table.set_cell_formatting("C1", "custom", format=long_date)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
numbers_parser/__init__.py,sha256=a5CkU3_Fn41rHS0DN8u8se0iz2JhvmggRHmSh-akn5o,1428
|
|
2
|
-
numbers_parser/_cat_numbers.py,sha256=
|
|
2
|
+
numbers_parser/_cat_numbers.py,sha256=LQDBHLdVP8JIk0heV50T0Xz1oOMVNGILaX2mk8pVhCg,4846
|
|
3
3
|
numbers_parser/_csv2numbers.py,sha256=R_13gVe_RfLWLOv-DzVJ60xkqhdOA-RKna-Ce5ud4V8,14624
|
|
4
4
|
numbers_parser/_unpack_numbers.py,sha256=KvY04wqTH6JPwZWHAW1VlcY1HZQvXq-U5THEG7Au0mY,7045
|
|
5
5
|
numbers_parser/bullets.py,sha256=CKMjSYRzLM123wQNDG8B5vfodRLjW5UOc2HDPlvfNr4,2637
|
|
@@ -8,7 +8,7 @@ numbers_parser/constants.py,sha256=JyTKQCnmEP6eNUQpk7eWQYlygTgUhVD7G6Std6426xs,1
|
|
|
8
8
|
numbers_parser/containers.py,sha256=SBD99t0ABHraGA8729jPXy5VcRHT21U_WM3ijOIiwd4,4886
|
|
9
9
|
numbers_parser/currencies.py,sha256=8k4a3WKmDoHeurkDICymHX13N7ManHSTaka_JNXCZYA,3767
|
|
10
10
|
numbers_parser/data/empty.numbers,sha256=zQjVqcNGN-xNZh51_eAxD8Zxmxh88Sd7kpf4JygUA_E,90601
|
|
11
|
-
numbers_parser/document.py,sha256=
|
|
11
|
+
numbers_parser/document.py,sha256=oOw8Gag6z_lJyAhI3WcYi-RZb2k7N4I0Nj4wi1aLMFM,59114
|
|
12
12
|
numbers_parser/exceptions.py,sha256=51yJTYm0X2am4YK-F6sVYOHmlYrBex_e4lYtbmiQX3I,611
|
|
13
13
|
numbers_parser/experimental.py,sha256=WARjTa-2ePb8Ga8Q6oDP6EJCs12ofLRF2YpwzUu66ZI,374
|
|
14
14
|
numbers_parser/formula.py,sha256=yRGSrd0Jrv_pgwtfokYRI2rZwUyTMYIV_Icm_8dj_P8,10759
|
|
@@ -51,12 +51,12 @@ numbers_parser/generated/functionmap.py,sha256=9OLSNlOVWxRO9xS8QZmK1HURpc11c1B5n
|
|
|
51
51
|
numbers_parser/generated/mapping.py,sha256=bJS_CK3AXXMFUSoSWbeDt6VTbCqIfX9OnTKLr0qDezA,32288
|
|
52
52
|
numbers_parser/iwafile.py,sha256=nVwCcXvx8TgX-DkYqSbcJQzKyXR1Z8_y547XeY7Y-fs,11948
|
|
53
53
|
numbers_parser/iwork.py,sha256=Qx1Izf9cfQKnLTDiJyeCOsmL9PSsfV-XOf0Kkb2oPMo,9396
|
|
54
|
-
numbers_parser/model.py,sha256=
|
|
54
|
+
numbers_parser/model.py,sha256=to4WRFIxJ-Y4tqViSocCKzut7GxeyGHFQiYjPSI7CZc,107120
|
|
55
55
|
numbers_parser/numbers_cache.py,sha256=wJHEGQfCbRvX94xL2Uehlz5UjTr8n4nBgutCw_4Dbis,1098
|
|
56
56
|
numbers_parser/numbers_uuid.py,sha256=d5-Hwu-lWbBPuIP6vybNBuVzzja5HeuKsgK_PvMSw9c,2735
|
|
57
57
|
numbers_parser/roman.py,sha256=CErv1uRp8eE9Bsuh_QsrBAzKFsfHSEs8CHpfFW0Gd70,725
|
|
58
|
-
numbers_parser-4.14.
|
|
59
|
-
numbers_parser-4.14.
|
|
60
|
-
numbers_parser-4.14.
|
|
61
|
-
numbers_parser-4.14.
|
|
62
|
-
numbers_parser-4.14.
|
|
58
|
+
numbers_parser-4.14.4.dist-info/LICENSE.rst,sha256=8vTa1-5KSdHrTpU9rlheO5005EWReEPMpjV7BjSaMc4,1050
|
|
59
|
+
numbers_parser-4.14.4.dist-info/METADATA,sha256=9NuTYRjqnWEMdiVFU0xWstijfsNzidvOsk1FD9yDzO8,22889
|
|
60
|
+
numbers_parser-4.14.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
61
|
+
numbers_parser-4.14.4.dist-info/entry_points.txt,sha256=8VSxWAamOAvVcKS6iza4BQtYe03nga552HMLcVY-MBc,160
|
|
62
|
+
numbers_parser-4.14.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|