Passed
Push — master ( 7596de...7d2c3d )
by Simon
04:29
created

hyperactive.dashboards.progress_board.run_streamlit   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 30
dl 0
loc 47
rs 10
c 0
b 0
f 0
wmc 6

1 Function

Rating   Name   Duplication   Size   Complexity  
B main() 0 30 6
1
# Author: Simon Blanke
2
# Email: [email protected]
3
# License: MIT License
4
5
import sys
6
import time
7
import streamlit as st
8
9
10
from streamlit_backend import StreamlitBackend
11
12
13
def main():
14
    try:
15
        st.set_page_config(page_title="Hyperactive Progress Board", layout="wide")
16
    except:
17
        pass
18
19
    search_ids = sys.argv[1:]
20
    backend = StreamlitBackend(search_ids)
21
22
    for search_id in search_ids:
23
        st.title(search_id)
24
        st.components.v1.html(
25
            """<hr style="height:1px;border:none;color:#333;background-color:#333;" /> """,
26
            height=10,
27
        )
28
        col1, col2 = st.beta_columns([1, 2])
29
30
        pyplot_fig, plotly_fig = backend.create_plots(search_id)
31
32
        if pyplot_fig is not None:
33
            col1.pyplot(pyplot_fig)
34
        if plotly_fig is not None:
35
            col2.plotly_chart(plotly_fig)
36
37
        for _ in range(3):
38
            st.write(" ")
39
40
    time.sleep(1)
41
    print("\nStart next run:")
42
    st.experimental_rerun()
43
44
45
if __name__ == "__main__":
46
    main()
47