1+ # SPDX-License-Identifier: Apache-2.0
2+ # Copyright 2026 Samuel Amen Ague
3+ #
4+ # Licensed under the Apache License, Version 2.0 (the "License");
5+ # you may not use this file except in compliance with the License.
6+ # You may obtain a copy of the License at
7+ #
8+ # http://www.apache.org/licenses/LICENSE-2.0
9+ #
10+ # Unless required by applicable law or agreed to in writing, software
11+ # distributed under the License is distributed on an "AS IS" BASIS,
12+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ # See the License for the specific language governing permissions and
14+ # limitations under the License.
15+ """
16+ Data classes for structured information
17+
18+ """
19+ from __future__ import annotations
20+
21+ import ast
22+ import fnmatch
23+ import hashlib
24+ import http .client
25+ import json
26+ import os
27+ import re
28+ import shutil
29+ import subprocess
30+ import sys
31+ import time
32+ import urllib .parse
33+ import urllib .request
34+ from dataclasses import dataclass , field
35+ from pathlib import Path
36+ from typing import Any , Dict , Iterator , List , Optional , Pattern , Set , Tuple , Union
37+
38+
39+
40+
41+ @dataclass
42+ class DependencyInfo :
43+ """Information about project dependencies."""
44+
45+ requirements_txt : List [str ] = field (default_factory = list )
46+ pyproject_toml : Dict [str , Any ] = field (default_factory = dict )
47+ setup_py : Dict [str , Any ] = field (default_factory = dict )
48+ pipfile : Dict [str , Any ] = field (default_factory = dict )
49+ conda_yaml : Dict [str , Any ] = field (default_factory = dict )
50+ all_dependencies : Set [str ] = field (default_factory = set )
51+
52+
53+ @dataclass
54+ class PythonFileInfo :
55+ """Information extracted from a Python file."""
56+
57+ path : Path
58+ imports : List [str ] = field (default_factory = list )
59+ functions : List [str ] = field (default_factory = list )
60+ classes : List [str ] = field (default_factory = list )
61+ docstring : Optional [str ] = None
62+ line_count : int = 0
63+ is_valid_syntax : bool = True
64+ syntax_error : Optional [str ] = None
65+
66+
67+ @dataclass
68+ class VenvInfo :
69+ """Information about a virtual environment."""
70+
71+ path : Path
72+ exists : bool = False
73+ python_version : Optional [str ] = None
74+ pip_version : Optional [str ] = None
75+ installed_packages : Dict [str , str ] = field (default_factory = dict )
76+ is_active : bool = False
77+
78+
79+ @dataclass
80+ class GitInfo :
81+ """Git repository information."""
82+
83+ is_repo : bool = False
84+ branch : Optional [str ] = None
85+ has_uncommitted : bool = False
86+ staged_files : List [str ] = field (default_factory = list )
87+ modified_files : List [str ] = field (default_factory = list )
88+ untracked_files : List [str ] = field (default_factory = list )
89+ last_commit : Optional [str ] = None
0 commit comments