Skip to content

Commit b7793e8

Browse files
committed
Try fixing missing pillow types
1 parent 642d58b commit b7793e8

12 files changed

+28
-29
lines changed

stubs/D3DShot/METADATA.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version = "0.1.*"
2-
requires = ["numpy", "torch", "comtypes"]
2+
requires = ["types-Pillow"]
33

44
[tool.stubtest]
55
ignore_missing_stub = false

stubs/D3DShot/d3dshot/capture_output.pyi

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import enum
22
from _typeshed import Incomplete
33
from typing_extensions import TypeAlias
44

5-
from PIL.Image import Image
5+
from PIL import Image
66

77
_Frame: TypeAlias = Incomplete
8-
# _Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | _Tensor
8+
# _Frame: TypeAlias = Image.Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | _Tensor
99
_Pointer: TypeAlias = Incomplete
1010

1111
class CaptureOutputs(enum.Enum):
@@ -25,5 +25,5 @@ class CaptureOutput:
2525
def process(
2626
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
2727
) -> _Frame: ...
28-
def to_pil(self, frame: _Frame) -> Image: ...
28+
def to_pil(self, frame: _Frame) -> Image.Image: ...
2929
def stack(self, frames: list[_Frame], stack_dimension) -> _Frame: ...

stubs/D3DShot/d3dshot/capture_outputs/numpy_capture_output.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from _typeshed import Incomplete
22
from typing_extensions import TypeAlias
33

44
from d3dshot.capture_output import CaptureOutput as CaptureOutput
5-
from PIL.Image import Image
5+
from PIL import Image
66

77
# TODO: Complete types once we can import non-types dependencies
88
# See: https://github.com/python/typeshed/issues/5768
@@ -17,5 +17,5 @@ class NumpyCaptureOutput(CaptureOutput):
1717
def process(
1818
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
1919
) -> NDArray: ...
20-
def to_pil(self, frame: NDArray) -> Image: ...
20+
def to_pil(self, frame: NDArray) -> Image.Image: ...
2121
def stack(self, frames: list[NDArray] | NDArray, stack_dimension: int) -> NDArray: ...

stubs/D3DShot/d3dshot/capture_outputs/numpy_float_capture_output.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from _typeshed import Incomplete
22
from typing_extensions import TypeAlias
33

44
from d3dshot.capture_output import CaptureOutput as CaptureOutput
5-
from PIL.Image import Image
5+
from PIL import Image
66

77
# TODO: Complete types once we can import non-types dependencies
88
# See: https://github.com/python/typeshed/issues/5768
@@ -17,5 +17,5 @@ class NumpyFloatCaptureOutput(CaptureOutput):
1717
def process(
1818
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
1919
) -> NDArray: ...
20-
def to_pil(self, frame: NDArray) -> Image: ...
20+
def to_pil(self, frame: NDArray) -> Image.Image: ...
2121
def stack(self, frames: list[NDArray] | NDArray, stack_dimension: int) -> NDArray: ...

stubs/D3DShot/d3dshot/capture_outputs/pil_capture_output.pyi

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ from _typeshed import Incomplete
22
from typing_extensions import TypeAlias
33

44
from d3dshot.capture_output import CaptureOutput as CaptureOutput
5-
from PIL.Image import Image
5+
from PIL import Image
66

77
_Pointer: TypeAlias = Incomplete
88

99
class PILCaptureOutput(CaptureOutput):
1010
def __init__(self) -> None: ...
1111
def process(
1212
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
13-
) -> Image: ...
14-
def to_pil(self, frame: Image) -> Image: ...
15-
def stack(self, frames: list[Image], stack_dimension: int) -> list[Image]: ...
13+
) -> Image.Image: ...
14+
def to_pil(self, frame: Image.Image) -> Image.Image: ...
15+
def stack(self, frames: list[Image.Image], stack_dimension: int) -> list[Image.Image]: ...

stubs/D3DShot/d3dshot/capture_outputs/pytorch_capture_output.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from _typeshed import Incomplete
22
from typing_extensions import TypeAlias
33

44
from d3dshot.capture_output import CaptureOutput as CaptureOutput
5-
from PIL.Image import Image
5+
from PIL import Image
66

77
# TODO: Complete types once we can import non-types dependencies
88
# See: https://github.com/python/typeshed/issues/5768
@@ -15,5 +15,5 @@ class PytorchCaptureOutput(CaptureOutput):
1515
def process(
1616
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
1717
) -> _Tensor: ...
18-
def to_pil(self, frame: _Tensor) -> Image: ...
18+
def to_pil(self, frame: _Tensor) -> Image.Image: ...
1919
def stack(self, frames: list[_Tensor], stack_dimension: int) -> _Tensor: ...

stubs/D3DShot/d3dshot/capture_outputs/pytorch_float_capture_output.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from _typeshed import Incomplete
22
from typing_extensions import TypeAlias
33

44
from d3dshot.capture_output import CaptureOutput as CaptureOutput
5-
from PIL.Image import Image
5+
from PIL import Image
66

77
# TODO: Complete types once we can import non-types dependencies
88
# See: https://github.com/python/typeshed/issues/5768
@@ -15,5 +15,5 @@ class PytorchFloatCaptureOutput(CaptureOutput):
1515
def process(
1616
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
1717
) -> _Tensor: ...
18-
def to_pil(self, frame: _Tensor) -> Image: ...
18+
def to_pil(self, frame: _Tensor) -> Image.Image: ...
1919
def stack(self, frames: list[_Tensor], stack_dimension: int) -> _Tensor: ...

stubs/D3DShot/d3dshot/capture_outputs/pytorch_float_gpu_capture_output.pyi

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ from _typeshed import Incomplete
22
from typing_extensions import TypeAlias
33

44
from d3dshot.capture_output import CaptureOutput as CaptureOutput
5-
from PIL.Image import Image
5+
from PIL import Image
66

77
# TODO: Complete types once we can import non-types dependencies
88
# See: https://github.com/python/typeshed/issues/5768
99
# from torch import device, Tensor
1010
_Tensor: TypeAlias = Incomplete
11-
_device: TypeAlias = Incomplete
11+
_Device: TypeAlias = Incomplete
1212
_Pointer: TypeAlias = Incomplete
1313

1414
class PytorchFloatGPUCaptureOutput(CaptureOutput):
15-
device: _device
15+
device: _Device
1616
def __init__(self) -> None: ...
1717
def process(
1818
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
1919
) -> _Tensor: ...
20-
def to_pil(self, frame: _Tensor) -> Image: ...
20+
def to_pil(self, frame: _Tensor) -> Image.Image: ...
2121
def stack(self, frames: list[_Tensor], stack_dimension: int) -> _Tensor: ...

stubs/D3DShot/d3dshot/capture_outputs/pytorch_gpu_capture_output.pyi

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ from _typeshed import Incomplete
22
from typing_extensions import TypeAlias
33

44
from d3dshot.capture_output import CaptureOutput as CaptureOutput
5-
from PIL.Image import Image
5+
from PIL import Image
66

77
# TODO: Complete types once we can import non-types dependencies
88
# See: https://github.com/python/typeshed/issues/5768
99
# from torch import device, Tensor
1010
_Tensor: TypeAlias = Incomplete
11-
_device: TypeAlias = Incomplete
11+
_Device: TypeAlias = Incomplete
1212

1313
_Pointer: TypeAlias = Incomplete
1414

1515
class PytorchGPUCaptureOutput(CaptureOutput):
16-
device: _device
16+
device: _Device
1717
def __init__(self) -> None: ...
1818
def process(
1919
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
2020
) -> _Tensor: ...
21-
def to_pil(self, frame: _Tensor) -> Image: ...
21+
def to_pil(self, frame: _Tensor) -> Image.Image: ...
2222
def stack(self, frames: list[_Tensor], stack_dimension: int): ...

stubs/D3DShot/d3dshot/d3dshot.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from d3dshot.capture_output import CaptureOutput as CaptureOutput, CaptureOutput
66
from d3dshot.display import Display as Display
77

88
_Frame: TypeAlias = Incomplete
9-
# _Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | _Tensor
9+
# _Frame: TypeAlias = Image.Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | _Tensor
1010

1111
class D3DShot:
1212
displays: list[Display]

stubs/D3DShot/d3dshot/display.pyi

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
from _typeshed import Incomplete
22
from collections.abc import Callable
3-
from typing import Literal
4-
from typing_extensions import TypeAlias
3+
from typing_extensions import Literal, TypeAlias
54

65
_Frame: TypeAlias = Incomplete
7-
# _Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | _Tensor
6+
# _Frame: TypeAlias = Image.Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | _Tensor
87
_Pointer: TypeAlias = Incomplete
98

109
class Display:

stubs/D3DShot/d3dshot/dll/dxgi.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ from typing_extensions import TypeAlias
1010
_IUnknown: TypeAlias = Incomplete
1111

1212
_Frame: TypeAlias = Incomplete
13-
# _Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | Tensor
13+
# _Frame: TypeAlias = Image.Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | Tensor
1414
_Pointer: TypeAlias = Incomplete
1515

1616
class LUID(ctypes.Structure): ...

0 commit comments

Comments
 (0)