Use DUMAS Continuum reference bundle class

This commit is contained in:
2026-10-30 11:24:38 +00:00
parent e6116df914
commit 1684c6a849
2 changed files with 46 additions and 1 deletions
+20 -1
View File
@@ -14,12 +14,31 @@ REFERENCE_IMAGES_V39_TYPE = "H3_CONTINUUM_REFERENCE_IMAGES_V39"
def _continuum_reference_bundle_type():
"""Find the upstream H3 bundle class without copying its implementation."""
# Prefer the exact vendored Continuum module used by the namespaced DUMAS
# sampler. If the original Continuum pack is installed too, importing its
# equally named class first creates a bundle that fails isinstance checks
# in the DUMAS sampler.
import importlib
package_candidates = []
if __package__:
package_candidates.append(
f"{__package__}.vendor.dumas_h3_continuum.v3.reference_images_v39"
)
package_candidates.append("vendor.dumas_h3_continuum.v3.reference_images_v39")
for name in package_candidates:
try:
module = importlib.import_module(name)
except Exception:
continue
bundle = getattr(module, "ReferenceImagesV39Bundle", None)
if bundle is not None:
return bundle
candidates = [
module for name, module in list(sys.modules.items())
if module is not None and name.endswith(".v3.reference_images_v39")
]
try:
import importlib
candidates.append(importlib.import_module("v3.reference_images_v39"))
except Exception:
pass