Skip to content

Commit 7623532

Browse files
authored
updated dir (#166)
* updated dir * added init * test fix * Testing
1 parent d17b167 commit 7623532

File tree

5 files changed

+283
-159
lines changed

5 files changed

+283
-159
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@master
9-
# - name: GitHub Action for pylint
10-
# uses: zerodaysec/github-action-for-python@main
11-
# with:
12-
# args: pylint **/*.py
9+
# - name: GitHub Action for pylint
10+
# uses: zerodaysec/github-action-for-python@main
11+
# with:
12+
# args: pylint **/*.py
1313
- name: Lint with pylint
1414
run: |
15-
pip install pylint
16-
OUTPUT=$(pylint ./src --exit-zero)
17-
#OUTPUT=$(shell command or script to extract the part your want)
18-
echo "MESSAGE=$OUTPUT" >> $GITHUB_ENV
15+
pip install pylint
16+
OUTPUT=$(pylint ./app --exit-zero)
17+
echo "MESSAGE=${OUTPUT}" >> $GITHUB_ENV
1918
- name: Post result to PR
2019
uses: mshick/add-pr-comment@v2
2120
with:
22-
message: ${{ env.MESSAGE }}
23-
repo-token: ${{ secrets.GITHUB_TOKEN }}
24-
repo-token-user-login: 'github-actions[bot]' # The user.login for temporary GitHub tokens
25-
allow-repeats: false # This is the default
21+
message: ${{ env.MESSAGE }}
22+
repo-token: ${{ secrets.GITHUB_TOKEN }}
23+
repo-token-user-login: "github-actions[bot]" # The user.login for temporary GitHub tokens
24+
allow-repeats: false # This is the default
File renamed without changes.

app/app.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
import json
33
import pandas as pd
44

5+
56
# Function to load notes from JSON file
67
def load_notes():
7-
with open('/notes.json', 'r') as f:
8+
with open("/notes.json", "r") as f:
89
return json.load(f)
910

11+
1012
# Function to save notes to JSON file
1113
def save_notes(notes):
12-
with open('/notes.json', 'w') as f:
14+
with open("/notes.json", "w") as f:
1315
json.dump(notes, f, indent=4)
1416

17+
1518
# Load notes
1619
notes = load_notes()
1720

@@ -32,9 +35,14 @@ def save_notes(notes):
3235
"community": ":people_holding_hands:",
3336
# "code": ":code:",
3437
"TEST": ":science:",
35-
"architecture": ":building_construction:"
38+
"architecture": ":building_construction:",
3639
}
3740

41+
for note in notes:
42+
for cat in note["categories"]:
43+
if cat.lower() not in category_icon_map:
44+
category_icon_map[cat.lower()] = ":question:"
45+
3846
# Page selection
3947
page = st.sidebar.selectbox("Choose a page", ["Home", "Add Entry"])
4048

@@ -45,16 +53,20 @@ def save_notes(notes):
4553
selected_categories = st.sidebar.multiselect(
4654
"Select categories",
4755
options=list(category_icon_map.keys()),
48-
default=list(category_icon_map.keys())
56+
default=list(category_icon_map.keys()),
4957
)
5058

5159
# Filter notes based on selected categories
52-
filtered_notes = [note for note in notes if any(cat in note['categories'] for cat in selected_categories)]
60+
filtered_notes = [
61+
note
62+
for note in notes
63+
if any(cat in note["categories"] for cat in selected_categories)
64+
]
5365

5466
# Display filtered notes as tiles (3x wide)
5567
tiles = []
5668
for note in filtered_notes:
57-
icons = " ".join([category_icon_map.get(cat, "") for cat in note['categories']])
69+
icons = " ".join([category_icon_map.get(cat, "") for cat in note["categories"]])
5870
tile_content = f"### {icons} {note['title']}\n"
5971
tile_content += f"[{note['link']}]({note['link']})\n"
6072
tile_content += f"{note['description']}\n"
@@ -73,7 +85,7 @@ def save_notes(notes):
7385
# Display filtered notes as a table, each category on its own row
7486
st.write("### Filtered Notes Table")
7587
for index, row in df.iterrows():
76-
if any(cat in row['categories'] for cat in selected_categories):
88+
if any(cat in row["categories"] for cat in selected_categories):
7789
st.write(f"## {row['title']}")
7890
st.markdown(f" - {row['link']}")
7991
st.markdown(f" - {row['description']}")
@@ -103,7 +115,7 @@ def save_notes(notes):
103115
"title": new_title,
104116
"link": new_link,
105117
"description": new_description,
106-
"categories": selected_categories
118+
"categories": selected_categories,
107119
}
108120
notes.append(new_entry)
109121
save_notes(notes)

0 commit comments

Comments
 (0)