Commit a351457d authored by mouadh's avatar mouadh

Avoid consecutive if-statements

parent 1e4a8b9e
...@@ -52,28 +52,28 @@ class MdxParser: ...@@ -52,28 +52,28 @@ class MdxParser:
types=[SelectStatement])) types=[SelectStatement]))
ast = model.parse(query, rule_name=MdxParser.START, ignorecase=True) ast = model.parse(query, rule_name=MdxParser.START, ignorecase=True)
if axis == "column": if axis == "column":
if ast.select_statement.axis_specification_columns is not None: if ast.select_statement.axis_specification_columns is not None and \
if u'' in ast.select_statement.axis_specification_columns: u'' in ast.select_statement.axis_specification_columns:
ast.select_statement.axis_specification_columns.remove(u'') ast.select_statement.axis_specification_columns.remove(u'')
return ast.select_statement.axis_specification_columns return ast.select_statement.axis_specification_columns
elif axis == "row": elif axis == "row":
if ast.select_statement.axis_specification_rows is not None: if ast.select_statement.axis_specification_rows is not None and \
if u'' in ast.select_statement.axis_specification_rows: u'' in ast.select_statement.axis_specification_rows:
ast.select_statement.axis_specification_rows.remove(u'') ast.select_statement.axis_specification_rows.remove(u'')
return ast.select_statement.axis_specification_rows return ast.select_statement.axis_specification_rows
elif axis == "cube": elif axis == "cube":
if ast.select_statement.cube_specification is not None: if ast.select_statement.cube_specification is not None and \
if u'' in ast.select_statement.cube_specification: u'' in ast.select_statement.cube_specification:
ast.select_statement.cube_specification.remove(u'') ast.select_statement.cube_specification.remove(u'')
return ast.select_statement.cube_specification[1] if \ return ast.select_statement.cube_specification[1] if \
isinstance(ast.select_statement.cube_specification, list) \ isinstance(ast.select_statement.cube_specification, list) \
else ast.select_statement.cube_specification else ast.select_statement.cube_specification
elif axis == "condition": elif axis == "condition":
if ast.select_statement.condition_specification is not None: if ast.select_statement.condition_specification is not None and \
if type(ast.select_statement.condition_specification) not in ( type(ast.select_statement.condition_specification) not in (
unicode, str): unicode, str) and \
if u'' in ast.select_statement.condition_specification: u'' in ast.select_statement.condition_specification:
ast.select_statement.condition_specification.remove(u'') ast.select_statement.condition_specification.remove(u'')
return ast.select_statement.condition_specification return ast.select_statement.condition_specification
elif axis == "all": elif axis == "all":
......
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