Skip to content

Commit

Permalink
fix: mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
nannan00 committed Jul 29, 2024
1 parent 4f805aa commit e86d55c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/bk-login.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,13 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: 'src/bk-login/requirements_dev.txt'
- name: create idp plugin symbolic link
run: |
ln -s $(pwd)/src/idp-plugins/idp_plugins $(pwd)/src/bk-login/bklogin
- name: Set up Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.6.1"
- name: Install dependencies
working-directory: src/bk-login
run: poetry install
run: pip install -r src/bk-login/requirements_dev.txt
- name: Run unittest
working-directory: src/bk-login
run: |
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/bk-user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,13 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: 'src/bk-user/requirements_dev.txt'
- name: create idp plugin symbolic link
run: |
ln -s $(pwd)/src/idp-plugins/idp_plugins $(pwd)/src/bk-user/bkuser
- name: Set up Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.5.1"
- name: Install dependencies
working-directory: src/bk-user
run: poetry install
run: pip install -r src/bk-user/requirements_dev.txt
- name: Run unittest
working-directory: src/bk-user
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ repos:
name: ruff
language: python
types: [python]
entry: ruff --config=src/idp-plugins/pyproject.toml --fix --no-cache
entry: ruff check --config=src/idp-plugins/pyproject.toml --fix --no-cache
files: src/idp-plugins/
- id: mypy
name: mypy
Expand Down
16 changes: 10 additions & 6 deletions src/bk-login/bklogin/component/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

import logging
import time
from typing import Dict, Tuple
Expand Down Expand Up @@ -127,12 +128,15 @@ def _http_request(method: str, url: str, **kwargs) -> Tuple[HttpStatusCode, Dict
resp.status_code,
content,
)
return INVALID_JSON_STATUS_CODE, {
"error": (
f"http response body not json, http status code is {resp.status_code}! "
f"{method} {urlparse(url).path}, response.body={content}, error:{e}"
)
}
return (
INVALID_JSON_STATUS_CODE,
{
"error": (
f"http response body not json, http status code is {resp.status_code}! " # type: ignore
f"{method} {urlparse(url).path}, response.body={content}, error:{e}"
)
},
)


def _http_request_only_20x(method: str, url: str, **kwargs) -> Tuple[bool, Dict]:
Expand Down
2 changes: 1 addition & 1 deletion src/idp-plugins/idp_plugins/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _http_request(method: str, url: str, **kwargs) -> Tuple[HttpStatusCode, Dict
)
return INVALID_JSON_STATUS_CODE, {
"error": (
f"http response body not json, http status code is {resp.status_code}! "
f"http response body not json, http status code is {resp.status_code}! " # type: ignore
f"{method} {urlparse(url).path}, response.body={content}, error:{e}"
)
}
Expand Down

0 comments on commit e86d55c

Please sign in to comment.