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

Convert to Python 3 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Convert to Python 3 #3

wants to merge 1 commit into from

Conversation

Oliv4945
Copy link

@Oliv4945 Oliv4945 commented May 7, 2024

Hello @antdking, thank you for this software, it is still useful today!

But, as Python 2 has been deprecated for some time now, I updated it to Python3, I hope that it could help others.

Copy link
Member

@antdking antdking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. So you know, I won't be testing these changes, but the changes shouldn't result in a behaviour change.

@@ -17,12 +17,12 @@
# limitations under the License.
#

from __future__ import print_function
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be left in, it's fine in py3.

import binascii
import os
import struct
import sys
import hashlib
import math

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These imports are unused

@@ -55,7 +55,9 @@ def get_kernel_size(image_name):

def bumped(image_data):
d = binascii.hexlify(image_data[-1024:])
return d.endswith(lg_magic) or d.startswith(lg_magic)
print(type(d))
print(lg_magic.encode("ASCII"), type(lg_magic.encode("ASCII")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this change, lg_magic can be changed to be a byte string on line 38 (b"41....").

It's other uses will accept it

@@ -98,9 +103,11 @@ def pad_image(image_name):
i = num_pages - 1
f_image.seek(0, 0)
while i >= 0:
print("page size", page_size, type(page_size))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is likely going to be very noisy, so best to remove

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.

None yet

2 participants