Coverage for /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/memilio/simulation/__init__.py: 11%

18 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-11-18 12:29 +0000

1############################################################################# 

2# Copyright (C) 2020-2024 MEmilio 

3# 

4# Authors: Daniel Abele 

5# 

6# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> 

7# 

8# Licensed under the Apache License, Version 2.0 (the "License"); 

9# you may not use this file except in compliance with the License. 

10# You may obtain a copy of the License at 

11# 

12# http://www.apache.org/licenses/LICENSE-2.0 

13# 

14# Unless required by applicable law or agreed to in writing, software 

15# distributed under the License is distributed on an "AS IS" BASIS, 

16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

17# See the License for the specific language governing permissions and 

18# limitations under the License. 

19############################################################################# 

20 

21""" 

22The Python bindings to the MEmilio C++ library. 

23""" 

24 

25from memilio.simulation._simulation import * 

26 

27 

28def __getattr__(attr): 

29 """! The __getattr__ function is used here to implement lazy loading for the submodules within the memilio.simulation package.  

30 Submodules are only imported when they are first accessed, which can save memory and reduce startup time, if not all submodules  

31 are needed for every execution. 

32 """ 

33 if attr == "abm": 

34 import memilio.simulation.abm as abm 

35 return abm 

36 elif attr == "osir": 

37 import memilio.simulation.osir as osir 

38 return osir 

39 elif attr == "oseir": 

40 import memilio.simulation.oseir as oseir 

41 return oseir 

42 elif attr == "osecir": 

43 import memilio.simulation.osecir as osecir 

44 return osecir 

45 elif attr == "osecirvvs": 

46 import memilio.simulation.osecirvvs as osecirvvs 

47 return osecirvvs 

48 

49 raise AttributeError("module {!r} has no attribute " 

50 "{!r}".format(__name__, attr))