-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Review SupportsInt
and SupportsFloat
usages in 3rd-party stubs
#11003
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
Merged
srittau
merged 9 commits into
python:main
from
Avasam:ConvertibleToInt-ConvertibleToFloat-3rd-party
Dec 18, 2023
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ca03c2d
Use `ConvertibleToInt` and `ConvertibleToFloat` in 3rd-party stubs
Avasam b65042d
Missed import conversions in openpyxl
Avasam 34157d8
Update stubs/PyAutoGUI/pyautogui/__init__.pyi
Avasam e9a7a6e
Missed import conversions in openpyxl
Avasam a2677b4
Merge branch 'ConvertibleToInt-ConvertibleToFloat-3rd-party' of https…
Avasam 6931158
Revert "Direct Union replacements for ConvertibleToInt/ConvertibleToF…
Avasam d6c5b3e
Merge branch 'main' of https://github.com/python/typeshed into Conver…
Avasam 60bd401
Undo some overly-aggressive changes (PR comments)
Avasam dd1f359
Merge branch 'main' of https://github.com/python/typeshed into Conver…
Avasam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from _typeshed import Incomplete, Unused | ||
from _typeshed import ConvertibleToInt, Incomplete, Unused | ||
from abc import abstractmethod | ||
from collections.abc import Iterable, Iterator | ||
from typing import SupportsInt, overload | ||
|
@@ -71,9 +71,9 @@ class IPAddress(BaseIP): | |
def ipv4(self) -> Self: ... | ||
def ipv6(self, ipv4_compatible: bool = False) -> Self: ... | ||
def format(self, dialect: type[ipv6_verbose] | None = None) -> str: ... | ||
def __or__(self, other: str | SupportsInt | SupportsIndex) -> Self: ... | ||
def __and__(self, other: str | SupportsInt | SupportsIndex) -> Self: ... | ||
def __xor__(self, other: str | SupportsInt | SupportsIndex) -> Self: ... | ||
def __or__(self, other: SupportsInt | SupportsIndex) -> Self: ... | ||
def __and__(self, other: SupportsInt | SupportsIndex) -> Self: ... | ||
def __xor__(self, other: SupportsInt | SupportsIndex) -> Self: ... | ||
def __lshift__(self, numbits: int) -> Self: ... | ||
def __rshift__(self, numbits: int) -> Self: ... | ||
def __bool__(self) -> bool: ... | ||
|
@@ -148,7 +148,7 @@ class IPRange(BaseIP, IPListMixin): | |
def cidrs(self) -> list[IPNetwork]: ... | ||
|
||
def iter_unique_ips(*args: IPRange | _IPNetworkAddr) -> Iterator[IPAddress]: ... | ||
def cidr_abbrev_to_verbose(abbrev_cidr: str | SupportsInt | SupportsIndex) -> str: ... | ||
def cidr_abbrev_to_verbose(abbrev_cidr: ConvertibleToInt) -> str: ... | ||
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. This change seems reasonable to me; the function at runtime is deliberately very permissive in what it accepts |
||
def cidr_merge(ip_addrs: Iterable[IPRange | _IPNetworkAddr]) -> list[IPNetwork]: ... | ||
def cidr_exclude(target: _IPNetworkAddr, exclude: _IPNetworkAddr) -> list[IPNetwork]: ... | ||
def cidr_partition( | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This seems like a good change, since the
.value
property is explicitly there in order to transformstr
,bytes
objects etc. intoint
before they're stored on theEUI
instance