Skip to content

stdlib: More pos-only parameters to Protocols #10987

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
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stdlib/importlib/abc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if sys.version_info >= (3, 12):
def invalidate_caches(self) -> None: ...
# Not defined on the actual class, but expected to exist.
def find_spec(
self, fullname: str, path: Sequence[str] | None, target: types.ModuleType | None = ...
self, __fullname: str, __path: Sequence[str] | None, __target: types.ModuleType | None = ...
) -> ModuleSpec | None: ...

class PathEntryFinder(metaclass=ABCMeta):
Expand All @@ -84,7 +84,7 @@ else:
def invalidate_caches(self) -> None: ...
# Not defined on the actual class, but expected to exist.
def find_spec(
self, fullname: str, path: Sequence[str] | None, target: types.ModuleType | None = ...
self, __fullname: str, __path: Sequence[str] | None, __target: types.ModuleType | None = ...
) -> ModuleSpec | None: ...

class PathEntryFinder(Finder):
Expand Down
2 changes: 1 addition & 1 deletion stdlib/multiprocessing/sharedctypes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def synchronized(obj: ctypes.Array[_CT], lock: _LockLike | None = None, ctx: Any
def synchronized(obj: _CT, lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedBase[_CT]: ...

class _AcquireFunc(Protocol):
def __call__(self, block: bool = ..., timeout: float | None = ...) -> bool: ...
def __call__(self, __block: bool = ..., __timeout: float | None = ...) -> bool: ...

class SynchronizedBase(Generic[_CT]):
acquire: _AcquireFunc
Expand Down
4 changes: 2 additions & 2 deletions stdlib/smtplib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ def quotedata(data: str) -> str: ...

class _AuthObject(Protocol):
@overload
def __call__(self, challenge: None = None) -> str | None: ...
def __call__(self, __challenge: None = None) -> str | None: ...
@overload
def __call__(self, challenge: bytes) -> str: ...
def __call__(self, __challenge: bytes) -> str: ...

class SMTP:
debuglevel: int
Expand Down
4 changes: 3 additions & 1 deletion stdlib/sys/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ _OptExcInfo: TypeAlias = OptExcInfo # noqa: Y047 # TODO: obsolete, remove fall

# Intentionally omits one deprecated and one optional method of `importlib.abc.MetaPathFinder`
class _MetaPathFinder(Protocol):
def find_spec(self, fullname: str, path: Sequence[str] | None, target: ModuleType | None = ...) -> ModuleSpec | None: ...
def find_spec(
self, __fullname: str, __path: Sequence[str] | None, __target: ModuleType | None = ...
) -> ModuleSpec | None: ...

# ----- sys variables -----
if sys.platform != "win32":
Expand Down
2 changes: 1 addition & 1 deletion stdlib/tkinter/dnd.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if sys.version_info >= (3, 9):
__all__ = ["dnd_start", "DndHandler"]

class _DndSource(Protocol):
def dnd_end(self, target: Widget | None, event: Event[Misc] | None) -> None: ...
def dnd_end(self, __target: Widget | None, __event: Event[Misc] | None) -> None: ...

class DndHandler:
root: ClassVar[Tk | None]
Expand Down
2 changes: 1 addition & 1 deletion stdlib/unittest/main.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MAIN_EXAMPLES: str
MODULE_EXAMPLES: str

class _TestRunner(Protocol):
def run(self, test: unittest.suite.TestSuite | unittest.case.TestCase) -> unittest.result.TestResult: ...
def run(self, __test: unittest.suite.TestSuite | unittest.case.TestCase) -> unittest.result.TestResult: ...

# not really documented
class TestProgram:
Expand Down
3 changes: 2 additions & 1 deletion stdlib/urllib/request.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
class _HTTPConnectionProtocol(Protocol):
def __call__(
self,
host: str,
__host: str,
*,
port: int | None = ...,
timeout: float = ...,
source_address: tuple[str, int] | None = ...,
Expand Down