forked from ScoDoc/ScoDoc
Fix: bac None
This commit is contained in:
parent
b196675f9e
commit
e7a97919b4
@ -132,19 +132,29 @@ BACS_S = {t[0]: t[2:] for t in _BACS}
|
|||||||
|
|
||||||
class Baccalaureat:
|
class Baccalaureat:
|
||||||
def __init__(self, bac, specialite=""):
|
def __init__(self, bac, specialite=""):
|
||||||
self.bac = bac
|
self.bac = bac or ""
|
||||||
self.specialite = specialite
|
self.specialite = specialite or ""
|
||||||
self._abbrev, self._type = BACS_SSP.get((bac, specialite), (None, None))
|
self._abbrev, self._type = BACS_SSP.get(
|
||||||
|
(self.bac, self.specialite), (None, None)
|
||||||
|
)
|
||||||
# Parfois, la specialite commence par la serie: essaye
|
# Parfois, la specialite commence par la serie: essaye
|
||||||
if self._type is None and specialite and specialite.startswith(bac):
|
if (
|
||||||
specialite = specialite[len(bac) :].strip(" -")
|
self._type is None
|
||||||
self._abbrev, self._type = BACS_SSP.get((bac, specialite), (None, None))
|
and self.specialite
|
||||||
|
and self.specialite.startswith(self.bac)
|
||||||
|
):
|
||||||
|
specialite = self.specialite[len(self.bac) :].strip(" -")
|
||||||
|
self._abbrev, self._type = BACS_SSP.get(
|
||||||
|
(self.bac, specialite), (None, None)
|
||||||
|
)
|
||||||
# Cherche la forme serie specialite
|
# Cherche la forme serie specialite
|
||||||
if self._type is None and specialite:
|
if self._type is None and specialite:
|
||||||
self._abbrev, self._type = BACS_S.get(bac + " " + specialite, (None, None))
|
self._abbrev, self._type = BACS_S.get(
|
||||||
|
self.bac + " " + specialite, (None, None)
|
||||||
|
)
|
||||||
# Cherche avec juste le bac, sans specialite
|
# Cherche avec juste le bac, sans specialite
|
||||||
if self._type is None:
|
if self._type is None:
|
||||||
self._abbrev, self._type = BACS_S.get(bac, (None, None))
|
self._abbrev, self._type = BACS_S.get(self.bac, (None, None))
|
||||||
|
|
||||||
def abbrev(self):
|
def abbrev(self):
|
||||||
"abbreviation for this bac"
|
"abbreviation for this bac"
|
||||||
|
Loading…
Reference in New Issue
Block a user