Skip to content

Commit eae566d

Browse files
committed
refactor!(typings): Handmade changes after MonkeyTyping
1 parent 2cbcc00 commit eae566d

15 files changed

+527
-320
lines changed

docs/conf.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import sys
55
from os.path import dirname, relpath
66
from pathlib import Path
7-
from typing import Dict, List
7+
from typing import Dict, List, Union
88

99
import libtmux # NOQA
1010
from libtmux import test # NOQA
@@ -17,7 +17,7 @@
1717
sys.path.insert(0, str(cwd / "_ext"))
1818

1919
# package data
20-
about: Dict = {}
20+
about: Dict[str, str] = {}
2121
with open("../libtmux/__about__.py") as fp:
2222
exec(fp.read(), about)
2323

@@ -69,8 +69,8 @@
6969
html_css_files = ["css/custom.css"]
7070
html_extra_path = ["manifest.json"]
7171
html_theme = "furo"
72-
html_theme_path: List = []
73-
html_theme_options: Dict = {
72+
html_theme_path: List[str] = []
73+
html_theme_options: Dict[str, Union[str, List[Dict[str, str]]]] = {
7474
"light_logo": "img/libtmux.svg",
7575
"dark_logo": "img/libtmux.svg",
7676
"footer_icons": [
@@ -162,7 +162,9 @@
162162
intersphinx_mapping = {"http://docs.python.org/": None}
163163

164164

165-
def linkcode_resolve(domain, info): # NOQA: C901
165+
def linkcode_resolve(
166+
domain: str, info: Dict[str, str]
167+
) -> Union[None, str]: # NOQA: C901
166168
"""
167169
Determine the URL corresponding to Python object
168170
@@ -195,7 +197,8 @@ def linkcode_resolve(domain, info): # NOQA: C901
195197
except AttributeError:
196198
pass
197199
else:
198-
obj = unwrap(obj)
200+
if callable(obj):
201+
obj = unwrap(obj)
199202

200203
try:
201204
fn = inspect.getsourcefile(obj)

libtmux/_compat.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# flake8: NOQA
22
import sys
3+
import types
34
import typing as t
45

56
console_encoding = sys.__stdout__.encoding
@@ -14,7 +15,12 @@ def console_to_str(s: bytes) -> str:
1415

1516

1617
# TODO Consider removing, reraise does not seem to be called anywhere
17-
def reraise(tp, value, tb=None):
18+
def reraise(
19+
tp: t.Type[BaseException],
20+
value: BaseException,
21+
tb: types.TracebackType,
22+
) -> t.NoReturn:
23+
1824
if value.__traceback__ is not tb:
1925
raise (value.with_traceback(tb))
2026
raise value

0 commit comments

Comments
 (0)