diff --git a/src/drf_yasg/inspectors/field.py b/src/drf_yasg/inspectors/field.py index 9b767a8e..5be41cf3 100644 --- a/src/drf_yasg/inspectors/field.py +++ b/src/drf_yasg/inspectors/field.py @@ -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 diff --git a/src/drf_yasg/openapi.py b/src/drf_yasg/openapi.py index 0a2cfb8f..788822cb 100644 --- a/src/drf_yasg/openapi.py +++ b/src/drf_yasg/openapi.py @@ -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): @@ -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 type(self) is not _Ref, "do not instantiate _Ref directly" ref_name = "#/{scope}/{name}".format(scope=scope, name=name) if not ignore_unresolved: obj = resolver.get(name, scope) diff --git a/src/drf_yasg/utils.py b/src/drf_yasg/utils.py index 494ce48c..fd444c47 100644 --- a/src/drf_yasg/utils.py +++ b/src/drf_yasg/utils.py @@ -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: # noqa: E721 s = '' + s # Remove common indentation to get the correct Markdown rendering