Skip to content

Commit

Permalink
fix: suppression du warning de division par zéro en mettant infini si…
Browse files Browse the repository at this point in the history
… les ressources sont à 0
  • Loading branch information
jenovateurs committed Aug 28, 2024
1 parent 405eb96 commit 852efb3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions openfisca_paris/paris.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import division

from numpy import (maximum as max_, logical_not as not_, absolute as abs_, minimum as min_, select, where)
from numpy import (full_like as fl_, inf, divide as div_, zeros_like as zer_, maximum as max_, logical_not as not_, absolute as abs_, minimum as min_, select, where)

from openfisca_france.model.base import * # noqa analysis:ignore

Expand Down Expand Up @@ -226,8 +226,15 @@ def formula(famille, period, legislation):
aspa_reference = famille('paris_aspa_reference', period)
ressources = max_(aspa_reference, base_ressources)

return (loyer + charges_forfaitaires_logement - aide_logement) / ressources
# Utiliser si les ressources sont à 0
ressources_inf = fl_(ressources, inf)

return div_(
(loyer + charges_forfaitaires_logement - aide_logement),
ressources,
out=ressources_inf,
where=ressources != 0
)

class paris_condition_taux_effort(Variable):
value_type = bool
Expand Down

0 comments on commit 852efb3

Please sign in to comment.