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

Fix up encoding and avoid encode-decode waste. Resolves #82 #86

Merged
merged 2 commits into from
Oct 5, 2023

Conversation

alexaryn
Copy link
Contributor

@alexaryn alexaryn commented Oct 5, 2023

No description provided.

Comment on lines -51 to +59
element.binary_representation = dict.pop("text")
element.text_representation = str(element.binary_representation)
element.binary_representation = binary
element.text_representation = text
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. It actually looks like the type of element.binary_representation is wrong. It is Optional[str], but I think it should be Optional[bytes]. Document has it right, so I'm guessing this is just an oversight. @bohou-aryn just confirming there's not a reason you know of? I noticed b/c this is failing type checking since you have correctly assigned bytes.

Copy link
Contributor

Choose a reason for hiding this comment

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

(to be clear, the issue I'm referring to is not in the code here, but in the definition of the Element class).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes total sense. That's what I get for only running 2 of the 3 linters locally. We should get Poetry to run all the linters in one command.

Copy link
Contributor

Choose a reason for hiding this comment

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

poetry run pre-commit run --all-files should run all the linters, though there are some issues running mypy in pre-commit that I haven't been able to figure out (#83). In the meantime poetry run mypy --install-types . should run mypy in the most reliable way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know about that type change, mostly the reason should just be a typo when restructuring. Didn't we decide to only keep the bytes representation? this is postponed to future fix?

@alexaryn alexaryn merged commit fee43fb into main Oct 5, 2023
10 checks passed
@alexaryn alexaryn deleted the fix_encode branch October 5, 2023 17:31
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.

3 participants