Skip to content

Commit

Permalink
Linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
joaodaher committed Mar 21, 2021
1 parent 607efb8 commit 373c6fe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ disable=missing-docstring,
logging-format-interpolation,
too-many-public-methods,
too-many-locals,
too-many-return-statements,
f-string-without-interpolation,
fixme

Expand Down
2 changes: 1 addition & 1 deletion sanic_rest/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def build(cls, field_klass, required: bool) -> 'FieldInfo':
)
else:
raise RuntimeError(f"Unable to handle field class {field_klass}")
elif field_klass == Any:
elif field_klass == Any: # pylint: disable=comparison-with-callable
return FieldInfo(type='any', required=required)
else:
raise RuntimeError(f"Unable to handle field class {field_klass}")
Expand Down
4 changes: 2 additions & 2 deletions sanic_rest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ def _parse_pk(self, pk: str):
pk_field_type = self.model.Meta.fields[self.model.Meta.pk_field]
try:
return pk_field_type(pk)
except ValueError:
raise exceptions.ValidationError(f"{pk_field_name} field must be {pk_field_type.__name__}")
except ValueError as e:
raise exceptions.ValidationError(f"{pk_field_name} field must be {pk_field_type.__name__}") from e

async def get(self, request: Request, pk: str) -> HTTPResponse:
try:
Expand Down

0 comments on commit 373c6fe

Please sign in to comment.