-
Notifications
You must be signed in to change notification settings - Fork 108
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
Port becomes optional #92
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
import os | ||
import sys | ||
import typing | ||
from ._types import URL, Origin | ||
|
||
_LOGGER_INITIALIZED = False | ||
TRACE_LOG_LEVEL = 5 | ||
|
@@ -47,3 +48,10 @@ def trace(message: str, *args: typing.Any, **kwargs: typing.Any) -> None: | |
logger.trace = trace # type: ignore | ||
|
||
return typing.cast(Logger, logger) | ||
|
||
|
||
def url_to_origin(url: URL) -> Origin: | ||
scheme, host, explicit_port = url[:3] | ||
default_port = {b'http': 80, b'https': 443}[scheme] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was curious why Black didn't cough up on this usage of single quotes, only to realize it's not run in It's been a while since I've been around here but I assume it (and the isort check) was removed on purpose from there? Edit: OK, looks like we're planning to introduce black and flake8 back in #67 |
||
port = default_port if explicit_port is None else explicit_port | ||
return scheme, host, port |
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.
OMG thanks! 😅
The docstring above needs to be updated.