From cef6fd6e8309ca86dddbba4983c7de202716d912 Mon Sep 17 00:00:00 2001 From: RainDayDream <2717056664@qq.com> Date: Mon, 30 Dec 2024 20:02:26 +0800 Subject: [PATCH 1/4] fist commit --- src/model_server/locator/interface.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/model_server/locator/interface.py b/src/model_server/locator/interface.py index 48778b0..d933c25 100644 --- a/src/model_server/locator/interface.py +++ b/src/model_server/locator/interface.py @@ -139,11 +139,15 @@ def load_model(model_path): def normalize_string(s): - - -if not isinstance(s, if) return s - # 当检测到 s 含有 ' 时,进行转义 - if s.find("'") != -1: +# if not isinstance(s, if) return s +# # 当检测到 s 含有 ' 时,进行转义 +# if s.find("'") != -1: +# s = s.replace("'", "\'") +# return s + if not isinstance(s, str): + return s + # 当检测到 s 含有 ' 时,进行转义 + if s.find("'") != -1: s = s.replace("'", "\'") return s From c97090c7aa640fc3bec737b2f7f245824890ac24 Mon Sep 17 00:00:00 2001 From: RainDayDream <2717056664@qq.com> Date: Mon, 30 Dec 2024 20:04:13 +0800 Subject: [PATCH 2/4] add yaml --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..08e6337 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Code Style Check + +on: + push: + branches: + - main # 当代码推送到 main 分支时触发 + pull_request: + branches: + - main # 当对 main 分支发起 Pull Request 时触发 + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 # 拉取代码仓库内容 + + - name: Set up Python environment + uses: actions/setup-python@v4 # 设置 Python 环境 + with: + python-version: '3.9' # 指定 Python 版本 + + - name: Install flake8 + run: pip install flake8 # 安装代码风格检测工具 flake8 + + - name: Run flake8 + run: | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Upload flake8 report + if: failure() + uses: actions/upload-artifact@v3 + with: + name: flake8-report + path: flake8-report.txt From 6c53557fcbd45ba7da7e763d365424551f373dd6 Mon Sep 17 00:00:00 2001 From: RainDayDream <2717056664@qq.com> Date: Mon, 30 Dec 2024 22:07:03 +0800 Subject: [PATCH 3/4] add yaml --- .github/workflows/ci.yml | 50 +++++++++++++++++++ .../{test.yml => code-style-check.yml} | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml rename .github/workflows/{test.yml => code-style-check.yml} (94%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ed7c5f3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Install dependencies + run: | + npm install + + - name: Run tests + run: | + npm test + + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Install dependencies + run: | + npm install + + - name: Run linter + run: | + npm run lint \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/code-style-check.yml similarity index 94% rename from .github/workflows/test.yml rename to .github/workflows/code-style-check.yml index 08e6337..c7b7e1c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/code-style-check.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Python environment uses: actions/setup-python@v4 # 设置 Python 环境 with: - python-version: '3.9' # 指定 Python 版本 + python-version: '3.10.13' # 指定 Python 版本 - name: Install flake8 run: pip install flake8 # 安装代码风格检测工具 flake8 From 7e7cad23650c0623fb8ca7098e78ed288e934250 Mon Sep 17 00:00:00 2001 From: RainDayDream <2717056664@qq.com> Date: Mon, 30 Dec 2024 22:20:36 +0800 Subject: [PATCH 4/4] change yaml name --- .github/workflows/{ci.yml => lint.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{ci.yml => lint.yml} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/lint.yml similarity index 100% rename from .github/workflows/ci.yml rename to .github/workflows/lint.yml