mergeron 2025.739439.12__tar.gz → 2025.739596.4__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.
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/PKG-INFO +9 -5
- mergeron-2025.739596.4/docs/source/license.rst +13 -0
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/pyproject.toml +74 -51
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/__init__.py +10 -5
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/core/__init__.py +67 -5
- mergeron-2025.739596.4/src/mergeron/core/_process_ftc_merger_investigations_data.py +379 -0
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/core/empirical_margin_distribution.py +9 -7
- mergeron-2025.739596.4/src/mergeron/core/ftc_merger_investigations_data.py +371 -0
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/core/guidelines_boundaries.py +23 -44
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/core/guidelines_boundary_functions.py +5 -8
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/core/pseudorandom_numbers.py +5 -5
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/gen/__init__.py +41 -39
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/gen/data_generation.py +20 -15
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/gen/data_generation_functions.py +1 -8
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/gen/enforcement_stats.py +23 -129
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/gen/upp_tests.py +35 -31
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/perks/guidelines_boundary_functions_extra.py +3 -6
- mergeron-2025.739439.12/src/mergeron/core/ftc_merger_investigations_data.py +0 -764
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/README.rst +0 -0
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/data/__init__.py +0 -0
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/data/damodaran_margin_data_serialized.zip +0 -0
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/data/ftc_merger_investigations_data.zip +0 -0
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/perks/__init__.py +0 -0
- {mergeron-2025.739439.12 → mergeron-2025.739596.4}/src/mergeron/py.typed +0 -0
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: mergeron
|
|
3
|
-
Version: 2025.
|
|
3
|
+
Version: 2025.739596.4
|
|
4
4
|
Summary: Python for analyzing merger enforcement policy
|
|
5
|
-
License: MIT
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: docs/source/license.rst
|
|
6
7
|
Keywords: merger enforcement policy,merger guidelines,merger screening,enforcement presumptions,concentration standards,diversion ratio,upward pricing pressure,GUPPI
|
|
7
8
|
Author: Murthy Kambhampaty
|
|
8
9
|
Author-email: smk@capeconomics.com
|
|
9
|
-
Requires-Python: >=3.
|
|
10
|
+
Requires-Python: >=3.12,<4.0
|
|
10
11
|
Classifier: Development Status :: 4 - Beta
|
|
11
12
|
Classifier: Environment :: Console
|
|
12
13
|
Classifier: Intended Audience :: End Users/Desktop
|
|
13
14
|
Classifier: Intended Audience :: Science/Research
|
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
21
|
Requires-Dist: aenum (>=3.1.16)
|
|
20
22
|
Requires-Dist: attrs (>=25.3.0)
|
|
23
|
+
Requires-Dist: backports.zstd ; python_version < "3.14"
|
|
21
24
|
Requires-Dist: beautifulsoup4 (>=4.13.4)
|
|
22
25
|
Requires-Dist: certifi (>=2025.6.15)
|
|
23
26
|
Requires-Dist: h5py (>=3.14.0)
|
|
27
|
+
Requires-Dist: hdf5plugin (>=6.0.0,<7.0.0)
|
|
24
28
|
Requires-Dist: jinja2 (>=3.1.6)
|
|
25
29
|
Requires-Dist: joblib (>=1.5.1)
|
|
26
30
|
Requires-Dist: lxml (>=6.0.0)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
License
|
|
2
|
+
========
|
|
3
|
+
|
|
4
|
+
Copyright 2017-2025 S. Murthy Kambhampaty
|
|
5
|
+
|
|
6
|
+
MIT License
|
|
7
|
+
-----------
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
13
|
+
|
|
@@ -15,8 +15,8 @@ keywords = [
|
|
|
15
15
|
"upward pricing pressure",
|
|
16
16
|
"GUPPI",
|
|
17
17
|
]
|
|
18
|
-
version = "2025.
|
|
19
|
-
requires-python = ">=3.
|
|
18
|
+
version = "2025.739596.4"
|
|
19
|
+
requires-python = ">=3.12,<4.0"
|
|
20
20
|
|
|
21
21
|
# Classifiers list: https://pypi.org/classifiers/
|
|
22
22
|
classifiers = [
|
|
@@ -24,16 +24,18 @@ classifiers = [
|
|
|
24
24
|
"Environment :: Console",
|
|
25
25
|
"Intended Audience :: End Users/Desktop",
|
|
26
26
|
"Intended Audience :: Science/Research",
|
|
27
|
-
"License :: OSI Approved :: MIT License",
|
|
28
27
|
"Operating System :: OS Independent",
|
|
29
28
|
"Programming Language :: Python",
|
|
30
29
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
30
|
+
"Programming Language :: Python :: 3.12",
|
|
31
31
|
"Programming Language :: Python :: 3.13",
|
|
32
|
+
"Programming Language :: Python :: 3.14",
|
|
32
33
|
]
|
|
33
34
|
|
|
34
35
|
dependencies = [
|
|
35
36
|
"aenum>=3.1.16",
|
|
36
37
|
"attrs>=25.3.0",
|
|
38
|
+
"backports.zstd; python_version < '3.14'",
|
|
37
39
|
"beautifulsoup4>=4.13.4",
|
|
38
40
|
"certifi>=2025.6.15",
|
|
39
41
|
"h5py>=3.14.0",
|
|
@@ -48,6 +50,7 @@ dependencies = [
|
|
|
48
50
|
"sympy>=1.14.0",
|
|
49
51
|
"types-beautifulsoup4>=4.12.0.20250516",
|
|
50
52
|
"urllib3>=2.5.0",
|
|
53
|
+
"hdf5plugin (>=6.0.0,<7.0.0)",
|
|
51
54
|
]
|
|
52
55
|
|
|
53
56
|
[project.urls]
|
|
@@ -55,36 +58,36 @@ Homepage = "https://software.capeconomics.com/mergeron/"
|
|
|
55
58
|
Repository = "https://github.com/capeconomics/mergeron.git"
|
|
56
59
|
|
|
57
60
|
|
|
58
|
-
[
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
sphinx
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
[
|
|
76
|
-
coverage
|
|
77
|
-
|
|
78
|
-
pytest
|
|
79
|
-
pytest-
|
|
80
|
-
pytest-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
61
|
+
[dependency-groups]
|
|
62
|
+
doc = [
|
|
63
|
+
"sphinx<9",
|
|
64
|
+
"sphinx-autodoc-typehints",
|
|
65
|
+
"sphinx-autoapi",
|
|
66
|
+
"sphinx-immaterial",
|
|
67
|
+
"linuxdoc",
|
|
68
|
+
"ipython",
|
|
69
|
+
"ipython-pygments-lexers",
|
|
70
|
+
"roman_numerals",
|
|
71
|
+
]
|
|
72
|
+
lint = [
|
|
73
|
+
"ruff",
|
|
74
|
+
"mypy",
|
|
75
|
+
"radon",
|
|
76
|
+
"xenon"
|
|
77
|
+
]
|
|
78
|
+
test = [
|
|
79
|
+
"coverage",
|
|
80
|
+
"pendulum",
|
|
81
|
+
"pytest",
|
|
82
|
+
"pytest-cov",
|
|
83
|
+
"pytest-xdist",
|
|
84
|
+
"pytest-sugar",
|
|
85
|
+
"tox"
|
|
86
|
+
]
|
|
87
|
+
dev = [
|
|
88
|
+
"semver",
|
|
89
|
+
"twine",
|
|
90
|
+
]
|
|
88
91
|
|
|
89
92
|
[tool.ruff]
|
|
90
93
|
|
|
@@ -187,9 +190,14 @@ preview = true
|
|
|
187
190
|
|
|
188
191
|
[tool.mypy]
|
|
189
192
|
|
|
193
|
+
fixed_format_cache = true
|
|
190
194
|
cache_fine_grained = true
|
|
191
195
|
ignore_missing_imports = false
|
|
196
|
+
warn_unreachable = false
|
|
197
|
+
warn_redundant_casts = true
|
|
192
198
|
strict = true
|
|
199
|
+
strict_equality = true
|
|
200
|
+
strict_equality_for_none = true
|
|
193
201
|
local_partial_types = true
|
|
194
202
|
allow_redefinition_new = true
|
|
195
203
|
enable_incomplete_feature = ["PreciseTupleTypes"]
|
|
@@ -203,14 +211,17 @@ no_implicit_reexport = true
|
|
|
203
211
|
|
|
204
212
|
allow_redefinition = true
|
|
205
213
|
|
|
206
|
-
[tool.pytest
|
|
207
|
-
log_auto_indent = 4
|
|
208
|
-
minversion = "
|
|
214
|
+
[tool.pytest]
|
|
215
|
+
log_auto_indent = "4"
|
|
216
|
+
minversion = "9.0"
|
|
209
217
|
addopts = [
|
|
210
218
|
"--import-mode=importlib",
|
|
211
219
|
"--cov=mergeron",
|
|
212
220
|
"--cov-report=html:tests/cov_html",
|
|
213
221
|
]
|
|
222
|
+
testpaths = [
|
|
223
|
+
"tests",
|
|
224
|
+
]
|
|
214
225
|
filterwarnings = [
|
|
215
226
|
"all",
|
|
216
227
|
"ignore::DeprecationWarning:dateutil.tz.tz",
|
|
@@ -225,31 +236,43 @@ tmp_path_retention_policy = "failed"
|
|
|
225
236
|
|
|
226
237
|
[tool.tox]
|
|
227
238
|
requires = ["tox>=4.19"]
|
|
239
|
+
skip_missing_interpreters = true
|
|
228
240
|
isolated_build = true
|
|
229
|
-
envlist = ["py313"]
|
|
230
241
|
|
|
231
|
-
|
|
232
|
-
[tool.tox.env."py313"]
|
|
242
|
+
[tool.tox.env_run_base]
|
|
233
243
|
commands = [
|
|
234
244
|
[
|
|
235
|
-
"
|
|
236
|
-
"
|
|
237
|
-
"
|
|
238
|
-
"
|
|
245
|
+
"uv",
|
|
246
|
+
"sync",
|
|
247
|
+
"--active",
|
|
248
|
+
"--group",
|
|
249
|
+
"lint",
|
|
250
|
+
"--group",
|
|
251
|
+
"test",
|
|
252
|
+
],
|
|
253
|
+
[
|
|
254
|
+
"ruff",
|
|
255
|
+
"check",
|
|
256
|
+
"./src",
|
|
239
257
|
],
|
|
240
258
|
[
|
|
241
|
-
"
|
|
242
|
-
"
|
|
243
|
-
"--without",
|
|
244
|
-
"doc,lint",
|
|
245
|
-
"--no-root",
|
|
259
|
+
"mypy",
|
|
260
|
+
"./src",
|
|
246
261
|
],
|
|
247
262
|
[
|
|
248
263
|
"pytest",
|
|
249
|
-
"--force-sugar",
|
|
250
264
|
{ replace = "posargs", extend = true },
|
|
251
265
|
],
|
|
252
266
|
]
|
|
253
267
|
|
|
254
|
-
description = "install pytest in a virtual environment and invoke
|
|
255
|
-
deps = ["poetry"]
|
|
268
|
+
description = "install ruff, mpypy, pytest in a virtual environment and invoke each, in turn"
|
|
269
|
+
deps = ["poetry-core"]
|
|
270
|
+
allowlist_externals = ["uv"]
|
|
271
|
+
|
|
272
|
+
[tool.uv]
|
|
273
|
+
default-groups = ["dev",]
|
|
274
|
+
|
|
275
|
+
[build-system]
|
|
276
|
+
requires = ["poetry-core"]
|
|
277
|
+
build-backend = "poetry.core.masonry.api"
|
|
278
|
+
|
|
@@ -15,7 +15,7 @@ from ruamel import yaml
|
|
|
15
15
|
|
|
16
16
|
_PKG_NAME: str = Path(__file__).parent.name
|
|
17
17
|
|
|
18
|
-
VERSION = "2025.
|
|
18
|
+
VERSION = "2025.739504.0"
|
|
19
19
|
|
|
20
20
|
__version__ = VERSION
|
|
21
21
|
|
|
@@ -41,7 +41,7 @@ PKG_ATTRS_MAP: dict[str, type] = {}
|
|
|
41
41
|
|
|
42
42
|
np.set_printoptions(precision=28, floatmode="fixed", legacy=False)
|
|
43
43
|
|
|
44
|
-
type
|
|
44
|
+
type PubYear = Literal[1992, 2010, 2023]
|
|
45
45
|
|
|
46
46
|
type ArrayBoolean = NDArray[np.bool_]
|
|
47
47
|
type ArrayFloat = NDArray[np.floating]
|
|
@@ -50,6 +50,8 @@ type ArrayINT = NDArray[np.integer]
|
|
|
50
50
|
type ArrayDouble = NDArray[np.float64]
|
|
51
51
|
type ArrayBIGINT = NDArray[np.int64]
|
|
52
52
|
|
|
53
|
+
# redefine numpy testing functions to modify default tolerances
|
|
54
|
+
|
|
53
55
|
|
|
54
56
|
def allclose(
|
|
55
57
|
_a: ArrayFloat | ArrayINT | float | int,
|
|
@@ -80,8 +82,8 @@ def assert_allclose( # noqa: PLR0913
|
|
|
80
82
|
return np.testing.assert_allclose(
|
|
81
83
|
_a,
|
|
82
84
|
_b,
|
|
83
|
-
atol=
|
|
84
|
-
rtol=
|
|
85
|
+
atol=atol,
|
|
86
|
+
rtol=rtol,
|
|
85
87
|
equal_nan=equal_nan,
|
|
86
88
|
err_msg=err_msg,
|
|
87
89
|
verbose=verbose,
|
|
@@ -89,6 +91,9 @@ def assert_allclose( # noqa: PLR0913
|
|
|
89
91
|
)
|
|
90
92
|
|
|
91
93
|
|
|
94
|
+
# Add functions for serializing/deserializing some objects used
|
|
95
|
+
# or defined in this package
|
|
96
|
+
|
|
92
97
|
this_yaml = yaml.YAML(typ="rt")
|
|
93
98
|
this_yaml.indent(mapping=2, sequence=4, offset=2)
|
|
94
99
|
|
|
@@ -164,7 +169,7 @@ class Enameled(enum.Enum):
|
|
|
164
169
|
def from_yaml(
|
|
165
170
|
cls, _c: yaml.constructor.RoundTripConstructor, _n: yaml.ScalarNode
|
|
166
171
|
) -> enum.EnumType:
|
|
167
|
-
"""Deserialize enumeration."""
|
|
172
|
+
"""Deserialize enumeration serialized by .name."""
|
|
168
173
|
retval: enum.EnumType = super().__getattribute__(cls, _n.value)
|
|
169
174
|
return retval
|
|
170
175
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import shutil
|
|
5
6
|
from collections.abc import Mapping
|
|
6
7
|
from decimal import Decimal
|
|
7
8
|
from types import MappingProxyType
|
|
@@ -20,6 +21,8 @@ from .. import ( # noqa: TID252
|
|
|
20
21
|
yamelize_attrs,
|
|
21
22
|
yaml_rt_mapper,
|
|
22
23
|
)
|
|
24
|
+
from .. import WORK_DIR as PKG_WORK_DIR # noqa: TID252
|
|
25
|
+
from .. import data as mdat # noqa: TID252
|
|
23
26
|
|
|
24
27
|
__version__ = VERSION
|
|
25
28
|
|
|
@@ -40,6 +43,70 @@ class GuidelinesBoundary:
|
|
|
40
43
|
"""Area under the boundary."""
|
|
41
44
|
|
|
42
45
|
|
|
46
|
+
WORK_DIR = globals().get("WORK_DIR", PKG_WORK_DIR)
|
|
47
|
+
"""Redefined, in case the user defines WORK_DIR between module imports."""
|
|
48
|
+
|
|
49
|
+
FID_WORK_DIR = WORK_DIR / "FTCData"
|
|
50
|
+
if not FID_WORK_DIR.is_dir():
|
|
51
|
+
FID_WORK_DIR.mkdir(parents=True)
|
|
52
|
+
|
|
53
|
+
INVDATA_ARCHIVE_PATH = WORK_DIR / mdat.FTC_MERGER_INVESTIGATIONS_DATA.name
|
|
54
|
+
if not INVDATA_ARCHIVE_PATH.is_file():
|
|
55
|
+
shutil.copy2(mdat.FTC_MERGER_INVESTIGATIONS_DATA, INVDATA_ARCHIVE_PATH) # type: ignore
|
|
56
|
+
|
|
57
|
+
TABLE_TYPES = ("ByHHIandDelta", "ByFirmCount")
|
|
58
|
+
CONC_TABLE_ALL = "Table 3.1"
|
|
59
|
+
CNT_TABLE_ALL = "Table 4.1"
|
|
60
|
+
|
|
61
|
+
TTL_KEY = 86825
|
|
62
|
+
CONC_HHI_DICT = {
|
|
63
|
+
"0 - 1,799": 0,
|
|
64
|
+
"1,800 - 1,999": 1800,
|
|
65
|
+
"2,000 - 2,399": 2000,
|
|
66
|
+
"2,400 - 2,999": 2400,
|
|
67
|
+
"3,000 - 3,999": 3000,
|
|
68
|
+
"4,000 - 4,999": 4000,
|
|
69
|
+
"5,000 - 6,999": 5000,
|
|
70
|
+
"7,000 - 10,000": 7000,
|
|
71
|
+
"TOTAL": TTL_KEY,
|
|
72
|
+
}
|
|
73
|
+
CONC_DELTA_DICT = {
|
|
74
|
+
"0 - 100": 0,
|
|
75
|
+
"100 - 200": 100,
|
|
76
|
+
"200 - 300": 200,
|
|
77
|
+
"300 - 500": 300,
|
|
78
|
+
"500 - 800": 500,
|
|
79
|
+
"800 - 1,200": 800,
|
|
80
|
+
"1,200 - 2,500": 1200,
|
|
81
|
+
"2,500 - 5,000": 2500,
|
|
82
|
+
"TOTAL": TTL_KEY,
|
|
83
|
+
}
|
|
84
|
+
CNT_FCOUNT_DICT = {
|
|
85
|
+
"2 to 1": 2,
|
|
86
|
+
"3 to 2": 3,
|
|
87
|
+
"4 to 3": 4,
|
|
88
|
+
"5 to 4": 5,
|
|
89
|
+
"6 to 5": 6,
|
|
90
|
+
"7 to 6": 7,
|
|
91
|
+
"8 to 7": 8,
|
|
92
|
+
"9 to 8": 9,
|
|
93
|
+
"10 to 9": 10,
|
|
94
|
+
"10 +": 11,
|
|
95
|
+
"TOTAL": TTL_KEY,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def invert_map(_dict: Mapping[Any, Any]) -> Mapping[Any, Any]:
|
|
100
|
+
"""Invert mapping, mapping values to keys of the original mapping."""
|
|
101
|
+
return {_v: _k for _k, _v in _dict.items()}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
type INVData = MappingProxyType[
|
|
105
|
+
str, MappingProxyType[str, MappingProxyType[str, INVTableData]]
|
|
106
|
+
]
|
|
107
|
+
type INVData_in = dict[str, dict[str, dict[str, INVTableData]]]
|
|
108
|
+
|
|
109
|
+
|
|
43
110
|
@frozen
|
|
44
111
|
class INVTableData:
|
|
45
112
|
"""Represents individual table of FTC merger investigations data."""
|
|
@@ -49,11 +116,6 @@ class INVTableData:
|
|
|
49
116
|
data_array: ArrayBIGINT = field(eq=cmp_using(eq=np.array_equal))
|
|
50
117
|
|
|
51
118
|
|
|
52
|
-
type INVData = MappingProxyType[
|
|
53
|
-
str, MappingProxyType[str, MappingProxyType[str, INVTableData]]
|
|
54
|
-
]
|
|
55
|
-
type INVData_in = dict[str, dict[str, dict[str, INVTableData]]]
|
|
56
|
-
|
|
57
119
|
yamelize_attrs(INVTableData)
|
|
58
120
|
|
|
59
121
|
(_, _) = (
|