style: apply ruff auto-fixes

This commit is contained in:
2026-01-19 03:14:30 -08:00
parent 3ab122a55d
commit a961ac3ce7
72 changed files with 2477 additions and 2871 deletions

View File

@@ -203,7 +203,6 @@ def run_platform_bootstrap(repo_root: Path) -> int:
def playwright_package_installed() -> bool:
try:
import playwright # type: ignore
return True
except Exception:
@@ -751,7 +750,7 @@ def main() -> int:
user_bin = Path(os.environ.get("USERPROFILE", str(home))) / "bin"
mm_bat = user_bin / "mm.bat"
print(f"Checking for shim files:")
print("Checking for shim files:")
print(f" mm.bat: {'' if mm_bat.exists() else ''} ({mm_bat})")
print()
@@ -760,14 +759,14 @@ def main() -> int:
if "REPO=" in bat_content or "ENTRY=" in bat_content:
print(f" mm.bat content looks valid ({len(bat_content)} bytes)")
else:
print(f" ⚠️ mm.bat content may be corrupted")
print(" ⚠️ mm.bat content may be corrupted")
print()
# Check PATH
path = os.environ.get("PATH", "")
user_bin_str = str(user_bin)
in_path = user_bin_str in path
print(f"Checking PATH environment variable:")
print("Checking PATH environment variable:")
print(f" {user_bin_str} in current session PATH: {'' if in_path else ''}")
# Check registry
@@ -792,7 +791,7 @@ def main() -> int:
try:
result = subprocess.run(["mm", "--help"], capture_output=True, text=True, timeout=5)
if result.returncode == 0:
print(f"'mm --help' works!")
print("'mm --help' works!")
print(f" Output (first line): {result.stdout.split(chr(10))[0]}")
else:
print(f"'mm --help' failed with exit code {result.returncode}")
@@ -800,8 +799,8 @@ def main() -> int:
print(f" Error: {result.stderr.strip()}")
except FileNotFoundError:
# mm not found via PATH, try calling the .ps1 directly
print(f"'mm' command not found in PATH")
print(f" Shims exist but command is not accessible via PATH")
print("'mm' command not found in PATH")
print(" Shims exist but command is not accessible via PATH")
print()
print("Attempting to call shim directly...")
try:
@@ -810,23 +809,23 @@ def main() -> int:
capture_output=True, text=True, timeout=5
)
if result.returncode == 0:
print(f" ✓ Direct shim call works!")
print(f" The shim files are valid and functional.")
print(" ✓ Direct shim call works!")
print(" The shim files are valid and functional.")
print()
print("⚠️ 'mm' is not in PATH, but the shims are working correctly.")
print()
print("Possible causes and fixes:")
print(f" 1. Terminal needs restart: Close and reopen your terminal/PowerShell")
print(f" 2. PATH reload: Run: $env:Path = [Environment]::GetEnvironmentVariable('PATH', 'User') + ';' + [Environment]::GetEnvironmentVariable('PATH', 'Machine')")
print(" 1. Terminal needs restart: Close and reopen your terminal/PowerShell")
print(" 2. PATH reload: Run: $env:Path = [Environment]::GetEnvironmentVariable('PATH', 'User') + ';' + [Environment]::GetEnvironmentVariable('PATH', 'Machine')")
print(f" 3. Manual PATH: Add {user_bin} to your system PATH manually")
else:
print(f" ✗ Direct shim call failed")
print(" ✗ Direct shim call failed")
if result.stderr:
print(f" Error: {result.stderr.strip()}")
except Exception as e:
print(f" ✗ Could not test direct shim: {e}")
except subprocess.TimeoutExpired:
print(f"'mm' command timed out")
print("'mm' command timed out")
except Exception as e:
print(f" ✗ Error testing 'mm': {e}")
else:
@@ -835,7 +834,7 @@ def main() -> int:
locations = [home / ".local" / "bin" / "mm", Path("/usr/local/bin/mm"), Path("/usr/bin/mm")]
found_shims = [p for p in locations if p.exists()]
print(f"Checking for shim files:")
print("Checking for shim files:")
for p in locations:
if p.exists():
print(f" mm: ✓ ({p})")
@@ -844,23 +843,23 @@ def main() -> int:
print(f" mm: ✗ ({p})")
if not found_shims:
print(f" mm: ✗ (No shim found in standard locations)")
print(" mm: ✗ (No shim found in standard locations)")
print()
path = os.environ.get("PATH", "")
# Find which 'mm' is actually being run
actual_mm = shutil.which("mm")
print(f"Checking PATH environment variable:")
print("Checking PATH environment variable:")
if actual_mm:
print(f" 'mm' resolved to: {actual_mm}")
# Check if it's in a directory on the PATH
if any(str(Path(actual_mm).parent) in p for p in path.split(os.pathsep)):
print(f" Command is accessible via current session PATH: ✓")
print(" Command is accessible via current session PATH: ✓")
else:
print(f" Command is found but directory may not be in current PATH: ⚠️")
print(" Command is found but directory may not be in current PATH: ⚠️")
else:
print(f" 'mm' not found in current session PATH: ✗")
print(" 'mm' not found in current session PATH: ✗")
print()
# Test if mm command works
@@ -868,14 +867,14 @@ def main() -> int:
try:
result = subprocess.run(["mm", "--help"], capture_output=True, text=True, timeout=5)
if result.returncode == 0:
print(f"'mm --help' works!")
print("'mm --help' works!")
print(f" Output (first line): {result.stdout.split(chr(10))[0]}")
else:
print(f"'mm --help' failed with exit code {result.returncode}")
if result.stderr:
print(f" Error: {result.stderr.strip()}")
except FileNotFoundError:
print(f"'mm' command not found in PATH")
print("'mm' command not found in PATH")
except Exception as e:
print(f" ✗ Error testing 'mm': {e}")
@@ -1002,7 +1001,7 @@ def main() -> int:
try:
_run_cmd([str(python_path), "-m", "ensurepip", "--upgrade"])
except subprocess.CalledProcessError as exc:
except subprocess.CalledProcessError:
print(
"Failed to install pip inside the local virtualenv via ensurepip; ensure your Python build includes ensurepip and retry.",
file=sys.stderr,
@@ -1326,10 +1325,10 @@ if (Test-Path (Join-Path $repo 'CLI.py')) {
if not args.quiet:
print(f"Installed global launcher to: {user_bin}")
print(f"✓ mm.bat (Command Prompt and PowerShell)")
print("✓ mm.bat (Command Prompt and PowerShell)")
print()
print("You can now run 'mm' from any terminal window.")
print(f"If 'mm' is not found, restart your terminal or reload PATH:")
print("If 'mm' is not found, restart your terminal or reload PATH:")
print(" PowerShell: $env:PATH = [Environment]::GetEnvironmentVariable('PATH','User') + ';' + [Environment]::GetEnvironmentVariable('PATH','Machine')")
print(" CMD: path %PATH%")