-
Notifications
You must be signed in to change notification settings - Fork 2
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
add support for python 3 #5
Conversation
@@ -1,3 +1,6 @@ | |||
# 0.2.1 | |||
* Add Python 3 support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we adding python 3 support or replacing 2 with 3? New code won't work with Python 2, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will work with both py2 and py3
|
||
class EPTRNParser(Parser): | ||
def __init__(self, config_file=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'config/eptrn.yml')): | ||
super(self.__class__, self).__init__() | ||
|
||
self.eptrn_config = load(open(config_file))['DETAIL_RECORD'] | ||
self.section_types = [v for k, v in self.eptrn_config['TYPE_MAPPING'].iteritems()] | ||
self.section_types = [v for k, v in iteritems(self.eptrn_config['TYPE_MAPPING'])] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this errors in python 2
>>> iteritems({})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'iteritems' is not defined
Some basic changes for supporting relative imports in Python 3, removed leading zero which is not supported in Python 3, added support for dict.iteritems