Skip to content

Commit a1a8107

Browse files
committed
Cover special case with NoneType in annotation
* fix warnings for setup.py
1 parent 41567d9 commit a1a8107

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

logwrap/repr_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ def _repr_callable(
250250
sig: inspect.Signature = inspect.signature(src)
251251
if sig.return_annotation is inspect.Parameter.empty:
252252
annotation: str = ""
253+
elif sig.return_annotation is type(None): # noqa: E721
254+
# Python 3.10 special case
255+
annotation = " -> None"
253256
else:
254257
annotation = f" -> {getattr(sig.return_annotation, '__name__', sig.return_annotation)!s}"
255258

setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ def run(self) -> None:
107107
except (
108108
distutils.errors.DistutilsPlatformError,
109109
FileNotFoundError,
110-
):
111-
raise BuildFailed()
110+
) as exc:
111+
raise BuildFailed() from exc
112112

113113
def build_extension(self, ext) -> None:
114114
"""build_extension.
@@ -122,8 +122,8 @@ def build_extension(self, ext) -> None:
122122
distutils.errors.DistutilsExecError,
123123
distutils.errors.DistutilsPlatformError,
124124
ValueError,
125-
):
126-
raise BuildFailed()
125+
) as exc:
126+
raise BuildFailed() from exc
127127

128128

129129
# noinspection PyUnresolvedReferences
@@ -224,6 +224,7 @@ def get_simple_vars_from_src(
224224
license=VARIABLES["__license__"],
225225
description=VARIABLES["__description__"],
226226
long_description=LONG_DESCRIPTION,
227+
long_description_content_type="text/x-rst",
227228
classifiers=CLASSIFIERS,
228229
keywords=KEYWORDS,
229230
python_requires=">=3.7.0",

0 commit comments

Comments
 (0)