Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalmat committed Dec 9, 2022
2 parents a64f366 + 5029b19 commit 65e8713
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ typing_extensions>=4.4.0

# Windows
pywin32>=302; sys_platform == 'win32'
types-pywin32>=304.0.0.4
types-pywin32>=305.0.0.3

# Linux
xlib>=0.21; sys_platform == 'linux'
Expand Down
3 changes: 2 additions & 1 deletion pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"reportImplicitStringConcatenation": "error",
"reportCallInDefaultInitializer": "error",
"reportPropertyTypeMismatch": "error",
"reportUnnecessaryTypeIgnoreComment": "error",
// type: ignore comments are meant for mypy
"reportUnnecessaryTypeIgnoreComment": "information",
"enableTypeIgnoreComments": false,
// False positives with TYPE_CHECKING and defered imports
"reportImportCycles": "information",
// As a library, we're allowed to use our own privates
Expand Down
22 changes: 11 additions & 11 deletions src/pywinctl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from collections.abc import Callable
from typing import Any, NamedTuple, cast

import pyrect # type: ignore[import] # TODO: Create type stubs or add to base library
import pyrect # type: ignore[import] # pyright: ignore[reportMissingTypeStubs] # TODO: Create type stubs or add to base library


__all__ = [
Expand Down Expand Up @@ -79,17 +79,17 @@ class Re:
# Does not play well with static typing and current implementation of TypedDict
_cond_dic: dict[int, Callable[[str | re.Pattern[str], str, float], bool]] = {
IS: lambda s1, s2, fl: s1 == s2,
CONTAINS: lambda s1, s2, fl: s1 in s2, # type: ignore
STARTSWITH: lambda s1, s2, fl: s2.startswith(s1), # type: ignore
ENDSWITH: lambda s1, s2, fl: s2.endswith(s1), # type: ignore
CONTAINS: lambda s1, s2, fl: s1 in s2, # type: ignore # pyright: ignore
STARTSWITH: lambda s1, s2, fl: s2.startswith(s1), # type: ignore # pyright: ignore
ENDSWITH: lambda s1, s2, fl: s2.endswith(s1), # type: ignore # pyright: ignore
NOTIS: lambda s1, s2, fl: s1 != s2,
NOTCONTAINS: lambda s1, s2, fl: s1 not in s2, # type: ignore
NOTSTARTSWITH: lambda s1, s2, fl: not s2.startswith(s1), # type: ignore
NOTENDSWITH: lambda s1, s2, fl: not s2.endswith(s1), # type: ignore
MATCH: lambda s1, s2, fl: bool(s1.search(s2)), # type: ignore
NOTMATCH: lambda s1, s2, fl: not (bool(s1.search(s2))), # type: ignore
EDITDISTANCE: lambda s1, s2, fl: _levenshtein(s1, s2) >= fl, # type: ignore
DIFFRATIO: lambda s1, s2, fl: difflib.SequenceMatcher(None, s1, s2).ratio() * 100 >= fl # type: ignore
NOTCONTAINS: lambda s1, s2, fl: s1 not in s2, # type: ignore # pyright: ignore
NOTSTARTSWITH: lambda s1, s2, fl: not s2.startswith(s1), # type: ignore # pyright: ignore
NOTENDSWITH: lambda s1, s2, fl: not s2.endswith(s1), # type: ignore # pyright: ignore
MATCH: lambda s1, s2, fl: bool(s1.search(s2)), # type: ignore # pyright: ignore
NOTMATCH: lambda s1, s2, fl: not (bool(s1.search(s2))), # type: ignore # pyright: ignore
EDITDISTANCE: lambda s1, s2, fl: _levenshtein(s1, s2) >= fl, # type: ignore # pyright: ignore
DIFFRATIO: lambda s1, s2, fl: difflib.SequenceMatcher(None, s1, s2).ratio() * 100 >= fl # type: ignore # pyright: ignore
}


Expand Down
4 changes: 2 additions & 2 deletions src/pywinctl/_pywinctl_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __remove_bad_windows(windows: Iterable[Window | None]):
"""
for window in windows:
try:
yield LinuxWindow(window) # type: ignore[arg-type,reportGeneralTypeIssues] # We expect an error here
yield LinuxWindow(window) # type: ignore[arg-type] # pyright: ignore[reportGeneralTypeIssues] # We expect an error here
except Xlib.error.XResourceError:
pass

Expand Down Expand Up @@ -808,7 +808,7 @@ def acceptInput(self, setTo: bool) -> None:
data = (32, [Xlib.Xutil.VisualScreenMask, 0, 0, 0, 0]) # it seems to work with any atom (like Xlib.Xutil.IconicState)
ev = Xlib.protocol.event.ClientMessage(window=self._hWnd.id, client_type=prop, data=data)
# TODO: Xlib stubs need to be updated to accept xobjects in structs/Requests, not just ids
DISP.send_event(destination=ROOT, event=ev, event_mask=mask) # type: ignore[call-overload] # pyright: ignore[reportGeneralTypeIssues]
DISP.send_event(destination=ROOT, event=ev, event_mask=mask) # type: ignore[call-overload]

def getAppName(self) -> str:
"""
Expand Down
2 changes: 1 addition & 1 deletion src/pywinctl/_pywinctl_macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ def isActive(self) -> bool:
return active is not None and active._app == self._app and active.title == self.title

@property
def title(self) -> str | None: # type: ignore[override]
def title(self) -> str | None: # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
"""
Get the current window title, as string.
IMPORTANT: window title may change. In that case, it will return None.
Expand Down
7 changes: 3 additions & 4 deletions src/pywinctl/_pywinctl_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,12 +709,11 @@ def acceptInput(self, setTo: bool) -> None:
:param setTo: True/False to toggle window transparent to input and focus
:return: None
"""
# These ignores will all be fixed by https://github.com/python/typeshed/pull/9308
exStyle = win32api.GetWindowLong(self._hWnd, win32con.GWL_EXSTYLE) # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]
exStyle = win32api.GetWindowLong(self._hWnd, win32con.GWL_EXSTYLE)
if setTo:
win32api.SetWindowLong(self._hWnd, win32con.GWL_EXSTYLE, exStyle & ~win32con.WS_EX_TRANSPARENT) # pyright: ignore[reportUnknownMemberType, reportUnknownArgumentType]
win32api.SetWindowLong(self._hWnd, win32con.GWL_EXSTYLE, exStyle & ~win32con.WS_EX_TRANSPARENT)
else:
win32api.SetWindowLong(self._hWnd, win32con.GWL_EXSTYLE, exStyle | win32con.WS_EX_TRANSPARENT) # pyright: ignore[reportUnknownMemberType, reportUnknownArgumentType]
win32api.SetWindowLong(self._hWnd, win32con.GWL_EXSTYLE, exStyle | win32con.WS_EX_TRANSPARENT)

def getAppName(self) -> str:
"""
Expand Down
2 changes: 1 addition & 1 deletion typings/Quartz/ImageKit/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# mypy: disable-error-code=type-arg
from typing import Any

import objc._lazyimport # type: ignore
import objc._lazyimport # type: ignore # pyright: ignore

IKCameraDeviceViewDisplayMode: Any
IKCameraDeviceViewTransferMode: Any
Expand Down
2 changes: 1 addition & 1 deletion typings/Quartz/PDFKit/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# mypy: disable-error-code=type-arg
from typing import Any

import objc._lazyimport # type: ignore
import objc._lazyimport # type: ignore # pyright: ignore

PDFAccessPermissions: Any
PDFActionNamedName: Any
Expand Down
8 changes: 4 additions & 4 deletions typings/Quartz/QuartzCore/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# mypy: disable-error-code=type-arg
from typing import Any, ClassVar

import objc # type: ignore
import objc._lazyimport # type: ignore
import objc # type: ignore # pyright: ignore
import objc._lazyimport # type: ignore # pyright: ignore

CAAnimationCalculationMode: Any
CAAnimationRotationMode: Any
Expand Down Expand Up @@ -49,7 +49,7 @@ r: Any
protocols: Any
expressions: Any

class CAFrameRateRange(objc._structwrapper): # type: ignore
class CAFrameRateRange(objc._structwrapper): # type: ignore # pyright: ignore
_fields: ClassVar[tuple] = ...
__match_args__: ClassVar[tuple] = ...
__typestr__: ClassVar[bytes] = ...
Expand All @@ -68,7 +68,7 @@ class CAFrameRateRange(objc._structwrapper): # type: ignore
def __setattr__(self, name, value) -> Any: ...
def __setitem__(self, index, object) -> Any: ...

class CATransform3D(objc._structwrapper): # type: ignore
class CATransform3D(objc._structwrapper): # type: ignore # pyright: ignore
_fields: ClassVar[tuple] = ...
__match_args__: ClassVar[tuple] = ...
__typestr__: ClassVar[bytes] = ...
Expand Down
2 changes: 1 addition & 1 deletion typings/Quartz/QuartzFilters/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pyright: reportUnknownParameterType=false, reportMissingParameterType=false, reportMissingTypeArgument=false
from typing import Any

import Foundation as Foundation # type: ignore
import Foundation as Foundation # type: ignore # pyright: ignore


def sel32or64(a, b): ...
Expand Down
2 changes: 1 addition & 1 deletion typings/Quartz/QuickLookUI/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# mypy: disable-error-code=type-arg
from typing import Any

import objc._lazyimport # type: ignore
import objc._lazyimport # type: ignore # pyright: ignore

QLPreviewViewStyle: Any
_ObjCLazyModule__aliases_deprecated: dict
Expand Down
2 changes: 1 addition & 1 deletion typings/Quartz/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://github.com/ronaldoussoren/pyobjc/issues/419
from typing import Any

import objc as objc # type: ignore
import objc as objc # type: ignore # pyright: ignore
from AppKit import *
from Quartz.CoreGraphics import *
from Quartz.CoreVideo import *
Expand Down

0 comments on commit 65e8713

Please sign in to comment.