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

Avoid DeprecationWarning when importing OrderedDict #54

Merged
merged 2 commits into from
Feb 14, 2020
Merged
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
6 changes: 1 addition & 5 deletions flask_restx/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 1 addition & 5 deletions flask_restx/marshalling.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 1 addition & 5 deletions flask_restx/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions flask_restx/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions flask_restx/swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions flask_restx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 1 addition & 5 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 1 addition & 5 deletions tests/test_fields_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 1 addition & 5 deletions tests/test_marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down