Skip to content

Commit

Permalink
Merge pull request #164 from openfisca/4566-erreur-de-division-par-0-…
Browse files Browse the repository at this point in the history
…--of

Suppression du warning de division par 0
  • Loading branch information
jenovateurs authored Oct 4, 2024
2 parents 405eb96 + 0ddc145 commit 1af1766
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 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_, maximum as max_, 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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name="Openfisca-Paris",
version="5.5.5",
version="5.5.6",
author="OpenFisca Team",
author_email="[email protected]",
classifiers=[
Expand Down

0 comments on commit 1af1766

Please sign in to comment.