Skip to content

Commit c902bc5

Browse files
mohamedashrraf222Saga4
authored andcommitted
fix linting
1 parent 095871b commit c902bc5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

codeflash/code_utils/git_worktree_utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
from __future__ import annotations
22

33
import configparser
4-
import os
54
import shutil
65
import stat
76
import subprocess
87
import tempfile
98
import time
109
from pathlib import Path
11-
from typing import Optional
10+
from typing import Any, Callable, Optional
1211

1312
import git
1413

@@ -98,10 +97,12 @@ def create_detached_worktree(module_root: Path) -> Optional[Path]:
9897
return worktree_dir
9998

10099

101-
def _handle_remove_readonly(func, path, exc_info):
100+
def _handle_remove_readonly(
101+
func: Callable[[str], None], path: str, exc_info: tuple[type[BaseException], BaseException, Any]
102+
) -> None:
102103
"""Error handler for shutil.rmtree to handle read-only files on Windows."""
103104
if isinstance(exc_info[1], PermissionError):
104-
os.chmod(path, stat.S_IWUSR | stat.S_IRUSR | stat.S_IXUSR)
105+
Path(path).chmod(stat.S_IWUSR | stat.S_IRUSR | stat.S_IXUSR)
105106
func(path)
106107
else:
107108
raise exc_info[1]

0 commit comments

Comments
 (0)