8000 Update various comments now non-types dependencies are allowed (#9527) · python/typeshed@1a9aa3f · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a9aa3f

Browse files
authored
Update various comments now non-types dependencies are allowed (#9527)
1 parent cd56735 commit 1a9aa3f

File tree

9 files changed

+19
-16
lines changed

9 files changed

+19
-16
lines changed

stubs/D3DShot/d3dshot/capture_output.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ from typing_extensions import Literal, TypeAlias
77
from PIL import Image
88

99
_Frame: TypeAlias = Image.Image | Incomplete
10-
# TODO: Complete types once we can import non-types dependencies
11-
# See: #5768
10+
# stub_uploader doesn't allow numpy and torch because D3DShot doesn't declare it as a dependency
1211
# from torch import Tensor
13-
# from comtypes import IUnknown
1412
# import numpy.typing as npt
1513
# _Frame: TypeAlias = Image.Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | Tensor
1614

stubs/D3DShot/d3dshot/capture_outputs/numpy_capture_output.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ from typing_extensions import Literal, TypeAlias
66
from d3dshot.capture_output import CaptureOutput
77
from PIL import Image
88

9-
# TODO: Complete types once we can import non-types dependencies
10-
# See: #5768
9+
# stub_uploader doesn't allow numpy because D3DShot doesn't declare it as a dependency
1110
# import numpy as np
1211
# import numpy.typing as npt
1312
# _NDArray: TypeAlias = npt.NDArray[np.int32]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from d3dshot.capture_outputs.numpy_capture_output import NumpyCaptureOutput
22

3-
# TODO: Once we can import non-types dependencies, this CaptureOutput should be float based
4-
# See: #5768
3+
# stub_uploader doesn't allow numpy because D3DShot doesn't declare it as a dependency
4+
# this CaptureOutput should be float based
55
class NumpyFloatCaptureOutput(NumpyCaptureOutput): ...

stubs/D3DShot/d3dshot/capture_outputs/pytorch_capture_output.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ from typing_extensions import Literal, TypeAlias
66
from d3dshot.capture_output import CaptureOutput
77
from PIL import Image
88

9-
# TODO: Complete types once we can import non-types dependencies
10-
# See: https://github.com/python/typeshed/issues/5768
9+
# stub_uploader doesn't allow torch because D3DShot doesn't declare it as a dependency
1110
# from torch import Tensor
1211
_Tensor: TypeAlias = Incomplete
1312

stubs/D3DShot/d3dshot/dll/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ if sys.platform == "win32":
2020
else:
2121
_HRESULT: TypeAlias = Incomplete
2222

23-
# TODO: Use comtypes.IUnknown once we can import non-types dependencies
24-
# See: #5768
23+
# comtypes is not typed
24+
# from comtypes import IUnknown
2525
class _IUnknown(_CData):
2626
def QueryInterface(self, interface: type, iid: _CData | None = ...) -> _HRESULT: ...
2727
def AddRef(self) -> c_ulong: ...
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PIL.FpxImagePlugin
22
PIL.ImageQt.ImageQt
33
PIL.MicImagePlugin
4-
# Requires Pyside or PyQt to be installed.
4+
# Requires PySide or PyQt to be installed.
55
# We don't install either in stubtest so it can't see it
66
PIL.ImageQt.QImage
77
PIL.ImageQt.QPixmap

stubs/PyScreeze/pyscreeze/__init__.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ from PIL import Image
99
_Unused: TypeAlias = object
1010
_P = ParamSpec("_P")
1111
_R = TypeVar("_R")
12-
# TODO: cv2.Mat is not available as a type yet: https://github.com/microsoft/python-type-stubs/issues/211
12+
# TODO: cv2.Mat is not available as a type yet:
13+
# https://github.com/microsoft/python-type-stubs/issues/211
14+
# https://github.com/microsoft/python-type-stubs/tree/main/cv2
15+
# https://github.com/opencv/opencv/pull/20370
1316
# cv2.Mat is just an alias for a numpy NDArray, but can't import that either.
17+
# Because pyscreeze does not declare it as a dependency, stub_uploader won't let it.
1418
_Mat: TypeAlias = Incomplete
1519

1620
useOpenCV: bool
@@ -37,6 +41,7 @@ class RGB(NamedTuple):
3741
class PyScreezeException(Exception): ...
3842
class ImageNotFoundException(PyScreezeException): ...
3943

44+
# _locateAll_opencv
4045
def requiresPillow(wrappedFunction: Callable[_P, _R]) -> Callable[_P, _R]: ...
4146
@overload
4247
def locate(

stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
# Partial typing of the vendored modulegraph package.
2+
# We reference the vendored package rather than depending on the original untyped module.
3+
# Anything not referenced in the PyInstaller stubs doesn't need to be added here.
4+
15
from typing import Any, Protocol
26

37
class _SupportsGraphident(Protocol):
48
graphident: str
59

6-
# TODO: For typing purposes, once #5768 is complete, it'll be easier to use the modulegraph package directly.
7-
810
# code, filename and packagepath are always initialized to None. But they can be given a value later.
911
class Node:
1012
# Compiled code. See stdlib.builtins.compile

tests/mypy_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def run_mypy(
264264
# Stub completion is checked by pyright (--allow-*-defs)
265265
"--allow-untyped-defs",
266266
"--allow-incomplete-defs",
267-
"--allow-subclassing-any", # TODO: Do we still need this now that non-types dependencies are allowed? (#5768)
267+
"--allow-subclassing-any", # See #9491
268268
"--enable-error-code",
269269
"ignore-without-code",
270270
"--config-file",

0 commit comments

Comments
 (0)
0