This commit is contained in:
Sebastien Corbin
2022-01-17 13:44:27 +01:00
committed by Sébastien Corbin
parent 63c3d7d2dc
commit 382c824cca
3 changed files with 27 additions and 23 deletions

View File

@@ -11,7 +11,7 @@ jobs:
- '2.2' - '2.2'
- '3.2' - '3.2'
- '4.0' - '4.0'
python_version: python-version:
- 3.6 - 3.6
- 3.7 - 3.7
- 3.8 - 3.8
@@ -19,13 +19,13 @@ jobs:
- "3.10" - "3.10"
exclude: exclude:
- django_version: '2.2' - django_version: '2.2'
python_version: '3.10' python-version: '3.10'
- django_version: '4.0' - django_version: '4.0'
python_version: '3.6' python-version: '3.6'
- django_version: '4.0' - django_version: '4.0'
python_version: '3.7' python-version: '3.7'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -33,17 +33,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python_version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python_version: ${{ matrix.python_version }} python-version: ${{ matrix.python-version }}
- name: Cache pip - name: Cache pip
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
# This path is specific to Ubuntu # This path is specific to Ubuntu
path: ~/.cache/pip path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python_version }}-${{ matrix.django_version }} key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.django_version }}
- name: Install dependencies - name: Install dependencies
run: | run: |
@@ -58,7 +58,7 @@ jobs:
- name: Test Django - name: Test Django
run: | run: |
python -W error::DeprecationWarning -W error::PendingDeprecationWarning \ python -W error::DeprecationWarning -W error::PendingDeprecationWarning \
-m coverage run runtests.py -m coverage run ./runtests.py
- name: Coverage - name: Coverage
if: ${{ success() }} if: ${{ success() }}

View File

@@ -14,8 +14,12 @@ def draw_signature(data, as_file=False):
`data` can be a json object (list in fact) or a json string `data` can be a json object (list in fact) or a json string
if `as_file` is True, a temp file is returned instead of Image instance if `as_file` is True, a temp file is returned instead of Image instance
""" """
def _remove_empty_pts(pt): def _remove_empty_pts(pt):
return {'x': list(filter(lambda n: n is not None, pt['x'])), 'y': list(filter(lambda n: n is not None, pt['y']))} return {
'x': list(filter(lambda n: n is not None, pt['x'])),
'y': list(filter(lambda n: n is not None, pt['y']))
}
if type(data) is str: if type(data) is str:
drawing = json.loads(data, object_hook=_remove_empty_pts) drawing = json.loads(data, object_hook=_remove_empty_pts)