Skip to content

Commit 1d9855e

Browse files
committed
✅ update example report files so test pass (reviewed changes are only style of .py files)
1 parent a9ace37 commit 1d9855e

File tree

10 files changed

+358
-74
lines changed

10 files changed

+358
-74
lines changed

src/vuegen/streamlit_reportview.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,10 +678,10 @@ def _generate_plot_content(self, plot) -> List[str]:
678678
textwrap.dedent(
679679
f"""
680680
st.markdown(("<p style='text-align: center; color: black;'> "
681-
f"<b>Number of nodes:</b> {num_nodes} </p>"),
681+
"<b>Number of nodes:</b> {num_nodes} </p>"),
682682
unsafe_allow_html=True)
683683
st.markdown(("<p style='text-align: center; color: black;'>"
684-
f" <b>Number of relationships:</b> {num_edges} </p>"),
684+
" <b>Number of relationships:</b> {num_edges} </p>"),
685685
unsafe_allow_html=True)
686686
"""
687687
)

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Dataframes/All_Formats.py

Lines changed: 98 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,38 @@
44
import streamlit as st
55
df_index = 1
66

7-
st.markdown('''<h3 style='text-align: center; color: #023558;'>All Formats</h3>''', unsafe_allow_html=True)
8-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Phyla Correlation Network Csv</h4>''', unsafe_allow_html=True)
7+
8+
st.markdown(
9+
(
10+
"<h3 style='text-align: center; "
11+
"color: #023558;'>All Formats</h3>"
12+
),
13+
unsafe_allow_html=True)
14+
15+
16+
st.markdown(
17+
(
18+
"<h4 style='text-align: center; "
19+
"color: #2b8cbe;'>Phyla Correlation Network Csv</h4>"
20+
),
21+
unsafe_allow_html=True)
22+
923
df = pd.read_csv('docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/1_phyla_correlation_network_csv.csv')
1024

1125

1226
# Displays a DataFrame using AgGrid with configurable options.
1327
grid_builder = GridOptionsBuilder.from_dataframe(df)
14-
grid_builder.configure_default_column(editable=True, groupable=True, filter=True)
15-
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
28+
grid_builder.configure_default_column(editable=True,
29+
groupable=True,
30+
filter=True,
31+
)
32+
grid_builder.configure_side_bar(filters_panel=True,
33+
columns_panel=True)
1634
grid_builder.configure_selection(selection_mode="multiple")
17-
grid_builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=20)
35+
grid_builder.configure_pagination(enabled=True,
36+
paginationAutoPageSize=False,
37+
paginationPageSize=20,
38+
)
1839
grid_options = grid_builder.build()
1940

2041
AgGrid(df, gridOptions=grid_options, enable_enterprise_modules=True)
@@ -28,7 +49,14 @@
2849
mime='text/csv',
2950
key=f"download_button_{df_index}")
3051
df_index += 1
31-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Abundance Table Example Xls</h4>''', unsafe_allow_html=True)
52+
53+
st.markdown(
54+
(
55+
"<h4 style='text-align: center; "
56+
"color: #2b8cbe;'>Abundance Table Example Xls</h4>"
57+
),
58+
unsafe_allow_html=True)
59+
3260
selected_sheet = 0
3361
sheet_names = table_utils.get_sheet_names("docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/2_abundance_table_example_xls.xls")
3462
selected_sheet = st.selectbox("Select a sheet to display", options=sheet_names)
@@ -38,10 +66,17 @@
3866

3967
# Displays a DataFrame using AgGrid with configurable options.
4068
grid_builder = GridOptionsBuilder.from_dataframe(df)
41-
grid_builder.configure_default_column(editable=True, groupable=True, filter=True)
42-
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
69+
grid_builder.configure_default_column(editable=True,
70+
groupable=True,
71+
filter=True,
72+
)
73+
grid_builder.configure_side_bar(filters_panel=True,
74+
columns_panel=True)
4375
grid_builder.configure_selection(selection_mode="multiple")
44-
grid_builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=20)
76+
grid_builder.configure_pagination(enabled=True,
77+
paginationAutoPageSize=False,
78+
paginationPageSize=20,
79+
)
4580
grid_options = grid_builder.build()
4681

4782
AgGrid(df, gridOptions=grid_options, enable_enterprise_modules=True)
@@ -55,16 +90,30 @@
5590
mime='text/csv',
5691
key=f"download_button_{df_index}")
5792
df_index += 1
58-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Sample Info Example Txt</h4>''', unsafe_allow_html=True)
93+
94+
st.markdown(
95+
(
96+
"<h4 style='text-align: center; "
97+
"color: #2b8cbe;'>Sample Info Example Txt</h4>"
98+
),
99+
unsafe_allow_html=True)
100+
59101
df = pd.read_table('docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/3_sample_info_example_txt.txt')
60102

61103

62104
# Displays a DataFrame using AgGrid with configurable options.
63105
grid_builder = GridOptionsBuilder.from_dataframe(df)
64-
grid_builder.configure_default_column(editable=True, groupable=True, filter=True)
65-
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
106+
grid_builder.configure_default_column(editable=True,
107+
groupable=True,
108+
filter=True,
109+
)
110+
grid_builder.configure_side_bar(filters_panel=True,
111+
columns_panel=True)
66112
grid_builder.configure_selection(selection_mode="multiple")
67-
grid_builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=20)
113+
grid_builder.configure_pagination(enabled=True,
114+
paginationAutoPageSize=False,
115+
paginationPageSize=20,
116+
)
68117
grid_options = grid_builder.build()
69118

70119
AgGrid(df, gridOptions=grid_options, enable_enterprise_modules=True)
@@ -78,16 +127,30 @@
78127
mime='text/csv',
79128
key=f"download_button_{df_index}")
80129
df_index += 1
81-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Sample Info Example Parquet</h4>''', unsafe_allow_html=True)
130+
131+
st.markdown(
132+
(
133+
"<h4 style='text-align: center; "
134+
"color: #2b8cbe;'>Sample Info Example Parquet</h4>"
135+
),
136+
unsafe_allow_html=True)
137+
82138
df = pd.read_parquet('docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/4_sample_info_example_parquet.parquet')
83139

84140

85141
# Displays a DataFrame using AgGrid with configurable options.
86142
grid_builder = GridOptionsBuilder.from_dataframe(df)
87-
grid_builder.configure_default_column(editable=True, groupable=True, filter=True)
88-
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
143+
grid_builder.configure_default_column(editable=True,
144+
groupable=True,
145+
filter=True,
146+
)
147+
grid_builder.configure_side_bar(filters_panel=True,
148+
columns_panel=True)
89149
grid_builder.configure_selection(selection_mode="multiple")
90-
grid_builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=20)
150+
grid_builder.configure_pagination(enabled=True,
151+
paginationAutoPageSize=False,
152+
paginationPageSize=20,
153+
)
91154
grid_options = grid_builder.build()
92155

93156
AgGrid(df, gridOptions=grid_options, enable_enterprise_modules=True)
@@ -101,17 +164,31 @@
101164
mime='text/csv',
102165
key=f"download_button_{df_index}")
103166
df_index += 1
104-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Example Xlsx</h4>''', unsafe_allow_html=True)
167+
168+
st.markdown(
169+
(
170+
"<h4 style='text-align: center; "
171+
"color: #2b8cbe;'>Example Xlsx</h4>"
172+
),
173+
unsafe_allow_html=True)
174+
105175
selected_sheet = 0
106176
df = pd.read_excel('docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/5_example_xlsx.xlsx', sheet_name=selected_sheet)
107177

108178

109179
# Displays a DataFrame using AgGrid with configurable options.
110180
grid_builder = GridOptionsBuilder.from_dataframe(df)
111-
grid_builder.configure_default_column(editable=True, groupable=True, filter=True)
112-
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
181+
grid_builder.configure_default_column(editable=True,
182+
groupable=True,
183+
filter=True,
184+
)
185+
grid_builder.configure_side_bar(filters_panel=True,
186+
columns_panel=True)
113187
grid_builder.configure_selection(selection_mode="multiple")
114-
grid_builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=20)
188+
grid_builder.configure_pagination(enabled=True,
189+
paginationAutoPageSize=False,
190+
paginationPageSize=20,
191+
)
115192
grid_options = grid_builder.build()
116193

117194
AgGrid(df, gridOptions=grid_options, enable_enterprise_modules=True)

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Home/Homepage.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import streamlit as st
2-
st.markdown('''<p style='text-align: center; color: #000000;'>A general description of the report.
3-
</p>''', unsafe_allow_html=True)
2+
3+
st.markdown(
4+
(
5+
"<p style='text-align: center; "
6+
"color: #000000;'>A general description of the report.</p>"
7+
),
8+
unsafe_allow_html=True)
9+
410
footer = '''<style type="text/css">
511
.footer {
612
position: relative;

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Html/All_Html.py

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,62 @@
11
import requests
22
import streamlit as st
33

4-
st.markdown('''<h3 style='text-align: center; color: #023558;'>All Html</h3>''', unsafe_allow_html=True)
5-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Plot</h4>''', unsafe_allow_html=True)
4+
5+
st.markdown(
6+
(
7+
"<h3 style='text-align: center; "
8+
"color: #023558;'>All Html</h3>"
9+
),
10+
unsafe_allow_html=True)
11+
12+
13+
st.markdown(
14+
(
15+
"<h4 style='text-align: center; "
16+
"color: #2b8cbe;'>Plot</h4>"
17+
),
18+
unsafe_allow_html=True)
19+
620

721
with open('docs/example_data/Basic_example_vuegen_demo_notebook/4_Html/1_All_html/1_plot.html', 'r', encoding='utf-8') as html_file:
822
html_content = html_file.read()
923

1024
st.components.v1.html(html_content, height=600, scrolling=True)
1125

12-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Ckg Network</h4>''', unsafe_allow_html=True)
26+
27+
st.markdown(
28+
(
29+
"<h4 style='text-align: center; "
30+
"color: #2b8cbe;'>Ckg Network</h4>"
31+
),
32+
unsafe_allow_html=True)
33+
1334

1435
with open('docs/example_data/Basic_example_vuegen_demo_notebook/4_Html/1_All_html/2_ckg_network.html', 'r') as html_file:
1536
html_content = html_file.read()
1637

1738

18-
st.markdown(f"<p style='text-align: center; color: black;'> <b>Number of nodes:</b> 33 </p>", unsafe_allow_html=True)
19-
st.markdown(f"<p style='text-align: center; color: black;'> <b>Number of relationships:</b> 35 </p>", unsafe_allow_html=True)
39+
st.markdown(("<p style='text-align: center; color: black;'> "
40+
"<b>Number of nodes:</b> 33 </p>"),
41+
unsafe_allow_html=True)
42+
st.markdown(("<p style='text-align: center; color: black;'>"
43+
" <b>Number of relationships:</b> 35 </p>"),
44+
unsafe_allow_html=True)
2045

2146
# Streamlit checkbox for controlling the layout
2247
control_layout = st.checkbox('Add panel to control layout', value=True)
2348
net_html_height = 1200 if control_layout else 630
2449
# Load HTML into HTML component for display on Streamlit
2550
st.components.v1.html(html_content, height=net_html_height)
2651

27-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Multiqc Report</h4>''', unsafe_allow_html=True)
52+
53+
st.markdown(
54+
(
55+
"<h4 style='text-align: center; "
56+
"color: #2b8cbe;'>Multiqc Report</h4>"
57+
),
58+
unsafe_allow_html=True)
59+
2860

2961
with open('docs/example_data/Basic_example_vuegen_demo_notebook/4_Html/1_All_html/3_multiqc_report.html', 'r', encoding='utf-8') as html_file:
3062
html_content = html_file.read()

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Markdown/All_Markdown.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
import requests
22
import streamlit as st
33

4-
st.markdown('''<h3 style='text-align: center; color: #023558;'>All Markdown</h3>''', unsafe_allow_html=True)
5-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Readme</h4>''', unsafe_allow_html=True)
4+
5+
st.markdown(
6+
(
7+
"<h3 style='text-align: center; "
8+
"color: #023558;'>All Markdown</h3>"
9+
),
10+
unsafe_allow_html=True)
11+
12+
13+
st.markdown(
14+
(
15+
"<h4 style='text-align: center; "
16+
"color: #2b8cbe;'>Readme</h4>"
17+
),
18+
unsafe_allow_html=True)
19+
620

721
with open('docs/example_data/Basic_example_vuegen_demo_notebook/5_Markdown/1_All_markdown/README.md', 'r') as markdown_file:
822
markdown_content = markdown_file.read()

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Networks/Interactive_Networks.py

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,56 @@
11
import requests
22
import streamlit as st
33

4-
st.markdown('''<h3 style='text-align: center; color: #023558;'>Interactive Networks</h3>''', unsafe_allow_html=True)
5-
st.markdown('''<p style='text-align: center; color: #000000;'>Optional description for subsection.
6-
</p>''', unsafe_allow_html=True)
7-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Man Example</h4>''', unsafe_allow_html=True)
4+
5+
st.markdown(
6+
(
7+
"<h3 style='text-align: center; "
8+
"color: #023558;'>Interactive Networks</h3>"
9+
),
10+
unsafe_allow_html=True)
11+
12+
13+
st.markdown(
14+
(
15+
"<p style='text-align: center; "
16+
"color: #000000;'>Optional description for subsection.</p>"
17+
),
18+
unsafe_allow_html=True)
19+
20+
21+
st.markdown(
22+
(
23+
"<h4 style='text-align: center; "
24+
"color: #2b8cbe;'>Man Example</h4>"
25+
),
26+
unsafe_allow_html=True)
27+
828

929
with open('tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/static/Man_Example.html', 'r') as html_file:
1030
html_content = html_file.read()
1131

1232

13-
st.markdown(f"<p style='text-align: center; color: black;'> <b>Number of nodes:</b> 9 </p>", unsafe_allow_html=True)
14-
st.markdown(f"<p style='text-align: center; color: black;'> <b>Number of relationships:</b> 14 </p>", unsafe_allow_html=True)
33+
st.markdown(("<p style='text-align: center; color: black;'> "
34+
"<b>Number of nodes:</b> 9 </p>"),
35+
unsafe_allow_html=True)
36+
st.markdown(("<p style='text-align: center; color: black;'>"
37+
" <b>Number of relationships:</b> 14 </p>"),
38+
unsafe_allow_html=True)
1539

1640
# Streamlit checkbox for controlling the layout
1741
control_layout = st.checkbox('Add panel to control layout', value=True)
1842
net_html_height = 1200 if control_layout else 630
1943
# Load HTML into HTML component for display on Streamlit
2044
st.components.v1.html(html_content, height=net_html_height)
2145

22-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Description</h4>''', unsafe_allow_html=True)
46+
47+
st.markdown(
48+
(
49+
"<h4 style='text-align: center; "
50+
"color: #2b8cbe;'>Description</h4>"
51+
),
52+
unsafe_allow_html=True)
53+
2354

2455
with open('docs/example_data/Basic_example_vuegen_demo_notebook/3_Networks/1_Interactive_networks/description.md', 'r') as markdown_file:
2556
markdown_content = markdown_file.read()

tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/sections/Networks/Static_Networks.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
import streamlit as st
22

3-
st.markdown('''<h3 style='text-align: center; color: #023558;'>Static Networks</h3>''', unsafe_allow_html=True)
4-
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Phyla Correlation Network</h4>''', unsafe_allow_html=True)
53

6-
st.image('docs/example_data/Basic_example_vuegen_demo_notebook/3_Networks/2_Static_networks/1_phyla_correlation_network.png', caption='', use_column_width=True)
4+
st.markdown(
5+
(
6+
"<h3 style='text-align: center; "
7+
"color: #023558;'>Static Networks</h3>"
8+
),
9+
unsafe_allow_html=True)
10+
11+
12+
st.markdown(
13+
(
14+
"<h4 style='text-align: center; "
15+
"color: #2b8cbe;'>Phyla Correlation Network</h4>"
16+
),
17+
unsafe_allow_html=True)
18+
19+
20+
st.image('docs/example_data/Basic_example_vuegen_demo_notebook/3_Networks/2_Static_networks/1_phyla_correlation_network.png', caption='', use_column_width=True)
721

822
footer = '''<style type="text/css">
923
.footer {

0 commit comments

Comments
 (0)