This repository has been archived by the owner on Apr 26, 2023. It is now read-only.
forked from Toufool/AutoSplit
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
from python/typeshed#8652
- Loading branch information
Showing
17 changed files
with
427 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from d3dshot.capture_output import CaptureOutputs as CaptureOutputs | ||
from d3dshot.d3dshot import D3DShot as D3DShot | ||
|
||
pil_is_available: bool | ||
numpy_is_available: bool | ||
pytorch_is_available: bool | ||
pytorch_gpu_is_available: bool | ||
capture_output_mapping: dict[str, CaptureOutputs] | ||
capture_outputs: list[str] | ||
|
||
|
||
def determine_available_capture_outputs() -> list[CaptureOutputs]: ... | ||
def create(capture_output: str = ..., frame_buffer_size: int = ...) -> D3DShot: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import enum | ||
from typing import Any | ||
|
||
from _typeshed import Incomplete | ||
from PIL.Image import Image | ||
from typing_extensions import TypeAlias | ||
|
||
Frame: TypeAlias = Any | ||
# Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | torch.Tensor | ||
Pointer: TypeAlias = Incomplete | ||
|
||
|
||
class CaptureOutputs(enum.Enum): | ||
PIL: int | ||
NUMPY: int | ||
NUMPY_FLOAT: int | ||
PYTORCH: int | ||
PYTORCH_FLOAT: int | ||
PYTORCH_GPU: int | ||
PYTORCH_FLOAT_GPU: int | ||
|
||
|
||
class CaptureOutputError(BaseException): | ||
... | ||
|
||
|
||
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: ... |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import numpy as np | ||
import numpy.typing as npt | ||
from _typeshed import Incomplete | ||
from d3dshot.capture_output import CaptureOutput as CaptureOutput | ||
from PIL.Image import Image | ||
from typing_extensions import TypeAlias | ||
|
||
Pointer: TypeAlias = Incomplete | ||
NDArray: TypeAlias = npt.NDArray[np.int32] | ||
|
||
|
||
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 | ||
) -> NDArray: ... | ||
def to_pil(self, frame: NDArray) -> Image: ... | ||
def stack(self, frames: list[NDArray] | NDArray, stack_dimension: int) -> NDArray: ... |
19 changes: 19 additions & 0 deletions
19
typings/d3dshot/capture_outputs/numpy_float_capture_output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import numpy as np | ||
import numpy.typing as npt | ||
from _typeshed import Incomplete | ||
from d3dshot.capture_output import CaptureOutput as CaptureOutput | ||
from PIL.Image import Image | ||
from typing_extensions import TypeAlias | ||
|
||
Pointer: TypeAlias = Incomplete | ||
NDArray: TypeAlias = npt.NDArray[np.float32] | ||
|
||
|
||
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 | ||
) -> NDArray: ... | ||
def to_pil(self, frame: NDArray) -> Image: ... | ||
def stack(self, frames: list[NDArray] | NDArray, stack_dimension: int) -> NDArray: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from _typeshed import Incomplete | ||
from d3dshot.capture_output import CaptureOutput as CaptureOutput | ||
from PIL.Image import Image | ||
from typing_extensions import TypeAlias | ||
|
||
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 | ||
) -> Image: ... | ||
def to_pil(self, frame: Image) -> Image: ... | ||
def stack(self, frames: list[Image], stack_dimension: int) -> list[Image]: ... |
17 changes: 17 additions & 0 deletions
17
typings/d3dshot/capture_outputs/pytorch_capture_output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import torch | ||
from _typeshed import Incomplete | ||
from d3dshot.capture_output import CaptureOutput as CaptureOutput | ||
from PIL.Image import Image | ||
from typing_extensions import TypeAlias | ||
|
||
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: ... |
17 changes: 17 additions & 0 deletions
17
typings/d3dshot/capture_outputs/pytorch_float_capture_output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import torch | ||
from _typeshed import Incomplete | ||
from d3dshot.capture_output import CaptureOutput as CaptureOutput | ||
from PIL.Image import Image | ||
from typing_extensions import TypeAlias | ||
|
||
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: ... |
18 changes: 18 additions & 0 deletions
18
typings/d3dshot/capture_outputs/pytorch_float_gpu_capture_output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import torch | ||
from _typeshed import Incomplete | ||
from d3dshot.capture_output import CaptureOutput as CaptureOutput | ||
from PIL.Image import Image | ||
from typing_extensions import TypeAlias | ||
|
||
Pointer: TypeAlias = Incomplete | ||
|
||
|
||
class PytorchFloatGPUCaptureOutput(CaptureOutput): | ||
device: Incomplete | ||
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: ... |
18 changes: 18 additions & 0 deletions
18
typings/d3dshot/capture_outputs/pytorch_gpu_capture_output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import torch | ||
from _typeshed import Incomplete | ||
from d3dshot.capture_output import CaptureOutput as CaptureOutput | ||
from PIL.Image import Image | ||
from typing_extensions import TypeAlias | ||
|
||
Pointer: TypeAlias = Incomplete | ||
|
||
|
||
class PytorchGPUCaptureOutput(CaptureOutput): | ||
device: torch.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): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from collections import deque | ||
from typing import Any | ||
|
||
from d3dshot.capture_output import CaptureOutput as CaptureOutput, CaptureOutputs as CaptureOutputs | ||
from d3dshot.display import Display as Display | ||
from typing_extensions import TypeAlias | ||
|
||
Frame: TypeAlias = Any | ||
# Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | torch.Tensor | ||
|
||
|
||
class D3DShot: | ||
displays: list[Display] | ||
display: Display | ||
capture_output: CaptureOutput | ||
frame_buffer_size: int | ||
frame_buffer: deque[Frame] | ||
previous_screenshot: Frame | None | ||
region: tuple[int, int, int, int] | None | ||
|
||
def __init__( | ||
self, | ||
capture_output: CaptureOutputs = ..., | ||
frame_buffer_size: int = ..., | ||
pil_is_available: bool = ..., | ||
numpy_is_available: bool = ..., | ||
pytorch_is_available: bool = ..., | ||
pytorch_gpu_is_available: bool = ..., | ||
) -> 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 screenshot_to_disk( | ||
self, directory: str | None = ..., file_name: str | None = ..., region: tuple[int, int, int, int] | None = ... | ||
) -> str: ... | ||
def frame_buffer_to_disk(self, directory: str | None = ...) -> None: ... | ||
def capture(self, target_fps: int = ..., region: tuple[int, int, int, int] | None = ...) -> bool: ... | ||
def screenshot_every(self, interval: float, region: tuple[int, int, int, int] | None = ...) -> bool: ... | ||
|
||
def screenshot_to_disk_every( | ||
self, interval: float, directory: str | None = ..., region: tuple[int, int, int, int] | None = ... | ||
) -> bool: ... | ||
def stop(self) -> bool: ... | ||
def benchmark(self) -> None: ... | ||
def detect_displays(self) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from collections.abc import Callable | ||
from typing import Any, Literal | ||
|
||
from _typeshed import Incomplete | ||
from typing_extensions import TypeAlias | ||
|
||
Frame: TypeAlias = Any | ||
# Frame: TypeAlias = Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | torch.Tensor | ||
Pointer: TypeAlias = Incomplete | ||
|
||
|
||
class Display: | ||
name: str | ||
adapter_name: str | ||
resolution: tuple[int, int] | ||
position: dict[Literal["left", "top", "right", "bottom"], int] | ||
rotation: int | ||
scale_factor: int | ||
is_primary: bool | ||
hmonitor: int | ||
dxgi_output: Incomplete | None | ||
dxgi_adapter: Incomplete | None | ||
d3d_device: Incomplete # ctypes.POINTER(ID3D11Device)() | ||
d3d_device_context: Incomplete # ctypes.POINTER(ID3D11DeviceContext)() | ||
dxgi_output_duplication: Incomplete # ctypes.POINTER(IDXGIOutputDuplication)() | ||
|
||
def __init__( | ||
self, | ||
name: str | None = ..., | ||
adapter_name: str | None = ..., | ||
resolution: tuple[int, int] | None = ..., | ||
position: dict[Literal["left", "top", "right", "bottom"], int] | None = ..., | ||
rotation: int | None = ..., | ||
scale_factor: int | None = ..., | ||
is_primary: bool = ..., | ||
hmonitor: int | None = ..., | ||
dxgi_output: Incomplete | None = ..., | ||
dxgi_adapter: Incomplete | None = ..., | ||
) -> None: ... | ||
|
||
def capture( | ||
self, | ||
# Incomplete: dxgi_mapped_rect.pBits | ||
process_func: Callable[[Pointer, int, int, int, tuple[int, int, int, int], int], Frame | None] | None, | ||
region: tuple[int, int, int, int] = ..., | ||
) -> Frame: ... | ||
@classmethod | ||
def discover_displays(cls) -> list[Display]: ... |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import ctypes | ||
|
||
import comtypes | ||
from _typeshed import Incomplete | ||
from typing_extensions import TypeAlias | ||
|
||
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 ID3D11Resource(ID3D11DeviceChild): | ||
... | ||
|
||
|
||
class ID3D11Texture2D(ID3D11Resource): | ||
... | ||
|
||
|
||
class ID3D11DeviceContext(ID3D11DeviceChild): | ||
... | ||
|
||
|
||
class ID3D11Device(comtypes.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: ... |
Oops, something went wrong.