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.
Files changed (83) hide show
  1. {commodutil-5.5.2 → commodutil-5.5.3}/CHANGELOG.md +4 -0
  2. {commodutil-5.5.2 → commodutil-5.5.3}/PKG-INFO +1 -1
  3. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/geography.py +6 -1
  4. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil.egg-info/PKG-INFO +1 -1
  5. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_geography.py +14 -0
  6. {commodutil-5.5.2 → commodutil-5.5.3}/.coveragerc +0 -0
  7. {commodutil-5.5.2 → commodutil-5.5.3}/.github/workflows/1_tests.yml +0 -0
  8. {commodutil-5.5.2 → commodutil-5.5.3}/.github/workflows/2_coverage.yml +0 -0
  9. {commodutil-5.5.2 → commodutil-5.5.3}/.github/workflows/3_linting.yml +0 -0
  10. {commodutil-5.5.2 → commodutil-5.5.3}/.github/workflows/4_release.yml +0 -0
  11. {commodutil-5.5.2 → commodutil-5.5.3}/.gitignore +0 -0
  12. {commodutil-5.5.2 → commodutil-5.5.3}/.pypirc +0 -0
  13. {commodutil-5.5.2 → commodutil-5.5.3}/README.md +0 -0
  14. {commodutil-5.5.2 → commodutil-5.5.3}/azure-build-pipelines.yml +0 -0
  15. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/__init__.py +0 -0
  16. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/arb.py +0 -0
  17. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/convfactors.py +0 -0
  18. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/dates.py +0 -0
  19. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/__init__.py +0 -0
  20. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/calendar.py +0 -0
  21. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/continuous.py +0 -0
  22. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/fly.py +0 -0
  23. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/quarterly.py +0 -0
  24. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/spreads.py +0 -0
  25. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/structure.py +0 -0
  26. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forward/util.py +0 -0
  27. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/forwards.py +0 -0
  28. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/pandasutil.py +0 -0
  29. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/priceconv.py +0 -0
  30. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/__init__.py +0 -0
  31. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/analysis_types.py +0 -0
  32. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/commodities.py +0 -0
  33. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/commodity_groups.py +0 -0
  34. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/currency.py +0 -0
  35. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/price_unit.py +0 -0
  36. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/trading_hubs.py +0 -0
  37. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/unit_registry.py +0 -0
  38. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/standards/units.py +0 -0
  39. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/stats.py +0 -0
  40. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil/transforms.py +0 -0
  41. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil.egg-info/SOURCES.txt +0 -0
  42. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil.egg-info/dependency_links.txt +0 -0
  43. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil.egg-info/requires.txt +0 -0
  44. {commodutil-5.5.2 → commodutil-5.5.3}/commodutil.egg-info/top_level.txt +0 -0
  45. {commodutil-5.5.2 → commodutil-5.5.3}/pyproject.toml +0 -0
  46. {commodutil-5.5.2 → commodutil-5.5.3}/setup.cfg +0 -0
  47. {commodutil-5.5.2 → commodutil-5.5.3}/tests/__init__.py +0 -0
  48. {commodutil-5.5.2 → commodutil-5.5.3}/tests/conftest.py +0 -0
  49. {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/__init__.py +0 -0
  50. {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/conftest.py +0 -0
  51. {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_calendar.py +0 -0
  52. {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_continuous.py +0 -0
  53. {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_fly.py +0 -0
  54. {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_quarterly.py +0 -0
  55. {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_spreads.py +0 -0
  56. {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_structure.py +0 -0
  57. {commodutil-5.5.2 → commodutil-5.5.3}/tests/forward/test_util.py +0 -0
  58. {commodutil-5.5.2 → commodutil-5.5.3}/tests/golden/golden_factors.json +0 -0
  59. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_aliases.py +0 -0
  60. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_align_fx_result.py +0 -0
  61. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_arb.py +0 -0
  62. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_cl.csv +0 -0
  63. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_conv.py +0 -0
  64. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_dates.py +0 -0
  65. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_forwards.py +0 -0
  66. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_golden_factors.py +0 -0
  67. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_pandasutils.py +0 -0
  68. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_price_conv.py +0 -0
  69. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_price_unit.py +0 -0
  70. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_priceconv_reexports.py +0 -0
  71. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_rate_pint.py +0 -0
  72. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_regex_literals.py +0 -0
  73. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_analysis_types.py +0 -0
  74. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_commodities.py +0 -0
  75. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_commodity_groups.py +0 -0
  76. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_currency.py +0 -0
  77. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_trading_hubs.py +0 -0
  78. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_standards_units.py +0 -0
  79. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_stats.py +0 -0
  80. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_transforms.py +0 -0
  81. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_unit_registry.py +0 -0
  82. {commodutil-5.5.2 → commodutil-5.5.3}/tests/test_weekly.csv +0 -0
  83. {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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commodutil
3
- Version: 5.5.2
3
+ Version: 5.5.3
4
4
  Summary: common commodity/oil analytics utils
5
5
  Author-email: aeorxc <author@example.com>
6
6
  License-Expression: MIT
@@ -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
- return " ".join(name.replace("&", " and ").split()).casefold()
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]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commodutil
3
- Version: 5.5.2
3
+ Version: 5.5.3
4
4
  Summary: common commodity/oil analytics utils
5
5
  Author-email: aeorxc <author@example.com>
6
6
  License-Expression: MIT
@@ -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