Skip to content

Commit 3582c84

Browse files
authored
Merge pull request #54 from kbevers/fix-ordereddict-import
Avoid DeprecationWarning when importing OrderedDict
2 parents ae9aa33 + 6b253c0 commit 3582c84

File tree

10 files changed

+14
-44
lines changed

10 files changed

+14
-44
lines changed

flask_restx/api.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
import six
1111
import sys
1212

13-
try:
14-
from collections.abc import OrderedDict
15-
except ImportError:
16-
# TODO Remove this to drop Python2 support
17-
from collections import OrderedDict
13+
from collections import OrderedDict
1814
from functools import wraps, partial
1915
from types import MethodType
2016

flask_restx/marshalling.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import unicode_literals
33

4-
try:
5-
from collections.abc import OrderedDict
6-
except ImportError:
7-
# TODO Remove this to drop Python2 support
8-
from collections import OrderedDict
4+
from collections import OrderedDict
95
from functools import wraps
106
from six import iteritems
117

flask_restx/mask.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
import re
66
import six
77

8-
try:
9-
from collections.abc import OrderedDict
10-
except ImportError:
11-
# TODO Remove this to drop Python2 support
12-
from collections import OrderedDict
8+
from collections import OrderedDict
139
from inspect import isclass
1410

1511
from .errors import RestError

flask_restx/model.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
import re
66
import warnings
77

8+
from collections import OrderedDict
89
try:
9-
from collections.abc import OrderedDict, MutableMapping
10+
from collections.abc import MutableMapping
1011
except ImportError:
1112
# TODO Remove this to drop Python2 support
12-
from collections import OrderedDict, MutableMapping
13+
from collections import MutableMapping
1314
from six import iteritems, itervalues
1415
from werkzeug.utils import cached_property
1516

flask_restx/swagger.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
import re
66

77
from inspect import isclass, getdoc
8+
from collections import OrderedDict
89
try:
9-
from collections.abc import OrderedDict, Hashable
10+
from collections.abc import Hashable
1011
except ImportError:
1112
# TODO Remove this to drop Python2 support
12-
from collections import OrderedDict, Hashable
13+
from collections import Hashable
1314
from six import string_types, itervalues, iteritems, iterkeys
1415

1516
from flask import current_app

flask_restx/utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33

44
import re
55

6-
try:
7-
from collections.abc import OrderedDict
8-
except ImportError:
9-
# TODO Remove this to drop Python2 support
10-
from collections import OrderedDict
6+
from collections import OrderedDict
117
from copy import deepcopy
128
from six import iteritems
139

tests/test_fields.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import unicode_literals
33

4-
try:
5-
from collections.abc import OrderedDict
6-
except ImportError:
7-
# TODO Remove this to drop Python2 support
8-
from collections import OrderedDict
4+
from collections import OrderedDict
95
from datetime import date, datetime
106
from decimal import Decimal
117
from functools import partial

tests/test_fields_mask.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
import json
55
import pytest
66

7-
try:
8-
from collections.abc import OrderedDict
9-
except ImportError:
10-
# TODO Remove this to drop Python2 support
11-
from collections import OrderedDict
7+
from collections import OrderedDict
128

139
from flask_restx import mask, Api, Resource, fields, marshal, Mask
1410

tests/test_marshalling.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
marshal, marshal_with, marshal_with_field, fields, Api, Resource
88
)
99

10-
try:
11-
from collections.abc import OrderedDict
12-
except ImportError:
13-
# TODO Remove this to drop Python2 support
14-
from collections import OrderedDict
10+
from collections import OrderedDict
1511

1612

1713
# Add a dummy Resource to verify that the app is properly set.

tests/test_model.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
import copy
55
import pytest
66

7-
try:
8-
from collections.abc import OrderedDict
9-
except ImportError:
10-
# TODO Remove this to drop Python2 support
11-
from collections import OrderedDict
7+
from collections import OrderedDict
128

139
from flask_restx import fields, Model, OrderedModel, SchemaModel
1410

0 commit comments

Comments
 (0)