-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
platform(general): trim API urls #3460
Conversation
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 fixed the mypy
issue for you 🙂
@overload | ||
def normalize_bc_url(url: None) -> None: | ||
... | ||
|
||
|
||
@overload | ||
def normalize_bc_url(url: str) -> str: | ||
... | ||
|
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.
HI! I
never saw such a using of overload.
can you please share why those 2 function are necessary?
it seem that the third one is enough
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.
the @overload
functionality in Python is only for typing purposes. It gives a possibility to differentiate between what kind of types go in and what to what should come out. In this example it is clear, if None
goes in, None
should come out, same for str
.
If you don't add the @overload
annotation, then the type checker will assume that either str
or None
could return, which can be ok, but then you have handle it downstream and always check, if it is not None
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.
cool!
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description
Trims the BC and Prisma API URL inputs.
Checklist: