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