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 linting error in plots #628

Merged
merged 2 commits into from
Nov 14, 2024
Merged

fix linting error in plots #628

merged 2 commits into from
Nov 14, 2024

Conversation

marjoleinpnnl
Copy link
Contributor

No description provided.

Copy link
Contributor

@djinnome djinnome left a comment

Choose a reason for hiding this comment

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

Why does changing the name fix the linting error?

@marjoleinpnnl
Copy link
Contributor Author

Joseph figured it out. Since we had used png_data elsewhere, and it was a bytes argument then, it expected it to be a bytes (and not string) result again the second time. But svg_data is a string.

@JosephCottam
Copy link
Contributor

JosephCottam commented Nov 14, 2024

Why does changing the name fix the linting error?

The linter wants a variable to have the same type everywhere in the function/method. png_data was used earlier to hold png data (bytes), the SVG code was built via copy-paste from that branch of the if statement. Even though png_data in the SVG branch only ever held an str and even though the png and SVG branches can never both be executed, it wants the variable name to be have that consistent type. I had missed this in my prior attempts to fix it, but once I saw @marjoleinpnnl's encode based solution, it made it clear what was going on.

@marjoleinpnnl marjoleinpnnl merged commit 1ce34fd into main Nov 14, 2024
5 checks passed
@djinnome djinnome changed the title add encode fix linting error in plots Nov 14, 2024
@djinnome djinnome linked an issue Nov 14, 2024 that may be closed by this pull request
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.

Mypy error in plots.py when running the linting tests
3 participants