Commit 3d6bb11e authored by mouadh's avatar mouadh

Prefer static methods over instance methods

parent 3484de7e
......@@ -10,7 +10,8 @@ class MicBench:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def bench(self, connection, query, cube=CUBE_NAME, number=1):
@staticmethod
def bench(connection, query, cube=CUBE_NAME, number=1):
"""
To be precise, this executes the query statement once, and
then returns the time it takes to execute
......
......@@ -575,7 +575,8 @@ class MdxEngine:
return df[cols + self.selected_measures]
def add_missed_column(self, dataframe1, dataframe2):
@staticmethod
def add_missed_column(dataframe1, dataframe2):
"""
solution to fix BUG : https://github.com/pandas-dev/pandas/issues/15525
......
......@@ -12,7 +12,8 @@ class MdxParser:
"""
START = 'MDX_statement'
def parsing_mdx_query(self, axis, query):
@staticmethod
def parsing_mdx_query(axis, query):
'''
Split the query into axis
......
......@@ -52,7 +52,8 @@ class XmlaDiscoverTools():
if col[-3:] != "_id"
]]
def discover_datasources_response(self):
@staticmethod
def discover_datasources_response():
return etree.fromstring("""
<return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
......@@ -1513,7 +1514,8 @@ class XmlaDiscoverTools():
</return>
""")
def discover_literals_response(self, request):
@staticmethod
def discover_literals_response(request):
if request.Properties.PropertyList.Content == 'SchemaData' \
and request.Properties.PropertyList.Format == 'Tabular':
......
......@@ -12,7 +12,8 @@ class XmlaExecuteTools():
def __init__(self, executer):
self.executer = executer
def split_dataframe(self, mdx_execution_result):
@staticmethod
def split_dataframe(mdx_execution_result):
"""
Split DataFrame into multiple ones by dimension
example:
......@@ -57,7 +58,8 @@ class XmlaExecuteTools():
for key, value in mdx_execution_result['columns_desc']['all']
.items())
def get_tuple_without_nan(self, tuple):
@staticmethod
def get_tuple_without_nan(tuple):
"""
remove nan from tuple.
example
......@@ -505,7 +507,8 @@ class XmlaExecuteTools():
return self.generate_one_axis_info(mdx_execution_result)
def generate_cell_info(self):
@staticmethod
def generate_cell_info():
return """
<CellInfo>
<Value name="VALUE"/>
......
......@@ -15,7 +15,8 @@ class Logs:
self.file_name = file_name + ".log"
self.root_path = self._create_log_file()
def _create_log_file(self):
@staticmethod
def _create_log_file():
home_directory = expanduser("~")
location = os.path.join(home_directory, 'olapy-data', 'logs')
......
......@@ -13,7 +13,8 @@ class Graphs:
"""
# TODO remove this , ( right know this is just a demo with sales cube )
def generate_graphes(self, dataframe):
@staticmethod
def generate_graphes(dataframe):
"""
Generate graphs for a pandas DataFrame, if you want to add graphs, you have to do it in this function
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment