Skip to content

Commit

Permalink
Merge pull request #170 from jodal/dependabot/pip/mypy-tw-0.960
Browse files Browse the repository at this point in the history
build(deps-dev): update mypy requirement from ^0.942 to ^0.960
  • Loading branch information
jodal committed May 27, 2022
2 parents 83d6e22 + 6b7c950 commit 1ba21c3
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 49 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ flake8-bugbear = "^22.1.11"
flake8-isort = "^4.0.0"
flake8-pyi = "^22.1.0"
isort = "^5.9.2"
mypy = "^0.942"
mypy = "^0.960"
pytest = "^7.0.0"
pytest-cov = "^3.0.0"
pytest-mock = "^3.6.1"
Expand Down
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ warn_unused_ignores = True
warn_unused_configs = True
strict_equality = True

[mypy-importlib.*]
# importlib types are missing when running mypy on Python 3.7
ignore_missing_imports = True

[mypy-pykka.*]
disallow_untyped_defs = True

Expand Down
3 changes: 2 additions & 1 deletion src/pykka/_actor.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import threading
from collections.abc import Sequence
from types import TracebackType
from typing import Any, Dict, Sequence, Type
from typing import Any, Dict, Type

from typing_extensions import Protocol # Py38+: Available in ``typing``

Expand Down
6 changes: 3 additions & 3 deletions src/pykka/_envelope.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Any, Optional
from typing import Any

from pykka import Future

class Envelope:
message: Any
reply_to: Optional[Future]
def __init__(self, message: Any, reply_to: Optional[Future] = ...) -> None: ...
reply_to: Future | None
def __init__(self, message: Any, reply_to: Future | None = ...) -> None: ...
17 changes: 9 additions & 8 deletions src/pykka/_future.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Callable, Generator, Generic, Iterable, Optional, TypeVar
from collections.abc import Callable, Generator, Iterable
from typing import Any, Generic, TypeVar

from pykka._types import OptExcInfo

Expand All @@ -8,14 +9,14 @@ J = TypeVar("J") # For when T is Iterable[J] # noqa
_M = TypeVar("_M") # For Future.map()
_R = TypeVar("_R") # For Future.reduce()

GetHookFunc = Callable[[Optional[float]], _T]
GetHookFunc = Callable[[float | None], _T]

class Future(Generic[_T]):
_get_hook: Optional[GetHookFunc]
_get_hook_result: Optional[_T]
def get(self, timeout: Optional[float] = ...) -> _T: ...
def set(self, value: Optional[_T] = ...) -> None: ...
def set_exception(self, exc_info: Optional[OptExcInfo] = ...) -> None: ...
_get_hook: GetHookFunc | None
_get_hook_result: _T | None
def get(self, timeout: float | None = ...) -> _T: ...
def set(self, value: _T | None = ...) -> None: ...
def set_exception(self, exc_info: OptExcInfo | None = ...) -> None: ...
def set_get_hook(self, func: GetHookFunc) -> None: ...
def filter(
self: Future[Iterable[J]], func: Callable[[J], bool]
Expand All @@ -28,5 +29,5 @@ class Future(Generic[_T]):
def __await__(self) -> Generator[None, None, _T]: ...

def get_all(
futures: Iterable[Future[Any]], timeout: Optional[float] = ...
futures: Iterable[Future[Any]], timeout: float | None = ...
) -> Iterable[Any]: ...
19 changes: 4 additions & 15 deletions src/pykka/_proxy.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
from typing import (
Any,
Callable,
Dict,
NamedTuple,
Optional,
Sequence,
Tuple,
TypeVar,
Union,
)
from collections.abc import Callable, Sequence
from typing import Any, Dict, NamedTuple, Tuple, TypeVar

from pykka import Actor, ActorRef, Future

Expand All @@ -26,7 +17,7 @@ class ActorProxy:
_actor_proxies: Dict[AttrPath, ActorProxy]
_callable_proxies: Dict[AttrPath, CallableProxy]
def __init__(
self, actor_ref: ActorRef, attr_path: Optional[AttrPath] = ...
self, actor_ref: ActorRef, attr_path: AttrPath | None = ...
) -> None: ...
def _introspect_attributes(self) -> Dict[AttrPath, AttrInfo]: ...
def _is_exposable_attribute(self, attr_name: str) -> bool: ...
Expand All @@ -36,9 +27,7 @@ class ActorProxy:
def __eq__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
def __dir__(self) -> Dict[str, Any]: ...
def __getattr__(
self, name: str
) -> Union[CallableProxy, ActorProxy, Future[Any]]: ...
def __getattr__(self, name: str) -> CallableProxy | ActorProxy | Future[Any]: ...
def __setattr__(self, name: str, value: Any) -> None: ...

class CallableProxy:
Expand Down
18 changes: 8 additions & 10 deletions src/pykka/_ref.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import threading
from typing import Any, Optional, Type, Union, overload
from typing import Any, Type, overload

from typing_extensions import Literal

Expand All @@ -20,27 +20,25 @@ class ActorRef:
self,
message: Any,
block: Literal[False],
timeout: Optional[float] = ...,
timeout: float | None = ...,
) -> Future[Any]: ...
@overload # noqa: Allow redefinition
def ask(
self,
message: Any,
block: Literal[True],
timeout: Optional[float] = ...,
timeout: float | None = ...,
) -> Any: ...
@overload # noqa: Allow redefinition
def ask(
self, message: Any, block: bool = ..., timeout: Optional[float] = ...
) -> Union[Future[Any], Any]: ...
self, message: Any, block: bool = ..., timeout: float | None = ...
) -> Future[Any] | Any: ...
@overload
def stop(self, block: Literal[True], timeout: Optional[float]) -> bool: ...
def stop(self, block: Literal[True], timeout: float | None) -> bool: ...
@overload # noqa: Allow redefinition
def stop(
self, block: Literal[False], timeout: Optional[float] = ...
self, block: Literal[False], timeout: float | None = ...
) -> Future[bool]: ...
@overload # noqa: Allow redefinition
def stop(
self, block: bool, timeout: Optional[float] = ...
) -> Union[Future[bool], bool]: ...
def stop(self, block: bool, timeout: float | None = ...) -> Future[bool] | bool: ...
def proxy(self) -> ActorProxy: ...
14 changes: 7 additions & 7 deletions src/pykka/_registry.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import threading
from typing import Any, ClassVar, List, Optional, Type, Union, overload
from typing import Any, ClassVar, List, Type, overload

from typing_extensions import Literal # Py38+: Available in ``typing``

Expand All @@ -10,7 +10,7 @@ class ActorRegistry:
_actor_refs_lock: ClassVar[threading.RLock]
@classmethod
def broadcast(
cls, message: Any, target_class: Optional[Type[Actor]] = ...
cls, message: Any, target_class: Type[Actor] | None = ...
) -> None: ...
@classmethod
def get_all(cls) -> List[ActorRef]: ...
Expand All @@ -19,23 +19,23 @@ class ActorRegistry:
@classmethod
def get_by_class_name(cls, actor_class_name: str) -> List[ActorRef]: ...
@classmethod
def get_by_urn(cls, actor_urn: str) -> Optional[ActorRef]: ...
def get_by_urn(cls, actor_urn: str) -> ActorRef | None: ...
@classmethod
def register(cls, actor_ref: ActorRef) -> None: ...
@overload
@classmethod
def stop_all(
cls, block: Literal[True], timeout: Optional[float] = ...
cls, block: Literal[True], timeout: float | None = ...
) -> List[bool]: ...
@overload # noqa: Allow redefinition
@classmethod
def stop_all(
cls, block: Literal[False], timeout: Optional[float] = ...
cls, block: Literal[False], timeout: float | None = ...
) -> List[Future[bool]]: ...
@overload # noqa: Allow redefinition
@classmethod
def stop_all(
cls, block: bool = ..., timeout: Optional[float] = ...
) -> Union[List[bool], List[Future[bool]], List[Union[bool, Future[bool]]]]: ...
cls, block: bool = ..., timeout: float | None = ...
) -> List[bool] | List[Future[bool]] | List[bool | Future[bool]]: ...
@classmethod
def unregister(cls, actor_ref: ActorRef) -> None: ...
8 changes: 4 additions & 4 deletions src/pykka/_threading.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from queue import Queue
from typing import Any, ClassVar, NamedTuple, Optional
from typing import Any, ClassVar, NamedTuple

from pykka import Actor, Future
from pykka._types import OptExcInfo

class ThreadingFutureResult(NamedTuple):
value: Optional[Any] = ...
exc_info: Optional[OptExcInfo] = ...
value: Any | None = ...
exc_info: OptExcInfo | None = ...

class ThreadingFuture(Future):
_queue: Queue[ThreadingFutureResult]
_result: Optional[ThreadingFutureResult]
_result: ThreadingFutureResult | None

class ThreadingActor(Actor):
use_deamon_thread: ClassVar[bool]

0 comments on commit 1ba21c3

Please sign in to comment.