First commit

This commit is contained in:
Cyril Novel 2020-06-11 20:10:49 +02:00
commit 16a203292d
7 changed files with 920 additions and 0 deletions

37
src/mariage.py Normal file
View file

@ -0,0 +1,37 @@
from datetime import date
unions = ['D', 'M', 'L'] # Divorce (0), Mariage ou Pacs (1), Union Libre (2)
class Mariage:
def __init__(self, uid: int, id_a: int, id_b: int, event_date: date, last_mariage: bool,
hide: bool, union: str):
self._uid = uid
self._id_a = id_a
self._id_b = id_b
self._date = event_date
self._last_mariage = last_mariage
self._hide = hide
if union not in unions:
raise ValueError('{} is not in {}'.format(union, unions))
self._union = union
def show_mariage(self):
return not self._hide and self._union != 'D' and self._last_mariage
def event_date(self):
return self._date
def in_this_union(self, uid: int) -> bool:
return self._id_a == uid or self._id_b == uid
def get_so(self, uid: int) -> int:
if uid == self._id_a:
return self._id_b
return self._id_a
def id_a(self):
return self._id_a
def id_b(self):
return self._id_b