Skip to content

Commit

Permalink
Merge pull request chekoduadarsh#102 from chekoduadarsh/dev
Browse files Browse the repository at this point in the history
πŸ—‘ Formatting and Cleaning Code πŸ—‘
  • Loading branch information
chekoduadarsh authored May 20, 2022
2 parents 24c47a9 + b015882 commit 1867465
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 131 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
#https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems
.iws
workspace.xml
tasks.xml
tasks.xml
.idea
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/BlocklyML.iml

This file was deleted.

37 changes: 0 additions & 37 deletions .idea/csv-plugin.xml

This file was deleted.

15 changes: 0 additions & 15 deletions .idea/git_toolbox_prj.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@

DASH_APP.layout = html.Div()


@app.route('/DataVisualizer', methods=['POST', 'GET'])
def dataframe_return():
"""returns list of Dataframes from dataframe_visualizer
Returns:
string: list of datafrmaes
"""
# pylint: disable=W0603
global DASH_APP
list_dataframe, DASH_APP = dataframe_visualizer(request.form, DASH_APP)
return str(list_dataframe)
Expand Down
30 changes: 5 additions & 25 deletions libs/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
"""Instantiate a Dash app."""
import numpy as np
import pandas as pd
import dash
from dash import dash_table
from dash import dcc
import plotly.express as px
import json
from dash import html
import dash_daq as daq
from dash.dependencies import Input, Output, State
import string
import random
import urllib.parse


import plotly.graph_objects as go
import dash_bootstrap_components as dbc
from .util import floatNoneConvert, strNoneConvert, otherinputtodict
Expand All @@ -35,30 +29,16 @@ def dashboard_app(df, dash_app, plotly_config):
"backgroundColor": "black",
"color": "white",
}

dropdown_style = {
"fontWeight": "bold",
"backgroundColor": "black",
"color": "white",
}

tab_selected_style = {
"borderTop": "1px solid #d6d6d6",
"borderBottom": "1px solid #d6d6d6",
"backgroundColor": "#119DFF",
"color": "white",
"padding": "6px",
}

not_mandatory_font_style = {"color": "blue"}
mandatory_font_style = {"color": "red"}
mandatory_div_style = {" marginLeft": "1%", "width": "48%", "display": "inline-grid"}
only_mandatory_div_style = {
" marginLeft": "1%",
"width": "98%",
" marginRight": "1%",
"display": "inline-grid",
}
not_mandatory_div_style = {
" marginLeft": "2%",
"border-spacing": "2px",
Expand Down Expand Up @@ -1829,7 +1809,7 @@ def update_areaplot(n_clicks, input1, input2, input3, input4, input5):
State("input-other-heat", "value"),
)
def update_heatplot(n_clicks, input1, input2, input3, input4):
if not (input1 is None) and not (input2 is None):
if not input1 is None and not input2 is None:
if strNoneConvert(input1) in df.columns and strNoneConvert(input2) in df.columns:

input_parametes = {
Expand All @@ -1855,7 +1835,7 @@ def update_heatplot(n_clicks, input1, input2, input3, input4):
State("input-other-violin", "value"),
)
def update_violinplot(n_clicks, input1, input2, input3, input4):
if not (input1 is None):
if not input1 is None:
if strNoneConvert(input1) in df.columns:

input_parametes = {
Expand Down Expand Up @@ -2130,7 +2110,7 @@ def update_streamtubeplot(n_clicks, input1, input2, input3, input4, input5, inpu
State("input-custom-code", "value"),
)
def update_customplot(n_clicks, input1):
if not (input1 is None):
if not input1 is None:
df
_locals = locals()
exec(input1, globals(), _locals)
Expand Down
26 changes: 12 additions & 14 deletions libs/util.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
""" Python script with utility functions """
def strNoneConvert(input):
def strNoneConvert(input_data):
""" Converting input to string if it is not a list or none """
if input is None:
if input_data is None:
return None
if input is list:
if input_data is list:
return list
else:
return str(input)
return str(input_data)


def floatNoneConvert(input):
def floatNoneConvert(input_data):
""" Converting input to float if it is not a list or none """
if input is None or input == '':
if input_data is None or input_data == '':
return None
if input is list:
if input_data is list:
return list
else:
return float(input)
return float(input_data)


def otherinputtodict(input):
def otherinputtodict(input_data):

""" Dict [parser funtion for other inputs """
input_parameter_dict = {}
if not(input is None):
if "=" in input:
input_parameter_list = input.split(",")
if not input_data is None:
if "=" in input_data:
input_parameter_list = input_data.split(",")
for parameter in input_parameter_list:
input_parameter_dict[parameter.split(
"=")[0]] = parameter.split("=")[1]
Expand Down

0 comments on commit 1867465

Please sign in to comment.