Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions scripts/stubsabot.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,15 +875,16 @@ def get_update_pr_body(update: Update, settings: StubtestSettings) -> str:

def remove_stubs(distribution: str) -> None:
stub_path = distribution_path(distribution)
target_path_prefix = f'"stubs/{distribution}'
target_path = f'"stubs/{distribution}"'
target_path_prefix = f'"stubs/{distribution}/'

if stub_path.exists() and stub_path.is_dir():
shutil.rmtree(stub_path)

with PYRIGHT_CONFIG.open("r", encoding="UTF-8") as f:
lines = f.readlines()

lines = [line for line in lines if not line.lstrip().startswith(target_path_prefix)]
lines = [line for line in lines if line.strip() != target_path and not line.lstrip().startswith(target_path_prefix)]

with PYRIGHT_CONFIG.open("w", encoding="UTF-8") as f:
f.writelines(lines)
Expand Down
Loading