aboutsummaryrefslogtreecommitdiff
path: root/sgdfi/_dbs
diff options
context:
space:
mode:
authorThomas Touhey <thomas@touhey.fr>2020-08-04 00:53:15 +0200
committerThomas Touhey <thomas@touhey.fr>2020-08-04 00:53:15 +0200
commitcaf1063c5f75a140fbc5b2bb4d72931b7c81ca38 (patch)
treee943e9e9da9334f9cee568682e0a26f876f2479b /sgdfi/_dbs
parent89c0f6a4dacb74e7a50df9a13d962e6ecc5074ac (diff)
Latest edits
Diffstat (limited to 'sgdfi/_dbs')
-rwxr-xr-xsgdfi/_dbs/__init__.py19
-rwxr-xr-xsgdfi/_dbs/_code.py181
-rwxr-xr-xsgdfi/_dbs/_dept.py683
-rwxr-xr-xsgdfi/_dbs/_event.py75
-rwxr-xr-xsgdfi/_dbs/_funcdata.py767
-rwxr-xr-xsgdfi/_dbs/_funcs.py232
-rwxr-xr-xsgdfi/_dbs/_ops.py357
-rwxr-xr-xsgdfi/_dbs/_regime.py26
-rwxr-xr-xsgdfi/_dbs/_st.py167
-rwxr-xr-xsgdfi/_dbs/_stspe.py120
-rwxr-xr-xsgdfi/_dbs/_ststatus.py118
11 files changed, 0 insertions, 2745 deletions
diff --git a/sgdfi/_dbs/__init__.py b/sgdfi/_dbs/__init__.py
deleted file mode 100755
index 8bc7dec..0000000
--- a/sgdfi/_dbs/__init__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-""" Databases for SGDFi. """
-
-from ._ops import OperationType, OperationTypeData
-from ._st import StructureType, StructureTypeData
-from ._stspe import StructureSpeciality, StructureSpecialityData
-from ._ststatus import StructureStatus, StructureStatusData
-from ._funcs import Function, FunctionData, FunctionRawData
-from ._event import EventType, EventTypeData
-from ._dept import Department, DepartmentData
-from ._code import Code, CodeType
-
-from ._regime import AllocationsRegime
-
-# End of file.
diff --git a/sgdfi/_dbs/_code.py b/sgdfi/_dbs/_code.py
deleted file mode 100755
index 1d8434b..0000000
--- a/sgdfi/_dbs/_code.py
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-""" Code decoding for SGDFi. """
-
-from enum import Enum as _Enum, unique as _unique
-
-from ._st import StructureType as _StructureType
-
-__all__ = ["Code", "CodeType"]
-
-@_unique
-class CodeType(_Enum):
- """ Unknown code type. """
- UNKNOWN = 0
-
- """ Structure. """
- STRUCTURE = 1
-
- """ Adherent. """
- ADHERENT = 2
-
-_strcodeallowed = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
-def _strcode(value):
- """ Normalize the code and validate it. """
-
- oldvalue = value
-
- try:
- value = f"{int(value):09d}"
- except ValueError:
- pass
-
- value = value.strip().upper()
- value = value.rjust(9, '0')
-
- if len(value) != 9 or any(c not in _strcodeallowed for c in value):
- raise ValueError(f"Can't get a code out of {repr(oldvalue)}")
- return value
-
-class Code:
- """ A structure code, which is a 9-digit number. """
-
- def __init__(self, value):
- self.__code = _strcode(value)
-
- # Try to deduce things of this code.
- # This algorithm is an implementation of the one described in
- # the documentation, in `env/intranet/index.rst`.
-
- typ = CodeType.UNKNOWN
- styp = None
- sec = value[:2]
- dep = None
- depn = None
- grpn = None
-
- if value == '000000000':
- typ = CodeType.STRUCTURE
- styp = _StructureType.SOMMET
- elif value[2:] in ('0000000', '9999999'):
- typ = CodeType.STRUCTURE
- styp = _StructureType.CENTRE_NATIONAL
- elif value[:2] in ('12', '13', '14', '15', '16', '17'):
- typ = CodeType.ADHERENT
- elif value[:2] == '98':
- typ = CodeType.STRUCTURE
-
- if value[2:7] == '88001':
- if value[8] == '8':
- styp = _StructureType.ASSOCIES_N
- else:
- styp = _StructureType.CENTRE_NATIONAL
- else:
- if value[7] == '8':
- styp = _StructureType.ASSOCIES_N
- else:
- styp = _StructureType.CENTRE_NATIONAL
- else:
- dep = value[2:4]
- depn = int(value[4])
-
- typ = CodeType.STRUCTURE
-
- if value[5:7] == '00':
- if value[7:9] == '00':
- styp = _StructureType.TERRITOIRE
- else:
- styp = _StructureType.ASSOCIES_T
- else:
- grpn = int(value[5:7]) - 1
-
- if value[7:9] == '00':
- styp = _StructureType.GROUPE
- elif value[7] == '1':
- styp = _StructureType.UNITE_8_11_ANS
- elif value[7] == '2':
- styp = _StructureType.UNITE_11_14_ANS
- elif value[7] == '3':
- styp = _StructureType.UNITE_14_17_ANS
- elif value[7] == '7':
- styp = _StructureType.UNITE_FARFADET
- elif value[7] == '9':
- styp = _StructureType.UNITE_VENT_DU_LARGE
- else:
- styp = _StructureType.ASSOCIES_L
-
- self.__type = typ
- self.__subtype = styp
- self.__sector = sec
- self.__dep = dep
- self.__depn = depn
- self.__grpn = grpn
-
- def __repr__(self):
- p = [f"code = {self.__code}"]
- if self.__type != CodeType.UNKNOWN:
- p.append(f"type = {self.__type}")
- if self.__type == CodeType.STRUCTURE:
- p.append(f"subtype = {self.__subtype}")
- if self.__sector is not None:
- p.append(f"sector = {self.__sector}")
- if self.__dep is not None:
- p.append(f"dep = {self.__dep}")
- if self.__depn is not None:
- p.append(f"depn = {self.__depn}")
- if self.__grpn is not None:
- p.append(f"grpn = {self.__grpn}")
-
- return f"{self.__class__.__name__}({', '.join(p)})"
-
- def __str__(self):
- return self.__code
-
- def __eq__(self, value):
- try:
- code = _strcode(value)
- return self.__code == code
- except ValueError:
- return False
-
- @property
- def type(self):
- """ The code type. """
-
- return self.__type
-
- @property
- def subtype(self):
- """ The code subtype. """
-
- return self.__subtype
-
- @property
- def sector(self):
- """ The sector (first two characters). """
-
- return self.__sector
-
- @property
- def department(self):
- """ The code of the associated administrative department. """
-
- return self.__dep
-
- @property
- def territory_index(self):
- """ The number of the territory in the administrative department. """
-
- return self.__depn
-
- @property
- def group_index(self):
- """ The index of the group in the territory. """
-
- return self.__grpn
-
-# End of file.
diff --git a/sgdfi/_dbs/_dept.py b/sgdfi/_dbs/_dept.py
deleted file mode 100755
index c5e1144..0000000
--- a/sgdfi/_dbs/_dept.py
+++ /dev/null
@@ -1,683 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-""" Department reference for SGDFi. """
-
-from enum import Enum as _Enum, unique as _unique
-from unicodedata import normalize as _udnormalize
-
-__all__ = ["Department", "DepartmentData"]
-
-@_unique
-class Department(_Enum):
- """ The default department (unknown). """
- UNKNOWN = -1
-
- """ 00 - Not given. """
- NONE = 0
-
- '01 - Ain'
- AIN = 1
-
- '02 - Aisne'
- AISNE = 2
-
- '03 - Allier'
- ALLIER = 3
-
- '04 - Alpes-de-Haute-Provence'
- ALPES_DE_HAUTE_PROVENCE = 4
-
- '05 - Hautes-Alpes'
- HAUTES_ALPES = 5
-
- '06 - Alpes-Maritimes'
- ALPES_MARITIMES = 6
-
- '07 - Ardèche'
- ARDECHE = 7
-
- '08 - Ardennes'
- ARDENNES = 8
-
- '09 - Ariège'
- ARIEGE = 9
-
- '10 - Aube'
- AUBE = 10
-
- '11 - Aude'
- AUDE = 11
-
- '12 - Aveyron'
- AVEYRON = 12
-
- '13 - Bouches-du-Rhône'
- BOUCHES_DU_RHONE = 13
-
- '14 - Calvados'
- CALVADOS = 14
-
- '15 - Cantal'
- CANTAL = 15
-
- '16 - Charente'
- CHARENTE = 16
-
- '17 - Charente-Maritime'
- CHARENTE_MARITIME = 17
-
- '18 - Cher'
- CHER = 18
-
- '19 - Corrèze'
- CORREZE = 19
-
- "21 - Côte-d'Or"
- COTE_D_OR = 21
-
- "22 - Côtes-d'Armor"
- COTES_D_ARMOR = 22
-
- '23 - Creuse'
- CREUSE = 23
-
- '24 - Dordogne'
- DORDOGNE = 24
-
- '25 - Doubs'
- DOUBS = 25
-
- '26 - Drôme'
- DROME = 26
-
- '27 - Eure'
- EURE = 27
-
- '28 - Eure-et-Loir'
- EURE_ET_LOIR = 28
-
- '29 - Finistère'
- FINISTERE = 29
-
- '2A - Corse-du-Sud'
- CORSE_DU_SUD = 120
-
- '2B - Haute-Corse'
- HAUTE_CORSE = 121
-
- '30 - Gard'
- GARD = 30
-
- '31 - Haute-Garonne'
- HAUTE_GARONNE = 31
-
- '32 - Gers'
- GERS = 32
-
- '33 - Gironde'
- GIRONDE = 33
-
- '34 - Hérault'
- HERAULT = 34
-
- '35 - Ille-et-Vilaine'
- ILLE_ET_VILAINE = 35
-
- '36 - Indre'
- INDRE = 36
-
- '37 - Indre-et-Loire'
- INDRE_ET_LOIRE = 37
-
- '38 - Isère'
- ISERE = 38
-
- '39 - Jura'
- JURA = 39
-
- '40 - Landes'
- LANDES = 40
-
- '41 - Loir-et-Cher'
- LOIR_ET_CHER = 41
-
- '42 - Loire'
- LOIRE = 42
-
- '43 - Haute-Loire'
- HAUTE_LOIRE = 43
-
- '44 - Loire-Atlantique'
- LOIRE_ATLANTIQUE = 44
-
- '45 - Loiret'
- LOIRET = 45
-
- '46 - Lot'
- LOT = 46
-
- '47 - Lot-et-Garonne'
- LOT_ET_GARONNE = 47
-
- '48 - Lozère'
- LOZERE = 48
-
- '49 - Maine-et-Loire'
- MAINE_ET_LOIRE = 49
-
- '50 - Manche'
- MANCHE = 50
-
- '51 - Marne'
- MARNE = 51
-
- '52 - Haute-Marne'
- HAUTE_MARNE = 52
-
- '53 - Mayenne'
- MAYENNE = 53
-
- '54 - Meurthe-et-Moselle'
- MEURTHE_ET_MOSELLE = 54
-
- '55 - Meuse'
- MEUSE = 55
-
- '56 - Morbihan'
- MORBIHAN = 56
-
- '57 - Moselle'
- MOSELLE = 57
-
- '58 - Nièvre'
- NIEVRE = 58
-
- '59 - Nord'
- NORD = 59
-
- '60 - Oise'
- OISE = 60
-
- '61 - Orne'
- ORNE = 61
-
- '62 - Pas-de-Calais'
- PAS_DE_CALAIS = 62
-
- '63 - Puy-de-Dôme'
- PUY_DE_DOME = 63
-
- '64 - Pyrénées-Atlantiques'
- PYRENEES_ATLANTIQUES = 64
-
- '65 - Hautes-Pyrénées'
- HAUTES_PYRENEES = 65
-
- '66 - Pyrénées-Orientales'
- PYRENEES_ORIENTALES = 66
-
- '67 - Bas-Rhin'
- BAS_RHIN = 67
-
- '68 - Haut-Rhin'
- HAUT_RHIN = 68
-
- '69 - Rhône'
- RHONE = 69
-
- '70 - Haute-Saône'
- HAUTE_SAONE = 70
-
- '71 - Saône-et-Loire'
- SAONE_ET_LOIRE = 71
-
- '72 - Sarthe'
- SARTHE = 72
-
- '73 - Savoie'
- SAVOIE = 73
-
- '74 - Haute-Savoie'
- HAUTE_SAVOIE = 74
-
- '75 - Paris'
- PARIS = 75
-
- '76 - Seine-Maritime'
- SEINE_MARITIME = 76
-
- '77 - Seine-et-Marne'
- SEINE_ET_MARNE = 77
-
- '78 - Yvelines'
- YVELINES = 78
-
- '79 - Deux-Sèvres'
- DEUX_SEVRES = 79
-
- '80 - Somme'
- SOMME = 80
-
- '81 - Tarn'
- TARN = 81
-
- '82 - Tarn-et-Garonne'
- TARN_ET_GARONNE = 82
-
- '83 - Var'
- VAR = 83
-
- '84 - Vaucluse'
- VAUCLUSE = 84
-
- '85 - Vendée'
- VENDEE = 85
-
- '86 - Vienne'
- VIENNE = 86
-
- '87 - Haute-Vienne'
- HAUTE_VIENNE = 87
-
- '88 - Vosges'
- VOSGES = 88
-
- '89 - Yonne'
- YONNE = 89
-
- '90 - Territoire de Belfort'
- TERRITOIRE_DE_BELFORT = 90
-
- '91 - Essonne'
- ESSONNE = 91
-
- '92 - Hauts-de-Seine'
- HAUTS_DE_SEINE = 92
-
- '93 - Seine-Saint-Denis'
- SEINE_SAINT_DENIS = 93
-
- '94 - Val-de-Marne'
- VAL_DE_MARNE = 94
-
- "95 - Val-d'Oise"
- VAL_D_OISE = 95
-
- '971 - Guadeloupe'
- GUADELOUPE = 971
-
- '972 - Martinique'
- MARTINIQUE = 972
-
- '973 - Guyane'
- GUYANE = 973
-
- '974 - Réunion'
- REUNION = 974
-
- '975 - Saint-Pierre-et-Miquelon'
- SAINT_PIERRE_ET_MIQUELON = 975
-
- '976 - Mayotte'
- MAYOTTE = 976
-
- '984 - Terres australes et antarctiques française'
- TERRES_AUSTRALES_ET_ANTARCTIQUES_FRANCAISE = 984
-
- '986 - Wallis-et-Futuna'
- WALLIS_ET_FUTUNA = 986
-
- '987 - Polynésie française'
- POLYNESIE_FRANCAISE = 987
-
- '988 - Nouvelle-Calédonie'
- NOUVELLE_CALEDONIE = 988
-
- '998 - Monde - tarifs métropole'
- MONDE_TARIFS_METROPOLE = 998
-
- '999 - Monde'
- MONDE = 999
-
-_DepartmentData = {
- Department.UNKNOWN: \
- (None, "Tous", -1),
-
- Department.NONE: \
- ("00", "Non précisé", 9023),
- Department.AIN: \
- ('01', 'Ain', 1),
- Department.AISNE: \
- ('02', 'Aisne', 2),
- Department.ALLIER: \
- ('03', 'Allier', 3),
- Department.ALPES_DE_HAUTE_PROVENCE: \
- ('04', 'Alpes-de-Haute-Provence', 4),
- Department.HAUTES_ALPES: \
- ('05', 'Hautes-Alpes', 5),
- Department.ALPES_MARITIMES: \
- ('06', 'Alpes-Maritimes', 6),
- Department.ARDECHE: \
- ('07', 'Ardèche', 7),
- Department.ARDENNES: \
- ('08', 'Ardennes', 8),
- Department.ARIEGE: \
- ('09', 'Ariège', 9),
- Department.AUBE: \
- ('10', 'Aube', 10),
- Department.AUDE: \
- ('11', 'Aude', 11),
- Department.AVEYRON: \
- ('12', 'Aveyron', 12),
- Department.BOUCHES_DU_RHONE: \
- ('13', 'Bouches-du-Rhône', 13),
- Department.CALVADOS: \
- ('14', 'Calvados', 14),
- Department.CANTAL: \
- ('15', 'Cantal', 15),
- Department.CHARENTE: \
- ('16', 'Charente', 16),
- Department.CHARENTE_MARITIME: \
- ('17', 'Charente-Maritime', 17),
- Department.CHER: \
- ('18', 'Cher', 18),
- Department.CORREZE: \
- ('19', 'Corrèze', 19),
- Department.COTE_D_OR: \
- ('21', "Côte-d'Or", 21),
- Department.COTES_D_ARMOR: \
- ('22', "Côtes-d'Armor", 22),
- Department.CREUSE: \
- ('23', 'Creuse', 23),
- Department.DORDOGNE: \
- ('24', 'Dordogne', 24),
- Department.DOUBS: \
- ('25', 'Doubs', 25),
- Department.DROME: \
- ('26', 'Drôme', 26),
- Department.EURE: \
- ('27', 'Eure', 27),
- Department.EURE_ET_LOIR: \
- ('28', 'Eure-et-Loir', 28),
- Department.FINISTERE: \
- ('29', 'Finistère', 29),
- Department.CORSE_DU_SUD: \
- ('2A', 'Corse-du-Sud', 9021),
- Department.HAUTE_CORSE: \
- ('2B', 'Haute-Corse', 9022),
- Department.GARD: \
- ('30', 'Gard', 30),
- Department.HAUTE_GARONNE: \
- ('31', 'Haute-Garonne', 31),
- Department.GERS: \
- ('32', 'Gers', 32),
- Department.GIRONDE: \
- ('33', 'Gironde', 33),
- Department.HERAULT: \
- ('34', 'Hérault', 34),
- Department.ILLE_ET_VILAINE: \
- ('35', 'Ille-et-Vilaine', 35),
- Department.INDRE: \
- ('36', 'Indre', 36),
- Department.INDRE_ET_LOIRE: \
- ('37', 'Indre-et-Loire', 37),
- Department.ISERE: \
- ('38', 'Isère', 38),
- Department.JURA: \
- ('39', 'Jura', 39),
- Department.LANDES: \
- ('40', 'Landes', 40),
- Department.LOIR_ET_CHER: \
- ('41', 'Loir-et-Cher', 41),
- Department.LOIRE: \
- ('42', 'Loire', 42),
- Department.HAUTE_LOIRE: \
- ('43', 'Haute-Loire', 43),
- Department.LOIRE_ATLANTIQUE: \
- ('44', 'Loire-Atlantique', 44),
- Department.LOIRET: \
- ('45', 'Loiret', 45),
- Department.LOT: \
- ('46', 'Lot', 46),
- Department.LOT_ET_GARONNE: \
- ('47', 'Lot-et-Garonne', 47),
- Department.LOZERE: \
- ('48', 'Lozère', 48),
- Department.MAINE_ET_LOIRE: \
- ('49', 'Maine-et-Loire', 49),
- Department.MANCHE: \
- ('50', 'Manche', 50),
- Department.MARNE: \
- ('51', 'Marne', 51),
- Department.HAUTE_MARNE: \
- ('52', 'Haute-Marne', 52),
- Department.MAYENNE: \
- ('53', 'Mayenne', 53),
- Department.MEURTHE_ET_MOSELLE: \
- ('54', 'Meurthe-et-Moselle', 54),
- Department.MEUSE: \
- ('55', 'Meuse', 55),
- Department.MORBIHAN: \
- ('56', 'Morbihan', 56),
- Department.MOSELLE: \
- ('57', 'Moselle', 57),
- Department.NIEVRE: \
- ('58', 'Nièvre', 58),
- Department.NORD: \
- ('59', 'Nord', 59),
- Department.OISE: \
- ('60', 'Oise', 60),
- Department.ORNE: \
- ('61', 'Orne', 61),
- Department.PAS_DE_CALAIS: \
- ('62', 'Pas-de-Calais', 62),
- Department.PUY_DE_DOME: \
- ('63', 'Puy-de-Dôme', 63),
- Department.PYRENEES_ATLANTIQUES: \
- ('64', 'Pyrénées-Atlantiques', 64),
- Department.HAUTES_PYRENEES: \
- ('65', 'Hautes-Pyrénées', 65),
- Department.PYRENEES_ORIENTALES: \
- ('66', 'Pyrénées-Orientales', 66),
- Department.BAS_RHIN: \
- ('67', 'Bas-Rhin', 67),
- Department.HAUT_RHIN: \
- ('68', 'Haut-Rhin', 68),
- Department.RHONE: \
- ('69', 'Rhône', 69),
- Department.HAUTE_SAONE: \
- ('70', 'Haute-Saône', 70),
- Department.SAONE_ET_LOIRE: \
- ('71', 'Saône-et-Loire', 71),
- Department.SARTHE: \
- ('72', 'Sarthe', 72),
- Department.SAVOIE: \
- ('73', 'Savoie', 73),
- Department.HAUTE_SAVOIE: \
- ('74', 'Haute-Savoie', 74),
- Department.PARIS: \
- ('75', 'Paris', 75),
- Department.SEINE_MARITIME: \
- ('76', 'Seine-Maritime', 76),
- Department.SEINE_ET_MARNE: \
- ('77', 'Seine-et-Marne', 77),
- Department.YVELINES: \
- ('78', 'Yvelines', 78),
- Department.DEUX_SEVRES: \
- ('79', 'Deux-Sèvres', 79),
- Department.SOMME: \
- ('80', 'Somme', 80),
- Department.TARN: \
- ('81', 'Tarn', 81),
- Department.TARN_ET_GARONNE: \
- ('82', 'Tarn-et-Garonne', 82),
- Department.VAR: \
- ('83', 'Var', 83),
- Department.VAUCLUSE: \
- ('84', 'Vaucluse', 84),
- Department.VENDEE: \
- ('85', 'Vendée', 85),
- Department.VIENNE: \
- ('86', 'Vienne', 86),
- Department.HAUTE_VIENNE: \
- ('87', 'Haute-Vienne', 87),
- Department.VOSGES: \
- ('88', 'Vosges', 88),
- Department.YONNE: \
- ('89', 'Yonne', 89),
- Department.TERRITOIRE_DE_BELFORT: \
- ('90', 'Territoire de Belfort', 90),
- Department.ESSONNE: \
- ('91', 'Essonne', 91),
- Department.HAUTS_DE_SEINE: \
- ('92', 'Hauts-de-Seine', 92),
- Department.SEINE_SAINT_DENIS: \
- ('93', 'Seine-Saint-Denis', 93),
- Department.VAL_DE_MARNE: \
- ('94', 'Val-de-Marne', 94),
- Department.VAL_D_OISE: \
- ('95', "Val-d'Oise", 95),
- Department.GUADELOUPE: \
- ('971', 'Guadeloupe', 971),
- Department.MARTINIQUE: \
- ('972', 'Martinique', 972),
- Department.GUYANE: \
- ('973', 'Guyane', 973),
- Department.REUNION: \
- ('974', 'Réunion', 974),
- Department.SAINT_PIERRE_ET_MIQUELON: \
- ('975', 'Saint-Pierre-et-Miquelon', 975),
- Department.MAYOTTE: \
- ('976', 'Mayotte', 985),
- Department.TERRES_AUSTRALES_ET_ANTARCTIQUES_FRANCAISE: \
- ('984', 'Terres australes et antarctiques française', 984),
- Department.WALLIS_ET_FUTUNA: \
- ('986', 'Wallis-et-Futuna', 986),
- Department.POLYNESIE_FRANCAISE: \
- ('987', 'Polynésie française', 987),
- Department.NOUVELLE_CALEDONIE: \
- ('988', 'Nouvelle-Calédonie', 988),
- Department.MONDE_TARIFS_METROPOLE: \
- ('998', 'Monde - tarifs métropole', 9024),
- Department.MONDE: \
- ('999', 'Monde', 99),
-}
-
-def _normalize(value):
- """ Normalize a string for comparison. """
-
- return ''.join(c for c in _udnormalize('NFD', value.casefold()) \
- if c in 'abcdefghijklmnopqrstuvwxyz0123456789')
-
-# Leads are the following:
-# - intranet internal identifier.
-# - same but string version.
-# - normalized name only.
-# - displayed code.
-# - normalized 'dcode - name' (e.g. '01 - AIN').
-
-_DepartmentLeads = {}
-_DepartmentLeads.update({_normalize(name): i for i, (dcode, name, ii) \
- in _DepartmentData.items()})
-_DepartmentLeads.update({_normalize(dcode): i for i, (dcode, name, ii) \
- in _DepartmentData.items() if dcode is not None})
-_DepartmentLeads.update({ii: i for i, (dcode, name, ii) \
- in _DepartmentData.items()})
-_DepartmentLeads.update({str(ii): i for i, (dcode, name, ii) \
- in _DepartmentData.items()})
-_DepartmentLeads.update({_normalize(f"{dcode} - {name}"): i \
- for i, (dcode, name, ii) in _DepartmentData.items() \
- if dcode is not None})
-_DepartmentLeads.update({_normalize(f"{name} - {dcode}"): i \
- for i, (dcode, name, ii) in _DepartmentData.items() \
- if dcode is not None})
-
-class DepartmentData:
- """ Department data (id, name, …). """
-
- def __init__(self, value):
- def isid(id):
- try:
- Department(value)
- except ValueError:
- return False
- return True
-
- self.__id = Department.UNKNOWN
- self.__name = None
- self.__dcode = None
- self.__ii = None
- data = None
-
- if isinstance(value, DepartmentData):
- self.__id = value.id
- self.__ii = value.iid
- self.__dcode = value.displayed_code
- self.__name = value.name
- elif isid(value):
- value = Department(value)
- self.__id = value
-
- data = _DepartmentData.get(value, None)
- else:
- lead = value
- if type(lead) == str:
- lead = _normalize(lead)
-
- try:
- self.__id = _DepartmentLeads[lead]
- data = _DepartmentData.get(self.__id, None)
- except KeyError:
- if type(value) == str:
- self.__name = value
- else:
- raise ValueError("Could not determine a department.") \
- from None
-
- if data is not None:
- self.__dcode = data[0]
- self.__name = data[1]
- self.__ii = data[2]
-
- def __repr__(self):
- p = []
- if self.__id is not None:
- p.append(f"id = {repr(self.__id)}")
- if self.__dcode is not None:
- p.append(f"displayed_code = {repr(self.__dcode)}")
- if self.__name is not None:
- p.append(f"name = {repr(self.__name)}")
- if self.__ii is not None:
- p.append(f"iid = {repr(self.__ii)}")
-
- return f"{self.__class__.__name__}({', '.join(p)})"
-
- @property
- def id(self):
- """ The department identifier, as one of the structure types
- defined in the Department enumeration. """
-
- return self.__id
-
- @property
- def displayed_code(self):
- """ The displayed code. """
-
- return self.__dcode
-
- @property
- def name(self):
- """ The department name. """
-
- return self.__name
-
- @property
- def iid(self):
- """ The internal identifier on the intranet. """
-
- return self.__ii
-
-# End of file.
diff --git a/sgdfi/_dbs/_event.py b/sgdfi/_dbs/_event.py
deleted file mode 100755
index 4cd4bce..0000000
--- a/sgdfi/_dbs/_event.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-""" Event type reference for SGDFi. """
-
-from enum import Enum as _Enum, unique as _unique
-
-__all__ = ["EventType", "EventTypeData"]
-
-@_unique
-class EventType(_Enum):
- """ The default type (unknown). """
- UNKNOWN = 0
-
- """ Sortie journée. """
- DAY = 1
-
- """ Réunion demi-journée. """
- HALF = 2
-
- """ Week-End. """
- WEEKEND = 3
-
- """ Réunion de travail. """
- WORK_MEETING = 4
-
- """ Camp Année. """
- YEAR_CAMP = 5
-
- """ Camp Été. """
- CAMP = 6
-
- """ Extrajob. """
- EXTRAJOB = 7
-
-# Each entry in `_EventTypeData` has the following fields:
-# - Full type name.
-# - Abbreviated type name for XLS exports.
-
-_EventTypeData = {
- EventType.DAY: ("Sortie Journée", ""),
- EventType.HALF: ("Réunion Demi-Journée", "DemJour"),
- EventType.WEEKEND: ("Week-End", "WE"),
- EventType.WORK_MEETING: ("Réunion de travail", "RéuTrav"),
- EventType.YEAR_CAMP: ("Camp Année", ""),
- EventType.CAMP: ("Camp Eté", ""),
- EventType.EXTRAJOB: ("Extrajob", ""),
-}
-
-# Make the leads.
-
-_EventTypeLeads = {}
-_EventTypeLeads.update({full.strip().casefold(): i \
- for i, (full, abbr) in _EventTypeData.items()})
-_EventTypeLeads.update({abbr.strip().casefold(): i \
- for i, (full, abbr) in _EventTypeData.items()})
-
-# Define the data class.
-
-class EventTypeData:
- """ The event type data. """
-
- def __init__(self, value):
- def isid(value):
- try:
- EventType(value)
- except ValueError:
- return False
- return True
-
- # TODO
-
-# End of file.
diff --git a/sgdfi/_dbs/_funcdata.py b/sgdfi/_dbs/_funcdata.py
deleted file mode 100755
index 8df963b..0000000
--- a/sgdfi/_dbs/_funcdata.py
+++ /dev/null
@@ -1,767 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-'Generated functions reference for `_funcs.py`.'
-
-from enum import Enum as _Enum
-
-__all__ = ["Function", "FunctionData"]
-
-# This file was generated, do not edit it manually!
-
-class Function(_Enum):
- "Unknown function."
- UNKNOWN = 0
-
- 'LOUVETEAU / JEANNETTE'
- LOUVETEAU = 1
- JEANNETTE = 1
-
- 'MOUSSAILLON'
- MOUSSAILLON = 2
-
- 'SCOUT / GUIDE'
- SCOUT = 3
- GUIDE = 3
-
- 'MOUSSE'
- MOUSSE = 4
-
- 'PIONNIER / CARAVELLE'
- PIONNIER = 5
- CARAVELLE = 5
-
- 'MARIN / CARAVELLE MARINE'
- MARIN = 6
- CARAVELLE_MARINE = 6
-
- 'COMPAGNON'
- COMPAGNON = 7
-
- 'COMPAGNON MARIN'
- COMPAGNON_MARIN = 8
-
- 'COMPAGNON 3EME TEMPS'
- COMPAGNON_3EME_TEMPS = 9
-
- 'FARFADET'
- FARFADET = 10
-
- 'MEMBRE ASSOCIE / MEMBRE ASSOCIEE'
- MEMBRE_ASSOCIE_L = 11
- MEMBRE_ASSOCIEE_L = 11
-
- 'MEMBRE ASSOCIE / MEMBRE ASSOCIEE'
- MEMBRE_ASSOCIE_N = 12
- MEMBRE_ASSOCIEE_N = 12
-
- 'MEMBRE ASSOCIE / MEMBRE ASSOCIEE'
- MEMBRE_ASSOCIE_T = 13
- MEMBRE_ASSOCIEE_T = 13
-
- 'VENT DU LARGE'
- VENT_DU_LARGE = 14
-
- "RESPONSABLE D'UNITE LOUVETEAU JEANNETTE"
- RESPONSABLE_UNITE_LOUVETEAU_JEANNETTE = 15
-
- "RESPONSABLE D'UNITE MOUSSAILLON"
- RESPONSABLE_UNITE_MOUSSAILLON = 16
-
- 'CHEF LOUVETEAU JEANNETTE / CHEFTAINE LOUVETEAU JEANNETTE'
- CHEF_LOUVETEAU_JEANNETTE = 17
- CHEFTAINE_LOUVETEAU_JEANNETTE = 17
-
- 'CHEF MOUSSAILLON / CHEFTAINE MOUSSAILLON'
- CHEF_MOUSSAILLON = 18
- CHEFTAINE_MOUSSAILLON = 18
-
- "RESPONSABLE D'UNITE SCOUT GUIDE"
- RESPONSABLE_UNITE_SCOUT_GUIDE = 19
-
- "RESPONSABLE D'UNITE MOUSSE"
- RESPONSABLE_UNITE_MOUSSE = 20
-
- 'CHEF SCOUT GUIDE / CHEFTAINE SCOUT GUIDE'
- CHEF_SCOUT_GUIDE = 21
- CHEFTAINE_SCOUT_GUIDE = 21
-
- 'CHEF MOUSSE / CHEFTAINE MOUSSE'
- CHEF_MOUSSE = 22
- CHEFTAINE_MOUSSE = 22
-
- "RESPONSABLE D'UNITE PIONNIER CARAVELLE"
- RESPONSABLE_UNITE_PIONNIER_CARAVELLE = 23
-
- "RESPONSABLE D'UNITE FLOTILLE - CARAVELLE MARINE"
- RESPONSABLE_UNITE_FLOTILLE_CARAVELLE_MARINE = 24
-
- 'CHEF PIONNIER CARAVELLE / CHEFTAINE PIONNIER CARAVELLE'
- CHEF_PIONNIER_CARAVELLE = 25
- CHEFTAINE_PIONNIER_CARAVELLE = 25
-
- 'CHEF FLOTILLE - CARAVELLE MARINE / CHEFTAINE FLOTILLE - CARAVELLE MARINE'
- CHEF_FLOTILLE_CARAVELLE_MARINE = 26
- CHEFTAINE_FLOTILLE_CARAVELLE_MARINE = 26
-
- 'ACCOMPAGNATEUR COMPAGNON / ACCOMPAGNATRICE COMPAGNON'
- ACCOMPAGNATEUR_COMPAGNON = 27
- ACCOMPAGNATRICE_COMPAGNON = 27
-
- 'RESPONSABLE FARFADET'
- RESPONSABLE_FARFADET = 28
-
- 'PARENT ANIMATEUR FARFADET'
- PARENT_ANIMATEUR_FARFADET = 29
-
- 'RESPONSABLE VENT DU LARGE'
- RESPONSABLE_VENT_DU_LARGE = 30
-
- 'RESPONSABLE DE GROUPE'
- RESPONSABLE_DE_GROUPE = 31
-
- 'RESPONSABLE DE GROUPE ADJOINT / RESPONSABLE DE GROUPE ADJOINTE'
- RESPONSABLE_DE_GROUPE_ADJOINT = 32
- RESPONSABLE_DE_GROUPE_ADJOINTE = 32
-
- 'AUMONIER DE GROUPE'
- AUMONIER_DE_GROUPE = 33
-
- 'SECRETAIRE DE GROUPE'
- SECRETAIRE_DE_GROUPE = 34
-
- 'TRESORIER DE GROUPE / TRESORIERE DE GROUPE'
- TRESORIER_DE_GROUPE = 35
- TRESORIERE_DE_GROUPE = 35
-
- 'ANIMATEUR CLEOPHAS / ANIMATRICE CLEOPHAS'
- ANIMATEUR_CLEOPHAS_L = 36
- ANIMATRICE_CLEOPHAS_L = 36
-
- 'CHARGE DE MISSION DU GROUPE / CHARGEE DE MISSION DU GROUPE'
- CHARGE_DE_MISSION_DU_GROUPE = 37
- CHARGEE_DE_MISSION_DU_GROUPE = 37
-
- 'REFERENT TECHNIQUE MARIN / REFERENTE TECHNIQUE MARIN'
- REFERENT_TECHNIQUE_MARIN = 38
- REFERENTE_TECHNIQUE_MARIN = 38
-
- 'REPRESENTANT ASSOCIATIF'
- REPRESENTANT_ASSOCIATIF_L = 39
-
- 'OUVREUR DE GROUPE'
- OUVREUR_DE_GROUPE_L = 40
-
- 'DIRECTEUR DE CAMP / DIRECTRICE DE CAMP'
- DIRECTEUR_DE_CAMP = 41
- DIRECTRICE_DE_CAMP = 41
-
- 'RESPONSABLE LOCAL DEVELOPPEMENT ET RESEAUX'
- RESPONSABLE_LOCAL_DEVELOPPEMENT_ET_RESEAUX = 42
-
- 'FF TRESORIER DE GROUPE / FF TRESORIERE DE GROUPE'
- FF_TRESORIER_DE_GROUPE = 43
- FF_TRESORIERE_DE_GROUPE = 43
-
- 'NOMINATION DES CHEFS ET EQUIPIERS DE GROUPE'
- NOMINATION_DES_CHEFS_ET_EQUIPIERS_DE_GROUPE = 44
-
- 'FF RESPONSABLE DE GROUPE'
- FF_RESPONSABLE_DE_GROUPE = 45
-
- 'DELEGUE TERRITORIAL / DELEGUEE TERRITORIALE'
- DELEGUE_TERRITORIAL = 46
- DELEGUEE_TERRITORIALE = 46
-
- 'DELEGUE TERRITORIAL ADJOINT / DELEGUEE TERRITORIALE ADJOINTE'
- DELEGUE_TERRITORIAL_ADJOINT = 47
- DELEGUEE_TERRITORIALE_ADJOINTE = 47
-
- 'AUMONIER TERRITORIAL'
- AUMONIER_TERRITORIAL = 48
-
- 'RESPONSABLE POLE PEDAGOGIQUE'
- RESPONSABLE_POLE_PEDAGOGIQUE = 49
-
- 'RESPONSABLE POLE DEVELOPPEMENT'
- RESPONSABLE_POLE_DEVELOPPEMENT = 50
-
- 'RESPONSABLE POLE ADMINISTRATIF ET FINANCIER'
- RESPONSABLE_POLE_ADMINISTRATIF_ET_FINANCIER = 51
-
- 'FF RESPONSABLE POLE ADMINISTRATIF ET FINANCIER'
- FF_RESPONSABLE_POLE_ADMINISTRATIF_ET_FINANCIER = 52
-
- 'NOMINATION DES RG ET EQUIPIERS TERRITORIAUX / NOMINATION DES RG ET EQUIPIERS TERRITORIAUX'
- NOMINATION_DES_RG_ET_EQUIPIERS_TERRITORIAUX = 53
-
- 'FF DELEGUE TERRITORIAL / FF DELEGUEE TERRITORIALE'
- FF_DELEGUE_TERRITORIAL = 54
- FF_DELEGUEE_TERRITORIALE = 54
-
- 'ACCOMPAGNATEUR PEDAGOGIQUE / ACCOMPAGNATRICE PEDAGOGIQUE'
- ACCOMPAGNATEUR_PEDAGOGIQUE = 55
- ACCOMPAGNATRICE_PEDAGOGIQUE = 55
-
- 'AUMONIER DIOCESAIN'
- AUMONIER_DIOCESAIN = 56
-
- 'ACCOMPAGNATEUR DES RESPONSABLES DE GROUPE'
- ACCOMPAGNATEUR_DES_RESPONSABLES_DE_GROUPE = 57
-
- 'EQUIPIER TERRITORIAL / EQUIPIERE TERRITORIALE'
- EQUIPIER_TERRITORIAL = 58
- EQUIPIERE_TERRITORIALE = 58
-
- 'ANIMATEUR CLEOPHAS / ANIMATRICE CLEOPHAS'
- ANIMATEUR_CLEOPHAS_N = 59
- ANIMATRICE_CLEOPHAS_N = 59
-
- 'CHARGE MISSION DEVELOPPEMENT / CHARGEE MISSION DEVELOPPEMENT'
- CHARGE_MISSION_DEVELOPPEMENT = 60
- CHARGEE_MISSION_DEVELOPPEMENT = 60
-
- 'COORDINATEUR DEVELOPPEMENT ET RESEAUX / COORDINATRICE DEVELOPPEMENT ET RESEAUX'
- COORDINATEUR_DEVELOPPEMENT_ET_RESEAUX = 61
- COORDINATRICE_DEVELOPPEMENT_ET_RESEAUX = 61
-
- 'OUVREUR DE GROUPE'
- OUVREUR_DE_GROUPE_N = 62
-
- 'RESPONSABLE PARTENARIATS FINANCIERS'
- RESPONSABLE_PARTENARIATS_FINANCIERS = 63
-
- 'RESPONSABLE COMMUNICATION'
- RESPONSABLE_COMMUNICATION = 64
-
- 'CORRESPONDANT HANDICAP'
- CORRESPONDANT_HANDICAP = 65
-
- 'RESPONSABLE SCOUTISME EN QUARTIER'
- RESPONSABLE_SCOUTISME_EN_QUARTIER = 66
-
- 'CHARGE MISSION TERRITORIAL / CHARGEE MISSION TERRITORIALE'
- CHARGE_MISSION_TERRITORIAL = 67
- CHARGEE_MISSION_TERRITORIALE = 67
-
- 'MEDIATEUR / MEDIATRICE'
- MEDIATEUR_N = 68
- MEDIATRICE_N = 68
-
- 'REPRESENTANT ASSOCIATIF / REPRESENTANTE ASSOCIATIF'
- REPRESENTANT_ASSOCIATIF_N = 69
- REPRESENTANTE_ASSOCIATIF_N = 69
-
- 'RESPONSABLE BOUTIQUE SGDF'
- RESPONSABLE_BOUTIQUE_SGDF = 70
-
- 'DIRECTEUR DE CAMP TERRITORIAL / DIRECTRICE DE CAMP TERRITORIAL'
- DIRECTEUR_DE_CAMP_TERRITORIAL = 71
- DIRECTRICE_DE_CAMP_TERRITORIAL = 71
-
- 'TRESORIER DE BOUTIQUE / TRESORIERE DE BOUTIQUE'
- TRESORIER_DE_BOUTIQUE = 72
- TRESORIERE_DE_BOUTIQUE = 72
-
- 'CHARGE DE MISSION RASSEMBLEMENT'
- CHARGE_DE_MISSION_RASSEMBLEMENT = 73
-
- 'CHARGE MISSION ADMINISTRATIF / CHARGEE MISSION ADMINISTRATIF'
- CHARGE_MISSION_ADMINISTRATIF = 74
- CHARGEE_MISSION_ADMINISTRATIF = 74
-
- 'GESTIONNAIRE MATERIEL ET LOGISTIQUE'
- GESTIONNAIRE_MATERIEL_ET_LOGISTIQUE = 75
-
- 'TRESORIER DE BASE / TRESORIERE DE BASE'
- TRESORIER_DE_BASE = 76
- TRESORIERE_DE_BASE = 76
-
- 'EQUIPIER DE BASE / EQUIPIERE DE BASE'
- EQUIPIER_DE_BASE = 77
- EQUIPIERE_DE_BASE = 77
-
- 'RESPONSABLE DE BASE'
- RESPONSABLE_DE_BASE = 78
-
- 'SECRETAIRE TERRITORIAL / SECRETAIRE TERRITORIALE'
- SECRETAIRE_TERRITORIAL = 79
- SECRETAIRE_TERRITORIALE = 79
-
- 'CHARGE DE MISSION CONNECTE ! / CHARGEE DE MISSION CONNECTE !'
- CHARGE_DE_MISSION_CONNECTE = 80
- CHARGEE_DE_MISSION_CONNECTE = 80
-
- 'TRESORIER TERRITORIAL / TRESORIERE TERRITORIALE'
- TRESORIER_TERRITORIAL = 81
- TRESORIERE_TERRITORIALE = 81
-
- 'FF TRESORIER TERRITORIAL / FF TRESORIERE TERRITORIAL'
- FF_TRESORIER_TERRITORIAL = 82
- FF_TRESORIERE_TERRITORIAL = 82
-
- 'DIRECTEUR DE STAGE / DIRECTRICE DE STAGE'
- DIRECTEUR_DE_STAGE = 83
- DIRECTRICE_DE_STAGE = 83
-
- 'DIRECTEUR DE CAMP GROUPE / DIRECTRICE DE CAMP GROUPE'
- DIRECTEUR_DE_CAMP_GROUPE = 84
- DIRECTRICE_DE_CAMP_GROUPE = 84
-
- 'VOLONTAIRE SERVICE CIVIQUE'
- VOLONTAIRE_SERVICE_CIVIQUE = 85
-
- 'VOLONTAIRE SERVICE INTERNATIONAL'
- VOLONTAIRE_SERVICE_INTERNATIONAL = 86
-
- 'DELEGUE GENERAL / DELEGUEE GENERALE'
- DELEGUE_GENERAL = 87
- DELEGUEE_GENERALE = 87
-
- 'DELEGUE GENERAL ADJOINT / DELEGUEE GENERALE ADJOINTE'
- DELEGUE_GENERAL_ADJOINT = 88
- DELEGUEE_GENERALE_ADJOINTE = 88
-
- 'AUMONIER GENERAL'
- AUMONIER_GENERAL = 89
-
- 'DELEGUE NATIONAL / DELEGUEE NATIONALE'
- DELEGUE_NATIONAL = 90
- DELEGUEE_NATIONALE = 90
-
- 'AUMÔNIER GENERAL ADJOINT'
- AUMNIER_GENERAL_ADJOINT = 91
-
- 'RESPONSABLE NATIONAL / RESPONSABLE NATIONALE'
- RESPONSABLE_NATIONAL = 92
- RESPONSABLE_NATIONALE = 92
-
- 'AUMONIER NATIONAL'
- AUMONIER_NATIONAL = 93
-
- 'EQUIPIER NATIONAL / EQUIPIERE NATIONALE'
- EQUIPIER_NATIONAL = 94
- EQUIPIERE_NATIONALE = 94
-
- 'RESPONSABLE DE LA FORMATION CR'
- RESPONSABLE_DE_LA_FORMATION_CR = 95
-
- 'CHARGE MISSION / CHARGEE MISSION'
- CHARGE_MISSION = 96
- CHARGEE_MISSION = 96
-
- 'CHARGE MISSION PAYS / CHARGEE MISSION PAYS'
- CHARGE_MISSION_PAYS = 97
- CHARGEE_MISSION_PAYS = 97
-
- 'ADMINISTRATEUR / ADMINISTRATRICE'
- ADMINISTRATEUR = 98
- ADMINISTRATRICE = 98
-
- 'MEMBRE D HONNEUR'
- MEMBRE_D_HONNEUR = 99
-
- 'MEDIATEUR / MEDIATRICE'
- MEDIATEUR_T = 100
- MEDIATRICE_T = 100
-
- 'REPRESENTANT ASSOCIATIF / REPRESENTANTE ASSOCIATIF'
- REPRESENTANT_ASSOCIATIF_T = 101
- REPRESENTANTE_ASSOCIATIF_T = 101
-
- 'SALARIE / SALARIEE'
- SALARIE = 102
- SALARIEE = 102
-
- 'SALARIE FORMATION / SALARIEE FORMATION'
- SALARIE_FORMATION = 103
- SALARIEE_FORMATION = 103
-
- 'SALARIE SERVICE INTERNATIONAL / SALARIEE SERVICE INTERNATIONAL'
- SALARIE_SERVICE_INTERNATIONAL = 104
- SALARIEE_SERVICE_INTERNATIONAL = 104
-
- 'CONSULTANT BATEAU / CONSULTANTE BATEAU'
- CONSULTANT_BATEAU = 105
- CONSULTANTE_BATEAU = 105
-
- 'ASSISTANT DE SAISIE / ASSISTANTE DE SAISIE'
- ASSISTANT_DE_SAISIE = 106
- ASSISTANTE_DE_SAISIE = 106
-
- 'RESPONSABLE RASSEMBLEMENT'
- RESPONSABLE_RASSEMBLEMENT = 107
-
- 'CHARGE DE MISSION / CHARGEE DE MISSION'
- CHARGE_DE_MISSION = 108
- CHARGEE_DE_MISSION = 108
-
- 'CHARGE DE MISSION RASSEMBLEMENT EN / CHARGEE DE MISSION RASSEMBLEMENT EN'
- CHARGE_DE_MISSION_RASSEMBLEMENT_EN = 109
- CHARGEE_DE_MISSION_RASSEMBLEMENT_EN = 109
-
- 'ADMINISTRATEUR MODULE FORMATION / ADMINISTRATRICE MODULE FORMATION'
- ADMINISTRATEUR_MODULE_FORMATION = 110
- ADMINISTRATRICE_MODULE_FORMATION = 110
-
- 'Consultant Intégration / Consultante Intégration'
- CONSULTANT_INTEGRATION = 111
- CONSULTANTE_INTEGRATION = 111
-
- 'SALARIE COMPTABILITE / SALARIEE COMPTABILITE'
- SALARIE_COMPTABILITE = 112
- SALARIEE_COMPTABILITE = 112
-
- 'SALARIE ASSURANCE / SALARIEE ASSURANCE'
- SALARIE_ASSURANCE = 113
- SALARIEE_ASSURANCE = 113
-
- 'ADMINISTRATEUR ASSURANCE / ADMINISTRATRICE ASSURANCE'
- ADMINISTRATEUR_ASSURANCE = 114
- ADMINISTRATRICE_ASSURANCE = 114
-
- 'SALARIE CENTRE DE RESSOURCES / SALARIEE CENTRE DE RESSOURCES'
- SALARIE_CENTRE_DE_RESSOURCES = 115
- SALARIEE_CENTRE_DE_RESSOURCES = 115
-
- 'ADMINISTRATEUR COMPTABILITE / ADMINISTRATRICE COMPTABILITE'
- ADMINISTRATEUR_COMPTABILITE = 116
- ADMINISTRATRICE_COMPTABILITE = 116
-
- 'DIRECTEUR DE CENTRE DE RESSOURCES / DIRECTRICE DE CENTRE DE RESSOURCES'
- DIRECTEUR_DE_CENTRE_DE_RESSOURCES = 117
- DIRECTRICE_DE_CENTRE_DE_RESSOURCES = 117
-
- 'RESPONSABLE ADMINISTRATIF CR / RESPONSABLE ADMINISTRATIVE CR'
- RESPONSABLE_ADMINISTRATIF_CR = 118
- RESPONSABLE_ADMINISTRATIVE_CR = 118
-
- 'ANIMATION TERRITORIALE ET DEVELOPPEMENT'
- ANIMATION_TERRITORIALE_ET_DEVELOPPEMENT = 119
-
- 'ADMINISTRATEUR INTRANET / ADMINISTRATRICE INTRANET'
- ADMINISTRATEUR_INTRANET = 120
- ADMINISTRATRICE_INTRANET = 120
-
- 'Monitoring applicatif'
- MONITORING_APPLICATIF = 121
-
-FunctionData = {
- Function.LOUVETEAU: ('110', 8555,
- 'LOUVETEAU',
- 'JEANNETTE'),
- Function.MOUSSAILLON: ('110M', 8556,
- 'MOUSSAILLON'),
- Function.SCOUT: ('120', 8657,
- 'SCOUT',
- 'GUIDE'),
- Function.MOUSSE: ('120M', 8658,
- 'MOUSSE'),
- Function.PIONNIER: ('130', 8651,
- 'PIONNIER',
- 'CARAVELLE'),
- Function.MARIN: ('130M', 8652,
- 'MARIN',
- 'CARAVELLE MARINE'),
- Function.COMPAGNON: ('140', 8643,
- 'COMPAGNON'),
- Function.COMPAGNON_MARIN: ('140M', 8648,
- 'COMPAGNON MARIN'),
- Function.COMPAGNON_3EME_TEMPS: ('141', 8649,
- 'COMPAGNON 3EME TEMPS'),
- Function.FARFADET: ('170', 8640,
- 'FARFADET'),
- Function.MEMBRE_ASSOCIE_L: ('180L', 8559,
- 'MEMBRE ASSOCIE',
- 'MEMBRE ASSOCIEE'),
- Function.MEMBRE_ASSOCIE_N: ('180N', 8567,
- 'MEMBRE ASSOCIE',
- 'MEMBRE ASSOCIEE'),
- Function.MEMBRE_ASSOCIE_T: ('180T', 8564,
- 'MEMBRE ASSOCIE',
- 'MEMBRE ASSOCIEE'),
- Function.VENT_DU_LARGE: ('193', 8560,
- 'VENT DU LARGE'),
- Function.RESPONSABLE_UNITE_LOUVETEAU_JEANNETTE: ('210', 8557,
- "RESPONSABLE D'UNITE LOUVETEAU JEANNETTE"),
- Function.RESPONSABLE_UNITE_MOUSSAILLON: ('210M', 8671,
- "RESPONSABLE D'UNITE MOUSSAILLON"),
- Function.CHEF_LOUVETEAU_JEANNETTE: ('213', 8672,
- 'CHEF LOUVETEAU JEANNETTE',
- 'CHEFTAINE LOUVETEAU JEANNETTE'),
- Function.CHEF_MOUSSAILLON: ('213M', 8673,
- 'CHEF MOUSSAILLON',
- 'CHEFTAINE MOUSSAILLON'),
- Function.RESPONSABLE_UNITE_SCOUT_GUIDE: ('220', 8659,
- "RESPONSABLE D'UNITE SCOUT GUIDE"),
- Function.RESPONSABLE_UNITE_MOUSSE: ('220M', 8660,
- "RESPONSABLE D'UNITE MOUSSE"),
- Function.CHEF_SCOUT_GUIDE: ('223', 8661,
- 'CHEF SCOUT GUIDE',
- 'CHEFTAINE SCOUT GUIDE'),
- Function.CHEF_MOUSSE: ('223M', 8662,
- 'CHEF MOUSSE',
- 'CHEFTAINE MOUSSE'),
- Function.RESPONSABLE_UNITE_PIONNIER_CARAVELLE: ('230', 8653,
- "RESPONSABLE D'UNITE PIONNIER CARAVELLE"),
- Function.RESPONSABLE_UNITE_FLOTILLE_CARAVELLE_MARINE: ('230M', 8654,
- "RESPONSABLE D'UNITE FLOTILLE - CARAVELLE MARINE"),
- Function.CHEF_PIONNIER_CARAVELLE: ('233', 8655,
- 'CHEF PIONNIER CARAVELLE',
- 'CHEFTAINE PIONNIER CARAVELLE'),
- Function.CHEF_FLOTILLE_CARAVELLE_MARINE: ('233M', 8656,
- 'CHEF FLOTILLE - CARAVELLE MARINE',
- 'CHEFTAINE FLOTILLE - CARAVELLE MARINE'),
- Function.ACCOMPAGNATEUR_COMPAGNON: ('240', 8650,
- 'ACCOMPAGNATEUR COMPAGNON',
- 'ACCOMPAGNATRICE COMPAGNON'),
- Function.RESPONSABLE_FARFADET: ('270', 8641,
- 'RESPONSABLE FARFADET'),
- Function.PARENT_ANIMATEUR_FARFADET: ('271', 8642,
- 'PARENT ANIMATEUR FARFADET'),
- Function.RESPONSABLE_VENT_DU_LARGE: ('293', 8561,
- 'RESPONSABLE VENT DU LARGE'),
- Function.RESPONSABLE_DE_GROUPE: ('300', 8558,
- 'RESPONSABLE DE GROUPE'),
- Function.RESPONSABLE_DE_GROUPE_ADJOINT: ('301', 8646,
- 'RESPONSABLE DE GROUPE ADJOINT',
- 'RESPONSABLE DE GROUPE ADJOINTE'),
- Function.AUMONIER_DE_GROUPE: ('302', 8663,
- 'AUMONIER DE GROUPE'),
- Function.SECRETAIRE_DE_GROUPE: ('307', 8645,
- 'SECRETAIRE DE GROUPE'),
- Function.TRESORIER_DE_GROUPE: ('309', 8644,
- 'TRESORIER DE GROUPE',
- 'TRESORIERE DE GROUPE'),
- Function.ANIMATEUR_CLEOPHAS_L: ('316', 8664,
- 'ANIMATEUR CLEOPHAS',
- 'ANIMATRICE CLEOPHAS'),
- Function.CHARGE_DE_MISSION_DU_GROUPE: ('330', 8665,
- 'CHARGE DE MISSION DU GROUPE',
- 'CHARGEE DE MISSION DU GROUPE'),
- Function.REFERENT_TECHNIQUE_MARIN: ('330M', 8666,
- 'REFERENT TECHNIQUE MARIN',
- 'REFERENTE TECHNIQUE MARIN'),
- Function.REPRESENTANT_ASSOCIATIF_L: ('332', 8667,
- 'REPRESENTANT ASSOCIATIF'),
- Function.OUVREUR_DE_GROUPE_L: ('333', 8647,
- 'OUVREUR DE GROUPE'),
- Function.DIRECTEUR_DE_CAMP: ('351', 8668,
- 'DIRECTEUR DE CAMP',
- 'DIRECTRICE DE CAMP'),
- Function.RESPONSABLE_LOCAL_DEVELOPPEMENT_ET_RESEAUX: ('380', 8669,
- 'RESPONSABLE LOCAL DEVELOPPEMENT ET RESEAUX'),
- Function.FF_TRESORIER_DE_GROUPE: ('391', 8670,
- 'FF TRESORIER DE GROUPE',
- 'FF TRESORIERE DE GROUPE'),
- Function.NOMINATION_DES_CHEFS_ET_EQUIPIERS_DE_GROUPE: ('397', 8562,
- 'NOMINATION DES CHEFS ET EQUIPIERS DE GROUPE'),
- Function.FF_RESPONSABLE_DE_GROUPE: ('399', 8639,
- 'FF RESPONSABLE DE GROUPE'),
- Function.DELEGUE_TERRITORIAL: ('500', 8563,
- 'DELEGUE TERRITORIAL',
- 'DELEGUEE TERRITORIALE'),
- Function.DELEGUE_TERRITORIAL_ADJOINT: ('501', 8565,
- 'DELEGUE TERRITORIAL ADJOINT',
- 'DELEGUEE TERRITORIALE ADJOINTE'),
- Function.AUMONIER_TERRITORIAL: ('502', 8604,
- 'AUMONIER TERRITORIAL'),
- Function.RESPONSABLE_POLE_PEDAGOGIQUE: ('503', 8606,
- 'RESPONSABLE POLE PEDAGOGIQUE'),
- Function.RESPONSABLE_POLE_DEVELOPPEMENT: ('504', 8607,
- 'RESPONSABLE POLE DEVELOPPEMENT'),
- Function.RESPONSABLE_POLE_ADMINISTRATIF_ET_FINANCIER: ('505', 8608,
- 'RESPONSABLE POLE ADMINISTRATIF ET FINANCIER'),
- Function.FF_RESPONSABLE_POLE_ADMINISTRATIF_ET_FINANCIER: ('591', 8609,
- 'FF RESPONSABLE POLE ADMINISTRATIF ET FINANCIER'),
- Function.NOMINATION_DES_RG_ET_EQUIPIERS_TERRITORIAUX: ('597', 8610,
- 'NOMINATION DES RG ET EQUIPIERS TERRITORIAUX',
- 'NOMINATION DES RG ET EQUIPIERS TERRITORIAUX'),
- Function.FF_DELEGUE_TERRITORIAL: ('598', 8605,
- 'FF DELEGUE TERRITORIAL',
- 'FF DELEGUEE TERRITORIALE'),
- Function.ACCOMPAGNATEUR_PEDAGOGIQUE: ('600', 8611,
- 'ACCOMPAGNATEUR PEDAGOGIQUE',
- 'ACCOMPAGNATRICE PEDAGOGIQUE'),
- Function.AUMONIER_DIOCESAIN: ('602', 8612,
- 'AUMONIER DIOCESAIN'),
- Function.ACCOMPAGNATEUR_DES_RESPONSABLES_DE_GROUPE: ('609', 8613,
- 'ACCOMPAGNATEUR DES RESPONSABLES DE GROUPE'),
- Function.EQUIPIER_TERRITORIAL: ('610', 8677,
- 'EQUIPIER TERRITORIAL',
- 'EQUIPIERE TERRITORIALE'),
- Function.ANIMATEUR_CLEOPHAS_N: ('616', 8614,
- 'ANIMATEUR CLEOPHAS',
- 'ANIMATRICE CLEOPHAS'),
- Function.CHARGE_MISSION_DEVELOPPEMENT: ('620', 8615,
- 'CHARGE MISSION DEVELOPPEMENT',
- 'CHARGEE MISSION DEVELOPPEMENT'),
- Function.COORDINATEUR_DEVELOPPEMENT_ET_RESEAUX: ('621', 8616,
- 'COORDINATEUR DEVELOPPEMENT ET RESEAUX',
- 'COORDINATRICE DEVELOPPEMENT ET RESEAUX'),
- Function.OUVREUR_DE_GROUPE_N: ('622', 8617,
- 'OUVREUR DE GROUPE'),
- Function.RESPONSABLE_PARTENARIATS_FINANCIERS: ('624', 8619,
- 'RESPONSABLE PARTENARIATS FINANCIERS'),
- Function.RESPONSABLE_COMMUNICATION: ('625', 8620,
- 'RESPONSABLE COMMUNICATION'),
- Function.CORRESPONDANT_HANDICAP: ('626', 8621,
- 'CORRESPONDANT HANDICAP'),
- Function.RESPONSABLE_SCOUTISME_EN_QUARTIER: ('627', 8622,
- 'RESPONSABLE SCOUTISME EN QUARTIER'),
- Function.CHARGE_MISSION_TERRITORIAL: ('630', 8623,
- 'CHARGE MISSION TERRITORIAL',
- 'CHARGEE MISSION TERRITORIALE'),
- Function.MEDIATEUR_N: ('631', 8624,
- 'MEDIATEUR',
- 'MEDIATRICE'),
- Function.REPRESENTANT_ASSOCIATIF_N: ('632', 8625,
- 'REPRESENTANT ASSOCIATIF',
- 'REPRESENTANTE ASSOCIATIF'),
- Function.RESPONSABLE_BOUTIQUE_SGDF: ('650', 8626,
- 'RESPONSABLE BOUTIQUE SGDF'),
- Function.DIRECTEUR_DE_CAMP_TERRITORIAL: ('651', 8627,
- 'DIRECTEUR DE CAMP TERRITORIAL',
- 'DIRECTRICE DE CAMP TERRITORIAL'),
- Function.TRESORIER_DE_BOUTIQUE: ('652', 8628,
- 'TRESORIER DE BOUTIQUE',
- 'TRESORIERE DE BOUTIQUE'),
- Function.CHARGE_DE_MISSION_RASSEMBLEMENT: ('659', 8629,
- 'CHARGE DE MISSION RASSEMBLEMENT'),
- Function.CHARGE_MISSION_ADMINISTRATIF: ('660', 8630,
- 'CHARGE MISSION ADMINISTRATIF',
- 'CHARGEE MISSION ADMINISTRATIF'),
- Function.GESTIONNAIRE_MATERIEL_ET_LOGISTIQUE: ('661', 8631,
- 'GESTIONNAIRE MATERIEL ET LOGISTIQUE'),
- Function.TRESORIER_DE_BASE: ('663', 8632,
- 'TRESORIER DE BASE',
- 'TRESORIERE DE BASE'),
- Function.EQUIPIER_DE_BASE: ('664', 8633,
- 'EQUIPIER DE BASE',
- 'EQUIPIERE DE BASE'),
- Function.RESPONSABLE_DE_BASE: ('665', 8634,
- 'RESPONSABLE DE BASE'),
- Function.SECRETAIRE_TERRITORIAL: ('670', 8635,
- 'SECRETAIRE TERRITORIAL',
- 'SECRETAIRE TERRITORIALE'),
- Function.CHARGE_DE_MISSION_CONNECTE: ('685', 8636,
- 'CHARGE DE MISSION CONNECTE !',
- 'CHARGEE DE MISSION CONNECTE !'),
- Function.TRESORIER_TERRITORIAL: ('690', 8637,
- 'TRESORIER TERRITORIAL',
- 'TRESORIERE TERRITORIALE'),
- Function.FF_TRESORIER_TERRITORIAL: ('691', 8638,
- 'FF TRESORIER TERRITORIAL',
- 'FF TRESORIERE TERRITORIAL'),
- Function.DIRECTEUR_DE_STAGE: ('850', 8568,
- 'DIRECTEUR DE STAGE',
- 'DIRECTRICE DE STAGE'),
- Function.DIRECTEUR_DE_CAMP_GROUPE: ('851', 8576,
- 'DIRECTEUR DE CAMP GROUPE',
- 'DIRECTRICE DE CAMP GROUPE'),
- Function.VOLONTAIRE_SERVICE_CIVIQUE: ('860', 8577,
- 'VOLONTAIRE SERVICE CIVIQUE'),
- Function.VOLONTAIRE_SERVICE_INTERNATIONAL: ('861', 8578,
- 'VOLONTAIRE SERVICE INTERNATIONAL'),
- Function.DELEGUE_GENERAL: ('900', 8573,
- 'DELEGUE GENERAL',
- 'DELEGUEE GENERALE'),
- Function.DELEGUE_GENERAL_ADJOINT: ('901', 8566,
- 'DELEGUE GENERAL ADJOINT',
- 'DELEGUEE GENERALE ADJOINTE'),
- Function.AUMONIER_GENERAL: ('902', 8579,
- 'AUMONIER GENERAL'),
- Function.DELEGUE_NATIONAL: ('903', 8575,
- 'DELEGUE NATIONAL',
- 'DELEGUEE NATIONALE'),
- Function.AUMNIER_GENERAL_ADJOINT: ('904', 8675,
- 'AUMÔNIER GENERAL ADJOINT'),
- Function.RESPONSABLE_NATIONAL: ('910', 8574,
- 'RESPONSABLE NATIONAL',
- 'RESPONSABLE NATIONALE'),
- Function.AUMONIER_NATIONAL: ('911', 8580,
- 'AUMONIER NATIONAL'),
- Function.EQUIPIER_NATIONAL: ('912', 8581,
- 'EQUIPIER NATIONAL',
- 'EQUIPIERE NATIONALE'),
- Function.RESPONSABLE_DE_LA_FORMATION_CR: ('913', 8572,
- 'RESPONSABLE DE LA FORMATION CR'),
- Function.CHARGE_MISSION: ('914', 8582,
- 'CHARGE MISSION',
- 'CHARGEE MISSION'),
- Function.CHARGE_MISSION_PAYS: ('915', 8583,
- 'CHARGE MISSION PAYS',
- 'CHARGEE MISSION PAYS'),
- Function.ADMINISTRATEUR: ('920', 8585,
- 'ADMINISTRATEUR',
- 'ADMINISTRATRICE'),
- Function.MEMBRE_D_HONNEUR: ('921', 8586,
- 'MEMBRE D HONNEUR'),
- Function.MEDIATEUR_T: ('931', 8587,
- 'MEDIATEUR',
- 'MEDIATRICE'),
- Function.REPRESENTANT_ASSOCIATIF_T: ('932', 8588,
- 'REPRESENTANT ASSOCIATIF',
- 'REPRESENTANTE ASSOCIATIF'),
- Function.SALARIE: ('980', 8589,
- 'SALARIE',
- 'SALARIEE'),
- Function.SALARIE_FORMATION: ('981', 8590,
- 'SALARIE FORMATION',
- 'SALARIEE FORMATION'),
- Function.SALARIE_SERVICE_INTERNATIONAL: ('982', 8584,
- 'SALARIE SERVICE INTERNATIONAL',
- 'SALARIEE SERVICE INTERNATIONAL'),
- Function.CONSULTANT_BATEAU: ('983', 8678,
- 'CONSULTANT BATEAU',
- 'CONSULTANTE BATEAU'),
- Function.ASSISTANT_DE_SAISIE: ('984', 8592,
- 'ASSISTANT DE SAISIE',
- 'ASSISTANTE DE SAISIE'),
- Function.RESPONSABLE_RASSEMBLEMENT: ('985', 8593,
- 'RESPONSABLE RASSEMBLEMENT'),
- Function.CHARGE_DE_MISSION: ('986', 8676,
- 'CHARGE DE MISSION',
- 'CHARGEE DE MISSION'),
- Function.CHARGE_DE_MISSION_RASSEMBLEMENT_EN: ('987', 8594,
- 'CHARGE DE MISSION RASSEMBLEMENT EN',
- 'CHARGEE DE MISSION RASSEMBLEMENT EN'),
- Function.ADMINISTRATEUR_MODULE_FORMATION: ('989', 8569,
- 'ADMINISTRATEUR MODULE FORMATION',
- 'ADMINISTRATRICE MODULE FORMATION'),
- Function.CONSULTANT_INTEGRATION: ('990', 8595,
- 'Consultant Intégration',
- 'Consultante Intégration'),
- Function.SALARIE_COMPTABILITE: ('991', 8596,
- 'SALARIE COMPTABILITE',
- 'SALARIEE COMPTABILITE'),
- Function.SALARIE_ASSURANCE: ('992', 8597,
- 'SALARIE ASSURANCE',
- 'SALARIEE ASSURANCE'),
- Function.ADMINISTRATEUR_ASSURANCE: ('993', 8598,
- 'ADMINISTRATEUR ASSURANCE',
- 'ADMINISTRATRICE ASSURANCE'),
- Function.SALARIE_CENTRE_DE_RESSOURCES: ('994', 8599,
- 'SALARIE CENTRE DE RESSOURCES',
- 'SALARIEE CENTRE DE RESSOURCES'),
- Function.ADMINISTRATEUR_COMPTABILITE: ('995', 8600,
- 'ADMINISTRATEUR COMPTABILITE',
- 'ADMINISTRATRICE COMPTABILITE'),
- Function.DIRECTEUR_DE_CENTRE_DE_RESSOURCES: ('996', 8601,
- 'DIRECTEUR DE CENTRE DE RESSOURCES',
- 'DIRECTRICE DE CENTRE DE RESSOURCES'),
- Function.RESPONSABLE_ADMINISTRATIF_CR: ('997', 8602,
- 'RESPONSABLE ADMINISTRATIF CR',
- 'RESPONSABLE ADMINISTRATIVE CR'),
- Function.ANIMATION_TERRITORIALE_ET_DEVELOPPEMENT: ('998', 8571,
- 'ANIMATION TERRITORIALE ET DEVELOPPEMENT'),
- Function.ADMINISTRATEUR_INTRANET: ('999', 8570,
- 'ADMINISTRATEUR INTRANET',
- 'ADMINISTRATRICE INTRANET'),
- Function.MONITORING_APPLICATIF: ('9XX', 8603,
- 'Monitoring applicatif'),
-}
-
-# End of file.
diff --git a/sgdfi/_dbs/_funcs.py b/sgdfi/_dbs/_funcs.py
deleted file mode 100755
index 9dc2861..0000000
--- a/sgdfi/_dbs/_funcs.py
+++ /dev/null
@@ -1,232 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-""" Functions reference for SGDFi. """
-
-from ._funcdata import Function, FunctionData as _FunctionData
-
-__all__ = ["Function", "FunctionData", "FunctionRawData"]
-
-def _isid(value):
- try:
- Function(value)
- except:
- return False
- return True
-
-def _isint(value):
- try:
- int(value)
- except:
- return False
- return True
-
-class FunctionRawData:
- """ Raw data from a function for importation of the autocomplete file
- from the intranet. """
-
- def __init__(self, iid, code, nm, nf, cnames, srcorder):
- self.__iid = iid
- self.__code = code
- self.__nm = nm
- self.__nf = nf
- self.__cnames = tuple(cnames)
- self.__srcorder = srcorder
-
- def __repr__(self):
- p = []
- p.append(f"cnames = {repr(self.__cnames)}")
- p.append(f"iid = {repr(self.__iid)}")
- p.append(f"code = {repr(self.__code)}")
- p.append(f"nm = {repr(self.__nm)}")
- if self.__nf is not None:
- p.append(f"nf = {repr(self.__nf)}")
-
- return f"{self.__class__.__name__}({', '.join(p)})"
-
- @property
- def cnames(self):
- """ The canonical/constant name for the function. """
-
- return self.__cnames
-
- @property
- def iid(self):
- """ The internal identifier (e.g. 8434). """
-
- return self.__iid
-
- @property
- def code(self):
- """ The code (e.g. "110", "110M" or "9XX"). """
-
- return self.__code
-
- @property
- def name(self):
- """ The full name. """
-
- p = [self.__nm]
- if self.__nf is not None:
- p.append(self.__nf)
- return " / ".join(p)
-
- @property
- def nm(self):
- """ The masculine name. """
-
- return self.__nm
-
- @property
- def nf(self):
- """ The feminine name. """
-
- return self.__nf
-
- def add_cname_suffix(self, suffix):
- cnames = [cn + suffix for cn in self.__cnames]
- return FunctionRawData(self.__iid, self.__code, self.__nm,
- self.__nf, cnames, self.__srcorder)
-
- @property
- def srcorder(self):
- """ Order in the original JSON. """
-
- return self.__srcorder
-
-# Each entry in `_FunctionData` has the function identifier as the key, and
-# a data composed of the following components:
-# - `c`: the intranet code (e.g. "120", "110M", "9XX", …).
-# - `ii`: the intranet internal identifier (e.g. "8434", "8437", …).
-# - `nm`: the masculin name for the function.
-# - `nf` (opt.): the feminine name for the function.
-#
-# Leads defined in `_FunctionLeads` are:
-# - the masculine noun (e.g. "LOUVETEAU").
-# - the feminine noun (e.g. "JEANETTE").
-# - the integer internal identifier (e.g. 8434).
-# - a string version of the last.
-# - the code, e.g. "110".
-# - integer versions of the last ones.
-# - the full masculine string (e.g. "110 (LOUVETEAU)").
-# - the full feminine string (e.g. "110 (JEANETTE)").
-# - the full string (e.g. "110 (LOUVETEAU / JEANETTE)").
-
-_sc = lambda x: x.strip().casefold()
-
-_FunctionLeads = {}
-_FunctionLeads.update({nouns[0].strip().casefold(): i \
- for i, (c, ii, *nouns) in _FunctionData.items()})
-_FunctionLeads.update({nouns[1].strip().casefold(): i \
- for i, (c, ii, *nouns) in _FunctionData.items() if len(nouns) > 1})
-_FunctionLeads.update({ii: i \
- for i, (c, ii, *nouns) in _FunctionData.items()})
-_FunctionLeads.update({str(ii): i for i, (c, ii, *nouns) \
- in _FunctionData.items()})
-_FunctionLeads.update({c.casefold(): i for i, (c, ii, *nouns) \
- in _FunctionData.items()})
-_FunctionLeads.update({int(c): i for i, (c, ii, *nouns) \
- in _FunctionData.items() if _isint(c)})
-_FunctionLeads.update({_sc(f"{c} ({nouns[0]})"): i \
- for i, (c, ii, *nouns) in _FunctionData.items()})
-_FunctionLeads.update({_sc(f"{c} ({nouns[1]})"): i \
- for i, (c, ii, *nouns) in _FunctionData.items() if len(nouns) > 1})
-_FunctionLeads.update({_sc(f"{c} ({nouns[0]} / {nouns[1]})"): i \
- for i, (c, ii, *nouns) in _FunctionData.items() if len(nouns) > 1})
-
-class FunctionData:
- """ Function data (code, id, name, other). """
-
- def __init__(self, value):
- self.__id = None
- self.__iid = None
- self.__code = None
- self.__nm = None
- self.__nf = None
- data = None
-
- if isinstance(value, FunctionData):
- self.__id = value.id
- self.__iid = value.iid
- self.__code = value.code
- self.__nm = value.nm
- self.__nf = value.nf
-
- if self.__nm == self.__nf:
- self.__nf = None
- elif _isid(value):
- value = Function(value)
- self.__id = value
-
- data = _FunctionData.get(self.__id, None)
- else:
- # We suppose it's an intranet code such as "110", a private
- # function code such as 8434, or a function name.
-
- lead = value
- if type(value) == str:
- lead = lead.strip().casefold()
-
- try:
- self.__id = _FunctionLeads[lead]
- data = _FunctionData.get(self.__id, None)
- except KeyError:
- raise ValueError("Expected a valid function identifier.") \
- from None
-
- if data is not None:
- self.__code = data[0]
- self.__iid = data[1]
- self.__nm = data[2]
- if len(data) > 2:
- self.__nf = data[3]
-
- def __repr__(self):
- p = [f"id = {repr(self.__id)}"]
- if self.__code is not None:
- p.append(f"code = {repr(self.__code)}")
- if self.__iid is not None:
- p.append(f"iid = {repr(self.__iid)}")
- if self.__nm is not None:
- p.append(f"nm = {repr(self.__nm)}")
- if self.__nf is not None:
- p.append(f"nf = {repr(self.__nf)}")
-
- return f"{self.__class__.__name__}({', '.join(p)})"
-
- @property
- def id(self):
- """ The function identifier, as one of the functions defined in the
- Function enumeration. """
-
- return self.__id
-
- @property
- def iid(self):
- """ The internal identifier within the intranet. """
-
- return self.__iid
-
- @property
- def code(self):
- """ The code within the intranet. """
-
- return self.__code
-
- @property
- def nm(self):
- """ The masculine noun for the function. """
-
- return self.__nm
-
- @property
- def nf(self):
- """ The feminine noun for the function. """
-
- if self.__nf is None:
- return self.__nm
- return self.__nf
-
-# End of file.
diff --git a/sgdfi/_dbs/_ops.py b/sgdfi/_dbs/_ops.py
deleted file mode 100755
index f631d01..0000000
--- a/sgdfi/_dbs/_ops.py
+++ /dev/null
@@ -1,357 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-""" Operations reference for SGDFi. """
-
-from enum import Enum as _Enum, unique as _unique
-
-__all__ = ["OperationType", "OperationTypeData"]
-
-@_unique
-class OperationType(_Enum):
- """ The default type (unknown). """
- UNKNOWN = 0
-
- """ Animation / Création d'une date. """
- ANIM_DATE_NEW = 1
-
- """ Animation / Modification d'une date. """
- ANIM_DATE_EDIT = 2
-
- """ Animation / Suppression d'une date. """
- ANIM_DATE_DEL = 47
-
- """ Animation / Création d'un message. """
- ANIM_MSG_NEW = 49
-
- """ Animation / Création d'une tâche. """
- ANIM_TASK_NEW = 50
-
- """ Bulletin d'adhésion / Impression locale d'un bulletin
- d'adhésion. """
- BUL_PRINT = 3
-
- """ Camp / Ajout d'un animateur à un camp. """
- CAMP_ANIM_ADD = 4
-
- """ Camp / Ajout d'un directeur à un camp. """
- CAMP_DIR_ADD = 5
-
- """ Camp / Ajout d'une étape d'itinéraire à un camp. """
- CAMP_ITIN_ADD = 6
-
- """ Camp / Commentaire pour le responsable d'accueil. """
- CAMP_COMMENT = 7
-
- """ Camp / Création d'un camp. """
- CAMP_NEW = 8
-
- """ Camp / Sauvegarde de fichier. """
- CAMP_FILE_SAVE = 9
-
- """ Camp / Suivi Jeunesse et Sports. """
- CAMP_JS = 10
-
- """ Camp / Suppression d'une étape d'itinéraire d'un camp. """
- CAMP_ITIN_DEL = 11
-
- """ Camp / Modification d'un animateur d'un camp. """
- CAMP_ANIM_EDIT = 12
-
- """ Camp / Modification d'un camp. """
- CAMP_EDIT = 13
-
- """ Camp / Modification d'une étape d'itinéraire d'un camp. """
- CAMP_ITIN_EDIT = 14
-
- """ Camp / Validation d'une étape d'un camp. """
- CAMP_STEP_VAL = 15
-
- """ Déclaration J&S / Affectation TAM d'un intervenant. """
- JS_TAM_ASSIGN = 16
-
- """ Déclaration J&S / Déclaration TAM d'un intervenant. """
- JS_TAM_DECL = 17
-
- """ Formation / Création d'une action de formation. """
- TRAIN_NEW = 19
-
- """ Formation / Envoi de notification. """
- TRAIN_NOTIFY = 20
-
- """ Formation / Modification d'une action de formation. """
- TRAIN_EDIT = 21
-
- """ Individu / Abonnement. """
- IN_SUB = 48
-
- """ Individu / Adhésion. """
- IN_MEMBERSHIP = 22
-
- """ Individu / Création. """
- IN_NEW = 23
-
- """ Individu / Demande de nomination. """
- IN_NOMIN_REQUEST = 24
-
- """ Individu / Edition de la carte d'adhérent. """
- IN_CARD_EDIT = 25
-
- """ Individu / Edition d'un reçu fiscal. """
- IN_RECEIPT_EDIT = 26
-
- """ Individu / Inscription. """
- IN_REG = 27
-
- """ Individu / Règlement de famille. """
- IN_PAYMENT = 28
-
- """ Individu / Validation demande de nomination. """
- IN_NOMIN_REQUEST_VAL = 29
-
- """ Individu / Validation nomination. """
- IN_NOMIN_VAL = 30
-
- """ Inscription / Annulation d'une demande d'inscription. """
- REG_REQUEST_CAN = 31
-
- """ Inscription / Création d'une demande d'inscription. """
- REG_REQUEST_NEW = 32
-
- """ Inscription / Validation d'une demande d'inscription. """
- REG_REQUEST_VAL = 33
-
- """ Inscription rassemblement / Création Demande. """
- RALREG_REQUEST_NEW = 34
-
- """ Inscription rassemblement / Validation Intermédiaire Demande. """
- RALREG_REQUEST_MID_VAL = 35
-
- """ Lieu d'activité / Création d'un lieu d'activité. """
- PL_NEW = 36
-
- """ Lieu d'activité / Modification d'un lieu d'activité. """
- PL_EDIT = 37
-
- """ Patrimoine / Assurance. """
- PAT_INSURE = 38
-
- """ Patrimoine / Demande d'assurance. """
- PAT_INSURE_REQUEST = 39
-
- """ Patrimoine / Modification. """
- PAT_EDIT = 40
-
- """ Projet pédagogique / Import d'un fichier matrice. """
- PEDA_XLS_IMPORT = 41
-
- """ Projet pédagogique / Suppression d'un fichier matrice. """
- PEDA_XLS_DEL = 42
-
- """ Structure / Création. """
- ST_NEW = 43
-
- """ Structure / Définition date début d'activité. """
- ST_START = 44
-
- """ Structure / Modification spécialités. """
- ST_SPEC = 45
-
- """ Structure / Recopie nouvelle saison. """
- ST_COPY = 46
-
- # TODO: other types (next index: 51).
-
-# Operation type data.
-# - name.
-
-_OperationTypeData = {
- OperationType.ANIM_DATE_NEW: \
- ("Animation / Création d'une date",),
- OperationType.ANIM_DATE_EDIT: \
- ("Animation / Modification d'une date",),
- OperationType.ANIM_DATE_DEL: \
- ("Animation / Suppression d'une date",),
- OperationType.ANIM_MSG_NEW: \
- ("Animation / Création d'un message",),
- OperationType.ANIM_TASK_NEW: \
- ("Animation / Création d'une tâche",),
- OperationType.BUL_PRINT: \
- ("Bulletin d'adhésion / Impression locale d'un bulletin "
- "d'adhésion",),
- OperationType.CAMP_ANIM_ADD: \
- ("Camp / Ajout d'un animateur à un camp",),
- OperationType.CAMP_DIR_ADD: \
- ("Camp / Ajout d'un directeur à un camp",),
- OperationType.CAMP_ITIN_ADD: \
- ("Camp / Ajout d'une étape d'itinéraire à un camp",),
- OperationType.CAMP_COMMENT: \
- ("Camp / Commentaire pour le responsable d'accueil",),
- OperationType.CAMP_NEW: \
- ("Camp / Création d'un camp",),
- OperationType.CAMP_FILE_SAVE: \
- ("Camp / Sauvegarde de fichier",),
- OperationType.CAMP_JS: \
- ("Camp / Suivi Jeunesse et Sports",),
- OperationType.CAMP_ITIN_DEL: \
- ("Camp / Suppression d'une étape d'itinéraire d'un camp",),
- OperationType.CAMP_ANIM_EDIT: \
- ("Camp / Modification d'un animateur d'un camp",),
- OperationType.CAMP_EDIT: \
- ("Camp / Modification d'un camp",),
- OperationType.CAMP_ITIN_EDIT: \
- ("Camp / Modification d'une étape d'itinéraire d'un camp",),
- OperationType.CAMP_STEP_VAL: \
- ("Camp / Validation d'une étape d'un camp",),
- OperationType.JS_TAM_ASSIGN: \
- ("Déclaration J&S / Affectation TAM d'un intervenant",),
- OperationType.JS_TAM_DECL: \
- ("Déclaration J&S / Déclaration TAM d'un intervenant",),
- OperationType.TRAIN_NEW: \
- ("Formation / Création d'une action de formation",),
- OperationType.TRAIN_NOTIFY: \
- ("Formation / Envoi de notification",),
- OperationType.TRAIN_EDIT: \
- ("Formation / Modification d'une action de formation",),
- OperationType.IN_SUB: \
- ("Individu / Abonnement",),
- OperationType.IN_MEMBERSHIP: \
- ("Individu / Adhésion",),
- OperationType.IN_NEW: \
- ("Individu / Création",),
- OperationType.IN_NOMIN_REQUEST: \
- ("Individu / Demande de nomination",),
- OperationType.IN_CARD_EDIT: \
- ("Individu / Edition de la carte d'adhérent",),
- OperationType.IN_RECEIPT_EDIT: \
- ("Individu / Edition d'un reçu fiscal",),
- OperationType.IN_REG: \
- ("Individu / Inscription",),
- OperationType.IN_PAYMENT: \
- ("Individu / Règlement de famille",),
- OperationType.IN_NOMIN_REQUEST_VAL: \
- ("Individu / Validation demande de nomination",),
- OperationType.IN_NOMIN_VAL: \
- ("Individu / Validation nomination",),
- OperationType.REG_REQUEST_CAN: \
- ("Inscription / Annulation d'une demande d'inscription",),
- OperationType.REG_REQUEST_NEW: \
- ("Inscription / Création d'une demande d'inscription",),
- OperationType.REG_REQUEST_VAL: \
- ("Inscription / Validation d'une demande d'inscription",),
- OperationType.RALREG_REQUEST_NEW: \
- ("Inscription rassemblement / Création Demande",),
- OperationType.RALREG_REQUEST_MID_VAL: \
- ("Inscription rassemblement / Validation Intermédiaire Demande",),
- OperationType.PL_NEW: \
- ("Lieu d'activité / Création d'un lieu d'activité",),
- OperationType.PL_EDIT: \
- ("Lieu d'activité / Modification d'un lieu d'activité",),
- OperationType.PAT_INSURE: \
- ("Patrimoine / Assurance",),
- OperationType.PAT_INSURE_REQUEST: \
- ("Patrimoine / Demande d'assurance",),
- OperationType.PAT_EDIT: \
- ("Patrimoine / Modification",),
- OperationType.PEDA_XLS_IMPORT: \
- ("Projet pédagogique / Import d'un fichier matrice",),
- OperationType.PEDA_XLS_DEL: \
- ("Projet pédagogique / Suppression d'un fichier matrice",),
- OperationType.ST_NEW: \
- ("Structure / Création",),
- OperationType.ST_START: \
- ("Structure / Définition date début d'activité",),
- OperationType.ST_SPEC: \
- ("Structure / Modification spécialités",),
- OperationType.ST_COPY: \
- ("Structure / Recopie nouvelle saison",),
-}
-
-_OperationTypeLeads = {}
-_OperationTypeLeads.update({name.strip().casefold(): i \
- for i, (name,) in _OperationTypeData.items()})
-
-class OperationTypeData:
- """ Operation type data (id, name). """
-
- def __init__(self, value):
- def isid(value):
- try:
- OperationType(value)
- except ValueError:
- return False
- return True
-
- self.__id = OperationType.UNKNOWN
- self.__name = None
- data = None
-
- if isinstance(value, OperationTypeData):
- self.__id = value.id
- self.__name = value.name
- elif isid(value):
- value = OperationType(value)
- self.__id = value
-
- data = _OperationTypeData.get(value, None)
- else:
- lead = value
- if type(lead) == str:
- lead = lead.strip().casefold()
-
- try:
- self.__id = _OperationTypeLeads[lead]
- data = _OperationTypeData.get(self.__id, None)
- except KeyError:
- if type(value) == str:
- self.__name = value
- else:
- raise ValueError("Could not determine an operation " \
- "type.") from None
-
- if data is not None:
- self.__name = data[0]
-
- self.__ncmp = self.__name.strip().casefold() \
- if self.__name is not None else None
-
- def __repr__(self):
- p = [f"id = {repr(self.__id)}"]
- if self.__name is not None:
- p.append(f"name = {repr(self.__name)}")
-
- return f"{self.__class__.__name__}({', '.join(p)})"
-
- def __eq__(self, value):
- if isinstance(value, _OperationTypeData):
- if value.name is None:
- return self.__id == value.id
- else:
- return self.__ncmp == value.name.strip().casefold()
- elif type(value) == str:
- return self.__ncmp == value.strip().casefold()
- else:
- return self.__id == value
-
- def __str__(self):
- if self.__name is not None:
- return self.__name
- else:
- return "Inconnu"
-
- @property
- def id(self):
- """ The type identifier, as one of the operation types defined in
- the OperationType enumeration. """
-
- return self.__id
-
- @property
- def name(self):
- """ The type name as defined in the operations journal. """
-
- return self.__name
-
-# End of file.
diff --git a/sgdfi/_dbs/_regime.py b/sgdfi/_dbs/_regime.py
deleted file mode 100755
index 7115a5c..0000000
--- a/sgdfi/_dbs/_regime.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-""" Allocations regime reference for SGDFi. """
-
-from enum import Enum as _Enum, unique as _unique
-
-__all__ = ["AllocationsRegime"]
-
-@_unique
-class AllocationsRegime(_Enum):
- """ The default type (unknown). """
- UNKNOWN = 0
-
- """ Régime général (CAF, Maritime, SNCF, …). """
- GENERAL = 1
-
- """ MSA. """
- MSA = 2
-
- """ Étranger, conseil de l'Europe. """
- EUROPE = 3
-
-# End of file.
diff --git a/sgdfi/_dbs/_st.py b/sgdfi/_dbs/_st.py
deleted file mode 100755
index 46be987..0000000
--- a/sgdfi/_dbs/_st.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-""" Structure type reference for SGDFi. """
-
-from enum import Enum as _Enum, unique as _unique
-
-__all__ = ["StructureType", "StructureTypeData"]
-
-@_unique
-class StructureType(_Enum):
- """ The default type (unknown). """
- UNKNOWN = 0
-
- """ Autres. """
- AUTRES = 1
-
- """ Sommet. """
- SOMMET = 10
-
- """ Territoire. """
- TERRITOIRE = 11
-
- """ Groupe. """
- GROUPE = 12
-
- """ Membres associés national. """
- ASSOCIES_N = 13
-
- """ Membres associés territorial. """
- ASSOCIES_T = 14
-
- """ Membres associés local. """
- ASSOCIES_L = 15
-
- """ Centre national. """
- CENTRE_NATIONAL = 16
-
- """ Unité farfadets. """
- UNITE_FARFADET = 30
-
- """ Unité louveteaux-jeanettes. """
- UNITE_8_11_ANS = 31
-
- """ Unité scouts-guides. """
- UNITE_11_14_ANS = 32
-
- """ Unité pionniers-caravelles. """
- UNITE_14_17_ANS = 33
-
- """ Unité compagnons. """
- UNITE_17_20_ANS = 34
-
- """ Unité Vent du Large. """
- UNITE_VENT_DU_LARGE = 35
-
-# Structure type data:
-# - name.
-# - internal code.
-
-_ma = "Membres associés "
-_StructureTypeData = {
- StructureType.UNKNOWN: ("Tous", -1),
-
- StructureType.AUTRES: ("Autres", 1211),
-
- StructureType.SOMMET: ("Sommet", 1207),
- StructureType.TERRITOIRE: ("Territoire", 1203),
- StructureType.GROUPE: ("Groupe", 1200),
- StructureType.ASSOCIES_N: (f"{_ma}National", 1206),
- StructureType.ASSOCIES_T: (f"{_ma}Territorial", 1204),
- StructureType.ASSOCIES_L: (f"{_ma}local", 1201),
- StructureType.CENTRE_NATIONAL: ("Centre National", 1205),
-
- StructureType.UNITE_FARFADET: ("Unité Farfadet", 1208),
- StructureType.UNITE_8_11_ANS: ("Unité 8-11 ans", 1199),
- StructureType.UNITE_11_14_ANS: ("Unité 11-14 ans", 1212),
- StructureType.UNITE_14_17_ANS: ("Unité 14-17 ans", 1210),
- StructureType.UNITE_17_20_ANS: ("Unité 17-20 ans", 1209),
- StructureType.UNITE_VENT_DU_LARGE: ("Unité Vent du Large", 1202),
-}
-
-_StructureTypeLeads = {}
-_StructureTypeLeads.update({name.strip().casefold(): i for i, (name, ii) \
- in _StructureTypeData.items()})
-_StructureTypeLeads.update({ii: i for i, (name, ii) \
- in _StructureTypeData.items()})
-_StructureTypeLeads.update({str(ii): i for i, (name, ii) \
- in _StructureTypeData.items()})
-
-class StructureTypeData:
- """ Structure type data (id, name, …). """
-
- def __init__(self, value):
- def isid(id):
- try:
- StructureType(value)
- except ValueError:
- return False
- return True
-
- self.__id = StructureType.UNKNOWN
- self.__name = None
- self.__ii = None
- data = None
-
- if isinstance(value, StructureTypeData):
- self.__id = value.id
- self.__ii = value.iid
- self.__name = value.name
- elif isid(value):
- value = StructureType(value)
- self.__id = value
-
- data = _StructureTypeData.get(value, None)
- else:
- lead = value
- if type(lead) == str:
- lead = lead.strip().casefold()
-
- try:
- self.__id = _StructureTypeLeads[lead]
- data = _StructureTypeData.get(self.__id, None)
- except KeyError:
- if type(value) == str:
- self.__name = value
- else:
- raise ValueError("Could not determine a structure "
- "type.") from None
-
- if data is not None:
- self.__name = data[0]
- self.__ii = data[1]
-
- def __repr__(self):
- p = []
- if self.__id is not None:
- p.append(f"id = {repr(self.__id)}")
- if self.__name is not None:
- p.append(f"name = {repr(self.__name)}")
- if self.__ii is not None:
- p.append(f"iid = {repr(self.__ii)}")
-
- return f"{self.__class__.__name__}({', '.join(p)})"
-
- @property
- def id(self):
- """ The type identifier, as one of the structure types defined in
- the StructureType enumeration. """
-
- return self.__id
-
- @property
- def name(self):
- """ The type name as defined in the structure summary page. """
-
- return self.__name
-
- @property
- def iid(self):
- """ The internal identifier on the intranet. """
-
- return self.__ii
-
-# End of file.
diff --git a/sgdfi/_dbs/_stspe.py b/sgdfi/_dbs/_stspe.py
deleted file mode 100755
index b1102da..0000000
--- a/sgdfi/_dbs/_stspe.py
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-""" Structure speciality reference for SGDFi. """
-
-from enum import Enum as _Enum, unique as _unique
-
-__all__ = ["StructureSpeciality", "StructureSpecialityData"]
-
-@_unique
-class StructureSpeciality(_Enum):
- """ The default speciality (unknown). """
- UNKNOWN = 0
-
- """ Sans specialité. """
- WITHOUT = 1
-
- """ Marine. """
- MARINE = 2
-
- """ Vent du Large. """
- VENT_DU_LARGE = 3
-
-# Structure speciality data:
-# - name.
-# - internal code.
-
-_StructureSpecialityData = {
- StructureSpeciality.UNKNOWN: ("Toutes", -1),
-
- StructureSpeciality.WITHOUT: ("sans spécialité", 624),
- StructureSpeciality.MARINE: ("Marine", 622),
- StructureSpeciality.VENT_DU_LARGE: ("Vent du Large", 623),
-}
-
-_StructureSpecialityLeads = {}
-_StructureSpecialityLeads.update({name.strip().casefold(): i \
- for i, (name, ii) in _StructureSpecialityData.items()})
-_StructureSpecialityLeads.update({ii: i \
- for i, (name, ii) in _StructureSpecialityData.items()})
-_StructureSpecialityLeads.update({str(ii): i \
- for i, (name, ii) in _StructureSpecialityData.items()})
-
-class StructureSpecialityData:
- """ Structure speciality data (id, name, …). """
-
- def __init__(self, value):
- def isid(id):
- try:
- StructureSpeciality(value)
- except ValueError:
- return False
- return True
-
- self.__id = StructureSpeciality.UNKNOWN
- self.__name = None
- self.__ii = None
- data = None
-
- if isinstance(value, StructureSpecialityData):
- self.__id = value.id
- self.__ii = value.iid
- self.__name = value.name
- elif isid(value):
- value = StructureSpeciality(value)
- self.__id = value
-
- data = _StructureSpecialityData.get(value, None)
- else:
- lead = value
- if type(lead) == str:
- lead = lead.strip().casefold()
-
- try:
- self.__id = _StructureSpecialityLeads[lead]
- data = _StructureSpecialityData.get(self.__id, None)
- except KeyError:
- if type(value) == str:
- self.__name = value
- else:
- raise ValueError("Could not determine a structure "
- "type.") from None
-
- if data is not None:
- self.__name = data[0]
- self.__ii = data[1]
-
- def __repr__(self):
- p = []
- if self.__id is not None:
- p.append(f"id = {repr(self.__id)}")
- if self.__name is not None:
- p.append(f"name = {repr(self.__name)}")
- if self.__ii is not None:
- p.append(f"iid = {repr(self.__iid)}")
-
- return f"{self.__class__.__name__}({', '.join(p)})"
-
- @property
- def id(self):
- """ The speciality identifier, as one of the structure types
- defined in the StructureSpeciality enumeration. """
-
- return self.__id
-
- @property
- def name(self):
- """ The type name as defined in the structure summary page. """
-
- return self.__name
-
- @property
- def iid(self):
- """ The internal identifier on the intranet. """
-
- return self.__ii
-
-# End of file.
diff --git a/sgdfi/_dbs/_ststatus.py b/sgdfi/_dbs/_ststatus.py
deleted file mode 100755
index f8f27e9..0000000
--- a/sgdfi/_dbs/_ststatus.py
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/env python3
-#**************************************************************************
-# Copyright (C) 2018 Thomas Touhey <thomas@touhey.fr>
-# This file is part of the sgdfi project, which is MIT-licensed.
-#**************************************************************************
-""" Structure status reference for SGDFi. """
-
-from enum import Enum as _Enum, unique as _unique
-
-__all__ = ["StructureStatus", "StructureStatusData"]
-
-@_unique
-class StructureStatus(_Enum):
- """ The default status (unknown). """
- UNKNOWN = -1
-
- """ Ouverte. """
- OPEN = 0
-
- """ Fermée. """
- CLOSED = 1
-
- """ Suspendue. """
- SUSPENDED = 2
-
-# Structure status data.
-# - name.
-# - internal identifier on the intranet.
-
-_StructureStatusData = {
- StructureStatus.UNKNOWN: ("Tous", -1),
-
- StructureStatus.OPEN: ("Ouverte", 0),
- StructureStatus.CLOSED: ("Fermée", 1),
- StructureStatus.SUSPENDED: ("Suspendue", 2)
-}
-
-_StructureStatusLeads = {}
-_StructureStatusLeads.update({name.strip().casefold(): i \
- for i, (name, ii) in _StructureStatusData.items()})
-_StructureStatusLeads.update({ii: i for i, (name, ii) \
- in _StructureStatusData.items()})
-_StructureStatusLeads.update({str(ii): i for i, (name, ii) \
- in _StructureStatusData.items()})
-
-class StructureStatusData:
- """ The structure status data. """
-
- def __init__(self, value):
- def isid(id):
- try:
- StructureStatus(value)
- except ValueError:
- return False
- return True
-
- self.__id = StructureStatus.UNKNOWN
- self.__name = None
- self.__ii = None
- data = None
-
- if isinstance(value, StructureStatusData):
- self.__id = value.id
- self.__name = value.name
- self.__ii = value.iid
- elif isid(value):
- value = StructureStatus(value)
- self.__id = value
-
- data = _StructureStatusData.get(value, None)
- else:
- lead = value
- if type(lead) == str:
- lead = lead.strip().casefold()
-
- try:
- self.__id = _StructureStatusLeads[lead]
- data = _StructureStatusData.get(self.__id, None)
- except KeyError:
- if type(value) == str:
- self.__name = value
- else:
- msg = "Could not determine a structure status."
- raise ValueError(msg) from None
-
- if data is not None:
- self.__name = data[0]
- self.__ii = data[1]
-
- def __repr__(self):
- p = []
- if self.__id is not None:
- p.append(f"id = {repr(self.__id)}")
- if self.__name is not None:
- p.append(f"name = {repr(self.__name)}")
-
- return f"{self.__class__.__name__}({', '.join(p)})"
-
- @property
- def id(self):
- """ The status identifier, as one of the identifiers defined in
- the StructureStatus enumeration. """
-
- return self.__id
-
- @property
- def name(self):
- """ The status name as defined in the structure summary page. """
-
- return self.__name
-
- @property
- def iid(self):
- """ The internal identifier on the intranet. """
-
- return self.__ii
-
-# End of file.