auto-code-fixer 0.3.2__py3-none-any.whl → 0.3.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- auto_code_fixer/__init__.py +1 -1
- auto_code_fixer/cli.py +35 -7
- {auto_code_fixer-0.3.2.dist-info → auto_code_fixer-0.3.3.dist-info}/METADATA +1 -1
- {auto_code_fixer-0.3.2.dist-info → auto_code_fixer-0.3.3.dist-info}/RECORD +8 -8
- {auto_code_fixer-0.3.2.dist-info → auto_code_fixer-0.3.3.dist-info}/WHEEL +0 -0
- {auto_code_fixer-0.3.2.dist-info → auto_code_fixer-0.3.3.dist-info}/entry_points.txt +0 -0
- {auto_code_fixer-0.3.2.dist-info → auto_code_fixer-0.3.3.dist-info}/licenses/LICENSE +0 -0
- {auto_code_fixer-0.3.2.dist-info → auto_code_fixer-0.3.3.dist-info}/top_level.txt +0 -0
auto_code_fixer/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.3.
|
|
1
|
+
__version__ = "0.3.3"
|
auto_code_fixer/cli.py
CHANGED
|
@@ -88,15 +88,43 @@ def fix_file(file_path, project_root, api_key, ask, verbose, *, dry_run: bool, m
|
|
|
88
88
|
if dry_run:
|
|
89
89
|
log("DRY RUN: would apply fixes:\n" + "\n".join(rel_changes), "WARN")
|
|
90
90
|
else:
|
|
91
|
+
sr = os.path.realpath(os.path.abspath(sandbox_root))
|
|
92
|
+
pr = os.path.realpath(os.path.abspath(project_root))
|
|
93
|
+
|
|
91
94
|
for p in sorted(changed_sandbox_files):
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
p_real = os.path.realpath(os.path.abspath(p))
|
|
96
|
+
|
|
97
|
+
# compute rel using real paths to avoid macOS /private path weirdness
|
|
98
|
+
rel = os.path.relpath(p_real, sr)
|
|
99
|
+
|
|
100
|
+
# Safety: never allow paths escaping the sandbox
|
|
101
|
+
if rel.startswith(".." + os.sep) or rel == "..":
|
|
102
|
+
log(f"Skipping suspicious path outside sandbox: {p}", "WARN")
|
|
103
|
+
continue
|
|
104
|
+
|
|
105
|
+
dst = os.path.join(pr, rel)
|
|
106
|
+
dst_real = os.path.realpath(os.path.abspath(dst))
|
|
107
|
+
|
|
108
|
+
# Safety: never write outside the project root
|
|
109
|
+
if not (dst_real.startswith(pr + os.sep) or dst_real == pr):
|
|
110
|
+
log(f"Skipping suspicious destination outside project: {dst}", "WARN")
|
|
111
|
+
continue
|
|
112
|
+
|
|
113
|
+
# Avoid shutil.SameFileError
|
|
114
|
+
try:
|
|
115
|
+
if os.path.exists(dst_real) and os.path.samefile(p_real, dst_real):
|
|
116
|
+
log(f"Skip copy (same file): {dst_real}", "DEBUG")
|
|
117
|
+
continue
|
|
118
|
+
except Exception:
|
|
119
|
+
pass
|
|
120
|
+
|
|
121
|
+
if os.path.exists(dst_real):
|
|
122
|
+
bak = backup_file(dst_real)
|
|
96
123
|
log(f"Backup created: {bak}", "DEBUG")
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
124
|
+
|
|
125
|
+
os.makedirs(os.path.dirname(dst_real), exist_ok=True)
|
|
126
|
+
shutil.copy(p_real, dst_real)
|
|
127
|
+
log(f"File updated: {dst_real}")
|
|
100
128
|
|
|
101
129
|
shutil.rmtree(sandbox_root)
|
|
102
130
|
log(f"Fix completed in {attempt + 1} attempt(s) 🎉")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
auto_code_fixer/__init__.py,sha256=
|
|
2
|
-
auto_code_fixer/cli.py,sha256=
|
|
1
|
+
auto_code_fixer/__init__.py,sha256=8KcCYTXH99C2-gCLuPILJvtT9YftRWJsartIx6TQ2ZY,22
|
|
2
|
+
auto_code_fixer/cli.py,sha256=Fsty_FJC7sm7mJCnXFQpwdF7N-fFxkJkgjhHFrGr0OA,10453
|
|
3
3
|
auto_code_fixer/command_runner.py,sha256=6P8hGRavN5C39x-e03p02Vc805NnZH9U7e48ngb5jJI,1104
|
|
4
4
|
auto_code_fixer/fixer.py,sha256=DlAOVbw9AImEKJy8llisVCtss0tXKHMnioYeFBQGXlE,2293
|
|
5
5
|
auto_code_fixer/installer.py,sha256=LC0jasSsPI7eHMeDxa622OoMCR1951HAXUZWp-kcmVY,1522
|
|
@@ -11,9 +11,9 @@ auto_code_fixer/sandbox.py,sha256=FWQcCxNDI4i7ckTKHuARSSIHCopBRqG16MVtx9s75R8,16
|
|
|
11
11
|
auto_code_fixer/traceback_utils.py,sha256=sbSuLO-2UBk5QPJZYJunTK9WGOpEY8mxR6WRKbtCIoM,935
|
|
12
12
|
auto_code_fixer/utils.py,sha256=YXCv3PcDo5NBM1odksBTWkHTEELRtEXfPDIORA5iYaM,3090
|
|
13
13
|
auto_code_fixer/venv_manager.py,sha256=2ww8reYgLbLohh-moAD5YKM09qv_mC5yYzJRwm3XiXc,1202
|
|
14
|
-
auto_code_fixer-0.3.
|
|
15
|
-
auto_code_fixer-0.3.
|
|
16
|
-
auto_code_fixer-0.3.
|
|
17
|
-
auto_code_fixer-0.3.
|
|
18
|
-
auto_code_fixer-0.3.
|
|
19
|
-
auto_code_fixer-0.3.
|
|
14
|
+
auto_code_fixer-0.3.3.dist-info/licenses/LICENSE,sha256=hgchJNa26tjXuLztwSUDbYQxNLnAPnLk6kDXNIkC8xc,1066
|
|
15
|
+
auto_code_fixer-0.3.3.dist-info/METADATA,sha256=JBkdvGh27MLYWEGNX_NS46dnoVtidUhPyAn7uflcgZ8,3290
|
|
16
|
+
auto_code_fixer-0.3.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
17
|
+
auto_code_fixer-0.3.3.dist-info/entry_points.txt,sha256=a-j2rkfwkrhXZ5Qbz_6_gwk6Bj7nijYR1DALjWp5Myk,61
|
|
18
|
+
auto_code_fixer-0.3.3.dist-info/top_level.txt,sha256=qUk1qznb6Qxqmxy2A3z_5dpOZlmNKHwUiLuJwH-CrAk,16
|
|
19
|
+
auto_code_fixer-0.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|