From 9b5631e68989d24a6ce8f42775fd58d8fa22b2b7 Mon Sep 17 00:00:00 2001 From: Han Pham <36429830+hanpham32@users.noreply.github.com> Date: Tue, 12 Nov 2024 23:35:11 -0800 Subject: [PATCH 1/4] Create dependency-review.yml --- .github/workflows/dependency-review.yml | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/dependency-review.yml diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..d19e21b --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,39 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, +# surfacing known-vulnerable versions of the packages declared or updated in the PR. +# Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable +# packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement +name: 'Dependency review' +on: + pull_request: + branches: [ "main" ] + +# If using a dependency submission action in this workflow this permission will need to be set to: +# +# permissions: +# contents: write +# +# https://docs.github.com/en/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api +permissions: + contents: read + # Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option + pull-requests: write + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout repository' + uses: actions/checkout@v4 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v4 + # Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options. + with: + comment-summary-in-pr: always + # fail-on-severity: moderate + # deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later + # retry-on-snapshot-warnings: true From 5851e23ccfda9b145ec68d396966c4fd794ab974 Mon Sep 17 00:00:00 2001 From: Han Date: Tue, 12 Nov 2024 23:46:12 -0800 Subject: [PATCH 2/4] Remove .null-ls_250880_app.py from tracking --- .null-ls_250880_app.py | 105 ----------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 .null-ls_250880_app.py diff --git a/.null-ls_250880_app.py b/.null-ls_250880_app.py deleted file mode 100644 index e06bfbb..0000000 --- a/.null-ls_250880_app.py +++ /dev/null @@ -1,105 +0,0 @@ -import streamlit as st -from src.graph_utils import Graph -import src.esu as esu - - -def form_callback(): - """ - Handle form validation logic - """ - - if st.session_state['uploaded_file'] is None: - st.warning("Please upload a file.") - return - - if st.session_state['graph_type'] is None: - st.warning("Please select a graph type.") - return - - # create graph from file - G = Graph() - G.generate_graph(file=st.session_state['uploaded_file'], graph_type=st.session_state['graph_type']) - - # display graph properties - graph_properties = G.graph_properties() - st.write(f"Number of nodes: {graph_properties['Number of nodes']}") - # st.write(f"Edges: {graph_properties['Edges']}") - st.write(f"Number of edges: {graph_properties['Number of edges']}") - st.write(f"Weight: {graph_properties['Weight']}") - - # visualize the full graph if selected - if st.session_state['is_visualize_graph']: - st.markdown("### Full Graph Visualization") - G.draw_graph(st.session_state["graph_type"]) - - # Visualize subgraphs if selected - if st.session_state['is_visualize_subgraph']: - st.markdown("### Subgraph Visualization") - G.draw_subgraph(st.session_state["graph_type"], st.session_state["motif_size"]) - - -def main(): - # Initialize global session state for user form submission - if 'graph_type' not in st.session_state: - st.session_state['graph_type'] = None - if 'uploaded_file' not in st.session_state: - st.session_state['uploaded_file'] = None - if 'prev_uploaded_file' not in st.session_state: - st.session_state['prev_uploaded_file'] = None - - uploaded_file = st.file_uploader("Upload a file") - if uploaded_file: - if uploaded_file != st.session_state['prev_uploaded_file']: - st.session_state['uploaded_file'] = uploaded_file - st.session_state['prev_uploaded_file'] = uploaded_file - st.toast("Succesfully uploaded file", icon="✅") - - with st.form(key="form"): - col1, col2 = st.columns([1, 3]) - with col1: - graph_type = st.radio( - "Set Graph type:", - key="graph", - index=None, - options=["Directed", "Undirected"], - ) - - motif_size = st.number_input("Size of motif", value=3, placeholder="Input motif size...", min_value=1, max_value=5) - - nemo_count_type = st.radio( - "Nemo Data Options", - key="nemo_option", - index=None, - options=["NemoCount", "NemoProfile", "NemoCollect"], - ) - - with col2: - st.write("NOTE: Uploading more than 1000 nodes might consume more processing time.") - st.write("Visualize Options:") - is_visualize_graph = st.checkbox("Visualize graph") - is_visualize_subgraph = st.checkbox("Visualize subgraph") - - submitted = st.form_submit_button(label="Submit") - - if submitted: - st.session_state['is_visualize_graph'] = False - st.session_state['is_visualize_subgraph'] = False - - if is_visualize_graph: - st.session_state['is_visualize_graph'] = True - if is_visualize_subgraph: - st.session_state['is_visualize_subgraph'] = True - - st.session_state['graph_type'] = graph_type - st.session_state['uploaded_file'] = uploaded_file - st.session_state['motif_size'] = motif_size - form_callback() - ''' - [![Repo](https://badgen.net/badge/icon/GitHub?icon=github&label)](https://github.com/hanpham32/NetMotif) - - ''' - st.markdown("
", unsafe_allow_html=True) - - -if __name__ == "__main__": - main() From c1cf9bad1e71d7e82021d0e1ca78444f923009bc Mon Sep 17 00:00:00 2001 From: Han Date: Tue, 12 Nov 2024 23:57:35 -0800 Subject: [PATCH 3/4] add desktop.init --- .gitignore | 1 + desktop.ini | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 desktop.ini diff --git a/.gitignore b/.gitignore index fc38bca..063bb20 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ __pycache__/ drawings/ nx.html .null-ls_*.py +desktop.ini diff --git a/desktop.ini b/desktop.ini deleted file mode 100644 index 2273f3f..0000000 --- a/desktop.ini +++ /dev/null @@ -1,2 +0,0 @@ -[LocalizedFileNames] -labelg=@labelg,0 From 92b6ca32802c5331f9cd61cc57ede3f2970a6917 Mon Sep 17 00:00:00 2001 From: Han Date: Wed, 13 Nov 2024 15:10:03 -0800 Subject: [PATCH 4/4] chore: add nemo_type to session_state --- app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app.py b/app.py index de931e7..00bd146 100644 --- a/app.py +++ b/app.py @@ -54,6 +54,8 @@ def main(): st.session_state["uploaded_file"] = None if "prev_uploaded_file" not in st.session_state: st.session_state["prev_uploaded_file"] = None + if "nemo_option" not in st.session_state: + st.session_state["nemo_option"] = None uploaded_file = st.file_uploader("Upload a file") if uploaded_file: @@ -110,6 +112,7 @@ def main(): st.session_state["graph_type"] = graph_type st.session_state["uploaded_file"] = uploaded_file st.session_state["motif_size"] = motif_size + st.session_state["nemo_option"] = nemo_count_type form_callback() """ [![Repo](https://badgen.net/badge/icon/GitHub?icon=github&label)](https://github.com/hanpham32/NetMotif)