mirror of
https://github.com/msberends/AMR.git
synced 2026-07-17 09:50:53 +02:00
23 lines
669 B
Python
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
|