Skip to content

Adopt code for Python 3 interpreter#4

Open
dlemenkov wants to merge 1 commit into
yandex:masterfrom
dlemenkov:master
Open

Adopt code for Python 3 interpreter#4
dlemenkov wants to merge 1 commit into
yandex:masterfrom
dlemenkov:master

Conversation

@dlemenkov

Copy link
Copy Markdown

Adopt the code to support interpretation with Python 3.

  1. Use from __future__ import print_function.
  2. Change print ... to print(..., file=..., end=...).
  3. Remove unused or obsolete imports, add missing ones, fix wrong twos.
  4. Use b'...' format for binary string literals.
  5. Use // for integer divisions.
  6. Use for key in dictionary: ... format to iterate over dictionaries.
  7. Use for key, value in dictionary.items(): ... format to iterate over dictionaries with key-value pairs being used.
  8. Add a Python 2 & 3 compatible filtering of non-printable characters.
  9. Fix a typo in /litesession.py: prevseq --> prev_seq.
  10. Fix a type testing in /printing.py: t is float --> type(t) is float.
  11. Remove fixed_parse_opts function, use original dptk.tcp.parse_opts instead. The one has been fixed in [patch] dpkt.tcp.parse_opts() infinite-loops on a 0-length option kbandla/dpkt#139.

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.
@dlemenkov

Copy link
Copy Markdown
Author

Implements issue #3.

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