Skip to content

Commit

Permalink
Merge pull request twisted#1627 from graingert/fix-idna-type-annotation
Browse files Browse the repository at this point in the history
10229 type annotate twisted.internet._idna to fix CI
  • Loading branch information
graingert authored Jul 15, 2021
2 parents ba5cae9 + 2df3da1 commit 8e7255e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ check_untyped_defs = False
allow_untyped_defs = True
check_untyped_defs = False

[mypy-twisted.internet._idna]
allow_untyped_defs = True
check_untyped_defs = False

[mypy-twisted.internet._newtls]
allow_untyped_defs = True
check_untyped_defs = False
Expand Down
6 changes: 3 additions & 3 deletions src/twisted/internet/_idna.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""


def _idnaBytes(text):
def _idnaBytes(text: str) -> bytes:
"""
Convert some text typed by a human into some ASCII bytes.
Expand All @@ -24,14 +24,14 @@ def _idnaBytes(text):
@rtype: L{bytes}
"""
try:
import idna # type: ignore[import]
import idna
except ImportError:
return text.encode("idna")
else:
return idna.encode(text)


def _idnaText(octets):
def _idnaText(octets: bytes) -> str:
"""
Convert some IDNA-encoded octets into some human-readable text.
Expand Down
Empty file.

0 comments on commit 8e7255e

Please sign in to comment.