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

add support for python 3 #5

Merged
merged 4 commits into from
Aug 26, 2019
Merged

add support for python 3 #5

merged 4 commits into from
Aug 26, 2019

Conversation

tanjabrzak
Copy link
Contributor

@tanjabrzak tanjabrzak commented Aug 23, 2019

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

@@ -1,3 +1,6 @@
# 0.2.1
* Add Python 3 support
Copy link
Contributor

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?

Copy link
Contributor Author

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'])]
Copy link
Contributor

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

@tanjabrzak tanjabrzak merged commit 705fa75 into master Aug 26, 2019
@tanjabrzak tanjabrzak deleted the py3 branch August 26, 2019 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants