OpenFisca-France-Local 6.13.0__py3-none-any.whl → 6.14.1__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.13.0
3
+ Version: 6.14.1
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.13.0.data/scripts/openfisca_local_test,sha256=M55UQ5tskwZpJVLXGqlIcVs1nVZ2pBr_-R9jh-z2tbw,128
1
+ OpenFisca_France_Local-6.14.1.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
@@ -17,6 +17,8 @@ openfisca_france_local/communes/illkirch_graffenstaden/base.py,sha256=L90ys8g0jd
17
17
  openfisca_france_local/communes/iwuy/aide_permis.py,sha256=Xr-5NCWux1Hk4oFGurkWFkIFyEhxVDWYsR1hszzngvQ,933
18
18
  openfisca_france_local/communes/le_cateau/aide_permis.py,sha256=Ms2PKH-35eZc0ibbRbVIjOLc5gIwS0aHHdZh-ef20FI,1238
19
19
  openfisca_france_local/communes/les_rues_des_vignes/aide_permis.py,sha256=bPTeIT7ap4suySmzKBXDOORDmFpBaNyCQMuL-LFVQqg,1058
20
+ openfisca_france_local/communes/montpellier/eligibilite.py,sha256=aC3UfG7dZ9qHFa_DPVqUHKJJC4IwZYV5YPh4zQatAzk,360
21
+ openfisca_france_local/communes/montpellier/montpellier_mutuelle_communale.py,sha256=h4i5HTuHoGMwh7O1m8hxyN5ul4-KjaI1qszEPNe6J28,764
20
22
  openfisca_france_local/communes/nantes/aide_carte_blanche.py,sha256=uGs6HUZgJzuqddClJIuVU9l731ZjVCKQTW9RWRCNhtc,871
21
23
  openfisca_france_local/communes/saint_louis/eligibilite.py,sha256=UoTy7S7WABNTMcEVZai-vhj-mC5gyhcsW456dw7-iyg,398
22
24
  openfisca_france_local/departements/cotes_d_armor/eligibilite.py,sha256=8-qOmLSEc2i9jcKOkM-AD1s9Ug9GeWxsgguym7t8WkE,448
@@ -186,6 +188,7 @@ tests/communes/carcassonne/aide_permis.yaml,sha256=gqE1qdqz0l3cjDQMCuKjYpN-klauO
186
188
  tests/communes/iwuy/aide_permis.yml,sha256=vbWLT4hP4x3xDBBP8fh-zShCGjxsEEduhGzinS_TPCk,142
187
189
  tests/communes/le_cateau/aide_permis.yml,sha256=Hf1RI6pdgkL7pvyDb4euV9PVea7s1U-AyZ5JDNrJ0_0,223
188
190
  tests/communes/les_rues_des_vignes/aide_permis.yml,sha256=NbGXyaOT1lft1eAvB1zecuS1qqJMDnbnV8k-byhB_xk,157
191
+ tests/communes/montpellier/montpellier_mutuelle_communale.yml,sha256=07b43kilDgf2F9dwdNvLnl2RfwkhYVwg8t-bH_e4S1g,335
189
192
  tests/communes/nantes/aide_carte_blanche.yml,sha256=mPbfGL3I5nS9bPrtl0vERBYnG7B9RhY3EZonrM0l-sU,326
190
193
  tests/departements/cotes_d_armor/base_ressource.yml,sha256=FWHCWUeKedi5HiluAr9vBQt1ZjugxvAogKtXAZ2wkJU,1125
191
194
  tests/departements/cotes_d_armor/eligibilite.yml,sha256=Iilaz7lBJ1GmeW-QWFtX4WNQAWyQ4co3zClBVpCHr2U,119
@@ -253,8 +256,8 @@ tests/regions/occitanie/carte_jeune_region.yml,sha256=t86RNkSuBYr2fEt60WZi0R115n
253
256
  tests/regions/occitanie/carte_transport_scolaire.yml,sha256=ZzVRWnH6i9nni7hatdfUX0ltcWR2BCwh4BLP7UpKuZE,318
254
257
  tests/regions/occitanie/msa_midi_pyrenees_sud/aide_permis.yml,sha256=zAI_NBTfsP_Q72pDabN2ChQnpK98xasXetIQJmq6LTc,439
255
258
  tests/regions/pays_de_la_loire/epass_jeunes_culture_sport.yaml,sha256=vgdq2hFtBWYWHHmO70bPV0lR_0wohJfmJGQb48A0EpQ,336
256
- OpenFisca_France_Local-6.13.0.dist-info/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
257
- OpenFisca_France_Local-6.13.0.dist-info/METADATA,sha256=pk9JbBrJBe4oNOFM6aEQNaEm4Vkt4HiAyEvoquqKoiw,1170
258
- OpenFisca_France_Local-6.13.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
259
- OpenFisca_France_Local-6.13.0.dist-info/top_level.txt,sha256=DPfQtZjavxRdHDsGTetqu5AEeVMEEBtG1qdv7ijuwWQ,56
260
- OpenFisca_France_Local-6.13.0.dist-info/RECORD,,
259
+ OpenFisca_France_Local-6.14.1.dist-info/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
260
+ OpenFisca_France_Local-6.14.1.dist-info/METADATA,sha256=9NyjtSZrO3EA5yhxggVndS8lFIaRHIWCNDPeuoHXKmM,1170
261
+ OpenFisca_France_Local-6.14.1.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
262
+ OpenFisca_France_Local-6.14.1.dist-info/top_level.txt,sha256=DPfQtZjavxRdHDsGTetqu5AEeVMEEBtG1qdv7ijuwWQ,56
263
+ OpenFisca_France_Local-6.14.1.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,10 @@
1
+ from openfisca_france.model.base import Menage, MONTH, Variable
2
+
3
+ class montpellier_eligibilite_residence(Variable):
4
+ value_type = bool
5
+ entity = Menage
6
+ definition_period = MONTH
7
+ label = "Éligibilité résidentielle d'un ménage aux dipositifs de Montpellier"
8
+
9
+ def formula(menage, period):
10
+ return menage('depcom', period) == b'34172'
@@ -0,0 +1,17 @@
1
+ from openfisca_france.model.base import Variable, MONTH, not_, Famille
2
+
3
+ class montpellier_mutuelle_communale(Variable):
4
+ value_type = bool
5
+ entity = Famille
6
+ definition_period = MONTH
7
+ label = "Mutuelle communale de la ville de Montpellier"
8
+ reference = [
9
+ "https://www.montpellier.fr/4884-mutuelle-communale.htm"
10
+ ]
11
+
12
+ def formula(famille, period):
13
+ eligibilite_residentielle = famille.demandeur.menage('montpellier_eligibilite_residence', period)
14
+ css_participation_forfaitaire = famille('css_participation_forfaitaire', period)
15
+ cmu_c = famille('cmu_c', period)
16
+ eligibilite_css_cmu_c = (css_participation_forfaitaire > 0) | cmu_c
17
+ return eligibilite_residentielle * not_(eligibilite_css_cmu_c)
@@ -0,0 +1,8 @@
1
+ - name: "Égibilité à la mutuelle communale de Montpellier"
2
+ period: 2024-10
3
+ input:
4
+ depcom: ["34172","34172", "34172", "68400", "68400"]
5
+ css_participation_forfaitaire_montant: [0, 0, 20, 25, 30]
6
+ cmu_c: [False, True, False, False, False]
7
+ output:
8
+ montpellier_mutuelle_communale: [True, False, False, False, False]