Skip to content

Commit e8c1111

Browse files
noseworthysrittau
authored andcommitted
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.
1 parent 7869040 commit e8c1111

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/2and3/logging/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ fatal = critical
348348

349349
def disable(lvl: int) -> None: ...
350350
def addLevelName(lvl: int, levelName: str) -> None: ...
351-
def getLevelName(lvl: int) -> str: ...
351+
def getLevelName(lvl: Union[int, str]) -> Any: ...
352352

353353
def makeLogRecord(attrdict: Mapping[str, Any]) -> LogRecord: ...
354354

0 commit comments

Comments
 (0)