-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject_team.py
30 lines (23 loc) · 922 Bytes
/
project_team.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
from validate_email import validate_email
from employee import Employee
class ProjectTeam:
def __init__(self, name, lead=None, id=None) -> None:
self.id = id
self.name = name
self.members = []
self.reports = []
if lead:
self.set_reporting_members([lead])
def set_working_members(self, emails):
self.__add_employee(emails, self.members)
return self
def set_reporting_members(self, emails):
self.__add_employee(emails, self.reports)
return self
def __add_employee(self, employee_emails, employee_list):
for email in employee_emails:
email = email.strip(' \t\n\r')
if validate_email(email):
employee_list.append(Employee(email))
def __str__(self) -> str:
return "name={}, id={}, members={}, reports={}".format(self.name, self.id, self.members, self.reports)