From ffc9788d18919f34503f85b846a9732586ff1615 Mon Sep 17 00:00:00 2001 From: Simonas <20096648+simjak@users.noreply.github.com> Date: Wed, 10 Jan 2024 10:56:31 +0200 Subject: [PATCH] fix: removed helper replace.py --- .gitignore | 9 ++++++--- replace.py | 23 ----------------------- 2 files changed, 6 insertions(+), 26 deletions(-) delete mode 100644 replace.py diff --git a/.gitignore b/.gitignore index 41aac4aa..c3631d40 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,7 @@ venv/ .idea **/__pycache__ **/*.py[cod] -node_modules -package-lock.json -package.json + # local env files .env*.local @@ -23,3 +21,8 @@ mac.env .pytest_cache test.py output + +node_modules +package-lock.json +package.json +``` diff --git a/replace.py b/replace.py deleted file mode 100644 index d1fbe597..00000000 --- a/replace.py +++ /dev/null @@ -1,23 +0,0 @@ -import re -import os - - -def replace_type_hints(file_path): - with open(file_path, "rb") as file: - file_data = file.read() - - # Decode the file data with error handling - file_data = file_data.decode("utf-8", errors="ignore") - - # Regular expression pattern to find '| None' and replace with 'Optional' - file_data = re.sub(r"(\w+)\s*\|\s*None", r"Optional[\1]", file_data) - - with open(file_path, "w") as file: - file.write(file_data) - - -# Walk through the repository and update all .py files -for root, dirs, files in os.walk("/Users/jakit/customers/aurelio/semantic-router"): - for file in files: - if file.endswith(".py"): - replace_type_hints(os.path.join(root, file)) -- GitLab