Skip to content

Commit

Permalink
Enable warn_unreachable for remaining files in twisted.internet.
Browse files Browse the repository at this point in the history
  • Loading branch information
wsanchez committed Sep 25, 2020
1 parent c3e3f6a commit 6ebbae7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
6 changes: 0 additions & 6 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,6 @@ warn_unreachable = False
[mypy-twisted.conch.test.test_ssh]
warn_unreachable = False

[mypy-twisted.internet.defer]
warn_unreachable = False

[mypy-twisted.internet.test.test_endpoints]
warn_unreachable = False

[mypy-twisted.persisted.aot]
warn_unreachable = False

Expand Down
16 changes: 9 additions & 7 deletions src/twisted/internet/defer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@
"""


import attr
from asyncio import iscoroutine
from functools import wraps
from sys import exc_info, version_info
import traceback
import types
from typing import Optional
import warnings
from asyncio import iscoroutine
from sys import exc_info, version_info
from functools import wraps

import attr
from incremental import Version

# Twisted imports
from twisted.python.compat import cmp, comparable
from twisted.python import lockfile, failure
from twisted.logger import Logger
from twisted.python import lockfile, failure
from twisted.python.compat import cmp, comparable
from twisted.python.deprecate import warnAboutFunction, deprecated

try:
Expand Down Expand Up @@ -264,7 +266,7 @@ class Deferred:
# sets it directly.
debug = False

_chainedTo = None
_chainedTo = None # type: Optional[Deferred]

def __init__(self, canceller=None):
"""
Expand Down
6 changes: 3 additions & 3 deletions src/twisted/internet/test/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ def createServerEndpoint(self, reactor, factory, **listenArgs):
address = IPv4Address("TCP", "0.0.0.0", 0)

if listenArgs is None:
listenArgs = {}
listenArgs = {} # type: ignore[unreachable]

return (
endpoints.TCP4ServerEndpoint(reactor, address.port, **listenArgs),
Expand Down Expand Up @@ -1439,7 +1439,7 @@ def createServerEndpoint(self, reactor, factory, **listenArgs):
address = IPv6Address("TCP", interface, 0)

if listenArgs is None:
listenArgs = {}
listenArgs = {} # type: ignore[unreachable]

return (
endpoints.TCP6ServerEndpoint(reactor, address.port, **listenArgs),
Expand Down Expand Up @@ -2812,7 +2812,7 @@ def createClientEndpoint(self, reactor, clientFactory, **connectArgs):
address = IPv4Address("TCP", "localhost", 80)

if connectArgs is None:
connectArgs = {}
connectArgs = {} # type: ignore[unreachable]

return (
endpoints.SSL4ClientEndpoint(
Expand Down

0 comments on commit 6ebbae7

Please sign in to comment.