fix line that does nothing and deletion of cache
This commit is contained in:
@@ -8,6 +8,7 @@ import os
|
||||
import logging
|
||||
import shlex
|
||||
import subprocess
|
||||
import shutil
|
||||
from typing import Sequence
|
||||
from pathlib import Path
|
||||
import yaml
|
||||
@@ -56,11 +57,7 @@ def clean_cache(directory: Path):
|
||||
including the directory itself."""
|
||||
if not directory.is_dir():
|
||||
return
|
||||
for file in filter(lambda x: x.is_file(), directory.iterdir()):
|
||||
file.unlink()
|
||||
for dir in filter(lambda x: x.is_dir(), directory.iterdir()):
|
||||
dir.rmdir()
|
||||
directory.rmdir()
|
||||
shutil.rmtree(directory)
|
||||
|
||||
|
||||
def run(command: str | Sequence[str], verbose: bool, cwd: Path | None = None) -> None:
|
||||
@@ -117,9 +114,8 @@ def parse_list(file):
|
||||
for line in fileinput.input(file, inplace=True):
|
||||
sys.stdout.write(str(line).replace("http://", "https://"))
|
||||
with open(file, "r+", encoding="utf-8") as open_file:
|
||||
f_content = open_file.read()
|
||||
f_content = re.compile(r"\/$", 0).sub(r"\/$", "")
|
||||
lines = [ln.rstrip("\n").rstrip("/") + "\n" for ln in open_file]
|
||||
open_file.seek(0)
|
||||
open_file.truncate()
|
||||
print(f_content)
|
||||
open_file.writelines(lines)
|
||||
sort_txt_file(file)
|
||||
|
||||
Reference in New Issue
Block a user