Skip to content

Commit

Permalink
Fix linting and flake8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TueeNguyen committed Nov 19, 2021
1 parent b146626 commit ed42def
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 3 additions & 7 deletions backend/api/blueprints/leads.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ..db import db
from ..pagination import parse_pagination_params
from .users import get_all_users
from pydantic import BaseModel, Extra, ValidationError
from pydantic import BaseModel, ValidationError

leads_bp = Blueprint("leads", __name__)

Expand Down Expand Up @@ -374,11 +374,7 @@ class FieldTestModel(BaseModel):

@validator("phoneNum")
def check_phoneNumber_format(cls, v):
# regExs = ("^\(\w{3}\) \w{3}\-\w{4}$", "^\w{3}\-\w{4}$")
# for regEx in regExs:
# if not re.search(regEx, v):
# raise ValueError(f'{v!r} doesnt match phone number format')
regExs = ("\(\w{3}\) \w{3}\-\w{4}", "^\w{3}\-\w{4}$")
regExs = (r"\(\w{3}\) \w{3}\-\w{4}", r"^\w{3}\-\w{4}$")
if not re.search(regExs[0], v):
return ValueError("not match")
return v
Expand All @@ -388,7 +384,7 @@ def check_assigned(cls, v):
users_response = get_all_users()
if not users_response:
raise ValueError("get_all_users() doesnt work")
if not v in users_response["users"]:
if v not in users_response["users"]:
raise ValueError(f"{v!r} is not a registered user")
return v

Expand Down
2 changes: 2 additions & 0 deletions backend/api/blueprints/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
from ..db import db
from ..pagination import parse_pagination_params
from ..util.dict import exclude_keys

users_bp = Blueprint("users", __name__)


@users_bp.route("/users", methods=["GET"])
@auth("user")
def get_all_users():
Expand Down

0 comments on commit ed42def

Please sign in to comment.