orchestrata_ultimate.verification.autofix.helpers

Reference › orchestrata_ultimate › verification › autofix › helpers

Shared file walker for the autofix modules. walk_python_files(workspace) yields the absolute path of every .py file under a workspace, pruning hidden directories and the names in its skip set (the docstring lists .venv, __pycache__, site-packages and .git). It is used by format_fixes, import_fixes and redis_fixes.

At a glance

Source src/orchestrata_ultimate/verification/autofix/helpers.py
Lines of code 39
Classes 0
Functions 1
Imports (internal) orchestrata_ultimate.core.base.traces
Imported by orchestrata_ultimate.verification.autofix.format_fixes, orchestrata_ultimate.verification.autofix.import_fixes, orchestrata_ultimate.verification.autofix.redis_fixes
Tests that import it tests/generated_recovery/test_verification_autofix_helpers.py, tests/verification/autofix/test_helpers.py, tests/verification/test_autofix.py, tests/verification/test_autofix_helpers.py, tests/verification/test_small_modules.py

Class diagram

No classes; see Functions.

Dependency diagram

Dependency diagram orchestrata_ultimate.verification.autofix.helpers

API

Functions

Function Signature Summary
walk_python_files traces walk_python_files(workspace: str) -> Generator[str] Walk workspace yielding absolute paths to Python files.

Source

Permalink: https://gitlab.com/MSamy/orchestrata-ultimate-architecture/-/blob/a4cbc2bdf/src/orchestrata_ultimate/verification/autofix/helpers.py

"""Shared helpers for the autofix pipeline.

Spec: 007 - Verification Agent
"""

import os
from collections.abc import Generator

from orchestrata_ultimate.core.base.traces import traces

_SKIP_DIRS = frozenset(
    {
        ".venv",
        "__pycache__",
        "site-packages",
        ".git",
    }
)


@traces(spec="031", story="US-031-001", reqs=["REQ-031-015"])
def walk_python_files(
    workspace: str,
) -> Generator[str]:
    """Walk workspace yielding absolute paths to Python files.

    Skips .venv, __pycache__, site-packages, and .git directories.

    Args:
        workspace: Root directory to walk.

    Yields:
        Absolute path to each .py file found.
    """
    for root, dirs, files in os.walk(workspace):
        dirs[:] = [d for d in dirs if d not in _SKIP_DIRS and not d.startswith(".")]
        for fname in files:
            if fname.endswith(".py"):
                yield os.path.join(root, fname)