1
0
mirror of https://github.com/msberends/AMR.git synced 2026-07-18 08:30:58 +02:00
Files
AMR/AMR/beta.py
github-actions[bot] eeb88b30f5 Python wrapper update
2026-06-26 13:03:45 +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