Uh oh!
There was an error while loading. Please reload this page.
fix(types): get the os.PathLike type as correctly as possible - #1227
Conversation
This should make our internal PathLike type compatible with Python < 3.6 and < 3.9.
muggenhor
commented
Apr 23, 2021
Switched away from |
Byron
commented
Apr 23, 2021
Thanks, very elegant! I find it interesting that all PathLike types seem to use |
muggenhor
commented
Apr 23, 2021
FYI: this is the type annotation definition of |
muggenhor
commented
Apr 24, 2021
Hmm. Does that mean you think it should accept |
I would refrain from doing anything that reduces convenience or being idiomatic or that is breaking just to gain correctness. To me the whole encoding topic in GitPython is a lost cause as correctness could (to my mind) only be achieved if the API doesn't use strings (with encoding) to handle them. And by the looks of it, it's idiomatic to do that, too: # py 3.8>>> type(os.listdir('.')[0])
<class'str'>Edit: On the bright side, I believe just today I had an epiphany which helps me to see a future for GitPython, leveraging it as a strength and not seeing it as a burden. So I hope this will change my mindset too when helping to maintain it in the midterm until such a future can be realized. |
This should make our internal PathLike type compatible with Python < 3.6 and < 3.9.
Fixes#1219