Skip to content

Commit

Permalink
Préfère numpy.ceil à ceil
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauko Quiroga committed Jan 5, 2020
1 parent db14163 commit fe8479a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-

import numpy
from numpy import ceil

from openfisca_france.model.base import *

Expand All @@ -27,7 +26,7 @@ def formula(individu, period, parameters):

coef = params.coefficient_multiplicateur

return ceil(coef * plafond)
return numpy.ceil(coef * plafond)


class livret_epargne_populaire_eligibilite(Variable):
Expand Down
4 changes: 2 additions & 2 deletions openfisca_france/model/prestations/aides_logement.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys

import numpy
from numpy import ceil, datetime64, fromiter, int16, logical_or as or_, logical_and as and_
from numpy import datetime64, fromiter, int16, logical_or as or_, logical_and as and_

import openfisca_france
from openfisca_core.periods import Instant
Expand Down Expand Up @@ -738,7 +738,7 @@ def formula(famille, period, parameters):
ressources = numpy.round(ressources * 100) / 100

# Arrondi aux 100 euros supérieurs
ressources = ceil(ressources / 100) * 100
ressources = numpy.ceil(ressources / 100) * 100

accedant = famille.demandeur.menage('aides_logement_primo_accedant_eligibilite', period)
plancher = famille.demandeur.menage('aides_logement_primo_accedant_ressources', period)
Expand Down
4 changes: 2 additions & 2 deletions tests/patrimoine/livret_epargne_populaire/plafond.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
nbptr:
2017: 1
output:
livret_epargne_populaire_plafond: 19779 # ceil(1.8 * 10988)
livret_epargne_populaire_plafond: 19779 # numpy.ceil(1.8 * 10988)

- period: 2019-05
input:
residence: metropole
nbptr:
2017: 1.5
output:
livret_epargne_populaire_plafond: 25060 # ceil(1.8 * (10988 + 2934))
livret_epargne_populaire_plafond: 25060 # numpy.ceil(1.8 * (10988 + 2934))

0 comments on commit fe8479a

Please sign in to comment.