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

Code update/pylint mypy #95

Merged
merged 8 commits into from
Dec 1, 2021
Merged

Conversation

lowtower
Copy link
Contributor

@flopp
Copy link
Owner

flopp commented Nov 30, 2021

Can I already merge this, or do you want to solve the two mypy errors first?

@lowtower
Copy link
Contributor Author

To be honest, I don't have a clue at the moment how to solve them.
Maybe someone else can jump in and help.

@flopp
Copy link
Owner

flopp commented Dec 1, 2021

Ok, I see. I guess I will merge the changes for now, as they improve the code base a lot. We will deal with the remaining cases later...

@flopp flopp merged commit d7ff0ba into flopp:main Dec 1, 2021
@lowtower lowtower deleted the code-update/pylint_mypy branch December 1, 2021 07:21
@narfel
Copy link

narfel commented Jan 7, 2022

What's the harm of specifying the encoding? It breaks windows compatibility.

@lowtower
Copy link
Contributor Author

lowtower commented Jan 7, 2022

Did a quick search in the Internet and found nothing backing your statement.
Could You please elaborate?

@narfel
Copy link

narfel commented Jan 7, 2022

I can imagine, took me a while to find that. It happens when you use the gpxpy testfiles (that are intentionally doctored) and it says: UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 530: character maps to To be honest once I figured out that specifying the encoding fixes it I didn't dig deeper as for my purposes I did not see any harm in having it there.

edit: If I remember correctly it was because of a BOM character that trips up windows when it sees or misses it. It can easily convert it when it has the specified encoding or you can do it yourself in code. But I chose the former.

@lowtower
Copy link
Contributor Author

I am not convinced that this approach is straight forward.
I don't know what the test files of gpxpy test against.
It might be that an error should be raised with a special test file to see if the package catches it ...

@narfel
Copy link

narfel commented Jan 10, 2022

It might be that an error should be raised with a special test file to see if the package catches it ...
It was and it is. Meaning there are files especially prepared with and without that header. They were created because people ran into that very problem. In some earlier commit there was a handler for the bom files and it has since been taken out, probably for similar reasons you have. All I can say in my still very limited knowledge is that it fixed my problem and I can test it against a set of test files from that lib. To be honest I chalked it up as a typical windows edge case and be done with it. That's why my initial question was what's the harm in having it?

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