Skip to content

Commit

Permalink
Unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Aug 31, 2022
1 parent ba31840 commit 642d58b
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 93 deletions.
15 changes: 7 additions & 8 deletions stubs/D3DShot/d3dshot/capture_output.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import enum
from _typeshed import Incomplete
from typing import Any
from typing_extensions import TypeAlias

from PIL.Image import Image

Frame: TypeAlias = Any
# Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | torch.Tensor
Pointer: TypeAlias = Incomplete
_Frame: TypeAlias = Incomplete
# _Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | _Tensor
_Pointer: TypeAlias = Incomplete

class CaptureOutputs(enum.Enum):
PIL: int
Expand All @@ -24,7 +23,7 @@ class CaptureOutput:
backend: CaptureOutput
def __init__(self, backend: CaptureOutputs = ...) -> None: ...
def process(
self, pointer: Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> Frame: ...
def to_pil(self, frame: Frame) -> Image: ...
def stack(self, frames: list[Frame], stack_dimension) -> Frame: ...
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> _Frame: ...
def to_pil(self, frame: _Frame) -> Image: ...
def stack(self, frames: list[_Frame], stack_dimension) -> _Frame: ...
13 changes: 8 additions & 5 deletions stubs/D3DShot/d3dshot/capture_outputs/numpy_capture_output.pyi
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
from _typeshed import Incomplete
from typing_extensions import TypeAlias

import numpy as np
import numpy.typing as npt
from d3dshot.capture_output import CaptureOutput as CaptureOutput
from PIL.Image import Image

Pointer: TypeAlias = Incomplete
NDArray: TypeAlias = npt.NDArray[np.int32]
# TODO: Complete types once we can import non-types dependencies
# See: https://github.com/python/typeshed/issues/5768
# import numpy as np
# import numpy.typing as npt
# NDArray: TypeAlias = npt.NDArray[np.int32]
NDArray: TypeAlias = Incomplete
_Pointer: TypeAlias = Incomplete

class NumpyCaptureOutput(CaptureOutput):
def __init__(self) -> None: ...
def process(
self, pointer: Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> NDArray: ...
def to_pil(self, frame: NDArray) -> Image: ...
def stack(self, frames: list[NDArray] | NDArray, stack_dimension: int) -> NDArray: ...
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
from _typeshed import Incomplete
from typing_extensions import TypeAlias

import numpy as np
import numpy.typing as npt
from d3dshot.capture_output import CaptureOutput as CaptureOutput
from PIL.Image import Image

Pointer: TypeAlias = Incomplete
NDArray: TypeAlias = npt.NDArray[np.float32]
# TODO: Complete types once we can import non-types dependencies
# See: https://github.com/python/typeshed/issues/5768
# import numpy as np
# import numpy.typing as npt
# NDArray: TypeAlias = npt.NDArray[np.float32]
NDArray: TypeAlias = Incomplete
_Pointer: TypeAlias = Incomplete

class NumpyFloatCaptureOutput(CaptureOutput):
def __init__(self) -> None: ...
def process(
self, pointer: Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> NDArray: ...
def to_pil(self, frame: NDArray) -> Image: ...
def stack(self, frames: list[NDArray] | NDArray, stack_dimension: int) -> NDArray: ...
4 changes: 2 additions & 2 deletions stubs/D3DShot/d3dshot/capture_outputs/pil_capture_output.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ from typing_extensions import TypeAlias
from d3dshot.capture_output import CaptureOutput as CaptureOutput
from PIL.Image import Image

Pointer: TypeAlias = Incomplete
_Pointer: TypeAlias = Incomplete

class PILCaptureOutput(CaptureOutput):
def __init__(self) -> None: ...
def process(
self, pointer: Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> Image: ...
def to_pil(self, frame: Image) -> Image: ...
def stack(self, frames: list[Image], stack_dimension: int) -> list[Image]: ...
15 changes: 9 additions & 6 deletions stubs/D3DShot/d3dshot/capture_outputs/pytorch_capture_output.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
from _typeshed import Incomplete
from typing_extensions import TypeAlias

import torch
from d3dshot.capture_output import CaptureOutput as CaptureOutput
from PIL.Image import Image

Pointer: TypeAlias = Incomplete
# TODO: Complete types once we can import non-types dependencies
# See: https://github.com/python/typeshed/issues/5768
# from torch import Tensor
_Tensor: TypeAlias = Incomplete
_Pointer: TypeAlias = Incomplete

class PytorchCaptureOutput(CaptureOutput):
def __init__(self) -> None: ...
def process(
self, pointer: Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> torch.Tensor: ...
def to_pil(self, frame: torch.Tensor) -> Image: ...
def stack(self, frames: list[torch.Tensor], stack_dimension: int) -> torch.Tensor: ...
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> _Tensor: ...
def to_pil(self, frame: _Tensor) -> Image: ...
def stack(self, frames: list[_Tensor], stack_dimension: int) -> _Tensor: ...
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
from _typeshed import Incomplete
from typing_extensions import TypeAlias

import torch
from d3dshot.capture_output import CaptureOutput as CaptureOutput
from PIL.Image import Image

Pointer: TypeAlias = Incomplete
# TODO: Complete types once we can import non-types dependencies
# See: https://github.com/python/typeshed/issues/5768
# from torch import Tensor
_Tensor: TypeAlias = Incomplete
_Pointer: TypeAlias = Incomplete

class PytorchFloatCaptureOutput(CaptureOutput):
def __init__(self) -> None: ...
def process(
self, pointer: Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> torch.Tensor: ...
def to_pil(self, frame: torch.Tensor) -> Image: ...
def stack(self, frames: list[torch.Tensor], stack_dimension: int) -> torch.Tensor: ...
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> _Tensor: ...
def to_pil(self, frame: _Tensor) -> Image: ...
def stack(self, frames: list[_Tensor], stack_dimension: int) -> _Tensor: ...
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
from _typeshed import Incomplete
from typing_extensions import TypeAlias

import torch
from d3dshot.capture_output import CaptureOutput as CaptureOutput
from PIL.Image import Image

Pointer: TypeAlias = Incomplete
# TODO: Complete types once we can import non-types dependencies
# See: https://github.com/python/typeshed/issues/5768
# from torch import device, Tensor
_Tensor: TypeAlias = Incomplete
_device: TypeAlias = Incomplete
_Pointer: TypeAlias = Incomplete

class PytorchFloatGPUCaptureOutput(CaptureOutput):
device: Incomplete
device: _device
def __init__(self) -> None: ...
def process(
self, pointer: Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> torch.Tensor: ...
def to_pil(self, frame: torch.Tensor) -> Image: ...
def stack(self, frames: list[torch.Tensor], stack_dimension: int) -> torch.Tensor: ...
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> _Tensor: ...
def to_pil(self, frame: _Tensor) -> Image: ...
def stack(self, frames: list[_Tensor], stack_dimension: int) -> _Tensor: ...
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
from _typeshed import Incomplete
from typing_extensions import TypeAlias

import torch
from d3dshot.capture_output import CaptureOutput as CaptureOutput
from PIL.Image import Image

Pointer: TypeAlias = Incomplete
# TODO: Complete types once we can import non-types dependencies
# See: https://github.com/python/typeshed/issues/5768
# from torch import device, Tensor
_Tensor: TypeAlias = Incomplete
_device: TypeAlias = Incomplete

_Pointer: TypeAlias = Incomplete

class PytorchGPUCaptureOutput(CaptureOutput):
device: torch.device
device: _device
def __init__(self) -> None: ...
def process(
self, pointer: Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> torch.Tensor: ...
def to_pil(self, frame: torch.Tensor) -> Image: ...
def stack(self, frames: list[torch.Tensor], stack_dimension: int): ...
self, pointer: _Pointer, size: int, width: int, height: int, region: tuple[int, int, int, int], rotation: int
) -> _Tensor: ...
def to_pil(self, frame: _Tensor) -> Image: ...
def stack(self, frames: list[_Tensor], stack_dimension: int): ...
20 changes: 10 additions & 10 deletions stubs/D3DShot/d3dshot/d3dshot.pyi
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from _typeshed import Incomplete
from collections import deque
from typing import Any
from typing_extensions import TypeAlias

from d3dshot.capture_output import CaptureOutput as CaptureOutput, CaptureOutputs as CaptureOutputs
from d3dshot.display import Display as Display

Frame: TypeAlias = Any
# Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | torch.Tensor
_Frame: TypeAlias = Incomplete
# _Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | _Tensor

class D3DShot:
displays: list[Display]
display: Display
capture_output: CaptureOutput
frame_buffer_size: int
frame_buffer: deque[Frame]
previous_screenshot: Frame | None
frame_buffer: deque[_Frame]
previous_screenshot: _Frame | None
region: tuple[int, int, int, int] | None

def __init__(
Expand All @@ -28,11 +28,11 @@ class D3DShot:
) -> None: ...
@property
def is_capturing(self) -> bool: ...
def get_latest_frame(self) -> Frame | None: ...
def get_frame(self, frame_index: int) -> Frame | None: ...
def get_frames(self, frame_indices: list[int]) -> list[Frame]: ...
def get_frame_stack(self, frame_indices: list[int], stack_dimension: str | None = ...) -> Frame: ...
def screenshot(self, region: tuple[int, int, int, int] | None = ...) -> Frame | None: ...
def get_latest_frame(self) -> _Frame | None: ...
def get_frame(self, frame_index: int) -> _Frame | None: ...
def get_frames(self, frame_indices: list[int]) -> list[_Frame]: ...
def get_frame_stack(self, frame_indices: list[int], stack_dimension: str | None = ...) -> _Frame: ...
def screenshot(self, region: tuple[int, int, int, int] | None = ...) -> _Frame | None: ...
def screenshot_to_disk(
self, directory: str | None = ..., file_name: str | None = ..., region: tuple[int, int, int, int] | None = ...
) -> str: ...
Expand Down
12 changes: 6 additions & 6 deletions stubs/D3DShot/d3dshot/display.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Any, Literal
from typing import Literal
from typing_extensions import TypeAlias

Frame: TypeAlias = Any
# Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | torch.Tensor
Pointer: TypeAlias = Incomplete
_Frame: TypeAlias = Incomplete
# _Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | _Tensor
_Pointer: TypeAlias = Incomplete

class Display:
name: str
Expand Down Expand Up @@ -38,8 +38,8 @@ class Display:
def capture(
self,
# Incomplete: dxgi_mapped_rect.pBits
process_func: Callable[[Pointer, int, int, int, tuple[int, int, int, int], int], Frame | None] | None,
process_func: Callable[[_Pointer, int, int, int, tuple[int, int, int, int], int], _Frame | None] | None,
region: tuple[int, int, int, int] = ...,
) -> Frame: ...
) -> _Frame: ...
@classmethod
def discover_displays(cls) -> list[Display]: ...
17 changes: 10 additions & 7 deletions stubs/D3DShot/d3dshot/dll/d3d.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ import ctypes
from _typeshed import Incomplete
from typing_extensions import TypeAlias

import comtypes
# TODO: Complete types once we can import non-types dependencies
# See: https://github.com/python/typeshed/issues/5768
# import comtypes
_IUnknown: TypeAlias = Incomplete

Pointer: TypeAlias = Incomplete
_Pointer: TypeAlias = Incomplete

class DXGI_SAMPLE_DESC(ctypes.Structure): ...
class D3D11_BOX(ctypes.Structure): ...
class D3D11_TEXTURE2D_DESC(ctypes.Structure): ...
class ID3D11DeviceChild(comtypes.IUnknown): ...
class ID3D11DeviceChild(_IUnknown): ...
class ID3D11Resource(ID3D11DeviceChild): ...
class ID3D11Texture2D(ID3D11Resource): ...
class ID3D11DeviceContext(ID3D11DeviceChild): ...
class ID3D11Device(comtypes.IUnknown): ...
class ID3D11Device(_IUnknown): ...

def initialize_d3d_device(dxgi_adapter: Pointer) -> tuple[Pointer, Pointer]: ...
def describe_d3d11_texture_2d(d3d11_texture_2d: Pointer) -> D3D11_TEXTURE2D_DESC: ...
def prepare_d3d11_texture_2d_for_cpu(d3d11_texture_2d: Pointer, d3d_device: Pointer) -> Pointer: ...
def initialize_d3d_device(dxgi_adapter: _Pointer) -> tuple[_Pointer, _Pointer]: ...
def describe_d3d11_texture_2d(d3d11_texture_2d: _Pointer) -> D3D11_TEXTURE2D_DESC: ...
def prepare_d3d11_texture_2d_for_cpu(d3d11_texture_2d: _Pointer, d3d_device: _Pointer) -> _Pointer: ...
41 changes: 19 additions & 22 deletions stubs/D3DShot/d3dshot/dll/dxgi.pyi
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
import ctypes
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Any
from typing_extensions import TypeAlias

import comtypes
from d3dshot.dll.d3d import (
ID3D11Device as ID3D11Device,
ID3D11DeviceContext as ID3D11DeviceContext,
ID3D11Texture2D as ID3D11Texture2D,
prepare_d3d11_texture_2d_for_cpu as prepare_d3d11_texture_2d_for_cpu,
)
# TODO: Complete types once we can import non-types dependencies
# See: https://github.com/python/typeshed/issues/5768
# from torch import Tensor
# import comtypes
_IUnknown: TypeAlias = Incomplete

Frame: TypeAlias = Any
# Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | torch.Tensor
Pointer: TypeAlias = Incomplete
_Frame: TypeAlias = Incomplete
# _Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | Tensor
_Pointer: TypeAlias = Incomplete

class LUID(ctypes.Structure): ...
class DXGI_ADAPTER_DESC1(ctypes.Structure): ...
class DXGI_OUTPUT_DESC(ctypes.Structure): ...
class DXGI_OUTDUPL_POINTER_POSITION(ctypes.Structure): ...
class DXGI_OUTDUPL_FRAME_INFO(ctypes.Structure): ...
class DXGI_MAPPED_RECT(ctypes.Structure): ...
class IDXGIObject(comtypes.IUnknown): ...
class IDXGIObject(_IUnknown): ...
class IDXGIDeviceSubObject(IDXGIObject): ...
class IDXGIResource(IDXGIDeviceSubObject): ...
class IDXGISurface(IDXGIDeviceSubObject): ...
Expand All @@ -34,18 +31,18 @@ class IDXGIAdapter1(IDXGIAdapter): ...
class IDXGIFactory(IDXGIObject): ...
class IDXGIFactory1(IDXGIFactory): ...

def initialize_dxgi_factory() -> Pointer: ... # ctypes.POINTER(IDXGIFactory1)(handle.value)
def discover_dxgi_adapters(dxgi_factory: Pointer) -> list[Pointer]: ...
def describe_dxgi_adapter(dxgi_adapter: Pointer) -> Pointer: ...
def discover_dxgi_outputs(dxgi_adapter: Pointer) -> list[Pointer]: ...
def describe_dxgi_output(dxgi_output: Pointer) -> Pointer: ...
def initialize_dxgi_output_duplication(dxgi_output: Pointer, d3d_device: Pointer) -> Pointer: ...
def initialize_dxgi_factory() -> _Pointer: ... # ctypes.POINTER(IDXGIFactory1)(handle.value)
def discover_dxgi_adapters(dxgi_factory: _Pointer) -> list[_Pointer]: ...
def describe_dxgi_adapter(dxgi_adapter: _Pointer) -> _Pointer: ...
def discover_dxgi_outputs(dxgi_adapter: _Pointer) -> list[_Pointer]: ...
def describe_dxgi_output(dxgi_output: _Pointer) -> _Pointer: ...
def initialize_dxgi_output_duplication(dxgi_output: _Pointer, d3d_device: _Pointer) -> _Pointer: ...
def get_dxgi_output_duplication_frame(
dxgi_output_duplication: Pointer,
d3d_device: Pointer,
process_func: Callable[[Pointer, int, int, int, tuple[int, int, int, int], int], Frame | None] | None = ...,
dxgi_output_duplication: _Pointer,
d3d_device: _Pointer,
process_func: Callable[[_Pointer, int, int, int, tuple[int, int, int, int], int], _Frame | None] | None = ...,
width: int = ...,
height: int = ...,
region: tuple[int, int, int, int] | None = ...,
rotation: int = ...,
) -> Frame: ...
) -> _Frame: ...
4 changes: 2 additions & 2 deletions stubs/D3DShot/d3dshot/dll/user32.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import ctypes
from _typeshed import Incomplete
from typing_extensions import TypeAlias

Pointer: TypeAlias = Incomplete
_Pointer: TypeAlias = Incomplete

class DISPLAY_DEVICE(ctypes.Structure): ...

def get_display_device_name_mapping() -> dict[str, tuple[str, bool]]: ...
def get_hmonitor_by_point(x: int, y: int) -> Pointer: ... # ctypes.windll.user32.MonitorFromPoint(point, 0)
def get_hmonitor_by_point(x: int, y: int) -> _Pointer: ... # ctypes.windll.user32.MonitorFromPoint(point, 0)

0 comments on commit 642d58b

Please sign in to comment.