Skip to content

Added stub for urllib.request.proxy_bypass() - #3283

Merged
srittau merged 24 commits into
python:masterfrom
jolaf:proxy_bypass
Sep 30, 2019
Merged

srittau merged 24 commits into
python:masterfrom
jolaf:proxy_bypass

Conversation

@jolaf

@jolaf jolaf commented Sep 30, 2019

Copy link
Copy Markdown
Contributor

Fix for #3282

jolaf and others added 24 commits March 11, 2019 15:11
Make vars arguments Optional, as they default to None (#2853)
Missing return values added;
A lot of parameters have been made Optional, according to documentation;
translation() stub improved by using @overload
Sequence replaced with Container

Co-Authored-By: Sebastian Rittau <[email protected]>
Sequence replaced with Iterable

Co-Authored-By: Sebastian Rittau <[email protected]>
def getproxies() -> Dict[str, str]: ...
def parse_http_list(s: str) -> List[str]: ...
def parse_keqv_list(l: List[str]) -> Dict[str, str]: ...
def proxy_bypass(host: str) -> Any: ... # Undocumented

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Returns int as far as I can see (probably in place of a bool).

@jolaf jolaf Sep 30, 2019 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes it returns int (0 or 1).

However docstring specifies: Return True, if host should be bypassed.

The actual usage of the function in the module shows the typical usage like if proxy_bypass(...):.

This lead me to conclusion that Any is the proper return type, as it allows bool-like checks and doesn't specify the return type precisely which could produce warnings in runtime type checkers like typeguard.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sounds reasonable.

@srittau
srittau merged commit aaff561 into python:master Sep 30, 2019
@jolaf
jolaf deleted the proxy_bypass branch September 30, 2019 17:27
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.

2 participants