mergeron 2024.739123.8__tar.gz → 2024.739125.0__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.

Potentially problematic release.


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

Files changed (31) hide show
  1. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/PKG-INFO +1 -1
  2. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/pyproject.toml +1 -1
  3. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/__init__.py +1 -1
  4. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/core/ftc_merger_investigations_data.py +2 -2
  5. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/gen/enforcement_stats.py +60 -37
  6. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/README.rst +0 -0
  7. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/License.txt +0 -0
  8. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/core/__init__.py +0 -0
  9. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/core/damodaran_margin_data.py +0 -0
  10. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/core/guidelines_boundaries.py +0 -0
  11. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/core/guidelines_boundary_functions.py +0 -0
  12. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/core/guidelines_boundary_functions_extra.py +0 -0
  13. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/core/pseudorandom_numbers.py +0 -0
  14. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/__init__.py +0 -0
  15. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/damodaran_margin_data.xls +0 -0
  16. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/damodaran_margin_data_dict.msgpack +0 -0
  17. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/ftc_invdata.msgpack +0 -0
  18. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/jinja2_LaTeX_templates/clrrate_cis_summary_table_template.tex.jinja2 +0 -0
  19. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_byhhianddelta_table_template.tex.jinja2 +0 -0
  20. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summary_table_template.tex.jinja2 +0 -0
  21. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template.tex.jinja2 +0 -0
  22. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/jinja2_LaTeX_templates/mergeron.cls +0 -0
  23. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/jinja2_LaTeX_templates/mergeron_table_collection_template.tex.jinja2 +0 -0
  24. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.tex +0 -0
  25. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/demo/__init__.py +0 -0
  26. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/demo/visualize_empirical_margin_distribution.py +0 -0
  27. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/gen/__init__.py +0 -0
  28. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/gen/data_generation.py +0 -0
  29. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/gen/data_generation_functions.py +0 -0
  30. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/gen/upp_tests.py +0 -0
  31. {mergeron-2024.739123.8 → mergeron-2024.739125.0}/src/mergeron/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mergeron
3
- Version: 2024.739123.8
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
@@ -13,7 +13,7 @@ keywords = [
13
13
  "upward pricing pressure",
14
14
  "GUPPI",
15
15
  ]
16
- version = "2024.739123.8"
16
+ version = "2024.739125.0"
17
17
 
18
18
  # Classifiers list: https://pypi.org/classifiers/
19
19
  classifiers = [
@@ -9,7 +9,7 @@ from numpy.typing import NDArray
9
9
 
10
10
  _PKG_NAME: str = Path(__file__).parent.stem
11
11
 
12
- VERSION = "2024.739123.8"
12
+ VERSION = "2024.739125.0"
13
13
 
14
14
  __version__ = VERSION
15
15
 
@@ -95,7 +95,7 @@ class INVTableData(NamedTuple):
95
95
  data_array: ArrayBIGINT
96
96
 
97
97
 
98
- INVData: TypeAlias = Mapping[str, dict[str, dict[str, INVTableData]]]
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 3.1" if _stats_grp == "ByHHIandDelta" else "Table 4.1"
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, Sequence
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
- _tmpl_resource = resources.files(f"{_PKG_NAME}.data.jinja2_LaTeX_templates")
98
- _tmpl_folder = DATA_DIR.joinpath(_tmpl_resource.name)
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 _tmpl_folder.is_dir():
103
- shutil.copytree(_tmpl_src, _tmpl_folder)
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(_tmpl_folder / _out_path.name, _out_path)
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(_tmpl_folder.joinpath("setup_tikz_tables.tex"), _DOTTEX)
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
- _table_dottex_pathlist: Sequence[str], _table_coll_path: str, /
849
+ _table_collection_design: Template,
850
+ _table_collection_content: StatsContainer,
851
+ _output_tex_path: Path,
852
+ /,
833
853
  ) -> None:
834
- _table_collection_design = LaTeX_jinja_env.get_template(
835
- "mergeron_table_collection_template.tex.jinja2"
836
- )
837
- _table_collection_content = StatsContainer()
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
- _table_collection_content.path_list = _table_dottex_pathlist
864
+ _output_tex_path
865
+ Path to LaTeX output file to render to PDF
866
+ """
840
867
 
841
- with Path(DATA_DIR / _table_coll_path).open(
842
- "w", encoding="utf8"
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=_table_coll_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 {_table_coll_path}".split(),
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__":