Skip to content

Commit

Permalink
chore: Remove "type: ignore" comments as python/mypy#5887 is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Dec 20, 2021
1 parent f2e9da6 commit 68eb927
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions yapw/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Client(clients.Threaded, clients.Durable, clients.Blocking, clients.Base):
import threading
from collections import namedtuple
from types import FrameType
from typing import Any, Callable, List, Set, Tuple
from typing import Any, Callable, List, Optional, Set, Tuple

import pika

Expand Down Expand Up @@ -142,7 +142,7 @@ def __init__(
:param blocked_connection_timeout: the timeout, in seconds, that the connection may remain blocked
:param prefetch_count: the maximum number of unacknowledged deliveries that are permitted on the channel
"""
super().__init__(**kwargs) # type: ignore # https://github.com/python/mypy/issues/5887
super().__init__(**kwargs)

parameters = pika.URLParameters(url)
parameters.blocked_connection_timeout = blocked_connection_timeout # type: ignore # python/mypy#3186
Expand Down Expand Up @@ -274,7 +274,7 @@ def __init__(self, decode: Decode = default_decode, **kwargs: Any):
:param decode: the message body's decoder
"""
super().__init__(**kwargs) # type: ignore # https://github.com/python/mypy/issues/5887
super().__init__(**kwargs)

#: The message body's decoder.
self.decode = decode # type: Decode
Expand Down Expand Up @@ -313,7 +313,7 @@ def consume(self, callback: ConsumerCallback, routing_key: str, decorator: Decor
thread.join()
self.connection.close()

def _on_shutdown(self, signum: int, frame: FrameType) -> None:
def _on_shutdown(self, signum: int, frame: Optional[FrameType]) -> None:
install_signal_handlers(signal.SIG_IGN)
logger.info("Received %s, shutting down gracefully", signal_names[signum])
self.channel.stop_consuming()
4 changes: 2 additions & 2 deletions yapw/ossignal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copied and adapted from https://github.com/scrapy/scrapy/blob/master/scrapy/utils/ossignal.py
import signal
from types import FrameType
from typing import Callable, Union
from typing import Callable, Optional, Union

signal_names = {}
for signame in dir(signal):
Expand All @@ -11,7 +11,7 @@
signal_names[signum] = signame


def install_signal_handlers(function: Union[Callable[[int, FrameType], None], signal.Handlers]) -> None:
def install_signal_handlers(function: Union[Callable[[int, Optional[FrameType]], None], signal.Handlers]) -> None:
"""
Installs handlers for the SIGTERM, SIGINT, SIGUSR1 and SIGUSR2 signals.
Expand Down

0 comments on commit 68eb927

Please sign in to comment.