diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e1ea268..10ece8e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,7 +31,7 @@ repos: - id: trailing-whitespace - id: double-quote-string-fixer - repo: https://github.com/psf/black - rev: '23.12.1' + rev: '24.2.0' hooks: - id: black args: @@ -60,5 +60,5 @@ repos: - id: flake8 args: - "--ignore" - - "E501,E704,E301,W503" + - "E501,E704,E301,W503,E701" files: ahk\/(?!_sync).* diff --git a/_tests_setup.py b/_tests_setup.py index 34639b6..949b414 100644 --- a/_tests_setup.py +++ b/_tests_setup.py @@ -1,7 +1,4 @@ -""" -Not a real setup package -This is just to unasync our tests files -""" +# Not a real setup package. This is just to unasync our tests files import setuptools import unasync diff --git a/ahk/_async/transport.py b/ahk/_async/transport.py index 69b7e1e..1501b4c 100644 --- a/ahk/_async/transport.py +++ b/ahk/_async/transport.py @@ -58,8 +58,7 @@ T_SyncFuture = TypeVar('T_SyncFuture') -class AHKProtocolError(Exception): - ... +class AHKProtocolError(Exception): ... class AsyncFutureResult(Generic[T_AsyncFuture]): # unasync: remove @@ -191,8 +190,7 @@ def result(self, timeout: Optional[float] = None) -> T_SyncFuture: @runtime_checkable class Killable(Protocol): - def kill(self) -> None: - ... + def kill(self) -> None: ... def kill(proc: Killable) -> None: @@ -213,17 +211,14 @@ def async_assert_send_nonblocking_type_correct( class Communicable(Protocol): runargs: List[str] - def communicate(self, input_bytes: Optional[bytes], timeout: Optional[int] = None) -> Tuple[bytes, bytes]: - ... + def communicate(self, input_bytes: Optional[bytes], timeout: Optional[int] = None) -> Tuple[bytes, bytes]: ... async def acommunicate( # unasync: remove self, input_bytes: Optional[bytes], timeout: Optional[int] = None - ) -> Tuple[bytes, bytes]: - ... + ) -> Tuple[bytes, bytes]: ... @property - def returncode(self) -> Optional[int]: - ... + def returncode(self) -> Optional[int]: ... class AsyncAHKProcess: diff --git a/ahk/_async/window.py b/ahk/_async/window.py index d308083..656e0d9 100644 --- a/ahk/_async/window.py +++ b/ahk/_async/window.py @@ -25,8 +25,7 @@ from .transport import AsyncFutureResult -class WindowNotFoundException(Exception): - ... +class WindowNotFoundException(Exception): ... AsyncPropertyReturnStr: TypeAlias = Coroutine[None, None, str] # unasync: remove @@ -535,20 +534,16 @@ async def redraw(self, *, blocking: bool = True) -> Union[None, AsyncFutureResul ) @overload - async def set_style(self, style: str) -> bool: - ... + async def set_style(self, style: str) -> bool: ... @overload - async def set_style(self, style: str, *, blocking: Literal[True]) -> bool: - ... + async def set_style(self, style: str, *, blocking: Literal[True]) -> bool: ... @overload - async def set_style(self, style: str, *, blocking: Literal[False]) -> AsyncFutureResult[bool]: - ... + async def set_style(self, style: str, *, blocking: Literal[False]) -> AsyncFutureResult[bool]: ... @overload - async def set_style(self, style: str, *, blocking: bool = True) -> Union[bool, AsyncFutureResult[bool]]: - ... + async def set_style(self, style: str, *, blocking: bool = True) -> Union[bool, AsyncFutureResult[bool]]: ... async def set_style(self, style: str, *, blocking: bool = True) -> Union[bool, AsyncFutureResult[bool]]: return await self._engine.win_set_style( @@ -560,20 +555,16 @@ async def set_style(self, style: str, *, blocking: bool = True) -> Union[bool, A ) @overload - async def set_ex_style(self, style: str) -> bool: - ... + async def set_ex_style(self, style: str) -> bool: ... @overload - async def set_ex_style(self, style: str, *, blocking: Literal[False]) -> AsyncFutureResult[bool]: - ... + async def set_ex_style(self, style: str, *, blocking: Literal[False]) -> AsyncFutureResult[bool]: ... @overload - async def set_ex_style(self, style: str, *, blocking: Literal[True]) -> bool: - ... + async def set_ex_style(self, style: str, *, blocking: Literal[True]) -> bool: ... @overload - async def set_ex_style(self, style: str, *, blocking: bool = True) -> Union[bool, AsyncFutureResult[bool]]: - ... + async def set_ex_style(self, style: str, *, blocking: bool = True) -> Union[bool, AsyncFutureResult[bool]]: ... async def set_ex_style(self, style: str, *, blocking: bool = True) -> Union[bool, AsyncFutureResult[bool]]: return await self._engine.win_set_ex_style( @@ -585,20 +576,16 @@ async def set_ex_style(self, style: str, *, blocking: bool = True) -> Union[bool ) @overload - async def set_region(self, options: str) -> bool: - ... + async def set_region(self, options: str) -> bool: ... @overload - async def set_region(self, options: str, *, blocking: Literal[True]) -> bool: - ... + async def set_region(self, options: str, *, blocking: Literal[True]) -> bool: ... @overload - async def set_region(self, options: str, *, blocking: Literal[False]) -> AsyncFutureResult[bool]: - ... + async def set_region(self, options: str, *, blocking: Literal[False]) -> AsyncFutureResult[bool]: ... @overload - async def set_region(self, options: str, *, blocking: bool = True) -> Union[bool, AsyncFutureResult[bool]]: - ... + async def set_region(self, options: str, *, blocking: bool = True) -> Union[bool, AsyncFutureResult[bool]]: ... async def set_region(self, options: str, *, blocking: bool = True) -> Union[bool, AsyncFutureResult[bool]]: return await self._engine.win_set_region( diff --git a/ahk/_hotkey.py b/ahk/_hotkey.py index ba37863..9019497 100644 --- a/ahk/_hotkey.py +++ b/ahk/_hotkey.py @@ -158,8 +158,7 @@ def on_clipboard_change( self.restart() -class STOP: - ... +class STOP: ... class ThreadedHotkeyTransport(HotkeyTransportBase): @@ -453,8 +452,7 @@ def _validate(self) -> None: @runtime_checkable class Killable(Protocol): - def kill(self) -> None: - ... + def kill(self) -> None: ... def kill(proc: Killable) -> None: diff --git a/ahk/_sync/transport.py b/ahk/_sync/transport.py index 0766491..27cf3b7 100644 --- a/ahk/_sync/transport.py +++ b/ahk/_sync/transport.py @@ -57,8 +57,7 @@ T_SyncFuture = TypeVar('T_SyncFuture') -class AHKProtocolError(Exception): - ... +class AHKProtocolError(Exception): ... @@ -183,8 +182,7 @@ def result(self, timeout: Optional[float] = None) -> T_SyncFuture: @runtime_checkable class Killable(Protocol): - def kill(self) -> None: - ... + def kill(self) -> None: ... def kill(proc: Killable) -> None: @@ -205,13 +203,11 @@ def async_assert_send_nonblocking_type_correct( class Communicable(Protocol): runargs: List[str] - def communicate(self, input_bytes: Optional[bytes], timeout: Optional[int] = None) -> Tuple[bytes, bytes]: - ... + def communicate(self, input_bytes: Optional[bytes], timeout: Optional[int] = None) -> Tuple[bytes, bytes]: ... @property - def returncode(self) -> Optional[int]: - ... + def returncode(self) -> Optional[int]: ... class SyncAHKProcess: diff --git a/ahk/_sync/window.py b/ahk/_sync/window.py index 7c6f6f6..6576903 100644 --- a/ahk/_sync/window.py +++ b/ahk/_sync/window.py @@ -25,8 +25,7 @@ from .transport import FutureResult -class WindowNotFoundException(Exception): - ... +class WindowNotFoundException(Exception): ... SyncPropertyReturnStr: TypeAlias = str @@ -514,20 +513,16 @@ def redraw(self, *, blocking: bool = True) -> Union[None, FutureResult[None]]: ) @overload - def set_style(self, style: str) -> bool: - ... + def set_style(self, style: str) -> bool: ... @overload - def set_style(self, style: str, *, blocking: Literal[True]) -> bool: - ... + def set_style(self, style: str, *, blocking: Literal[True]) -> bool: ... @overload - def set_style(self, style: str, *, blocking: Literal[False]) -> FutureResult[bool]: - ... + def set_style(self, style: str, *, blocking: Literal[False]) -> FutureResult[bool]: ... @overload - def set_style(self, style: str, *, blocking: bool = True) -> Union[bool, FutureResult[bool]]: - ... + def set_style(self, style: str, *, blocking: bool = True) -> Union[bool, FutureResult[bool]]: ... def set_style(self, style: str, *, blocking: bool = True) -> Union[bool, FutureResult[bool]]: return self._engine.win_set_style( @@ -539,20 +534,16 @@ def set_style(self, style: str, *, blocking: bool = True) -> Union[bool, FutureR ) @overload - def set_ex_style(self, style: str) -> bool: - ... + def set_ex_style(self, style: str) -> bool: ... @overload - def set_ex_style(self, style: str, *, blocking: Literal[False]) -> FutureResult[bool]: - ... + def set_ex_style(self, style: str, *, blocking: Literal[False]) -> FutureResult[bool]: ... @overload - def set_ex_style(self, style: str, *, blocking: Literal[True]) -> bool: - ... + def set_ex_style(self, style: str, *, blocking: Literal[True]) -> bool: ... @overload - def set_ex_style(self, style: str, *, blocking: bool = True) -> Union[bool, FutureResult[bool]]: - ... + def set_ex_style(self, style: str, *, blocking: bool = True) -> Union[bool, FutureResult[bool]]: ... def set_ex_style(self, style: str, *, blocking: bool = True) -> Union[bool, FutureResult[bool]]: return self._engine.win_set_ex_style( @@ -564,20 +555,16 @@ def set_ex_style(self, style: str, *, blocking: bool = True) -> Union[bool, Futu ) @overload - def set_region(self, options: str) -> bool: - ... + def set_region(self, options: str) -> bool: ... @overload - def set_region(self, options: str, *, blocking: Literal[True]) -> bool: - ... + def set_region(self, options: str, *, blocking: Literal[True]) -> bool: ... @overload - def set_region(self, options: str, *, blocking: Literal[False]) -> FutureResult[bool]: - ... + def set_region(self, options: str, *, blocking: Literal[False]) -> FutureResult[bool]: ... @overload - def set_region(self, options: str, *, blocking: bool = True) -> Union[bool, FutureResult[bool]]: - ... + def set_region(self, options: str, *, blocking: bool = True) -> Union[bool, FutureResult[bool]]: ... def set_region(self, options: str, *, blocking: bool = True) -> Union[bool, FutureResult[bool]]: return self._engine.win_set_region( diff --git a/ahk/directives.py b/ahk/directives.py index 7e16b9b..dbb5482 100644 --- a/ahk/directives.py +++ b/ahk/directives.py @@ -1,6 +1,3 @@ -""" -Contains directive classes -""" from types import SimpleNamespace from typing import Any from typing import NoReturn diff --git a/ahk/keys.py b/ahk/keys.py index c978ce7..6eb0c85 100644 --- a/ahk/keys.py +++ b/ahk/keys.py @@ -1,6 +1,3 @@ -""" -The ahk.keys module contains some useful constants and classes for working with keys. -""" from __future__ import annotations from typing import Any @@ -115,8 +112,7 @@ def __repr__(self) -> str: @runtime_checkable class Stringable(Protocol): - def __str__(self) -> str: - ... + def __str__(self) -> str: ... class KeyModifier(Key): diff --git a/ahk/message.py b/ahk/message.py index a78206c..c9bf127 100644 --- a/ahk/message.py +++ b/ahk/message.py @@ -28,8 +28,7 @@ from typing import Union -class OutOfMessageTypes(Exception): - ... +class OutOfMessageTypes(Exception): ... Position = namedtuple('Position', ('x', 'y', 'width', 'height')) @@ -37,8 +36,7 @@ class OutOfMessageTypes(Exception): @runtime_checkable class BytesLineReadable(Protocol): - def readline(self) -> bytes: - ... + def readline(self) -> bytes: ... def is_window_control_list_response(resp_obj: object) -> TypeGuard[Tuple[str, List[Tuple[str, str]]]]: diff --git a/buildunasync.py b/buildunasync.py index d187ee8..d53b399 100644 --- a/buildunasync.py +++ b/buildunasync.py @@ -18,7 +18,7 @@ 'async_sleep': 'sleep', 'AsyncFutureResult': 'FutureResult', '_async_run_nonblocking': '_sync_run_nonblocking', - 'acommunicate': 'communicate' + 'acommunicate': 'communicate', # "__aenter__": "__aenter__", }, ),