Skip to content

Commit 4dd9398

Browse files
committed
Fix some mypy errors
1 parent 2f984f6 commit 4dd9398

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

colorlog/colorlog.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def formatMessage(self, record: logging.LogRecord) -> str:
127127
"""Format a message from a record object."""
128128
escapes = self._escape_code_map(record.levelname)
129129
wrapper = ColoredRecord(record, escapes)
130-
message = super(ColoredFormatter, self).formatMessage(wrapper)
130+
message = super(ColoredFormatter, self).formatMessage(wrapper) # type: ignore
131131
message = self._append_reset(message, escapes)
132132
return message
133133

@@ -173,9 +173,7 @@ def _append_reset(self, message: str, escapes: EscapeCodes) -> str:
173173
class LevelFormatter:
174174
"""An extension of ColoredFormatter that uses per-level format strings."""
175175

176-
def __init__(
177-
self, fmt: typing.Mapping[str, typing.Mapping[str, str]], **kwargs: typing.Any
178-
) -> None:
176+
def __init__(self, fmt: typing.Mapping[str, str], **kwargs: typing.Any) -> None:
179177
"""
180178
Configure a ColoredFormatter with its own format string for each log level.
181179
@@ -201,7 +199,7 @@ def __init__(
201199
)
202200
"""
203201
self.formatters = {
204-
level: ColoredFormatter(fmt=fmt, **kwargs) for level, fmt in fmt.items()
202+
level: ColoredFormatter(fmt=f, **kwargs) for level, f in fmt.items()
205203
}
206204

207205
def format(self, record: logging.LogRecord) -> str:

colorlog/logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def basicConfig(
2222
) -> None:
2323
"""Call ``logging.basicConfig`` and override the formatter it creates."""
2424
logging.basicConfig(**kwargs)
25-
logging._acquireLock()
25+
logging._acquireLock() # type: ignore
2626
try:
2727
handler = logging.root.handlers[0]
2828
handler.setFormatter(
@@ -37,7 +37,7 @@ def basicConfig(
3737
)
3838
)
3939
finally:
40-
logging._releaseLock()
40+
logging._releaseLock() # type: ignore
4141

4242

4343
def ensure_configured(func):

0 commit comments

Comments
 (0)