Fix mypy for platforms without epoll support. (#11771)

This commit is contained in:
Patrick Cloke 2022-01-19 11:50:09 -05:00 committed by GitHub
parent 7ad7a47e5a
commit c072c0b829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

1
changelog.d/11771.misc Normal file
View File

@ -0,0 +1 @@
Improve accuracy of `python_twisted_reactor_tick_time` prometheus metric.

View File

@ -35,7 +35,7 @@ tick_time = Histogram(
class EpollWrapper:
"""a wrapper for an epoll object which records the time between polls"""
def __init__(self, poller: "select.epoll"):
def __init__(self, poller: "select.epoll"): # type: ignore[name-defined]
self.last_polled = time.time()
self._poller = poller
@ -71,7 +71,7 @@ try:
# if the reactor has a `_poller` attribute, which is an `epoll` object
# (ie, it's an EPollReactor), we wrap the `epoll` with a thing that will
# measure the time between ticks
from select import epoll
from select import epoll # type: ignore[attr-defined]
poller = reactor._poller # type: ignore[attr-defined]
except (AttributeError, ImportError):