Skip to content

Commit 4cbdedc

Browse files
committed
docs: Add docstring to detect_legacy_os_badges function
1 parent e62e564 commit 4cbdedc

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

tools/os_detector.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
1+
"""OS detection utilities for identifying legacy operating systems."""
2+
13
import platform
24
import subprocess
35
import json
46
from datetime import datetime
57

68
def detect_legacy_os_badges():
9+
"""Detects legacy operating systems and awards NFT badges based on the OS environment.
10+
11+
This function scans the system for indicators of legacy operating systems
12+
(DOS, MacOS, BeOS, Windows 3.x, Windows 95) by checking for characteristic
13+
files and directories. When legacy OS indicators are found, it generates
14+
NFT badge data representing the detected system.
15+
16+
Returns:
17+
dict: A dictionary containing a "badges" key with a list of NFT badge
18+
dictionaries. Each badge contains:
19+
- nft_id: Unique badge identifier
20+
- title: Human-readable badge title
21+
- class: Badge category (e.g., "OS Relic")
22+
- description: Description of the badge
23+
- emotional_resonance: Emotional context for the badge
24+
- symbol: Emoji symbol representing the badge
25+
- visual_anchor: Visual description
26+
- rarity: Badge rarity level
27+
- soulbound: Whether the badge is soulbound
28+
"""
729
detected_os = platform.system()
830
badges = []
931

@@ -76,4 +98,4 @@ def detect_legacy_os_badges():
7698
output = detect_legacy_os_badges()
7799
with open("relic_rewards.json", "w") as f:
78100
json.dump(output, f, indent=4)
79-
print(f"Legacy OS badges awarded: {[b['title'] for b in output['badges']]}")
101+
print(f"Legacy OS badges awarded: {[b[title] for b in output[badges]]}")

0 commit comments

Comments
 (0)