Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve typing #70

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@ name: Tests
on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tool:
- flake8
- mypy
- black --diff --check

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: "3.7"
cache: pip
cache-dependency-path: |
requirements/base.pip
requirements/test.pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/test.pip
- name: Run ${{ matrix.tool }} static check
run: |
python3 -m ${{ matrix.tool }} flask_pydantic/ tests/

build:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -12,19 +40,19 @@ jobs:
os: [ubuntu-latest, macOS-latest]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
requirements/base.pip
requirements/test.pip
- name: Install dependencies
if: steps.cache-pip.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r requirements/test.pip
- name: Test with pytest
run: |
python3 -m pytest
- name: Lint with flake8
run: |
flake8 .
8 changes: 4 additions & 4 deletions flask_pydantic/converters.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Type
from typing import Dict, List, Type, Union

from pydantic import BaseModel
from werkzeug.datastructures import ImmutableMultiDict
from werkzeug.datastructures import MultiDict


def convert_query_params(
query_params: ImmutableMultiDict, model: Type[BaseModel]
) -> dict:
query_params: "MultiDict[str, str]", model: Type[BaseModel]
) -> Dict[str, Union[str, List[str]]]:
"""
group query parameters into lists if model defines them

Expand Down
Loading