mergeron 2024.739088.2__py3-none-any.whl → 2024.739089.0__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.

Potentially problematic release.


This version of mergeron might be problematic. Click here for more details.

mergeron/__init__.py CHANGED
@@ -11,7 +11,7 @@ from numpy.typing import NDArray
11
11
 
12
12
  _PKG_NAME: str = Path(__file__).parent.stem
13
13
 
14
- VERSION = "2024.739088.2"
14
+ VERSION = "2024.739089.0"
15
15
 
16
16
  __version__ = VERSION
17
17
 
@@ -16,7 +16,7 @@ such as `polars` likely provide better performance.
16
16
  from __future__ import annotations
17
17
 
18
18
  from collections.abc import Mapping, Sequence
19
- from typing import Any, ClassVar
19
+ from typing import Any, ClassVar, Literal, TypeAlias, TypedDict
20
20
 
21
21
  import numpy as np
22
22
  import numpy.typing as npt
@@ -29,6 +29,88 @@ __version__ = VERSION
29
29
 
30
30
  Workbook = xlsxwriter.Workbook
31
31
 
32
+ xl_border_type: TypeAlias = Literal[
33
+ "none",
34
+ "thin",
35
+ "medium",
36
+ "dashed",
37
+ "dotted",
38
+ "thick",
39
+ "double",
40
+ "hair",
41
+ "medium_dashed",
42
+ "dash_dot",
43
+ "medium_dash_dot",
44
+ "dash_dot_dot",
45
+ "medium_dash_dot_dot",
46
+ "slant_dash_dot",
47
+ True,
48
+ False,
49
+ 0,
50
+ 1,
51
+ 2,
52
+ 3,
53
+ 4,
54
+ 5,
55
+ 6,
56
+ 7,
57
+ 8,
58
+ 9,
59
+ 10,
60
+ 11,
61
+ 12,
62
+ 13,
63
+ ]
64
+
65
+
66
+ class CFmtVal(TypedDict, total=False):
67
+ """Keys for xlsxwriter Format objects.
68
+
69
+ This is a partial list based on formats defined below.
70
+ """
71
+
72
+ font_name: str
73
+ font_size: int
74
+ font_color: str
75
+ bg_color: str # html color string, no #
76
+ align: Literal[
77
+ "left", "center", "right", "center_across", "top", "bottom", "vcenter"
78
+ ]
79
+ text_wrap: bool
80
+ rotation: int # integer, 0-360
81
+ indent: int
82
+ shrink: bool
83
+ bold: bool
84
+ italic: bool
85
+ underline: Literal[
86
+ True,
87
+ False,
88
+ 1,
89
+ 2,
90
+ 33,
91
+ 34,
92
+ "single",
93
+ "double",
94
+ "accountingSingle",
95
+ "accountingDouble",
96
+ ]
97
+ font_strikeout: bool
98
+ font_script: Literal[1, 2]
99
+
100
+ num_format: str
101
+
102
+ pattern: int
103
+
104
+ border: xl_border_type
105
+ bottom: xl_border_type
106
+ left: xl_border_type
107
+ right: xl_border_type
108
+ top: xl_border_type
109
+ bottom_color: str # html color string, no #
110
+ left_color: str # html color string, no #
111
+ right_color: str # html color string, no #
112
+ top_color: str # html color string, no #
113
+
32
114
 
33
115
  @unique
34
116
  class CFmt(dict, Enum): # type: ignore
@@ -48,51 +130,51 @@ class CFmt(dict, Enum): # type: ignore
48
130
 
49
131
  """
50
132
 
51
- XL_DEFAULT: ClassVar = {"font_name": "Calibri", "font_size": 11}
52
- XL_DEFAULT_2003: ClassVar = {"font_name": "Arial", "font_size": 10}
53
-
54
- A_CTR: ClassVar = {"align": "center"}
55
- A_CTR_ACROSS: ClassVar = {"align": "center_across"}
56
- A_LEFT: ClassVar = {"align": "left"}
57
- A_RIGHT: ClassVar = {"align": "right"}
58
- V_TOP: ClassVar = {"align": "top"}
59
- V_BOTTOM: ClassVar = {"align": "bottom"}
60
- V_CTR: ClassVar = {"align": "vcenter"}
61
-
62
- TEXT_WRAP: ClassVar = {"text_wrap": True}
63
- TEXT_ROTATE: ClassVar = {"rotation": 90}
64
- IND_1: ClassVar = {"indent": 1}
65
-
66
- BOLD: ClassVar = {"bold": True}
67
- BOLD_ITALIC: ClassVar = {"bold": True, "italic": True}
68
- ITALIC: ClassVar = {"italic": True}
69
- ULINE: ClassVar = {"underline": True}
70
- SOUT: ClassVar = {"font_strikeout": True}
133
+ XL_DEFAULT: ClassVar[CFmtVal] = {"font_name": "Calibri", "font_size": 11}
134
+ XL_DEFAULT_2003: ClassVar[CFmtVal] = {"font_name": "Arial", "font_size": 10}
135
+
136
+ A_CTR: ClassVar[CFmtVal] = {"align": "center"}
137
+ A_CTR_ACROSS: ClassVar[CFmtVal] = {"align": "center_across"}
138
+ A_LEFT: ClassVar[CFmtVal] = {"align": "left"}
139
+ A_RIGHT: ClassVar[CFmtVal] = {"align": "right"}
140
+ V_TOP: ClassVar[CFmtVal] = {"align": "top"}
141
+ V_BOTTOM: ClassVar[CFmtVal] = {"align": "bottom"}
142
+ V_CTR: ClassVar[CFmtVal] = {"align": "vcenter"}
143
+
144
+ TEXT_WRAP: ClassVar[CFmtVal] = {"text_wrap": True}
145
+ TEXT_ROTATE: ClassVar[CFmtVal] = {"rotation": 90}
146
+ IND_1: ClassVar[CFmtVal] = {"indent": 1}
147
+
148
+ BOLD: ClassVar[CFmtVal] = {"bold": True}
149
+ BOLD_ITALIC: ClassVar[CFmtVal] = {"bold": True, "italic": True}
150
+ ITALIC: ClassVar[CFmtVal] = {"italic": True}
151
+ ULINE: ClassVar[CFmtVal] = {"underline": "single"}
152
+ SOUT: ClassVar[CFmtVal] = {"font_strikeout": True}
71
153
  # Useful with write_rich_text()
72
- SUPERSCRIPT: ClassVar = {"font_script": 1}
73
- SUBSCRIPT: ClassVar = {"font_script": 2}
74
-
75
- AREA_NUM: ClassVar = ({"num_format": "0.00000000"},)
76
- DOLLAR_NUM: ClassVar = {"num_format": "[$$-409]#,##0.00"}
77
- DT_NUM: ClassVar = {"num_format": "mm/dd/yyyy"}
78
- PCT_NUM: ClassVar = {"num_format": "##0%"}
79
- PCT2_NUM: ClassVar = {"num_format": "##0.00%"}
80
- PCT4_NUM: ClassVar = {"num_format": "##0.0000%"}
81
- PCT6_NUM: ClassVar = {"num_format": "##0.000000%"}
82
- PCT8_NUM: ClassVar = {"num_format": "##0.00000000%"}
83
- QTY_NUM: ClassVar = {"num_format": "#,##0.0"}
84
-
85
- BAR_FILL: ClassVar = {"pattern": 1, "bg_color": "dfeadf"}
86
- HDR_FILL: ClassVar = {"pattern": 1, "bg_color": "bfbfbf"}
87
-
88
- LEFT_BORDER: ClassVar = {"left": 1, "left_color": "000000"}
89
- RIGHT_BORDER: ClassVar = {"right": 1, "right_color": "000000"}
90
- BOT_BORDER: ClassVar = {"bottom": 1, "bottom_color": "000000"}
91
- TOP_BORDER: ClassVar = {"top": 1, "top_color": "000000"}
92
- HDR_BORDER: ClassVar = TOP_BORDER | BOT_BORDER
154
+ SUPERSCRIPT: ClassVar[CFmtVal] = {"font_script": 1}
155
+ SUBSCRIPT: ClassVar[CFmtVal] = {"font_script": 2}
156
+
157
+ AREA_NUM: ClassVar[CFmtVal] = {"num_format": "0.00000000"}
158
+ DOLLAR_NUM: ClassVar[CFmtVal] = {"num_format": "[$$-409]#,##0.00"}
159
+ DT_NUM: ClassVar[CFmtVal] = {"num_format": "mm/dd/yyyy"}
160
+ PCT_NUM: ClassVar[CFmtVal] = {"num_format": "##0%"}
161
+ PCT2_NUM: ClassVar[CFmtVal] = {"num_format": "##0.00%"}
162
+ PCT4_NUM: ClassVar[CFmtVal] = {"num_format": "##0.0000%"}
163
+ PCT6_NUM: ClassVar[CFmtVal] = {"num_format": "##0.000000%"}
164
+ PCT8_NUM: ClassVar[CFmtVal] = {"num_format": "##0.00000000%"}
165
+ QTY_NUM: ClassVar[CFmtVal] = {"num_format": "#,##0.0"}
166
+
167
+ BAR_FILL: ClassVar[CFmtVal] = {"pattern": 1, "bg_color": "dfeadf"}
168
+ HDR_FILL: ClassVar[CFmtVal] = {"pattern": 1, "bg_color": "bfbfbf"}
169
+
170
+ LEFT_BORDER: ClassVar[CFmtVal] = {"left": 1, "left_color": "000000"}
171
+ RIGHT_BORDER: ClassVar[CFmtVal] = {"right": 1, "right_color": "000000"}
172
+ BOT_BORDER: ClassVar[CFmtVal] = {"bottom": 1, "bottom_color": "000000"}
173
+ TOP_BORDER: ClassVar[CFmtVal] = {"top": 1, "top_color": "000000"}
174
+ HDR_BORDER: ClassVar[CFmtVal] = TOP_BORDER | BOT_BORDER
93
175
 
94
176
  @classmethod
95
- def add_new(self, _fmt_name: str, _xlsx_fmt_dict: dict[str, Any], /) -> CFmt:
177
+ def add_new(self, _fmt_name: str, _xlsx_fmt_dict: CFmtVal, /) -> CFmt:
96
178
  """
97
179
  Add new CFmt object to instance.
98
180
 
@@ -297,6 +379,7 @@ def array_to_sheet(
297
379
  /,
298
380
  *,
299
381
  cell_format: Sequence[CFmt | Sequence[CFmt]] | CFmt | None = None,
382
+ empty_as_blank: bool = True,
300
383
  green_bar_flag: bool = True,
301
384
  ragged_flag: bool = True,
302
385
  ) -> tuple[int, int]:
@@ -426,7 +509,14 @@ def array_to_sheet(
426
509
  _wbk_fmt_tuple = _wbk_formats_greened if _ri % 2 else _wbk_formats
427
510
  for _ci, _cv in enumerate(_rv):
428
511
  _cf = _wbk_fmt_tuple[_ci]
429
- scalar_to_sheet(_xl_sheet, _row_id + _ri, _col_id + _ci, _cv, _cf)
512
+ scalar_to_sheet(
513
+ _xl_sheet,
514
+ _row_id + _ri,
515
+ _col_id + _ci,
516
+ _cv,
517
+ _cf,
518
+ empty_as_blank=empty_as_blank,
519
+ )
430
520
 
431
521
  _right_column_id = _col_id + _ci + 1 if _ci > _num_cols else _right_column_id
432
522
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mergeron
3
- Version: 2024.739088.2
3
+ Version: 2024.739089.0
4
4
  Summary: Merger Policy Analysis using Python
5
5
  License: MIT
6
6
  Keywords: merger policy analysis,merger guidelines,merger screening,policy presumptions,concentration standards,upward pricing pressure,GUPPI
@@ -1,5 +1,5 @@
1
1
  mergeron/License.txt,sha256=7iX-y0EyjkbVJKJLS4ZKzuuE1wd0lryfsD_IytLG8lQ,1246
2
- mergeron/__init__.py,sha256=I-4UWXBTLSC71II8rxExM8CBFXj1jkjlJg7p9JCDMA4,1647
2
+ mergeron/__init__.py,sha256=0POvvT_xzVdaCJ3-jXCSv4lcEOjhd4OH3mRnM5D_YL0,1647
3
3
  mergeron/core/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
4
4
  mergeron/core/damodaran_margin_data.py,sha256=pjI1rSK_O1-3Oel5b9KXH6ctnInjX1Vii7fypt00gV8,8541
5
5
  mergeron/core/ftc_merger_investigations_data.py,sha256=ZaV2DO7UZabV8eX0Ubq_ToIor7tIRzcvYC54ADliuTk,27931
@@ -23,7 +23,7 @@ mergeron/demo/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
23
23
  mergeron/demo/visualize_empirical_margin_distribution.py,sha256=v1xFJumBX2Ooye82kSSgly-_GpFVkYSDqBwM__rcmZY,2363
24
24
  mergeron/ext/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
25
25
  mergeron/ext/tol_colors.py,sha256=QBw8s-ZGpUpIIYOplHbLFZSXVoa6eDDJDtzSScP954E,22303
26
- mergeron/ext/xlsxw_helper.py,sha256=zCVWC7F5ZRNUCfSDwa3d8Evq7XXyoYZq4MZtU0lxJWM,15251
26
+ mergeron/ext/xlsxw_helper.py,sha256=g0C58NBAskqmmj5KkSU_E0Oiq_Br7UYf_1ONSnR59K0,17257
27
27
  mergeron/gen/__init__.py,sha256=mlZn8gud6bxP_XKSQY2c-u-C85A8U7VxUKLiXu2hMw0,16280
28
28
  mergeron/gen/_data_generation_functions.py,sha256=7fP4mSVaN36FBhPKSf1y_TbxfRUe-I7fgqdBt74oaCA,21029
29
29
  mergeron/gen/data_generation.py,sha256=gDvCZYJwGpQnokcygM7IRzHBpE5rYI2J5I8uu0_wQyE,8727
@@ -31,6 +31,6 @@ mergeron/gen/enforcement_stats.py,sha256=kpkpMbhqEGQcY2-oUYDj4N2MJ6tvBPSxVpPJne4
31
31
  mergeron/gen/market_sample.py,sha256=ekMA9db2AWvrA-GDbIieu270fovFX0JyynCo5FRAGzk,2270
32
32
  mergeron/gen/upp_tests.py,sha256=GQZcXU4vQPJRxdI2DVsY7yX6TPqhntlTH-DOAufWFmM,17197
33
33
  mergeron/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
34
- mergeron-2024.739088.2.dist-info/METADATA,sha256=swh2YNR1_UNMzgIaz-iH5QlxbwKZzeTPayWExmczuXQ,8690
35
- mergeron-2024.739088.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
- mergeron-2024.739088.2.dist-info/RECORD,,
34
+ mergeron-2024.739089.0.dist-info/METADATA,sha256=P09WcpQEw_OgSAvdatC2OcMiDHvDAGXCz5nEgF9howY,8690
35
+ mergeron-2024.739089.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
+ mergeron-2024.739089.0.dist-info/RECORD,,