Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Commit

Permalink
🐛 Use new types from Pydantic v1 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
tehtbl authored and tiangolo committed Jan 19, 2020
1 parent e730af3 commit 2cdf5e0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List

from fastapi import APIRouter, Body, Depends, HTTPException
from pydantic.types import EmailStr
from pydantic.networks import EmailStr

from app import crud
from app.api.utils.security import get_current_active_superuser, get_current_active_user
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fastapi import APIRouter, Depends
from pydantic.types import EmailStr
from pydantic.networks import EmailStr

from app.api.utils.security import get_current_active_superuser
from app.core.celery_app import celery_app
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/backend/app/app/crud/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from couchbase.n1ql import CONSISTENCY_REQUEST, N1QLQuery
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
from pydantic.fields import Field, Shape
from pydantic.fields import Field, SHAPE_LIST, SHAPE_SET, SHAPE_TUPLE

from app.core import config

Expand Down Expand Up @@ -85,7 +85,7 @@ def search_results_to_model(
field: Field = doc_model.__fields__[key]
if not value:
value = None
elif field.shape in {Shape.LIST, Shape.SET, Shape.TUPLE} and not isinstance(
elif field.shape in {SHAPE_LIST, SHAPE_SET, SHAPE_TUPLE} and not isinstance(
value, list
):
value = [value]
Expand Down

0 comments on commit 2cdf5e0

Please sign in to comment.