diff --git a/flask_restx/api.py b/flask_restx/api.py index d8e0d3a2..f66f3653 100644 --- a/flask_restx/api.py +++ b/flask_restx/api.py @@ -10,11 +10,7 @@ import six import sys -try: - from collections.abc import OrderedDict -except ImportError: - # TODO Remove this to drop Python2 support - from collections import OrderedDict +from collections import OrderedDict from functools import wraps, partial from types import MethodType diff --git a/flask_restx/marshalling.py b/flask_restx/marshalling.py index 899e86df..3d435d0b 100644 --- a/flask_restx/marshalling.py +++ b/flask_restx/marshalling.py @@ -1,11 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -try: - from collections.abc import OrderedDict -except ImportError: - # TODO Remove this to drop Python2 support - from collections import OrderedDict +from collections import OrderedDict from functools import wraps from six import iteritems diff --git a/flask_restx/mask.py b/flask_restx/mask.py index ee61669d..e4c1670c 100644 --- a/flask_restx/mask.py +++ b/flask_restx/mask.py @@ -5,11 +5,7 @@ import re import six -try: - from collections.abc import OrderedDict -except ImportError: - # TODO Remove this to drop Python2 support - from collections import OrderedDict +from collections import OrderedDict from inspect import isclass from .errors import RestError diff --git a/flask_restx/model.py b/flask_restx/model.py index cbe1a3cf..6da9dbcd 100644 --- a/flask_restx/model.py +++ b/flask_restx/model.py @@ -5,11 +5,12 @@ import re import warnings +from collections import OrderedDict try: - from collections.abc import OrderedDict, MutableMapping + from collections.abc import MutableMapping except ImportError: # TODO Remove this to drop Python2 support - from collections import OrderedDict, MutableMapping + from collections import MutableMapping from six import iteritems, itervalues from werkzeug.utils import cached_property diff --git a/flask_restx/swagger.py b/flask_restx/swagger.py index c02feb44..c43ac818 100644 --- a/flask_restx/swagger.py +++ b/flask_restx/swagger.py @@ -5,11 +5,12 @@ import re from inspect import isclass, getdoc +from collections import OrderedDict try: - from collections.abc import OrderedDict, Hashable + from collections.abc import Hashable except ImportError: # TODO Remove this to drop Python2 support - from collections import OrderedDict, Hashable + from collections import Hashable from six import string_types, itervalues, iteritems, iterkeys from flask import current_app diff --git a/flask_restx/utils.py b/flask_restx/utils.py index a094d2dd..9ec17721 100644 --- a/flask_restx/utils.py +++ b/flask_restx/utils.py @@ -3,11 +3,7 @@ import re -try: - from collections.abc import OrderedDict -except ImportError: - # TODO Remove this to drop Python2 support - from collections import OrderedDict +from collections import OrderedDict from copy import deepcopy from six import iteritems diff --git a/tests/test_fields.py b/tests/test_fields.py index cb145bc4..9b7f9912 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -1,11 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -try: - from collections.abc import OrderedDict -except ImportError: - # TODO Remove this to drop Python2 support - from collections import OrderedDict +from collections import OrderedDict from datetime import date, datetime from decimal import Decimal from functools import partial diff --git a/tests/test_fields_mask.py b/tests/test_fields_mask.py index 74894678..fdd19cd9 100644 --- a/tests/test_fields_mask.py +++ b/tests/test_fields_mask.py @@ -4,11 +4,7 @@ import json import pytest -try: - from collections.abc import OrderedDict -except ImportError: - # TODO Remove this to drop Python2 support - from collections import OrderedDict +from collections import OrderedDict from flask_restx import mask, Api, Resource, fields, marshal, Mask diff --git a/tests/test_marshalling.py b/tests/test_marshalling.py index 8c339471..3ff8737a 100644 --- a/tests/test_marshalling.py +++ b/tests/test_marshalling.py @@ -7,11 +7,7 @@ marshal, marshal_with, marshal_with_field, fields, Api, Resource ) -try: - from collections.abc import OrderedDict -except ImportError: - # TODO Remove this to drop Python2 support - from collections import OrderedDict +from collections import OrderedDict # Add a dummy Resource to verify that the app is properly set. diff --git a/tests/test_model.py b/tests/test_model.py index d683bf81..52a69343 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -4,11 +4,7 @@ import copy import pytest -try: - from collections.abc import OrderedDict -except ImportError: - # TODO Remove this to drop Python2 support - from collections import OrderedDict +from collections import OrderedDict from flask_restx import fields, Model, OrderedModel, SchemaModel