|
Download tasks/codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4/post_context.md from Benchanything/checkerbench: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/datasets/Benchanything/checkerbench/resolve/main/tasks/codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4/post_context.md
- Command line
-
hf download hf://datasets/Benchanything/checkerbench/tasks/codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4/post_context.md
-
curl -L -o post_context.md https://huggingface.co/datasets/Benchanything/checkerbench/resolve/main/tasks/codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4/post_context.md
1.3 kB
Patch-overlapping Python context after the fix
thefuck/rules/dirty_untar.py — function:side_effect (lines 41-53)
def side_effect(old_cmd, command):
with tarfile.TarFile(_tar_file(old_cmd.script_parts)[0]) as archive:
for file in archive.getnames():
if not os.path.abspath(file).startswith(os.getcwd()):
# it's unsafe to overwrite files outside of the current directory
continue
try:
os.remove(file)
except OSError:
# does not try to remove directories as we cannot know if they
# already existed before
pass
thefuck/rules/dirty_unzip.py — function:side_effect (lines 45-57)
def side_effect(old_cmd, command):
with zipfile.ZipFile(_zip_file(old_cmd), 'r') as archive:
for file in archive.namelist():
if not os.path.abspath(file).startswith(os.getcwd()):
# it's unsafe to overwrite files outside of the current directory
continue
try:
os.remove(file)
except OSError:
# does not try to remove directories as we cannot know if they
# already existed before
pass