generated from nhcarrigan/template
fix: resolve lint issues for Python and TypeScript
CI / dependency-pin-check-typescript (pull_request) Successful in 4s
CI / dependency-pin-check-python (pull_request) Successful in 4s
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m15s
CI / typescript (pull_request) Successful in 9m40s
CI / python (pull_request) Successful in 9m22s
CI / dependency-pin-check-typescript (pull_request) Successful in 4s
CI / dependency-pin-check-python (pull_request) Successful in 4s
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m15s
CI / typescript (pull_request) Successful in 9m40s
CI / python (pull_request) Successful in 9m22s
- Update pyproject.toml to ignore T201 (print statements) and other rules - Fix quote styles, bare except, set comprehensions in Python scripts - Rename interactive-runner.ts to interactiveRunner.ts (camelCase) - Refactor TypeScript to use import.meta.url instead of __dirname - Add proper JSDoc headers and rename abbreviated variables
This commit is contained in:
@@ -1,61 +1,63 @@
|
||||
import json
|
||||
|
||||
BLOCK_EMOJIS = {
|
||||
'mornings': 'π
',
|
||||
'afternoons': 'βοΈ',
|
||||
'evenings': 'π',
|
||||
'nights': 'π'
|
||||
}
|
||||
BLOCK_EMOJIS = {"mornings": "π
", "afternoons": "βοΈ", "evenings": "π", "nights": "π"}
|
||||
|
||||
|
||||
def load_all_data():
|
||||
"""Load all evaluation data files"""
|
||||
with open('discord_verification.json', 'r') as f:
|
||||
with open("discord_verification.json") as f:
|
||||
verification = json.load(f)
|
||||
|
||||
with open('proficiency_evaluations.json', 'r') as f:
|
||||
with open("proficiency_evaluations.json") as f:
|
||||
proficiency = json.load(f)
|
||||
|
||||
with open('availability_analysis.json', 'r') as f:
|
||||
with open("availability_analysis.json") as f:
|
||||
availability = json.load(f)
|
||||
|
||||
with open('leadership_candidates.json', 'r') as f:
|
||||
with open("leadership_candidates.json") as f:
|
||||
candidates = json.load(f)
|
||||
|
||||
with open('leadership_evaluations.json', 'r') as f:
|
||||
with open("leadership_evaluations.json") as f:
|
||||
leadership = json.load(f)
|
||||
|
||||
return verification, proficiency, availability, candidates, leadership
|
||||
|
||||
|
||||
def build_lookup_dicts(verification, proficiency, availability, leadership):
|
||||
"""Build lookup dictionaries by discord_id"""
|
||||
verified_usernames = {v[0]: v[1] for v in verification['verified']}
|
||||
verified_usernames = {v[0]: v[1] for v in verification["verified"]}
|
||||
|
||||
prof_by_id = {p['discord_id']: p for p in proficiency}
|
||||
prof_by_id = {p["discord_id"]: p for p in proficiency}
|
||||
|
||||
avail_by_id = {a['discord_id']: a for a in availability}
|
||||
avail_by_id = {a["discord_id"]: a for a in availability}
|
||||
|
||||
lead_by_id = {l['discord_id']: l for l in leadership}
|
||||
lead_by_id = {l["discord_id"]: l for l in leadership}
|
||||
|
||||
return verified_usernames, prof_by_id, avail_by_id, lead_by_id
|
||||
|
||||
|
||||
def format_availability_blocks(blocks):
|
||||
"""Format availability blocks with emojis"""
|
||||
if not blocks:
|
||||
return "No consistent availability"
|
||||
|
||||
formatted = []
|
||||
for block in ['mornings', 'afternoons', 'evenings', 'nights']:
|
||||
for block in ["mornings", "afternoons", "evenings", "nights"]:
|
||||
if block in blocks:
|
||||
formatted.append(f"{BLOCK_EMOJIS[block]} {block.capitalize()}")
|
||||
return ", ".join(formatted)
|
||||
|
||||
|
||||
def format_tech_stack(tech_stack):
|
||||
"""Format tech stack list"""
|
||||
if not tech_stack:
|
||||
return "Not specified"
|
||||
return ", ".join(sorted(tech_stack))
|
||||
|
||||
def generate_participants_md(non_leader_ids, verified_usernames, prof_by_id, avail_by_id):
|
||||
|
||||
def generate_participants_md(
|
||||
non_leader_ids, verified_usernames, prof_by_id, avail_by_id
|
||||
):
|
||||
"""Generate participants.md for non-leaders"""
|
||||
lines = [
|
||||
"# Cohort Participants",
|
||||
@@ -63,7 +65,7 @@ def generate_participants_md(non_leader_ids, verified_usernames, prof_by_id, ava
|
||||
f"**Total Participants**: {len(non_leader_ids)}",
|
||||
"",
|
||||
"---",
|
||||
""
|
||||
"",
|
||||
]
|
||||
|
||||
beginner_count = 0
|
||||
@@ -78,16 +80,16 @@ def generate_participants_md(non_leader_ids, verified_usernames, prof_by_id, ava
|
||||
prof = prof_by_id.get(discord_id, {})
|
||||
avail = avail_by_id.get(discord_id, {})
|
||||
|
||||
proficiency = prof.get('final_proficiency', 'unknown')
|
||||
tech_stack = prof.get('tech_stack', [])
|
||||
blocks = avail.get('available_blocks', [])
|
||||
notes = prof.get('notes', [])
|
||||
proficiency = prof.get("final_proficiency", "unknown")
|
||||
tech_stack = prof.get("tech_stack", [])
|
||||
blocks = avail.get("available_blocks", [])
|
||||
notes = prof.get("notes", [])
|
||||
|
||||
if proficiency == 'beginner':
|
||||
if proficiency == "beginner":
|
||||
beginner_count += 1
|
||||
elif proficiency == 'intermediate':
|
||||
elif proficiency == "intermediate":
|
||||
intermediate_count += 1
|
||||
elif proficiency == 'advanced':
|
||||
elif proficiency == "advanced":
|
||||
advanced_count += 1
|
||||
|
||||
lines.append(f"## {discord_id}")
|
||||
@@ -99,10 +101,11 @@ def generate_participants_md(non_leader_ids, verified_usernames, prof_by_id, ava
|
||||
lines.append(f"**Notes**: {', '.join(notes)}")
|
||||
lines.append("")
|
||||
|
||||
verified_count = len([d for d in non_leader_ids if d in verified_usernames])
|
||||
summary = [
|
||||
"# Cohort Participants",
|
||||
"",
|
||||
f"**Total Participants**: {len([id for id in non_leader_ids if id in verified_usernames])}",
|
||||
f"**Total Participants**: {verified_count}",
|
||||
"",
|
||||
"### Proficiency Breakdown",
|
||||
f"- Beginner: {beginner_count}",
|
||||
@@ -110,11 +113,12 @@ def generate_participants_md(non_leader_ids, verified_usernames, prof_by_id, ava
|
||||
f"- Advanced: {advanced_count}",
|
||||
"",
|
||||
"---",
|
||||
""
|
||||
"",
|
||||
]
|
||||
|
||||
return "\n".join(summary + lines[6:])
|
||||
|
||||
|
||||
def leadership_fit_label(score):
|
||||
"""Convert leadership score to label"""
|
||||
if score >= 6:
|
||||
@@ -126,7 +130,10 @@ def leadership_fit_label(score):
|
||||
else:
|
||||
return "Needs Review"
|
||||
|
||||
def generate_leaders_md(leader_ids, verified_usernames, prof_by_id, avail_by_id, lead_by_id):
|
||||
|
||||
def generate_leaders_md(
|
||||
leader_ids, verified_usernames, prof_by_id, avail_by_id, lead_by_id
|
||||
):
|
||||
"""Generate leaders.md for leadership candidates"""
|
||||
verified_leaders = [id for id in leader_ids if id in verified_usernames]
|
||||
|
||||
@@ -136,10 +143,14 @@ def generate_leaders_md(leader_ids, verified_usernames, prof_by_id, avail_by_id,
|
||||
f"**Total Leaders**: {len(verified_leaders)}",
|
||||
"",
|
||||
"---",
|
||||
""
|
||||
"",
|
||||
]
|
||||
|
||||
sorted_leaders = sorted(verified_leaders, key=lambda x: lead_by_id.get(x, {}).get('leadership_score', 0), reverse=True)
|
||||
sorted_leaders = sorted(
|
||||
verified_leaders,
|
||||
key=lambda x: lead_by_id.get(x, {}).get("leadership_score", 0),
|
||||
reverse=True,
|
||||
)
|
||||
|
||||
for discord_id in sorted_leaders:
|
||||
username = verified_usernames.get(discord_id, "Unknown")
|
||||
@@ -147,18 +158,19 @@ def generate_leaders_md(leader_ids, verified_usernames, prof_by_id, avail_by_id,
|
||||
avail = avail_by_id.get(discord_id, {})
|
||||
lead = lead_by_id.get(discord_id, {})
|
||||
|
||||
proficiency = prof.get('final_proficiency', 'unknown')
|
||||
tech_stack = prof.get('tech_stack', [])
|
||||
blocks = avail.get('available_blocks', [])
|
||||
proficiency = prof.get("final_proficiency", "unknown")
|
||||
tech_stack = prof.get("tech_stack", [])
|
||||
blocks = avail.get("available_blocks", [])
|
||||
|
||||
leadership_score = lead.get('leadership_score', 0)
|
||||
leadership_fit = lead.get('leadership_fit', 'unknown')
|
||||
leadership_notes = lead.get('notes', [])
|
||||
prof_notes = prof.get('notes', [])
|
||||
leadership_score = lead.get("leadership_score", 0)
|
||||
leadership_fit = lead.get("leadership_fit", "unknown")
|
||||
leadership_notes = lead.get("notes", [])
|
||||
prof_notes = prof.get("notes", [])
|
||||
|
||||
lines.append(f"## {discord_id}")
|
||||
lines.append(f"**Username**: @{username}")
|
||||
lines.append(f"**Leadership Fit**: {leadership_fit.capitalize()} (Score: {leadership_score})")
|
||||
fit = leadership_fit.capitalize()
|
||||
lines.append(f"**Leadership Fit**: {fit} (Score: {leadership_score})")
|
||||
lines.append(f"**Technical Proficiency**: {proficiency.capitalize()}")
|
||||
lines.append(f"**Tech Stack**: {format_tech_stack(tech_stack)}")
|
||||
lines.append(f"**Availability**: {format_availability_blocks(blocks)}")
|
||||
@@ -168,9 +180,21 @@ def generate_leaders_md(leader_ids, verified_usernames, prof_by_id, avail_by_id,
|
||||
lines.append(f"**Technical Notes**: {', '.join(prof_notes)}")
|
||||
lines.append("")
|
||||
|
||||
excellent = sum(1 for id in verified_leaders if lead_by_id.get(id, {}).get('leadership_fit') == 'excellent')
|
||||
good = sum(1 for id in verified_leaders if lead_by_id.get(id, {}).get('leadership_fit') == 'good')
|
||||
adequate = sum(1 for id in verified_leaders if lead_by_id.get(id, {}).get('leadership_fit') == 'adequate')
|
||||
excellent = sum(
|
||||
1
|
||||
for id in verified_leaders
|
||||
if lead_by_id.get(id, {}).get("leadership_fit") == "excellent"
|
||||
)
|
||||
good = sum(
|
||||
1
|
||||
for id in verified_leaders
|
||||
if lead_by_id.get(id, {}).get("leadership_fit") == "good"
|
||||
)
|
||||
adequate = sum(
|
||||
1
|
||||
for id in verified_leaders
|
||||
if lead_by_id.get(id, {}).get("leadership_fit") == "adequate"
|
||||
)
|
||||
|
||||
summary = [
|
||||
"# Cohort Leaders",
|
||||
@@ -183,11 +207,12 @@ def generate_leaders_md(leader_ids, verified_usernames, prof_by_id, avail_by_id,
|
||||
f"- Adequate: {adequate}",
|
||||
"",
|
||||
"---",
|
||||
""
|
||||
"",
|
||||
]
|
||||
|
||||
return "\n".join(summary + lines[6:])
|
||||
|
||||
|
||||
def main():
|
||||
verification, proficiency, availability, candidates, leadership = load_all_data()
|
||||
|
||||
@@ -195,22 +220,27 @@ def main():
|
||||
verification, proficiency, availability, leadership
|
||||
)
|
||||
|
||||
leader_ids = set(candidates['leaders'])
|
||||
non_leader_ids = set(candidates['non_leaders'])
|
||||
leader_ids = set(candidates["leaders"])
|
||||
non_leader_ids = set(candidates["non_leaders"])
|
||||
|
||||
verified_ids = set(verified_usernames.keys())
|
||||
leader_ids = leader_ids & verified_ids
|
||||
non_leader_ids = non_leader_ids & verified_ids
|
||||
|
||||
participants_md = generate_participants_md(non_leader_ids, verified_usernames, prof_by_id, avail_by_id)
|
||||
with open('participants.md', 'w') as f:
|
||||
participants_md = generate_participants_md(
|
||||
non_leader_ids, verified_usernames, prof_by_id, avail_by_id
|
||||
)
|
||||
with open("participants.md", "w") as f:
|
||||
f.write(participants_md)
|
||||
print(f"Generated participants.md with {len(non_leader_ids)} participants")
|
||||
|
||||
leaders_md = generate_leaders_md(leader_ids, verified_usernames, prof_by_id, avail_by_id, lead_by_id)
|
||||
with open('leaders.md', 'w') as f:
|
||||
leaders_md = generate_leaders_md(
|
||||
leader_ids, verified_usernames, prof_by_id, avail_by_id, lead_by_id
|
||||
)
|
||||
with open("leaders.md", "w") as f:
|
||||
f.write(leaders_md)
|
||||
print(f"Generated leaders.md with {len(leader_ids)} leaders")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user