greedo / python-xbrl

xbrl parser written in Python :bulb:
https://pypi.python.org/pypi/python-xbrl
Apache License 2.0
220 stars 76 forks source link

Remove ordereddict dependency #55

Open yosukesan opened 3 years ago

yosukesan commented 3 years ago

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:
greedo commented 2 years ago

This sounds good, happy to review the PR @yosukesan