Skip to content

Commit 2cb5955

Browse files
committed
fix bytearray issue
1 parent afea947 commit 2cb5955

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

scripts/inject_python_sdk_helpers.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,23 @@ PYCODE
336336

337337
sed -i "s/__PACKAGE_NAME__/${package_name}/g" "${package_dir}/auth.py" "${package_dir}/sdk.py"
338338

339+
models_dir="${package_dir}/models"
340+
if [ -d "${models_dir}" ]; then
341+
while IFS= read -r -d '' model_file; do
342+
python3 - <<'PYCODE' "${model_file}"
343+
import pathlib
344+
import re
345+
import sys
346+
347+
path = pathlib.Path(sys.argv[1])
348+
text = path.read_text(encoding="utf-8")
349+
updated = re.sub(r"\bbytearray\b", "bytes", text)
350+
if updated != text:
351+
path.write_text(updated, encoding="utf-8")
352+
PYCODE
353+
done < <(find "${models_dir}" -type f -name "*.py" -print0)
354+
fi
355+
339356
readme_path="${sdk_dir}/README.md"
340357
if [ -f "${readme_path}" ]; then
341358
tmp_readme="$(mktemp)"

0 commit comments

Comments
 (0)