Adopt code for Python 3 interpreter#4
Open
dlemenkov wants to merge 1 commit into
Open
Conversation
Adopt the code to support interpretation with Python 3.
1. Use `from __future__ import print_function`.
1. Change `print ...` to `print(..., file=..., end=...)`.
1. Remove unused or obsolete imports, add missing ones, fix wrong twos.
1. Use `b'...'` format for binary string literals.
1. Use `//` for integer divisions.
1. Use `for key in dictionary: ...` format to iterate over dictionaries.
1. Use `for key, value in dictionary.items(): ...` format to iterate
over dictionaries with key-value pairs being used.
1. Add a Python 2 & 3 compatible filtering of non-printable characters.
1. Fix a typo in `/litesession.py`: `prevseq` --> `prev_seq`.
1. Fix a type testing in `/printing.py`:
`t is float` --> `type(t) is float`.
1. Remove `fixed_parse_opts` function, use original
`dptk.tcp.parse_opts` instead. The one has been fixed in
kbandla/dpkt#139.
Author
|
Implements issue #3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adopt the code to support interpretation with Python 3.
from __future__ import print_function.print ...toprint(..., file=..., end=...).b'...'format for binary string literals.//for integer divisions.for key in dictionary: ...format to iterate over dictionaries.for key, value in dictionary.items(): ...format to iterate over dictionaries with key-value pairs being used./litesession.py:prevseq-->prev_seq./printing.py:t is float-->type(t) is float.fixed_parse_optsfunction, use originaldptk.tcp.parse_optsinstead. The one has been fixed in [patch] dpkt.tcp.parse_opts() infinite-loops on a 0-length option kbandla/dpkt#139.