Skip to content

Commit 8b47f16

Browse files
author
schmide
committed
circular imports: re-establish measures, tag and disc_rates import through entity
by importing Impact in measures strictly on method level
1 parent dfa18ef commit 8b47f16

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

climada/engine/impact.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@
3737
from tqdm import tqdm
3838

3939

40-
from climada.entity.tag import Tag
41-
from climada.entity.exposures.base import Exposures
42-
from climada.hazard.tag import Tag as TagHaz
43-
from climada.entity.exposures.base import INDICATOR_IF, INDICATOR_CENTR
40+
from climada.entity import Exposures, Tag
41+
from climada.entity.exposures import INDICATOR_IF, INDICATOR_CENTR
42+
from climada.hazard import Tag as TagHaz
4443
import climada.util.plot as u_plot
4544
from climada import CONFIG
4645
from climada.util.constants import DEF_CRS

climada/entity/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@
2020
"""
2121
from .exposures import *
2222
from .impact_funcs import *
23+
from .tag import *
24+
from .disc_rates import *
25+
from .measures import *

climada/entity/exposures/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Define Exposures class.
2020
"""
2121

22-
__all__ = ['Exposures', 'add_sea']
22+
__all__ = ['Exposures', 'add_sea', 'INDICATOR_IF', 'INDICATOR_CENTR']
2323

2424
import logging
2525
import copy

climada/entity/exposures/litpop.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
You should have received a copy of the GNU Lesser General Public License along
1616
with CLIMADA. If not, see <https://www.gnu.org/licenses/>.
1717
"""
18+
19+
__all__ = ['LitPop']
20+
1821
import logging
1922
import time
2023
from sys import stdout

climada/entity/measures/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from geopandas import GeoDataFrame
3030

3131
from climada.entity.exposures.base import Exposures, INDICATOR_IF, INDICATOR_CENTR
32-
from climada.engine.impact import Impact
3332
import climada.util.checker as u_check
3433

3534
LOGGER = logging.getLogger(__name__)
@@ -294,6 +293,7 @@ def _cutoff_hazard_damage(self, exposures, if_set, hazard):
294293
else:
295294
exp_imp = exposures
296295

296+
from climada.engine.impact import Impact
297297
imp = Impact()
298298
imp.calc(exp_imp, if_set, hazard)
299299

0 commit comments

Comments
 (0)