numbers-parser 4.9.0__py3-none-any.whl → 4.9.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.
@@ -1226,6 +1226,13 @@ class Table(Cacheable): # noqa: F811
1226
1226
  decimal_places=3,
1227
1227
  negative_style=NegativeNumberStyle.RED
1228
1228
  )
1229
+ table.set_cell_formatting(
1230
+ 3,
1231
+ 0,
1232
+ "popup",
1233
+ popup_values=["Cat", "Dog", "Rabbit"],
1234
+ allow_none=True
1235
+ )
1229
1236
 
1230
1237
  :Parameters:
1231
1238
  * **args** (*list*, *optional*) – Positional arguments for cell reference and data format type (see below)
@@ -1243,6 +1250,8 @@ class Table(Cacheable): # noqa: F811
1243
1250
  :Raises:
1244
1251
  * **TypeError** -
1245
1252
  If a tickbox is chosen for anything other than ``bool`` values.
1253
+ * **IndexError** -
1254
+ If the current cell value does not match a list of popup items.
1246
1255
 
1247
1256
  :Warns:
1248
1257
  * **RuntimeWarning** -
@@ -1421,13 +1430,19 @@ class Table(Cacheable): # noqa: F811
1421
1430
  else False
1422
1431
  )
1423
1432
  except (KeyError, AttributeError):
1433
+ control_format = kwargs["control_format"]
1424
1434
  raise TypeError(
1425
- "unsupported number format '{control_format}' for format_type_name"
1435
+ f"unsupported number format '{control_format}' for {format_type_name}"
1426
1436
  ) from None
1427
1437
  else:
1428
1438
  number_format_type = FormattingType.NUMBER
1429
1439
  format_id = self._model.format_archive(self._table_id, number_format_type, format)
1430
1440
  elif format_type_name == "popup":
1441
+ if cell.value not in format.popup_values:
1442
+ raise IndexError(
1443
+ f"current cell value '{cell.value}' does not match any popup values"
1444
+ )
1445
+
1431
1446
  popup_format_type = FormattingType.TEXT if isinstance(cell, TextCell) else True
1432
1447
  format_id = self._model.format_archive(self._table_id, popup_format_type, format)
1433
1448
  else:
numbers_parser/model.py CHANGED
@@ -1739,7 +1739,9 @@ class _NumbersModel(Cacheable):
1739
1739
  cell_type = TSTArchives.durationCellType
1740
1740
  value = value = pack("<d", float(cell.value.total_seconds()))
1741
1741
  elif isinstance(cell, EmptyCell):
1742
- if cell._style is not None:
1742
+ if cell._style is not None or (
1743
+ cell._storage is not None and cell._storage.control_id is not None
1744
+ ):
1743
1745
  flags = 0
1744
1746
  cell_type = TSTArchives.emptyCellValueType
1745
1747
  value = b""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: numbers-parser
3
- Version: 4.9.0
3
+ Version: 4.9.2
4
4
  Summary: Read and write Apple Numbers spreadsheets
5
5
  Home-page: https://github.com/masaccio/numbers-parser
6
6
  License: MIT
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
18
18
  Requires-Dist: compact-json (>=1.1.3,<2.0.0)
19
+ Requires-Dist: enum-tools (>=0.11.0,<0.12.0)
19
20
  Requires-Dist: importlib-resources (>=6.1.1,<7.0.0)
20
21
  Requires-Dist: pendulum (>=3.0,<4.0)
21
22
  Requires-Dist: protobuf (>=4.21.1,<5.0.0)
@@ -8,7 +8,7 @@ numbers_parser/constants.py,sha256=BJGNz0ZZCs5xfAXlzLox4tvKOHIpDMXgJQ6i5yvdr4A,9
8
8
  numbers_parser/containers.py,sha256=yR_T2yF5QiVj7Dg22nCMLvo___Xrec3j8kitbxiaWyU,4220
9
9
  numbers_parser/currencies.py,sha256=8k4a3WKmDoHeurkDICymHX13N7ManHSTaka_JNXCZYA,3767
10
10
  numbers_parser/data/empty.numbers,sha256=8JOp035V-p2ff9_Wao7mLcYvb6_if6O2cus_esjVA9k,90316
11
- numbers_parser/document.py,sha256=JmGyafm10FXnS5zmXkMTRVvYM-KnCKtcmbNCwMDyuSU,55333
11
+ numbers_parser/document.py,sha256=7dL6-pX1BSEIWsmIXaHLWvc34m4kjDywSKim_H3CezY,55908
12
12
  numbers_parser/exceptions.py,sha256=G8dASUQZI8ksHYRVfdGWJzgsJD5CBpcZvmDJUZTqT-c,670
13
13
  numbers_parser/experimental.py,sha256=WARjTa-2ePb8Ga8Q6oDP6EJCs12ofLRF2YpwzUu66ZI,374
14
14
  numbers_parser/file.py,sha256=buNbZRzQCIlr7H4JxwTh2_eh7oDA2fGH5ZiFpIEVHoo,4200
@@ -50,11 +50,11 @@ numbers_parser/generated/fontmap.py,sha256=pqc1HwwTr3UbFMmhUaHJg1dX5-3pXbyhfS2bk
50
50
  numbers_parser/generated/functionmap.py,sha256=VdZo0ERMYONcrnJFwABcSCHb8pjA4wY2ogt8Janz57M,6082
51
51
  numbers_parser/iwafile.py,sha256=MuFIlB_hdXTTZflxoX_ZvA_68OaJkmRQ4eJ2UAiCKXQ,11833
52
52
  numbers_parser/mapping.py,sha256=in8W3S8DmTcPefFaxnATLw0FQ4YnFsnAE-cl5dljzJE,32215
53
- numbers_parser/model.py,sha256=qvU0RRF4YgUcfhtRlDdRP09gl8rUY0GNgeHpOTJYvHk,103312
53
+ numbers_parser/model.py,sha256=4kRGh9M7AynD85S-GzYO7xekCH-WGg-iM_ccGpXP8D0,103414
54
54
  numbers_parser/numbers_cache.py,sha256=1ghEBghQAYFpPiEeOtb74i016mXc039v1pOubbqvaLs,1141
55
55
  numbers_parser/numbers_uuid.py,sha256=-LeAj_ULC0va57pEmyegGY0xXqkNNjyuLukCaiQJhOk,2642
56
- numbers_parser-4.9.0.dist-info/LICENSE.rst,sha256=8vTa1-5KSdHrTpU9rlheO5005EWReEPMpjV7BjSaMc4,1050
57
- numbers_parser-4.9.0.dist-info/METADATA,sha256=RWBbYXp1YHBV7Jj4Q6C_RwXIA_-JEi55l6o1A7G9r4w,16152
58
- numbers_parser-4.9.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
59
- numbers_parser-4.9.0.dist-info/entry_points.txt,sha256=V91uB9vBPxf3eCY1h-0syv21imYCT0MJfMxf87DmwIk,115
60
- numbers_parser-4.9.0.dist-info/RECORD,,
56
+ numbers_parser-4.9.2.dist-info/LICENSE.rst,sha256=8vTa1-5KSdHrTpU9rlheO5005EWReEPMpjV7BjSaMc4,1050
57
+ numbers_parser-4.9.2.dist-info/METADATA,sha256=HR2Ozrv4UIKuebrQmZVoTA5B-mVCMLXhf5DTlf5YuA0,16197
58
+ numbers_parser-4.9.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
59
+ numbers_parser-4.9.2.dist-info/entry_points.txt,sha256=V91uB9vBPxf3eCY1h-0syv21imYCT0MJfMxf87DmwIk,115
60
+ numbers_parser-4.9.2.dist-info/RECORD,,