2025-02-02 14:58:18 -05:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2024-09-22 12:47:54 -07:00
|
|
|
import glob
|
|
|
|
|
|
|
|
requires_files = glob.glob('requirements*.txt')
|
|
|
|
requires_files += ["pyproject.toml"]
|
|
|
|
for file in requires_files:
|
|
|
|
print(f">>> cleaning {file}")
|
2024-11-06 02:11:55 -05:00
|
|
|
with open(file) as f:
|
2024-09-22 12:47:54 -07:00
|
|
|
lines = f.readlines()
|
|
|
|
if "torch" in "".join(lines).lower():
|
|
|
|
print("removed:")
|
|
|
|
with open(file, 'w') as f:
|
|
|
|
for line in lines:
|
|
|
|
if 'torch' not in line.lower():
|
|
|
|
f.write(line)
|
|
|
|
else:
|
|
|
|
print(line.strip())
|
|
|
|
print(f"<<< done cleaning {file}")
|
|
|
|
print()
|