hestia-earth-models 0.64.9__py3-none-any.whl → 0.64.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hestia-earth-models might be problematic. Click here for more details.
- hestia_earth/models/cml2001Baseline/abioticResourceDepletionFossilFuels.py +175 -0
- hestia_earth/models/cml2001Baseline/abioticResourceDepletionMineralsAndMetals.py +136 -0
- hestia_earth/models/cml2001Baseline/eutrophicationPotentialExcludingFate.py +2 -2
- hestia_earth/models/cml2001Baseline/terrestrialAcidificationPotentialIncludingFateAverageEurope.py +2 -2
- hestia_earth/models/cml2001NonBaseline/eutrophicationPotentialIncludingFateAverageEurope.py +2 -2
- hestia_earth/models/cml2001NonBaseline/terrestrialAcidificationPotentialExcludingFate.py +2 -2
- hestia_earth/models/cycle/completeness/cropResidue.py +15 -10
- hestia_earth/models/cycle/completeness/freshForage.py +60 -0
- hestia_earth/models/edip2003/ozoneDepletionPotential.py +2 -2
- hestia_earth/models/environmentalFootprintV3/soilQualityIndexLandTransformation.py +2 -2
- hestia_earth/models/fantkeEtAl2016/damageToHumanHealthParticulateMatterFormation.py +7 -17
- hestia_earth/models/ipcc2013ExcludingFeedbacks/gwp100.py +2 -2
- hestia_earth/models/ipcc2013IncludingFeedbacks/gwp100.py +2 -2
- hestia_earth/models/ipcc2019/aboveGroundBiomass.py +31 -243
- hestia_earth/models/ipcc2019/belowGroundBiomass.py +529 -0
- hestia_earth/models/ipcc2019/biomass_utils.py +406 -0
- hestia_earth/models/ipcc2019/{co2ToAirAboveGroundBiomassStockChangeLandUseChange.py → co2ToAirAboveGroundBiomassStockChange.py} +19 -7
- hestia_earth/models/ipcc2019/{co2ToAirBelowGroundBiomassStockChangeLandUseChange.py → co2ToAirBelowGroundBiomassStockChange.py} +19 -7
- hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py +402 -73
- hestia_earth/models/ipcc2019/{co2ToAirSoilOrganicCarbonStockChangeManagementChange.py → co2ToAirSoilOrganicCarbonStockChange.py} +20 -8
- hestia_earth/models/ipcc2019/organicCarbonPerHa.py +3 -1
- hestia_earth/models/ipcc2019/pastureGrass_utils.py +6 -7
- hestia_earth/models/ipcc2021/gwp100.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToFreshwaterEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToFreshwaterEcosystemsFreshwaterEutrophication.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToFreshwaterEcosystemsWaterStress.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthParticulateMatterFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthWaterStress.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToMarineEcosystemsMarineEutrophication.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToTerrestrialEcosystemsTerrestrialAcidification.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToFreshwaterEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToFreshwaterEcosystemsFreshwaterEutrophication.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToFreshwaterEcosystemsWaterStress.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthParticulateMatterFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthWaterStress.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToMarineEcosystemsMarineEutrophication.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToTerrestrialEcosystemsTerrestrialAcidification.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToFreshwaterEcosystemsFreshwaterEutrophication.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToFreshwaterEcosystemsWaterStress.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthParticulateMatterFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthWaterStress.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToMarineEcosystemsMarineEutrophication.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToTerrestrialEcosystemsTerrestrialAcidification.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToFreshwaterEcosystemsFreshwaterEutrophication.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToFreshwaterEcosystemsWaterStress.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthParticulateMatterFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthWaterStress.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToMarineEcosystemsMarineEutrophication.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsTerrestrialAcidification.py +2 -2
- hestia_earth/models/mocking/build_mock_search.py +44 -0
- hestia_earth/models/mocking/mock_search.py +8 -49
- hestia_earth/models/mocking/search-results.json +3055 -558
- hestia_earth/models/poschEtAl2008/terrestrialAcidificationPotentialAccumulatedExceedance.py +3 -3
- hestia_earth/models/poschEtAl2008/terrestrialEutrophicationPotentialAccumulatedExceedance.py +3 -3
- hestia_earth/models/preload_requests.py +1 -1
- hestia_earth/models/recipe2016Egalitarian/ecosystemDamageOzoneFormation.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/freshwaterEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/humanDamageOzoneFormation.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/marineEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/ozoneDepletionPotential.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/terrestrialAcidificationPotential.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/ecosystemDamageOzoneFormation.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/freshwaterEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/humanDamageOzoneFormation.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/marineEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/ozoneDepletionPotential.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/terrestrialAcidificationPotential.py +2 -2
- hestia_earth/models/recipe2016Individualist/ecosystemDamageOzoneFormation.py +2 -2
- hestia_earth/models/recipe2016Individualist/freshwaterEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Individualist/humanDamageOzoneFormation.py +2 -2
- hestia_earth/models/recipe2016Individualist/marineEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Individualist/ozoneDepletionPotential.py +2 -2
- hestia_earth/models/recipe2016Individualist/terrestrialAcidificationPotential.py +2 -2
- hestia_earth/models/schmidt2007/utils.py +13 -4
- hestia_earth/models/utils/blank_node.py +73 -3
- hestia_earth/models/utils/constant.py +8 -1
- hestia_earth/models/utils/cycle.py +10 -13
- hestia_earth/models/utils/fuel.py +1 -1
- hestia_earth/models/utils/impact_assessment.py +49 -24
- hestia_earth/models/utils/lookup.py +36 -7
- hestia_earth/models/utils/pesticideAI.py +1 -1
- hestia_earth/models/utils/property.py +11 -4
- hestia_earth/models/utils/term.py +15 -8
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.64.9.dist-info → hestia_earth_models-0.64.11.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.64.9.dist-info → hestia_earth_models-0.64.11.dist-info}/RECORD +123 -114
- {hestia_earth_models-0.64.9.dist-info → hestia_earth_models-0.64.11.dist-info}/WHEEL +1 -1
- tests/models/cml2001Baseline/test_abioticResourceDepletionFossilFuels.py +196 -0
- tests/models/cml2001Baseline/test_abioticResourceDepletionMineralsAndMetals.py +124 -0
- tests/models/cycle/completeness/test_freshForage.py +21 -0
- tests/models/edip2003/test_ozoneDepletionPotential.py +1 -13
- tests/models/environmentalFootprintV3/test_soilQualityIndexLandTransformation.py +1 -2
- tests/models/impact_assessment/test_emissions.py +1 -0
- tests/models/ipcc2019/test_aboveGroundBiomass.py +27 -63
- tests/models/ipcc2019/test_belowGroundBiomass.py +146 -0
- tests/models/ipcc2019/test_biomass_utils.py +115 -0
- tests/models/ipcc2019/{test_co2ToAirAboveGroundBiomassStockChangeLandUseChange.py → test_co2ToAirAboveGroundBiomassStockChange.py} +5 -5
- tests/models/ipcc2019/{test_co2ToAirBelowGroundBiomassStockChangeLandUseChange.py → test_co2ToAirBelowGroundBiomassStockChange.py} +5 -5
- tests/models/ipcc2019/{test_co2ToAirSoilOrganicCarbonStockChangeManagementChange.py → test_co2ToAirSoilOrganicCarbonStockChange.py} +5 -5
- tests/models/ipcc2021/test_gwp100.py +2 -2
- tests/models/utils/test_impact_assessment.py +3 -3
- hestia_earth/models/ipcc2019/aboveGroundBiomass_utils.py +0 -180
- tests/models/ipcc2019/test_aboveGroundBiomass_utils.py +0 -92
- {hestia_earth_models-0.64.9.dist-info → hestia_earth_models-0.64.11.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.64.9.dist-info → hestia_earth_models-0.64.11.dist-info}/top_level.txt +0 -0
hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthStratosphericOzoneDepletion.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
29
|
+
value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
30
30
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
31
31
|
value=value)
|
|
32
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -47,5 +47,5 @@ def run(impact_assessment: dict):
|
|
|
47
47
|
)
|
|
48
48
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
49
49
|
value=value)
|
|
50
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
51
|
-
return _indicator(value)
|
|
50
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
51
|
+
return None if value is None else _indicator(value)
|
hestia_earth/models/lcImpactCertainEffectsInfinite/damageToMarineEcosystemsMarineEutrophication.py
CHANGED
|
@@ -33,5 +33,5 @@ def run(impact_assessment: dict):
|
|
|
33
33
|
value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv")
|
|
34
34
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
35
35
|
value=value)
|
|
36
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
37
|
-
return _indicator(value)
|
|
36
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
37
|
+
return None if value is None else _indicator(value)
|
hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsClimateChange.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
29
|
+
value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
30
30
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
31
31
|
value=value)
|
|
32
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -33,5 +33,5 @@ def run(impact_assessment: dict):
|
|
|
33
33
|
value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv")
|
|
34
34
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
35
35
|
value=value)
|
|
36
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
37
|
-
return _indicator(value)
|
|
36
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
37
|
+
return None if value is None else _indicator(value)
|
|
@@ -33,5 +33,5 @@ def run(impact_assessment: dict):
|
|
|
33
33
|
value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv")
|
|
34
34
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
35
35
|
value=value)
|
|
36
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
37
|
-
return _indicator(value)
|
|
36
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
37
|
+
return None if value is None else _indicator(value)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from inspect import getmembers, isfunction
|
|
2
|
+
from hestia_earth.utils.tools import flatten
|
|
3
|
+
|
|
4
|
+
from hestia_earth.models.utils import term
|
|
5
|
+
|
|
6
|
+
_IGNORE_FUNC = ['get_lookup_value', 'get_table_value']
|
|
7
|
+
_original_search_func = term.search
|
|
8
|
+
_original_find_node_func = term.find_node
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _map_results(results):
|
|
12
|
+
# returning the whole term
|
|
13
|
+
return [results] if isinstance(results, dict) else (
|
|
14
|
+
{'@type': 'Term', '@id': results} if isinstance(results, str) else
|
|
15
|
+
flatten(map(_map_results, results)) if isinstance(results, list) else
|
|
16
|
+
None
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _create_search_result(data: tuple):
|
|
21
|
+
search_query = {}
|
|
22
|
+
|
|
23
|
+
def new_search(query: dict, *_a, **_b):
|
|
24
|
+
nonlocal search_query
|
|
25
|
+
search_query = query
|
|
26
|
+
return _original_search_func(query, *_a, **_b)
|
|
27
|
+
|
|
28
|
+
term.search = new_search
|
|
29
|
+
|
|
30
|
+
def new_find_node(_n, query: dict, *_a, **_b):
|
|
31
|
+
nonlocal search_query
|
|
32
|
+
search_query = query
|
|
33
|
+
return _original_find_node_func(_n, query, *_a, **_b)
|
|
34
|
+
|
|
35
|
+
term.find_node = new_find_node
|
|
36
|
+
|
|
37
|
+
function_name, func = data
|
|
38
|
+
res = func()
|
|
39
|
+
return {'name': function_name, 'query': search_query, 'results': _map_results(res)}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def create_search_results():
|
|
43
|
+
funcs = list(filter(lambda v: v[0].startswith('get_') and not v[0] in _IGNORE_FUNC, getmembers(term, isfunction)))
|
|
44
|
+
return list(map(_create_search_result, funcs))
|
|
@@ -1,48 +1,9 @@
|
|
|
1
|
-
from inspect import getmembers, isfunction
|
|
2
1
|
import json
|
|
3
|
-
from hestia_earth.utils.tools import flatten
|
|
4
2
|
|
|
5
3
|
from hestia_earth.models.utils import term
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def _map_results(results):
|
|
11
|
-
# returning the whole term
|
|
12
|
-
return [results] if isinstance(results, dict) else (
|
|
13
|
-
{'@type': 'Term', '@id': results} if isinstance(results, str) else
|
|
14
|
-
flatten(map(_map_results, results)) if isinstance(results, list) else
|
|
15
|
-
None
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def _create_search_result(data: tuple):
|
|
20
|
-
search_query = {}
|
|
21
|
-
|
|
22
|
-
original_search = term.search
|
|
23
|
-
|
|
24
|
-
def new_search(query: dict, *_a, **_b):
|
|
25
|
-
nonlocal search_query
|
|
26
|
-
search_query = query
|
|
27
|
-
return original_search(query, *_a, **_b)
|
|
28
|
-
term.search = new_search
|
|
29
|
-
|
|
30
|
-
original_find_node = term.find_node
|
|
31
|
-
|
|
32
|
-
def new_find_node(_n, query: dict, *_a, **_b):
|
|
33
|
-
nonlocal search_query
|
|
34
|
-
search_query = query
|
|
35
|
-
return original_find_node(_n, query, *_a, **_b)
|
|
36
|
-
term.find_node = new_find_node
|
|
37
|
-
|
|
38
|
-
function_name, func = data
|
|
39
|
-
res = func()
|
|
40
|
-
return {'name': function_name, 'query': search_query, 'results': _map_results(res)}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def create_search_results():
|
|
44
|
-
funcs = list(filter(lambda v: v[0].startswith('get_') and not v[0] in IGNORE_FUNC, getmembers(term, isfunction)))
|
|
45
|
-
return list(map(_create_search_result, funcs))
|
|
5
|
+
_original_search_func = term.search
|
|
6
|
+
_original_find_node_func = term.find_node
|
|
46
7
|
|
|
47
8
|
|
|
48
9
|
def _load_results(filepath: str):
|
|
@@ -56,22 +17,20 @@ def _find_search_result(filepath: str, query: dict):
|
|
|
56
17
|
return None if res is None else res.get('results', [])
|
|
57
18
|
|
|
58
19
|
|
|
59
|
-
def _mocked_search(
|
|
20
|
+
def _mocked_search(filepath: str):
|
|
60
21
|
def mock(query: dict, **kwargs):
|
|
61
22
|
result = _find_search_result(filepath, query)
|
|
62
|
-
return
|
|
23
|
+
return _original_search_func(query, **kwargs) if result is None else result
|
|
63
24
|
return mock
|
|
64
25
|
|
|
65
26
|
|
|
66
|
-
def _mocked_find_node(
|
|
27
|
+
def _mocked_find_node(filepath: str):
|
|
67
28
|
def mock(node_type: str, query: dict, **kwargs):
|
|
68
29
|
result = _find_search_result(filepath, query)
|
|
69
|
-
return
|
|
30
|
+
return _original_find_node_func(node_type, query, **kwargs) if result is None else result
|
|
70
31
|
return mock
|
|
71
32
|
|
|
72
33
|
|
|
73
34
|
def mock(filepath: str):
|
|
74
|
-
|
|
75
|
-
term.
|
|
76
|
-
original_find_node = term.find_node
|
|
77
|
-
term.find_node = _mocked_find_node(original_find_node, filepath)
|
|
35
|
+
term.search = _mocked_search(filepath)
|
|
36
|
+
term.find_node = _mocked_find_node(filepath)
|