-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Replaced overload with AnyStr or Union type in os/path module #443
Conversation
@overload | ||
def ismount(path: str) -> bool: pass | ||
@overload | ||
def ismount(path: bytes) -> bool: pass | ||
@overload | ||
def join(path: str, *paths: str) -> str: pass | ||
@overload | ||
def join(path: bytes, *paths: bytes) -> bytes: pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure what to do with these. Currently, everything is either bytes
or str
; replacing with Union would make combinations possible as well.
I think |
Yeah, union types can't always be used here.
This can be written equivalent like this:
Note that this also gets the return type right. Sorry that this is not properly documented yet. I need to update the documentation to include all the new cool features. @spkersten Did the the above explanation make sense? |
Ok, it's clear what needs to be done. For my understanding: How does |
@spkersten
The function is generic since there is a reference to a (free) type variable in the signature. The function is valid for an arbitrary type
Now, let's get back to
This means that |
Clear explanation. Thanks. |
It looks to me like the Travis is failing now due to #360. I'll see if I can fix that first. |
Now that #360 is fixed, this PR now seems good. Thanks for refactoring this! |
Replaced overload with AnyStr or Union type in os/path module
Resolves #436