Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ mss = "mss.__main__:main"
dev = [
"build==1.5.0",
"lxml==6.1.1",
"mypy==1.20.2",
"mypy==2.1.0",
"ruff==0.15.18",
"twine==6.2.0",
"typing_extensions==4.15.0",
Expand Down
4 changes: 3 additions & 1 deletion src/mss/linux/xlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
from mss.screenshot import ScreenShot

if TYPE_CHECKING:
from threading import Thread

from mss.models import CFunctions, Monitor, Monitors

__all__ = ()
Expand Down Expand Up @@ -259,7 +261,7 @@ class XWindowAttributes(Structure):
)


_ERROR = {}
_ERROR: dict[Thread, dict[str, Any]] = {}
_X11 = find_library("X11")
_XFIXES = find_library("Xfixes")
_XRANDR = find_library("Xrandr")
Expand Down
4 changes: 3 additions & 1 deletion src/mss/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def parse_edid(edid_data: bytes) -> dict:
return rv


def to_png(data: bytes, size: tuple[int, int], /, *, level: int = 6, output: Path | str | None = None) -> bytes | None:
def to_png(
data: bytes | memoryview[int], size: tuple[int, int], /, *, level: int = 6, output: Path | str | None = None
) -> bytes | None:
"""Dump data to a PNG file. If `output` is `None`, create no file but return
the whole PNG data.

Expand Down
2 changes: 1 addition & 1 deletion src/tests/bench_bgra2rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from mss.screenshot import ScreenShot


def mss_rgb(im: ScreenShot) -> bytes:
def mss_rgb(im: ScreenShot) -> memoryview:
return im.rgb


Expand Down
2 changes: 1 addition & 1 deletion src/tests/bench_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def grab(sct: MSS) -> ScreenShot:
return sct.grab(monitor)


def access_rgb(sct: MSS) -> bytes:
def access_rgb(sct: MSS) -> memoryview:
im = grab(sct)
return im.rgb

Expand Down
Loading