mergeron 2024.739123.8__py3-none-any.whl → 2024.739125.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 +1 -1
- mergeron/core/ftc_merger_investigations_data.py +2 -2
- mergeron/gen/enforcement_stats.py +60 -37
- {mergeron-2024.739123.8.dist-info → mergeron-2024.739125.0.dist-info}/METADATA +1 -1
- {mergeron-2024.739123.8.dist-info → mergeron-2024.739125.0.dist-info}/RECORD +6 -6
- {mergeron-2024.739123.8.dist-info → mergeron-2024.739125.0.dist-info}/WHEEL +0 -0
mergeron/__init__.py
CHANGED
|
@@ -95,7 +95,7 @@ class INVTableData(NamedTuple):
|
|
|
95
95
|
data_array: ArrayBIGINT
|
|
96
96
|
|
|
97
97
|
|
|
98
|
-
INVData: TypeAlias = Mapping[str,
|
|
98
|
+
INVData: TypeAlias = Mapping[str, Mapping[str, Mapping[str, INVTableData]]]
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
def construct_data(
|
|
@@ -228,7 +228,7 @@ def _construct_no_evidence_data(_invdata: INVData, _data_period: str, /) -> None
|
|
|
228
228
|
_invdata_sub_evid_cond_conc = _invdata[_data_period][_stats_grp]
|
|
229
229
|
|
|
230
230
|
_dtn = _table_nos_map[_invdata_evid_cond]["ByHHIandDelta"]
|
|
231
|
-
_stn0 = "Table
|
|
231
|
+
_stn0 = "Table 4.1" if _stats_grp == "ByFirmCount" else "Table 3.1"
|
|
232
232
|
_stn1, _stn2 = (_dtn.replace(".X", f".{_i}") for _i in ("1", "2"))
|
|
233
233
|
|
|
234
234
|
_invdata_sub_evid_cond_conc[_dtn] = INVTableData(
|
|
@@ -6,7 +6,7 @@ Methods to format and print summary statistics on merger enforcement patterns.
|
|
|
6
6
|
import enum
|
|
7
7
|
import shutil
|
|
8
8
|
import subprocess
|
|
9
|
-
from collections.abc import Mapping
|
|
9
|
+
from collections.abc import Mapping
|
|
10
10
|
from importlib import resources
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from types import SimpleNamespace
|
|
@@ -94,36 +94,53 @@ moe_tmpl = Template(R"""
|
|
|
94
94
|
""")
|
|
95
95
|
|
|
96
96
|
# Define the LaTeX jinja environment
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
_template_resource = resources.files(f"{_PKG_NAME}.data.jinja2_LaTeX_templates")
|
|
98
|
+
_template_folder = DATA_DIR.joinpath(_template_resource.name)
|
|
99
99
|
with resources.as_file(
|
|
100
100
|
resources.files(f"{_PKG_NAME}.data.jinja2_LaTeX_templates")
|
|
101
101
|
) as _tmpl_src:
|
|
102
|
-
if not
|
|
103
|
-
shutil.copytree(_tmpl_src,
|
|
104
|
-
|
|
105
|
-
LaTeX_jinja_env = Environment(
|
|
106
|
-
block_start_string=R"((*",
|
|
107
|
-
block_end_string="*))",
|
|
108
|
-
variable_start_string=R"\JINVAR{",
|
|
109
|
-
variable_end_string="}",
|
|
110
|
-
comment_start_string=R"((#", # r'#{',
|
|
111
|
-
comment_end_string=R"#))", # '}',
|
|
112
|
-
line_statement_prefix="##",
|
|
113
|
-
line_comment_prefix="%#",
|
|
114
|
-
trim_blocks=True,
|
|
115
|
-
lstrip_blocks=True,
|
|
116
|
-
autoescape=select_autoescape(disabled_extensions=("tex.jinja2",)),
|
|
117
|
-
loader=FileSystemLoader(_tmpl_folder),
|
|
118
|
-
)
|
|
102
|
+
if not _template_folder.is_dir():
|
|
103
|
+
shutil.copytree(_tmpl_src, _template_folder)
|
|
119
104
|
|
|
120
105
|
# Place files related to rendering LaTeX in output data directory
|
|
121
106
|
if not (_out_path := DATA_DIR.joinpath(f"{_PKG_NAME}.cls")).is_file():
|
|
122
|
-
shutil.move(
|
|
107
|
+
shutil.move(_template_folder / _out_path.name, _out_path)
|
|
123
108
|
|
|
124
109
|
# Write to LaTeX table settings file
|
|
125
110
|
if not (_DOTTEX := DATA_DIR / Rf"{_PKG_NAME}_TikZTableSettings.tex").is_file():
|
|
126
|
-
shutil.move(
|
|
111
|
+
shutil.move(_template_folder / "setup_tikz_tables.tex", _DOTTEX)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def create_jinja_env(_tmpl_folder: Path = _template_folder, /) -> Environment:
|
|
115
|
+
"""Create jinja2 environment
|
|
116
|
+
|
|
117
|
+
Loader is the FileSystemLoader initialized with the given path as
|
|
118
|
+
template folder
|
|
119
|
+
|
|
120
|
+
Parameters
|
|
121
|
+
----------
|
|
122
|
+
_tmpl_folder : Path
|
|
123
|
+
Path to template folder
|
|
124
|
+
|
|
125
|
+
Returns
|
|
126
|
+
-------
|
|
127
|
+
Environment
|
|
128
|
+
jinja2 environment
|
|
129
|
+
"""
|
|
130
|
+
return Environment(
|
|
131
|
+
block_start_string=R"((*",
|
|
132
|
+
block_end_string="*))",
|
|
133
|
+
variable_start_string=R"\JINVAR{",
|
|
134
|
+
variable_end_string="}",
|
|
135
|
+
comment_start_string=R"((#", # r'#{',
|
|
136
|
+
comment_end_string=R"#))", # '}',
|
|
137
|
+
line_statement_prefix="##",
|
|
138
|
+
line_comment_prefix="%#",
|
|
139
|
+
trim_blocks=True,
|
|
140
|
+
lstrip_blocks=True,
|
|
141
|
+
autoescape=select_autoescape(disabled_extensions=("tex.jinja2",)),
|
|
142
|
+
loader=FileSystemLoader(_tmpl_folder),
|
|
143
|
+
)
|
|
127
144
|
|
|
128
145
|
|
|
129
146
|
LTX_ARRAY_LINEEND = "\\\\\n"
|
|
@@ -829,25 +846,33 @@ def propn_ci(
|
|
|
829
846
|
|
|
830
847
|
|
|
831
848
|
def render_table_pdf(
|
|
832
|
-
|
|
849
|
+
_table_collection_design: Template,
|
|
850
|
+
_table_collection_content: StatsContainer,
|
|
851
|
+
_output_tex_path: Path,
|
|
852
|
+
/,
|
|
833
853
|
) -> None:
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
854
|
+
"""Render table collection to PDF
|
|
855
|
+
|
|
856
|
+
Parameters
|
|
857
|
+
----------
|
|
858
|
+
_table_collection_design
|
|
859
|
+
A jinja2 template for generating the LaTeX file to render
|
|
860
|
+
|
|
861
|
+
_table_collection_content
|
|
862
|
+
Content for jinja2 template
|
|
838
863
|
|
|
839
|
-
|
|
864
|
+
_output_tex_path
|
|
865
|
+
Path to LaTeX output file to render to PDF
|
|
866
|
+
"""
|
|
840
867
|
|
|
841
|
-
with
|
|
842
|
-
|
|
843
|
-
) as _table_coll_file:
|
|
844
|
-
_table_coll_file.write(
|
|
868
|
+
with _output_tex_path.open("w", encoding="utf8") as _output_tex_file:
|
|
869
|
+
_output_tex_file.write(
|
|
845
870
|
_table_collection_design.render(tmpl_data=_table_collection_content)
|
|
846
871
|
)
|
|
847
|
-
print("\n", file=
|
|
872
|
+
print("\n", file=_output_tex_file)
|
|
848
873
|
|
|
849
874
|
_run_rc = subprocess.run( # noqa: S603
|
|
850
|
-
f"latexmk -f -quiet -synctex=0 -interaction=nonstopmode -file-line-error -pdflua {
|
|
875
|
+
f"latexmk -f -quiet -synctex=0 -interaction=nonstopmode -file-line-error -pdflua {_output_tex_path}".split(),
|
|
851
876
|
check=True,
|
|
852
877
|
cwd=DATA_DIR,
|
|
853
878
|
)
|
|
@@ -855,9 +880,7 @@ def render_table_pdf(
|
|
|
855
880
|
subprocess.run("latexmk -quiet -c".split(), check=True, cwd=DATA_DIR) # noqa: S603
|
|
856
881
|
del _run_rc
|
|
857
882
|
|
|
858
|
-
print(
|
|
859
|
-
f"Tables rendered to path, {f"{Path(DATA_DIR / _table_coll_path).with_suffix(".pdf")}"}"
|
|
860
|
-
)
|
|
883
|
+
print(f"Tables rendered to path, {_output_tex_path.with_suffix(".pdf")}")
|
|
861
884
|
|
|
862
885
|
|
|
863
886
|
if __name__ == "__main__":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mergeron
|
|
3
|
-
Version: 2024.
|
|
3
|
+
Version: 2024.739125.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,8 +1,8 @@
|
|
|
1
1
|
mergeron/License.txt,sha256=7iX-y0EyjkbVJKJLS4ZKzuuE1wd0lryfsD_IytLG8lQ,1246
|
|
2
|
-
mergeron/__init__.py,sha256=
|
|
2
|
+
mergeron/__init__.py,sha256=5QKzLNoCz8V-dP_hOfOTu2hNaSyIO5Zrd2uN7DDbtOk,1479
|
|
3
3
|
mergeron/core/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
|
|
4
4
|
mergeron/core/damodaran_margin_data.py,sha256=rMrgN1Qtw572a0ftY97OOj4otq8ldlLrcOi-bcE-org,8554
|
|
5
|
-
mergeron/core/ftc_merger_investigations_data.py,sha256=
|
|
5
|
+
mergeron/core/ftc_merger_investigations_data.py,sha256=Q8d2N4brY2cwJClibwxOVfLE3WV0XZABssblGN6nOdA,28639
|
|
6
6
|
mergeron/core/guidelines_boundaries.py,sha256=sEvIIaOvWl6tMDYeZCIr8EsBioXOn9RSXKyKlmxnH-k,15610
|
|
7
7
|
mergeron/core/guidelines_boundary_functions.py,sha256=GGn5mwBWmxkqcat4Ya0D-J6-7ujosgCCK3eJ9RFWASI,29749
|
|
8
8
|
mergeron/core/guidelines_boundary_functions_extra.py,sha256=HDwwKZDWlrj3Tw-I0gHm0TCSDcIyb9jDfwbuDvK55B8,11322
|
|
@@ -23,9 +23,9 @@ mergeron/demo/visualize_empirical_margin_distribution.py,sha256=v1xFJumBX2Ooye82
|
|
|
23
23
|
mergeron/gen/__init__.py,sha256=0rfcWpKDhYE_jNsw6xKTGFJqgNtfJ-5JFxHS89CIEuI,16575
|
|
24
24
|
mergeron/gen/data_generation.py,sha256=ZwcVoAfqGTwVBL7PRil_A9kZU8DQK0eCHtsBFA1QElA,16773
|
|
25
25
|
mergeron/gen/data_generation_functions.py,sha256=bP3E0IPXINRc8s0dUxS_Wqo1byVzheZLX811A17WNbU,28571
|
|
26
|
-
mergeron/gen/enforcement_stats.py,sha256=
|
|
26
|
+
mergeron/gen/enforcement_stats.py,sha256=53ld9Qg_oZpYAoCXJg54m9wLBNycy7TwULPDJj18aHg,27940
|
|
27
27
|
mergeron/gen/upp_tests.py,sha256=yzEwWK1bVfjtBYMwXnL5uEWWRiR0_9y0wmjNMB-O3rU,12589
|
|
28
28
|
mergeron/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
29
|
-
mergeron-2024.
|
|
30
|
-
mergeron-2024.
|
|
31
|
-
mergeron-2024.
|
|
29
|
+
mergeron-2024.739125.0.dist-info/METADATA,sha256=U-7AJXiRdBMTLLzzzjPdM5CFINNPtC60fSW_ICTykU0,13976
|
|
30
|
+
mergeron-2024.739125.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
31
|
+
mergeron-2024.739125.0.dist-info/RECORD,,
|
|
File without changes
|