OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
hps
/
faces
/
.venv
/
lib
/
python3.10
/
site-packages
/
numpy
/
distutils
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/26/2024 01:26:35 PM
rwxr-xr-x
📄
__config__.py
5.02 KB
10/26/2024 01:26:26 PM
rw-r--r--
📄
__init__.py
2.03 KB
10/26/2024 01:26:26 PM
rw-r--r--
📄
__init__.pyi
119 bytes
10/26/2024 01:26:26 PM
rw-r--r--
📁
__pycache__
-
10/26/2024 01:27:35 PM
rwxr-xr-x
📄
_shell_utils.py
2.55 KB
10/26/2024 01:26:26 PM
rw-r--r--
📄
armccompiler.py
962 bytes
10/26/2024 01:26:25 PM
rw-r--r--
📄
ccompiler.py
27.47 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
ccompiler_opt.py
97.69 KB
10/26/2024 01:26:25 PM
rw-r--r--
📁
checks
-
10/26/2024 01:27:32 PM
rwxr-xr-x
📁
command
-
10/26/2024 01:28:51 PM
rwxr-xr-x
📄
conv_template.py
9.31 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
core.py
7.98 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
cpuinfo.py
22.11 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
exec_command.py
10.04 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
extension.py
3.48 KB
10/26/2024 01:26:25 PM
rw-r--r--
📁
fcompiler
-
10/26/2024 01:28:52 PM
rwxr-xr-x
📄
from_template.py
7.73 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
intelccompiler.py
4.13 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
lib2def.py
3.54 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
line_endings.py
1.98 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
log.py
2.81 KB
10/26/2024 01:26:25 PM
rw-r--r--
📁
mingw
-
10/26/2024 01:27:34 PM
rwxr-xr-x
📄
mingw32ccompiler.py
21.56 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
misc_util.py
87.27 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
msvc9compiler.py
2.14 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
msvccompiler.py
2.58 KB
10/26/2024 01:26:25 PM
rw-r--r--
📄
npy_pkg_config.py
12.67 KB
10/26/2024 01:26:26 PM
rw-r--r--
📄
numpy_distribution.py
634 bytes
10/26/2024 01:26:26 PM
rw-r--r--
📄
pathccompiler.py
713 bytes
10/26/2024 01:26:26 PM
rw-r--r--
📄
setup.py
634 bytes
10/26/2024 01:26:26 PM
rw-r--r--
📄
system_info.py
108.43 KB
10/26/2024 01:26:26 PM
rw-r--r--
📁
tests
-
10/26/2024 01:28:52 PM
rwxr-xr-x
📄
unixccompiler.py
5.3 KB
10/26/2024 01:26:26 PM
rw-r--r--
Editing: line_endings.py
Close
""" Functions for converting from DOS to UNIX line endings """ import os import re import sys def dos2unix(file): "Replace CRLF with LF in argument files. Print names of changed files." if os.path.isdir(file): print(file, "Directory!") return with open(file, "rb") as fp: data = fp.read() if '\0' in data: print(file, "Binary!") return newdata = re.sub("\r\n", "\n", data) if newdata != data: print('dos2unix:', file) with open(file, "wb") as f: f.write(newdata) return file else: print(file, 'ok') def dos2unix_one_dir(modified_files, dir_name, file_names): for file in file_names: full_path = os.path.join(dir_name, file) file = dos2unix(full_path) if file is not None: modified_files.append(file) def dos2unix_dir(dir_name): modified_files = [] os.path.walk(dir_name, dos2unix_one_dir, modified_files) return modified_files #---------------------------------- def unix2dos(file): "Replace LF with CRLF in argument files. Print names of changed files." if os.path.isdir(file): print(file, "Directory!") return with open(file, "rb") as fp: data = fp.read() if '\0' in data: print(file, "Binary!") return newdata = re.sub("\r\n", "\n", data) newdata = re.sub("\n", "\r\n", newdata) if newdata != data: print('unix2dos:', file) with open(file, "wb") as f: f.write(newdata) return file else: print(file, 'ok') def unix2dos_one_dir(modified_files, dir_name, file_names): for file in file_names: full_path = os.path.join(dir_name, file) unix2dos(full_path) if file is not None: modified_files.append(file) def unix2dos_dir(dir_name): modified_files = [] os.path.walk(dir_name, unix2dos_one_dir, modified_files) return modified_files if __name__ == "__main__": dos2unix_dir(sys.argv[1])