#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1022
Task: Write a Python function that reads /etc/os-release and returns the OS name and version as a dict
Generated: 2026-02-12T17:20:32.927623
"""

import re

def read_os_release():
    os_info = {}
    try:
        with open("/etc/os-release", "r") as file:
            content = file.read()
        # Extract OS name and version using regex
        os_name_match = re.search(r'NAME="([^"]+)"', content)
        version_match = re.search(r'PRETTY_NAME="([^"]+)"', content)
        if os_name_match:
            os_info["os_name"] = os_name_match.group(1)
        if version_match:
            os_info["version"] = version_match.group(1)
    except Exception as e:
        os_info["error"] = str(e)
    return os_info

if __name__ == '__main__':
    result = read_os_release()
    print(result)