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

fix lint errors with type comparison #868

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/drf_yasg/inspectors/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def get_queryset_from_view(view, serializer=None):

if queryset is not None and serializer is not None:
# make sure the view is actually using *this* serializer
assert type(serializer) == call_view_method(view, 'get_serializer_class', 'serializer_class')
assert type(serializer) is call_view_method(view, 'get_serializer_class', 'serializer_class')

return queryset
except Exception: # pragma: no cover
Expand Down
4 changes: 2 additions & 2 deletions src/drf_yasg/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class SwaggerDict(OrderedDict):
def __init__(self, **attrs):
super(SwaggerDict, self).__init__()
self._extras__ = attrs
if type(self) == SwaggerDict:
if type(self) is SwaggerDict:
self._insert_extras__()

def __setattr__(self, key, value):
Expand Down Expand Up @@ -516,7 +516,7 @@ def __init__(self, resolver, name, scope, expected_type, ignore_unresolved=False
:param bool ignore_unresolved: do not throw if the referenced object does not exist
"""
super(_Ref, self).__init__()
assert not type(self) == _Ref, "do not instantiate _Ref directly"
assert not type(self) is _Ref, "do not instantiate _Ref directly"
ref_name = "#/{scope}/{name}".format(scope=scope, name=name)
if not ignore_unresolved:
obj = resolver.get(name, scope)
Expand Down
2 changes: 1 addition & 1 deletion src/drf_yasg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def force_real_str(s, encoding='utf-8', strings_only=False, errors='strict'):
"""
if s is not None:
s = force_str(s, encoding, strings_only, errors)
if type(s) != str:
if type(s) is not str:
s = '' + s

# Remove common indentation to get the correct Markdown rendering
Expand Down