diff options
author | gilad_ilsar <gandismidas1> | 2016-09-22 14:13:48 +0300 |
---|---|---|
committer | gilad_ilsar <gandismidas1> | 2016-09-22 14:13:48 +0300 |
commit | e24a4199fc75f9939c488c46aea3d8ff745a6ba8 (patch) | |
tree | 689fb682e26da9c25de272b33c23493c060f3193 /entities | |
parent | cc9c0e57d5a23be30a9d0ad5a97acaa01019b573 (diff) |
updates
Diffstat (limited to 'entities')
-rw-r--r-- | entities/location.py | 3 | ||||
-rw-r--r-- | entities/person.py | 29 |
2 files changed, 24 insertions, 8 deletions
diff --git a/entities/location.py b/entities/location.py index cd1ca01..07ef7ff 100644 --- a/entities/location.py +++ b/entities/location.py @@ -2,10 +2,11 @@ from entities.basic_entity import BasicEntity class Location(BasicEntity): - def __init__(self, name, types_of_place, name_in_langs): + def __init__(self, name, types_of_place, name_in_langs, comments_list): self.name = name self.types_of_place = types_of_place self.name_in_langs = name_in_langs + self.comments_list = comments_list def print_entity(self): print("Name = " + self.name) diff --git a/entities/person.py b/entities/person.py index d541bb4..fa04566 100644 --- a/entities/person.py +++ b/entities/person.py @@ -2,7 +2,7 @@ from entities.basic_entity import BasicEntity class Person(BasicEntity): - def __init__(self, name, date_of_birth, name_in_langs, bio_data): + def __init__(self, name, date_of_birth, name_in_langs, bio_data, comments_list): """ :param name: @@ -22,6 +22,7 @@ class Person(BasicEntity): self.birth_year = date_of_birth.strip() self.death_year = '' self.name_in_langs = name_in_langs + ''' place_of_birth = list() place_of_death = list() profession = list() @@ -37,12 +38,26 @@ class Person(BasicEntity): self.place_of_birth = place_of_birth self.place_of_death = place_of_death self.profession = profession + ''' + bio_data_dict = dict() + for elem in bio_data: + elem_splitted = elem.split(":") + if len(elem_splitted) == 2: + bio_data_key = elem_splitted[0] + bio_data_value = elem_splitted[1] + if bio_data_key in bio_data_dict: + bio_data_dict.get(bio_data_key).append(bio_data_value) + else: + bio_data_dict.update( + {bio_data_key: [bio_data_value]} + ) + else: + bio_data_dict.update({elem: ''}) + self.bio_data = bio_data_dict + self.comments_list = comments_list + def print_entity(self): print("Name = " + self.name) - print("Birth year = " + self.birth_year) - print("Death year = " + self.death_year) - print("Names in langs" + str(self.name_in_langs)) - print("Places of birth = " + str(self.place_of_birth)) - print("Places of death = " + str(self.place_of_death)) - print("profession = " + str(self.profession)) + print("Names in langs = " + str(self.name_in_langs)) + print("Bio Data = " + str(self.bio_data)) |