From 985a0fcac8b89bfe3c5bdcea0889b921cc27c033 Mon Sep 17 00:00:00 2001 From: roy lewin Date: Wed, 21 Sep 2016 21:59:22 +0300 Subject: Added basic entities --- entities/__init__.py | 3 +++ entities/basic_entity.py | 5 +++++ entities/institution.py | 6 ++++++ entities/location.py | 8 ++++++++ entities/person.py | 18 ++++++++++++++++++ 5 files changed, 40 insertions(+) create mode 100644 entities/basic_entity.py create mode 100644 entities/institution.py create mode 100644 entities/location.py create mode 100644 entities/person.py (limited to 'entities') diff --git a/entities/__init__.py b/entities/__init__.py index e69de29..48f64d6 100644 --- a/entities/__init__.py +++ b/entities/__init__.py @@ -0,0 +1,3 @@ +from person import Person +from institution import Institution +from location import Location \ No newline at end of file diff --git a/entities/basic_entity.py b/entities/basic_entity.py new file mode 100644 index 0000000..9181422 --- /dev/null +++ b/entities/basic_entity.py @@ -0,0 +1,5 @@ +from libs import JsonSerializable + + +class BasicEntity(JsonSerializable): + pass diff --git a/entities/institution.py b/entities/institution.py new file mode 100644 index 0000000..4538207 --- /dev/null +++ b/entities/institution.py @@ -0,0 +1,6 @@ +from entities.basic_entity import BasicEntity + + +class Institution(BasicEntity): + def __init__(self): + raise NotImplementedError() diff --git a/entities/location.py b/entities/location.py new file mode 100644 index 0000000..8130632 --- /dev/null +++ b/entities/location.py @@ -0,0 +1,8 @@ +from entities.basic_entity import BasicEntity + + +class Location(BasicEntity): + def __init__(self, name, types, coordinates): + self.name = name + self.types = types + self.coordinates = coordinates diff --git a/entities/person.py b/entities/person.py new file mode 100644 index 0000000..b9e9d78 --- /dev/null +++ b/entities/person.py @@ -0,0 +1,18 @@ +from entities.basic_entity import BasicEntity + + +class Person(BasicEntity): + def __init__(self, name, date_of_birth, name_in_langs): + """ + + :param name: + :param date_of_birth: + :param name_in_langs: Mapping of the persons's name in various languages, as a dictionary. For example: + { + "latin": "George" + "heb": "[george in hebrew]" + } + """ + self.name = name + self.date_of_birth = date_of_birth + self.name_in_langs = name_in_langs -- cgit v1.2.3