flask-restplus
flask-restplus copied to clipboard
Invalid import of OrderedDict from collections.abc
OrderedDict
should be imported from collections
instead of collections.abc
.
For example:
https://github.com/noirbizarre/flask-restplus/blob/9232e1a6599621e97223e1915c9b414c92faf2cc/flask_restplus/model.py#L8-L12
When trying to import it gives the following error:
>>> from collections.abc import OrderedDict
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'OrderedDict' from 'collections.abc'
I have manually tested it on Python versions: 2.7, 3.4, 3.5, 3.6, 3.7 and 3.8.
The current code is not failing because of the try-except
.
For tracking purposes, this change was made on PR https://github.com/noirbizarre/flask-restplus/pull/732 and is related to issue https://github.com/noirbizarre/flask-restplus/issues/727.
Can I submit a PR to solve this issue?
Indeed you are right, OrderedDict is not an abstract base class and is not within collections.abc as stated in python documentation. I can also submit a PR to fix my initial mistake.
Thanks for the comment @Colin-b, I would like to submit a PR to solve this issue as my first contribution to the project, if you don't mind!? :grin: