Skip to content

Commit

Permalink
#21, will revert post commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ZNevzz committed Feb 8, 2020
1 parent e0620dd commit 2732902
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions octopy_predictor/src/datagatherer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,21 @@ def __init__(self, type:str):
None.
"""

if type not in DataGathererInput.CONSTRAINTS.keys():
pass
#TODO Throw error
self.type = type
self.values = {}
self._values = {}

def add(self, key:str, value):
@values.setter
def values(self, key:str, value):
"""
Parameters
----------
key : str
valid keys present in CONSTRAINTS values.
valid keys present in CONSTRAINTS _values.
value : any
value corresponding to key.
Expand All @@ -79,7 +79,7 @@ def add(self, key:str, value):
"""

if key in DataGathererInput.CONSTRAINTS[self.type]:
self.values[key] = value
self._values[key] = value


class DataGatherer(object):
Expand Down Expand Up @@ -182,7 +182,7 @@ def read_sql(self, input: DataGathererInput):
----------
input : DataGathererInput
Contains values required to execute SQL QUERY.
Contains _values required to execute SQL QUERY.
Returns
-------
Expand All @@ -192,6 +192,7 @@ def read_sql(self, input: DataGathererInput):
"""
df = pd.DataFrame()
#TODO Move all connections to application start-up
conn = sqlite3.connect(input[CONNECTION])
df = pd.read_sql_query(input[QUERY], con=conn)
return df
Expand Down
4 changes: 2 additions & 2 deletions octopy_predictor/tests/test_datagatherer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def test_determine_resource(self):
self.assertTrue(1==1)

class DataGathererInputTest(unittest.TestCase):
"""Test cases for DataGathererInput"""

"""Test cases for DataGathererInput"""
def test_SQL_inputs(self):
"""
given: input is SQL
Expand Down

0 comments on commit 2732902

Please sign in to comment.