Skip to content

Commit

Permalink
fix lint errors when comparing types with == instead of is
Browse files Browse the repository at this point in the history
  • Loading branch information
terencehonles committed Sep 7, 2023
1 parent 5f889de commit b66af4c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/drf_yasg/inspectors/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,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

0 comments on commit b66af4c

Please sign in to comment.