greedo / python-xbrl

xbrl parser written in Python :bulb:

Home Page:https://pypi.python.org/pypi/python-xbrl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove ordereddict dependency

yosukesan opened this issue · comments

Ordereddict was used before collections was introduced at Python 2.7. Since Python 2 is no longer supported I feel it's probably safe to remove. Python 2.6 or older users may have trouble. If you are happy, I will send a pull request.

To change following should be enough.

diff --git a/setup.py b/setup.py
index 9b1bada..ec9ecc3 100644
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@ setup(
     keywords='xbrl, Financial, Accounting, file formats',
     packages=['xbrl'],
     install_requires=['pytest', 'pep8', 'marshmallow',
-    'beautifulsoup4', 'ordereddict', 'lxml', 'six'],
+    'beautifulsoup4', 'lxml', 'six'],
     classifiers=[
         'Intended Audience :: Developers',
         'Natural Language :: English',
diff --git a/xbrl/xbrl.py b/xbrl/xbrl.py
index b93f8e8..ff4087a 100644
--- a/xbrl/xbrl.py
+++ b/xbrl/xbrl.py
@@ -4,7 +4,7 @@
 import re
 from marshmallow import Schema, fields
 import datetime
-import collections
+import collections as odict
 import six
 import logging
 
@@ -13,12 +13,6 @@ try:
 except ImportError:
     from io import StringIO
 
-if 'OrderedDict' in dir(collections):
-    odict = collections
-else:
-    import ordereddict as odict
-
-
 def soup_maker(fh):
     """ Takes a file handler returns BeautifulSoup"""
     try:

This sounds good, happy to review the PR @yosukesan