mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-12 22:10:01 -04:00
don't set a default websocket url
This commit is contained in:
parent
58a8f2259e
commit
b071019761
8 changed files with 45 additions and 20 deletions
|
@ -1,29 +0,0 @@
|
|||
import re
|
||||
import sys
|
||||
import pathlib
|
||||
|
||||
match_regex = r'/\* (.+?)\n(.+?)\n\*/\n(.*?)(\n\n|$)'
|
||||
|
||||
fragments_dir = sys.argv[1]
|
||||
target_dir = sys.argv[2]
|
||||
fragments_path = pathlib.Path(fragments_dir)
|
||||
target_path = pathlib.Path(target_dir)
|
||||
target_text = target_path.read_text()
|
||||
|
||||
for fragment_file in fragments_path.iterdir():
|
||||
print(f"applying patch from {fragment_file.name}")
|
||||
fragment_text = fragment_file.read_text()
|
||||
matches = re.findall(match_regex, fragment_text, re.S)
|
||||
|
||||
for mode, patch_regex, patch_text, _ in matches:
|
||||
fragment_matches = re.findall(patch_regex, target_text)
|
||||
if not fragment_matches:
|
||||
print(f"warning: regex did not match anything for '{patch_regex}'");
|
||||
if mode == "DELETE":
|
||||
target_text = re.sub(patch_regex, "", target_text)
|
||||
elif mode == "REPLACE":
|
||||
target_text = re.sub(patch_regex, patch_text, target_text)
|
||||
elif mode == "INSERT":
|
||||
target_text = re.sub("("+patch_regex+")", r'\1'+patch_text, target_text)
|
||||
|
||||
target_path.write_text(target_text)
|
Loading…
Add table
Add a link
Reference in a new issue