aboutsummaryrefslogtreecommitdiff
path: root/sgdfi/_dbs
diff options
context:
space:
mode:
authorThomas Touhey <thomas@touhey.fr>2019-09-29 17:51:06 +0200
committerThomas Touhey <thomas@touhey.fr>2019-09-29 17:51:06 +0200
commit89c0f6a4dacb74e7a50df9a13d962e6ecc5074ac (patch)
treefd0eee1a30f593223e1b815fbc1768f8356f897c /sgdfi/_dbs
parentd2983f5eef8715e2935cf8b721f4f45c41b8703c (diff)
Just a push of my latest toyings around
Diffstat (limited to 'sgdfi/_dbs')
-rwxr-xr-xsgdfi/_dbs/__init__.py4
-rwxr-xr-xsgdfi/_dbs/_code.py4
-rwxr-xr-xsgdfi/_dbs/_dept.py14
-rwxr-xr-xsgdfi/_dbs/_event.py4
-rwxr-xr-xsgdfi/_dbs/_funcdata.py4
-rwxr-xr-xsgdfi/_dbs/_funcs.py27
-rwxr-xr-xsgdfi/_dbs/_ops.py14
-rwxr-xr-xsgdfi/_dbs/_regime.py4
-rwxr-xr-xsgdfi/_dbs/_st.py15
-rwxr-xr-xsgdfi/_dbs/_stspe.py12
-rwxr-xr-xsgdfi/_dbs/_ststatus.py8
11 files changed, 59 insertions, 51 deletions
diff --git a/sgdfi/_dbs/__init__.py b/sgdfi/_dbs/__init__.py
index e37ca74..8bc7dec 100755
--- a/sgdfi/_dbs/__init__.py
+++ b/sgdfi/_dbs/__init__.py
@@ -1,8 +1,8 @@
#!/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
diff --git a/sgdfi/_dbs/_code.py b/sgdfi/_dbs/_code.py
index d8cce03..1d8434b 100755
--- a/sgdfi/_dbs/_code.py
+++ b/sgdfi/_dbs/_code.py
@@ -1,8 +1,8 @@
#!/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
diff --git a/sgdfi/_dbs/_dept.py b/sgdfi/_dbs/_dept.py
index 25c2f42..c5e1144 100755
--- a/sgdfi/_dbs/_dept.py
+++ b/sgdfi/_dbs/_dept.py
@@ -1,8 +1,8 @@
#!/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
@@ -589,9 +589,11 @@ _DepartmentLeads.update({ii: i for i, (dcode, name, ii) \
_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})
+ 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})
+ for i, (dcode, name, ii) in _DepartmentData.items() \
+ if dcode is not None})
class DepartmentData:
""" Department data (id, name, …). """
@@ -655,8 +657,8 @@ class DepartmentData:
@property
def id(self):
- """ The department identifier, as one of the structure types defined in
- the Department enumeration. """
+ """ The department identifier, as one of the structure types
+ defined in the Department enumeration. """
return self.__id
diff --git a/sgdfi/_dbs/_event.py b/sgdfi/_dbs/_event.py
index b25c27a..4cd4bce 100755
--- a/sgdfi/_dbs/_event.py
+++ b/sgdfi/_dbs/_event.py
@@ -1,8 +1,8 @@
#!/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
diff --git a/sgdfi/_dbs/_funcdata.py b/sgdfi/_dbs/_funcdata.py
index fbc7bb0..8df963b 100755
--- a/sgdfi/_dbs/_funcdata.py
+++ b/sgdfi/_dbs/_funcdata.py
@@ -1,8 +1,8 @@
#!/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
diff --git a/sgdfi/_dbs/_funcs.py b/sgdfi/_dbs/_funcs.py
index d70e69a..9dc2861 100755
--- a/sgdfi/_dbs/_funcs.py
+++ b/sgdfi/_dbs/_funcs.py
@@ -1,8 +1,8 @@
#!/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
@@ -87,8 +87,8 @@ class FunctionRawData:
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)
+ return FunctionRawData(self.__iid, self.__code, self.__nm,
+ self.__nf, cnames, self.__srcorder)
@property
def srcorder(self):
@@ -114,23 +114,26 @@ class FunctionRawData:
# - 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({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({f"{c} ({nouns[0]})".strip().casefold(): i \
+_FunctionLeads.update({_sc(f"{c} ({nouns[0]})"): i \
for i, (c, ii, *nouns) in _FunctionData.items()})
-_FunctionLeads.update({f"{c} ({nouns[1]})".strip().casefold(): i \
+_FunctionLeads.update({_sc(f"{c} ({nouns[1]})"): i \
for i, (c, ii, *nouns) in _FunctionData.items() if len(nouns) > 1})
-_FunctionLeads.update({f"{c} ({nouns[0]} / {nouns[1]})".strip().casefold(): i \
+_FunctionLeads.update({_sc(f"{c} ({nouns[0]} / {nouns[1]})"): i \
for i, (c, ii, *nouns) in _FunctionData.items() if len(nouns) > 1})
class FunctionData:
diff --git a/sgdfi/_dbs/_ops.py b/sgdfi/_dbs/_ops.py
index 7d3dd03..f631d01 100755
--- a/sgdfi/_dbs/_ops.py
+++ b/sgdfi/_dbs/_ops.py
@@ -1,8 +1,8 @@
#!/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
@@ -29,7 +29,8 @@ class OperationType(_Enum):
""" Animation / Création d'une tâche. """
ANIM_TASK_NEW = 50
- """ Bulletin d'adhésion / Impression locale d'un bulletin d'adhésion. """
+ """ Bulletin d'adhésion / Impression locale d'un bulletin
+ d'adhésion. """
BUL_PRINT = 3
""" Camp / Ajout d'un animateur à un camp. """
@@ -178,7 +179,8 @@ _OperationTypeData = {
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",),
+ ("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: \
@@ -341,8 +343,8 @@ class OperationTypeData:
@property
def id(self):
- """ The type identifier, as one of the operation types defined in the
- OperationType enumeration. """
+ """ The type identifier, as one of the operation types defined in
+ the OperationType enumeration. """
return self.__id
diff --git a/sgdfi/_dbs/_regime.py b/sgdfi/_dbs/_regime.py
index 2e9c2f0..7115a5c 100755
--- a/sgdfi/_dbs/_regime.py
+++ b/sgdfi/_dbs/_regime.py
@@ -1,8 +1,8 @@
#!/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
diff --git a/sgdfi/_dbs/_st.py b/sgdfi/_dbs/_st.py
index 4cca2dc..46be987 100755
--- a/sgdfi/_dbs/_st.py
+++ b/sgdfi/_dbs/_st.py
@@ -1,8 +1,8 @@
#!/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
@@ -60,6 +60,7 @@ class StructureType(_Enum):
# - name.
# - internal code.
+_ma = "Membres associés "
_StructureTypeData = {
StructureType.UNKNOWN: ("Tous", -1),
@@ -68,9 +69,9 @@ _StructureTypeData = {
StructureType.SOMMET: ("Sommet", 1207),
StructureType.TERRITOIRE: ("Territoire", 1203),
StructureType.GROUPE: ("Groupe", 1200),
- StructureType.ASSOCIES_N: ("Membres associés National", 1206),
- StructureType.ASSOCIES_T: ("Membres associés Territorial", 1204),
- StructureType.ASSOCIES_L: ("Membres associés local", 1201),
+ 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),
@@ -126,8 +127,8 @@ class StructureTypeData:
if type(value) == str:
self.__name = value
else:
- raise ValueError("Could not determine a structure type.") \
- from None
+ raise ValueError("Could not determine a structure "
+ "type.") from None
if data is not None:
self.__name = data[0]
diff --git a/sgdfi/_dbs/_stspe.py b/sgdfi/_dbs/_stspe.py
index 03bde17..b1102da 100755
--- a/sgdfi/_dbs/_stspe.py
+++ b/sgdfi/_dbs/_stspe.py
@@ -1,8 +1,8 @@
#!/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
@@ -80,8 +80,8 @@ class StructureSpecialityData:
if type(value) == str:
self.__name = value
else:
- raise ValueError("Could not determine a structure type.") \
- from None
+ raise ValueError("Could not determine a structure "
+ "type.") from None
if data is not None:
self.__name = data[0]
@@ -100,8 +100,8 @@ class StructureSpecialityData:
@property
def id(self):
- """ The speciality identifier, as one of the structure types defined in
- the StructureSpeciality enumeration. """
+ """ The speciality identifier, as one of the structure types
+ defined in the StructureSpeciality enumeration. """
return self.__id
diff --git a/sgdfi/_dbs/_ststatus.py b/sgdfi/_dbs/_ststatus.py
index 2144cc9..f8f27e9 100755
--- a/sgdfi/_dbs/_ststatus.py
+++ b/sgdfi/_dbs/_ststatus.py
@@ -1,8 +1,8 @@
#!/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
@@ -36,8 +36,8 @@ _StructureStatusData = {
}
_StructureStatusLeads = {}
-_StructureStatusLeads.update({name.strip().casefold(): i for i, (name, ii) \
- in _StructureStatusData.items()})
+_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) \