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

Update changes to get code running on Python 3 using antlr_python3_runtime-3.1.3. #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

changeling
Copy link

These changes should bring the code up to a functional state for Python 3.8, including the retrieval of an antlr_python_runtime updated for Python 3.

Downloading the archive and executing pip install . from within the file directory of the downloaded target should, using this setup.py, install:

java2python
antlr_python3_runtime-3.1.3 (as antlr_python_runtime for dependency and antlr3 as package)
[from https://github.com/altigee/antlr-python3-runtime-3.1.3/archive/master.zip]

It's worth noting that Issue natural#62 on the upstream repo is still present, but seems to have an unincorporated fix, in PR natural#32 on that repo, that does seem to work.

`.next()` has been replaced with `next()` in Python 3. Fixed.
…)`. Updated `except` to use `as` keywords.

Replaced Python 2 `isinstance(x, file)` with Python 3 `isinstance(x, io.IOBase)`.  Fixed.
Python 3 no longer allows `file` in isinstance(), updated to use `io.IOBase`. Fixed.
Python 3 requires `as` keyword in `except`, in place of comma separator. Fixed.
`_levelNames` has been replaced with `_nameToLevel` in `logging`. Fixed.
Changed `print 'IOError: %s.' % (msg, )` to `print(f'IOError: {msg}.')`
…>>` to `file=` syntax.

Update Python 2 `print` statements to Python 3 `print()`, including `>>` to `file=` syntax.
Python 2 `print >> fd, str` syntax is now `print(str, file=fd)` in Python 3.
Implemented f-strings where relevant for these.
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.

1 participant