1
0
mirror of https://github.com/msberends/AMR.git synced 2026-07-17 09:50:53 +02:00
Files
AMR/AMR/beta.py
github-actions[bot] ad1d637fff Python wrapper update
2026-07-03 17:14:20 +00:00

23 lines
669 B
Python

import sys
_DATASETS = frozenset({
'example_isolates', 'microorganisms',
'antimicrobials', 'clinical_breakpoints'
})
class _BetaModule(type(sys.modules[__name__])):
"""Lazy-loading module: installs AMR from GitHub on first access."""
def __getattr__(self, name):
if name in _DATASETS:
from .datasets import get
return get(name, source="github")
try:
from . import functions
return getattr(functions, name)
except AttributeError:
raise AttributeError(
f"module 'AMR.beta' has no attribute '{name}'")
sys.modules[__name__].__class__ = _BetaModule