Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Update numpy and 5768 comments
  • Loading branch information
Avasam committed Jan 14, 2023
commit 8c2613f098a340d9740a2cd1335ec36bcd445413
4 changes: 1 addition & 3 deletions stubs/D3DShot/d3dshot/capture_output.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ from typing_extensions import Literal, TypeAlias
from PIL import Image

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ from typing_extensions import Literal, TypeAlias
from d3dshot.capture_output import CaptureOutput
from PIL import Image

# TODO: Complete types once we can import non-types dependencies
# See: #5768
# stub_uploader doesn't allow numpy because D3DShot doesn't declare it as a dependency
# import numpy as np
# import numpy.typing as npt
# _NDArray: TypeAlias = npt.NDArray[np.int32]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from d3dshot.capture_outputs.numpy_capture_output import NumpyCaptureOutput

# TODO: Once we can import non-types dependencies, this CaptureOutput should be float based
# See: #5768
# stub_uploader doesn't allow numpy because D3DShot doesn't declare it as a dependency
# this CaptureOutput should be float based
class NumpyFloatCaptureOutput(NumpyCaptureOutput): ...
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ from typing_extensions import Literal, TypeAlias
from d3dshot.capture_output import CaptureOutput
from PIL import Image

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

Expand Down
4 changes: 2 additions & 2 deletions stubs/D3DShot/d3dshot/dll/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ if sys.platform == "win32":
else:
_HRESULT: TypeAlias = Incomplete

# TODO: Use comtypes.IUnknown once we can import non-types dependencies
# See: #5768
# comtypes is not typed
# from comtypes import IUnknown
class _IUnknown(_CData):
def QueryInterface(self, interface: type, iid: _CData | None = ...) -> _HRESULT: ...
def AddRef(self) -> c_ulong: ...
Expand Down
7 changes: 6 additions & 1 deletion stubs/PyScreeze/pyscreeze/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ from PIL import Image
_Unused: TypeAlias = object
_P = ParamSpec("_P")
_R = TypeVar("_R")
# TODO: cv2.Mat is not available as a type yet: https://github.com/microsoft/python-type-stubs/issues/211
# TODO: cv2.Mat is not available as a type yet:
# https://github.com/microsoft/python-type-stubs/issues/211
# https://github.com/microsoft/python-type-stubs/tree/main/cv2
# https://github.com/opencv/opencv/pull/20370
# cv2.Mat is just an alias for a numpy NDArray, but can't import that either.
# Because pyscreeze does not declare it as a dependency, stubsuploader won't let it.
Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
_Mat: TypeAlias = Incomplete

useOpenCV: bool
Expand All @@ -37,6 +41,7 @@ class RGB(NamedTuple):
class PyScreezeException(Exception): ...
class ImageNotFoundException(PyScreezeException): ...

# _locateAll_opencv
def requiresPillow(wrappedFunction: Callable[_P, _R]) -> Callable[_P, _R]: ...
@overload
def locate(
Expand Down
2 changes: 1 addition & 1 deletion stubs/pycocotools/pycocotools/coco.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from typing_extensions import Literal, TypeAlias, TypedDict

from . import _EncodedRLE

# TODO: Use numpy types when #5768 is resolved.
# stub_uploader doesn't allow numpy because pycocotools doesn't declare it as a dependency
# import numpy as np
# import numpy.typing as npt

Expand Down
2 changes: 1 addition & 1 deletion stubs/pycocotools/pycocotools/cocoeval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from typing_extensions import Literal, TypeAlias, TypedDict

from .coco import COCO

# TODO: Use numpy types when #5768 is resolved.
# stub_uploader doesn't allow numpy because pycocotools doesn't declare it as a dependency
# import numpy as np
# import numpy.typing as npt

Expand Down
2 changes: 1 addition & 1 deletion stubs/pycocotools/pycocotools/mask.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from typing_extensions import TypeAlias

from . import _EncodedRLE

# TODO: Use numpy types when #5768 is resolved.
# stub_uploader doesn't allow numpy because pycocotools doesn't declare it as a dependency
# import numpy as np
# import numpy.typing as npt

Expand Down
6 changes: 4 additions & 2 deletions stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Partial typing of the vendored modulegraph package.
# We reference the vendored package rather than depending on the original untyped module.
# Anything not referenced in the PyInstaller stubs doesn't need to be added here.

from typing import Any, Protocol

class _SupportsGraphident(Protocol):
graphident: str

# TODO: For typing purposes, once #5768 is complete, it'll be easier to use the modulegraph package directly.

# code, filename and packagepath are always initialized to None. But they can be given a value later.
class Node:
# Compiled code. See stdlib.builtins.compile
Expand Down
2 changes: 1 addition & 1 deletion tests/mypy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def run_mypy(
# Stub completion is checked by pyright (--allow-*-defs)
"--allow-untyped-defs",
"--allow-incomplete-defs",
"--allow-subclassing-any", # TODO: Do we still need this now that non-types dependencies are allowed? (#5768)
"--allow-subclassing-any", # See #9491

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If #9491 is accepted, then this line will be removed. If not then this links to the discussion/decision.

"--enable-error-code",
"ignore-without-code",
"--config-file",
Expand Down