-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelation.py
46 lines (38 loc) · 1.45 KB
/
relation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 17 14:02:42 2021
@author: josse
"""
class Relation:
def __init__(self, perso = None, relation = "neutre"):
# Relations neutres : "inconnu" (0) , "connaissance" (1,2) , "ami" (3 et +)
# Relations spéciales : Base + Détail (ex: famille + parent)
self.perso = perso
self.nbRencontres = 0
self.nbDiscussions = 0
self.relationBase = "neutre"
self.relationDetaillee = ""
if relation == "inconnu":
self.relationBase = "neutre"
if relation == "connaissance":
self.relationBase = "neutre"
self.nbDiscussions = 1
elif relation == "ami":
self.relationBase = "neutre"
self.nbDiscussions = 3
if relation in ["parent", "enfant", "adelphe", "époux"]:
self.relationBase = "famille"
self.relationDetaillee = relation
if relation in ["patron","collègue","employé"]:
self.relationBase = "travail"
self.relationDetaillee = relation
def getRelation(self):
if self.relationBase != "neutre":
return self.relationBase + "/" + self.relationDetaillee
else:
if self.nbDiscussions < 1:
return "inconnu"
elif self.nbDiscussions < 3:
return "connaissance"
else:
return "ami"