From 1f283710924a5bf70bd6241b972e7b9f8fe20aa7 Mon Sep 17 00:00:00 2001
From: lodenthal <lodenthal@uni-bielefeld.de>
Date: Thu, 21 Dec 2017 10:59:38 +0300
Subject: [PATCH] finished properties for rest of files

---
 navipy/database/__init__.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/navipy/database/__init__.py b/navipy/database/__init__.py
index b310701..ac02d21 100644
--- a/navipy/database/__init__.py
+++ b/navipy/database/__init__.py
@@ -116,8 +116,10 @@ It creates three sql table on initialisation.
 
     def __init__(self, filename, channels=['R', 'G', 'B', 'D']):
         """Initialisation of the database """
-        assert isinstance(filename, str), 'filename should be a string'
-        assert isinstance(channels, list), 'nb_channel should be an integer'
+        if not isinstance(filename, str):
+            raise TypeError('filename should be a string')
+        if not isinstance(channels, list):
+            raise TypeError('nb_channel should be an integer')
         self.filename = filename
         self.channels = channels
         self.normalisation_columns = list()
@@ -151,7 +153,7 @@ It creates three sql table on initialisation.
                 assert self.table_exist(tablename),\
                     '{} does not contain a table named {}'.format(
                         filename, tablename)
-        elif self.create():
+        elif self.create:
             # Create database
             self.db = sqlite3.connect(
                 filename, detect_types=sqlite3.PARSE_DECLTYPES)
@@ -244,7 +246,7 @@ It creates three sql table on initialisation.
                 WHERE {};
                 """.format(where), params)
             return self.db_cursor.fetchone()[0]
-        elif self.create():
+        elif self.create:
             self.db_cursor.execute(
                 """
                 INSERT
@@ -264,6 +266,7 @@ It creates three sql table on initialisation.
             print(posorient)
             raise ValueError('posorient not found')
 
+    @property
     def create(self):
         return False
 
@@ -276,6 +279,7 @@ class DataBaseLoad(DataBase):
         """Initialise the DataBaseLoader"""
         DataBase.__init__(self, filename, channels=channels)
 
+    @property
     def create(self):
         """use to decide weather to alter the database or not
         return False because we do not want
@@ -300,7 +304,8 @@ class DataBaseLoad(DataBase):
             toyield.drop('id', inplace=True)
             yield toyield
 
-    def get_posorients(self):
+    @property
+    def posorients(self):
         """Return the position orientations of all points in the \
 database
         """
-- 
GitLab