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

platform(general): trim API urls #3460

Merged
merged 2 commits into from
Sep 4, 2022
Merged

platform(general): trim API urls #3460

merged 2 commits into from
Sep 4, 2022

Conversation

mikeurbanski1
Copy link
Contributor

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:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Contributor

@gruebel gruebel left a 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 🙂

@gruebel gruebel changed the title fix: trim API urls platform(general): trim API urls Sep 3, 2022
Comment on lines +28 to +36
@overload
def normalize_bc_url(url: None) -> None:
...


@overload
def normalize_bc_url(url: str) -> str:
...

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

cool!

@gruebel gruebel merged commit 153f83e into master Sep 4, 2022
@gruebel gruebel deleted the trim-api-url branch September 4, 2022 18:42
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.

4 participants