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

Thick Wrappers #9

Open
wants to merge 227 commits into
base: main
Choose a base branch
from
Open

Thick Wrappers #9

wants to merge 227 commits into from

Conversation

janine9vn
Copy link
Contributor

No description provided.

DavidLlanio and others added 30 commits August 28, 2023 14:56
Added Poop to README for example
Static and helper folders added. Main.py added
Created function that take binary in and spits out the ascii version
Robin5605 and others added 29 commits September 8, 2023 21:02
Parse EXIF for original image size
…c75d79'

git-subtree-dir: thick-wrappers
git-subtree-mainline: 4bae50a
git-subtree-split: a1a1bca
Copy link
Member

@swfarnsworth swfarnsworth left a comment

Choose a reason for hiding this comment

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

Hey there, Thick Wrappers! Thank you for participating in this year's code jam, and congratulations on making it this far! I've enjoyed reviewing your submission, and I hope that my comments help you improve as Python developers.

I also hope that you'll take my suggestions for improvement in stride. I am overall impressed with what you came up with, especially among a team of strangers in so short a time.

I think the project you came up with is a fun idea, and a great application of image processing and the theme. I also appreciate that contributes are reasonably balanced among all the team members.

We'll see you at the live stream!


# Iterates through each binary output and converts each binary to ASCII, simultaneously checking for the delimiter
for binary in pixel_list:
if word_total[-5:] == ",,,..":
Copy link
Member

Choose a reason for hiding this comment

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

I would expect ',,,..' to be defined once as a constant, so that you can change the delimiter in one place without having to make any other changes elsewhere in the code base.

You could also have used the str.endswith method.

delimiter = True
break
word_total += format(binary, "c")
return word_total[:-5], delimiter
Copy link
Member

Choose a reason for hiding this comment

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

Likewise, word_total[:-5] can be rewritten with a call to str.removesuffix, so that the code doesn't depend on a known length for the delimiter. It might look something like word_total.removesuffix(DELIMITER).


T = TypeVar("T", int, np.signedinteger[Any])

EXIF_MODEL_PATTERN = re.compile(r"I(?P<width>\d*)P(?P<height>\d*)P")
Copy link
Member

Choose a reason for hiding this comment

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

I love to see regular expressions with named groups 😄

Comment on lines +36 to +37
for y in range(height):
for x in range(width):
Copy link
Member

Choose a reason for hiding this comment

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

This nested loop could be flattened with itertools.product

for y, x in product(range(height), range(width)):
    ...

Comment on lines +16 to +17
This function encrypts a string in an image. Non-ASCII characters are
stripped from the string, and a copy of the image is made.
Copy link
Member

Choose a reason for hiding this comment

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

I recommend this library for converting unicode-only characters to their nearest ascii equivalent: https://pypi.org/project/Unidecode/

# GUI Contents

# Create Filepaths object to keep track of file paths
file_paths = Filepaths()
Copy link
Member

Choose a reason for hiding this comment

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

It looks like the functions above are reading this variable from the global scope. While you've written this in such a way that that won't cause any problems, it's a good practice to define global variables before any code that refers to them.

# Add static files folder
app.add_static_files("/static", "static")
# Add dark mode config
dark_mode = ui.dark_mode()
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for including dark mode 😄

Comment on lines +376 to +388
encrypt_text_button = ui.button(
"Encrypt",
on_click=lambda e: encrypt_event(
e,
dropdown_text_or_image.value,
enter_text_or_upload.value,
(
text_to_encrypt
if isinstance(text_to_encrypt, str)
else text_to_encrypt.value
),
),
)
Copy link
Member

Choose a reason for hiding this comment

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

Nice formatting here

Copy link
Member

Choose a reason for hiding this comment

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

I appreciate that you've written tests and that you're using pytest instead of unittest.


seed(a=1)
ascii = string.ascii_letters + string.digits + string.punctuation + "\n\t\r"
non_ascii = "".join(map(chr, range(128, 1000)))
Copy link
Member

Choose a reason for hiding this comment

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

Tasteful use of map. (I dislike seeing list(map(...)) or maps involving lambdas.)

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.

6 participants