From e8c1111d1312358d92aca410bb87a59b8b9e431f Mon Sep 17 00:00:00 2001 From: Michael Noseworthy Date: Thu, 17 Jan 2019 09:10:03 -0330 Subject: [PATCH] Fix `logging.getLevelName()` type hints (#2730) `logging.getLevelName()` can take either an `int` and returns a `str` or a `str` and returns an `int` when the level name (`str`) or level (`int`) is one of the registered log levels. If the value passed in isn't one of the registered log levels, it returns the string `"level %s" % lvl` where `lvl` is the value passed in to the function. --- stdlib/2and3/logging/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/2and3/logging/__init__.pyi b/stdlib/2and3/logging/__init__.pyi index 5fe9e19cc..dbbe200fb 100644 --- a/stdlib/2and3/logging/__init__.pyi +++ b/stdlib/2and3/logging/__init__.pyi @@ -348,7 +348,7 @@ fatal = critical def disable(lvl: int) -> None: ... def addLevelName(lvl: int, levelName: str) -> None: ... -def getLevelName(lvl: int) -> str: ... +def getLevelName(lvl: Union[int, str]) -> Any: ... def makeLogRecord(attrdict: Mapping[str, Any]) -> LogRecord: ...