commodutil 5.5.2__tar.gz → 5.5.3__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.
- {commodutil-5.5.2 → commodutil-5.5.3}/CHANGELOG.md +4 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/PKG-INFO +1 -1
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/geography.py +6 -1
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil.egg-info/PKG-INFO +1 -1
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_geography.py +14 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/.coveragerc +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/.github/workflows/1_tests.yml +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/.github/workflows/2_coverage.yml +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/.github/workflows/3_linting.yml +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/.github/workflows/4_release.yml +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/.gitignore +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/.pypirc +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/README.md +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/azure-build-pipelines.yml +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/__init__.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/arb.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/convfactors.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/dates.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/__init__.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/calendar.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/continuous.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/fly.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/quarterly.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/spreads.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/structure.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/util.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forwards.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/pandasutil.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/priceconv.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/__init__.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/analysis_types.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/commodities.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/commodity_groups.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/currency.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/price_unit.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/trading_hubs.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/unit_registry.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/units.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/stats.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/transforms.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil.egg-info/SOURCES.txt +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil.egg-info/dependency_links.txt +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil.egg-info/requires.txt +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/commodutil.egg-info/top_level.txt +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/pyproject.toml +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/setup.cfg +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/__init__.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/conftest.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/__init__.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/conftest.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_calendar.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_continuous.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_fly.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_quarterly.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_spreads.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_structure.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_util.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/golden/golden_factors.json +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_aliases.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_align_fx_result.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_arb.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_cl.csv +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_conv.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_dates.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_forwards.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_golden_factors.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_pandasutils.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_price_conv.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_price_unit.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_priceconv_reexports.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_rate_pint.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_regex_literals.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_analysis_types.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_commodities.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_commodity_groups.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_currency.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_trading_hubs.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_units.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_stats.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_transforms.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_unit_registry.py +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_weekly.csv +0 -0
- {commodutil-5.5.2 → commodutil-5.5.3}/uv.lock +0 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.5.3 - 2026-07-28
|
|
4
|
+
|
|
5
|
+
- Fixed country-name resolution for standalone `St`/`St.` abbreviations and the vendor spellings `Taiwan, China` and `Virgin Islands (US)`.
|
|
6
|
+
|
|
3
7
|
## 5.5.2 - 2026-07-28
|
|
4
8
|
|
|
5
9
|
- Fixed country-name resolution to normalize ampersands to `and`, matching ISO names such as Antigua and Barbuda.
|
|
@@ -15,6 +15,7 @@ memberships are derived from those definitions at import time.
|
|
|
15
15
|
|
|
16
16
|
from __future__ import annotations
|
|
17
17
|
|
|
18
|
+
import re
|
|
18
19
|
from dataclasses import dataclass
|
|
19
20
|
from typing import Dict, Optional, Tuple
|
|
20
21
|
|
|
@@ -69,11 +70,13 @@ COUNTRY_ALIASES: dict[str, str] = {
|
|
|
69
70
|
"Turkey": "TR",
|
|
70
71
|
"Turkiye": "TR",
|
|
71
72
|
"Republic of China": "TW",
|
|
73
|
+
"Taiwan, China": "TW",
|
|
72
74
|
"USA": "US",
|
|
73
75
|
"U.S.": "US",
|
|
74
76
|
"U.S.A.": "US",
|
|
75
77
|
"Holy See": "VA",
|
|
76
78
|
"US Virgin Islands": "VI",
|
|
79
|
+
"Virgin Islands (US)": "VI",
|
|
77
80
|
# From empirical vendor-vocabulary validation (see commodflows research).
|
|
78
81
|
# ISO merges Bonaire and Sint Eustatius into BQ; sub-island detail is
|
|
79
82
|
# lost by design.
|
|
@@ -100,7 +103,9 @@ COUNTRY_ALIASES: dict[str, str] = {
|
|
|
100
103
|
|
|
101
104
|
def _normalize_country_name(name: str) -> str:
|
|
102
105
|
"""Return the case-folded lookup key for a country name."""
|
|
103
|
-
|
|
106
|
+
normalized = name.replace("&", " and ")
|
|
107
|
+
normalized = re.sub(r"\bSt\.?(?=\s|$)", "Saint", normalized, flags=re.IGNORECASE)
|
|
108
|
+
return " ".join(normalized.split()).casefold()
|
|
104
109
|
|
|
105
110
|
|
|
106
111
|
def _build_country_name_map(aliases: Dict[str, str]) -> Dict[str, str]:
|
|
@@ -79,6 +79,20 @@ def test_canonical_country_normalizes_ampersands(value, expected):
|
|
|
79
79
|
assert canonical_country(value) == expected
|
|
80
80
|
|
|
81
81
|
|
|
82
|
+
@pytest.mark.parametrize(
|
|
83
|
+
"value,expected",
|
|
84
|
+
[
|
|
85
|
+
("St Kitts & Nevis", "KN"),
|
|
86
|
+
("St. Lucia", "LC"),
|
|
87
|
+
("Taiwan, China", "TW"),
|
|
88
|
+
("Virgin Islands (US)", "VI"),
|
|
89
|
+
("Stockholm", None),
|
|
90
|
+
],
|
|
91
|
+
)
|
|
92
|
+
def test_canonical_country_normalizes_live_vendor_spellings(value, expected):
|
|
93
|
+
assert canonical_country(value) == expected
|
|
94
|
+
|
|
95
|
+
|
|
82
96
|
@pytest.mark.parametrize(
|
|
83
97
|
"value,expected",
|
|
84
98
|
[
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|