OpenFisca-France-Local 6.14.0__py3-none-any.whl → 6.15.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of OpenFisca-France-Local might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: OpenFisca-France-Local
3
- Version: 6.14.0
3
+ Version: 6.15.0
4
4
  Summary: Extension OpenFisca pour nos partenariats avec les collectivités territoriales
5
5
  Home-page: https://github.com/openfisca/openfisca-france-local
6
6
  Author: OpenFisca Team
@@ -1,6 +1,6 @@
1
- OpenFisca_France_Local-6.14.0.data/scripts/openfisca_local_test,sha256=M55UQ5tskwZpJVLXGqlIcVs1nVZ2pBr_-R9jh-z2tbw,128
1
+ OpenFisca_France_Local-6.15.0.data/scripts/openfisca_local_test,sha256=M55UQ5tskwZpJVLXGqlIcVs1nVZ2pBr_-R9jh-z2tbw,128
2
2
  openfisca_france_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- openfisca_france_local/aides_jeunes_reform.py,sha256=ai1nfE0WPmBjTNSc3WoYQ71kOquaTEjdX8iOheistK0,16418
3
+ openfisca_france_local/aides_jeunes_reform.py,sha256=2Kf9AUH_oOelsfU8nKuzamX1X9VyJlImlJ35RrVqbDA,19055
4
4
  openfisca_france_local/convert_benefit_conditions_to_parameters.py,sha256=qMQNMQKJh-m77KWvbAaMxO2VHB8SwUtVw80c7r7YeFc,6304
5
5
  openfisca_france_local/epci_test_factory.py,sha256=QtasFXb9xH2ZZhOt4a2XpfpuaJJgH8HLaKoNV2nuhl0,1211
6
6
  openfisca_france_local/epcicom2020.xlsx,sha256=dh0_urEHajdv0FoxbFAgyXIMH4s8xlAeriBpVklrqeg,3102230
@@ -26,6 +26,7 @@ openfisca_france_local/departements/cotes_d_armor/fonds_solidarite_logement/acce
26
26
  openfisca_france_local/departements/cotes_d_armor/fonds_solidarite_logement/assurance_locative_energie.py,sha256=bGqoCLOOE6a3Fe4yLBCEW4Ex20UTg7tuO_X6cvkZ1LI,2166
27
27
  openfisca_france_local/departements/cotes_d_armor/fonds_solidarite_logement/base_ressource.py,sha256=orO3nwyVlCnGK9gIEd0lm88DgGCk1FkFqdvuI6CrdTE,2072
28
28
  openfisca_france_local/departements/eure_et_loir/adefip.py,sha256=tirnODplwwAJFT7kln0Ll-sMo7UDr1HvYmT6Gw8CK20,838
29
+ openfisca_france_local/departements/eure_et_loir/aep.py,sha256=S9Ig5OkU80IvWMH2vOW5ta8EySGjswyeuJbRYDTOW1I,787
29
30
  openfisca_france_local/departements/eure_et_loir/aide-menagere.py,sha256=-KS-BpqJOOrQ1SGSPfpYKfafsPio93ud6RXTMFfrKKc,7546
30
31
  openfisca_france_local/departements/eure_et_loir/ash.py,sha256=7k-vlvd4dtx3sAfoq3n6sqSseV7Lt5rHSb5roJlfeJ0,5157
31
32
  openfisca_france_local/departements/eure_et_loir/caracteristiques_socio_demographiques.py,sha256=OUzrhyk6LX1iXReviF4lJVA8jkboxcIUfruVvE1y8Hs,1984
@@ -195,6 +196,7 @@ tests/departements/cotes_d_armor/eligibilite.yml,sha256=Iilaz7lBJ1GmeW-QWFtX4WNQ
195
196
  tests/departements/cotes_d_armor/fonds_solidarite_logement_acces_maintien.yml,sha256=ajuQWCnRSORQUlmtXd8Dzq2qmMmvHmDiU47Mii8YcII,999
196
197
  tests/departements/cotes_d_armor/fonds_solidarite_logement_assurance_locative_energie.yml,sha256=XLPJJx4R6eU7o4yAnivcG5nTF33sYuFeElvzzL-ciys,317
197
198
  tests/departements/eure_et_loir/adefip.yml,sha256=qgrpglaHdSk0s6m84EDAPWyS0lIDLRaSbmkjMzBHmKM,3514
199
+ tests/departements/eure_et_loir/aep.yml,sha256=kS311GJjIL2Shi642_A1iJaOx-vD0xO41tnbcb7MTVY,2067
198
200
  tests/departements/eure_et_loir/aide-menagere-personne-agee.yml,sha256=tlxoE5U1jxpIoOSR73HB3zXYYO9AnyVyLbLi6rOXI5A,7827
199
201
  tests/departements/eure_et_loir/aide-menagere-personne-handicap.yml,sha256=xcVH8dSkVRKUndU6Oz_nxFZfm5B8HIF7J80X8962J5I,6069
200
202
  tests/departements/eure_et_loir/ash_personne_agee.yml,sha256=SEEu-jrl8koJGqivRjdro9Q2kwkFtWCv-WMR_TeMj1k,7127
@@ -256,8 +258,8 @@ tests/regions/occitanie/carte_jeune_region.yml,sha256=t86RNkSuBYr2fEt60WZi0R115n
256
258
  tests/regions/occitanie/carte_transport_scolaire.yml,sha256=ZzVRWnH6i9nni7hatdfUX0ltcWR2BCwh4BLP7UpKuZE,318
257
259
  tests/regions/occitanie/msa_midi_pyrenees_sud/aide_permis.yml,sha256=zAI_NBTfsP_Q72pDabN2ChQnpK98xasXetIQJmq6LTc,439
258
260
  tests/regions/pays_de_la_loire/epass_jeunes_culture_sport.yaml,sha256=vgdq2hFtBWYWHHmO70bPV0lR_0wohJfmJGQb48A0EpQ,336
259
- OpenFisca_France_Local-6.14.0.dist-info/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
260
- OpenFisca_France_Local-6.14.0.dist-info/METADATA,sha256=VU5vEX7HEzkPidnO20Iq4ulJh1Zm_a_RO-7bxPhPmVg,1170
261
- OpenFisca_France_Local-6.14.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
262
- OpenFisca_France_Local-6.14.0.dist-info/top_level.txt,sha256=DPfQtZjavxRdHDsGTetqu5AEeVMEEBtG1qdv7ijuwWQ,56
263
- OpenFisca_France_Local-6.14.0.dist-info/RECORD,,
261
+ OpenFisca_France_Local-6.15.0.dist-info/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
262
+ OpenFisca_France_Local-6.15.0.dist-info/METADATA,sha256=-1ohIAoVozEZZOZ7aEj9MADMGWNYBY4nEd8UAHrWqyo,1170
263
+ OpenFisca_France_Local-6.15.0.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
264
+ OpenFisca_France_Local-6.15.0.dist-info/top_level.txt,sha256=DPfQtZjavxRdHDsGTetqu5AEeVMEEBtG1qdv7ijuwWQ,56
265
+ OpenFisca_France_Local-6.15.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -284,6 +284,9 @@ ProfileEvaluator = collections.namedtuple(
284
284
 
285
285
 
286
286
  def build_condition_evaluator_list(conditions: 'list[dict]') -> 'list[ConditionEvaluator]':
287
+ """
288
+ Établit une correspondance entre les conditions et les fonctions qui évaluent ces conditions.
289
+ """
287
290
  try:
288
291
  evaluators: 'list[ConditionEvaluator]' = [
289
292
  ConditionEvaluator(condition, condition_table[condition['type']])
@@ -296,6 +299,9 @@ def build_condition_evaluator_list(conditions: 'list[dict]') -> 'list[ConditionE
296
299
 
297
300
 
298
301
  def build_profil_evaluator(profil: dict) -> ProfileEvaluator:
302
+ """
303
+ Associe un test d'éligibilité au profil et pour chacune de ses conditions.
304
+ """
299
305
  try:
300
306
  predicate = profil_table[profil['type']]
301
307
  except KeyError:
@@ -334,6 +340,12 @@ def eval_profil(profil_evaluator: ProfileEvaluator,
334
340
 
335
341
 
336
342
  def generate_variable(benefit: dict):
343
+ """
344
+ Créé la variable qui va être intégrée dans le TaxAndBenefitSystem.
345
+
346
+ Génère une `Variable` Openfisca dont le type est la formule correspondent
347
+ aux données du dictionaire source issue d'un fichier `YAML`.
348
+ """
337
349
  variable_name: str = benefit['slug']
338
350
  amount = benefit.get('montant')
339
351
 
@@ -379,6 +391,21 @@ default_institutions_path = 'test_data/institutions'
379
391
 
380
392
 
381
393
  class aides_jeunes_reform_dynamic(reforms.Reform):
394
+ """
395
+ Cette réforme n'est pas une réforme au sens légal du terme.
396
+
397
+ La réforme ici présente est utilisée pour lire des fichiers `YAML`
398
+ qui modélisent des dispositifs d'aides sociales avec des conditions simples
399
+ de manière à les intégrer dans une instance Openfisca.
400
+
401
+ Pour utiliser la réforme, il faut :
402
+ - Définir le chemin des dossiers qui contiennent
403
+ les aides et les institutions avec les variables d'environement
404
+ `DYNAMIC_BENEFIT_FOLDER` et `DYNAMIC_INSTITUTION_FOLDER`
405
+ - Lancer Openfisca en appelant la réforme :
406
+ `--reform openfisca_france_local.aides_jeunes_reform.aides_jeunes_reform_dynamic`
407
+ """
408
+
382
409
  def __init__(self, baseline, benefits_folder_path=default_benefit_path, institutions_folder_path=default_institutions_path):
383
410
  self.benefits_folder_path = getenv('DYNAMIC_BENEFIT_FOLDER', benefits_folder_path)
384
411
  self.institutions_folder_path = getenv('DYNAMIC_INSTITUTION_FOLDER', institutions_folder_path)
@@ -403,12 +430,30 @@ class aides_jeunes_reform_dynamic(reforms.Reform):
403
430
 
404
431
  def _extract_benefit_file_content(self, benefit_path: str):
405
432
  def _convert_institution_to_condition(benefit: dict) -> dict:
433
+ """
434
+ Si le fichier `YAML` traité contient une condition de type `attached_to_institution`,
435
+ un traitement est nécessaire car les modalités de cette condition ne sont pas précisées
436
+ dans le fichier en question.
437
+
438
+ Cette condition est une condition géographique.
439
+
440
+ Il faut aller récupérer les informations liées à l'institution en question
441
+ dans un fichier qui modélise l'institution correspondante pour ensuite ajouter
442
+ une condition géographique équivalente.
443
+
444
+ Il existe 4 type de condition géographique :
445
+ `msa`, `caf`, `epci`, `regions`, `departements` et `communes`.
446
+ """
406
447
  if {'type': 'attached_to_institution'} in benefit['conditions_generales']:
407
448
  conditions_generales_without_attached_institution = [
408
449
  condition for condition
409
450
  in benefit['conditions_generales']
410
451
  if condition != {'type': 'attached_to_institution'}]
411
452
 
453
+ # /!\ Pas de mise en cache faite ici. Si deux fichiers font appel à la même institution,
454
+ # le fichier de l'institution en question sera ouvert 2 fois.
455
+ # Si un jour la condition `attached_to_institution` venait à être utilisée de manière
456
+ # intensive, il pourrait être intéressant d'implanter un cache ici
412
457
  with open(f'{self.institutions_folder_path}/{benefit["institution"]}.yml') as file:
413
458
  institution: dict = yaml.safe_load(file)
414
459
 
@@ -429,6 +474,13 @@ class aides_jeunes_reform_dynamic(reforms.Reform):
429
474
  return benefit
430
475
 
431
476
  def _slug_from_path(path: str):
477
+ """
478
+ Pour créer une nouvelle variable Openfisca, il est necessaire
479
+ de lui donner un nom qui respecte la syntaxe d'une variable Python.
480
+
481
+ Cette méthode utilise le nom du fichier pour déterminer
482
+ un nom de variable compatible.
483
+ """
432
484
  return path.split('/')[-1].replace('-', '_').split('.')[0]
433
485
 
434
486
  with open(benefit_path) as file:
@@ -0,0 +1,18 @@
1
+ from openfisca_france.model.base import Variable, Menage, MONTH
2
+
3
+ class eure_et_loir_eligibilite_aep(Variable):
4
+ value_type = bool
5
+ entity = Menage
6
+ definition_period = MONTH
7
+ label = "En Eure-et-Loir, éligibilité a l'Action Éducative de Promixité (AEP)"
8
+ reference = [
9
+ "https://eurelien.fr/wp-content/uploads/2023/01/l_aide_educative_de_proximite.pdf",
10
+ "https://eurelien.fr/mon-quotidien/enfance-et-famille/#Laction-educative"
11
+ ]
12
+
13
+ def formula(menage, period):
14
+ reside_eure_et_loir = menage('eure_et_loir_eligibilite_residence', period)
15
+ enfants_a_charge = menage.members('enfant_a_charge', period.this_year)
16
+ has_enfants_a_charge = menage.sum(enfants_a_charge) > 0
17
+
18
+ return reside_eure_et_loir * has_enfants_a_charge
@@ -0,0 +1,88 @@
1
+ - name: Eligibilité à l'aide AEP d'Eure-et-Loir avec menage ayant des enfants à charge
2
+ period: 2023-01
3
+ input:
4
+ individus:
5
+ parent1:
6
+ salaire_imposable: 1000
7
+ parent2:
8
+ salaire_imposable: 0
9
+ enfant1:
10
+ age: 8
11
+ enfant_a_charge:
12
+ 2023: True
13
+ enfant2:
14
+ age: 12
15
+ enfant_a_charge:
16
+ 2023: True
17
+ menage:
18
+ personne_de_reference: parent1
19
+ conjoint: parent2
20
+ enfants: [ "enfant1", "enfant2" ]
21
+ depcom: 28000
22
+ output:
23
+ eure_et_loir_eligibilite_aep: True
24
+
25
+ - name: Eligibilité à l'aide AEP d'Eure-et-Loir avec menage n'ayant pas d'enfants à charge
26
+ period: 2023-01
27
+ input:
28
+ individus:
29
+ parent1:
30
+ salaire_imposable: 1000
31
+ parent2:
32
+ salaire_imposable: 0
33
+ enfant1:
34
+ age: 8
35
+ enfant_a_charge:
36
+ 2023: False
37
+ enfant2:
38
+ age: 12
39
+ enfant_a_charge:
40
+ 2023: False
41
+ menage:
42
+ personne_de_reference: parent1
43
+ conjoint: parent2
44
+ enfants: [ "enfant1", "enfant2" ]
45
+ depcom: 28000
46
+ output:
47
+ eure_et_loir_eligibilite_aep: False
48
+
49
+ - name: Eligibilité à l'aide AEP d'Eure-et-Loir avec menage n'ayant pas d'enfants
50
+ period: 2023-01
51
+ input:
52
+ individus:
53
+ parent1:
54
+ salaire_imposable: 1000
55
+ parent2:
56
+ salaire_imposable: 0
57
+ menage:
58
+ personne_de_reference: parent1
59
+ conjoint: parent2
60
+ enfants: []
61
+ depcom: 28000
62
+ output:
63
+ eure_et_loir_eligibilite_aep: False
64
+
65
+
66
+ - name: Eligibilité à l'aide AEP d'Eure-et-Loir avec menage n'habitant pas en Eure-et-Loir
67
+ period: 2023-01
68
+ input:
69
+ individus:
70
+ parent1:
71
+ salaire_imposable: 1000
72
+ parent2:
73
+ salaire_imposable: 0
74
+ enfant1:
75
+ age: 8
76
+ enfant_a_charge:
77
+ 2023: True
78
+ enfant2:
79
+ age: 12
80
+ enfant_a_charge:
81
+ 2023: True
82
+ menage:
83
+ personne_de_reference: parent1
84
+ conjoint: parent2
85
+ enfants: [ "enfant1", "enfant2" ]
86
+ depcom: 45000
87
+ output:
88
+ eure_et_loir_eligibilite_aep: False