From 8bafd2c93f1d757747ce644ec34d62d351b0b0a7 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Wed, 1 Jan 2020 20:23:22 +0100 Subject: [PATCH 1/5] =?UTF-8?q?Supprime=20d=C3=A9claration=20encoding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openfisca_france/model/prestations/logement_social.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openfisca_france/model/prestations/logement_social.py b/openfisca_france/model/prestations/logement_social.py index 3cd612d198..3d5a801be2 100644 --- a/openfisca_france/model/prestations/logement_social.py +++ b/openfisca_france/model/prestations/logement_social.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from numpy.core.defchararray import startswith from openfisca_france.model.base import * From 78acd16dac0500ad0ae29b45e6c2726dfc690633 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Wed, 1 Jan 2020 20:45:28 +0100 Subject: [PATCH 2/5] Utilise imports explicites --- openfisca_france/model/prestations/logement_social.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openfisca_france/model/prestations/logement_social.py b/openfisca_france/model/prestations/logement_social.py index 3d5a801be2..3d6034da21 100644 --- a/openfisca_france/model/prestations/logement_social.py +++ b/openfisca_france/model/prestations/logement_social.py @@ -1,5 +1,11 @@ +from numpy import 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 From 611e762dbed4f9d6b8c470cc51d0cd7b9484490d Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sat, 4 Jan 2020 15:42:53 +0100 Subject: [PATCH 3/5] Utilise numpy.isin pour tester appartenance --- openfisca_france/model/prestations/logement_social.py | 7 +++---- setup.cfg | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/openfisca_france/model/prestations/logement_social.py b/openfisca_france/model/prestations/logement_social.py index 3d6034da21..c77b9d8325 100644 --- a/openfisca_france/model/prestations/logement_social.py +++ b/openfisca_france/model/prestations/logement_social.py @@ -1,4 +1,4 @@ -from numpy import logical_not as not_, select +from numpy import isin, logical_not as not_, select from numpy.core.defchararray import startswith from openfisca_core.indexed_enums import Enum @@ -68,9 +68,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([True], startswith(depcom, departements_idf)) return select( [ diff --git a/setup.cfg b/setup.cfg index d6d8d57976..f2d1afde0e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,4 +17,3 @@ in-place = true addopts = --showlocals --exitfirst --doctest-modules --disable-pytest-warnings testpaths = tests python_files = **/*.py - From b7a7c5ae3da304e4c04bd5bfb7ff32c55f228bbb Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Sun, 5 Jan 2020 18:59:00 +0100 Subject: [PATCH 4/5] Utilise numpy.ljust au lieu de startswith --- openfisca_france/model/prestations/logement_social.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openfisca_france/model/prestations/logement_social.py b/openfisca_france/model/prestations/logement_social.py index c77b9d8325..e6420be41c 100644 --- a/openfisca_france/model/prestations/logement_social.py +++ b/openfisca_france/model/prestations/logement_social.py @@ -1,5 +1,4 @@ -from numpy import isin, logical_not as not_, select -from numpy.core.defchararray import startswith +from numpy import char, isin, logical_not as not_, select from openfisca_core.indexed_enums import Enum from openfisca_core.periods import MONTH @@ -69,7 +68,7 @@ class zone_logement_social(Variable): def formula(menage, period): depcom = menage('depcom', period) in_paris_communes_limitrophes = isin(depcom, paris_communes_limitrophes) - in_idf = isin([True], startswith(depcom, departements_idf)) + in_idf = isin(char.ljust(depcom, 2), departements_idf) return select( [ From 2469a001c585081624c87c48eba94e58887ede34 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Mon, 6 Jan 2020 23:02:10 +0100 Subject: [PATCH 5/5] =?UTF-8?q?Incr=C3=A9mente=20en=20patch=20la=20version?= =?UTF-8?q?=20=C3=A0=2048.9.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 10 ++++++++++ setup.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 002d38e7e5..e49f84bdb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/setup.py b/setup.py index 6636f000a7..d54d029449 100644 --- a/setup.py +++ b/setup.py @@ -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 = [