Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrige zone_logement_social pour retourner un vecteur #1395

Merged
merged 5 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

### 48.9.5 [#1395](https://github.com/openfisca/openfisca-france/pull/1395)

* Amélioration technique.
* Périodes concernées : toutes.
* Zones impactées : `model/prestations/logement_social.py`.
* Détails :
- La formule zone_logement_social retournait un scalar `numpy.ndarray[int]`.
- Corrige zone_logement_social pour retourner un vecteur `numpy.ndarray[bool]`.
- Note : à partir de Numpy 1.18, l'utilisation de `select` avec une valeur non `bool` est dépréciée.

### 48.9.4 [#1399](https://github.com/openfisca/openfisca-france/pull/1399)

* Évolution du système socio-fiscal.
Expand Down
14 changes: 8 additions & 6 deletions openfisca_france/model/prestations/logement_social.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
from numpy import char, isin, logical_not as not_, select

from numpy.core.defchararray import startswith
from openfisca_france.model.base import *
from openfisca_core.indexed_enums import Enum
from openfisca_core.periods import MONTH
from openfisca_core.variables import Variable

from openfisca_france.entities import Famille, Menage

paris_communes_limitrophes = [
b'75056', # Paris
Expand Down Expand Up @@ -64,9 +67,8 @@ class zone_logement_social(Variable):

def formula(menage, period):
depcom = menage('depcom', period)

in_paris_communes_limitrophes = sum([depcom == commune_proche_paris for commune_proche_paris in paris_communes_limitrophes])
in_idf = sum([startswith(depcom, departement) for departement in departements_idf])
in_paris_communes_limitrophes = isin(depcom, paris_communes_limitrophes)
in_idf = isin(char.ljust(depcom, 2), departements_idf)

return select(
[
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ in-place = true
addopts = --showlocals --exitfirst --doctest-modules --disable-pytest-warnings
testpaths = tests
python_files = **/*.py

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name = "OpenFisca-France",
version = "48.9.4",
version = "48.9.5",
author = "OpenFisca Team",
author_email = "contact@openfisca.fr",
classifiers = [
Expand Down