From 02afdb60dbb7aa11d21b7e131064297e5178c64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9o=20Baras?= Date: Tue, 30 Mar 2021 07:59:21 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9porte=20les=20donn=C3=A9es=20officielles?= =?UTF-8?q?=20dans=20officiel.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/officiel.py | 13 +++++++++++++ python/ressource.py | 9 +-------- 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 python/officiel.py diff --git a/python/officiel.py b/python/officiel.py new file mode 100644 index 0000000..dda564e --- /dev/null +++ b/python/officiel.py @@ -0,0 +1,13 @@ +import logging, yaml + +__LOGGER = logging.getLogger(__name__) + +# Récupère les informations officielles sur les ressources (code/nom) +with open("pn/ressources.yml", 'r', encoding="utf8") as fid: + DATA_RESSOURCES = yaml.load(fid.read(), Loader=yaml.Loader) +# Récupère les données officielles des ACs +with open("pn/acs.yml", 'r', encoding="utf8") as fid: + DATA_ACS = yaml.load(fid.read(), Loader=yaml.Loader) +with open("pn/saes.yml", 'r', encoding="utf8") as fid: + DATA_SAES = yaml.load(fid.read(), Loader=yaml.Loader) + diff --git a/python/ressource.py b/python/ressource.py index 8493d6b..fddd4e6 100644 --- a/python/ressource.py +++ b/python/ressource.py @@ -3,18 +3,11 @@ import logging import re import yaml import unicodedata +from officiel import * from modeles import * __LOGGER = logging.getLogger(__name__) -# Récupère les informations officielles sur les ressources (code/nom) -with open("pn/ressources.yml", 'r', encoding="utf8") as fid: - DATA_RESSOURCES = yaml.load(fid.read(), Loader=yaml.Loader) -# Récupère les données officielles des ACs -with open("pn/acs.yml", 'r', encoding="utf8") as fid: - DATA_ACS = yaml.load(fid.read(), Loader=yaml.Loader) -with open("pn/saes.yml", 'r', encoding="utf8") as fid: - DATA_SAES = yaml.load(fid.read(), Loader=yaml.Loader) class Ressource(): """Classe modélisant les ressources"""