mergeron_extra 2024.739148.5__tar.gz → 2024.739148.6__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mergeron_extra
3
- Version: 2024.739148.5
3
+ Version: 2024.739148.6
4
4
  Summary: Tools for users of the mergeron package.
5
5
  License: MIT
6
6
  Author: Murthy Kambhampaty
@@ -15,6 +15,7 @@ Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python
16
16
  Classifier: Programming Language :: Python :: 3
17
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
18
19
  Classifier: Programming Language :: Python :: 3 :: Only
19
20
  Classifier: Programming Language :: Python :: Implementation :: CPython
20
21
  Requires-Dist: aenum (>=3.1.15,<4.0.0)
@@ -4,7 +4,7 @@ description = "Tools for users of the mergeron package."
4
4
  authors = ["Murthy Kambhampaty <smk@capeconomics.com>"]
5
5
  license = "MIT"
6
6
  readme = "README.rst"
7
- version = "2024.739148.5"
7
+ version = "2024.739148.6"
8
8
 
9
9
  classifiers = [
10
10
  "Development Status :: 4 - Beta",
@@ -147,7 +147,7 @@ preview = true
147
147
  python_version = "3.12"
148
148
  ignore_missing_imports = false
149
149
  strict = true
150
- enable_incomplete_feature = ["NewGenericSyntax", "PreciseTupleTypes"]
150
+ enable_incomplete_feature = ["PreciseTupleTypes"]
151
151
 
152
152
  show_column_numbers = true
153
153
  show_error_codes = true
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  import numpy as np
4
4
  from numpy.typing import NDArray
5
5
 
6
- VERSION = "2024.739148.5"
6
+ VERSION = "2024.739148.6"
7
7
 
8
8
  __version__ = VERSION
9
9
 
@@ -219,7 +219,7 @@ class CFmt(Enum): # type: ignore
219
219
 
220
220
  """
221
221
 
222
- return extend_enum(cls, _fmt_name, _xlsx_fmt_dict) # type: ignore
222
+ return extend_enum(cls, _fmt_name, MappingProxyType(_xlsx_fmt_dict)) # type: ignore
223
223
 
224
224
  @classmethod
225
225
  def ensure_cell_format_spec_tuple(
@@ -492,7 +492,7 @@ def array_to_sheet(
492
492
  raise _err
493
493
  elif not (
494
494
  isinstance(_data_table, Sequence | np.ndarray)
495
- and hasattr(_data_table[0], "__len__")
495
+ and isinstance(_data_table[0], Sequence | np.ndarray)
496
496
  ):
497
497
  raise ValueError("Given array must be two-dimensional array.")
498
498
 
@@ -553,9 +553,9 @@ def array_to_sheet(
553
553
  def scalar_to_sheet(
554
554
  _xl_book: Workbook,
555
555
  _xl_sheet: Worksheet,
556
- _cell_addr_0: str | int = "A1",
557
556
  /,
558
- *_s2s_args: Any,
557
+ *_s2s_args: tuple[str, Any, CFmt | Sequence[CFmt | Sequence[CFmt]] | None]
558
+ | tuple[int, int, Any, CFmt | Sequence[CFmt | Sequence[CFmt]] | None],
559
559
  ) -> None:
560
560
  """
561
561
  Write to a single cell in a worksheet.
@@ -594,21 +594,21 @@ def scalar_to_sheet(
594
594
 
595
595
  _cell_addr: tuple[str] | tuple[int, int]
596
596
  _cell_val: Any
597
- _cell_fmt: CFmt | Sequence[CFmt] | None
597
+ _cell_fmt: CFmt | Sequence[CFmt | Sequence[CFmt]] | None
598
598
 
599
- if isinstance(_cell_addr_0, str):
600
- if len(_s2s_args) not in (1, 2):
599
+ if isinstance(_s2s_args[0], str):
600
+ if len(_s2s_args) not in (2, 3):
601
601
  raise ValueError("Incorrect number of arguments.")
602
- _cell_addr = (_cell_addr_0,)
602
+ _cell_addr = (_s2s_args[0],)
603
603
  _cell_val = _s2s_args[0]
604
604
  _cell_fmt = _s2s_args[1] if len(_s2s_args) == 2 else None
605
- elif isinstance(_cell_addr_0, int):
606
- if len(_s2s_args) not in (2, 3) or not isinstance(_s2s_args[0], int):
605
+ elif isinstance(_s2s_args[0], int):
606
+ if not isinstance(_s2s_args[1], int) or len(_s2s_args) not in (3, 4):
607
607
  print(repr(_s2s_args))
608
608
  raise ValueError("Incorrect/incomplete specification for Excel cell data.")
609
- _cell_addr = (_cell_addr_0, _s2s_args[0])
610
- _cell_val = _s2s_args[1]
611
- _cell_fmt = _s2s_args[2] if len(_s2s_args) == 3 else None
609
+ _cell_addr = _s2s_args[:2]
610
+ _cell_val = _s2s_args[2]
611
+ _cell_fmt = _s2s_args[3] if len(_s2s_args) == 3 else None
612
612
  else:
613
613
  raise ValueError("Incorrect/incomplete specification for Excel cell data.")
614
614
 
@@ -617,9 +617,7 @@ def scalar_to_sheet(
617
617
  if np.ndim(_cell_val) or _cell_val in (np.inf, -np.inf, np.nan)
618
618
  else (*_cell_addr, _cell_val)
619
619
  )
620
- _write_args = (
621
- (*_write_args, CFmt.xl_fmt(_xl_book, _cell_fmt)) if _cell_fmt else _write_args
622
- )
620
+ _write_args += (CFmt.xl_fmt(_xl_book, _cell_fmt),) if _cell_fmt else ()
623
621
 
624
622
  if _cell_val is None or _cell_val == "":
625
623
  _xl_sheet.write_blank(*_write_args)